├── .gitignore ├── DIRECTIONS.md ├── LICENSE ├── Mini NES Wiring.png ├── README.md ├── TROUBLESHOOTING.md ├── buttons ├── Makefile ├── README.md ├── init │ └── nes_buttons ├── log.py ├── nes_buttons.py └── nes_buttons_daemon.py ├── nfc ├── Makefile ├── etc │ └── nfc_poll.conf ├── init │ └── nfc_poll ├── log.py ├── nfc_get_uid.c ├── nfc_poll.py ├── nfc_poll_daemon.py ├── nfcutils.c └── nfcutils.h ├── pcb-board ├── README.md ├── front-panel │ ├── front-panel-back.png │ ├── front-panel-front.png │ ├── front-panel.kicad_pcb │ ├── front-panel.pdf │ ├── front-panel.pro │ ├── front-panel.rules │ ├── front-panel.sch │ └── front-panel.xml └── main-board │ ├── main-board-back.png │ ├── main-board-front.png │ ├── main-board.kicad_pcb │ ├── main-board.pdf │ ├── main-board.pro │ ├── main-board.rules │ └── main-board.sch └── screen ├── Makefile ├── README.md ├── log.py ├── screen_manager.py └── update_autostart.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so* 3 | *.pyc 4 | nfc/nfc_get_uid 5 | -------------------------------------------------------------------------------- /DIRECTIONS.md: -------------------------------------------------------------------------------- 1 | # Mini NES Setup 2 | 3 | ## Prerequisites 4 | 5 | 1. Ensure Python 2.7 is working correctly and installed in `/usr/bin/python2.7` 6 | 2. `sudo apt-get install python-dev python-pip` 7 | 3. `sudo pip install python-daemon==2.2.4` (this is necessary to fix an issue with the latest release of python-daemon) 8 | 9 | ## Enable i2c device 10 | 1. `sudo mkdir /etc/nfc` 11 | 2. `sudo raspi-config` 12 | 3. Select "5 Interfacing" 13 | 4. Select "P5 I2C" 14 | 5. Select "\" 15 | 6. Exit `raspi-config` program 16 | 7. `sudo shutdown -r now` to reboot with i2c enabled. 17 | 18 | ## Install libnfc 19 | 1. Ensure you are logged in as `pi` and in the `/home/pi` directory. 20 | 2. `wget -O libnfc-1.7.1.tar.bz2 https://bintray.com/nfc-tools/sources/download_file?file_path=libnfc-1.7.1.tar.bz2` 21 | 3. `tar -xvf libnfc-1.7.1.tar.bz2` 22 | 4. `cd libnfc-1.7.1` 23 | 5. `./configure --prefix=/usr --sysconfdir=/etc --with-drivers=pn532_i2c` 24 | 6. `make` 25 | 7. `sudo make install` 26 | 8. After reboot, type `lsmod |grep i2c` and ensure that you see an `i2c_dev` in the list. 27 | 9. Also, type `ls /dev/i2c*` and ensure that `/dev/i2c-1` is returned. 28 | 29 | ## Configure libnfc 30 | 1. `sudo nano /etc/nfc/libnfc.conf` 31 | 2. Cut and paste the following and save the file. 32 | ``` 33 | # Allow device auto-detection (default: true) 34 | # Note: if this auto-detection is disabled, user has to manually set a device 35 | # configuration using file or environment variable 36 | allow_autoscan = true 37 | 38 | # Allow intrusive auto-detection (default: false) 39 | # Warning: intrusive auto-detection can seriously disturb other devices 40 | # This option is not recommended, so user should prefer to add manually his/her device. 41 | allow_intrusive_scan = false 42 | 43 | # Set log level (default: error) 44 | # Valid log levels are (in order of verbosity): 0 (none), 1 (error), 2 (info), 3 (debug) 45 | # Note: if you compiled with --enable-debug option, the default log level is "debug" 46 | log_level = 1 47 | 48 | # Manually set default device (no default) 49 | # To set a default device, users must set both name and connstring for their device 50 | # Note: if autoscan is enabled, default device will be the first device available in device list. 51 | device.name = "PN532" 52 | device.connstring = "pn532_i2c:/dev/i2c-1" 53 | ``` 54 | 3. Run `nfc-poll` and ensure you see `NFC reader: pn532_i2c:/dev/i2c-1 opened` 55 | 4. Try reading a tag, use Ctrl-C to stop or just wait 30 seconds 56 | 57 | ## Install nfc_poll 58 | 1. Ensure you are logged in as `pi` and in the `/home/pi` directory. 59 | 2. `export NFC_HOME=/home/pi/libnfc-1.7.1` 60 | 3. `git clone https://github.com/coderkevin/mini-nes.git` 61 | 4. `cd mini-nes/nfc` 62 | 5. `make` 63 | 6. `sudo make install` 64 | 7. Run `systemctl status nfc_poll` and ensure you see "Active: active (running)" in the output 65 | 66 | ## Configure your cartridges 67 | 68 | In this system, the cartridges don't need to be written to, we configure a mapping to their UIDs, which should already be uniquely pre-programmed to each tag. 69 | 70 | ### Record your NFC tag UIDs 71 | 1. Run `tail -f /dev/shm/nfc_poll.log` 72 | 2. Place a cartridge (NFC tag) over the reader, the log should output "Reading NFC UID: 00000000000000" where the zeroes are the UID of the tag. 73 | 3. Copy/paste the UID into a text file. 74 | 4. Continue with all tags you wish to use. 75 | 5. To exit the log, hit \-C 76 | 77 | ### Record your desired games 78 | 1. `cd ~/RetroPie/roms` 79 | 2. Start typing `ls /` (e.g. `ls nes/Super`) to find the rom you want. Hit tab to complete the file, or hit tab twice to show possible matches. Don't forget to backslash things like spaces and parenthesis as you go. 80 | 3. After you finally tab through to the complete file, hit . 81 | 4. Copy the resulting line and put it and put it next to the UID you want to use in your text file. (`e.g. nes/Super Mario Bros. (JU) [!].zip`) Make sure you don't have backslashes here. 82 | 5. Repeat this process 83 | 84 | ### Write your cartridges in the config 85 | 1. `sudo nano /etc/nfc_poll/nfc_poll.conf` 86 | 2. At the bottom of the file, there's a `[Cartridges]` section. 87 | 3. For each cartridge you want, add a line in this format: ` = ` (e.g. `00000000000000 = nes/Super Mario Bros. (JU) [!].zip`) 88 | 4. `sudo systemctl restart nfc_poll` 89 | 5. Try it out! Place one of your cartridges on the reader and the screen should go black for a couple seconds, then bring up your game. Remove it and it should go back to the dashboard. 90 | 91 | ## Install nes_buttons 92 | 1. Ensure you are logged in as `pi` and in the `/home/pi` directory. 93 | 2. (If you haven't already) `git clone https://github.com/coderkevin/mini-nes.git` 94 | 3. `cd mini-nes/buttons` 95 | 4. `sudo make install` 96 | 5. Run `systemctl status nes_buttons` and ensure you see "Active: active (running)" in the output 97 | 6. From here, you should be able to depress the power button to release it, and the LED should stay lit until the shutdown completes, then turn off. At this point, your RPi CPU is completely off. Now press the power button to latch it, and the RPi should come back up. A reset will simply send a `shutdown -r now` instead and reboot the system. 98 | 99 | ## Install screen_manager 100 | 1. Ensure you are logged in as `pi` and in the `/home/pi` directory. 101 | 2. (If you haven't already) `git clone https://github.com/coderkevin/mini-nes.git` 102 | 3. `cd mini-nes/screen` 103 | 4. `sudo make install` 104 | 5. Restart your Pi (try the reset button!) and if you've done all the steps above, everything should be working! 105 | 106 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Mini NES Wiring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderkevin/mini-nes/5b6a0ac12719177fa43fabb03cbf7ab6c81edf06/Mini NES Wiring.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mini-nes 2 | Support code for my version of a RPi-based Mini NES 3 | 4 | This is based on/inspired by [DaftMike's NESPi](http://www.daftmike.com/2016/07/NESPi.html) 5 | It is compatible with the 3D printed parts, but the hardware set up is simplified: 6 | 7 | - No Arduino board needed, only the Raspberry Pi 8 | - No power board support (In CPU shutdown, the RPi uses less power than the USB power supply you're using to power it) 9 | - No fan support (buy good heatsinks, you likely won't miss the fan) 10 | 11 | Here's a more detailed list of the features: 12 | 13 | ## Latching Power Button 14 | 15 | The Power button is handled via GPIO and reset pin on the RPi. 16 | The power button, when latched, brings the reset pin high, awakening the RPi from its shutdown. 17 | After the RPi is powered up, a script is used on an output GPIO pin to hold the reset pin high in addition to the power button. 18 | When the power button is unlatched, the GPIO holds the reset pin high until system shutdown completes. 19 | 20 | ## Power LED 21 | 22 | The Power LED is connected to the reset pin, this indicates the true run state of the RPi. If the reset pin is high, the RPi is running. If the reset pin is low, then the RPi is held in reset and the CPU is in shutdown. It looks a little strange to see the power LED remain lit for a few seconds after unlatching the power button, but it is reassuring to know that the RPi isn't being subjected to a hard reset. 23 | 24 | ## Reset Button 25 | 26 | The Reset button is connected to an RPi GPIO and simply does a system reboot. 27 | 28 | ## NFC Cartidge support 29 | 30 | The NFC Reader is a PN532 running on the RPi's i2c interface. I've made a simple c interface to Python to utilize it. No Arduino or microcontroller needed to use it. 31 | 32 | ## No NFC tag writing needed 33 | 34 | This system is designed to simply rely on the unique IDs already imprinted on your NFC tags. It uses a configuration file to map those UIDs to the correct game files to be run. 35 | 36 | ## Immediate loading of games 37 | 38 | The system doesn't have to be powered off to start a game. It continually scans for cartridges and will restart Emulation Station as soon as a cart is installed. Don't worry if you like the feel of the old process though. You can still power off the system and install your cart and power it back on if you like. 39 | 40 | -------------------------------------------------------------------------------- /TROUBLESHOOTING.md: -------------------------------------------------------------------------------- 1 | # Mini NES Troubleshooting Guide 2 | 3 | Things not working the way they should? Check here for some tactics on diagnosing your problem. 4 | 5 | ## Power Buttons 6 | 7 | ### Software 8 | 9 | - Program: `nes_buttons` daemon (should be running on system startup) 10 | - How to start: `sudo systemctl start nes_buttons` 11 | - How to stop: `sudo systemctl stop nes_buttons` 12 | - How to check the log: `cat /dev/shm/nes_buttons.log` 13 | 14 | If the system daemon isn't behaving the way you'd expect, you can run the code manually. 15 | 16 | 1. `sudo systemctl stop nes_buttons` 17 | 2. Change your directory to the `buttons` subdirectory of the source. 18 | 3. `python nes_buttons.py` 19 | 4. Logging output should be visible on the command line. (If you see a "RuntimeWarning" about a channel already in use, that's okay.) 20 | 5. Press the reset button. You should see logging output about restarting. 21 | 22 | ### Electrical 23 | 24 | If your power isn't shuttting down and starting back up correctly, here are a couple things to check: 25 | 26 | 1. Ensure the power button is unlatched and then plug in the RPi power. 27 | 2. Use a multimeter to test for voltage on RUN pin #1. It should be around 0.5v or less. 28 | 3. Press the power button to latch it. 29 | 4. The LED should turn on, indicating that RUN pin #1 has risen in voltage. 30 | 5. The system should power up as normal. 31 | 32 | If your RPi turns off but not back on, it's likely because the RUN pin isn't pulled low enough before rising back to 3.3v. On my RPi 3, a 10k is enough to drop the RUN pin to 0.5v. Check with a multimeter when the device is plugged in, but the power button is not on. If it's too high, then try a lower value resistor. Something between 10k down to 1k should work. When you try out a different resistor, test the voltage, then try the behavior. 33 | 34 | 35 | ## NFC Reader 36 | 37 | ### Software 38 | 39 | - Program: `nfc_poll` daemon (should be running on system startup) 40 | - How to start: `sudo systemctl start nfc_poll` 41 | - How to stop: `sudo systemctl stop nfc_poll` 42 | - How to check the log: `cat /dev/shm/nfc_poll.log` 43 | 44 | If the system daemon isn't behaving the way you'd expect, you can run the code manually. 45 | 46 | 1. `sudo systemctl stop nfc_poll` 47 | 2. Change your directory to the `nfc` subdirectory of the source. 48 | 3. `python nfc_poll.py` 49 | 4. Logging output should be visible on the command line. 50 | 5. Try placing a cartridge over the sensor and watch for output. 51 | 52 | ### Electrical 53 | 54 | If your nfc reader isn't working correctly, it should show up in the logs. If you suspect it's electrical, here are some things to check: 55 | 56 | 1. There are two small DIP switches on the NFC board to select the mode. Ensure they're set correctly for i2c. 57 | 2. Ensure the correct pins are connected to the RPi header and the NFC board. Revisit the wiring diagram for this. 58 | 3. The red LED on the NFC board should be on any time the RPi header is plugged in. 59 | 60 | 61 | ## Screen Manager 62 | 63 | ### Software 64 | 65 | - Script: `/var/lib/screen_manager/screen_manager.py` (called by autostart.sh) 66 | - How to check the log: `cat /dev/shm/screen_manager.log` 67 | 68 | This script should be fairly stable and shouldn't have too many problems. If emulationstation is running on startup, then this script is running. 69 | 70 | The installation for this script modifies `/opt/retropie/configs/all/autostart.sh`. It comments out emulationstation and adds `python screen_manager.py` instead. If this is causing problems, you can edit this file and restore default operation there. 71 | 72 | You can run this script manually just like the others, but you'll want to disable it in `autostart.sh` before you do. 73 | 74 | To test: 75 | 76 | 1. Edit the config file at `cat /dev/shm/screen_manager.cfg` in accordance with [the screen readme](https://github.com/coderkevin/mini-nes/blob/master/screen/README.md) 77 | 2. Try a `dashboard` action. 78 | 3. Try a `rom` action. 79 | 4. Try deleting the file to ensure the default dashboard action runs. 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /buttons/Makefile: -------------------------------------------------------------------------------- 1 | # Builds nes buttons support code for mini-nes 2 | # 3 | 4 | INSTALL_PREFIX := /usr 5 | VAR_WORK_DIR := /var/lib/nes_buttons 6 | INIT_DIR := /etc/init.d 7 | 8 | .PHONY: install 9 | 10 | install: 11 | -pip install python-daemon 12 | install -m 0755 *.py -D -t $(VAR_WORK_DIR) 13 | install -m 0755 init/nes_buttons -D -t $(INIT_DIR) 14 | -systemctl enable nes_buttons 15 | -systemctl daemon-reload 16 | -systemctl start nes_buttons 17 | 18 | -------------------------------------------------------------------------------- /buttons/README.md: -------------------------------------------------------------------------------- 1 | # Mini NES Power Buttons 2 | 3 | This software is designed to work with two buttons: 4 | 5 | 1. A latching DPDT "Power" switch. 6 | 2. A momentary "Reset" switch. 7 | 8 | ## Reset Switch 9 | 10 | This one is easy, it's simply connected to a GPIO and when pressed, the `nes_buttons` daemon issues the `shutdown -r now` command to reboot the system. 11 | 12 | ## Power Switch 13 | 14 | This one is a little trickier. The goal of powering down the system in this way is to ensure as low power usage as possible. For this to happen, the main CPU has to be shut down. That's done easily enough via a `shutdown -h now` command, but in order for the RPi to start back up from that state, the "RUN" pin has to be toggled. 15 | 16 | The key part of this system is the RUN pin. This is pin 1 of the RUN header. It sits at 3.3v normally, but if it's pulled down low, it does a hard reset of the RPi. And then it must rise back up to 3.3v for the RPi to start back up. 17 | 18 | The theory behind this system is: 19 | 20 | 1. A pull-down resistor (10k) is used to pull the RUN pin down by default. This holds the RPi in reset until you push the power button. 21 | 2. When you push the latching power button, it supplies 3.3v to the RUN pin. This brings the RPi out of reset and it boots up. 22 | 3. Upon startup, the `nes_buttons` daemon sets a GPIO to also supply 3.3v to the RUN pin. This ensures the RPi doesn't do a hard reset when you release the latching power button. 23 | 4. When you push the latching power button, it no longer supplies 3.3v to the RUN pin, but the RPi doesn't go into reset because the GPIO is still holding it up to 3.3v. However, the other pins on the power button let the `nes_buttons` daemon know that the power button was released. This runs the `shutdown -h now` command. 24 | 5. The RPi then begins the shutdown process as normal, doing critical things like ensuring all the writes to the SD card are completed (this is why it's bad to pull power on a Pi). 25 | 6. At some point in the shutdown process, the GPIO system is shut down. When this happens, the GPIO that was holding up the RUN pin to 3.3v falls. 26 | 7. Given that there is nothing supplying voltage to the RUN pin, the pull-down resistor takes over and pulls the RUN pin to ground. (on my RPi 3 with a 10k resistor, it is about 0.5v) 27 | 28 | -------------------------------------------------------------------------------- /buttons/init/nes_buttons: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # nes_buttons Startup script for nes_buttons_daemon 4 | # 5 | # config: /etc/nes_buttons/nes_buttons.conf 6 | # pidfile: /var/run/nes_buttons.pid 7 | # logfile: /dev/shm/nes_buttons.log 8 | # 9 | ### BEGIN INIT INFO 10 | # Provides: nes_buttons_daemon 11 | # Required-Start: udev mountkernfs $local_fs 12 | # Required-Stop: $local_fs 13 | # Default-Start: S 14 | # Default-Stop: 15 | # Short-Description: start and stop nes_buttons server 16 | # Description: nes_buttons manages the power/reset buttons. 17 | ### END INIT INFO 18 | 19 | # Source function library. 20 | . /lib/lsb/init-functions 21 | 22 | nes_buttons_daemon=/var/lib/nes_buttons/nes_buttons_daemon.py 23 | prog=nes_buttons_daemon 24 | pidfile=/var/run/nes_buttons.pid 25 | logfile=/dev/shm/nes_buttons.log 26 | RETVAL=0 27 | 28 | NES_BUTTONS_OPTS="-p $pidfile -l $logfile" 29 | 30 | case "$1" in 31 | start) 32 | log_daemon_msg "Starting $prog: " 33 | if start-stop-daemon --start --quiet --oknodo --pidfile $pidfile --exec $nes_buttons_daemon -- $NES_BUTTONS_OPTS ; then 34 | log_end_msg 0 35 | else 36 | log_end_msg 1 37 | fi 38 | ;; 39 | stop) 40 | log_daemon_msg "Stopping $prog: " 41 | if start-stop-daemon --stop --quiet --oknodo --pidfile $pidfile ; then 42 | log_end_msg 0 43 | else 44 | log_end_msg 1 45 | fi 46 | ;; 47 | status) 48 | status_of_proc -p $pidfile $nes_buttons_daemon $prog && exit 0 || exit $? 49 | ;; 50 | restart) 51 | log_daemon_msg "Restarting $prog: " 52 | stop-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $pidfile 53 | if start-stop-daemon --start --quiet --oknodo --pidfile $pidfile --exec $nes_buttons_daemon -- $NES_BUTTONS_OPTS ; then 54 | log_end_msg 0 55 | else 56 | log_end_msg 1 57 | fi 58 | ;; 59 | force-reload|reload) 60 | reload 61 | ;; 62 | *) 63 | log_action_msg "Usage: $prog {start|stop|restart|force-reload|reload|status}" 64 | exit 1 65 | esac 66 | 67 | -------------------------------------------------------------------------------- /buttons/log.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import logging 3 | 4 | def initLogger( logLevel, logFormat, logFile = None ): 5 | logger = logging.getLogger( 'NESButtons' ) 6 | logger.setLevel( logLevel ) 7 | 8 | logHandler = None 9 | 10 | if logFile: 11 | logHandler = logging.FileHandler( logFile ) 12 | else: 13 | logHandler = logging.StreamHandler( sys.stdout ) 14 | 15 | logHandler.setLevel( logLevel ) 16 | logHandler.setFormatter( logging.Formatter( logFormat ) ) 17 | logger.addHandler( logHandler ) 18 | 19 | return logger 20 | 21 | -------------------------------------------------------------------------------- /buttons/nes_buttons.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | 3 | import sys 4 | import time 5 | import subprocess 6 | import traceback 7 | import log 8 | import logging 9 | import RPi.GPIO as GPIO 10 | 11 | # Pin Mappings 12 | RESET_SENSE_PIN = 11 13 | POWER_SENSE_PIN = 13 14 | POWER_HOLD_PIN = 15 15 | 16 | class NESButtons(): 17 | def __init__( self, logger ): 18 | self.logger = logger 19 | self.mode = 'init' 20 | 21 | self.logger.info( "Initializing NES button controls" ) 22 | 23 | GPIO.setmode( GPIO.BOARD ) 24 | GPIO.setup( RESET_SENSE_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN ) 25 | GPIO.setup( POWER_SENSE_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN ) 26 | GPIO.setup( POWER_HOLD_PIN, GPIO.OUT ) 27 | 28 | # This is the only thing that keeps the RPi alive after the 29 | # power button is released. We never turn this pin low because 30 | # the system will hard-reset if we do. We wait for shutdown 31 | # to take down the GPIO system with it. 32 | GPIO.output( POWER_HOLD_PIN, GPIO.HIGH ) 33 | 34 | self.addHandlers() 35 | 36 | def addHandlers( self ): 37 | GPIO.add_event_detect( 38 | RESET_SENSE_PIN, 39 | GPIO.RISING, 40 | callback=self.resetPressed, 41 | bouncetime=500 42 | ) 43 | 44 | GPIO.add_event_detect( 45 | POWER_SENSE_PIN, 46 | GPIO.FALLING, 47 | callback=self.powerPressed, 48 | bouncetime=500 49 | ) 50 | 51 | def removeHandlers( self ): 52 | GPIO.remove_event_detect( RESET_SENSE_PIN ) 53 | GPIO.remove_event_detect( POWER_SENSE_PIN ) 54 | 55 | def run( self ): 56 | self.mode = 'run' 57 | 58 | while True: 59 | time.sleep(5) 60 | if 'run' != self.mode: 61 | self.logger.info( "{}ing...".format( self.mode ) ) 62 | 63 | def resetPressed( self, channel ): 64 | self.removeHandlers() 65 | self.mode = 'restart' 66 | self.logger.info( "Restarting system..." ) 67 | subprocess.call( "sudo shutdown -r now", shell=True ) 68 | 69 | def powerPressed( self, channel ): 70 | self.removeHandlers() 71 | self.mode = 'halt' 72 | self.logger.info( "Powering system down..." ) 73 | subprocess.call( "sudo shutdown -h now", shell=True ) 74 | 75 | if __name__ == "__main__": 76 | logLevel = logging.DEBUG 77 | logFormat = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' 78 | 79 | logger = log.initLogger( logLevel, logFormat ) 80 | 81 | try: 82 | app = NESButtons( logger ) 83 | app.run() 84 | except: 85 | logger.error( traceback.format_exc() ) 86 | sys.exit(1) 87 | 88 | -------------------------------------------------------------------------------- /buttons/nes_buttons_daemon.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | 3 | import sys 4 | import traceback 5 | import argparse 6 | import signal 7 | import grp 8 | import daemon 9 | from daemon import pidfile 10 | import log 11 | import logging 12 | import nes_buttons 13 | 14 | debug_p = True 15 | 16 | def start_daemon( pidf, logf ): 17 | # This launches the daemon in its context 18 | 19 | global debug_p 20 | 21 | if debug_p: 22 | print( "nes_buttons_daemon: entered start_daemon()" ) 23 | print( "nes_buttons_daemon: pidf={} logf={}".format( pidf, logf ) ) 24 | 25 | try: 26 | with daemon.DaemonContext( 27 | working_directory='/var/lib/nes_buttons', 28 | gid = grp.getgrnam( 'pi' ).gr_gid, 29 | umask=0o002, 30 | pidfile=pidfile.TimeoutPIDLockFile( pidf ), 31 | ) as context: 32 | 33 | logLevel = logging.INFO 34 | logFormat = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' 35 | 36 | logger = log.initLogger( logLevel, logFormat, logf ) 37 | logger.info( "nes_buttons_daemon: entered daemon context" ) 38 | 39 | try: 40 | app = nes_buttons.NESButtons( logger ) 41 | logger.info( "nes_buttons_daemon: running app" ) 42 | app.run() 43 | except: 44 | logger.error( traceback.format_exc() ) 45 | sys.exit(1) 46 | 47 | except: 48 | print( "Unhandled exception: {}".format( traceback.format_exc() ) ) 49 | sys.exit(1) 50 | 51 | if __name__ == "__main__": 52 | parser = argparse.ArgumentParser( description="NES Buttons Daemon" ) 53 | parser.add_argument( '-p', '--pid-file', default='/var/run/nes_buttons.pid' ) 54 | parser.add_argument( '-l', '--log-file', default='/dev/shm/nes_buttons.log' ) 55 | 56 | args = parser.parse_args() 57 | 58 | start_daemon( args.pid_file, args.log_file ) 59 | 60 | -------------------------------------------------------------------------------- /nfc/Makefile: -------------------------------------------------------------------------------- 1 | # Builds nfc support code for mini-nes 2 | # 3 | # Requirements: 4 | # $NFC_HOME should be set to the libnfc-1.7.1 source directory 5 | # 6 | 7 | NFC_INCLUDES := -I$(NFC_HOME) -I$(NFC_HOME)/include 8 | 9 | TEST := nfc_get_uid 10 | CC := gcc 11 | CFLAGS := $(NFC_INCLUDES) -fPIC -O3 -g -Wall -Werror 12 | TEST_OBJECTS := nfc_get_uid.o 13 | 14 | MAJOR := 0 15 | MINOR := 1 16 | NAME := nfcutils 17 | VERSION := $(MAJOR).$(MINOR) 18 | 19 | INSTALL_PREFIX := /usr 20 | VAR_WORK_DIR := /var/lib/nfc_poll 21 | INIT_DIR := /etc/init.d 22 | CONFIG_DIR := /etc/nfc_poll 23 | 24 | .PHONY: default all clean lib install 25 | 26 | default: $(TEST) lib 27 | all: default 28 | 29 | lib: lib$(NAME).so 30 | 31 | lib$(NAME).so: lib$(NAME).so.$(VERSION) 32 | ldconfig -v -n . 33 | ln -s lib$(NAME).so.$(MAJOR) lib$(NAME).so 34 | 35 | lib$(NAME).so.$(VERSION): $(NAME).o 36 | $(CC) -fPIC -O3 -shared -lnfc -Wl,-soname,lib$(NAME).so.$(MAJOR) $^ -o $@ 37 | 38 | %.o: %.c 39 | $(CC) $(CFLAGS) -c $< -o $@ 40 | 41 | .PRECIOUS: $(TEST) $(TEST_OBJECTS) 42 | 43 | $(TEST): $(TEST_OBJECTS) lib$(NAME).so 44 | $(CC) $(TEST_OBJECTS) -o $@ -L. -l$(NAME) -lnfc 45 | 46 | test: $(TEST) 47 | LD_LIBRARY_PATH=. ./$(TEST) -v 48 | 49 | install: lib 50 | -pip install python-daemon 51 | -pip install psutil 52 | install -m 0755 *.so* -D -t $(INSTALL_PREFIX)/lib 53 | install -m 0755 *.py -D -t $(VAR_WORK_DIR) 54 | install -m 0755 init/nfc_poll -D -t $(INIT_DIR) 55 | install -m 0644 etc/*.conf -D -t $(CONFIG_DIR) 56 | -systemctl enable nfc_poll 57 | -systemctl daemon-reload 58 | -systemctl start nfc_poll 59 | 60 | clean: 61 | -rm -f *.o *.so* 62 | -rm -f nfc_get_uid 63 | 64 | -------------------------------------------------------------------------------- /nfc/etc/nfc_poll.conf: -------------------------------------------------------------------------------- 1 | [Settings] 2 | 3 | # Home directory for ROMs 4 | roms_home = /home/pi/RetroPie/roms 5 | 6 | # Location of screen_manager.cfg 7 | screen_config_file = /dev/shm/screen_manager.cfg 8 | 9 | # Frequency with which to poll NFC reader 10 | interval_seconds = 2 11 | 12 | # Number of times to poll each interval 13 | ui_poll_nr = 1 14 | 15 | # NFC polling periods each interval 16 | ui_period = 1 17 | 18 | [Cartridges] 19 | 20 | # = 21 | 22 | 04fc3bea794d80 = nes/Super Mario Bros. (JU) [!].zip 23 | 044d3cea794d81 = nes/Super Mario Bros 2 (U) (PRG 1).zip 24 | 042143ea794d81 = nes/Super Mario Bros 3 (U) (PRG 1).zip 25 | 26 | -------------------------------------------------------------------------------- /nfc/init/nfc_poll: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # nfc_poll Startup script for nfc_poll_daemon 4 | # 5 | # config: /etc/nfc_poll/nfc_poll.conf 6 | # pidfile: /var/run/nfc_poll.pid 7 | # logfile: /dev/shm/nfc_poll.log 8 | # 9 | ### BEGIN INIT INFO 10 | # Provides: nfc_poll_daemon 11 | # Required-Start: udev mountkernfs $local_fs 12 | # Required-Stop: $local_fs 13 | # Default-Start: S 14 | # Default-Stop: 15 | # Short-Description: start and stop nfc_poll server 16 | # Description: nfc_poll checks the nfc device for tags periodically, then acts on them. 17 | ### END INIT INFO 18 | 19 | # Source function library. 20 | . /lib/lsb/init-functions 21 | 22 | nfc_poll_daemon=/var/lib/nfc_poll/nfc_poll_daemon.py 23 | prog=nfc_poll_daemon 24 | pidfile=/var/run/nfc_poll.pid 25 | logfile=/dev/shm/nfc_poll.log 26 | RETVAL=0 27 | 28 | NFC_POLL_OPTS="-p $pidfile -l $logfile" 29 | 30 | case "$1" in 31 | start) 32 | log_daemon_msg "Starting $prog: " 33 | if start-stop-daemon --start --quiet --oknodo --pidfile $pidfile --exec $nfc_poll_daemon -- $NFC_POLL_OPTS ; then 34 | log_end_msg 0 35 | else 36 | log_end_msg 1 37 | fi 38 | ;; 39 | stop) 40 | log_daemon_msg "Stopping $prog: " 41 | if start-stop-daemon --stop --quiet --oknodo --pidfile $pidfile ; then 42 | log_end_msg 0 43 | else 44 | log_end_msg 1 45 | fi 46 | ;; 47 | status) 48 | status_of_proc -p $pidfile $nfc_poll_daemon $prog && exit 0 || exit $? 49 | ;; 50 | restart) 51 | log_daemon_msg "Restarting $prog: " 52 | stop-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $pidfile 53 | if start-stop-daemon --start --quiet --oknodo --pidfile $pidfile --exec $nfc_poll_daemon -- $NFC_POLL_OPTS ; then 54 | log_end_msg 0 55 | else 56 | log_end_msg 1 57 | fi 58 | ;; 59 | force-reload|reload) 60 | reload 61 | ;; 62 | *) 63 | log_action_msg "Usage: $prog {start|stop|restart|force-reload|reload|status}" 64 | exit 1 65 | esac 66 | 67 | -------------------------------------------------------------------------------- /nfc/log.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import logging 3 | 4 | def initLogger( logLevel, logFormat, logFile = None ): 5 | logger = logging.getLogger( 'NFCPoll' ) 6 | logger.setLevel( logLevel ) 7 | 8 | logHandler = None 9 | 10 | if logFile: 11 | logHandler = logging.FileHandler( logFile ) 12 | else: 13 | logHandler = logging.StreamHandler( sys.stdout ) 14 | 15 | logHandler.setLevel( logLevel ) 16 | logHandler.setFormatter( logging.Formatter( logFormat ) ) 17 | logger.addHandler( logHandler ) 18 | 19 | return logger 20 | 21 | -------------------------------------------------------------------------------- /nfc/nfc_get_uid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include "nfcutils.h" 9 | 10 | // Error codes 11 | #define ERR_INIT -101 12 | #define ERR_OPEN -102 13 | #define ERR_INITIATOR -103 14 | #define ERR_POLL -104 15 | 16 | static void print_usage( const char *progname ) 17 | { 18 | printf( "usage: %s [-v]\n", progname ); 19 | printf( " -v\t verbose display\n" ); 20 | } 21 | 22 | int main( int argc, const char *argv[] ) 23 | { 24 | bool verbose = false; 25 | int uiPollNr = 20; 26 | int uiPeriod = 2; 27 | 28 | // Display libnfc version 29 | const char *libnfcVersion = nfc_version(); 30 | 31 | if ( verbose ) { 32 | printf( "%s uses libnfc %s\n", argv[0], libnfcVersion ); 33 | } 34 | 35 | if ( argc != 1 ) { 36 | if ( ( argc = 2 ) && ( 0 == strcmp( "-v", argv[1] ) ) ) { 37 | verbose = true; 38 | } else { 39 | print_usage( argv[0] ); 40 | exit( EXIT_FAILURE ); 41 | } 42 | } 43 | 44 | char uid[20]; 45 | int res = 0; 46 | 47 | if ( ( res = nfcutils_open() ) < 0 ) { 48 | fprintf( stderr, "NFC init/open failed: %d\n", res ); 49 | exit( EXIT_FAILURE ); 50 | } 51 | 52 | if ( verbose ) { 53 | printf( "NFC device opened\n" ); 54 | } 55 | 56 | if ( ( res = nfcutils_poll( uiPollNr, uiPeriod, uid ) ) < 0 ) { 57 | fprintf( stderr, "NFC poll failed: %d\n", res ); 58 | } else if ( res > 0 ) { 59 | printf( "UID: %s\n", uid ); 60 | } else { 61 | printf( "No NFC tag found" ); 62 | } 63 | 64 | nfcutils_close(); 65 | 66 | if ( verbose ) { 67 | printf( "NFC device closed\n" ); 68 | } 69 | exit( EXIT_SUCCESS ); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /nfc/nfc_poll.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | 3 | from ctypes import * 4 | import os 5 | import sys 6 | import time 7 | import psutil 8 | import subprocess 9 | import ConfigParser 10 | import traceback 11 | import log 12 | import logging 13 | 14 | configDir = '/etc/nfc_poll/' 15 | defaultConfigFile = configDir + 'nfc_poll.conf' 16 | 17 | class NFCPoll(): 18 | def __init__( self, options, logger ): 19 | 20 | self.options = options 21 | self.logger = logger 22 | self.rom = None 23 | 24 | self.libnfc = CDLL("libnfc.so") 25 | self.libnfcutils = CDLL("libnfcutils.so") 26 | 27 | def run( self ): 28 | self.logger.debug( "NFCPoll.run" ) 29 | self.nfc_open() 30 | 31 | self.logger.info( "Entering main loop" ) 32 | self.logger.debug( "cartridges={}".format( self.options['cartridges'] ) ) 33 | 34 | while True: 35 | uid = self.nfc_poll( self.options['uiPollNr'], self.options['uiPeriod'] ) 36 | rom = None 37 | 38 | if uid: 39 | self.logger.info( "Reading NFC UID: {}".format( uid ) ) 40 | rom = self.lookupCartridge( uid ) 41 | 42 | if rom: 43 | self.loadRom( rom ) 44 | else: 45 | self.clearRom() 46 | 47 | time.sleep( self.options['interval'] ) 48 | 49 | def loadRom( self, rom ): 50 | if self.rom != rom: 51 | self.rom = rom 52 | system = rom[0:rom.index('/')] 53 | path = os.path.join( self.options['romsHome'], rom ) 54 | 55 | self.writeScreenConfig( [ 56 | "# Action set by nfc_poll", 57 | "", 58 | "[Action]", 59 | "type=rom", 60 | "system={}".format( system ), 61 | "path={}".format( path ), 62 | ] ) 63 | 64 | def clearRom( self ): 65 | if self.rom: 66 | self.rom = None 67 | 68 | self.writeScreenConfig( [ 69 | "# Action set by nfc_poll", 70 | "", 71 | "[Action]", 72 | "type=dashboard", 73 | ] ) 74 | 75 | def writeScreenConfig( self, lines ): 76 | with open( self.options['screenConfig'], 'wt' ) as f: 77 | for line in lines: 78 | f.write( "{}\n".format( line ) ) 79 | 80 | def cleanup( self ): 81 | self.logger.debug( "cleanup" ) 82 | self.nfc_close() 83 | 84 | def lookupCartridge( self, uid ): 85 | cartridges = self.options['cartridges'] 86 | if uid in cartridges: 87 | return cartridges[uid] 88 | else: 89 | return None 90 | 91 | def nfc_open( self ): 92 | res = self.libnfcutils.nfcutils_open() 93 | 94 | if res < 0: 95 | raise OSError( "Error: Unable to open NFC device: {0}".format( res ) ) 96 | else: 97 | self.logger.info( "NFC Device Open" ) 98 | 99 | def nfc_close( self ): 100 | res = self.libnfcutils.nfcutils_close() 101 | 102 | def nfc_poll( self, uiPollNr, uiPeriod ): 103 | charArray20 = c_char * 20 104 | uidString = charArray20() 105 | 106 | res = self.libnfcutils.nfcutils_poll( uiPollNr, uiPeriod, uidString ) 107 | 108 | if res < 0: 109 | # (KK) On my chipset, it returns a -104 Internal Chip Error when the tag is 110 | # not present. This sucks as it sounds like a valid error code, but 111 | # we have to ignore that error as it's a normal condition. 112 | self.logger.debug( "Warning: nfc poll: {0}".format( res ) ) 113 | return None 114 | elif res == 0: 115 | self.logger.debug( "No NFC tag found" ) 116 | return None 117 | elif res == 1: 118 | self.logger.debug( "NFC tag found: {0}".format( uidString.value ) ) 119 | return uidString.value 120 | 121 | def initConfig( logger, configFile = defaultConfigFile ): 122 | config = ConfigParser.RawConfigParser() 123 | config.read( configFile ) 124 | 125 | cartridgeIds = config.options( 'Cartridges' ) 126 | cartridges = {} 127 | 128 | for uid in cartridgeIds: 129 | cartridges[ uid ] = config.get( 'Cartridges', uid ) 130 | 131 | return { 132 | 'romsHome': config.get( 'Settings', 'roms_home' ), 133 | 'screenConfig': config.get( 'Settings', 'screen_config_file' ), 134 | 'interval': config.getint( 'Settings', 'interval_seconds' ), 135 | 'uiPollNr': config.getint( 'Settings', 'ui_poll_nr' ), 136 | 'uiPeriod': config.getint( 'Settings', 'ui_period' ), 137 | 'cartridges': cartridges 138 | } 139 | 140 | if __name__ == "__main__": 141 | logLevel = logging.DEBUG 142 | logFormat = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' 143 | 144 | logger = log.initLogger( logLevel, logFormat ) 145 | 146 | try: 147 | options = initConfig( logger ) 148 | 149 | app = NFCPoll( options, logger ) 150 | app.run() 151 | except: 152 | logger.error( traceback.format_exc() ) 153 | sys.exit(1) 154 | 155 | -------------------------------------------------------------------------------- /nfc/nfc_poll_daemon.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | 3 | import sys 4 | import traceback 5 | import argparse 6 | import signal 7 | import grp 8 | import daemon 9 | from daemon import pidfile 10 | import log 11 | import logging 12 | import nfc_poll 13 | 14 | debug_p = True 15 | 16 | def start_daemon( pidf, logf ): 17 | # This launches the daemon in its context 18 | 19 | global debug_p 20 | 21 | if debug_p: 22 | print( "nfc_poll_daemon: entered start_daemon()") 23 | print( "nfc_poll_daemon: pidf={} logf={}".format( pidf, logf ) ) 24 | 25 | try: 26 | with daemon.DaemonContext( 27 | working_directory='/var/lib/nfc_poll', 28 | gid = grp.getgrnam( 'pi' ).gr_gid, 29 | umask=0o002, 30 | pidfile=pidfile.TimeoutPIDLockFile( pidf ), 31 | ) as context: 32 | 33 | logLevel = logging.INFO 34 | logFormat = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' 35 | 36 | logger = log.initLogger( logLevel, logFormat, logf ) 37 | logger.info( "nfc_poll_daemon: entered daemon context" ) 38 | 39 | try: 40 | options = nfc_poll.initConfig( logger ) 41 | logger.info( "nfc_poll_daemon: options: {}".format( options ) ) 42 | 43 | app = nfc_poll.NFCPoll( options, logger ) 44 | context.signal_map = { 45 | signal.SIGTERM: app.cleanup 46 | } 47 | logger.info( "nfc_poll_daemon: running app" ) 48 | app.run() 49 | except: 50 | logger.error( traceback.format_exc() ) 51 | sys.exit(1) 52 | 53 | except: 54 | print( "Unhandled Exception: {}".format( traceback.format_exc() ) ) 55 | sys.exit(1) 56 | 57 | 58 | if __name__ == "__main__": 59 | parser = argparse.ArgumentParser( description="NFC Poll Daemon" ) 60 | parser.add_argument( '-p', '--pid-file', default='/var/run/nfc_poll.pid' ) 61 | parser.add_argument( '-l', '--log-file', default='/dev/shm/nfc_poll.log' ) 62 | 63 | args = parser.parse_args() 64 | 65 | start_daemon( args.pid_file, args.log_file ) 66 | 67 | -------------------------------------------------------------------------------- /nfc/nfcutils.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #include "utils/nfc-utils.h" 10 | 11 | // Error codes 12 | #define ERR_INIT -101 13 | #define ERR_OPEN -102 14 | #define ERR_INITIATOR -103 15 | #define ERR_POLL -104 16 | 17 | // Modulations to scan for 18 | const nfc_modulation nmModulations[1] = { 19 | { .nmt = NMT_ISO14443A, .nbr = NBR_106 }, 20 | }; 21 | const size_t szModulations = 1; 22 | 23 | static nfc_device *pnd = NULL; 24 | static nfc_context *context; 25 | 26 | void stop_polling( int sig ) 27 | { 28 | (void) sig; 29 | 30 | if ( pnd != NULL ) { 31 | nfc_abort_command( pnd ); 32 | } else { 33 | nfc_exit( context ); 34 | exit( EXIT_FAILURE ); 35 | } 36 | } 37 | 38 | int nfcutils_open() { 39 | signal( SIGINT, stop_polling ); 40 | 41 | nfc_init( &context ); 42 | if ( NULL == context ) { 43 | return ERR_INIT; 44 | } 45 | 46 | pnd = nfc_open( context, NULL ); 47 | 48 | if ( NULL == pnd ) { 49 | nfc_exit( context ); 50 | return ERR_OPEN; 51 | } 52 | 53 | if ( nfc_initiator_init( pnd ) < 0 ) { 54 | nfc_close( pnd ); 55 | nfc_exit( context ); 56 | return ERR_INITIATOR; 57 | } 58 | 59 | return 0; 60 | } 61 | 62 | void nfcutils_close() { 63 | 64 | nfc_close( pnd ); 65 | nfc_exit( context ); 66 | } 67 | 68 | int nfcutils_poll( int uiPollNr, int uiPeriod, char *uid) { 69 | int res = 0; 70 | nfc_target nt; 71 | 72 | if ( ( res = nfc_initiator_poll_target( pnd, nmModulations, szModulations, uiPollNr, uiPeriod, &nt ) ) < 0 ) { 73 | return ERR_POLL; 74 | } 75 | 76 | if ( res > 0 ) { 77 | nfc_iso14443a_info *pnai = &nt.nti.nai; 78 | int i; 79 | int charIndex = 0; 80 | 81 | // Print the hex numbers to the uid string. 82 | for ( i = 0; i < pnai->szUidLen; i++ ) { 83 | sprintf( uid + charIndex, "%02x", pnai->abtUid[ i ] ); 84 | charIndex += 2; 85 | } 86 | 87 | return 1; 88 | } else { 89 | return 0; 90 | } 91 | } 92 | 93 | -------------------------------------------------------------------------------- /nfc/nfcutils.h: -------------------------------------------------------------------------------- 1 | #ifndef NFCUTILS_H 2 | #define NFCUTILS_H 3 | 4 | /** 5 | * Open an NFC device. 6 | * 7 | * @return int 0 on success, negative on error. 8 | */ 9 | int nfcutils_open(); 10 | 11 | /** 12 | * Close the currently opened NFC device. 13 | */ 14 | void nfcutils_close(); 15 | 16 | /** 17 | * Poll the currently opened NFC device for tags nearby. 18 | * 19 | * @param [in] int uiPollNr The number of times to poll before giving up. 20 | * @param [in] int uiPeriod The periods to try for each time. 21 | * @param [out] char[20] uid The buffer in which to write the resulting UID as a string. 22 | * @return int 1 if tag found, 0 if no tag found, negative on error. 23 | */ 24 | int nfcutils_poll( int uiPollNr, int uiPeriod, char *uid); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /pcb-board/README.md: -------------------------------------------------------------------------------- 1 | # KiCad PCB projects 2 | This are the Front and Main PCB projects designed on KiCad, this PCB is designed to be as easy to solder as possible using all through hole components. The NFC and 3 | Front Panel connector are 1.25mm pitch and require careful soldering to avoid bridging solder points. 4 | 5 | ## BOM 6 | 7 | This is the list of components and there respectable links to order each part from different suppliers: 8 | 9 | Front Panel 10 | - 150ohm Power LED Resistor, Quantity: 1 digikey: http://bit.ly/2qCImqK 11 | - Front Panel Power LED, Quantity: 1 digikey: http://bit.ly/2qCURmf 12 | - Latching Push Button Switche (Power Switch) Quantity: 1 amazon: http://amzn.to/2rpfMua 13 | - Momentary Push Button Switch (Reset Switch) Quantity: 1 amazon: http://amzn.to/2rpqrF1 14 | 15 | Main Board 16 | - Micro JST Picoblade 1.25mm Pitch 4 Pin(NFC Reader) Quantity: 1 ebay: http://ebay.to/2sDfNLq 17 | - Micro JST Picoblade 1.25mm Pitch 5 Pin(Front Control Panel) Quantity: 1 ebay: http://ebay.to/2sDwypP 18 | - Resistor 10kohm, Quantity: 1 digikey: http://bit.ly/2rpp1KH 19 | - 16 Pin Pi Header Connector, Quantity: 1 digikey: http://bit.ly/2rp8Ehp 20 | 21 | ## OSH Park Links 22 | This PCB projects are publicly shared at oskpark.com you can order this boards from the following links: 23 | 24 | -Front Panel PCB 25 | https://oshpark.com/shared_projects/b4CEMlJS 26 | 27 | -Main Board PCB 28 | https://oshpark.com/shared_projects/rdgBPoq0 29 | 30 | -------------------------------------------------------------------------------- /pcb-board/front-panel/front-panel-back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderkevin/mini-nes/5b6a0ac12719177fa43fabb03cbf7ab6c81edf06/pcb-board/front-panel/front-panel-back.png -------------------------------------------------------------------------------- /pcb-board/front-panel/front-panel-front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderkevin/mini-nes/5b6a0ac12719177fa43fabb03cbf7ab6c81edf06/pcb-board/front-panel/front-panel-front.png -------------------------------------------------------------------------------- /pcb-board/front-panel/front-panel.kicad_pcb: -------------------------------------------------------------------------------- 1 | (kicad_pcb (version 4) (host pcbnew 4.0.6) 2 | 3 | (general 4 | (links 11) 5 | (no_connects 0) 6 | (area 131.254499 101.663499 162.242501 113.855501) 7 | (thickness 1.6) 8 | (drawings 21) 9 | (tracks 40) 10 | (zones 0) 11 | (modules 5) 12 | (nets 8) 13 | ) 14 | 15 | (page USLetter) 16 | (title_block 17 | (title "Mini-NES_NFC_FRONT-PANEL by @coderkevin") 18 | (date 2017-05-18) 19 | (rev 1.0) 20 | (company "Eladio Martinez") 21 | ) 22 | 23 | (layers 24 | (0 F.Cu signal) 25 | (31 B.Cu signal) 26 | (32 B.Adhes user) 27 | (33 F.Adhes user) 28 | (34 B.Paste user) 29 | (35 F.Paste user) 30 | (36 B.SilkS user) 31 | (37 F.SilkS user) 32 | (38 B.Mask user) 33 | (39 F.Mask user) 34 | (40 Dwgs.User user) 35 | (41 Cmts.User user) 36 | (42 Eco1.User user) 37 | (43 Eco2.User user) 38 | (44 Edge.Cuts user) 39 | (45 Margin user) 40 | (46 B.CrtYd user) 41 | (47 F.CrtYd user) 42 | (48 B.Fab user) 43 | (49 F.Fab user) 44 | ) 45 | 46 | (setup 47 | (last_trace_width 0.254) 48 | (user_trace_width 0.1524) 49 | (user_trace_width 0.2) 50 | (user_trace_width 0.25) 51 | (user_trace_width 0.3) 52 | (user_trace_width 0.4) 53 | (user_trace_width 0.5) 54 | (user_trace_width 0.6) 55 | (user_trace_width 0.8) 56 | (user_trace_width 1) 57 | (user_trace_width 1.2) 58 | (user_trace_width 1.5) 59 | (user_trace_width 2) 60 | (trace_clearance 0.254) 61 | (zone_clearance 0.508) 62 | (zone_45_only no) 63 | (trace_min 0.1524) 64 | (segment_width 0.127) 65 | (edge_width 0.127) 66 | (via_size 0.6858) 67 | (via_drill 0.3302) 68 | (via_min_size 0.6858) 69 | (via_min_drill 0.3302) 70 | (uvia_size 0.508) 71 | (uvia_drill 0.127) 72 | (uvias_allowed no) 73 | (uvia_min_size 0.508) 74 | (uvia_min_drill 0.127) 75 | (pcb_text_width 0.127) 76 | (pcb_text_size 0.6 0.6) 77 | (mod_edge_width 0.127) 78 | (mod_text_size 0.6 0.6) 79 | (mod_text_width 0.127) 80 | (pad_size 1.524 1.524) 81 | (pad_drill 0.762) 82 | (pad_to_mask_clearance 0.05) 83 | (pad_to_paste_clearance -0.04) 84 | (aux_axis_origin 0 0) 85 | (visible_elements 7FFFFFFF) 86 | (pcbplotparams 87 | (layerselection 0x010f0_80000001) 88 | (usegerberextensions true) 89 | (excludeedgelayer true) 90 | (linewidth 0.127000) 91 | (plotframeref false) 92 | (viasonmask false) 93 | (mode 1) 94 | (useauxorigin false) 95 | (hpglpennumber 1) 96 | (hpglpenspeed 20) 97 | (hpglpendiameter 15) 98 | (hpglpenoverlay 2) 99 | (psnegative false) 100 | (psa4output false) 101 | (plotreference true) 102 | (plotvalue true) 103 | (plotinvisibletext false) 104 | (padsonsilk false) 105 | (subtractmaskfromsilk false) 106 | (outputformat 1) 107 | (mirror false) 108 | (drillshape 0) 109 | (scaleselection 1) 110 | (outputdirectory Mini-NES_Panel.gerber/)) 111 | ) 112 | 113 | (net 0 "") 114 | (net 1 /LED) 115 | (net 2 /GND) 116 | (net 3 /VCC) 117 | (net 4 /PWR) 118 | (net 5 /RST) 119 | (net 6 "Net-(SW2-Pad4)") 120 | (net 7 "Net-(D1-Pad1)") 121 | 122 | (net_class Default "Dit is de standaard class." 123 | (clearance 0.254) 124 | (trace_width 0.254) 125 | (via_dia 0.6858) 126 | (via_drill 0.3302) 127 | (uvia_dia 0.508) 128 | (uvia_drill 0.127) 129 | (add_net /GND) 130 | (add_net /LED) 131 | (add_net /PWR) 132 | (add_net /RST) 133 | (add_net /VCC) 134 | (add_net "Net-(D1-Pad1)") 135 | (add_net "Net-(SW2-Pad4)") 136 | ) 137 | 138 | (net_class 0.2mm "" 139 | (clearance 0.2) 140 | (trace_width 0.2) 141 | (via_dia 0.6858) 142 | (via_drill 0.3302) 143 | (uvia_dia 0.508) 144 | (uvia_drill 0.127) 145 | ) 146 | 147 | (net_class Minimal "" 148 | (clearance 0.1524) 149 | (trace_width 0.1524) 150 | (via_dia 0.6858) 151 | (via_drill 0.3302) 152 | (uvia_dia 0.508) 153 | (uvia_drill 0.127) 154 | ) 155 | 156 | (module Pin_Headers:Pin_Header_Straight_1x05_Pitch2.54mm (layer F.Cu) (tedit 591F4523) (tstamp 591E5F35) 157 | (at 149.987 103.505 90) 158 | (descr "Through hole straight pin header, 1x05, 2.54mm pitch, single row") 159 | (tags "Through hole pin header THT 1x05 2.54mm single row") 160 | (path /591E5B6A) 161 | (fp_text reference J1 (at 0 -2.33 90) (layer F.SilkS) hide 162 | (effects (font (size 1 1) (thickness 0.15))) 163 | ) 164 | (fp_text value FRONT_CONN (at -1.905 2.921 180) (layer F.Fab) hide 165 | (effects (font (size 1 1) (thickness 0.15))) 166 | ) 167 | (fp_line (start -1.27 -1.27) (end -1.27 11.43) (layer F.Fab) (width 0.1)) 168 | (fp_line (start -1.27 11.43) (end 1.27 11.43) (layer F.Fab) (width 0.1)) 169 | (fp_line (start 1.27 11.43) (end 1.27 -1.27) (layer F.Fab) (width 0.1)) 170 | (fp_line (start 1.27 -1.27) (end -1.27 -1.27) (layer F.Fab) (width 0.1)) 171 | (fp_line (start -1.33 1.27) (end -1.33 11.49) (layer F.SilkS) (width 0.12)) 172 | (fp_line (start -1.33 11.49) (end 1.33 11.49) (layer F.SilkS) (width 0.12)) 173 | (fp_line (start 1.33 11.49) (end 1.33 1.27) (layer F.SilkS) (width 0.12)) 174 | (fp_line (start 1.33 1.27) (end -1.33 1.27) (layer F.SilkS) (width 0.12)) 175 | (fp_line (start -1.33 0) (end -1.33 -1.33) (layer F.SilkS) (width 0.12)) 176 | (fp_line (start -1.33 -1.33) (end 0 -1.33) (layer F.SilkS) (width 0.12)) 177 | (fp_line (start -1.8 -1.8) (end -1.8 11.95) (layer F.CrtYd) (width 0.05)) 178 | (fp_line (start -1.8 11.95) (end 1.8 11.95) (layer F.CrtYd) (width 0.05)) 179 | (fp_line (start 1.8 11.95) (end 1.8 -1.8) (layer F.CrtYd) (width 0.05)) 180 | (fp_line (start 1.8 -1.8) (end -1.8 -1.8) (layer F.CrtYd) (width 0.05)) 181 | (fp_text user %R (at 0 -2.33 90) (layer F.Fab) hide 182 | (effects (font (size 1 1) (thickness 0.15))) 183 | ) 184 | (pad 1 thru_hole rect (at 0 0 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 185 | (net 2 /GND)) 186 | (pad 2 thru_hole oval (at 0 2.54 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 187 | (net 3 /VCC)) 188 | (pad 3 thru_hole oval (at 0 5.08 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 189 | (net 1 /LED)) 190 | (pad 4 thru_hole oval (at 0 7.62 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 191 | (net 4 /PWR)) 192 | (pad 5 thru_hole oval (at 0 10.16 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 193 | (net 5 /RST)) 194 | (model ${KISYS3DMOD}/Pin_Headers.3dshapes/Pin_Header_Straight_1x05_Pitch2.54mm.wrl 195 | (at (xyz 0 -0.2 0)) 196 | (scale (xyz 1 1 1)) 197 | (rotate (xyz 0 0 90)) 198 | ) 199 | ) 200 | 201 | (module LEDs:LED_D3.0mm (layer F.Cu) (tedit 59446E6A) (tstamp 59446BC3) 202 | (at 133.858 108.712 270) 203 | (descr "LED, diameter 3.0mm, 2 pins") 204 | (tags "LED diameter 3.0mm 2 pins") 205 | (path /591E600E) 206 | (fp_text reference LED (at 1.27 -2.96 270) (layer B.SilkS) 207 | (effects (font (size 0.7 0.7) (thickness 0.15)) (justify mirror)) 208 | ) 209 | (fp_text value LED (at 1.27 -3.4925 270) (layer F.Fab) hide 210 | (effects (font (size 1 1) (thickness 0.15))) 211 | ) 212 | (fp_arc (start 1.27 0) (end -0.23 -1.16619) (angle 284.3) (layer F.Fab) (width 0.1)) 213 | (fp_arc (start 1.27 0) (end -0.29 -1.235516) (angle 108.8) (layer F.SilkS) (width 0.12)) 214 | (fp_arc (start 1.27 0) (end -0.29 1.235516) (angle -108.8) (layer F.SilkS) (width 0.12)) 215 | (fp_arc (start 1.27 0) (end 0.229039 -1.08) (angle 87.9) (layer F.SilkS) (width 0.12)) 216 | (fp_arc (start 1.27 0) (end 0.229039 1.08) (angle -87.9) (layer F.SilkS) (width 0.12)) 217 | (fp_circle (center 1.27 0) (end 2.77 0) (layer F.Fab) (width 0.1)) 218 | (fp_line (start -0.23 -1.16619) (end -0.23 1.16619) (layer F.Fab) (width 0.1)) 219 | (fp_line (start -0.29 -1.236) (end -0.29 -1.08) (layer F.SilkS) (width 0.12)) 220 | (fp_line (start -0.29 1.08) (end -0.29 1.236) (layer F.SilkS) (width 0.12)) 221 | (fp_line (start -1.15 -2.25) (end -1.15 2.25) (layer F.CrtYd) (width 0.05)) 222 | (fp_line (start -1.15 2.25) (end 3.7 2.25) (layer F.CrtYd) (width 0.05)) 223 | (fp_line (start 3.7 2.25) (end 3.7 -2.25) (layer F.CrtYd) (width 0.05)) 224 | (fp_line (start 3.7 -2.25) (end -1.15 -2.25) (layer F.CrtYd) (width 0.05)) 225 | (pad 1 thru_hole rect (at 0 0 270) (size 1.8 1.8) (drill 0.9) (layers *.Cu *.Mask) 226 | (net 7 "Net-(D1-Pad1)")) 227 | (pad 2 thru_hole circle (at 2.54 0 270) (size 1.8 1.8) (drill 0.9) (layers *.Cu *.Mask) 228 | (net 1 /LED)) 229 | (model LEDs.3dshapes/LED_D3.0mm.wrl 230 | (at (xyz 0 0 0)) 231 | (scale (xyz 0.393701 0.393701 0.393701)) 232 | (rotate (xyz 0 0 0)) 233 | ) 234 | ) 235 | 236 | (module Resistors_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P12.70mm_Horizontal (layer F.Cu) (tedit 59446CEA) (tstamp 59446BD9) 237 | (at 132.778 103.759) 238 | (descr "Resistor, Axial_DIN0309 series, Axial, Horizontal, pin pitch=12.7mm, 0.5W = 1/2W, length*diameter=9*3.2mm^2, http://cdn-reichelt.de/documents/datenblatt/B400/1_4W%23YAG.pdf") 239 | (tags "Resistor Axial_DIN0309 series Axial Horizontal pin pitch 12.7mm 0.5W = 1/2W length 9mm diameter 3.2mm") 240 | (path /591F3340) 241 | (fp_text reference 220h-1K (at 6.2865 0) (layer F.SilkS) 242 | (effects (font (size 0.7 0.7) (thickness 0.15))) 243 | ) 244 | (fp_text value 220h (at 6.35 2.66) (layer F.Fab) hide 245 | (effects (font (size 1 1) (thickness 0.15))) 246 | ) 247 | (fp_line (start 1.85 -1.6) (end 1.85 1.6) (layer F.Fab) (width 0.1)) 248 | (fp_line (start 1.85 1.6) (end 10.85 1.6) (layer F.Fab) (width 0.1)) 249 | (fp_line (start 10.85 1.6) (end 10.85 -1.6) (layer F.Fab) (width 0.1)) 250 | (fp_line (start 10.85 -1.6) (end 1.85 -1.6) (layer F.Fab) (width 0.1)) 251 | (fp_line (start 0 0) (end 1.85 0) (layer F.Fab) (width 0.1)) 252 | (fp_line (start 12.7 0) (end 10.85 0) (layer F.Fab) (width 0.1)) 253 | (fp_line (start 1.79 -1.66) (end 1.79 1.66) (layer F.SilkS) (width 0.12)) 254 | (fp_line (start 1.79 1.66) (end 10.91 1.66) (layer F.SilkS) (width 0.12)) 255 | (fp_line (start 10.91 1.66) (end 10.91 -1.66) (layer F.SilkS) (width 0.12)) 256 | (fp_line (start 10.91 -1.66) (end 1.79 -1.66) (layer F.SilkS) (width 0.12)) 257 | (fp_line (start 0.98 0) (end 1.79 0) (layer F.SilkS) (width 0.12)) 258 | (fp_line (start 11.72 0) (end 10.91 0) (layer F.SilkS) (width 0.12)) 259 | (fp_line (start -1.05 -1.95) (end -1.05 1.95) (layer F.CrtYd) (width 0.05)) 260 | (fp_line (start -1.05 1.95) (end 13.75 1.95) (layer F.CrtYd) (width 0.05)) 261 | (fp_line (start 13.75 1.95) (end 13.75 -1.95) (layer F.CrtYd) (width 0.05)) 262 | (fp_line (start 13.75 -1.95) (end -1.05 -1.95) (layer F.CrtYd) (width 0.05)) 263 | (pad 1 thru_hole circle (at 0 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) 264 | (net 7 "Net-(D1-Pad1)")) 265 | (pad 2 thru_hole oval (at 12.7 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) 266 | (net 2 /GND)) 267 | (model Resistors_THT.3dshapes/R_Axial_DIN0309_L9.0mm_D3.2mm_P12.70mm_Horizontal.wrl 268 | (at (xyz 0 0 0)) 269 | (scale (xyz 0.393701 0.393701 0.393701)) 270 | (rotate (xyz 0 0 0)) 271 | ) 272 | ) 273 | 274 | (module e-switch:TL2230 (layer F.Cu) (tedit 59446CF7) (tstamp 59446BF4) 275 | (at 156.21 113.284) 276 | (descr "DPDT Latching Mini Push Button Switch 7mmx7mm") 277 | (tags "SWITCH DEV TL2230EE TL2230OA TL2230") 278 | (path /591F3F8D) 279 | (fp_text reference RESET (at 2.2225 -3.7465 90) (layer B.SilkS) 280 | (effects (font (size 0.7 0.7) (thickness 0.15)) (justify mirror)) 281 | ) 282 | (fp_text value TL2230OA (at 2 -8.5) (layer F.Fab) hide 283 | (effects (font (size 1 1) (thickness 0.15))) 284 | ) 285 | (fp_line (start 5.9 -6.9) (end 5.9 -7.4) (layer F.SilkS) (width 0.05)) 286 | (fp_line (start 5.9 -7.4) (end -1.9 -7.4) (layer F.SilkS) (width 0.05)) 287 | (fp_line (start -1.9 -7.4) (end -1.9 -6.85) (layer F.SilkS) (width 0.05)) 288 | (fp_line (start -1.9 0.4) (end 5.9 0.4) (layer F.SilkS) (width 0.05)) 289 | (fp_line (start 5.9 0.4) (end 5.9 -0.2) (layer F.SilkS) (width 0.05)) 290 | (fp_line (start -1.9 -0.2) (end -1.9 0.4) (layer F.SilkS) (width 0.05)) 291 | (fp_line (start 5.5 -6.45) (end 5.5 -7) (layer F.SilkS) (width 0.15)) 292 | (fp_line (start -1.5 0) (end -1.5 -1) (layer F.SilkS) (width 0.15)) 293 | (fp_line (start 5.5 -7) (end -1.5 -7) (layer F.SilkS) (width 0.15)) 294 | (fp_line (start -1.5 -7) (end -1.5 -6.25) (layer F.SilkS) (width 0.15)) 295 | (fp_line (start -1.5 0) (end 5.5 0) (layer F.SilkS) (width 0.15)) 296 | (fp_line (start 5.5 0) (end 5.5 -0.75) (layer F.SilkS) (width 0.15)) 297 | (fp_line (start 5.9 -0.9) (end 5.9 -6.9) (layer F.SilkS) (width 0.05)) 298 | (fp_line (start -1.9 -6.9) (end -1.9 -0.1) (layer F.SilkS) (width 0.05)) 299 | (fp_line (start -1.5 -0.5) (end -1.5 -6.5) (layer F.SilkS) (width 0.15)) 300 | (fp_line (start 5.9 -0.9) (end 5.9 -0.1) (layer F.SilkS) (width 0.05)) 301 | (fp_line (start 5.5 -0.5) (end 5.5 -6.5) (layer F.SilkS) (width 0.15)) 302 | (pad 4 thru_hole circle (at 4.5 -1.5) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask)) 303 | (pad 5 thru_hole circle (at 4.5 -3.5 90) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask)) 304 | (pad 6 thru_hole circle (at 4.5 -5.5 90) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask)) 305 | (pad 3 thru_hole circle (at -0.5 -5.5 90) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask) 306 | (net 3 /VCC)) 307 | (pad 2 thru_hole circle (at -0.5 -3.5 90) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask) 308 | (net 5 /RST)) 309 | (pad 1 thru_hole rect (at -0.5 -1.5) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask) 310 | (net 2 /GND)) 311 | (model ${MYLIB3DMOD}/e-switch.3dshapes/TL2230EE.wrl 312 | (at (xyz -0.055 0.003 0)) 313 | (scale (xyz 0.393701 0.393701 0.393701)) 314 | (rotate (xyz 0 0 0)) 315 | ) 316 | ) 317 | 318 | (module e-switch:TL2230 (layer F.Cu) (tedit 59446CF1) (tstamp 59446C0F) 319 | (at 141.732 113.284) 320 | (descr "DPDT Latching Mini Push Button Switch 7mmx7mm") 321 | (tags "SWITCH DEV TL2230EE TL2230OA TL2230") 322 | (path /591F4014) 323 | (fp_text reference POWER (at 2.0955 -3.81 90) (layer B.SilkS) 324 | (effects (font (size 0.7 0.7) (thickness 0.15)) (justify mirror)) 325 | ) 326 | (fp_text value TL2230EE (at 2 -8.5) (layer F.Fab) hide 327 | (effects (font (size 1 1) (thickness 0.15))) 328 | ) 329 | (fp_line (start 5.9 -6.9) (end 5.9 -7.4) (layer F.SilkS) (width 0.05)) 330 | (fp_line (start 5.9 -7.4) (end -1.9 -7.4) (layer F.SilkS) (width 0.05)) 331 | (fp_line (start -1.9 -7.4) (end -1.9 -6.85) (layer F.SilkS) (width 0.05)) 332 | (fp_line (start -1.9 0.4) (end 5.9 0.4) (layer F.SilkS) (width 0.05)) 333 | (fp_line (start 5.9 0.4) (end 5.9 -0.2) (layer F.SilkS) (width 0.05)) 334 | (fp_line (start -1.9 -0.2) (end -1.9 0.4) (layer F.SilkS) (width 0.05)) 335 | (fp_line (start 5.5 -6.45) (end 5.5 -7) (layer F.SilkS) (width 0.15)) 336 | (fp_line (start -1.5 0) (end -1.5 -1) (layer F.SilkS) (width 0.15)) 337 | (fp_line (start 5.5 -7) (end -1.5 -7) (layer F.SilkS) (width 0.15)) 338 | (fp_line (start -1.5 -7) (end -1.5 -6.25) (layer F.SilkS) (width 0.15)) 339 | (fp_line (start -1.5 0) (end 5.5 0) (layer F.SilkS) (width 0.15)) 340 | (fp_line (start 5.5 0) (end 5.5 -0.75) (layer F.SilkS) (width 0.15)) 341 | (fp_line (start 5.9 -0.9) (end 5.9 -6.9) (layer F.SilkS) (width 0.05)) 342 | (fp_line (start -1.9 -6.9) (end -1.9 -0.1) (layer F.SilkS) (width 0.05)) 343 | (fp_line (start -1.5 -0.5) (end -1.5 -6.5) (layer F.SilkS) (width 0.15)) 344 | (fp_line (start 5.9 -0.9) (end 5.9 -0.1) (layer F.SilkS) (width 0.05)) 345 | (fp_line (start 5.5 -0.5) (end 5.5 -6.5) (layer F.SilkS) (width 0.15)) 346 | (pad 4 thru_hole circle (at 4.5 -1.5) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask) 347 | (net 6 "Net-(SW2-Pad4)")) 348 | (pad 5 thru_hole circle (at 4.5 -3.5 90) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask) 349 | (net 1 /LED)) 350 | (pad 6 thru_hole circle (at 4.5 -5.5 90) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask) 351 | (net 3 /VCC)) 352 | (pad 3 thru_hole circle (at -0.5 -5.5 90) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask) 353 | (net 3 /VCC)) 354 | (pad 2 thru_hole circle (at -0.5 -3.5 90) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask) 355 | (net 4 /PWR)) 356 | (pad 1 thru_hole rect (at -0.5 -1.5) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask) 357 | (net 2 /GND)) 358 | (model ${MYLIB3DMOD}/e-switch.3dshapes/TL2230EE.wrl 359 | (at (xyz -0.055 0.003 0)) 360 | (scale (xyz 0.393701 0.393701 0.393701)) 361 | (rotate (xyz 0 0 0)) 362 | ) 363 | ) 364 | 365 | (gr_text N.O. (at 158.3055 111.76) (layer F.SilkS) 366 | (effects (font (size 0.6 0.6) (thickness 0.127))) 367 | ) 368 | (gr_text N.O. (at 143.891 111.6965) (layer F.SilkS) 369 | (effects (font (size 0.6 0.6) (thickness 0.127))) 370 | ) 371 | (gr_text / (at 157.9245 108.585) (layer F.SilkS) 372 | (effects (font (size 2 2) (thickness 0.127))) 373 | ) 374 | (gr_text / (at 143.383 108.585) (layer F.SilkS) 375 | (effects (font (size 2 2) (thickness 0.127))) 376 | ) 377 | (gr_text 1 (at 153.924 111.76) (layer B.SilkS) 378 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 379 | ) 380 | (gr_text 1 (at 139.446 111.76) (layer B.SilkS) 381 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 382 | ) 383 | (gr_text "Mini NES Panel Rev 1" (at 139.192 103.632) (layer B.SilkS) 384 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 385 | ) 386 | (gr_line (start 131.318 101.727) (end 131.318 113.792) (angle 90) (layer Edge.Cuts) (width 0.127)) 387 | (gr_line (start 148.082 101.727) (end 131.318 101.727) (angle 90) (layer Edge.Cuts) (width 0.127)) 388 | (gr_line (start 148.082 101.727) (end 162.179 101.727) (angle 90) (layer Edge.Cuts) (width 0.127)) 389 | (gr_line (start 162.179 101.727) (end 162.179 113.792) (angle 90) (layer Edge.Cuts) (width 0.127)) 390 | (gr_line (start 162.179 113.792) (end 131.318 113.792) (angle 90) (layer Edge.Cuts) (width 0.127)) 391 | (gr_text Latchin (at 143.637 113.157) (layer B.SilkS) 392 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 393 | ) 394 | (gr_text Momentary (at 158.242 113.157) (layer B.SilkS) 395 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 396 | ) 397 | (gr_text GND (at 149.987 105.41) (layer B.SilkS) 398 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 399 | ) 400 | (gr_text VCC (at 152.527 105.41) (layer B.SilkS) 401 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 402 | ) 403 | (gr_text LED (at 155.194 105.41) (layer B.SilkS) 404 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 405 | ) 406 | (gr_text PWR (at 157.48 105.41) (layer B.SilkS) 407 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 408 | ) 409 | (gr_text RST (at 160.274 105.41) (layer B.SilkS) 410 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 411 | ) 412 | (gr_text + (at 135.636 111.76) (layer B.SilkS) 413 | (effects (font (size 0.6 0.6) (thickness 0.127))) 414 | ) 415 | (gr_text + (at 135.636 111.76) (layer F.SilkS) 416 | (effects (font (size 0.6 0.6) (thickness 0.127))) 417 | ) 418 | 419 | (segment (start 153.8357 104.0152) (end 153.8357 103.505) (width 0.254) (layer B.Cu) (net 1)) 420 | (segment (start 148.0669 109.784) (end 153.8357 104.0152) (width 0.254) (layer B.Cu) (net 1)) 421 | (segment (start 146.232 109.784) (end 148.0669 109.784) (width 0.254) (layer B.Cu) (net 1)) 422 | (segment (start 155.067 103.505) (end 153.8357 103.505) (width 0.254) (layer B.Cu) (net 1)) 423 | (segment (start 143.1521 112.8639) (end 146.232 109.784) (width 0.254) (layer B.Cu) (net 1)) 424 | (segment (start 135.4699 112.8639) (end 143.1521 112.8639) (width 0.254) (layer B.Cu) (net 1)) 425 | (segment (start 133.858 111.252) (end 135.4699 112.8639) (width 0.254) (layer B.Cu) (net 1)) 426 | (segment (start 143.3916 112.8638) (end 142.3118 111.784) (width 0.254) (layer F.Cu) (net 2)) 427 | (segment (start 153.5504 112.8638) (end 143.3916 112.8638) (width 0.254) (layer F.Cu) (net 2)) 428 | (segment (start 154.6302 111.784) (end 153.5504 112.8638) (width 0.254) (layer F.Cu) (net 2)) 429 | (segment (start 155.71 111.784) (end 154.6302 111.784) (width 0.254) (layer F.Cu) (net 2)) 430 | (segment (start 141.232 111.784) (end 142.3118 111.784) (width 0.254) (layer F.Cu) (net 2)) 431 | (segment (start 148.5017 103.759) (end 148.7557 103.505) (width 0.254) (layer F.Cu) (net 2)) 432 | (segment (start 145.478 103.759) (end 148.5017 103.759) (width 0.254) (layer F.Cu) (net 2)) 433 | (segment (start 149.987 103.505) (end 148.7557 103.505) (width 0.254) (layer F.Cu) (net 2)) 434 | (segment (start 144.9886 105.4297) (end 145.478 104.9403) (width 0.254) (layer B.Cu) (net 2)) 435 | (segment (start 144.9886 108.0274) (end 144.9886 105.4297) (width 0.254) (layer B.Cu) (net 2)) 436 | (segment (start 141.232 111.784) (end 144.9886 108.0274) (width 0.254) (layer B.Cu) (net 2)) 437 | (segment (start 145.478 103.759) (end 145.478 104.9403) (width 0.254) (layer B.Cu) (net 2)) 438 | (segment (start 152.6623 104.7363) (end 152.527 104.7363) (width 0.254) (layer F.Cu) (net 3)) 439 | (segment (start 155.71 107.784) (end 152.6623 104.7363) (width 0.254) (layer F.Cu) (net 3)) 440 | (segment (start 152.527 103.505) (end 152.527 104.7363) (width 0.254) (layer F.Cu) (net 3)) 441 | (segment (start 141.232 107.784) (end 146.232 107.784) (width 0.254) (layer F.Cu) (net 3)) 442 | (segment (start 149.2797 104.7363) (end 152.527 104.7363) (width 0.254) (layer F.Cu) (net 3)) 443 | (segment (start 146.232 107.784) (end 149.2797 104.7363) (width 0.254) (layer F.Cu) (net 3)) 444 | (segment (start 157.607 103.505) (end 156.3757 103.505) (width 0.254) (layer B.Cu) (net 4)) 445 | (segment (start 143.3771 107.6389) (end 141.232 109.784) (width 0.254) (layer B.Cu) (net 4)) 446 | (segment (start 143.3771 104.1478) (end 143.3771 107.6389) (width 0.254) (layer B.Cu) (net 4)) 447 | (segment (start 145.3247 102.2002) (end 143.3771 104.1478) (width 0.254) (layer B.Cu) (net 4)) 448 | (segment (start 155.5811 102.2002) (end 145.3247 102.2002) (width 0.254) (layer B.Cu) (net 4)) 449 | (segment (start 156.3757 102.9948) (end 155.5811 102.2002) (width 0.254) (layer B.Cu) (net 4)) 450 | (segment (start 156.3757 103.505) (end 156.3757 102.9948) (width 0.254) (layer B.Cu) (net 4)) 451 | (segment (start 160.147 105.347) (end 160.147 103.505) (width 0.254) (layer B.Cu) (net 5)) 452 | (segment (start 155.71 109.784) (end 160.147 105.347) (width 0.254) (layer B.Cu) (net 5)) 453 | (segment (start 133.35 103.886) (end 133.477 104.013) (width 0.254) (layer B.Cu) (net 7)) 454 | (segment (start 133.032 104.013) (end 132.778 103.759) (width 0.254) (layer B.Cu) (net 7)) 455 | (segment (start 133.477 104.013) (end 133.032 104.013) (width 0.254) (layer B.Cu) (net 7)) 456 | (segment (start 133.477 104.013) (end 133.604 104.14) (width 0.254) (layer B.Cu) (net 7)) 457 | (segment (start 133.858 104.394) (end 133.858 108.712) (width 0.254) (layer B.Cu) (net 7)) 458 | (segment (start 133.604 104.14) (end 133.858 104.394) (width 0.254) (layer B.Cu) (net 7)) 459 | 460 | (zone (net 2) (net_name /GND) (layer F.Cu) (tstamp 59446E6D) (hatch edge 0.508) 461 | (connect_pads (clearance 0.508)) 462 | (min_thickness 0.254) 463 | (fill yes (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.508)) 464 | (polygon 465 | (pts 466 | (xy 162.179 113.7285) (xy 131.318 113.792) (xy 131.3815 101.727) (xy 162.179 101.727) 467 | ) 468 | ) 469 | (filled_polygon 470 | (pts 471 | (xy 161.4805 106.668345) (xy 161.466353 106.654173) (xy 160.976413 106.450732) (xy 160.445914 106.450269) (xy 159.95562 106.652854) 472 | (xy 159.580173 107.027647) (xy 159.376732 107.517587) (xy 159.376269 108.048086) (xy 159.578854 108.53838) (xy 159.824145 108.7841) 473 | (xy 159.580173 109.027647) (xy 159.376732 109.517587) (xy 159.376269 110.048086) (xy 159.578854 110.53838) (xy 159.824145 110.7841) 474 | (xy 159.580173 111.027647) (xy 159.376732 111.517587) (xy 159.376269 112.048086) (xy 159.578854 112.53838) (xy 159.953647 112.913827) 475 | (xy 160.386347 113.0935) (xy 156.59275 113.0935) (xy 156.768198 113.020827) (xy 156.946827 112.842199) (xy 157.0435 112.60881) 476 | (xy 157.0435 112.06975) (xy 156.88475 111.911) (xy 155.837 111.911) (xy 155.837 111.931) (xy 155.583 111.931) 477 | (xy 155.583 111.911) (xy 154.53525 111.911) (xy 154.3765 112.06975) (xy 154.3765 112.60881) (xy 154.473173 112.842199) 478 | (xy 154.651802 113.020827) (xy 154.82725 113.0935) (xy 146.55473 113.0935) (xy 146.98638 112.915146) (xy 147.361827 112.540353) 479 | (xy 147.565268 112.050413) (xy 147.565731 111.519914) (xy 147.363146 111.02962) (xy 147.117855 110.7839) (xy 147.361827 110.540353) 480 | (xy 147.565268 110.050413) (xy 147.565731 109.519914) (xy 147.363146 109.02962) (xy 147.117855 108.7839) (xy 147.361827 108.540353) 481 | (xy 147.565268 108.050413) (xy 147.565724 107.527906) (xy 149.595331 105.4983) (xy 152.34667 105.4983) (xy 154.376723 107.528353) 482 | (xy 154.376269 108.048086) (xy 154.578854 108.53838) (xy 154.824145 108.7841) (xy 154.580173 109.027647) (xy 154.376732 109.517587) 483 | (xy 154.376269 110.048086) (xy 154.578854 110.53838) (xy 154.619689 110.579286) (xy 154.473173 110.725801) (xy 154.3765 110.95919) 484 | (xy 154.3765 111.49825) (xy 154.53525 111.657) (xy 155.583 111.657) (xy 155.583 111.637) (xy 155.837 111.637) 485 | (xy 155.837 111.657) (xy 156.88475 111.657) (xy 157.0435 111.49825) (xy 157.0435 110.95919) (xy 156.946827 110.725801) 486 | (xy 156.800568 110.579543) (xy 156.839827 110.540353) (xy 157.043268 110.050413) (xy 157.043731 109.519914) (xy 156.841146 109.02962) 487 | (xy 156.595855 108.7839) (xy 156.839827 108.540353) (xy 157.043268 108.050413) (xy 157.043731 107.519914) (xy 156.841146 107.02962) 488 | (xy 156.466353 106.654173) (xy 155.976413 106.450732) (xy 155.453907 106.450276) (xy 153.581349 104.577719) (xy 153.797 104.254974) 489 | (xy 154.016946 104.584147) (xy 154.498715 104.906054) (xy 155.067 105.019093) (xy 155.635285 104.906054) (xy 156.117054 104.584147) 490 | (xy 156.337 104.254974) (xy 156.556946 104.584147) (xy 157.038715 104.906054) (xy 157.607 105.019093) (xy 158.175285 104.906054) 491 | (xy 158.657054 104.584147) (xy 158.877 104.254974) (xy 159.096946 104.584147) (xy 159.578715 104.906054) (xy 160.147 105.019093) 492 | (xy 160.715285 104.906054) (xy 161.197054 104.584147) (xy 161.4805 104.159939) 493 | ) 494 | ) 495 | (filled_polygon 496 | (pts 497 | (xy 144.622866 102.606611) (xy 144.246959 103.021577) (xy 144.086096 103.409961) (xy 144.208085 103.632) (xy 145.351 103.632) 498 | (xy 145.351 103.612) (xy 145.605 103.612) (xy 145.605 103.632) (xy 146.747915 103.632) (xy 146.869904 103.409961) 499 | (xy 146.709041 103.021577) (xy 146.333134 102.606611) (xy 145.950464 102.4255) (xy 148.544743 102.4255) (xy 148.502 102.528691) 500 | (xy 148.502 103.21925) (xy 148.66075 103.378) (xy 149.86 103.378) (xy 149.86 103.358) (xy 150.114 103.358) 501 | (xy 150.114 103.378) (xy 150.134 103.378) (xy 150.134 103.632) (xy 150.114 103.632) (xy 150.114 103.652) 502 | (xy 149.86 103.652) (xy 149.86 103.632) (xy 148.66075 103.632) (xy 148.502 103.79075) (xy 148.502 104.436369) 503 | (xy 146.487647 106.450723) (xy 145.967914 106.450269) (xy 145.47762 106.652854) (xy 145.10783 107.022) (xy 142.355539 107.022) 504 | (xy 141.988353 106.654173) (xy 141.498413 106.450732) (xy 140.967914 106.450269) (xy 140.47762 106.652854) (xy 140.102173 107.027647) 505 | (xy 139.898732 107.517587) (xy 139.898269 108.048086) (xy 140.100854 108.53838) (xy 140.346145 108.7841) (xy 140.102173 109.027647) 506 | (xy 139.898732 109.517587) (xy 139.898269 110.048086) (xy 140.100854 110.53838) (xy 140.141689 110.579286) (xy 139.995173 110.725801) 507 | (xy 139.8985 110.95919) (xy 139.8985 111.49825) (xy 140.05725 111.657) (xy 141.105 111.657) (xy 141.105 111.637) 508 | (xy 141.359 111.637) (xy 141.359 111.657) (xy 142.40675 111.657) (xy 142.5655 111.49825) (xy 142.5655 110.95919) 509 | (xy 142.468827 110.725801) (xy 142.322568 110.579543) (xy 142.361827 110.540353) (xy 142.565268 110.050413) (xy 142.565731 109.519914) 510 | (xy 142.363146 109.02962) (xy 142.117855 108.7839) (xy 142.35617 108.546) (xy 145.108461 108.546) (xy 145.346145 108.7841) 511 | (xy 145.102173 109.027647) (xy 144.898732 109.517587) (xy 144.898269 110.048086) (xy 145.100854 110.53838) (xy 145.346145 110.7841) 512 | (xy 145.102173 111.027647) (xy 144.898732 111.517587) (xy 144.898269 112.048086) (xy 145.100854 112.53838) (xy 145.475647 112.913827) 513 | (xy 145.908347 113.0935) (xy 142.11475 113.0935) (xy 142.290198 113.020827) (xy 142.468827 112.842199) (xy 142.5655 112.60881) 514 | (xy 142.5655 112.06975) (xy 142.40675 111.911) (xy 141.359 111.911) (xy 141.359 111.931) (xy 141.105 111.931) 515 | (xy 141.105 111.911) (xy 140.05725 111.911) (xy 139.8985 112.06975) (xy 139.8985 112.60881) (xy 139.995173 112.842199) 516 | (xy 140.173802 113.020827) (xy 140.34925 113.0935) (xy 132.0165 113.0935) (xy 132.0165 107.812) (xy 132.31056 107.812) 517 | (xy 132.31056 109.612) (xy 132.354838 109.847317) (xy 132.49391 110.063441) (xy 132.70611 110.208431) (xy 132.726534 110.212567) 518 | (xy 132.557449 110.381357) (xy 132.323267 110.94533) (xy 132.322735 111.555991) (xy 132.555932 112.120371) (xy 132.987357 112.552551) 519 | (xy 133.55133 112.786733) (xy 134.161991 112.787265) (xy 134.726371 112.554068) (xy 135.158551 112.122643) (xy 135.392733 111.55867) 520 | (xy 135.393265 110.948009) (xy 135.160068 110.383629) (xy 134.99212 110.215387) (xy 134.993317 110.215162) (xy 135.209441 110.07609) 521 | (xy 135.354431 109.86389) (xy 135.40544 109.612) (xy 135.40544 107.812) (xy 135.361162 107.576683) (xy 135.22209 107.360559) 522 | (xy 135.00989 107.215569) (xy 134.758 107.16456) (xy 132.958 107.16456) (xy 132.722683 107.208838) (xy 132.506559 107.34791) 523 | (xy 132.361569 107.56011) (xy 132.31056 107.812) (xy 132.0165 107.812) (xy 132.0165 104.996592) (xy 132.491309 105.19375) 524 | (xy 133.062187 105.194248) (xy 133.5898 104.976243) (xy 133.993824 104.572923) (xy 134.18686 104.108039) (xy 144.086096 104.108039) 525 | (xy 144.246959 104.496423) (xy 144.622866 104.911389) (xy 145.128959 105.150914) (xy 145.351 105.029629) (xy 145.351 103.886) 526 | (xy 145.605 103.886) (xy 145.605 105.029629) (xy 145.827041 105.150914) (xy 146.333134 104.911389) (xy 146.709041 104.496423) 527 | (xy 146.869904 104.108039) (xy 146.747915 103.886) (xy 145.605 103.886) (xy 145.351 103.886) (xy 144.208085 103.886) 528 | (xy 144.086096 104.108039) (xy 134.18686 104.108039) (xy 134.21275 104.045691) (xy 134.213248 103.474813) (xy 133.995243 102.9472) 529 | (xy 133.591923 102.543176) (xy 133.308528 102.4255) (xy 145.005536 102.4255) 530 | ) 531 | ) 532 | ) 533 | (zone (net 3) (net_name /VCC) (layer B.Cu) (tstamp 59446E6E) (hatch edge 0.508) 534 | (connect_pads (clearance 0.508)) 535 | (min_thickness 0.254) 536 | (fill yes (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.508)) 537 | (polygon 538 | (pts 539 | (xy 162.179 101.727) (xy 162.179 113.7285) (xy 131.318 113.7285) (xy 131.3815 101.6635) 540 | ) 541 | ) 542 | (filled_polygon 543 | (pts 544 | (xy 159.096946 104.584147) (xy 159.385 104.776618) (xy 159.385 105.031369) (xy 157.010283 107.406086) (xy 156.8798 107.091071) 545 | (xy 156.644188 107.029417) (xy 155.889605 107.784) (xy 155.903748 107.798143) (xy 155.724143 107.977748) (xy 155.71 107.963605) 546 | (xy 155.066612 108.606993) (xy 154.95562 108.652854) (xy 154.580173 109.027647) (xy 154.376732 109.517587) (xy 154.376269 110.048086) 547 | (xy 154.578854 110.53838) (xy 154.62197 110.581571) (xy 154.560059 110.62141) (xy 154.415069 110.83361) (xy 154.36406 111.0855) 548 | (xy 154.36406 112.4825) (xy 154.408338 112.717817) (xy 154.54741 112.933941) (xy 154.75961 113.078931) (xy 154.831554 113.0935) 549 | (xy 146.55473 113.0935) (xy 146.98638 112.915146) (xy 147.361827 112.540353) (xy 147.565268 112.050413) (xy 147.565731 111.519914) 550 | (xy 147.363146 111.02962) (xy 147.117855 110.7839) (xy 147.35617 110.546) (xy 148.0669 110.546) (xy 148.358505 110.487996) 551 | (xy 148.605715 110.322815) (xy 151.33705 107.59148) (xy 154.364073 107.59148) (xy 154.392852 108.121199) (xy 154.5402 108.476929) 552 | (xy 154.775812 108.538583) (xy 155.530395 107.784) (xy 154.775812 107.029417) (xy 154.5402 107.091071) (xy 154.364073 107.59148) 553 | (xy 151.33705 107.59148) (xy 152.078718 106.849812) (xy 154.955417 106.849812) (xy 155.71 107.604395) (xy 156.464583 106.849812) 554 | (xy 156.402929 106.6142) (xy 155.90252 106.438073) (xy 155.372801 106.466852) (xy 155.017071 106.6142) (xy 154.955417 106.849812) 555 | (xy 152.078718 106.849812) (xy 154.213231 104.7153) (xy 154.498715 104.906054) (xy 155.067 105.019093) (xy 155.635285 104.906054) 556 | (xy 156.117054 104.584147) (xy 156.334447 104.258794) (xy 156.340335 104.259966) (xy 156.556946 104.584147) (xy 157.038715 104.906054) 557 | (xy 157.607 105.019093) (xy 158.175285 104.906054) (xy 158.657054 104.584147) (xy 158.877 104.254974) 558 | ) 559 | ) 560 | (filled_polygon 561 | (pts 562 | (xy 142.838285 103.608985) (xy 142.673104 103.856195) (xy 142.6151 104.1478) (xy 142.6151 107.323269) (xy 142.532283 107.406086) 563 | (xy 142.4018 107.091071) (xy 142.166188 107.029417) (xy 141.411605 107.784) (xy 141.425748 107.798143) (xy 141.246143 107.977748) 564 | (xy 141.232 107.963605) (xy 140.588612 108.606993) (xy 140.47762 108.652854) (xy 140.102173 109.027647) (xy 139.898732 109.517587) 565 | (xy 139.898269 110.048086) (xy 140.100854 110.53838) (xy 140.14397 110.581571) (xy 140.082059 110.62141) (xy 139.937069 110.83361) 566 | (xy 139.88606 111.0855) (xy 139.88606 112.1019) (xy 135.78553 112.1019) (xy 135.348595 111.664965) (xy 135.392733 111.55867) 567 | (xy 135.393265 110.948009) (xy 135.160068 110.383629) (xy 134.99212 110.215387) (xy 134.993317 110.215162) (xy 135.209441 110.07609) 568 | (xy 135.354431 109.86389) (xy 135.40544 109.612) (xy 135.40544 107.812) (xy 135.363947 107.59148) (xy 139.886073 107.59148) 569 | (xy 139.914852 108.121199) (xy 140.0622 108.476929) (xy 140.297812 108.538583) (xy 141.052395 107.784) (xy 140.297812 107.029417) 570 | (xy 140.0622 107.091071) (xy 139.886073 107.59148) (xy 135.363947 107.59148) (xy 135.361162 107.576683) (xy 135.22209 107.360559) 571 | (xy 135.00989 107.215569) (xy 134.758 107.16456) (xy 134.62 107.16456) (xy 134.62 106.849812) (xy 140.477417 106.849812) 572 | (xy 141.232 107.604395) (xy 141.986583 106.849812) (xy 141.924929 106.6142) (xy 141.42452 106.438073) (xy 140.894801 106.466852) 573 | (xy 140.539071 106.6142) (xy 140.477417 106.849812) (xy 134.62 106.849812) (xy 134.62 104.394) (xy 134.561996 104.102395) 574 | (xy 134.52739 104.050604) (xy 134.396815 103.855184) (xy 134.213076 103.671446) (xy 134.213248 103.474813) (xy 133.995243 102.9472) 575 | (xy 133.591923 102.543176) (xy 133.308528 102.4255) (xy 144.021769 102.4255) 576 | ) 577 | ) 578 | (filled_polygon 579 | (pts 580 | (xy 148.48956 104.355) (xy 148.533838 104.590317) (xy 148.67291 104.806441) (xy 148.88511 104.951431) (xy 149.137 105.00244) 581 | (xy 150.837 105.00244) (xy 151.072317 104.958162) (xy 151.288441 104.81909) (xy 151.433431 104.60689) (xy 151.455301 104.498893) 582 | (xy 151.760076 104.776645) (xy 151.927344 104.845925) (xy 147.75127 109.022) (xy 147.355539 109.022) (xy 146.988353 108.654173) 583 | (xy 146.875855 108.60746) (xy 146.232 107.963605) (xy 146.217858 107.977748) (xy 146.038253 107.798143) (xy 146.052395 107.784) 584 | (xy 146.411605 107.784) (xy 147.166188 108.538583) (xy 147.4018 108.476929) (xy 147.577927 107.97652) (xy 147.549148 107.446801) 585 | (xy 147.4018 107.091071) (xy 147.166188 107.029417) (xy 146.411605 107.784) (xy 146.052395 107.784) (xy 146.038253 107.769858) 586 | (xy 146.217858 107.590253) (xy 146.232 107.604395) (xy 146.986583 106.849812) (xy 146.924929 106.6142) (xy 146.42452 106.438073) 587 | (xy 145.894801 106.466852) (xy 145.7506 106.526582) (xy 145.7506 105.74533) (xy 146.016815 105.479115) (xy 146.181996 105.231905) 588 | (xy 146.189536 105.194) (xy 146.235176 104.964554) (xy 146.520811 104.773698) (xy 146.83188 104.308151) (xy 146.941113 103.759) 589 | (xy 146.83188 103.209849) (xy 146.666406 102.9622) (xy 148.48956 102.9622) 590 | ) 591 | ) 592 | (filled_polygon 593 | (pts 594 | (xy 152.654 103.378) (xy 152.674 103.378) (xy 152.674 103.632) (xy 152.654 103.632) (xy 152.654 103.652) 595 | (xy 152.4 103.652) (xy 152.4 103.632) (xy 152.38 103.632) (xy 152.38 103.378) (xy 152.4 103.378) 596 | (xy 152.4 103.358) (xy 152.654 103.358) 597 | ) 598 | ) 599 | ) 600 | ) 601 | -------------------------------------------------------------------------------- /pcb-board/front-panel/front-panel.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderkevin/mini-nes/5b6a0ac12719177fa43fabb03cbf7ab6c81edf06/pcb-board/front-panel/front-panel.pdf -------------------------------------------------------------------------------- /pcb-board/front-panel/front-panel.pro: -------------------------------------------------------------------------------- 1 | update=6/18/2017 4:33:57 AM 2 | version=1 3 | last_client=kicad 4 | [pcbnew] 5 | version=1 6 | LastNetListRead= 7 | UseCmpFile=1 8 | PadDrill=0.600000000000 9 | PadDrillOvalY=0.600000000000 10 | PadSizeH=1.500000000000 11 | PadSizeV=1.500000000000 12 | PcbTextSizeV=1.500000000000 13 | PcbTextSizeH=1.500000000000 14 | PcbTextThickness=0.300000000000 15 | ModuleTextSizeV=1.000000000000 16 | ModuleTextSizeH=1.000000000000 17 | ModuleTextSizeThickness=0.150000000000 18 | SolderMaskClearance=0.000000000000 19 | SolderMaskMinWidth=0.000000000000 20 | DrawSegmentWidth=0.200000000000 21 | BoardOutlineThickness=0.100000000000 22 | ModuleOutlineThickness=0.150000000000 23 | [cvpcb] 24 | version=1 25 | NetIExt=net 26 | [general] 27 | version=1 28 | [eeschema] 29 | version=1 30 | LibDir=../../../MyLibrary/library 31 | [eeschema/libraries] 32 | LibName1=power 33 | LibName2=device 34 | LibName3=transistors 35 | LibName4=conn 36 | LibName5=linear 37 | LibName6=regul 38 | LibName7=74xx 39 | LibName8=cmos4000 40 | LibName9=adc-dac 41 | LibName10=memory 42 | LibName11=xilinx 43 | LibName12=microcontrollers 44 | LibName13=dsp 45 | LibName14=microchip 46 | LibName15=analog_switches 47 | LibName16=motorola 48 | LibName17=texas 49 | LibName18=intel 50 | LibName19=audio 51 | LibName20=interface 52 | LibName21=digital-audio 53 | LibName22=philips 54 | LibName23=display 55 | LibName24=cypress 56 | LibName25=siliconi 57 | LibName26=opto 58 | LibName27=atmel 59 | LibName28=contrib 60 | LibName29=valves 61 | LibName30=C:/Users/mafe7/Documents/KiCad/MyLibrary/library/e-switch 62 | [schematic_editor] 63 | version=1 64 | PageLayoutDescrFile= 65 | PlotDirectoryName= 66 | SubpartIdSeparator=0 67 | SubpartFirstId=65 68 | NetFmtName=Pcbnew 69 | SpiceForceRefPrefix=0 70 | SpiceUseNetNumbers=0 71 | LabSize=60 72 | -------------------------------------------------------------------------------- /pcb-board/front-panel/front-panel.rules: -------------------------------------------------------------------------------- 1 | 2 | (rules PCB Mini-NES_Panel 3 | (snap_angle 4 | fortyfive_degree 5 | ) 6 | (autoroute_settings 7 | (fanout off) 8 | (autoroute on) 9 | (postroute on) 10 | (vias on) 11 | (via_costs 50) 12 | (plane_via_costs 5) 13 | (start_ripup_costs 100) 14 | (start_pass_no 124) 15 | (layer_rule F.Cu 16 | (active on) 17 | (preferred_direction horizontal) 18 | (preferred_direction_trace_costs 1.0) 19 | (against_preferred_direction_trace_costs 3.5) 20 | ) 21 | (layer_rule B.Cu 22 | (active on) 23 | (preferred_direction vertical) 24 | (preferred_direction_trace_costs 1.0) 25 | (against_preferred_direction_trace_costs 1.4) 26 | ) 27 | ) 28 | (rule 29 | (width 254.0) 30 | (clear 254.2) 31 | (clear 127.0 (type smd_to_turn_gap)) 32 | (clear 63.6 (type smd_smd)) 33 | (clear 200.2 (type 0.2mm_0.2mm)) 34 | (clear 152.6 (type Minimal_Minimal)) 35 | ) 36 | (padstack "Via[0-1]_685.8:330.2_um" 37 | (shape 38 | (circle F.Cu 685.8 0.0 0.0) 39 | ) 40 | (shape 41 | (circle B.Cu 685.8 0.0 0.0) 42 | ) 43 | (attach off) 44 | ) 45 | (via 46 | "Via[0-1]_685.8:330.2_um" "Via[0-1]_685.8:330.2_um" default 47 | ) 48 | (via 49 | "Via[0-1]_685.8:330.2_um-kicad_default" "Via[0-1]_685.8:330.2_um" "kicad_default" 50 | ) 51 | (via 52 | "Via[0-1]_685.8:330.2_um-0.2mm" "Via[0-1]_685.8:330.2_um" 0.2mm 53 | ) 54 | (via 55 | "Via[0-1]_685.8:330.2_um-Minimal" "Via[0-1]_685.8:330.2_um" Minimal 56 | ) 57 | (via_rule 58 | default "Via[0-1]_685.8:330.2_um" 59 | ) 60 | (via_rule 61 | "kicad_default" "Via[0-1]_685.8:330.2_um-kicad_default" 62 | ) 63 | (via_rule 64 | 0.2mm "Via[0-1]_685.8:330.2_um-0.2mm" 65 | ) 66 | (via_rule 67 | Minimal "Via[0-1]_685.8:330.2_um-Minimal" 68 | ) 69 | (class default 70 | (clearance_class default) 71 | (via_rule default) 72 | (rule 73 | (width 254.0) 74 | ) 75 | (circuit 76 | (use_layer F.Cu B.Cu) 77 | ) 78 | ) 79 | (class "kicad_default" 80 | /LED /GND /VCC /PWR /RST "Net-(SW2-Pad4)" "Net-(D1-Pad1)" 81 | (clearance_class "kicad_default") 82 | (via_rule kicad_default) 83 | (rule 84 | (width 254.0) 85 | ) 86 | (circuit 87 | (use_layer F.Cu B.Cu) 88 | ) 89 | ) 90 | (class 0.2mm 91 | (clearance_class 0.2mm) 92 | (via_rule 0.2mm) 93 | (rule 94 | (width 200.0) 95 | ) 96 | (circuit 97 | (use_layer F.Cu B.Cu) 98 | ) 99 | ) 100 | (class Minimal 101 | (clearance_class Minimal) 102 | (via_rule Minimal) 103 | (rule 104 | (width 152.4) 105 | ) 106 | (circuit 107 | (use_layer F.Cu B.Cu) 108 | ) 109 | ) 110 | ) -------------------------------------------------------------------------------- /pcb-board/front-panel/front-panel.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 2 | LIBS:power 3 | LIBS:device 4 | LIBS:transistors 5 | LIBS:conn 6 | LIBS:linear 7 | LIBS:regul 8 | LIBS:74xx 9 | LIBS:cmos4000 10 | LIBS:adc-dac 11 | LIBS:memory 12 | LIBS:xilinx 13 | LIBS:microcontrollers 14 | LIBS:dsp 15 | LIBS:microchip 16 | LIBS:analog_switches 17 | LIBS:motorola 18 | LIBS:texas 19 | LIBS:intel 20 | LIBS:audio 21 | LIBS:interface 22 | LIBS:digital-audio 23 | LIBS:philips 24 | LIBS:display 25 | LIBS:cypress 26 | LIBS:siliconi 27 | LIBS:opto 28 | LIBS:atmel 29 | LIBS:contrib 30 | LIBS:valves 31 | LIBS:e-switch 32 | LIBS:Mini-NES_Panel-cache 33 | EELAYER 25 0 34 | EELAYER END 35 | $Descr USLetter 11000 8500 36 | encoding utf-8 37 | Sheet 1 1 38 | Title "Mini-NES_NFC_FRONT-PANEL by @coderkevin" 39 | Date "2017-05-18" 40 | Rev "1.0" 41 | Comp "Eladio Martinez" 42 | Comment1 "" 43 | Comment2 "" 44 | Comment3 "" 45 | Comment4 "" 46 | $EndDescr 47 | $Comp 48 | L CONN_01X05 J1 49 | U 1 1 591E5B6A 50 | P 2800 4700 51 | F 0 "J1" H 2800 5000 50 0000 C CNN 52 | F 1 "FRONT_CONN" V 2900 4700 50 0000 C CNN 53 | F 2 "Pin_Headers:Pin_Header_Straight_1x05_Pitch2.54mm" H 2800 4700 50 0001 C CNN 54 | F 3 "" H 2800 4700 50 0001 C CNN 55 | 1 2800 4700 56 | 1 0 0 -1 57 | $EndComp 58 | Wire Wire Line 59 | 8450 2450 8450 2100 60 | Connection ~ 7850 2450 61 | Text Label 2600 4500 2 60 ~ 0 62 | GND 63 | Text Label 2600 4600 2 60 ~ 0 64 | VCC 65 | Text Label 8250 4450 0 60 ~ 0 66 | LED 67 | Text Label 2600 4800 2 60 ~ 0 68 | PWR 69 | Text Label 2600 4900 2 60 ~ 0 70 | RST 71 | Text Label 2350 1950 2 60 ~ 0 72 | RST 73 | Text Label 7450 2000 2 60 ~ 0 74 | PWR 75 | Text Label 8050 2000 2 60 ~ 0 76 | LED 77 | $Comp 78 | L LED D1 79 | U 1 1 591E600E 80 | P 8050 4450 81 | F 0 "D1" H 8050 4550 50 0000 C CNN 82 | F 1 "LED" H 8050 4350 50 0000 C CNN 83 | F 2 "LEDs:LED_D3.0mm" H 8050 4450 50 0001 C CNN 84 | F 3 "" H 8050 4450 50 0001 C CNN 85 | 1 8050 4450 86 | 1 0 0 -1 87 | $EndComp 88 | Text Label 2750 1850 0 60 ~ 0 89 | GND 90 | NoConn ~ 8450 1900 91 | Text Notes 5700 1050 0 118 ~ 0 92 | Power Button 93 | $Comp 94 | L R R1 95 | U 1 1 591F3340 96 | P 7700 4650 97 | F 0 "R1" V 7780 4650 50 0000 C CNN 98 | F 1 "220h" V 7700 4650 50 0000 C CNN 99 | F 2 "Resistors_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P12.70mm_Horizontal" V 7630 4650 50 0001 C CNN 100 | F 3 "" H 7700 4650 50 0001 C CNN 101 | 1 7700 4650 102 | 1 0 0 -1 103 | $EndComp 104 | Wire Wire Line 105 | 8250 4450 8200 4450 106 | $Comp 107 | L TL2230OA SW1 108 | U 1 1 591F3F8D 109 | P 2550 1950 110 | F 0 "SW1" H 2550 2120 50 0000 C CNN 111 | F 1 "TL2230OA" H 2550 1750 50 0000 C CNN 112 | F 2 "e-switch:TL2230" H 2550 1950 50 0001 C CNN 113 | F 3 "" H 2550 1950 50 0001 C CNN 114 | 1 2550 1950 115 | 1 0 0 -1 116 | $EndComp 117 | $Comp 118 | L TL2230EE SW2 119 | U 1 1 591F4014 120 | P 7650 2000 121 | F 0 "SW2" H 7650 2170 50 0000 C CNN 122 | F 1 "TL2230EE" H 7650 1800 50 0000 C CNN 123 | F 2 "e-switch:TL2230" H 7650 2000 50 0001 C CNN 124 | F 3 "" H 7650 2000 50 0001 C CNN 125 | 1 7650 2000 126 | 1 0 0 -1 127 | $EndComp 128 | $Comp 129 | L TL2230EE SW2 130 | U 2 1 591F40A7 131 | P 8250 2000 132 | F 0 "SW2" H 8250 2170 50 0000 C CNN 133 | F 1 "TL2230EE" H 8250 1800 50 0000 C CNN 134 | F 2 "e-switch:TL2230" H 8250 2000 50 0001 C CNN 135 | F 3 "" H 8250 2000 50 0001 C CNN 136 | 2 8250 2000 137 | 1 0 0 -1 138 | $EndComp 139 | Text Notes 750 1050 0 118 ~ 0 140 | Reset Button 141 | Text Label 8450 2100 0 60 ~ 0 142 | VCC 143 | Wire Wire Line 144 | 7850 2100 7850 2450 145 | Text Label 2600 4700 2 60 ~ 0 146 | LED 147 | Text Label 7950 4900 0 60 ~ 0 148 | GND 149 | Text Label 7850 1700 0 60 ~ 0 150 | GND 151 | Wire Wire Line 152 | 7850 1900 7850 1700 153 | Text Label 2750 2050 0 60 ~ 0 154 | VCC 155 | Wire Wire Line 156 | 7850 2450 8450 2450 157 | Wire Notes Line 158 | 10500 3300 450 3300 159 | Wire Notes Line 160 | 5350 450 5350 6200 161 | Wire Notes Line 162 | 450 6200 10550 6200 163 | Text Notes 5750 3900 0 118 ~ 0 164 | Power LED 165 | Text Notes 800 3900 0 118 ~ 0 166 | Connector 167 | Text Notes 8950 3100 0 60 ~ 0 168 | Note: Latching push button 169 | Text Notes 3750 3100 0 60 ~ 0 170 | Note: Momentary push button 171 | Wire Wire Line 172 | 7900 4450 7700 4450 173 | Wire Wire Line 174 | 7700 4450 7700 4500 175 | Wire Wire Line 176 | 7700 4800 7700 4900 177 | Wire Wire Line 178 | 7700 4900 7950 4900 179 | $EndSCHEMATC 180 | -------------------------------------------------------------------------------- /pcb-board/front-panel/front-panel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | C:/Users/mafe7/Documents/GitHub/mini-nes/pcb-board/front-panel/front-panel.sch 5 | 6/18/2017 4:34:39 AM 6 | Eeschema 4.0.6 7 | 8 | 9 | Mini-NES_NFC_FRONT-PANEL by @coderkevin 10 | Eladio Martinez 11 | 1.0 12 | 2017-05-18 13 | front-panel.sch 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | FRONT_CONN 24 | Pin_Headers:Pin_Header_Straight_1x05_Pitch2.54mm 25 | 26 | 27 | 591E5B6A 28 | 29 | 30 | LED 31 | LEDs:LED_D3.0mm 32 | 33 | 34 | 591E600E 35 | 36 | 37 | 220h 38 | Resistors_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P12.70mm_Horizontal 39 | 40 | 41 | 591F3340 42 | 43 | 44 | TL2230OA 45 | e-switch:TL2230 46 | 47 | 48 | 591F3F8D 49 | 50 | 51 | TL2230EE 52 | e-switch:TL2230 53 | 54 | 55 | 591F4014 56 | 57 | 58 | 59 | 60 | Connector, single row, 01x05, pin header 61 | 62 | Pin_Header_Straight_1X* 63 | Pin_Header_Angled_1X* 64 | Socket_Strip_Straight_1X* 65 | Socket_Strip_Angled_1X* 66 | 67 | 68 | J 69 | CONN_01X05 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | LED generic 81 | 82 | LED* 83 | 84 | 85 | D 86 | LED 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | Resistor 95 | 96 | R_* 97 | R_* 98 | 99 | 100 | R 101 | R 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | Switch, dual Latching Type DPDT Mini Push Button, 6Pins Square 7mmx7mm 110 | C:/Users/mafe7/Documents/KiCad/MyLibrary/data_sheet/TL2230EE_datasheet.pdf 111 | 112 | DPDT* 113 | 114 | 115 | SW 116 | TL2230EE 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | Switch, dual Momentary Type DPDT Mini Push Button, 6Pins Square 7mmx7mm 129 | C:/Users/mafe7/Documents/KiCad/MyLibrary/data_sheet/TL2230OA_datasheet.pdf 130 | 131 | DPDT* 132 | 133 | 134 | SW 135 | TL2230OA 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | C:\Users\mafe7\Documents\KiCad\MyLibrary\library\e-switch.lib 150 | 151 | 152 | C:\Program Files\KiCad\share\kicad\library\conn.lib 153 | 154 | 155 | C:\Program Files\KiCad\share\kicad\library\device.lib 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /pcb-board/main-board/main-board-back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderkevin/mini-nes/5b6a0ac12719177fa43fabb03cbf7ab6c81edf06/pcb-board/main-board/main-board-back.png -------------------------------------------------------------------------------- /pcb-board/main-board/main-board-front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderkevin/mini-nes/5b6a0ac12719177fa43fabb03cbf7ab6c81edf06/pcb-board/main-board/main-board-front.png -------------------------------------------------------------------------------- /pcb-board/main-board/main-board.kicad_pcb: -------------------------------------------------------------------------------- 1 | (kicad_pcb (version 4) (host pcbnew 4.0.6) 2 | 3 | (general 4 | (links 12) 5 | (no_connects 0) 6 | (area 141.421 113.780999 165.672667 136.953142) 7 | (thickness 1.6) 8 | (drawings 17) 9 | (tracks 51) 10 | (zones 0) 11 | (modules 5) 12 | (nets 18) 13 | ) 14 | 15 | (page USLetter) 16 | (title_block 17 | (title "Mini-NES_NFC by @coderkevin") 18 | (date 2017-05-18) 19 | (rev 1.0) 20 | (company "Eladio Martinez") 21 | (comment 1 https://github.com/coderkevin/mini-nes) 22 | (comment 2 https://oshpark.com/shared_projects/WR0dwyfv) 23 | ) 24 | 25 | (layers 26 | (0 F.Cu signal) 27 | (31 B.Cu signal) 28 | (32 B.Adhes user) 29 | (33 F.Adhes user) 30 | (34 B.Paste user) 31 | (35 F.Paste user) 32 | (36 B.SilkS user) 33 | (37 F.SilkS user) 34 | (38 B.Mask user) 35 | (39 F.Mask user) 36 | (40 Dwgs.User user) 37 | (41 Cmts.User user) 38 | (42 Eco1.User user) 39 | (43 Eco2.User user) 40 | (44 Edge.Cuts user) 41 | (45 Margin user) 42 | (46 B.CrtYd user) 43 | (47 F.CrtYd user) 44 | (48 B.Fab user) 45 | (49 F.Fab user) 46 | ) 47 | 48 | (setup 49 | (last_trace_width 0.254) 50 | (user_trace_width 0.1524) 51 | (user_trace_width 0.2) 52 | (user_trace_width 0.25) 53 | (user_trace_width 0.3) 54 | (user_trace_width 0.4) 55 | (user_trace_width 0.5) 56 | (user_trace_width 0.6) 57 | (user_trace_width 0.8) 58 | (user_trace_width 1) 59 | (user_trace_width 1.2) 60 | (user_trace_width 1.5) 61 | (user_trace_width 2) 62 | (trace_clearance 0.254) 63 | (zone_clearance 0.508) 64 | (zone_45_only no) 65 | (trace_min 0.1524) 66 | (segment_width 0.127) 67 | (edge_width 0.127) 68 | (via_size 0.6858) 69 | (via_drill 0.3302) 70 | (via_min_size 0.6858) 71 | (via_min_drill 0.3302) 72 | (uvia_size 0.508) 73 | (uvia_drill 0.127) 74 | (uvias_allowed no) 75 | (uvia_min_size 0.508) 76 | (uvia_min_drill 0.127) 77 | (pcb_text_width 0.127) 78 | (pcb_text_size 0.6 0.6) 79 | (mod_edge_width 0.127) 80 | (mod_text_size 0.6 0.6) 81 | (mod_text_width 0.127) 82 | (pad_size 1.524 1.524) 83 | (pad_drill 0.762) 84 | (pad_to_mask_clearance 0.05) 85 | (pad_to_paste_clearance -0.04) 86 | (aux_axis_origin 0 0) 87 | (visible_elements 7FFFFFFF) 88 | (pcbplotparams 89 | (layerselection 0x010f0_80000001) 90 | (usegerberextensions true) 91 | (excludeedgelayer true) 92 | (linewidth 0.127000) 93 | (plotframeref false) 94 | (viasonmask false) 95 | (mode 1) 96 | (useauxorigin false) 97 | (hpglpennumber 1) 98 | (hpglpenspeed 20) 99 | (hpglpendiameter 15) 100 | (hpglpenoverlay 2) 101 | (psnegative false) 102 | (psa4output false) 103 | (plotreference true) 104 | (plotvalue true) 105 | (plotinvisibletext false) 106 | (padsonsilk false) 107 | (subtractmaskfromsilk false) 108 | (outputformat 1) 109 | (mirror false) 110 | (drillshape 0) 111 | (scaleselection 1) 112 | (outputdirectory Mini-NES_Board.gerber/)) 113 | ) 114 | 115 | (net 0 "") 116 | (net 1 /LED) 117 | (net 2 /GND) 118 | (net 3 /VCC) 119 | (net 4 /SDA) 120 | (net 5 /SCL) 121 | (net 6 "Net-(J2-Pad2)") 122 | (net 7 "Net-(J2-Pad4)") 123 | (net 8 "Net-(J2-Pad6)") 124 | (net 9 "Net-(J2-Pad7)") 125 | (net 10 "Net-(J2-Pad8)") 126 | (net 11 "Net-(J2-Pad10)") 127 | (net 12 /RST) 128 | (net 13 "Net-(J2-Pad12)") 129 | (net 14 /PWR) 130 | (net 15 "Net-(J2-Pad14)") 131 | (net 16 "Net-(J2-Pad16)") 132 | (net 17 "Net-(J3-Pad2)") 133 | 134 | (net_class Default "Dit is de standaard class." 135 | (clearance 0.254) 136 | (trace_width 0.254) 137 | (via_dia 0.6858) 138 | (via_drill 0.3302) 139 | (uvia_dia 0.508) 140 | (uvia_drill 0.127) 141 | (add_net /GND) 142 | (add_net /LED) 143 | (add_net /PWR) 144 | (add_net /RST) 145 | (add_net /SCL) 146 | (add_net /SDA) 147 | (add_net /VCC) 148 | (add_net "Net-(J2-Pad10)") 149 | (add_net "Net-(J2-Pad12)") 150 | (add_net "Net-(J2-Pad14)") 151 | (add_net "Net-(J2-Pad16)") 152 | (add_net "Net-(J2-Pad2)") 153 | (add_net "Net-(J2-Pad4)") 154 | (add_net "Net-(J2-Pad6)") 155 | (add_net "Net-(J2-Pad7)") 156 | (add_net "Net-(J2-Pad8)") 157 | (add_net "Net-(J3-Pad2)") 158 | ) 159 | 160 | (net_class 0.2mm "" 161 | (clearance 0.2) 162 | (trace_width 0.2) 163 | (via_dia 0.6858) 164 | (via_drill 0.3302) 165 | (uvia_dia 0.508) 166 | (uvia_drill 0.127) 167 | ) 168 | 169 | (net_class Minimal "" 170 | (clearance 0.1524) 171 | (trace_width 0.1524) 172 | (via_dia 0.6858) 173 | (via_drill 0.3302) 174 | (uvia_dia 0.508) 175 | (uvia_drill 0.127) 176 | ) 177 | 178 | (module Connectors_Molex:Molex_PicoBlade_53047-0410_04x1.25mm_Straight placed (layer F.Cu) (tedit 591F2AED) (tstamp 591F2657) 179 | (at 158.877 123.825) 180 | (descr "Molex PicoBlade, single row, top entry type, through hole, PN:53047-0410") 181 | (tags "connector molex picoblade") 182 | (path /591DF89C) 183 | (fp_text reference "NFC READER" (at 1.905 -2.794) (layer F.SilkS) 184 | (effects (font (size 0.6 0.6) (thickness 0.15))) 185 | ) 186 | (fp_text value "NFC READER" (at 1.875 -3.25) (layer F.Fab) hide 187 | (effects (font (size 1 1) (thickness 0.15))) 188 | ) 189 | (fp_line (start -2 -2.55) (end -2 1.6) (layer F.CrtYd) (width 0.05)) 190 | (fp_line (start -2 1.6) (end 5.75 1.6) (layer F.CrtYd) (width 0.05)) 191 | (fp_line (start 5.75 1.6) (end 5.75 -2.55) (layer F.CrtYd) (width 0.05)) 192 | (fp_line (start 5.75 -2.55) (end -2 -2.55) (layer F.CrtYd) (width 0.05)) 193 | (fp_line (start -1.5 -2.075) (end -1.5 1.125) (layer F.Fab) (width 0.1)) 194 | (fp_line (start -1.5 1.125) (end 5.25 1.125) (layer F.Fab) (width 0.1)) 195 | (fp_line (start 5.25 1.125) (end 5.25 -2.075) (layer F.Fab) (width 0.1)) 196 | (fp_line (start 5.25 -2.075) (end -1.5 -2.075) (layer F.Fab) (width 0.1)) 197 | (fp_line (start -1.65 -2.225) (end -1.65 1.275) (layer F.SilkS) (width 0.12)) 198 | (fp_line (start -1.65 1.275) (end 5.4 1.275) (layer F.SilkS) (width 0.12)) 199 | (fp_line (start 5.4 1.275) (end 5.4 -2.225) (layer F.SilkS) (width 0.12)) 200 | (fp_line (start 5.4 -2.225) (end -1.65 -2.225) (layer F.SilkS) (width 0.12)) 201 | (fp_line (start 1.875 0.725) (end -1.1 0.725) (layer F.SilkS) (width 0.12)) 202 | (fp_line (start -1.1 0.725) (end -1.1 0) (layer F.SilkS) (width 0.12)) 203 | (fp_line (start -1.1 0) (end -1.3 0) (layer F.SilkS) (width 0.12)) 204 | (fp_line (start -1.3 0) (end -1.3 -0.8) (layer F.SilkS) (width 0.12)) 205 | (fp_line (start -1.3 -0.8) (end -1.1 -0.8) (layer F.SilkS) (width 0.12)) 206 | (fp_line (start -1.1 -0.8) (end -1.1 -1.675) (layer F.SilkS) (width 0.12)) 207 | (fp_line (start -1.1 -1.675) (end 1.875 -1.675) (layer F.SilkS) (width 0.12)) 208 | (fp_line (start 1.875 0.725) (end 4.85 0.725) (layer F.SilkS) (width 0.12)) 209 | (fp_line (start 4.85 0.725) (end 4.85 0) (layer F.SilkS) (width 0.12)) 210 | (fp_line (start 4.85 0) (end 5.05 0) (layer F.SilkS) (width 0.12)) 211 | (fp_line (start 5.05 0) (end 5.05 -0.8) (layer F.SilkS) (width 0.12)) 212 | (fp_line (start 5.05 -0.8) (end 4.85 -0.8) (layer F.SilkS) (width 0.12)) 213 | (fp_line (start 4.85 -0.8) (end 4.85 -1.675) (layer F.SilkS) (width 0.12)) 214 | (fp_line (start 4.85 -1.675) (end 1.875 -1.675) (layer F.SilkS) (width 0.12)) 215 | (fp_line (start -1.9 1.525) (end -1.9 0.525) (layer F.SilkS) (width 0.12)) 216 | (fp_line (start -1.9 1.525) (end -0.9 1.525) (layer F.SilkS) (width 0.12)) 217 | (fp_text user %R (at 1.875 -1.25) (layer F.Fab) hide 218 | (effects (font (size 1 1) (thickness 0.15))) 219 | ) 220 | (pad 1 thru_hole rect (at 0 0) (size 0.85 0.85) (drill 0.5) (layers *.Cu *.Mask) 221 | (net 2 /GND)) 222 | (pad 2 thru_hole circle (at 1.25 0) (size 0.85 0.85) (drill 0.5) (layers *.Cu *.Mask) 223 | (net 3 /VCC)) 224 | (pad 3 thru_hole circle (at 2.5 0) (size 0.85 0.85) (drill 0.5) (layers *.Cu *.Mask) 225 | (net 4 /SDA)) 226 | (pad 4 thru_hole circle (at 3.75 0) (size 0.85 0.85) (drill 0.5) (layers *.Cu *.Mask) 227 | (net 5 /SCL)) 228 | (model Connectors_Molex.3dshapes/Molex_PicoBlade_53047-0410.wrl 229 | (at (xyz 0.075 0 0)) 230 | (scale (xyz 1 1 1)) 231 | (rotate (xyz 0 0 180)) 232 | ) 233 | ) 234 | 235 | (module Socket_Strips:Socket_Strip_Straight_2x08_Pitch2.54mm placed (layer B.Cu) (tedit 591F2D03) (tstamp 591F266B) 236 | (at 162.56 131.572 90) 237 | (descr "Through hole straight socket strip, 2x08, 2.54mm pitch, double rows") 238 | (tags "Through hole socket strip THT 2x08 2.54mm double row") 239 | (path /591DF53B) 240 | (fp_text reference GPIO (at 2.159 0.762 180) (layer B.SilkS) 241 | (effects (font (size 0.6 0.6) (thickness 0.15)) (justify mirror)) 242 | ) 243 | (fp_text value "RPi3 GPIO" (at -1.27 -20.11 90) (layer B.Fab) hide 244 | (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) 245 | ) 246 | (fp_line (start -3.81 1.27) (end -3.81 -19.05) (layer B.Fab) (width 0.1)) 247 | (fp_line (start -3.81 -19.05) (end 1.27 -19.05) (layer B.Fab) (width 0.1)) 248 | (fp_line (start 1.27 -19.05) (end 1.27 1.27) (layer B.Fab) (width 0.1)) 249 | (fp_line (start 1.27 1.27) (end -3.81 1.27) (layer B.Fab) (width 0.1)) 250 | (fp_line (start 1.33 -1.27) (end 1.33 -19.11) (layer B.SilkS) (width 0.12)) 251 | (fp_line (start 1.33 -19.11) (end -3.87 -19.11) (layer B.SilkS) (width 0.12)) 252 | (fp_line (start -3.87 -19.11) (end -3.87 1.33) (layer B.SilkS) (width 0.12)) 253 | (fp_line (start -3.87 1.33) (end -1.27 1.33) (layer B.SilkS) (width 0.12)) 254 | (fp_line (start -1.27 1.33) (end -1.27 -1.27) (layer B.SilkS) (width 0.12)) 255 | (fp_line (start -1.27 -1.27) (end 1.33 -1.27) (layer B.SilkS) (width 0.12)) 256 | (fp_line (start 1.33 0) (end 1.33 1.33) (layer B.SilkS) (width 0.12)) 257 | (fp_line (start 1.33 1.33) (end 0.06 1.33) (layer B.SilkS) (width 0.12)) 258 | (fp_line (start -4.35 1.8) (end -4.35 -19.55) (layer B.CrtYd) (width 0.05)) 259 | (fp_line (start -4.35 -19.55) (end 1.8 -19.55) (layer B.CrtYd) (width 0.05)) 260 | (fp_line (start 1.8 -19.55) (end 1.8 1.8) (layer B.CrtYd) (width 0.05)) 261 | (fp_line (start 1.8 1.8) (end -4.35 1.8) (layer B.CrtYd) (width 0.05)) 262 | (fp_text user %R (at -1.27 2.33 90) (layer B.Fab) hide 263 | (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) 264 | ) 265 | (pad 1 thru_hole rect (at 0 0 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 266 | (net 3 /VCC)) 267 | (pad 2 thru_hole oval (at -2.54 0 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 268 | (net 6 "Net-(J2-Pad2)")) 269 | (pad 3 thru_hole oval (at 0 -2.54 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 270 | (net 4 /SDA)) 271 | (pad 4 thru_hole oval (at -2.54 -2.54 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 272 | (net 7 "Net-(J2-Pad4)")) 273 | (pad 5 thru_hole oval (at 0 -5.08 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 274 | (net 5 /SCL)) 275 | (pad 6 thru_hole oval (at -2.54 -5.08 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 276 | (net 8 "Net-(J2-Pad6)")) 277 | (pad 7 thru_hole oval (at 0 -7.62 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 278 | (net 9 "Net-(J2-Pad7)")) 279 | (pad 8 thru_hole oval (at -2.54 -7.62 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 280 | (net 10 "Net-(J2-Pad8)")) 281 | (pad 9 thru_hole oval (at 0 -10.16 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 282 | (net 2 /GND)) 283 | (pad 10 thru_hole oval (at -2.54 -10.16 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 284 | (net 11 "Net-(J2-Pad10)")) 285 | (pad 11 thru_hole oval (at 0 -12.7 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 286 | (net 12 /RST)) 287 | (pad 12 thru_hole oval (at -2.54 -12.7 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 288 | (net 13 "Net-(J2-Pad12)")) 289 | (pad 13 thru_hole oval (at 0 -15.24 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 290 | (net 14 /PWR)) 291 | (pad 14 thru_hole oval (at -2.54 -15.24 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 292 | (net 15 "Net-(J2-Pad14)")) 293 | (pad 15 thru_hole oval (at 0 -17.78 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 294 | (net 1 /LED)) 295 | (pad 16 thru_hole oval (at -2.54 -17.78 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 296 | (net 16 "Net-(J2-Pad16)")) 297 | (model ${KISYS3DMOD}/Socket_Strips.3dshapes/Socket_Strip_Straight_2x08_Pitch2.54mm.wrl 298 | (at (xyz -0.05 -0.35 0)) 299 | (scale (xyz 1 1 1)) 300 | (rotate (xyz 0 0 270)) 301 | ) 302 | ) 303 | 304 | (module Pin_Headers:Pin_Header_Angled_1x02_Pitch2.54mm placed (layer F.Cu) (tedit 5942A287) (tstamp 591F2671) 305 | (at 151.384 124.46 90) 306 | (descr "Through hole angled pin header, 1x02, 2.54mm pitch, 6mm pin length, single row") 307 | (tags "Through hole angled pin header THT 1x02 2.54mm single row") 308 | (path /591E03C4) 309 | (fp_text reference "RUN PIN" (at 1.905 4.445 90) (layer F.SilkS) 310 | (effects (font (size 0.5 0.5) (thickness 0.125))) 311 | ) 312 | (fp_text value "RESET PIN" (at 4.315 4.81 90) (layer F.Fab) hide 313 | (effects (font (size 1 1) (thickness 0.15))) 314 | ) 315 | (fp_line (start 1.4 -1.27) (end 1.4 1.27) (layer F.Fab) (width 0.1)) 316 | (fp_line (start 1.4 1.27) (end 3.9 1.27) (layer F.Fab) (width 0.1)) 317 | (fp_line (start 3.9 1.27) (end 3.9 -1.27) (layer F.Fab) (width 0.1)) 318 | (fp_line (start 3.9 -1.27) (end 1.4 -1.27) (layer F.Fab) (width 0.1)) 319 | (fp_line (start 0 -0.32) (end 0 0.32) (layer F.Fab) (width 0.1)) 320 | (fp_line (start 0 0.32) (end 9.9 0.32) (layer F.Fab) (width 0.1)) 321 | (fp_line (start 9.9 0.32) (end 9.9 -0.32) (layer F.Fab) (width 0.1)) 322 | (fp_line (start 9.9 -0.32) (end 0 -0.32) (layer F.Fab) (width 0.1)) 323 | (fp_line (start 1.4 1.27) (end 1.4 3.81) (layer F.Fab) (width 0.1)) 324 | (fp_line (start 1.4 3.81) (end 3.9 3.81) (layer F.Fab) (width 0.1)) 325 | (fp_line (start 3.9 3.81) (end 3.9 1.27) (layer F.Fab) (width 0.1)) 326 | (fp_line (start 3.9 1.27) (end 1.4 1.27) (layer F.Fab) (width 0.1)) 327 | (fp_line (start 0 2.22) (end 0 2.86) (layer F.Fab) (width 0.1)) 328 | (fp_line (start 0 2.86) (end 9.9 2.86) (layer F.Fab) (width 0.1)) 329 | (fp_line (start 9.9 2.86) (end 9.9 2.22) (layer F.Fab) (width 0.1)) 330 | (fp_line (start 9.9 2.22) (end 0 2.22) (layer F.Fab) (width 0.1)) 331 | (fp_line (start 1.34 -1.33) (end 1.34 1.27) (layer F.SilkS) (width 0.12)) 332 | (fp_line (start 1.34 1.27) (end 3.96 1.27) (layer F.SilkS) (width 0.12)) 333 | (fp_line (start 3.96 1.27) (end 3.96 -1.33) (layer F.SilkS) (width 0.12)) 334 | (fp_line (start 3.96 -1.33) (end 1.34 -1.33) (layer F.SilkS) (width 0.12)) 335 | (fp_line (start 3.96 -0.38) (end 3.96 0.38) (layer F.SilkS) (width 0.12)) 336 | (fp_line (start 3.96 0.38) (end 9.96 0.38) (layer F.SilkS) (width 0.12)) 337 | (fp_line (start 9.96 0.38) (end 9.96 -0.38) (layer F.SilkS) (width 0.12)) 338 | (fp_line (start 9.96 -0.38) (end 3.96 -0.38) (layer F.SilkS) (width 0.12)) 339 | (fp_line (start 0.91 -0.38) (end 1.34 -0.38) (layer F.SilkS) (width 0.12)) 340 | (fp_line (start 0.91 0.38) (end 1.34 0.38) (layer F.SilkS) (width 0.12)) 341 | (fp_line (start 3.96 -0.26) (end 9.96 -0.26) (layer F.SilkS) (width 0.12)) 342 | (fp_line (start 3.96 -0.14) (end 9.96 -0.14) (layer F.SilkS) (width 0.12)) 343 | (fp_line (start 3.96 -0.02) (end 9.96 -0.02) (layer F.SilkS) (width 0.12)) 344 | (fp_line (start 3.96 0.1) (end 9.96 0.1) (layer F.SilkS) (width 0.12)) 345 | (fp_line (start 3.96 0.22) (end 9.96 0.22) (layer F.SilkS) (width 0.12)) 346 | (fp_line (start 3.96 0.34) (end 9.96 0.34) (layer F.SilkS) (width 0.12)) 347 | (fp_line (start 1.34 1.27) (end 1.34 3.87) (layer F.SilkS) (width 0.12)) 348 | (fp_line (start 1.34 3.87) (end 3.96 3.87) (layer F.SilkS) (width 0.12)) 349 | (fp_line (start 3.96 3.87) (end 3.96 1.27) (layer F.SilkS) (width 0.12)) 350 | (fp_line (start 3.96 1.27) (end 1.34 1.27) (layer F.SilkS) (width 0.12)) 351 | (fp_line (start 3.96 2.16) (end 3.96 2.92) (layer F.SilkS) (width 0.12)) 352 | (fp_line (start 3.96 2.92) (end 9.96 2.92) (layer F.SilkS) (width 0.12)) 353 | (fp_line (start 9.96 2.92) (end 9.96 2.16) (layer F.SilkS) (width 0.12)) 354 | (fp_line (start 9.96 2.16) (end 3.96 2.16) (layer F.SilkS) (width 0.12)) 355 | (fp_line (start 0.91 2.16) (end 1.34 2.16) (layer F.SilkS) (width 0.12)) 356 | (fp_line (start 0.91 2.92) (end 1.34 2.92) (layer F.SilkS) (width 0.12)) 357 | (fp_line (start -1.27 0) (end -1.27 -1.27) (layer F.SilkS) (width 0.12)) 358 | (fp_line (start -1.27 -1.27) (end 0 -1.27) (layer F.SilkS) (width 0.12)) 359 | (fp_line (start -1.8 -1.8) (end -1.8 4.35) (layer F.CrtYd) (width 0.05)) 360 | (fp_line (start -1.8 4.35) (end 10.4 4.35) (layer F.CrtYd) (width 0.05)) 361 | (fp_line (start 10.4 4.35) (end 10.4 -1.8) (layer F.CrtYd) (width 0.05)) 362 | (fp_line (start 10.4 -1.8) (end -1.8 -1.8) (layer F.CrtYd) (width 0.05)) 363 | (fp_text user %R (at 4.315 -2.27 90) (layer F.Fab) hide 364 | (effects (font (size 1 1) (thickness 0.15))) 365 | ) 366 | (pad 1 thru_hole rect (at 0 0 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 367 | (net 1 /LED)) 368 | (pad 2 thru_hole oval (at 0 2.54 90) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 369 | (net 17 "Net-(J3-Pad2)")) 370 | (model ${KISYS3DMOD}/Pin_Headers.3dshapes/Pin_Header_Angled_1x02_Pitch2.54mm.wrl 371 | (at (xyz 0 -0.05 0)) 372 | (scale (xyz 1 1 1)) 373 | (rotate (xyz 0 0 90)) 374 | ) 375 | ) 376 | 377 | (module Connectors_Molex:Molex_PicoBlade_53047-0510_05x1.25mm_Straight placed (layer F.Cu) (tedit 591F2968) (tstamp 591F267A) 378 | (at 146.304 127.762 90) 379 | (descr "Molex PicoBlade, single row, top entry type, through hole, PN:53047-0510") 380 | (tags "connector molex picoblade") 381 | (path /591E40B0) 382 | (fp_text reference "FRONT PANEL" (at 2.54 -2.794 90) (layer F.SilkS) 383 | (effects (font (size 0.6 0.6) (thickness 0.15))) 384 | ) 385 | (fp_text value "FRONT PANEL" (at 2.5 -3.25 90) (layer F.Fab) hide 386 | (effects (font (size 1 1) (thickness 0.15))) 387 | ) 388 | (fp_line (start -2 -2.55) (end -2 1.6) (layer F.CrtYd) (width 0.05)) 389 | (fp_line (start -2 1.6) (end 7 1.6) (layer F.CrtYd) (width 0.05)) 390 | (fp_line (start 7 1.6) (end 7 -2.55) (layer F.CrtYd) (width 0.05)) 391 | (fp_line (start 7 -2.55) (end -2 -2.55) (layer F.CrtYd) (width 0.05)) 392 | (fp_line (start -1.5 -2.075) (end -1.5 1.125) (layer F.Fab) (width 0.1)) 393 | (fp_line (start -1.5 1.125) (end 6.5 1.125) (layer F.Fab) (width 0.1)) 394 | (fp_line (start 6.5 1.125) (end 6.5 -2.075) (layer F.Fab) (width 0.1)) 395 | (fp_line (start 6.5 -2.075) (end -1.5 -2.075) (layer F.Fab) (width 0.1)) 396 | (fp_line (start -1.65 -2.225) (end -1.65 1.275) (layer F.SilkS) (width 0.12)) 397 | (fp_line (start -1.65 1.275) (end 6.65 1.275) (layer F.SilkS) (width 0.12)) 398 | (fp_line (start 6.65 1.275) (end 6.65 -2.225) (layer F.SilkS) (width 0.12)) 399 | (fp_line (start 6.65 -2.225) (end -1.65 -2.225) (layer F.SilkS) (width 0.12)) 400 | (fp_line (start 2.5 0.725) (end -1.1 0.725) (layer F.SilkS) (width 0.12)) 401 | (fp_line (start -1.1 0.725) (end -1.1 0) (layer F.SilkS) (width 0.12)) 402 | (fp_line (start -1.1 0) (end -1.3 0) (layer F.SilkS) (width 0.12)) 403 | (fp_line (start -1.3 0) (end -1.3 -0.8) (layer F.SilkS) (width 0.12)) 404 | (fp_line (start -1.3 -0.8) (end -1.1 -0.8) (layer F.SilkS) (width 0.12)) 405 | (fp_line (start -1.1 -0.8) (end -1.1 -1.675) (layer F.SilkS) (width 0.12)) 406 | (fp_line (start -1.1 -1.675) (end 2.5 -1.675) (layer F.SilkS) (width 0.12)) 407 | (fp_line (start 2.5 0.725) (end 6.1 0.725) (layer F.SilkS) (width 0.12)) 408 | (fp_line (start 6.1 0.725) (end 6.1 0) (layer F.SilkS) (width 0.12)) 409 | (fp_line (start 6.1 0) (end 6.3 0) (layer F.SilkS) (width 0.12)) 410 | (fp_line (start 6.3 0) (end 6.3 -0.8) (layer F.SilkS) (width 0.12)) 411 | (fp_line (start 6.3 -0.8) (end 6.1 -0.8) (layer F.SilkS) (width 0.12)) 412 | (fp_line (start 6.1 -0.8) (end 6.1 -1.675) (layer F.SilkS) (width 0.12)) 413 | (fp_line (start 6.1 -1.675) (end 2.5 -1.675) (layer F.SilkS) (width 0.12)) 414 | (fp_line (start -1.9 1.525) (end -1.9 0.525) (layer F.SilkS) (width 0.12)) 415 | (fp_line (start -1.9 1.525) (end -0.9 1.525) (layer F.SilkS) (width 0.12)) 416 | (fp_text user %R (at 2.5 -1.25 90) (layer F.Fab) hide 417 | (effects (font (size 1 1) (thickness 0.15))) 418 | ) 419 | (pad 1 thru_hole rect (at 0 0 90) (size 0.85 0.85) (drill 0.5) (layers *.Cu *.Mask) 420 | (net 2 /GND)) 421 | (pad 2 thru_hole circle (at 1.25 0 90) (size 0.85 0.85) (drill 0.5) (layers *.Cu *.Mask) 422 | (net 3 /VCC)) 423 | (pad 3 thru_hole circle (at 2.5 0 90) (size 0.85 0.85) (drill 0.5) (layers *.Cu *.Mask) 424 | (net 1 /LED)) 425 | (pad 4 thru_hole circle (at 3.75 0 90) (size 0.85 0.85) (drill 0.5) (layers *.Cu *.Mask) 426 | (net 14 /PWR)) 427 | (pad 5 thru_hole circle (at 5 0 90) (size 0.85 0.85) (drill 0.5) (layers *.Cu *.Mask) 428 | (net 12 /RST)) 429 | (model Connectors_Molex.3dshapes/Molex_PicoBlade_53047-0510.wrl 430 | (at (xyz 0.1 0 0)) 431 | (scale (xyz 1 1 1)) 432 | (rotate (xyz 0 0 180)) 433 | ) 434 | ) 435 | 436 | (module Resistors_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal placed (layer F.Cu) (tedit 591F2CD7) (tstamp 591F2680) 437 | (at 150.495 128.397) 438 | (descr "Resistor, Axial_DIN0207 series, Axial, Horizontal, pin pitch=10.16mm, 0.25W = 1/4W, length*diameter=6.3*2.5mm^2, http://cdn-reichelt.de/documents/datenblatt/B400/1_4W%23YAG.pdf") 439 | (tags "Resistor Axial_DIN0207 series Axial Horizontal pin pitch 10.16mm 0.25W = 1/4W length 6.3mm diameter 2.5mm") 440 | (path /591DF7AE) 441 | (fp_text reference 10K (at 5.08 0) (layer F.SilkS) 442 | (effects (font (size 0.6 0.6) (thickness 0.15))) 443 | ) 444 | (fp_text value 10K (at 5.08 2.31) (layer F.Fab) hide 445 | (effects (font (size 1 1) (thickness 0.15))) 446 | ) 447 | (fp_line (start 1.93 -1.25) (end 1.93 1.25) (layer F.Fab) (width 0.1)) 448 | (fp_line (start 1.93 1.25) (end 8.23 1.25) (layer F.Fab) (width 0.1)) 449 | (fp_line (start 8.23 1.25) (end 8.23 -1.25) (layer F.Fab) (width 0.1)) 450 | (fp_line (start 8.23 -1.25) (end 1.93 -1.25) (layer F.Fab) (width 0.1)) 451 | (fp_line (start 0 0) (end 1.93 0) (layer F.Fab) (width 0.1)) 452 | (fp_line (start 10.16 0) (end 8.23 0) (layer F.Fab) (width 0.1)) 453 | (fp_line (start 1.87 -1.31) (end 1.87 1.31) (layer F.SilkS) (width 0.12)) 454 | (fp_line (start 1.87 1.31) (end 8.29 1.31) (layer F.SilkS) (width 0.12)) 455 | (fp_line (start 8.29 1.31) (end 8.29 -1.31) (layer F.SilkS) (width 0.12)) 456 | (fp_line (start 8.29 -1.31) (end 1.87 -1.31) (layer F.SilkS) (width 0.12)) 457 | (fp_line (start 0.98 0) (end 1.87 0) (layer F.SilkS) (width 0.12)) 458 | (fp_line (start 9.18 0) (end 8.29 0) (layer F.SilkS) (width 0.12)) 459 | (fp_line (start -1.05 -1.6) (end -1.05 1.6) (layer F.CrtYd) (width 0.05)) 460 | (fp_line (start -1.05 1.6) (end 11.25 1.6) (layer F.CrtYd) (width 0.05)) 461 | (fp_line (start 11.25 1.6) (end 11.25 -1.6) (layer F.CrtYd) (width 0.05)) 462 | (fp_line (start 11.25 -1.6) (end -1.05 -1.6) (layer F.CrtYd) (width 0.05)) 463 | (pad 1 thru_hole circle (at 0 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) 464 | (net 1 /LED)) 465 | (pad 2 thru_hole oval (at 10.16 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) 466 | (net 17 "Net-(J3-Pad2)")) 467 | (model Resistors_THT.3dshapes/R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal.wrl 468 | (at (xyz 0 0 0)) 469 | (scale (xyz 0.393701 0.393701 0.393701)) 470 | (rotate (xyz 0 0 0)) 471 | ) 472 | ) 473 | 474 | (gr_text Bottom (at 157.0355 129.3495) (layer B.SilkS) 475 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 476 | ) 477 | (gr_text GND (at 153.9875 126.3015) (layer F.SilkS) 478 | (effects (font (size 0.5 0.5) (thickness 0.125))) 479 | ) 480 | (gr_text "Mini NES Board Rev 1" (at 153.67 121.793) (layer B.SilkS) 481 | (effects (font (size 0.6 0.6) (thickness 0.127)) (justify mirror)) 482 | ) 483 | (gr_line (start 143.002 120.523) (end 164.592 120.523) (angle 90) (layer Edge.Cuts) (width 0.127)) 484 | (gr_line (start 164.592 135.636) (end 143.002 135.636) (angle 90) (layer Edge.Cuts) (width 0.127)) 485 | (gr_line (start 164.592 120.523) (end 164.592 135.636) (angle 90) (layer Edge.Cuts) (width 0.127)) 486 | (gr_line (start 143.002 135.636) (end 143.002 120.523) (angle 90) (layer Edge.Cuts) (width 0.127)) 487 | (gr_text SCL (at 162.687 125.984 90) (layer F.SilkS) 488 | (effects (font (size 0.5 0.5) (thickness 0.125))) 489 | ) 490 | (gr_text SDA (at 161.417 125.984 90) (layer F.SilkS) 491 | (effects (font (size 0.5 0.5) (thickness 0.125))) 492 | ) 493 | (gr_text 3.3V (at 160.147 126.111 90) (layer F.SilkS) 494 | (effects (font (size 0.5 0.5) (thickness 0.125))) 495 | ) 496 | (gr_text GND (at 158.877 125.984 90) (layer F.SilkS) 497 | (effects (font (size 0.5 0.5) (thickness 0.125))) 498 | ) 499 | (gr_text RUN (at 151.384 126.3015) (layer F.SilkS) 500 | (effects (font (size 0.5 0.5) (thickness 0.125))) 501 | ) 502 | (gr_text GND (at 148.463 127.635) (layer F.SilkS) 503 | (effects (font (size 0.5 0.5) (thickness 0.125))) 504 | ) 505 | (gr_text 3.3V (at 148.59 126.365) (layer F.SilkS) 506 | (effects (font (size 0.5 0.5) (thickness 0.125))) 507 | ) 508 | (gr_text LED (at 148.463 125.222) (layer F.SilkS) 509 | (effects (font (size 0.5 0.5) (thickness 0.125))) 510 | ) 511 | (gr_text PWR (at 148.59 123.952) (layer F.SilkS) 512 | (effects (font (size 0.5 0.5) (thickness 0.125))) 513 | ) 514 | (gr_text RST (at 148.463 122.682) (layer F.SilkS) 515 | (effects (font (size 0.5 0.5) (thickness 0.125))) 516 | ) 517 | 518 | (segment (start 149.3507 125.262) (end 150.1527 124.46) (width 0.254) (layer F.Cu) (net 1)) 519 | (segment (start 146.304 125.262) (end 149.3507 125.262) (width 0.254) (layer F.Cu) (net 1)) 520 | (segment (start 151.384 124.46) (end 150.1527 124.46) (width 0.254) (layer F.Cu) (net 1)) 521 | (segment (start 146.0113 131.0618) (end 146.0113 131.572) (width 0.254) (layer F.Cu) (net 1)) 522 | (segment (start 148.6761 128.397) (end 146.0113 131.0618) (width 0.254) (layer F.Cu) (net 1)) 523 | (segment (start 150.495 128.397) (end 148.6761 128.397) (width 0.254) (layer F.Cu) (net 1)) 524 | (segment (start 144.78 131.572) (end 146.0113 131.572) (width 0.254) (layer F.Cu) (net 1)) 525 | (segment (start 150.495 126.5803) (end 151.384 125.6913) (width 0.254) (layer B.Cu) (net 1)) 526 | (segment (start 150.495 128.397) (end 150.495 126.5803) (width 0.254) (layer B.Cu) (net 1)) 527 | (segment (start 151.384 124.46) (end 151.384 125.6913) (width 0.254) (layer B.Cu) (net 1)) 528 | (segment (start 152.4 128.5565) (end 152.4 131.572) (width 0.254) (layer F.Cu) (net 2)) 529 | (segment (start 151.0493 127.2058) (end 152.4 128.5565) (width 0.254) (layer F.Cu) (net 2)) 530 | (segment (start 147.6665 127.2058) (end 151.0493 127.2058) (width 0.254) (layer F.Cu) (net 2)) 531 | (segment (start 147.1103 127.762) (end 147.6665 127.2058) (width 0.254) (layer F.Cu) (net 2)) 532 | (segment (start 146.304 127.762) (end 147.1103 127.762) (width 0.254) (layer F.Cu) (net 2)) 533 | (segment (start 157.4486 123.2029) (end 158.0707 123.825) (width 0.254) (layer B.Cu) (net 2)) 534 | (segment (start 153.435 123.2029) (end 157.4486 123.2029) (width 0.254) (layer B.Cu) (net 2)) 535 | (segment (start 152.6154 124.0225) (end 153.435 123.2029) (width 0.254) (layer B.Cu) (net 2)) 536 | (segment (start 152.6154 130.1253) (end 152.6154 124.0225) (width 0.254) (layer B.Cu) (net 2)) 537 | (segment (start 152.4 130.3407) (end 152.6154 130.1253) (width 0.254) (layer B.Cu) (net 2)) 538 | (segment (start 152.4 131.572) (end 152.4 130.3407) (width 0.254) (layer B.Cu) (net 2)) 539 | (segment (start 158.877 123.825) (end 158.0707 123.825) (width 0.254) (layer B.Cu) (net 2)) 540 | (segment (start 146.304 126.512) (end 157.7078 126.512) (width 0.254) (layer F.Cu) (net 3)) 541 | (segment (start 157.7078 127.1273) (end 157.7078 126.512) (width 0.254) (layer F.Cu) (net 3)) 542 | (segment (start 161.3287 130.7482) (end 157.7078 127.1273) (width 0.254) (layer F.Cu) (net 3)) 543 | (segment (start 161.3287 131.572) (end 161.3287 130.7482) (width 0.254) (layer F.Cu) (net 3)) 544 | (segment (start 160.127 124.0928) (end 160.127 123.825) (width 0.254) (layer F.Cu) (net 3)) 545 | (segment (start 157.7078 126.512) (end 160.127 124.0928) (width 0.254) (layer F.Cu) (net 3)) 546 | (segment (start 162.56 131.572) (end 161.3287 131.572) (width 0.254) (layer F.Cu) (net 3)) 547 | (segment (start 161.8395 124.2875) (end 161.377 123.825) (width 0.254) (layer B.Cu) (net 4)) 548 | (segment (start 161.8395 128.906) (end 161.8395 124.2875) (width 0.254) (layer B.Cu) (net 4)) 549 | (segment (start 160.4048 130.3407) (end 161.8395 128.906) (width 0.254) (layer B.Cu) (net 4)) 550 | (segment (start 160.02 130.3407) (end 160.4048 130.3407) (width 0.254) (layer B.Cu) (net 4)) 551 | (segment (start 160.02 131.572) (end 160.02 130.3407) (width 0.254) (layer B.Cu) (net 4)) 552 | (segment (start 162.627 129.1934) (end 162.627 123.825) (width 0.254) (layer B.Cu) (net 5)) 553 | (segment (start 161.258 130.5624) (end 162.627 129.1934) (width 0.254) (layer B.Cu) (net 5)) 554 | (segment (start 161.258 132.0799) (end 161.258 130.5624) (width 0.254) (layer B.Cu) (net 5)) 555 | (segment (start 160.4959 132.842) (end 161.258 132.0799) (width 0.254) (layer B.Cu) (net 5)) 556 | (segment (start 159.5196 132.842) (end 160.4959 132.842) (width 0.254) (layer B.Cu) (net 5)) 557 | (segment (start 158.7113 132.0337) (end 159.5196 132.842) (width 0.254) (layer B.Cu) (net 5)) 558 | (segment (start 158.7113 131.572) (end 158.7113 132.0337) (width 0.254) (layer B.Cu) (net 5)) 559 | (segment (start 157.48 131.572) (end 158.7113 131.572) (width 0.254) (layer B.Cu) (net 5)) 560 | (segment (start 149.1371 129.6178) (end 149.86 130.3407) (width 0.254) (layer B.Cu) (net 12)) 561 | (segment (start 149.1371 125.5951) (end 149.1371 129.6178) (width 0.254) (layer B.Cu) (net 12)) 562 | (segment (start 146.304 122.762) (end 149.1371 125.5951) (width 0.254) (layer B.Cu) (net 12)) 563 | (segment (start 149.86 131.572) (end 149.86 130.3407) (width 0.254) (layer B.Cu) (net 12)) 564 | (segment (start 147.32 125.028) (end 147.32 131.572) (width 0.254) (layer B.Cu) (net 14)) 565 | (segment (start 146.304 124.012) (end 147.32 125.028) (width 0.254) (layer B.Cu) (net 14)) 566 | (segment (start 159.0923 128.397) (end 155.1553 124.46) (width 0.254) (layer B.Cu) (net 17)) 567 | (segment (start 160.655 128.397) (end 159.0923 128.397) (width 0.254) (layer B.Cu) (net 17)) 568 | (segment (start 153.924 124.46) (end 155.1553 124.46) (width 0.254) (layer B.Cu) (net 17)) 569 | 570 | (zone (net 2) (net_name /GND) (layer F.Cu) (tstamp 591F33BB) (hatch edge 0.508) 571 | (connect_pads (clearance 0.508)) 572 | (min_thickness 0.254) 573 | (fill yes (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.508)) 574 | (polygon 575 | (pts 576 | (xy 164.592 135.636) (xy 143.002 135.636) (xy 143.002 120.523) (xy 164.592 120.523) 577 | ) 578 | ) 579 | (filled_polygon 580 | (pts 581 | (xy 157.003804 127.418905) (xy 157.042121 127.47625) (xy 157.168985 127.666115) (xy 159.636967 130.134097) (xy 159.451715 130.170946) 582 | (xy 158.969946 130.492853) (xy 158.75 130.822026) (xy 158.530054 130.492853) (xy 158.048285 130.170946) (xy 157.48 130.057907) 583 | (xy 156.911715 130.170946) (xy 156.429946 130.492853) (xy 156.21 130.822026) (xy 155.990054 130.492853) (xy 155.508285 130.170946) 584 | (xy 154.94 130.057907) (xy 154.371715 130.170946) (xy 153.889946 130.492853) (xy 153.662298 130.833553) (xy 153.595183 130.690642) 585 | (xy 153.166924 130.300355) (xy 152.75689 130.130524) (xy 152.527 130.251845) (xy 152.527 131.445) (xy 152.547 131.445) 586 | (xy 152.547 131.699) (xy 152.527 131.699) (xy 152.527 131.719) (xy 152.273 131.719) (xy 152.273 131.699) 587 | (xy 152.253 131.699) (xy 152.253 131.445) (xy 152.273 131.445) (xy 152.273 130.251845) (xy 152.04311 130.130524) 588 | (xy 151.633076 130.300355) (xy 151.204817 130.690642) (xy 151.137702 130.833553) (xy 150.910054 130.492853) (xy 150.428285 130.170946) 589 | (xy 149.86 130.057907) (xy 149.291715 130.170946) (xy 148.809946 130.492853) (xy 148.59 130.822026) (xy 148.370054 130.492853) 590 | (xy 147.943135 130.207596) (xy 148.991731 129.159) (xy 149.25718 129.159) (xy 149.277757 129.2088) (xy 149.681077 129.612824) 591 | (xy 150.208309 129.83175) (xy 150.779187 129.832248) (xy 151.3068 129.614243) (xy 151.710824 129.210923) (xy 151.92975 128.683691) 592 | (xy 151.930248 128.112813) (xy 151.712243 127.5852) (xy 151.401585 127.274) (xy 156.974981 127.274) 593 | ) 594 | ) 595 | (filled_polygon 596 | (pts 597 | (xy 163.8935 130.300723) (xy 163.87409 130.270559) (xy 163.66189 130.125569) (xy 163.41 130.07456) (xy 161.73269 130.07456) 598 | (xy 161.321363 129.663233) (xy 161.697811 129.411698) (xy 162.00888 128.946151) (xy 162.118113 128.397) (xy 162.00888 127.847849) 599 | (xy 161.697811 127.382302) (xy 161.232264 127.071233) (xy 160.683113 126.962) (xy 160.626887 126.962) (xy 160.077736 127.071233) 600 | (xy 159.612189 127.382302) (xy 159.383175 127.725045) (xy 158.47778 126.81965) (xy 160.465285 124.832146) (xy 160.726658 124.724149) 601 | (xy 160.751783 124.699068) (xy 160.775774 124.723101) (xy 161.165228 124.884816) (xy 161.586922 124.885184) (xy 161.976658 124.724149) 602 | (xy 162.001783 124.699068) (xy 162.025774 124.723101) (xy 162.415228 124.884816) (xy 162.836922 124.885184) (xy 163.226658 124.724149) 603 | (xy 163.525101 124.426226) (xy 163.686816 124.036772) (xy 163.687184 123.615078) (xy 163.526149 123.225342) (xy 163.228226 122.926899) 604 | (xy 162.838772 122.765184) (xy 162.417078 122.764816) (xy 162.027342 122.925851) (xy 162.002217 122.950932) (xy 161.978226 122.926899) 605 | (xy 161.588772 122.765184) (xy 161.167078 122.764816) (xy 160.777342 122.925851) (xy 160.752217 122.950932) (xy 160.728226 122.926899) 606 | (xy 160.338772 122.765184) (xy 159.917078 122.764816) (xy 159.667828 122.867803) (xy 159.661698 122.861673) (xy 159.428309 122.765) 607 | (xy 159.16275 122.765) (xy 159.004 122.92375) (xy 159.004 123.698) (xy 159.024 123.698) (xy 159.024 123.952) 608 | (xy 159.004 123.952) (xy 159.004 123.972) (xy 158.75 123.972) (xy 158.75 123.952) (xy 157.97575 123.952) 609 | (xy 157.817 124.11075) (xy 157.817 124.37631) (xy 157.913673 124.609699) (xy 158.092302 124.788327) (xy 158.277239 124.864931) 610 | (xy 157.39217 125.75) (xy 154.658489 125.75) (xy 154.974054 125.539147) (xy 155.295961 125.057378) (xy 155.409 124.489093) 611 | (xy 155.409 124.430907) (xy 155.295961 123.862622) (xy 154.974054 123.380853) (xy 154.813673 123.27369) (xy 157.817 123.27369) 612 | (xy 157.817 123.53925) (xy 157.97575 123.698) (xy 158.75 123.698) (xy 158.75 122.92375) (xy 158.59125 122.765) 613 | (xy 158.325691 122.765) (xy 158.092302 122.861673) (xy 157.913673 123.040301) (xy 157.817 123.27369) (xy 154.813673 123.27369) 614 | (xy 154.492285 123.058946) (xy 153.924 122.945907) (xy 153.355715 123.058946) (xy 152.873946 123.380853) (xy 152.84615 123.422452) 615 | (xy 152.837162 123.374683) (xy 152.69809 123.158559) (xy 152.48589 123.013569) (xy 152.234 122.96256) (xy 150.534 122.96256) 616 | (xy 150.298683 123.006838) (xy 150.082559 123.14591) (xy 149.937569 123.35811) (xy 149.88656 123.61) (xy 149.88656 123.750939) 617 | (xy 149.861095 123.756004) (xy 149.613884 123.921185) (xy 149.03507 124.5) (xy 147.249116 124.5) (xy 147.363816 124.223772) 618 | (xy 147.364184 123.802078) (xy 147.203149 123.412342) (xy 147.178068 123.387217) (xy 147.202101 123.363226) (xy 147.363816 122.973772) 619 | (xy 147.364184 122.552078) (xy 147.203149 122.162342) (xy 146.905226 121.863899) (xy 146.515772 121.702184) (xy 146.094078 121.701816) 620 | (xy 145.704342 121.862851) (xy 145.405899 122.160774) (xy 145.244184 122.550228) (xy 145.243816 122.971922) (xy 145.404851 123.361658) 621 | (xy 145.429932 123.386783) (xy 145.405899 123.410774) (xy 145.244184 123.800228) (xy 145.243816 124.221922) (xy 145.404851 124.611658) 622 | (xy 145.429932 124.636783) (xy 145.405899 124.660774) (xy 145.244184 125.050228) (xy 145.243816 125.471922) (xy 145.404851 125.861658) 623 | (xy 145.429932 125.886783) (xy 145.405899 125.910774) (xy 145.244184 126.300228) (xy 145.243816 126.721922) (xy 145.346803 126.971172) 624 | (xy 145.340673 126.977302) (xy 145.244 127.210691) (xy 145.244 127.47625) (xy 145.40275 127.635) (xy 146.177 127.635) 625 | (xy 146.177 127.615) (xy 146.431 127.615) (xy 146.431 127.635) (xy 147.20525 127.635) (xy 147.364 127.47625) 626 | (xy 147.364 127.274) (xy 149.588792 127.274) (xy 149.279176 127.583077) (xy 149.257616 127.635) (xy 148.6761 127.635) 627 | (xy 148.384495 127.693004) (xy 148.137284 127.858185) (xy 145.63377 130.3617) (xy 145.348285 130.170946) (xy 144.78 130.057907) 628 | (xy 144.211715 130.170946) (xy 143.729946 130.492853) (xy 143.7005 130.536922) (xy 143.7005 128.04775) (xy 145.244 128.04775) 629 | (xy 145.244 128.313309) (xy 145.340673 128.546698) (xy 145.519301 128.725327) (xy 145.75269 128.822) (xy 146.01825 128.822) 630 | (xy 146.177 128.66325) (xy 146.177 127.889) (xy 146.431 127.889) (xy 146.431 128.66325) (xy 146.58975 128.822) 631 | (xy 146.85531 128.822) (xy 147.088699 128.725327) (xy 147.267327 128.546698) (xy 147.364 128.313309) (xy 147.364 128.04775) 632 | (xy 147.20525 127.889) (xy 146.431 127.889) (xy 146.177 127.889) (xy 145.40275 127.889) (xy 145.244 128.04775) 633 | (xy 143.7005 128.04775) (xy 143.7005 121.2215) (xy 163.8935 121.2215) 634 | ) 635 | ) 636 | ) 637 | (zone (net 14) (net_name /PWR) (layer B.Cu) (tstamp 591F33BC) (hatch edge 0.508) 638 | (connect_pads (clearance 0.508)) 639 | (min_thickness 0.254) 640 | (fill yes (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.508)) 641 | (polygon 642 | (pts 643 | (xy 164.592 135.509) (xy 143.002 135.636) (xy 143.002 120.523) (xy 164.592 120.523) 644 | ) 645 | ) 646 | (filled_polygon 647 | (pts 648 | (xy 163.8935 130.300723) (xy 163.87409 130.270559) (xy 163.66189 130.125569) (xy 163.41 130.07456) (xy 162.823471 130.07456) 649 | (xy 163.165815 129.732216) (xy 163.330996 129.485005) (xy 163.343667 129.421303) (xy 163.389 129.1934) (xy 163.389 124.56209) 650 | (xy 163.525101 124.426226) (xy 163.686816 124.036772) (xy 163.687184 123.615078) (xy 163.526149 123.225342) (xy 163.228226 122.926899) 651 | (xy 162.838772 122.765184) (xy 162.417078 122.764816) (xy 162.027342 122.925851) (xy 162.002217 122.950932) (xy 161.978226 122.926899) 652 | (xy 161.588772 122.765184) (xy 161.167078 122.764816) (xy 160.777342 122.925851) (xy 160.752217 122.950932) (xy 160.728226 122.926899) 653 | (xy 160.338772 122.765184) (xy 159.917078 122.764816) (xy 159.65541 122.872935) (xy 159.55389 122.803569) (xy 159.302 122.75256) 654 | (xy 158.452 122.75256) (xy 158.216683 122.796838) (xy 158.157957 122.834627) (xy 157.987415 122.664085) (xy 157.819785 122.552078) 655 | (xy 157.740205 122.498904) (xy 157.4486 122.4409) (xy 153.435 122.4409) (xy 153.143395 122.498904) (xy 152.896184 122.664085) 656 | (xy 152.522016 123.038253) (xy 152.48589 123.013569) (xy 152.234 122.96256) (xy 150.534 122.96256) (xy 150.298683 123.006838) 657 | (xy 150.082559 123.14591) (xy 149.937569 123.35811) (xy 149.88656 123.61) (xy 149.88656 125.31) (xy 149.930838 125.545317) 658 | (xy 150.06991 125.761441) (xy 150.168717 125.828953) (xy 149.956185 126.041485) (xy 149.8991 126.126918) (xy 149.8991 125.5951) 659 | (xy 149.841096 125.303495) (xy 149.786643 125.222) (xy 149.675915 125.056284) (xy 147.364016 122.744386) (xy 147.364184 122.552078) 660 | (xy 147.203149 122.162342) (xy 146.905226 121.863899) (xy 146.515772 121.702184) (xy 146.094078 121.701816) (xy 145.704342 121.862851) 661 | (xy 145.405899 122.160774) (xy 145.244184 122.550228) (xy 145.243816 122.971922) (xy 145.404851 123.361658) (xy 145.507276 123.464262) 662 | (xy 145.36105 123.483887) (xy 145.230728 123.884939) (xy 145.263801 124.305334) (xy 145.36105 124.540113) (xy 145.507131 124.559719) 663 | (xy 145.405899 124.660774) (xy 145.244184 125.050228) (xy 145.243816 125.471922) (xy 145.404851 125.861658) (xy 145.429932 125.886783) 664 | (xy 145.405899 125.910774) (xy 145.244184 126.300228) (xy 145.243816 126.721922) (xy 145.351935 126.98359) (xy 145.282569 127.08511) 665 | (xy 145.23156 127.337) (xy 145.23156 128.187) (xy 145.275838 128.422317) (xy 145.41491 128.638441) (xy 145.62711 128.783431) 666 | (xy 145.879 128.83444) (xy 146.729 128.83444) (xy 146.964317 128.790162) (xy 147.180441 128.65109) (xy 147.325431 128.43889) 667 | (xy 147.37644 128.187) (xy 147.37644 127.337) (xy 147.332162 127.101683) (xy 147.256025 126.983363) (xy 147.363816 126.723772) 668 | (xy 147.364184 126.302078) (xy 147.203149 125.912342) (xy 147.178068 125.887217) (xy 147.202101 125.863226) (xy 147.363816 125.473772) 669 | (xy 147.364184 125.052078) (xy 147.256971 124.792601) (xy 148.3751 125.910731) (xy 148.3751 129.6178) (xy 148.433104 129.909405) 670 | (xy 148.598285 130.156615) (xy 148.884625 130.442955) (xy 148.809946 130.492853) (xy 148.582298 130.833553) (xy 148.515183 130.690642) 671 | (xy 148.086924 130.300355) (xy 147.67689 130.130524) (xy 147.447 130.251845) (xy 147.447 131.445) (xy 147.467 131.445) 672 | (xy 147.467 131.699) (xy 147.447 131.699) (xy 147.447 131.719) (xy 147.193 131.719) (xy 147.193 131.699) 673 | (xy 147.173 131.699) (xy 147.173 131.445) (xy 147.193 131.445) (xy 147.193 130.251845) (xy 146.96311 130.130524) 674 | (xy 146.553076 130.300355) (xy 146.124817 130.690642) (xy 146.057702 130.833553) (xy 145.830054 130.492853) (xy 145.348285 130.170946) 675 | (xy 144.78 130.057907) (xy 144.211715 130.170946) (xy 143.729946 130.492853) (xy 143.7005 130.536922) (xy 143.7005 121.2215) 676 | (xy 163.8935 121.2215) 677 | ) 678 | ) 679 | (filled_polygon 680 | (pts 681 | (xy 146.49413 124.02976) (xy 146.321875 124.202015) (xy 146.314403 124.202008) (xy 146.304 124.191605) (xy 146.293615 124.20199) 682 | (xy 146.286093 124.201983) (xy 146.110253 124.026143) (xy 146.124395 124.012) (xy 146.110253 123.997858) (xy 146.286125 123.821985) 683 | (xy 146.286355 123.821985) 684 | ) 685 | ) 686 | ) 687 | ) 688 | -------------------------------------------------------------------------------- /pcb-board/main-board/main-board.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderkevin/mini-nes/5b6a0ac12719177fa43fabb03cbf7ab6c81edf06/pcb-board/main-board/main-board.pdf -------------------------------------------------------------------------------- /pcb-board/main-board/main-board.pro: -------------------------------------------------------------------------------- 1 | update=6/15/2017 10:23:19 AM 2 | version=1 3 | last_client=kicad 4 | [pcbnew] 5 | version=1 6 | LastNetListRead= 7 | UseCmpFile=1 8 | PadDrill=0.600000000000 9 | PadDrillOvalY=0.600000000000 10 | PadSizeH=1.500000000000 11 | PadSizeV=1.500000000000 12 | PcbTextSizeV=1.500000000000 13 | PcbTextSizeH=1.500000000000 14 | PcbTextThickness=0.300000000000 15 | ModuleTextSizeV=1.000000000000 16 | ModuleTextSizeH=1.000000000000 17 | ModuleTextSizeThickness=0.150000000000 18 | SolderMaskClearance=0.000000000000 19 | SolderMaskMinWidth=0.000000000000 20 | DrawSegmentWidth=0.200000000000 21 | BoardOutlineThickness=0.100000000000 22 | ModuleOutlineThickness=0.150000000000 23 | [cvpcb] 24 | version=1 25 | NetIExt=net 26 | [general] 27 | version=1 28 | [eeschema] 29 | version=1 30 | LibDir= 31 | [eeschema/libraries] 32 | LibName1=power 33 | LibName2=device 34 | LibName3=transistors 35 | LibName4=conn 36 | LibName5=linear 37 | LibName6=regul 38 | LibName7=74xx 39 | LibName8=cmos4000 40 | LibName9=adc-dac 41 | LibName10=memory 42 | LibName11=xilinx 43 | LibName12=microcontrollers 44 | LibName13=dsp 45 | LibName14=microchip 46 | LibName15=analog_switches 47 | LibName16=motorola 48 | LibName17=texas 49 | LibName18=intel 50 | LibName19=audio 51 | LibName20=interface 52 | LibName21=digital-audio 53 | LibName22=philips 54 | LibName23=display 55 | LibName24=cypress 56 | LibName25=siliconi 57 | LibName26=opto 58 | LibName27=atmel 59 | LibName28=contrib 60 | LibName29=valves 61 | [schematic_editor] 62 | version=1 63 | PageLayoutDescrFile= 64 | PlotDirectoryName= 65 | SubpartIdSeparator=0 66 | SubpartFirstId=65 67 | NetFmtName=Pcbnew 68 | SpiceForceRefPrefix=0 69 | SpiceUseNetNumbers=0 70 | LabSize=60 71 | -------------------------------------------------------------------------------- /pcb-board/main-board/main-board.rules: -------------------------------------------------------------------------------- 1 | 2 | (rules PCB Mini-NES_Board 3 | (snap_angle 4 | fortyfive_degree 5 | ) 6 | (autoroute_settings 7 | (fanout off) 8 | (autoroute on) 9 | (postroute on) 10 | (vias on) 11 | (via_costs 50) 12 | (plane_via_costs 5) 13 | (start_ripup_costs 100) 14 | (start_pass_no 181) 15 | (layer_rule F.Cu 16 | (active on) 17 | (preferred_direction horizontal) 18 | (preferred_direction_trace_costs 1.0) 19 | (against_preferred_direction_trace_costs 2.6) 20 | ) 21 | (layer_rule B.Cu 22 | (active on) 23 | (preferred_direction vertical) 24 | (preferred_direction_trace_costs 1.0) 25 | (against_preferred_direction_trace_costs 1.6) 26 | ) 27 | ) 28 | (rule 29 | (width 254.0) 30 | (clear 254.2) 31 | (clear 127.0 (type smd_to_turn_gap)) 32 | (clear 63.6 (type smd_smd)) 33 | (clear 200.2 (type 0.2mm_0.2mm)) 34 | (clear 152.6 (type Minimal_Minimal)) 35 | ) 36 | (padstack "Via[0-1]_685.8:330.2_um" 37 | (shape 38 | (circle F.Cu 685.8 0.0 0.0) 39 | ) 40 | (shape 41 | (circle B.Cu 685.8 0.0 0.0) 42 | ) 43 | (attach off) 44 | ) 45 | (via 46 | "Via[0-1]_685.8:330.2_um" "Via[0-1]_685.8:330.2_um" default 47 | ) 48 | (via 49 | "Via[0-1]_685.8:330.2_um-kicad_default" "Via[0-1]_685.8:330.2_um" "kicad_default" 50 | ) 51 | (via 52 | "Via[0-1]_685.8:330.2_um-0.2mm" "Via[0-1]_685.8:330.2_um" 0.2mm 53 | ) 54 | (via 55 | "Via[0-1]_685.8:330.2_um-Minimal" "Via[0-1]_685.8:330.2_um" Minimal 56 | ) 57 | (via_rule 58 | default "Via[0-1]_685.8:330.2_um" 59 | ) 60 | (via_rule 61 | "kicad_default" "Via[0-1]_685.8:330.2_um-kicad_default" 62 | ) 63 | (via_rule 64 | 0.2mm "Via[0-1]_685.8:330.2_um-0.2mm" 65 | ) 66 | (via_rule 67 | Minimal "Via[0-1]_685.8:330.2_um-Minimal" 68 | ) 69 | (class default 70 | (clearance_class default) 71 | (via_rule default) 72 | (rule 73 | (width 254.0) 74 | ) 75 | (circuit 76 | (use_layer F.Cu B.Cu) 77 | ) 78 | ) 79 | (class "kicad_default" 80 | /LED /GND /VCC /SDA /SCL "Net-(J2-Pad2)" "Net-(J2-Pad4)" "Net-(J2-Pad6)" 81 | "Net-(J2-Pad7)" "Net-(J2-Pad8)" "Net-(J2-Pad10)" /RST "Net-(J2-Pad12)" /PWR "Net-(J2-Pad14)" "Net-(J2-Pad16)" 82 | "Net-(J3-Pad2)" 83 | (clearance_class "kicad_default") 84 | (via_rule kicad_default) 85 | (rule 86 | (width 254.0) 87 | ) 88 | (circuit 89 | (use_layer F.Cu B.Cu) 90 | ) 91 | ) 92 | (class 0.2mm 93 | (clearance_class 0.2mm) 94 | (via_rule 0.2mm) 95 | (rule 96 | (width 200.0) 97 | ) 98 | (circuit 99 | (use_layer F.Cu B.Cu) 100 | ) 101 | ) 102 | (class Minimal 103 | (clearance_class Minimal) 104 | (via_rule Minimal) 105 | (rule 106 | (width 152.4) 107 | ) 108 | (circuit 109 | (use_layer F.Cu B.Cu) 110 | ) 111 | ) 112 | ) -------------------------------------------------------------------------------- /pcb-board/main-board/main-board.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 2 | LIBS:power 3 | LIBS:device 4 | LIBS:transistors 5 | LIBS:conn 6 | LIBS:linear 7 | LIBS:regul 8 | LIBS:74xx 9 | LIBS:cmos4000 10 | LIBS:adc-dac 11 | LIBS:memory 12 | LIBS:xilinx 13 | LIBS:microcontrollers 14 | LIBS:dsp 15 | LIBS:microchip 16 | LIBS:analog_switches 17 | LIBS:motorola 18 | LIBS:texas 19 | LIBS:intel 20 | LIBS:audio 21 | LIBS:interface 22 | LIBS:digital-audio 23 | LIBS:philips 24 | LIBS:display 25 | LIBS:cypress 26 | LIBS:siliconi 27 | LIBS:opto 28 | LIBS:atmel 29 | LIBS:contrib 30 | LIBS:valves 31 | EELAYER 25 0 32 | EELAYER END 33 | $Descr USLetter 11000 8500 34 | encoding utf-8 35 | Sheet 1 1 36 | Title "Mini-NES_NFC by @coderkevin" 37 | Date "2017-05-18" 38 | Rev "1.0" 39 | Comp "Eladio Martinez" 40 | Comment1 "" 41 | Comment2 "" 42 | Comment3 "" 43 | Comment4 "" 44 | $EndDescr 45 | $Comp 46 | L CONN_02X08 J2 47 | U 1 1 591DF53B 48 | P 3250 3350 49 | F 0 "J2" H 3250 3800 50 0000 C CNN 50 | F 1 "RPi3 GPIO" V 3250 3350 50 0000 C CNN 51 | F 2 "Socket_Strips:Socket_Strip_Straight_2x08_Pitch2.54mm" H 3250 2150 50 0001 C CNN 52 | F 3 "" H 3250 2150 50 0001 C CNN 53 | 1 3250 3350 54 | 1 0 0 -1 55 | $EndComp 56 | $Comp 57 | L R R1 58 | U 1 1 591DF7AE 59 | P 8700 3600 60 | F 0 "R1" V 8780 3600 50 0000 C CNN 61 | F 1 "10K" V 8700 3600 50 0000 C CNN 62 | F 2 "Resistors_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal" V 8630 3600 50 0001 C CNN 63 | F 3 "" H 8700 3600 50 0001 C CNN 64 | 1 8700 3600 65 | 0 -1 -1 0 66 | $EndComp 67 | $Comp 68 | L CONN_01X04 J1 69 | U 1 1 591DF89C 70 | P 8750 1400 71 | F 0 "J1" H 8750 1650 50 0000 C CNN 72 | F 1 "NFC READER" V 8850 1400 50 0000 C CNN 73 | F 2 "Connectors_Molex:Molex_PicoBlade_53047-0410_04x1.25mm_Straight" H 8750 1400 50 0001 C CNN 74 | F 3 "" H 8750 1400 50 0001 C CNN 75 | 1 8750 1400 76 | 1 0 0 -1 77 | $EndComp 78 | Text Label 8550 1250 2 60 ~ 0 79 | GND 80 | Text Label 8550 1350 2 60 ~ 0 81 | VCC 82 | Text Label 8550 1450 2 60 ~ 0 83 | SDA 84 | Text Label 8550 1550 2 60 ~ 0 85 | SCL 86 | Text Label 3000 3000 2 60 ~ 0 87 | VCC 88 | Text Label 3000 3400 2 60 ~ 0 89 | GND 90 | Text Label 3000 3100 2 60 ~ 0 91 | SDA 92 | Text Label 3000 3200 2 60 ~ 0 93 | SCL 94 | NoConn ~ 3000 3300 95 | $Comp 96 | L CONN_01X02 J3 97 | U 1 1 591E03C4 98 | P 8700 3100 99 | F 0 "J3" H 8700 3250 50 0000 C CNN 100 | F 1 "RESET PIN" V 8800 3100 50 0000 C CNN 101 | F 2 "Pin_Headers:Pin_Header_Angled_1x02_Pitch2.54mm" H 8700 3100 50 0001 C CNN 102 | F 3 "" H 8700 3100 50 0001 C CNN 103 | 1 8700 3100 104 | 0 -1 -1 0 105 | $EndComp 106 | Wire Wire Line 107 | 8550 3600 8550 3400 108 | Wire Wire Line 109 | 8650 3400 8650 3300 110 | Wire Wire Line 111 | 8750 3300 8750 3400 112 | Wire Wire Line 113 | 8750 3400 8850 3400 114 | Wire Wire Line 115 | 8850 3400 8850 3600 116 | Wire Wire Line 117 | 8350 3400 8650 3400 118 | Text Label 3000 3700 2 60 ~ 0 119 | LED 120 | Text Label 8350 3400 2 60 ~ 0 121 | LED 122 | Connection ~ 8550 3400 123 | NoConn ~ 3500 3000 124 | NoConn ~ 3500 3100 125 | NoConn ~ 3500 3200 126 | NoConn ~ 3500 3400 127 | NoConn ~ 3500 3500 128 | NoConn ~ 3500 3600 129 | NoConn ~ 3500 3700 130 | NoConn ~ 3500 3300 131 | Text Notes 6600 800 0 118 ~ 0 132 | NFC Reader 133 | Text Notes 6600 2700 0 118 ~ 0 134 | Reset Pin 135 | Text Notes 1050 1200 0 118 ~ 0 136 | Raspberry GPIO 137 | Text Notes 6550 4700 0 118 ~ 0 138 | Front Pannel 139 | $Comp 140 | L CONN_01X05 J4 141 | U 1 1 591E40B0 142 | P 8750 5300 143 | F 0 "J4" H 8750 5600 50 0000 C CNN 144 | F 1 "FRONT PANEL" V 8850 5300 50 0000 C CNN 145 | F 2 "Connectors_Molex:Molex_PicoBlade_53047-0510_05x1.25mm_Straight" H 8750 5300 50 0001 C CNN 146 | F 3 "" H 8750 5300 50 0001 C CNN 147 | 1 8750 5300 148 | 1 0 0 -1 149 | $EndComp 150 | Text Label 8550 5100 2 60 ~ 0 151 | GND 152 | Text Label 8550 5200 2 60 ~ 0 153 | VCC 154 | Text Label 8550 5300 2 60 ~ 0 155 | LED 156 | Text Label 8550 5400 2 60 ~ 0 157 | PWR 158 | Text Label 3000 3600 2 60 ~ 0 159 | PWR 160 | Text Label 8550 5500 2 60 ~ 0 161 | RST 162 | Text Label 3000 3500 2 60 ~ 0 163 | RST 164 | Wire Notes Line 165 | 500 6300 10550 6300 166 | Wire Notes Line 167 | 6300 500 6300 6300 168 | Wire Notes Line 169 | 6300 6300 6350 6300 170 | Wire Notes Line 171 | 10500 4350 6300 4350 172 | Wire Notes Line 173 | 10550 2350 6300 2350 174 | $EndSCHEMATC 175 | -------------------------------------------------------------------------------- /screen/Makefile: -------------------------------------------------------------------------------- 1 | # Installs screen manager code 2 | # 3 | 4 | INSTALL_PREFIX := /usr 5 | VAR_WORK_DIR := /var/lib/screen_manager 6 | 7 | .PHONY: install 8 | 9 | install: 10 | -pip install watchdog 11 | install -m 0755 *.py -D -t $(VAR_WORK_DIR) 12 | -sh ./update_autostart.sh 13 | 14 | -------------------------------------------------------------------------------- /screen/README.md: -------------------------------------------------------------------------------- 1 | # RetroPie Screen Manager 2 | 3 | This is a script that manages what shows on the screen for RetroPie. 4 | It is installed in place of emulationstation, and provides a system-level 5 | way of starting roms or emulationstation. 6 | 7 | # Installation 8 | 9 | After cloning the repo, simply cd to this directory and run `sudo make install`. 10 | This will copy the script to `/var/lib/screen_manager` and embed it into the 11 | RetroPie autostart script. (`/opt/retropie/config/all/autostart.sh`) 12 | 13 | # Operation 14 | 15 | On startup, the `screen_manager.py` script will be run instead of `emulationstation`. 16 | However, default action is to run `emulationstation`, so if you have no config file, 17 | it will look the same as before. 18 | 19 | ## Configuration File 20 | 21 | This script looks for a configuration file at `/dev/shm/screen_manager.cfg` 22 | 23 | The `screen_manager.py` script actively watches this file, so as soon as the file 24 | is written, the script will respond and run the action. If the parsing of the file 25 | ends up with an identical action as before, the action will be ignored. (so it's 26 | okay to write the same action to it multiple times.) 27 | 28 | This script and configuration file is designed to work with other system processes such as: 29 | - A daemon that monitors GPIOs for button presses, then starts a rom. 30 | - An nfc reader daemon that watches for a tag and starts a rom, then runs the dashboard after the tag is removed. 31 | 32 | All you have to do is handle your input the way you need to, and then write the 33 | config file in response. 34 | 35 | For an example, look at my [NFC Poll Daemon](https://github.com/coderkevin/mini-nes/tree/master/nfc) 36 | 37 | The existing code for this script handles two action types by default (although you can add more!) 38 | 39 | ### dashboard (emulationstation) 40 | 41 | This action type simply runs emulationstation. 42 | ``` 43 | [Action] 44 | type=dashboard 45 | ``` 46 | 47 | ### rom 48 | 49 | This action uses `runcommand` to start a rom with the appropriate emulator. 50 | ``` 51 | [Action] 52 | type=rom 53 | system= 54 | path= 55 | ``` 56 | 57 | # Logging 58 | 59 | A log for the script is kept at `/dev/shm/screen_manager.log` 60 | Log level can be modified by editing the script itself (at `/var/lib/screen_manager/screen_manager.py`) 61 | 62 | # Known Limitations 63 | 64 | - If after running an action, the process exits, no further action will be taken by this script. The most likely scenario for this is exiting RetroArch by hitting `[select]+[start]` In that case, the user will see the console and a different action must be run. 65 | 66 | -------------------------------------------------------------------------------- /screen/log.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import logging 3 | 4 | def initLogger( logLevel, logFormat, logFile = None ): 5 | logger = logging.getLogger( 'screen_manager' ) 6 | logger.setLevel( logLevel ) 7 | 8 | logHandler = None 9 | 10 | if logFile: 11 | logHandler = logging.FileHandler( logFile ) 12 | else: 13 | logHandler = logging.StreamHandler( sys.stdout ) 14 | 15 | logHandler.setLevel( logLevel ) 16 | logHandler.setFormatter( logging.Formatter( logFormat ) ) 17 | logger.addHandler( logHandler ) 18 | 19 | return logger 20 | 21 | -------------------------------------------------------------------------------- /screen/screen_manager.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shlex 3 | import subprocess 4 | import psutil 5 | import log 6 | import logging 7 | import argparse 8 | import ConfigParser 9 | from watchdog.observers import Observer 10 | from watchdog.events import FileSystemEventHandler 11 | 12 | logLevel = logging.DEBUG; 13 | logFormat = '%(asctime)s - %(levelname)s - %(message)s' 14 | logger = None # This is set to a valid logger in the main, below. 15 | 16 | RUNCOMMAND = "/opt/retropie/supplementary/runcommand/runcommand.sh" 17 | EMULATIONSTATION = "/opt/retropie/supplementary/emulationstation/emulationstation.sh" 18 | DEFAULT_ACTION = { 'type': 'dashboard' } 19 | 20 | # Action functions 21 | 22 | def run_rom( options ): 23 | if not 'system' in options: 24 | logger.error( "Expected 'system' option" ) 25 | elif not 'path' in options: 26 | logger.error( "Expected 'path' option" ) 27 | else: 28 | system = options[ 'system' ] 29 | path = options[ 'path' ] 30 | 31 | # Use runcommand to load the rom, then ES after it exits 32 | logger.info( 'Running rom: {}'.format( path ) ) 33 | cmd = "{} 0 _SYS_ {} '{}'".format( RUNCOMMAND, system, path ) 34 | return cmd 35 | 36 | def run_dashboard( options ): 37 | logger.info( "Running dashboard" ) 38 | return EMULATIONSTATION 39 | 40 | ACTIONS = { 41 | 'dashboard': run_dashboard, # Expects no options 42 | 'rom': run_rom, # Expects { system, path } 43 | } 44 | 45 | def terminate_process( process ): 46 | logger.info( "Terminating current process" ) 47 | children = psutil.Process( process.pid ).children( recursive=True ) 48 | for child in children: 49 | child.terminate() 50 | process.terminate() 51 | 52 | class ConfigChangeHandler( FileSystemEventHandler ): 53 | def __init__( self, screen_manager ): 54 | self.screen_manager = screen_manager 55 | self.config_file = screen_manager.config_file 56 | 57 | def on_created( self, event ): 58 | if ( event.src_path == self.config_file ): 59 | logger.debug( "Config file created: {}".format( event ) ) 60 | self.screen_manager.read_config() 61 | 62 | def on_modified( self, event ): 63 | if ( event.src_path == self.config_file ): 64 | logger.debug( "Config file modified: {}".format( event ) ) 65 | self.screen_manager.read_config() 66 | 67 | def on_deleted( self, event ): 68 | if ( event.src_path == self.config_file ): 69 | logger.debug( "Config file deleted: {}".format( event ) ) 70 | self.screen_manager.read_config() 71 | 72 | class ScreenManager(): 73 | def __init__( self, config_file ): 74 | self.config_file = config_file 75 | self.lastAction = None 76 | self.process = None 77 | 78 | change_handler = ConfigChangeHandler( self ) 79 | self.observer = Observer() 80 | self.observer.schedule( change_handler, os.path.dirname( config_file ) ) 81 | 82 | def read_config( self ): 83 | action = DEFAULT_ACTION 84 | 85 | config = ConfigParser.RawConfigParser() 86 | config.read( self.config_file ) 87 | if config.has_section( 'Action' ): 88 | # Construct a dictionary for the Action section 89 | action = {} 90 | for name in config.options( 'Action' ): 91 | action[ name ] = config.get( 'Action', name ) 92 | 93 | if action != self.lastAction: 94 | self.run_action( action ) 95 | else: 96 | logger.debug( "Action is same as last action. Ignoring." ); 97 | 98 | def run_action( self, action ): 99 | logger.debug( "Running action: {}".format( action ) ) 100 | 101 | self.lastAction = action 102 | 103 | actionFunc = ACTIONS[ action[ 'type' ] ]; 104 | 105 | if actionFunc: 106 | cmd = actionFunc( action ) 107 | 108 | if cmd: 109 | self.run_cmd( cmd ) 110 | 111 | else: 112 | logger.error( "Action '{}' not recognized.".format( action[ 'type' ] ) ) 113 | 114 | def run_cmd( self, cmd ): 115 | if self.process: 116 | terminate_process( self.process ) 117 | 118 | logger.debug( "Running command: {}".format( cmd ) ); 119 | self.process = subprocess.Popen( shlex.split( cmd ) ) 120 | # TODO: Do something if the user exits the process ( like using select+start in RetroArch ) 121 | 122 | def start( self ): 123 | self.read_config() 124 | self.observer.start() 125 | self.observer.join() 126 | 127 | if __name__ == "__main__": 128 | parser = argparse.ArgumentParser( description="Screen Manager" ) 129 | parser.add_argument( '-c', '--config', default='/dev/shm/screen_manager.cfg' ) 130 | parser.add_argument( '-l', '--log-file', default='/dev/shm/screen_manager.log' ) 131 | 132 | args = parser.parse_args() 133 | 134 | logger = log.initLogger( logLevel, logFormat, args.log_file ) 135 | logger.info( "Screen Manager Start" ) 136 | 137 | screenManager = ScreenManager( args.config ) 138 | screenManager.start() 139 | 140 | -------------------------------------------------------------------------------- /screen/update_autostart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | AUTOSTART_SH=/opt/retropie/configs/all/autostart.sh 4 | VAR_WORK_DIR=/var/lib/screen_manager 5 | RUN_LINE="python $VAR_WORK_DIR/screen_manager.py" 6 | 7 | ed -s $AUTOSTART_SH <