├── .gitignore ├── LICENSE ├── README.md ├── circuitpython ├── esp32s3_pi_base_rev2 │ ├── board.c │ ├── mpconfigboard.h │ ├── mpconfigboard.mk │ ├── pins.c │ └── sdkconfig ├── esp32s3_zero_base_rev1 │ ├── board.c │ ├── mpconfigboard.h │ ├── mpconfigboard.mk │ ├── pins.c │ └── sdkconfig ├── pico_zero_base_rev2 │ ├── board.c │ ├── mpconfigboard.h │ ├── mpconfigboard.mk │ ├── pico-sdk-configboard.h │ └── pins.c ├── picow_pi_base_rev1 │ ├── board.c │ ├── link.ld │ ├── mpconfigboard.h │ ├── mpconfigboard.mk │ ├── pico-sdk-configboard.h │ └── pins.c ├── picow_pi_base_rev2 │ ├── board.c │ ├── link.ld │ ├── mpconfigboard.h │ ├── mpconfigboard.mk │ ├── pico-sdk-configboard.h │ └── pins.c ├── picow_zero_base_rev1 │ ├── board.c │ ├── link.ld │ ├── mpconfigboard.h │ ├── mpconfigboard.mk │ ├── pico-sdk-configboard.h │ └── pins.c └── picow_zero_base_rev2 │ ├── board.c │ ├── link.ld │ ├── mpconfigboard.h │ ├── mpconfigboard.mk │ ├── pico-sdk-configboard.h │ └── pins.c ├── examples ├── 4letter_hat-led_shim.jpg ├── 4letter_phat │ └── code.py ├── 8086-i2c-multiplex-hat │ └── code.py ├── Readme.md ├── audio-bonnet │ ├── code.py │ └── slow.mp3 ├── blinkt.jpg ├── blinkt │ └── code.py ├── buttonshim │ └── code.py ├── display-otron │ ├── backlight.py │ ├── graph.py │ ├── hello_world.py │ ├── ip_test.py │ ├── off.py │ ├── room.py │ └── touch.py ├── led_shim │ └── code.py ├── lora-bonnet │ └── code.py ├── pimoroni_phat │ ├── code.py │ └── display-ruler.bmp ├── pimoroni_what │ ├── display-ruler.bmp │ └── main.py ├── pirate-audio │ ├── code.py │ └── slow.mp3 ├── scroll-phat-hd.jpg ├── scrollphathd │ ├── code.py │ └── font5x8.bin ├── touchphat │ └── code.py └── waveshare-4in-display │ └── code.py ├── lib ├── blinkt.py ├── buttonshim │ └── __init__.py ├── cap1xxx.py ├── dothat │ ├── __init__.py │ ├── backlight.py │ ├── lcd.py │ └── touch.py ├── ili9486_waveshare_4in │ ├── bus_core.c.patch │ └── ili9486_waveshare40.py ├── phat.py ├── sn3218.py ├── st7036.py ├── touchphat │ └── __init__.py └── what.py ├── mapping.ods ├── pcb-3D-bot-pi-base.png ├── pcb-3D-bot-zero-base.png ├── pcb-3D-top-pi-base.png ├── pcb-3D-top-zero-base.png ├── pcb-layout-pi-base.png ├── pcb-layout-zero-base.png ├── pico-pi-base.jpg ├── pico-pi-base.kicad ├── pico-pi-base.kicad_pcb ├── pico-pi-base.kicad_prl ├── pico-pi-base.kicad_pro └── pico-pi-base.kicad_sch ├── pico-zero-base.jpg ├── pico-zero-base.kicad ├── pico-zero-base.kicad_pcb ├── pico-zero-base.kicad_prl ├── pico-zero-base.kicad_pro ├── pico-zero-base.kicad_sch └── pico-zero-base.kicad_sch_old ├── production_files ├── BOM-pico-pi-base.csv ├── BOM-pico-zero-base.csv ├── CPL-pico-pi-base.csv ├── CPL-pico-zero-base.csv ├── GERBER-pico-pi-base.zip └── GERBER-pico-zero-base.zip ├── schematic-pi-base.png └── schematic-zero-base.png /.gitignore: -------------------------------------------------------------------------------- 1 | # For PCBs designed using KiCad: http://www.kicad-pcb.org/ 2 | # Format documentation: http://kicad-pcb.org/help/file-formats/ 3 | 4 | # Temporary files 5 | *.000 6 | *.bak 7 | *.bck 8 | *.kicad_pcb-bak 9 | *.sch-bak 10 | *~ 11 | _autosave-* 12 | *.tmp 13 | *-save.pro 14 | *-save.kicad_pcb 15 | fp-info-cache 16 | *-backup 17 | 18 | jlcpcb 19 | work 20 | TODO 21 | 22 | boot_out.txt 23 | examples/*/lib 24 | work 25 | *.pyc 26 | *secrets.py 27 | __pycache__ 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-ShareAlike 4.0 International Public 58 | License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-ShareAlike 4.0 International Public License ("Public 63 | License"). To the extent this Public License may be interpreted as a 64 | contract, You are granted the Licensed Rights in consideration of Your 65 | acceptance of these terms and conditions, and the Licensor grants You 66 | such rights in consideration of benefits the Licensor receives from 67 | making the Licensed Material available under these terms and 68 | conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. Share means to provide material to the public by any means or 126 | process that requires permission under the Licensed Rights, such 127 | as reproduction, public display, public performance, distribution, 128 | dissemination, communication, or importation, and to make material 129 | available to the public including in ways that members of the 130 | public may access the material from a place and at a time 131 | individually chosen by them. 132 | 133 | l. Sui Generis Database Rights means rights other than copyright 134 | resulting from Directive 96/9/EC of the European Parliament and of 135 | the Council of 11 March 1996 on the legal protection of databases, 136 | as amended and/or succeeded, as well as other essentially 137 | equivalent rights anywhere in the world. 138 | 139 | m. You means the individual or entity exercising the Licensed Rights 140 | under this Public License. Your has a corresponding meaning. 141 | 142 | 143 | Section 2 -- Scope. 144 | 145 | a. License grant. 146 | 147 | 1. Subject to the terms and conditions of this Public License, 148 | the Licensor hereby grants You a worldwide, royalty-free, 149 | non-sublicensable, non-exclusive, irrevocable license to 150 | exercise the Licensed Rights in the Licensed Material to: 151 | 152 | a. reproduce and Share the Licensed Material, in whole or 153 | in part; and 154 | 155 | b. produce, reproduce, and Share Adapted Material. 156 | 157 | 2. Exceptions and Limitations. For the avoidance of doubt, where 158 | Exceptions and Limitations apply to Your use, this Public 159 | License does not apply, and You do not need to comply with 160 | its terms and conditions. 161 | 162 | 3. Term. The term of this Public License is specified in Section 163 | 6(a). 164 | 165 | 4. Media and formats; technical modifications allowed. The 166 | Licensor authorizes You to exercise the Licensed Rights in 167 | all media and formats whether now known or hereafter created, 168 | and to make technical modifications necessary to do so. The 169 | Licensor waives and/or agrees not to assert any right or 170 | authority to forbid You from making technical modifications 171 | necessary to exercise the Licensed Rights, including 172 | technical modifications necessary to circumvent Effective 173 | Technological Measures. For purposes of this Public License, 174 | simply making modifications authorized by this Section 2(a) 175 | (4) never produces Adapted Material. 176 | 177 | 5. Downstream recipients. 178 | 179 | a. Offer from the Licensor -- Licensed Material. Every 180 | recipient of the Licensed Material automatically 181 | receives an offer from the Licensor to exercise the 182 | Licensed Rights under the terms and conditions of this 183 | Public License. 184 | 185 | b. Additional offer from the Licensor -- Adapted Material. 186 | Every recipient of Adapted Material from You 187 | automatically receives an offer from the Licensor to 188 | exercise the Licensed Rights in the Adapted Material 189 | under the conditions of the Adapter's License You apply. 190 | 191 | c. No downstream restrictions. You may not offer or impose 192 | any additional or different terms or conditions on, or 193 | apply any Effective Technological Measures to, the 194 | Licensed Material if doing so restricts exercise of the 195 | Licensed Rights by any recipient of the Licensed 196 | Material. 197 | 198 | 6. No endorsement. Nothing in this Public License constitutes or 199 | may be construed as permission to assert or imply that You 200 | are, or that Your use of the Licensed Material is, connected 201 | with, or sponsored, endorsed, or granted official status by, 202 | the Licensor or others designated to receive attribution as 203 | provided in Section 3(a)(1)(A)(i). 204 | 205 | b. Other rights. 206 | 207 | 1. Moral rights, such as the right of integrity, are not 208 | licensed under this Public License, nor are publicity, 209 | privacy, and/or other similar personality rights; however, to 210 | the extent possible, the Licensor waives and/or agrees not to 211 | assert any such rights held by the Licensor to the limited 212 | extent necessary to allow You to exercise the Licensed 213 | Rights, but not otherwise. 214 | 215 | 2. Patent and trademark rights are not licensed under this 216 | Public License. 217 | 218 | 3. To the extent possible, the Licensor waives any right to 219 | collect royalties from You for the exercise of the Licensed 220 | Rights, whether directly or through a collecting society 221 | under any voluntary or waivable statutory or compulsory 222 | licensing scheme. In all other cases the Licensor expressly 223 | reserves any right to collect such royalties. 224 | 225 | 226 | Section 3 -- License Conditions. 227 | 228 | Your exercise of the Licensed Rights is expressly made subject to the 229 | following conditions. 230 | 231 | a. Attribution. 232 | 233 | 1. If You Share the Licensed Material (including in modified 234 | form), You must: 235 | 236 | a. retain the following if it is supplied by the Licensor 237 | with the Licensed Material: 238 | 239 | i. identification of the creator(s) of the Licensed 240 | Material and any others designated to receive 241 | attribution, in any reasonable manner requested by 242 | the Licensor (including by pseudonym if 243 | designated); 244 | 245 | ii. a copyright notice; 246 | 247 | iii. a notice that refers to this Public License; 248 | 249 | iv. a notice that refers to the disclaimer of 250 | warranties; 251 | 252 | v. a URI or hyperlink to the Licensed Material to the 253 | extent reasonably practicable; 254 | 255 | b. indicate if You modified the Licensed Material and 256 | retain an indication of any previous modifications; and 257 | 258 | c. indicate the Licensed Material is licensed under this 259 | Public License, and include the text of, or the URI or 260 | hyperlink to, this Public License. 261 | 262 | 2. You may satisfy the conditions in Section 3(a)(1) in any 263 | reasonable manner based on the medium, means, and context in 264 | which You Share the Licensed Material. For example, it may be 265 | reasonable to satisfy the conditions by providing a URI or 266 | hyperlink to a resource that includes the required 267 | information. 268 | 269 | 3. If requested by the Licensor, You must remove any of the 270 | information required by Section 3(a)(1)(A) to the extent 271 | reasonably practicable. 272 | 273 | b. ShareAlike. 274 | 275 | In addition to the conditions in Section 3(a), if You Share 276 | Adapted Material You produce, the following conditions also apply. 277 | 278 | 1. The Adapter's License You apply must be a Creative Commons 279 | license with the same License Elements, this version or 280 | later, or a BY-SA Compatible License. 281 | 282 | 2. You must include the text of, or the URI or hyperlink to, the 283 | Adapter's License You apply. You may satisfy this condition 284 | in any reasonable manner based on the medium, means, and 285 | context in which You Share Adapted Material. 286 | 287 | 3. You may not offer or impose any additional or different terms 288 | or conditions on, or apply any Effective Technological 289 | Measures to, Adapted Material that restrict exercise of the 290 | rights granted under the Adapter's License You apply. 291 | 292 | 293 | Section 4 -- Sui Generis Database Rights. 294 | 295 | Where the Licensed Rights include Sui Generis Database Rights that 296 | apply to Your use of the Licensed Material: 297 | 298 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 299 | to extract, reuse, reproduce, and Share all or a substantial 300 | portion of the contents of the database; 301 | 302 | b. if You include all or a substantial portion of the database 303 | contents in a database in which You have Sui Generis Database 304 | Rights, then the database in which You have Sui Generis Database 305 | Rights (but not its individual contents) is Adapted Material, 306 | 307 | including for purposes of Section 3(b); and 308 | c. You must comply with the conditions in Section 3(a) if You Share 309 | all or a substantial portion of the contents of the database. 310 | 311 | For the avoidance of doubt, this Section 4 supplements and does not 312 | replace Your obligations under this Public License where the Licensed 313 | Rights include other Copyright and Similar Rights. 314 | 315 | 316 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 317 | 318 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 319 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 320 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 321 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 322 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 323 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 324 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 325 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 326 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 327 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 328 | 329 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 330 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 331 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 332 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 333 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 334 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 335 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 336 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 337 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 338 | 339 | c. The disclaimer of warranties and limitation of liability provided 340 | above shall be interpreted in a manner that, to the extent 341 | possible, most closely approximates an absolute disclaimer and 342 | waiver of all liability. 343 | 344 | 345 | Section 6 -- Term and Termination. 346 | 347 | a. This Public License applies for the term of the Copyright and 348 | Similar Rights licensed here. However, if You fail to comply with 349 | this Public License, then Your rights under this Public License 350 | terminate automatically. 351 | 352 | b. Where Your right to use the Licensed Material has terminated under 353 | Section 6(a), it reinstates: 354 | 355 | 1. automatically as of the date the violation is cured, provided 356 | it is cured within 30 days of Your discovery of the 357 | violation; or 358 | 359 | 2. upon express reinstatement by the Licensor. 360 | 361 | For the avoidance of doubt, this Section 6(b) does not affect any 362 | right the Licensor may have to seek remedies for Your violations 363 | of this Public License. 364 | 365 | c. For the avoidance of doubt, the Licensor may also offer the 366 | Licensed Material under separate terms or conditions or stop 367 | distributing the Licensed Material at any time; however, doing so 368 | will not terminate this Public License. 369 | 370 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 371 | License. 372 | 373 | 374 | Section 7 -- Other Terms and Conditions. 375 | 376 | a. The Licensor shall not be bound by any additional or different 377 | terms or conditions communicated by You unless expressly agreed. 378 | 379 | b. Any arrangements, understandings, or agreements regarding the 380 | Licensed Material not stated herein are separate from and 381 | independent of the terms and conditions of this Public License. 382 | 383 | 384 | Section 8 -- Interpretation. 385 | 386 | a. For the avoidance of doubt, this Public License does not, and 387 | shall not be interpreted to, reduce, limit, restrict, or impose 388 | conditions on any use of the Licensed Material that could lawfully 389 | be made without permission under this Public License. 390 | 391 | b. To the extent possible, if any provision of this Public License is 392 | deemed unenforceable, it shall be automatically reformed to the 393 | minimum extent necessary to make it enforceable. If the provision 394 | cannot be reformed, it shall be severed from this Public License 395 | without affecting the enforceability of the remaining terms and 396 | conditions. 397 | 398 | c. No term or condition of this Public License will be waived and no 399 | failure to comply consented to unless expressly agreed to by the 400 | Licensor. 401 | 402 | d. Nothing in this Public License constitutes or may be interpreted 403 | as a limitation upon, or waiver of, any privileges and immunities 404 | that apply to the Licensor or You, including from the legal 405 | processes of any jurisdiction or authority. 406 | 407 | 408 | ======================================================================= 409 | 410 | Creative Commons is not a party to its public 411 | licenses. Notwithstanding, Creative Commons may elect to apply one of 412 | its public licenses to material it publishes and in those instances 413 | will be considered the “Licensor.” The text of the Creative Commons 414 | public licenses is dedicated to the public domain under the CC0 Public 415 | Domain Dedication. Except for the limited purpose of indicating that 416 | material is shared under a Creative Commons public license or as 417 | otherwise permitted by the Creative Commons policies published at 418 | creativecommons.org/policies, Creative Commons does not authorize the 419 | use of the trademark "Creative Commons" or any other trademark or logo 420 | of Creative Commons without its prior written consent including, 421 | without limitation, in connection with any unauthorized modifications 422 | to any of its public licenses or any other arrangements, 423 | understandings, or agreements concerning use of licensed material. For 424 | the avoidance of doubt, this paragraph does not form part of the 425 | public licenses. 426 | 427 | Creative Commons may be contacted at creativecommons.org. 428 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | pcb-pico-pi-base 2 | ================ 3 | 4 | This projects provides two adapter-boards to run Pi-hats with a Pico. 5 | 6 | The "pico-zero-base": 7 | 8 | ![](pico-zero-base.jpg) 9 | 10 | and the "pico-pi-base": 11 | 12 | ![](pico-pi-base.jpg) 13 | 14 | The boards support (besides digital IO) I2C, I2S and SPI. 15 | 16 | 17 | Supported Hats 18 | -------------- 19 | 20 | The following hats were successfully tested: 21 | 22 | - Scroll pHat HD 23 | - Touch pHat 24 | - 4-Letter pHat 25 | - LED-Shim 26 | - Button-Shim 27 | - Pirate-Audio Speaker-Hat 28 | - Pirate-Audio Shim 29 | - Adafruit Speaker Bonnet 30 | - Display-Otron-Hat 31 | - InkyImpression 5.7" 32 | - Inky wHAT (black and white version) 33 | - Waveshare 4 inch RPi LCD (A) 34 | - I2C-Multiplexer-pHat 35 | 36 | See the [examples page](examples/Readme.md) for details. 37 | 38 | 39 | Hardware 40 | -------- 41 | 42 | KiCad design-files are in `pico-zero-base.kicad` and in `pico-pi-base.kicad` 43 | respectively. Ready to upload production files for JLCPCB are in `production_files`. 44 | 45 | Except for I2C-pullups (and VSYS-diode on pico-pi-base) the adapter-boards 46 | only map the pins of the Pico to pins of the Pi. The current versions 47 | support I2C, SPI0, SPI1, I2S. 48 | 49 | Schematic, layout and 3D-rendered images for pico-zero-base: 50 | 51 | ![](schematic-zero-base.png) 52 | ![](pcb-layout-zero-base.png) 53 | ![](pcb-3D-top-zero-base.png) 54 | ![](pcb-3D-bot-zero-base.png) 55 | 56 | Schematic, layout and 3D-rendered images for pico-pi-base: 57 | 58 | ![](schematic-pi-base.png) 59 | ![](pcb-layout-pi-base.png) 60 | ![](pcb-3D-top-pi-base.png) 61 | ![](pcb-3D-bot-pi-base.png) 62 | 63 | 64 | Software 65 | -------- 66 | 67 | Since you cannot run Linux-software on the Pico, you need to check if there is a 68 | Pico-driver available for your hats or adapt existing Pi drivers to the Pico. Since 69 | many hats have python-drivers, this is not too difficult. Most hats only use 70 | I2C and/or SPI anyhow. 71 | 72 | In the directory `lib` you will find CircuitPython drivers for the supported 73 | hats, unless there is a ready to use driver available. 74 | 75 | The directory `examples` contains example programs. 76 | 77 | The software currently assumes that you use special CircuitPython-builds 78 | that do the pin mapping (see the directory `circuitpython`). 79 | If not, you have to manually look up the [mapping](mapping.ods). 80 | 81 | Porting to MicroPython from CircuitPython should be very simple, since 82 | CircuitPython is only a fork of MicroPython and all the drivers use only 83 | I2C, SPI and digital-IO. 84 | 85 | 86 | License 87 | ------- 88 | 89 | [![CC BY-SA 4.0][cc-by-sa-shield]][cc-by-sa] 90 | 91 | This work is licensed under a 92 | [Creative Commons Attribution-ShareAlike 4.0 International 93 | License][cc-by-sa]. 94 | 95 | [![CC BY-SA 4.0][cc-by-sa-image]][cc-by-sa] 96 | 97 | [cc-by-sa]: http://creativecommons.org/licenses/by-sa/4.0/ 98 | [cc-by-sa-image]: https://licensebuttons.net/l/by-sa/4.0/88x31.png 99 | [cc-by-sa-shield]: 100 | https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg 101 | -------------------------------------------------------------------------------- /circuitpython/esp32s3_pi_base_rev2/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the MicroPython project, http://micropython.org/ 3 | * 4 | * The MIT License (MIT) 5 | * 6 | * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | #include "supervisor/board.h" 28 | 29 | // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. 30 | -------------------------------------------------------------------------------- /circuitpython/esp32s3_pi_base_rev2/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "ESP32S3 Pi Base Rev2" 2 | #define MICROPY_HW_MCU_NAME "ESP32S3" 3 | 4 | #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) 5 | 6 | #define CIRCUITPY_BOARD_I2C (1) 7 | #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO14, .sda = &pin_GPIO13}} 8 | 9 | #define DEFAULT_SPI_BUS_SCK (&pin_GPIO1) 10 | #define DEFAULT_SPI_BUS_MISO (&pin_GPIO42) 11 | #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO2) 12 | 13 | #define CIRCUITPY_BOARD_UART (1) 14 | #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO15, .rx = &pin_GPIO16}} 15 | -------------------------------------------------------------------------------- /circuitpython/esp32s3_pi_base_rev2/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | USB_VID = 0x303a 2 | USB_PID = 0x81A3 3 | USB_PRODUCT = "ESP32-S3-Pico" 4 | USB_MANUFACTURER = "Waveshare Electronics" 5 | 6 | IDF_TARGET = esp32s3 7 | 8 | CIRCUITPY_ESP_FLASH_MODE = qio 9 | CIRCUITPY_ESP_FLASH_FREQ = 80m 10 | CIRCUITPY_ESP_FLASH_SIZE = 16MB 11 | 12 | CIRCUITPY_ESP_PSRAM_SIZE = 2MB 13 | CIRCUITPY_ESP_PSRAM_MODE = qio 14 | CIRCUITPY_ESP_PSRAM_FREQ = 80m 15 | -------------------------------------------------------------------------------- /circuitpython/esp32s3_pi_base_rev2/pins.c: -------------------------------------------------------------------------------- 1 | #include "shared-bindings/board/__init__.h" 2 | 3 | STATIC const mp_rom_map_elem_t board_module_globals_table[] = { 4 | CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS 5 | 6 | { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO11) }, 7 | { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO12) }, 8 | { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO13) }, 9 | { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO14) }, 10 | { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO15) }, 11 | { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO16) }, 12 | { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO17) }, 13 | { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO18) }, 14 | { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO33) }, 15 | { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO34) }, 16 | { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO35) }, 17 | { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO36) }, 18 | { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO37) }, 19 | { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO38) }, 20 | { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO39) }, 21 | { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO40) }, 22 | { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO42) }, 23 | { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO41) }, 24 | { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO1) }, 25 | { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO2) }, 26 | { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO4) }, 27 | { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO5) }, 28 | { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO6) }, 29 | { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO7) }, 30 | { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO8) }, 31 | { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO9) }, 32 | 33 | { MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO11) }, 34 | { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO12) }, 35 | 36 | { MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO13) }, 37 | { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO13) }, 38 | 39 | { MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO14) }, 40 | { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO14) }, 41 | 42 | { MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO15) }, 43 | { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO15) }, 44 | 45 | { MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO16) }, 46 | { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO16) }, 47 | 48 | { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO17) }, 49 | 50 | { MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO18) }, 51 | 52 | { MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO33) }, 53 | { MP_ROM_QSTR(MP_QSTR_MISO1), MP_ROM_PTR(&pin_GPIO33) }, 54 | 55 | { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO34) }, 56 | 57 | { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO35) }, 58 | { MP_ROM_QSTR(MP_QSTR_CE1), MP_ROM_PTR(&pin_GPIO35) }, 59 | 60 | { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO36) }, 61 | 62 | { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO37) }, 63 | 64 | { MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO38) }, 65 | 66 | { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO39) }, 67 | { MP_ROM_QSTR(MP_QSTR_SCLK1), MP_ROM_PTR(&pin_GPIO39) }, 68 | 69 | { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO40) }, 70 | { MP_ROM_QSTR(MP_QSTR_MOSI1), MP_ROM_PTR(&pin_GPIO40) }, 71 | 72 | { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO42) }, 73 | { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO42) }, 74 | 75 | { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO41) }, 76 | { MP_ROM_QSTR(MP_QSTR_CE0), MP_ROM_PTR(&pin_GPIO41) }, 77 | 78 | { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO1) }, 79 | { MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO1) }, 80 | 81 | { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO2) }, 82 | { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO2) }, 83 | 84 | { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO4) }, 85 | 86 | { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO5) }, 87 | 88 | { MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO6) }, 89 | 90 | { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO7) }, 91 | { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO7) }, 92 | 93 | { MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO8) }, 94 | 95 | { MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO9) }, 96 | 97 | { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO21) }, 98 | { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO3) }, 99 | 100 | { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, 101 | { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, 102 | 103 | }; 104 | MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); 105 | -------------------------------------------------------------------------------- /circuitpython/esp32s3_pi_base_rev2/sdkconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Espressif IoT Development Framework Configuration 3 | # 4 | # 5 | # Component config 6 | # 7 | # 8 | # LWIP 9 | # 10 | CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" 11 | # end of LWIP 12 | 13 | # end of Component config 14 | 15 | # end of Espressif IoT Development Framework Configuration 16 | -------------------------------------------------------------------------------- /circuitpython/esp32s3_zero_base_rev1/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the MicroPython project, http://micropython.org/ 3 | * 4 | * The MIT License (MIT) 5 | * 6 | * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | #include "supervisor/board.h" 28 | 29 | // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. 30 | -------------------------------------------------------------------------------- /circuitpython/esp32s3_zero_base_rev1/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "ESP32S3 Zero Base Rev1" 2 | #define MICROPY_HW_MCU_NAME "ESP32S3" 3 | 4 | #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) 5 | 6 | #define CIRCUITPY_BOARD_I2C (1) 7 | #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO14, .sda = &pin_GPIO13}} 8 | 9 | #define DEFAULT_SPI_BUS_SCK (&pin_GPIO35) 10 | #define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) 11 | #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO36) 12 | 13 | #define CIRCUITPY_BOARD_UART (1) 14 | #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO11, .rx = &pin_GPIO12}} 15 | -------------------------------------------------------------------------------- /circuitpython/esp32s3_zero_base_rev1/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | USB_VID = 0x303a 2 | USB_PID = 0x81A3 3 | USB_PRODUCT = "ESP32-S3-Pico" 4 | USB_MANUFACTURER = "Waveshare Electronics" 5 | 6 | IDF_TARGET = esp32s3 7 | 8 | CIRCUITPY_ESP_FLASH_MODE = qio 9 | CIRCUITPY_ESP_FLASH_FREQ = 80m 10 | CIRCUITPY_ESP_FLASH_SIZE = 16MB 11 | 12 | CIRCUITPY_ESP_PSRAM_SIZE = 2MB 13 | CIRCUITPY_ESP_PSRAM_MODE = qio 14 | CIRCUITPY_ESP_PSRAM_FREQ = 80m 15 | -------------------------------------------------------------------------------- /circuitpython/esp32s3_zero_base_rev1/pins.c: -------------------------------------------------------------------------------- 1 | #include "shared-bindings/board/__init__.h" 2 | 3 | STATIC const mp_rom_map_elem_t board_module_globals_table[] = { 4 | CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS 5 | 6 | { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO11) }, 7 | { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO12) }, 8 | { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO13) }, 9 | { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO14) }, 10 | { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO15) }, 11 | { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO16) }, 12 | { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO17) }, 13 | { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO18) }, 14 | { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO33) }, 15 | { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO34) }, 16 | { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO35) }, 17 | { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO36) }, 18 | { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO37) }, 19 | { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO38) }, 20 | { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO39) }, 21 | { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO40) }, 22 | { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO42) }, 23 | { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO41) }, 24 | { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO1) }, 25 | { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO2) }, 26 | { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO4) }, 27 | { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO5) }, 28 | { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO6) }, 29 | { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO7) }, 30 | { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO8) }, 31 | { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO9) }, 32 | 33 | { MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO13) }, 34 | { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO13) }, 35 | 36 | { MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO14) }, 37 | { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO14) }, 38 | 39 | { MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO15) }, 40 | { MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO5) }, 41 | { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO38) }, 42 | 43 | { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO6) }, 44 | { MP_ROM_QSTR(MP_QSTR_CE1), MP_ROM_PTR(&pin_GPIO6) }, 45 | 46 | { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO34) }, 47 | { MP_ROM_QSTR(MP_QSTR_CE0), MP_ROM_PTR(&pin_GPIO34) }, 48 | 49 | { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO37) }, 50 | { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, 51 | 52 | { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO36) }, 53 | { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO36) }, 54 | 55 | { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO35) }, 56 | { MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO35) }, 57 | 58 | { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO4) }, 59 | { MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO39) }, 60 | 61 | { MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO11) }, 62 | { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO11) }, 63 | 64 | { MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO12) }, 65 | { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO12) }, 66 | 67 | { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO33) }, 68 | 69 | { MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO41) }, 70 | { MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO16) }, 71 | { MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO9) }, 72 | 73 | { MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO42) }, 74 | { MP_ROM_QSTR(MP_QSTR_MISO1), MP_ROM_PTR(&pin_GPIO42) }, 75 | 76 | { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO2) }, 77 | { MP_ROM_QSTR(MP_QSTR_MOSI1), MP_ROM_PTR(&pin_GPIO2) }, 78 | 79 | { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO1) }, 80 | { MP_ROM_QSTR(MP_QSTR_SCLK1), MP_ROM_PTR(&pin_GPIO1) }, 81 | 82 | { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO18) }, 83 | { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO8) }, 84 | { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO7) }, 85 | { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO40) }, 86 | { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO17) }, 87 | 88 | { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO21) }, 89 | { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO3) }, 90 | 91 | { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, 92 | { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, 93 | 94 | }; 95 | MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); 96 | -------------------------------------------------------------------------------- /circuitpython/esp32s3_zero_base_rev1/sdkconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Espressif IoT Development Framework Configuration 3 | # 4 | # 5 | # Component config 6 | # 7 | # 8 | # LWIP 9 | # 10 | CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" 11 | # end of LWIP 12 | 13 | # end of Component config 14 | 15 | # end of Espressif IoT Development Framework Configuration 16 | -------------------------------------------------------------------------------- /circuitpython/pico_zero_base_rev2/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the MicroPython project, http://micropython.org/ 3 | * 4 | * The MIT License (MIT) 5 | * 6 | * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | #include "supervisor/board.h" 28 | 29 | // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. 30 | -------------------------------------------------------------------------------- /circuitpython/pico_zero_base_rev2/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "Pico Zero Base Rev2" 2 | #define MICROPY_HW_MCU_NAME "rp2040" 3 | 4 | #define MICROPY_HW_LED_STATUS (&pin_GPIO25) 5 | 6 | #define CIRCUITPY_BOARD_I2C (1) 7 | #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO3, .sda = &pin_GPIO2}} 8 | 9 | #define DEFAULT_SPI_BUS_SCK (&pin_GPIO10) 10 | #define DEFAULT_SPI_BUS_MISO (&pin_GPIO12) 11 | #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) 12 | 13 | 14 | #define CIRCUITPY_BOARD_UART (1) 15 | #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO0, .rx = &pin_GPIO1}} 16 | -------------------------------------------------------------------------------- /circuitpython/pico_zero_base_rev2/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | USB_VID = 0x239A 2 | USB_PID = 0x80F4 3 | USB_PRODUCT = "Pico" 4 | USB_MANUFACTURER = "Raspberry Pi" 5 | 6 | CHIP_VARIANT = RP2040 7 | CHIP_FAMILY = rp2 8 | 9 | EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" 10 | 11 | CIRCUITPY__EVE = 1 12 | -------------------------------------------------------------------------------- /circuitpython/pico_zero_base_rev2/pico-sdk-configboard.h: -------------------------------------------------------------------------------- 1 | // Put board-specific pico-sdk definitions here. This file must exist. 2 | -------------------------------------------------------------------------------- /circuitpython/pico_zero_base_rev2/pins.c: -------------------------------------------------------------------------------- 1 | #include "shared-bindings/board/__init__.h" 2 | 3 | STATIC const mp_rom_map_elem_t board_module_globals_table[] = { 4 | CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS 5 | 6 | { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, 7 | { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, 8 | { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, 9 | { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, 10 | { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, 11 | { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, 12 | { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, 13 | { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, 14 | { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, 15 | { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, 16 | { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, 17 | { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, 18 | { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, 19 | { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, 20 | { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, 21 | { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, 22 | { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, 23 | { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, 24 | { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, 25 | { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, 26 | { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, 27 | { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, 28 | { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, 29 | { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, 30 | { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, 31 | { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, 32 | 33 | { MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO0) }, 34 | { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, 35 | 36 | { MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO1) }, 37 | { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, 38 | 39 | { MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO2) }, 40 | { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, 41 | 42 | { MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO3) }, 43 | { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, 44 | 45 | { MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO4) }, 46 | 47 | { MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO5) }, 48 | 49 | { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO6) }, 50 | 51 | { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO7) }, 52 | 53 | { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO8) }, 54 | 55 | { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO9) }, 56 | { MP_ROM_QSTR(MP_QSTR_CE0), MP_ROM_PTR(&pin_GPIO9) }, 57 | 58 | { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO10) }, 59 | { MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO10) }, 60 | 61 | { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO11) }, 62 | { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, 63 | 64 | { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO12) }, 65 | { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO12) }, 66 | 67 | { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO13) }, 68 | 69 | { MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO14) }, 70 | 71 | { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO15) }, 72 | 73 | { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO16) }, 74 | 75 | { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO17) }, 76 | 77 | { MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO18) }, 78 | 79 | { MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO19) }, 80 | 81 | { MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO20) }, 82 | 83 | { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO21) }, 84 | 85 | { MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO22) }, 86 | 87 | { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO26) }, 88 | { MP_ROM_QSTR(MP_QSTR_CE1), MP_ROM_PTR(&pin_GPIO26) }, 89 | 90 | { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO27) }, 91 | 92 | { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO28) }, 93 | 94 | { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO23) }, 95 | { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, 96 | 97 | { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, 98 | { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, 99 | 100 | { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, 101 | { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, 102 | 103 | { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, 104 | { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, 105 | 106 | { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, 107 | { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, 108 | 109 | { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, 110 | { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, 111 | 112 | { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, 113 | { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, 114 | 115 | { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, 116 | { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, 117 | }; 118 | MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); 119 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev1/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the MicroPython project, http://micropython.org/ 3 | * 4 | * The MIT License (MIT) 5 | * 6 | * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | #include "supervisor/board.h" 28 | 29 | // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. 30 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev1/link.ld: -------------------------------------------------------------------------------- 1 | firmware_size = 1532k; 2 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev1/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "PicoW Pi Base Rev1" 2 | #define MICROPY_HW_MCU_NAME "rp2040" 3 | 4 | #define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) 5 | #define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) 6 | 7 | #define MICROPY_HW_LED_STATUS (&pin_CYW0) 8 | 9 | #define CIRCUITPY_BOARD_I2C (1) 10 | #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO3, .sda = &pin_GPIO2}} 11 | 12 | #define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) 13 | #define DEFAULT_SPI_BUS_MISO (&pin_GPIO16) 14 | #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19) 15 | 16 | #define CIRCUITPY_BOARD_UART (1) 17 | #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO4, .rx = &pin_GPIO5}} 18 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev1/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | USB_VID = 0x239A 2 | USB_PID = 0x8120 3 | USB_PRODUCT = "Pico W" 4 | USB_MANUFACTURER = "Raspberry Pi" 5 | 6 | CHIP_VARIANT = RP2040 7 | CHIP_FAMILY = rp2 8 | 9 | EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" 10 | 11 | CIRCUITPY__EVE = 1 12 | 13 | CIRCUITPY_CYW43 = 1 14 | CIRCUITPY_SSL = 1 15 | CIRCUITPY_SSL_MBEDTLS = 1 16 | CIRCUITPY_HASHLIB = 1 17 | CIRCUITPY_WEB_WORKFLOW = 1 18 | CIRCUITPY_MDNS = 1 19 | CIRCUITPY_SOCKETPOOL = 1 20 | CIRCUITPY_WIFI = 1 21 | 22 | CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 23 | # Must be accompanied by a linker script change 24 | CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' 25 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev1/pico-sdk-configboard.h: -------------------------------------------------------------------------------- 1 | // Put board-specific pico-sdk definitions here. This file must exist. 2 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev1/pins.c: -------------------------------------------------------------------------------- 1 | #include "shared-bindings/board/__init__.h" 2 | 3 | STATIC const mp_rom_map_elem_t board_module_globals_table[] = { 4 | CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS 5 | 6 | { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, 7 | { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, 8 | { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, 9 | { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, 10 | { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, 11 | { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, 12 | { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, 13 | { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, 14 | { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, 15 | { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, 16 | { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, 17 | { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, 18 | { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, 19 | { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, 20 | { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, 21 | { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, 22 | { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, 23 | { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, 24 | { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, 25 | { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, 26 | { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, 27 | { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, 28 | { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, 29 | { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, 30 | { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, 31 | { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, 32 | 33 | { MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO0) }, 34 | 35 | { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO1) }, 36 | 37 | { MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO2) }, 38 | { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, 39 | 40 | { MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO3) }, 41 | { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, 42 | 43 | { MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO4) }, 44 | { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO4) }, 45 | 46 | { MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO5) }, 47 | { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO5) }, 48 | 49 | { MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO6) }, 50 | 51 | { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO7) }, 52 | 53 | { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO8) }, 54 | 55 | { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO9) }, 56 | 57 | { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO10) }, 58 | { MP_ROM_QSTR(MP_QSTR_CE1), MP_ROM_PTR(&pin_GPIO10) }, 59 | 60 | { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO11) }, 61 | 62 | { MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO12) }, 63 | { MP_ROM_QSTR(MP_QSTR_MISO1), MP_ROM_PTR(&pin_GPIO12) }, 64 | 65 | { MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO13) }, 66 | 67 | { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO14) }, 68 | { MP_ROM_QSTR(MP_QSTR_SCLK1), MP_ROM_PTR(&pin_GPIO14) }, 69 | 70 | { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO15) }, 71 | { MP_ROM_QSTR(MP_QSTR_MOSI1), MP_ROM_PTR(&pin_GPIO15) }, 72 | 73 | { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO16) }, 74 | { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO16) }, 75 | 76 | { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO17) }, 77 | { MP_ROM_QSTR(MP_QSTR_CE0), MP_ROM_PTR(&pin_GPIO17) }, 78 | 79 | { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO18) }, 80 | { MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO18) }, 81 | 82 | { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO19) }, 83 | { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, 84 | 85 | { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO20) }, 86 | 87 | { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO21) }, 88 | 89 | { MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO22) }, 90 | 91 | { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO26) }, 92 | 93 | { MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO27) }, 94 | 95 | { MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO28) }, 96 | 97 | { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1) }, 98 | 99 | { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0) }, 100 | 101 | { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, 102 | 103 | { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, 104 | { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, 105 | 106 | { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, 107 | { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, 108 | 109 | { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, 110 | { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, 111 | 112 | { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, 113 | { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, 114 | 115 | { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, 116 | { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, 117 | }; 118 | MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); 119 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev2/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the MicroPython project, http://micropython.org/ 3 | * 4 | * The MIT License (MIT) 5 | * 6 | * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | #include "supervisor/board.h" 28 | 29 | // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. 30 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev2/link.ld: -------------------------------------------------------------------------------- 1 | firmware_size = 1532k; 2 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev2/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "PicoW Pi Base Rev2" 2 | #define MICROPY_HW_MCU_NAME "rp2040" 3 | 4 | #define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) 5 | #define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) 6 | 7 | #define MICROPY_HW_LED_STATUS (&pin_CYW0) 8 | 9 | #define CIRCUITPY_BOARD_I2C (1) 10 | #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO3, .sda = &pin_GPIO2}} 11 | 12 | #define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) 13 | #define DEFAULT_SPI_BUS_MISO (&pin_GPIO16) 14 | #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19) 15 | 16 | #define CIRCUITPY_BOARD_UART (1) 17 | #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO4, .rx = &pin_GPIO5}} 18 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev2/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | USB_VID = 0x239A 2 | USB_PID = 0x8120 3 | USB_PRODUCT = "Pico W" 4 | USB_MANUFACTURER = "Raspberry Pi" 5 | 6 | CHIP_VARIANT = RP2040 7 | CHIP_FAMILY = rp2 8 | 9 | EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" 10 | 11 | CIRCUITPY__EVE = 1 12 | 13 | CIRCUITPY_CYW43 = 1 14 | CIRCUITPY_SSL = 1 15 | CIRCUITPY_SSL_MBEDTLS = 1 16 | CIRCUITPY_HASHLIB = 1 17 | CIRCUITPY_WEB_WORKFLOW = 1 18 | CIRCUITPY_MDNS = 1 19 | CIRCUITPY_SOCKETPOOL = 1 20 | CIRCUITPY_WIFI = 1 21 | 22 | CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 23 | # Must be accompanied by a linker script change 24 | CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' 25 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev2/pico-sdk-configboard.h: -------------------------------------------------------------------------------- 1 | // Put board-specific pico-sdk definitions here. This file must exist. 2 | -------------------------------------------------------------------------------- /circuitpython/picow_pi_base_rev2/pins.c: -------------------------------------------------------------------------------- 1 | #include "shared-bindings/board/__init__.h" 2 | 3 | STATIC const mp_rom_map_elem_t board_module_globals_table[] = { 4 | CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS 5 | 6 | { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, 7 | { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, 8 | { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, 9 | { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, 10 | { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, 11 | { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, 12 | { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, 13 | { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, 14 | { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, 15 | { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, 16 | { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, 17 | { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, 18 | { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, 19 | { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, 20 | { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, 21 | { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, 22 | { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, 23 | { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, 24 | { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, 25 | { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, 26 | { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, 27 | { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, 28 | { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, 29 | { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, 30 | { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, 31 | { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, 32 | 33 | { MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO0) }, 34 | 35 | { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO1) }, 36 | 37 | { MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO2) }, 38 | { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, 39 | 40 | { MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO3) }, 41 | { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, 42 | 43 | { MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO4) }, 44 | { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO4) }, 45 | 46 | { MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO5) }, 47 | { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO5) }, 48 | 49 | { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO6) }, 50 | 51 | { MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO7) }, 52 | 53 | { MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO8) }, 54 | { MP_ROM_QSTR(MP_QSTR_MISO1), MP_ROM_PTR(&pin_GPIO8) }, 55 | 56 | { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO9) }, 57 | 58 | { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO10) }, 59 | { MP_ROM_QSTR(MP_QSTR_CE1), MP_ROM_PTR(&pin_GPIO10) }, 60 | 61 | { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO11) }, 62 | 63 | { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO12) }, 64 | 65 | { MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO13) }, 66 | 67 | { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO14) }, 68 | { MP_ROM_QSTR(MP_QSTR_SCLK1), MP_ROM_PTR(&pin_GPIO14) }, 69 | 70 | { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO15) }, 71 | { MP_ROM_QSTR(MP_QSTR_MOSI1), MP_ROM_PTR(&pin_GPIO15) }, 72 | 73 | { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO16) }, 74 | { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO16) }, 75 | 76 | { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO17) }, 77 | { MP_ROM_QSTR(MP_QSTR_CE0), MP_ROM_PTR(&pin_GPIO17) }, 78 | 79 | { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO18) }, 80 | { MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO18) }, 81 | 82 | { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO19) }, 83 | { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, 84 | 85 | { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO20) }, 86 | 87 | { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO21) }, 88 | 89 | { MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO22) }, 90 | 91 | { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO26) }, 92 | { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO26) }, 93 | 94 | { MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO27) }, 95 | 96 | { MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO28) }, 97 | 98 | { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1) }, 99 | 100 | { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0) }, 101 | 102 | { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, 103 | 104 | { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, 105 | { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, 106 | 107 | { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, 108 | { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, 109 | 110 | { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, 111 | { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, 112 | 113 | { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, 114 | { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, 115 | 116 | { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, 117 | { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, 118 | }; 119 | MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); 120 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev1/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the MicroPython project, http://micropython.org/ 3 | * 4 | * The MIT License (MIT) 5 | * 6 | * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | #include "supervisor/board.h" 28 | 29 | // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. 30 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev1/link.ld: -------------------------------------------------------------------------------- 1 | firmware_size = 1532k; 2 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev1/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "PicoW Zero Base Rev1" 2 | #define MICROPY_HW_MCU_NAME "rp2040" 3 | 4 | #define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) 5 | #define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) 6 | 7 | #define MICROPY_HW_LED_STATUS (&pin_CYW0) 8 | 9 | #define CIRCUITPY_BOARD_I2C (1) 10 | #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO3, .sda = &pin_GPIO2}} 11 | 12 | #define DEFAULT_SPI_BUS_SCK (&pin_GPIO10) 13 | #define DEFAULT_SPI_BUS_MISO (&pin_GPIO12) 14 | #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) 15 | 16 | 17 | #define CIRCUITPY_BOARD_UART (1) 18 | #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO0, .rx = &pin_GPIO1}} 19 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev1/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | USB_VID = 0x239A 2 | USB_PID = 0x8120 3 | USB_PRODUCT = "Pico W" 4 | USB_MANUFACTURER = "Raspberry Pi" 5 | 6 | CHIP_VARIANT = RP2040 7 | CHIP_FAMILY = rp2 8 | 9 | EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" 10 | 11 | CIRCUITPY__EVE = 1 12 | 13 | CIRCUITPY_CYW43 = 1 14 | CIRCUITPY_SSL = 1 15 | CIRCUITPY_SSL_MBEDTLS = 1 16 | CIRCUITPY_HASHLIB = 1 17 | CIRCUITPY_WEB_WORKFLOW = 1 18 | CIRCUITPY_MDNS = 1 19 | CIRCUITPY_SOCKETPOOL = 1 20 | CIRCUITPY_WIFI = 1 21 | 22 | CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 23 | # Must be accompanied by a linker script change 24 | CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' 25 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev1/pico-sdk-configboard.h: -------------------------------------------------------------------------------- 1 | // Put board-specific pico-sdk definitions here. This file must exist. 2 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev1/pins.c: -------------------------------------------------------------------------------- 1 | #include "shared-bindings/board/__init__.h" 2 | 3 | STATIC const mp_rom_map_elem_t board_module_globals_table[] = { 4 | CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS 5 | 6 | { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, 7 | { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, 8 | { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, 9 | { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, 10 | { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, 11 | { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, 12 | { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, 13 | { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, 14 | { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, 15 | { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, 16 | { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, 17 | { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, 18 | { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, 19 | { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, 20 | { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, 21 | { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, 22 | { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, 23 | { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, 24 | { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, 25 | { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, 26 | { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, 27 | { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, 28 | { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, 29 | { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, 30 | { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, 31 | { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, 32 | 33 | { MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO0) }, 34 | { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, 35 | 36 | { MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO1) }, 37 | { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, 38 | 39 | { MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO2) }, 40 | { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, 41 | 42 | { MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO3) }, 43 | { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, 44 | 45 | { MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO4) }, 46 | 47 | { MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO5) }, 48 | 49 | { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO6) }, 50 | 51 | { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO7) }, 52 | 53 | { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO8) }, 54 | 55 | { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO9) }, 56 | { MP_ROM_QSTR(MP_QSTR_CE0), MP_ROM_PTR(&pin_GPIO9) }, 57 | 58 | { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO10) }, 59 | { MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO10) }, 60 | 61 | { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO11) }, 62 | { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, 63 | 64 | { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO12) }, 65 | { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO12) }, 66 | 67 | { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO13) }, 68 | 69 | { MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO14) }, 70 | 71 | { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO15) }, 72 | 73 | { MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO16) }, 74 | { MP_ROM_QSTR(MP_QSTR_MISO1), MP_ROM_PTR(&pin_GPIO16) }, 75 | 76 | { MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO17) }, 77 | 78 | { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO18) }, 79 | { MP_ROM_QSTR(MP_QSTR_SCLK1), MP_ROM_PTR(&pin_GPIO18) }, 80 | 81 | { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO19) }, 82 | { MP_ROM_QSTR(MP_QSTR_MOSI1), MP_ROM_PTR(&pin_GPIO19) }, 83 | 84 | { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO20) }, 85 | 86 | { MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO21) }, 87 | 88 | { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO22) }, 89 | { MP_ROM_QSTR(MP_QSTR_CE1), MP_ROM_PTR(&pin_GPIO22) }, 90 | 91 | { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO26) }, 92 | 93 | { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO27) }, 94 | 95 | { MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO28) }, 96 | 97 | { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1) }, 98 | 99 | { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0) }, 100 | 101 | { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, 102 | 103 | { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, 104 | { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, 105 | 106 | { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, 107 | { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, 108 | 109 | { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, 110 | { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, 111 | 112 | { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, 113 | { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, 114 | 115 | { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, 116 | { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, 117 | }; 118 | MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); 119 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev2/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the MicroPython project, http://micropython.org/ 3 | * 4 | * The MIT License (MIT) 5 | * 6 | * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | #include "supervisor/board.h" 28 | 29 | // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. 30 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev2/link.ld: -------------------------------------------------------------------------------- 1 | firmware_size = 1532k; 2 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev2/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "PicoW Zero Base Rev2" 2 | #define MICROPY_HW_MCU_NAME "rp2040" 3 | 4 | #define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) 5 | #define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) 6 | 7 | #define MICROPY_HW_LED_STATUS (&pin_CYW0) 8 | 9 | #define CIRCUITPY_BOARD_I2C (1) 10 | #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO3, .sda = &pin_GPIO2}} 11 | 12 | #define DEFAULT_SPI_BUS_SCK (&pin_GPIO10) 13 | #define DEFAULT_SPI_BUS_MISO (&pin_GPIO12) 14 | #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) 15 | 16 | 17 | #define CIRCUITPY_BOARD_UART (1) 18 | #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO0, .rx = &pin_GPIO1}} 19 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev2/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | USB_VID = 0x239A 2 | USB_PID = 0x8120 3 | USB_PRODUCT = "Pico W" 4 | USB_MANUFACTURER = "Raspberry Pi" 5 | 6 | CHIP_VARIANT = RP2040 7 | CHIP_FAMILY = rp2 8 | 9 | EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" 10 | 11 | CIRCUITPY__EVE = 1 12 | 13 | CIRCUITPY_CYW43 = 1 14 | CIRCUITPY_SSL = 1 15 | CIRCUITPY_SSL_MBEDTLS = 1 16 | CIRCUITPY_HASHLIB = 1 17 | CIRCUITPY_WEB_WORKFLOW = 1 18 | CIRCUITPY_MDNS = 1 19 | CIRCUITPY_SOCKETPOOL = 1 20 | CIRCUITPY_WIFI = 1 21 | 22 | CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 23 | # Must be accompanied by a linker script change 24 | CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' 25 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev2/pico-sdk-configboard.h: -------------------------------------------------------------------------------- 1 | // Put board-specific pico-sdk definitions here. This file must exist. 2 | -------------------------------------------------------------------------------- /circuitpython/picow_zero_base_rev2/pins.c: -------------------------------------------------------------------------------- 1 | #include "shared-bindings/board/__init__.h" 2 | 3 | STATIC const mp_rom_map_elem_t board_module_globals_table[] = { 4 | CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS 5 | 6 | { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, 7 | { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, 8 | { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, 9 | { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, 10 | { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, 11 | { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, 12 | { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, 13 | { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, 14 | { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, 15 | { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, 16 | { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, 17 | { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, 18 | { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, 19 | { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, 20 | { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, 21 | { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, 22 | { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, 23 | { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, 24 | { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, 25 | { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, 26 | { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, 27 | { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, 28 | { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, 29 | { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, 30 | { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, 31 | { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, 32 | 33 | { MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO0) }, 34 | { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, 35 | 36 | { MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO1) }, 37 | { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, 38 | 39 | { MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO2) }, 40 | { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, 41 | 42 | { MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO3) }, 43 | { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, 44 | 45 | { MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO4) }, 46 | 47 | { MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO5) }, 48 | 49 | { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO6) }, 50 | 51 | { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO7) }, 52 | 53 | { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO8) }, 54 | 55 | { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO9) }, 56 | { MP_ROM_QSTR(MP_QSTR_CE0), MP_ROM_PTR(&pin_GPIO9) }, 57 | 58 | { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO10) }, 59 | { MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO10) }, 60 | 61 | { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO11) }, 62 | { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, 63 | 64 | { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO12) }, 65 | { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO12) }, 66 | 67 | { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO13) }, 68 | 69 | { MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO14) }, 70 | 71 | { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO15) }, 72 | 73 | { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO16) }, 74 | 75 | { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO17) }, 76 | 77 | { MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO18) }, 78 | 79 | { MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO19) }, 80 | 81 | { MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO20) }, 82 | 83 | { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO21) }, 84 | 85 | { MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO22) }, 86 | 87 | { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO26) }, 88 | { MP_ROM_QSTR(MP_QSTR_CE1), MP_ROM_PTR(&pin_GPIO26) }, 89 | 90 | { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO27) }, 91 | 92 | { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO28) }, 93 | 94 | { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1) }, 95 | 96 | { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0) }, 97 | 98 | { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, 99 | 100 | { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, 101 | { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, 102 | 103 | { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, 104 | { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, 105 | 106 | { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, 107 | { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, 108 | 109 | { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, 110 | { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, 111 | 112 | { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, 113 | { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, 114 | }; 115 | MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); 116 | -------------------------------------------------------------------------------- /examples/4letter_hat-led_shim.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/examples/4letter_hat-led_shim.jpg -------------------------------------------------------------------------------- /examples/4letter_phat/code.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | # from: http://github.com/adafruit/Adafruit_CircuitPython_HT16K33 4 | 5 | import time 6 | import board 7 | from adafruit_ht16k33 import segments 8 | 9 | # Create the display object. 10 | # Display connected to STEMMA QT connector. 11 | #display = segments.Seg14x4(board.STEMMA_I2C()) 12 | # Display connected to I2C pins. 13 | display = segments.Seg14x4(board.I2C()) # uses board.SCL and board.SDA 14 | 15 | # This section displays four 0's across the display. The code shows four 16 | # different ways to use the set_digit_raw function. Each is labeled below. 17 | # 16-bit Hexadecimal number 18 | display.set_digit_raw(0, 0x2D3F) 19 | time.sleep(0.2) 20 | # 16-bit Binary number 21 | display.set_digit_raw(1, 0b0010110100111111) 22 | time.sleep(0.2) 23 | # 8-bit Binary Tuple 24 | display.set_digit_raw(2, (0b00101101, 0b00111111)) 25 | time.sleep(0.2) 26 | # 8-bit Hexadecimal List 27 | display.set_digit_raw(3, [0x2D, 0x3F]) 28 | time.sleep(0.2) 29 | 30 | # Delay between. 31 | time.sleep(2) 32 | 33 | # Scroll "Hello, world!" across the display. Setting the loop parameter to false allows you to 34 | # tell the marquee function to run only once. By default, marquee loops indefinitely. 35 | display.marquee("Hello, world!", loop=False) 36 | 37 | # Delay between. 38 | time.sleep(2) 39 | 40 | # Scroll special characters, uppercase and lowercase letters, and numbers across 41 | # the display in a loop. This section will continue to run indefinitely. 42 | display.marquee("".join(chr(character) for character in range(ord("!"), ord("z") + 1))) 43 | -------------------------------------------------------------------------------- /examples/8086-i2c-multiplex-hat/code.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # Example program for the i2c-multiplexer-pHat from 8086net 3 | # (e.g. from Pimoroni, The PiHut, Tindie) 4 | # 5 | # Author: Bernhard Bablok 6 | # License: GPL3 7 | # 8 | # Website: https://github.com/bablokb/pcb-pico-pi-base 9 | # 10 | # ---------------------------------------------------------------------------- 11 | 12 | import time 13 | import board 14 | import busio 15 | import adafruit_tca9548a 16 | import adafruit_ahtx0 17 | 18 | #PIN_SCL = board.GP27 19 | #PIN_SDA = board.GP26 20 | PIN_SCL = board.SCL 21 | PIN_SDA = board.SDA 22 | 23 | i2c = busio.I2C(sda=PIN_SDA,scl=PIN_SCL) 24 | 25 | tca = adafruit_tca9548a.TCA9548A(i2c) 26 | 27 | sensors = [] 28 | sensors.append(adafruit_ahtx0.AHTx0(tca[0])) 29 | sensors.append(adafruit_ahtx0.AHTx0(tca[1])) 30 | 31 | while True: 32 | for i in range(len(sensors)): 33 | t = sensors[i].temperature 34 | h = sensors[i].relative_humidity 35 | print(f"sensor[{i}]: T: {t:0.1f}°C, H: {h:0.0f}%") 36 | time.sleep(5) 37 | -------------------------------------------------------------------------------- /examples/Readme.md: -------------------------------------------------------------------------------- 1 | Examples 2 | ======== 3 | 4 | Some example programs for various hats. Check the `lib`-directory for 5 | necessary (CircuitPython) drivers. 6 | 7 | All the drivers assume that the mapping is done by the board-module. 8 | E.g. the driver uses `board.GPIO24` and this is then mapped automatically 9 | to the correct `board.GPxx`. 10 | 11 | Some more examples are available here (for similar boards): 12 | 13 | 14 | 15 | Blinkt! 16 | ------- 17 | 18 | This is a row of 8 APA102-LEDs with a connector. Simple and easy for nice 19 | visual effects. It does not use I2C, but bit-banging with clock on GPIO24 20 | and data on GPIO23. Porting was easy, replacing RPi.GPIO with digitalio. 21 | 22 | ![](blinkt.jpg) 23 | 24 | 25 | Scroll pHat HD 26 | -------------- 27 | 28 | Pimoroni's Scroll pHAT HD (now a retired product). Should also work 29 | with the Scroll Hat Mini (). 30 | 31 | A hat with 11x7 (monochrome) LEDs. The example is from 32 | and 33 | uses the driver from that repo. 34 | 35 | ![](scroll-phat-hd.jpg) 36 | 37 | 38 | Touch pHat 39 | ---------- 40 | 41 | Pimoroni's Touch pHat . 42 | 43 | The driver for the pHat and the CAP1166 chip were ported from the 44 | Linux-version supplied by Pimoroni. 45 | 46 | 47 | 4-Letter pHat 48 | ------------- 49 | 50 | A 4x14 segment display pHat . 51 | 52 | ![](4letter_hat-led_shim.jpg) 53 | 54 | Works out of the box with . 55 | 56 | 57 | LED-Shim 58 | -------- 59 | 60 | Also from Pimoroni . You can see 61 | it above the 4-letter pHat in the image above. 62 | 63 | Same driver as the scroll pHat: . The example is from that repo too. 64 | 65 | 66 | Button-Shim 67 | ----------- 68 | 69 | A small pcb with five buttons and a RGB-LED from Pimoroni: 70 | . 71 | 72 | 73 | Pirate-Audio Speaker-Hat 74 | ------------------------ 75 | 76 | A hat from Pimoroni with a 240x240 display, four buttons, an audio DAC and 77 | a small speaker (). 78 | 79 | There are a few variants of this head available and all should work the same. 80 | 81 | Rev1-boards only support the display and the buttons. 82 | Rev2-boards also support audio. 83 | 84 | All components are directly supported with standard CircuitPython drivers. 85 | 86 | The hats have a major design flaw: they use the MISO-pin for the TFT-D/C, 87 | so you cannot use SPI-devices together with this hat, at least as long as 88 | you need MOSI. This really hurts, since this means you cannot read files 89 | from the SD-card. And it is absolutely unnessary to use this pin, since 90 | the Pi has so many other unused pins :-( 91 | 92 | 93 | Audio DAC Shim 94 | -------------- 95 | 96 | A solderless (more or less) shim with a 3.5mm line-out from Pimoroni 97 | . 98 | 99 | Needs a Rev2-board. Audio-support for I2S is built into CircuitPython, 100 | so no additional libs are necessary. 101 | 102 | 103 | Adafruit Speaker-Bonnet 104 | ----------------------- 105 | 106 | An audio hat with connectors for speakers, see 107 | . 108 | 109 | This bonnet uses I2S and works without any additional libraries. 110 | The example is from the guide 111 | . If you 112 | compare the many pages of install instructions necessary to get this 113 | working for a Pi you really love the simplicity of CircuitPython. 114 | 115 | 116 | Adafruit LoRa-Bonnet 117 | -------------------- 118 | 119 | A hat with a RFM9x-chip, three buttons and an I2C-OLED-display. 120 | . 121 | 122 | The example is an adaption of the code in the guide 123 | . 124 | 125 | 126 | Display-Otron-Hat 127 | ----------------- 128 | 129 | From Pimoroni: . 130 | 131 | The hat has a 3x16 character LCD with RGB backlight, six bar-graph 132 | LEDs and six touch-buttons. 133 | 134 | Fully supported, but the examples need some minor tweaks. 135 | 136 | 137 | InkyImpression 4.0" and 5.7" 138 | ---------------------------- 139 | 140 | These 7-color e-ink displays are from Pimoroni: 141 | 142 | 143 | It is the same display as used in the InkyFrame 5.7", which has a Pico-W 144 | attached. Main difference is that the latter also has a RTC and 145 | some sophisticated power-management circuit. 146 | 147 | The InkyImpression works out of the box with the SPD1656-driver from 148 | Adafruit . 149 | 150 | 151 | Inky wHAT 152 | --------- 153 | 154 | This is a 400x300 b&w e-ink display from Pimoroni (versions with an 155 | additional color are also available, but are untested): 156 | 157 | 158 | The driver is in `lib/what.py` and is a port of the (Linux-) Python-driver 159 | from Pimoroni. 160 | 161 | 162 | Inky pHAT 163 | --------- 164 | 165 | This is a 250x122 b&w e-ink display from Pimoroni (versions with an 166 | additional color are also available, but are untested): 167 | 168 | 169 | The driver is in `lib/phat.py` and is an adaption of the 170 | driver 171 | with input from the (Linux-) Python-driver of Pimoroni. 172 | 173 | 174 | Waveshare 4-inch RPi LCD (A) 175 | ---------------------------- 176 | 177 | This is a 480x320 LCD-display with a 26-pin connector. It uses 178 | the ILI4986-chip together with an XPT2046 for touch: 179 | . 180 | 181 | The display-driver needs a special hacked version of CircuitPython, the 182 | patch is included in the directory `lib/ili9486_waveshare_4in`. 183 | 184 | 185 | I2C-Multiplexer-pHat 186 | -------------------- 187 | 188 | This 8-bus I2C-multiplexer pHat from independent maker 8086.net is based 189 | on the TCA9548A and works with the TCA9548A-driver library from Adafruit 190 | . 191 | 192 | -------------------------------------------------------------------------------- /examples/audio-bonnet/code.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | """ 6 | CircuitPython I2S MP3 playback example. 7 | Plays a single MP3 once. 8 | 9 | See: https://learn.adafruit.com/circuitpython-essentials/circuitpython-mp3-audio 10 | https://learn.adafruit.com/mp3-playback-rp2040/pico-i2s-mp3 11 | """ 12 | import board 13 | import audiomp3 14 | import audiobusio 15 | 16 | # The speaker-bonnet uses pins GPIO18, GPIO19 and GPIO21 17 | # see https://learn.adafruit.com/adafruit-speaker-bonnet-for-raspberry-pi/pinouts 18 | 19 | audio = audiobusio.I2SOut(board.GPIO18, board.GPIO19, board.GPIO21) 20 | 21 | mp3 = audiomp3.MP3Decoder(open("slow.mp3", "rb")) 22 | 23 | audio.play(mp3) 24 | while audio.playing: 25 | pass 26 | 27 | print("Done playing!") 28 | -------------------------------------------------------------------------------- /examples/audio-bonnet/slow.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/examples/audio-bonnet/slow.mp3 -------------------------------------------------------------------------------- /examples/blinkt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/examples/blinkt.jpg -------------------------------------------------------------------------------- /examples/blinkt/code.py: -------------------------------------------------------------------------------- 1 | import math 2 | import time 3 | import colorsys 4 | 5 | import blinkt 6 | 7 | FALLOFF = 1.9 8 | SCAN_SPEED = 4 9 | 10 | i = 0 11 | while i<3: 12 | blinkt.set_all(255,0,0,0.1) 13 | blinkt.show() 14 | time.sleep(1) 15 | blinkt.set_all(0,255,0,0.1) 16 | blinkt.show() 17 | time.sleep(1) 18 | blinkt.set_all(0,0,255,0.1) 19 | blinkt.show() 20 | time.sleep(1) 21 | i += 1 22 | 23 | REDS = [0, 0, 0, 0, 0, 16, 64, 255, 64, 16, 0, 0, 0, 0, 0, 0] 24 | start_time = time.monotonic() 25 | i = 0 26 | while i < 32: 27 | # Triangle wave, a snappy ping-pong effect 28 | delta = (time.monotonic() - start_time) * 16 29 | offset = int(abs((delta % len(REDS)) - blinkt.NUM_PIXELS)) 30 | 31 | for pix in range(blinkt.NUM_PIXELS): 32 | blinkt.set_pixel(pix, REDS[offset + pix], 0, 0) 33 | blinkt.show() 34 | time.sleep(0.1) 35 | i += 1 36 | 37 | start_time = time.monotonic() 38 | while True: 39 | delta = (time.monotonic() - start_time) 40 | 41 | # Offset is a sine wave derived from the time delta 42 | # we use this to animate both the hue and larson scan 43 | # so they are kept in sync with each other 44 | offset = (math.sin(delta * SCAN_SPEED) + 1) / 2 45 | 46 | # Use offset to pick the right colour from the hue wheel 47 | hue = int(round(offset * 360)) 48 | 49 | # Maximum number basex on NUM_PIXELS 50 | max_val = blinkt.NUM_PIXELS - 1 51 | 52 | # Now we generate a value from 0 to max_val 53 | offset = int(round(offset * max_val)) 54 | 55 | for x in range(blinkt.NUM_PIXELS): 56 | sat = 1.0 57 | 58 | val = max_val - (abs(offset - x) * FALLOFF) 59 | val /= float(max_val) # Convert to 0.0 to 1.0 60 | val = max(val, 0.0) # Ditch negative values 61 | 62 | xhue = hue # Grab hue for this pixel 63 | xhue += (1 - val) * 10 # Use the val offset to give a slight colour trail variation 64 | xhue %= 360 # Clamp to 0-359 65 | xhue /= 360.0 # Convert to 0.0 to 1.0 66 | 67 | r, g, b = [int(c * 255) for c in colorsys.hsv_to_rgb(xhue, sat, val)] 68 | 69 | blinkt.set_pixel(x, r, g, b, val / 4) 70 | 71 | blinkt.show() 72 | 73 | time.sleep(0.001) 74 | -------------------------------------------------------------------------------- /examples/buttonshim/code.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # CircuitPython version of the example provided by Pimoroni. 3 | # (https://github.com/pimoroni/button-shim) 4 | # ---------------------------------------------------------------------------- 5 | 6 | import time 7 | import board 8 | import buttonshim 9 | 10 | print(""" 11 | Button SHIM: control-main.py 12 | 13 | Light up the LED a different color of the rainbow with each button pressed. 14 | """) 15 | 16 | shim = buttonshim.ButtonShim(i2c=board.I2C()) 17 | 18 | @shim.on_press(shim.BUTTON_A) 19 | def button_a(button, pressed): 20 | shim.set_pixel(0x94, 0x00, 0xd3) 21 | print(f"button {buttonshim.NAMES[button]}") 22 | 23 | @shim.on_press(shim.BUTTON_B) 24 | def button_b(button, pressed): 25 | shim.set_pixel(0x00, 0x00, 0xff) 26 | print(f"button {buttonshim.NAMES[button]}") 27 | 28 | @shim.on_press(shim.BUTTON_C) 29 | def button_c(button, pressed): 30 | shim.set_pixel(0x00, 0xff, 0x00) 31 | print(f"button {buttonshim.NAMES[button]}") 32 | 33 | @shim.on_press(shim.BUTTON_D) 34 | def button_d(button, pressed): 35 | shim.set_pixel(0xff, 0xff, 0x00) 36 | print(f"button {buttonshim.NAMES[button]}") 37 | 38 | @shim.on_press(shim.BUTTON_E) 39 | def button_e(button, pressed): 40 | shim.set_pixel(0xff, 0x00, 0x00) 41 | print(f"button {buttonshim.NAMES[button]}") 42 | 43 | while True: 44 | time.sleep(.1) 45 | shim.poll() 46 | -------------------------------------------------------------------------------- /examples/display-otron/backlight.py: -------------------------------------------------------------------------------- 1 | import math 2 | import time 3 | 4 | import dothat.backlight as backlight 5 | import dothat.lcd as lcd 6 | 7 | print(""" 8 | This example shows you a feature of the Dot HAT backlight. 9 | You should see a rainbow sweep across the whole display! 10 | 11 | Press CTRL+C to exit. 12 | """) 13 | 14 | lcd.set_cursor_position(0, 1) 15 | lcd.write(" Such Rainbow! ") 16 | 17 | x = 0 18 | 19 | while True: 20 | x += 1 21 | 22 | backlight.sweep((x % 360) / 360.0) 23 | backlight.set_graph(abs(math.sin(x / 100.0))) 24 | time.sleep(0.01) 25 | -------------------------------------------------------------------------------- /examples/display-otron/graph.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | import dothat.backlight as backlight 4 | import dothat.lcd as lcd 5 | 6 | print(""" 7 | This example shows you how to take individual control of the bar graph LEDs. 8 | You should see the bar graph LEDs count up in binary! 9 | 10 | Press CTRL+C to exit. 11 | """) 12 | 13 | # Each LED can be either on/off, 14 | # and brightness is controlled globally using: 15 | 16 | # * graph_set_led_duty(min, max) 17 | 18 | # When you don't need a bar graph, these LEDs could display 19 | # remaining lives in a game, the status of different processes, 20 | # the hour of the day in binary or anything else you might need! 21 | 22 | lcd.set_cursor_position(0, 1) 23 | lcd.write(" So Graph! ") 24 | 25 | # Reset the LED states and polarity 26 | backlight.graph_off() 27 | 28 | # Dim the LEDs by setting the max duty to 1 29 | backlight.graph_set_led_duty(0, 1) 30 | 31 | # Now run a binary counter on the LEDs 32 | while True: 33 | for x in range(64): 34 | for led in range(6): 35 | backlight.graph_set_led_state(led, x & (1 << led)) 36 | time.sleep(0.1) 37 | -------------------------------------------------------------------------------- /examples/display-otron/hello_world.py: -------------------------------------------------------------------------------- 1 | import dothat.lcd as lcd 2 | 3 | print(""" 4 | This example shows a basic "Hello World" on the LCD. 5 | You should see "Hello World" displayed on your LCD! 6 | 7 | Press CTRL+C to exit. 8 | """) 9 | 10 | # Clear the LCD and display Hello World 11 | lcd.clear() 12 | lcd.write("Hello World") 13 | -------------------------------------------------------------------------------- /examples/display-otron/ip_test.py: -------------------------------------------------------------------------------- 1 | import dothat.lcd as lcd 2 | from secrets import secrets 3 | import wifi 4 | 5 | # Clear the LCD 6 | lcd.clear() 7 | lcd.write(f"connecting to") 8 | lcd.set_cursor_position(column=0,row=1) 9 | lcd.write(f"{secrets.ssid}") 10 | 11 | # connect 12 | if not hasattr(secrets,'channel'): 13 | secrets.channel = 0 14 | if not hasattr(secrets,'timeout'): 15 | secrets.timeout = None 16 | 17 | try: 18 | wifi.radio.connect(secrets.ssid, 19 | secrets.password, 20 | channel = secrets.channel, 21 | timeout = secrets.timeout 22 | ) 23 | lcd.clear() 24 | lcd.write(f"connected") 25 | lcd.set_cursor_position(column=0,row=1) 26 | lcd.write(f"{wifi.radio.ipv4_address}") 27 | lcd.set_cursor_position(column=0,row=2) 28 | lcd.write(f"{wifi.radio.hostname}") 29 | except: 30 | lcd.clear() 31 | lcd.write(f"failed") 32 | -------------------------------------------------------------------------------- /examples/display-otron/off.py: -------------------------------------------------------------------------------- 1 | import dothat.backlight as backlight 2 | import dothat.lcd as lcd 3 | 4 | # Reset the LED states and polarity 5 | backlight.graph_off() 6 | 7 | # Empty the screen 8 | lcd.clear() 9 | 10 | # Turn off the backlight 11 | backlight.rgb(0, 0, 0) 12 | -------------------------------------------------------------------------------- /examples/display-otron/room.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | import dothat.backlight as backlight 4 | import dothat.lcd as lcd 5 | 6 | print(""" 7 | This is a really experimental example that doesn't do much! 8 | Do not adjust the horizontal, or the vertical! 9 | 10 | Press CTRL+C to exit. 11 | """) 12 | 13 | rain = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], 14 | [0, 0, 2, 0, 0, 0, 0, 0], [0, 0, 0, 2, 0, 0, 0, 0], 15 | [0, 0, 0, 0, 4, 0, 0, 0], [0, 0, 0, 0, 0, 4, 0, 0], 16 | [0, 0, 0, 0, 0, 0, 8, 0], [0, 0, 0, 0, 0, 0, 0, 16], 17 | [0, 0, 0, 0, 0, 0, 0, 0]] 18 | 19 | 20 | def get_anim_frame(char, fps): 21 | return char[int(round(time.time() * fps) % len(char))] 22 | 23 | 24 | backlight.graph_off() 25 | backlight.off() 26 | 27 | lcd.set_cursor_position(0, 0) 28 | lcd.write(chr(0) * 16) 29 | lcd.set_cursor_position(0, 1) 30 | lcd.write(chr(0) * 16) 31 | lcd.set_cursor_position(0, 2) 32 | lcd.write(chr(0) * 16) 33 | 34 | time.sleep(1) 35 | for x in range(0, 255, 5): 36 | backlight.single_rgb(3, x, x, x) 37 | 38 | while True: 39 | lcd.create_char(0, get_anim_frame(rain, 20)) 40 | time.sleep(0.1) 41 | -------------------------------------------------------------------------------- /examples/display-otron/touch.py: -------------------------------------------------------------------------------- 1 | import time 2 | import dothat.backlight as backlight 3 | import dothat.lcd as lcd 4 | import dothat.touch as nav 5 | 6 | print(""" 7 | This example shows the Display-o-Tron HAT touch inputs in action. 8 | Touch an input and you should see the LCD change accordingly. 9 | 10 | Press CTRL+C to exit. 11 | """) 12 | """ 13 | Captouch provides the @captouch.on() decorator 14 | to make it super easy to attach handlers to each button. 15 | 16 | It's also a drop-in replacement for joystick, with one exception: 17 | it has a "cancel" method. 18 | 19 | The handler will receive "channel" ( corresponding to a particular 20 | button ID ) and "event" ( corresponding to press/release ) arguments. 21 | """ 22 | 23 | 24 | @nav.on(nav.UP) 25 | def handle_up(ch, evt): 26 | print("Up pressed!") 27 | lcd.clear() 28 | backlight.rgb(255, 0, 0) 29 | lcd.write("Up up and away!") 30 | 31 | 32 | @nav.on(nav.DOWN) 33 | def handle_down(ch, evt): 34 | print("Down pressed!") 35 | lcd.clear() 36 | backlight.rgb(0, 255, 0) 37 | lcd.write("Down down doobie down!") 38 | 39 | 40 | @nav.on(nav.LEFT) 41 | def handle_left(ch, evt): 42 | print("Left pressed!") 43 | lcd.clear() 44 | backlight.rgb(0, 0, 255) 45 | lcd.write("Leftie left left!") 46 | 47 | 48 | @nav.on(nav.RIGHT) 49 | def handle_right(ch, evt): 50 | print("Right pressed!") 51 | lcd.clear() 52 | backlight.rgb(0, 255, 255) 53 | lcd.write("Rightie tighty!") 54 | 55 | 56 | @nav.on(nav.BUTTON) 57 | def handle_button(ch, evt): 58 | print("Button pressed!") 59 | lcd.clear() 60 | backlight.rgb(255, 255, 255) 61 | lcd.write("Ouch!") 62 | 63 | 64 | @nav.on(nav.CANCEL) 65 | def handle_cancel(ch, evt): 66 | print("Cancel pressed!") 67 | lcd.clear() 68 | backlight.rgb(0, 0, 0) 69 | lcd.write("Boom!") 70 | 71 | while True: 72 | nav.poll() 73 | time.sleep(0.2) 74 | -------------------------------------------------------------------------------- /examples/led_shim/code.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | 4 | import time 5 | import board 6 | import busio 7 | from adafruit_is31fl3731.led_shim import LedShim as Display 8 | 9 | i2c = busio.I2C(board.SCL, board.SDA) 10 | 11 | # initial display if you are using Pimoroni LED SHIM 12 | display = Display(i2c) 13 | 14 | # fmt: off 15 | # This list 28 colors from a rainbow... 16 | rainbow = [ 17 | (255, 0, 0), (255, 54, 0), (255, 109, 0), (255, 163, 0), 18 | (255, 218, 0), (236, 255, 0), (182, 255, 0), (127, 255, 0), 19 | (72, 255, 0), (18, 255, 0), (0, 255, 36), (0, 255, 91), 20 | (0, 255, 145), (0, 255, 200), (0, 255, 255), (0, 200, 255), 21 | (0, 145, 255), (0, 91, 255), (0, 36, 255), (18, 0, 255), 22 | (72, 0, 255), (127, 0, 255), (182, 0, 255), (236, 0, 255), 23 | (255, 0, 218), (255, 0, 163), (255, 0, 109), (255, 0, 54), 24 | ] 25 | # fmt: on 26 | 27 | 28 | for y in range(3): 29 | for x in range(28): 30 | display.pixel(x, y, 255) 31 | time.sleep(0.1) 32 | display.pixel(x, y, 0) 33 | 34 | while True: 35 | for offset in range(28): 36 | for x in range(28): 37 | r, g, b = rainbow[(x + offset) % 28] 38 | display.pixelrgb(x, r, g, b) 39 | -------------------------------------------------------------------------------- /examples/lora-bonnet/code.py: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # Sample LoRa code for a gateway on a Pico 3 | # 4 | # Adapted from: 5 | # 6 | # Adafruit IO LoRa Gateway 7 | # Learn Guide: https://learn.adafruit.com/multi-device-lora-temperature-network 8 | # by Brent Rubell for Adafruit Industries 9 | # SPDX-FileCopyrightText: 2019 Brent Rubell for Adafruit Industries 10 | # SPDX-License-Identifier: MIT 11 | # 12 | # Author: Bernhard Bablok 13 | # 14 | # Website: https://github.com/pcb-pico-pi-base 15 | #----------------------------------------------------------------------------- 16 | 17 | import time 18 | import busio 19 | import board 20 | from digitalio import DigitalInOut, Direction, Pull 21 | 22 | import busio 23 | import displayio 24 | from terminalio import FONT 25 | from adafruit_display_text import label 26 | from adafruit_displayio_ssd1306 import SSD1306 27 | 28 | import adafruit_rfm9x 29 | 30 | # --- constants ------------------------------------------------------------- 31 | 32 | INTERVAL = 2 33 | RADIO_FREQ_MHZ = 868.0 34 | LORA_STATION_ID = 0 35 | HEADER_TEXT = 'Datalogger Gateway' 36 | WAIT_TEXT = 'listening...' 37 | ERROR_TEXT = 'invalid data' 38 | 39 | # --- buttons (unused) ------------------------------------------------------ 40 | # Button A 41 | #btnA = DigitalInOut(board.GPIO5) 42 | #btnA.direction = Direction.INPUT 43 | #btnA.pull = Pull.UP 44 | 45 | # Button B 46 | #btnB = DigitalInOut(board.GPIO6) 47 | #btnB.direction = Direction.INPUT 48 | #btnB.pull = Pull.UP 49 | 50 | # Button C 51 | #btnC = DigitalInOut(board.GPIO12) 52 | #btnC.direction = Direction.INPUT 53 | #btnC.pull = Pull.UP 54 | 55 | # --- display -------------------------------------------------------------- 56 | 57 | displayio.release_displays() 58 | i2c = board.I2C() 59 | display_bus = displayio.I2CDisplay(i2c,device_address=0x3c) 60 | display = SSD1306(display_bus,width=128,height=32) 61 | 62 | group = displayio.Group() 63 | lbl = label.Label(FONT,text=HEADER_TEXT,color=0xFFFFFF,line_spacing=1.05, 64 | anchor_point=(0,0),x=0,y=4 65 | ) 66 | group.append(lbl) 67 | display.show(group) 68 | 69 | # --- LoRa ----------------------------------------------------------------- 70 | 71 | CS = DigitalInOut(board.CE1) 72 | RESET = DigitalInOut(board.GPIO25) 73 | spi = busio.SPI(board.SCLK, MOSI=board.MOSI, MISO=board.MISO) 74 | rfm9x = adafruit_rfm9x.RFM9x(spi, CS, RESET, RADIO_FREQ_MHZ) 75 | rfm9x.node = LORA_STATION_ID 76 | rfm9x.ack_delay = 0.1 77 | rfm9x.tx_power = 23 78 | 79 | # --- update display ------------------------------------------------------- 80 | 81 | def update_display(lines=[]): 82 | """ update display """ 83 | 84 | txt = f"{HEADER_TEXT}\n{lines[0]}" 85 | if len(lines) > 1: 86 | txt = f"{txt}\n{lines[1]}: {lines[2]}" 87 | lbl.text = txt 88 | 89 | # --- process data --------------------------------------------------------- 90 | 91 | def process_data(data): 92 | """ process data (e.g. send into the cloud) """ 93 | print(f"data: {data}") 94 | 95 | # --- main-loop ------------------------------------------------------------ 96 | 97 | update_display([WAIT_TEXT]) 98 | while True: 99 | packet = None 100 | 101 | # check for packet rx. Default timeout is 0.5 102 | packet = rfm9x.receive(with_ack=True,timeout=1.0) 103 | if packet is None: 104 | continue 105 | snr = rfm9x.last_snr 106 | rssi = rfm9x.last_rssi 107 | 108 | # Decode packet: assume it is csv with a timestamp as first field 109 | try: 110 | data = packet.decode() 111 | process_data(data) 112 | values = data.split(',') # expect csv 113 | ts = values[0].split('T')[1] # removes date from timestamp 114 | # Display packet information 115 | update_display([f"{ts} ({snr}/{rssi})",values[1],values[2]]) 116 | except: 117 | update_display([ERROR_TEXT]) 118 | time.sleep(INTERVAL) 119 | -------------------------------------------------------------------------------- /examples/pimoroni_phat/code.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------- 2 | # Testprogram for Pimoroni's pHat e-ink display. 3 | # 4 | # This program is an adaption of Adafruit's ssd1608_simpletest.py from 5 | # https://github.com/adafruit/Adafruit_CircuitPython_SSD1608 6 | # 7 | # Author: Bernhard Bablok 8 | # License: GPL3 9 | # 10 | # Website: https://github.com/bablokb/circuitpython-examples 11 | # 12 | # ------------------------------------------------------------------------- 13 | 14 | # pylint: disable=no-member 15 | 16 | import time 17 | import board 18 | import busio 19 | import displayio 20 | from phat import Inky_pHat 21 | 22 | print("starting program") 23 | time.sleep(5) 24 | 25 | print("releasing displays") 26 | displayio.release_displays() 27 | 28 | # pinout for Pimoroni pHat (Pi-names) 29 | 30 | SCK_PIN = board.GPIO11 31 | MOSI_PIN = board.GPIO10 32 | CS_PIN = board.CE0 33 | RST_PIN = board.GPIO27 34 | DC_PIN = board.GPIO22 35 | BUSY_PIN = board.GPIO17 36 | 37 | spi = busio.SPI(SCK_PIN,MOSI=MOSI_PIN) 38 | display_bus = displayio.FourWire( 39 | spi, command=DC_PIN, chip_select=CS_PIN, reset=RST_PIN, baudrate=488000 40 | ) 41 | display_bus.reset() 42 | 43 | print("creating display") 44 | display = Inky_pHat(display_bus, busy_pin=BUSY_PIN, rotation=90, 45 | border_color='white' 46 | ) 47 | 48 | print("creating root-group") 49 | g = displayio.Group() 50 | 51 | with open("/display-ruler.bmp", "rb") as f: 52 | pic = displayio.OnDiskBitmap(f) 53 | t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) 54 | print("appending image") 55 | g.append(t) 56 | 57 | print("starting show()") 58 | #display.root_group = g 59 | display.show(g) 60 | print("starting refresh()") 61 | display.refresh() 62 | print("finished") 63 | time.sleep(120) 64 | -------------------------------------------------------------------------------- /examples/pimoroni_phat/display-ruler.bmp: -------------------------------------------------------------------------------- 1 | ../pimoroni_what/display-ruler.bmp -------------------------------------------------------------------------------- /examples/pimoroni_what/display-ruler.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/examples/pimoroni_what/display-ruler.bmp -------------------------------------------------------------------------------- /examples/pimoroni_what/main.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------- 2 | # Testprogram for Pimoroni's wHat e-ink display. 3 | # 4 | # This program is an adaption of Adafruit's uc8151d_simpletest.py from 5 | # https://github.com/adafruit/Adafruit_CircuitPython_UC8151D 6 | # 7 | # Author: Bernhard Bablok 8 | # License: GPL3 9 | # 10 | # Website: https://github.com/bablokb/circuitpython-examples 11 | # 12 | # ------------------------------------------------------------------------- 13 | 14 | # pylint: disable=no-member 15 | 16 | import time 17 | import board 18 | import busio 19 | import displayio 20 | from what import Inky_wHat 21 | 22 | print("starting program") 23 | time.sleep(5) 24 | 25 | print("releasing displays") 26 | displayio.release_displays() 27 | 28 | # pinout for Pimoroni wHat (Pi-names) 29 | 30 | SCK_PIN = board.GPIO11 31 | MOSI_PIN = board.GPIO10 32 | CS_PIN = board.CE0 33 | RST_PIN = board.GPIO27 34 | DC_PIN = board.GPIO22 35 | BUSY_PIN = board.GPIO17 36 | 37 | spi = busio.SPI(SCK_PIN,MOSI=MOSI_PIN) 38 | display_bus = displayio.FourWire( 39 | spi, command=DC_PIN, chip_select=CS_PIN, reset=RST_PIN, baudrate=488000 40 | ) 41 | 42 | print("creating display") 43 | display = Inky_wHat(display_bus,busy_pin=BUSY_PIN,border_color='white', 44 | black_bits_inverted=True) 45 | 46 | print("creating root-group") 47 | g = displayio.Group() 48 | 49 | with open("/display-ruler.bmp", "rb") as f: 50 | pic = displayio.OnDiskBitmap(f) 51 | t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) 52 | print("appending image") 53 | g.append(t) 54 | 55 | print("starting show()") 56 | #display.root_group = g 57 | display.show(g) 58 | print("starting refresh()") 59 | display.refresh() 60 | print("finished") 61 | time.sleep(120) 62 | -------------------------------------------------------------------------------- /examples/pirate-audio/code.py: -------------------------------------------------------------------------------- 1 | # Test program for the Pirate Audio hat 2 | # 3 | # Based on: st7789_240x240_simpletest_Pimoroni_Pico_Explorer.py 4 | # from https://github.com/adafruit/adafruit_circuitpython_st7789 5 | # 6 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 7 | # SPDX-License-Identifier: MIT 8 | 9 | """ 10 | This test will initialize the display using displayio and draw a solid green 11 | background, a smaller purple rectangle, and some yellow text. 12 | 13 | In addition: support button-input and display the button-label 14 | """ 15 | 16 | import board 17 | import busio 18 | import time 19 | import terminalio 20 | import digitalio 21 | import displayio 22 | from adafruit_display_text import label 23 | from adafruit_st7789 import ST7789 24 | import audiomp3 25 | import audiobusio 26 | 27 | # The hat uses pins GPIO18, GPIO19 and GPIO21 28 | 29 | audio = audiobusio.I2SOut(board.GPIO18, board.GPIO19, board.GPIO21) 30 | mp3 = audiomp3.MP3Decoder(open("slow.mp3", "rb")) 31 | 32 | # Release any resources currently in use for the displays 33 | displayio.release_displays() 34 | 35 | tft_cs = board.GPIO7 # board.CE1 36 | tft_dc = board.GPIO9 # board.MISO -> reuse unused pin 37 | spi_mosi = board.GPIO10 # board.MOSI 38 | spi_clk = board.GPIO11 # board.SCLK 39 | 40 | spi = busio.SPI(spi_clk, spi_mosi) 41 | display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs) 42 | display = ST7789(display_bus, width=240, height=240, rowstart=80, rotation=180) 43 | 44 | # buttons 45 | 46 | btn_a = digitalio.DigitalInOut(board.GPIO5) 47 | btn_a.direction = digitalio.Direction.INPUT 48 | btn_a.pull = digitalio.Pull.UP 49 | 50 | btn_b = digitalio.DigitalInOut(board.GPIO6) 51 | btn_b.direction = digitalio.Direction.INPUT 52 | btn_b.pull = digitalio.Pull.UP 53 | 54 | btn_x = digitalio.DigitalInOut(board.GPIO16) 55 | btn_x.direction = digitalio.Direction.INPUT 56 | btn_x.pull = digitalio.Pull.UP 57 | 58 | btn_y = digitalio.DigitalInOut(board.GPIO20) # or GPIO24 on newer boards 59 | btn_y.direction = digitalio.Direction.INPUT 60 | btn_y.pull = digitalio.Pull.UP 61 | 62 | buttons = [(btn_a,'A'),(btn_b,'B'),(btn_x,'X'),(btn_y,'Y')] 63 | 64 | # Make the display context 65 | splash = displayio.Group() 66 | display.show(splash) 67 | 68 | color_bitmap = displayio.Bitmap(display.width,display.height, 1) 69 | color_palette = displayio.Palette(1) 70 | color_palette[0] = 0x00FF00 # Bright Green 71 | 72 | bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0) 73 | splash.append(bg_sprite) 74 | 75 | # Draw a smaller inner rectangle 76 | inner_bitmap = displayio.Bitmap(200, 200, 1) 77 | inner_palette = displayio.Palette(1) 78 | inner_palette[0] = 0xAA0088 # Purple 79 | inner_sprite = displayio.TileGrid(inner_bitmap, pixel_shader=inner_palette, x=20, y=20) 80 | splash.append(inner_sprite) 81 | 82 | # Draw a label 83 | text_group = displayio.Group(scale=2, x=50, y=120) 84 | text = "Hello World!" 85 | text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00) 86 | text_group.append(text_area) # Subgroup for text scaling 87 | splash.append(text_group) 88 | time.sleep(2) 89 | 90 | audio.play(mp3,loop=True) 91 | while audio.playing: 92 | for btn,label in buttons: 93 | if not btn.value: 94 | print(f"button {label} pressed") 95 | text_area.text = f"Button: {label}" 96 | time.sleep(0.1) 97 | -------------------------------------------------------------------------------- /examples/pirate-audio/slow.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/examples/pirate-audio/slow.mp3 -------------------------------------------------------------------------------- /examples/scroll-phat-hd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/examples/scroll-phat-hd.jpg -------------------------------------------------------------------------------- /examples/scrollphathd/code.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | 4 | import board 5 | import busio 6 | import adafruit_framebuf 7 | 8 | # uncomment next line if you are using Feather CharlieWing LED 15 x 7 9 | # from adafruit_is31fl3731.charlie_wing import CharlieWing as Display 10 | # uncomment next line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix 11 | # from adafruit_is31fl3731.matrix import Matrix as Display 12 | # uncomment next line if you are using Adafruit 16x8 Charlieplexed Bonnet 13 | # from adafruit_is31fl3731.charlie_bonnet import CharlieBonnet as Display 14 | 15 | # uncomment next line if you are using Pimoroni Scroll Phat HD LED 17 x 7 16 | from adafruit_is31fl3731.scroll_phat_hd import ScrollPhatHD as Display 17 | # uncomment next line if you are using Pimoroni 11x7 LED Matrix Breakout 18 | # from adafruit_is31fl3731.matrix_11x7 import Matrix11x7 as Display 19 | 20 | # uncomment this line if you use a Pico, here with SCL=GP21 and SDA=GP20. 21 | # i2c = busio.I2C(board.GP21, board.GP20) 22 | 23 | i2c = busio.I2C(board.SCL, board.SDA) 24 | 25 | display = Display(i2c) 26 | 27 | text_to_show = "Pico!!" 28 | 29 | # Create a framebuffer for our display 30 | buf = bytearray(32) # 2 bytes tall x 16 wide = 32 bytes (9 bits is 2 bytes) 31 | fb = adafruit_framebuf.FrameBuffer( 32 | buf, display.width, display.height, adafruit_framebuf.MVLSB 33 | ) 34 | 35 | 36 | frame = 0 # start with frame 0 37 | while True: 38 | for i in range(len(text_to_show) * 9): 39 | # for i in range(display.width,display.width+1): 40 | fb.fill(0) 41 | fb.text(text_to_show, -i + display.width, 0, color=1) 42 | 43 | # to improve the display flicker we can use two frame 44 | # fill the next frame with scrolling text, then 45 | # show it. 46 | display.frame(frame, show=False) 47 | # turn all LEDs off 48 | display.fill(0) 49 | for x in range(display.width): 50 | # using the FrameBuffer text result 51 | bite = buf[x] 52 | for y in range(display.height): 53 | bit = 1 << y & bite 54 | # if bit > 0 then set the pixel brightness 55 | if bit: 56 | display.pixel(x, y, 50) 57 | 58 | # now that the frame is filled, show it. 59 | display.frame(frame, show=True) 60 | frame = 0 if frame else 1 61 | -------------------------------------------------------------------------------- /examples/scrollphathd/font5x8.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/examples/scrollphathd/font5x8.bin -------------------------------------------------------------------------------- /examples/touchphat/code.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # Simple touchphat example adapted from file 3 | # examples/buttons.py from the source repo of the Linux driver 4 | # (https://github.com/pimoroni/touch-phat.git) 5 | # ---------------------------------------------------------------------------- 6 | 7 | import time 8 | import touchphat 9 | 10 | for pad in ['Back','A','B','C','D','Enter']: 11 | print(f"blinking: {pad}") 12 | touchphat.set_led(pad, True) 13 | time.sleep(1) 14 | touchphat.set_led(pad, False) 15 | time.sleep(1) 16 | 17 | @touchphat.on_touch(['Back','A','B','C','D','Enter']) 18 | def handle_touch(event): 19 | print(event.name) 20 | 21 | print("polling for touch-events...") 22 | while True: 23 | touchphat.poll() 24 | time.sleep(0.1) 25 | -------------------------------------------------------------------------------- /examples/waveshare-4in-display/code.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | 4 | """ 5 | This test will initialize the display using displayio and draw a solid green 6 | background, a smaller purple rectangle, and some yellow text. 7 | """ 8 | import board 9 | import time 10 | import terminalio 11 | import displayio 12 | import fourwire 13 | import busdisplay 14 | import busio 15 | from adafruit_display_text import label 16 | from ili9486_waveshare40 import ILI9486 17 | 18 | # Release any resources currently in use for the displays 19 | displayio.release_displays() 20 | 21 | # pins (Pi names) 22 | # PIN_SPI_CLK = board.SCLK 23 | # PIN_SPI_MOSI = board.MOSI 24 | # PIN_SPI_MISO = board.MISO 25 | 26 | # PIN_LCD_DC = board.GPIO24 27 | # PIN_LCD_CS = board.CE0 28 | # PIN_LCD_RST = board.GPIO25 29 | 30 | # PIN_TP_CS = board.CE1 31 | # PIN_TP_IRQ = board.GPIO17 32 | 33 | # pins (pico pins pico-zero-base) 34 | # PIN_SPI_CLK = board.GP10 35 | # PIN_SPI_MOSI = board.GP11 36 | 37 | # PIN_LCD_DC = board.GP27 38 | # PIN_LCD_CS = board.GP9 39 | # PIN_LCD_RST = board.GP26 40 | 41 | # pins (pico pins pico-pi-base) 42 | PIN_SPI_CLK = board.GP18 43 | PIN_SPI_MOSI = board.GP19 44 | 45 | PIN_LCD_DC = board.GP11 46 | PIN_LCD_CS = board.GP17 47 | PIN_LCD_RST = board.GP9 48 | 49 | 50 | spi = busio.SPI(clock=PIN_SPI_CLK,MOSI=PIN_SPI_MOSI) 51 | if spi.try_lock(): 52 | spi.configure(baudrate=20_000_000) 53 | spi.unlock() 54 | display_bus = fourwire.FourWire( 55 | spi, command=PIN_LCD_DC, chip_select=PIN_LCD_CS, reset=PIN_LCD_RST, 56 | ) 57 | display_bus.reset() 58 | time.sleep(0.005) 59 | 60 | display = ILI9486(display_bus, rotation=0) 61 | 62 | # Make the display context 63 | splash = displayio.Group() 64 | display.root_group = splash 65 | 66 | color_bitmap = displayio.Bitmap(display.width,display.height, 1) 67 | color_palette = displayio.Palette(1) 68 | color_palette[0] = 0x00FF00 # Bright Green 69 | 70 | bg_sprite = displayio.TileGrid(color_bitmap, 71 | pixel_shader=color_palette, x=0, y=0) 72 | splash.append(bg_sprite) 73 | 74 | # Draw a smaller inner rectangle 75 | inner_bitmap = displayio.Bitmap(280, 200, 1) 76 | inner_palette = displayio.Palette(1) 77 | inner_palette[0] = 0xAA0088 # Purple 78 | inner_sprite = displayio.TileGrid(inner_bitmap, 79 | pixel_shader=inner_palette, x=20, y=20) 80 | splash.append(inner_sprite) 81 | 82 | # Draw a label 83 | text_group = displayio.Group(scale=3, x=57, y=120) 84 | text = "Hello World!" 85 | text_area = label.Label(terminalio.FONT, text=text, color=0xFFFFFF) 86 | text_group.append(text_area) # Subgroup for text scaling 87 | splash.append(text_group) 88 | 89 | print("finished!") 90 | print("press CTRL-C") 91 | while True: 92 | time.sleep(1) 93 | -------------------------------------------------------------------------------- /lib/blinkt.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # CircuitPython version of the Linux-driver provided by Pimoroni. 3 | # (https://github.com/pimoroni/blinkt.git) 4 | # ---------------------------------------------------------------------------- 5 | 6 | """Library for the Pimoroni Blinkt! - 8-pixel APA102 LED display.""" 7 | 8 | # ported to CircuitPython 9 | 10 | import board 11 | import time 12 | import digitalio 13 | 14 | __version__ = '0.1.2' 15 | 16 | DAT = board.GPIO23 17 | CLK = board.GPIO24 18 | NUM_PIXELS = 8 19 | BRIGHTNESS = 7 20 | SLEEP_TIME = 0 21 | 22 | data_pin = digitalio.DigitalInOut(DAT) 23 | clk_pin = digitalio.DigitalInOut(CLK) 24 | data_pin.direction = digitalio.Direction.OUTPUT 25 | clk_pin.direction = digitalio.Direction.OUTPUT 26 | clk_pin.value = False 27 | 28 | pixels = [[0, 0, 0, BRIGHTNESS]] * NUM_PIXELS 29 | 30 | def set_brightness(brightness): 31 | """Set the brightness of all pixels. 32 | 33 | :param brightness: Brightness: 0.0 to 1.0 34 | 35 | """ 36 | if brightness < 0 or brightness > 1: 37 | raise ValueError('Brightness should be between 0.0 and 1.0') 38 | 39 | for x in range(NUM_PIXELS): 40 | pixels[x][3] = int(31.0 * brightness) & 0b11111 41 | 42 | 43 | def clear(): 44 | """Clear the pixel buffer.""" 45 | for x in range(NUM_PIXELS): 46 | pixels[x][0:3] = [0, 0, 0] 47 | 48 | 49 | def _write_byte(b): 50 | for _ in range(8): 51 | data_pin.value = b & 0x80 52 | clk_pin.value = True 53 | time.sleep(SLEEP_TIME) 54 | clk_pin.value = False 55 | time.sleep(SLEEP_TIME) 56 | b = b << 1 57 | 58 | # Emit exactly enough clock pulses to latch the small dark die APA102s which are weird 59 | # for some reason it takes 36 clocks, the other IC takes just 4 (number of pixels/2) 60 | def _eof(): 61 | data_pin.value = 0 62 | for x in range(36): 63 | clk_pin.value = True 64 | time.sleep(SLEEP_TIME) 65 | clk_pin.value = False 66 | time.sleep(SLEEP_TIME) 67 | 68 | def _sof(): 69 | data_pin.value = 0 70 | for x in range(32): 71 | clk_pin.value = True 72 | time.sleep(SLEEP_TIME) 73 | clk_pin.value = False 74 | time.sleep(SLEEP_TIME) 75 | 76 | def show(): 77 | """Output the buffer to Blinkt!.""" 78 | _sof() 79 | for pixel in pixels: 80 | r, g, b, brightness = pixel 81 | _write_byte(0b11100000 | brightness) 82 | _write_byte(b) 83 | _write_byte(g) 84 | _write_byte(r) 85 | _eof() 86 | 87 | def set_all(r, g, b, brightness=None): 88 | """Set the RGB value and optionally brightness of all pixels. 89 | 90 | If you don't supply a brightness value, the last value set for each pixel be kept. 91 | 92 | :param r: Amount of red: 0 to 255 93 | :param g: Amount of green: 0 to 255 94 | :param b: Amount of blue: 0 to 255 95 | :param brightness: Brightness: 0.0 to 1.0 (default around 0.2) 96 | 97 | """ 98 | for x in range(NUM_PIXELS): 99 | set_pixel(x, r, g, b, brightness) 100 | 101 | 102 | def get_pixel(x): 103 | """Get the RGB and brightness value of a specific pixel. 104 | 105 | :param x: The horizontal position of the pixel: 0 to 7 106 | 107 | """ 108 | r, g, b, brightness = pixels[x] 109 | brightness /= 31.0 110 | 111 | return r, g, b, round(brightness, 3) 112 | 113 | 114 | def set_pixel(x, r, g, b, brightness=None): 115 | """Set the RGB value, and optionally brightness, of a single pixel. 116 | 117 | If you don't supply a brightness value, the last value will be kept. 118 | 119 | :param x: The horizontal position of the pixel: 0 to 7 120 | :param r: Amount of red: 0 to 255 121 | :param g: Amount of green: 0 to 255 122 | :param b: Amount of blue: 0 to 255 123 | :param brightness: Brightness: 0.0 to 1.0 (default around 0.2) 124 | 125 | """ 126 | if brightness is None: 127 | brightness = pixels[x][3] 128 | else: 129 | brightness = int(31.0 * brightness) & 0b11111 130 | 131 | pixels[x] = [int(r) & 0xff, int(g) & 0xff, int(b) & 0xff, brightness] 132 | -------------------------------------------------------------------------------- /lib/buttonshim/__init__.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # CircuitPython version of the Linux-driver provided by Pimoroni. 3 | # (https://github.com/pimoroni/button-shim) 4 | # ---------------------------------------------------------------------------- 5 | 6 | import time 7 | import busio 8 | from adafruit_bus_device.i2c_device import I2CDevice 9 | 10 | DEFAULT_ADDR = 0x3f 11 | LED_DATA = 7 12 | LED_CLOCK = 6 13 | 14 | REG_INPUT = 0x00 15 | REG_OUTPUT = 0x01 16 | REG_POLARITY = 0x02 17 | REG_CONFIG = 0x03 18 | 19 | NUM_BUTTONS = 5 20 | 21 | NAMES = ['A', 'B', 'C', 'D', 'E'] 22 | """Sometimes you want to print the plain text name of the button that's triggered. 23 | 24 | You can use:: 25 | 26 | buttonshim.NAMES[button_index] 27 | 28 | To accomplish this. 29 | 30 | """ 31 | 32 | ERROR_LIMIT = 10 33 | 34 | FPS = 60 35 | 36 | LED_GAMMA = [ 37 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38 | 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 39 | 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 40 | 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 41 | 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 42 | 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 43 | 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 40, 44 | 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 45 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 46 | 71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 88, 89, 47 | 90, 91, 93, 94, 95, 96, 98, 99, 100, 102, 103, 104, 106, 107, 109, 110, 48 | 111, 113, 114, 116, 117, 119, 120, 121, 123, 124, 126, 128, 129, 131, 132, 134, 49 | 135, 137, 138, 140, 142, 143, 145, 146, 148, 150, 151, 153, 155, 157, 158, 160, 50 | 162, 163, 165, 167, 169, 170, 172, 174, 176, 178, 179, 181, 183, 185, 187, 189, 51 | 191, 193, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 52 | 222, 224, 227, 229, 231, 233, 235, 237, 239, 241, 244, 246, 248, 250, 252, 255] 53 | 54 | 55 | class Handler(): 56 | def __init__(self): 57 | self.press = None 58 | self.release = None 59 | self.t_pressed = 0 60 | self.t_repeat = 0 61 | 62 | _handlers = [Handler() for x in range(NUM_BUTTONS)] 63 | 64 | class ButtonShim(): 65 | BUTTON_A = 0 66 | """Button A""" 67 | BUTTON_B = 1 68 | """Button B""" 69 | BUTTON_C = 2 70 | """Button C""" 71 | BUTTON_D = 3 72 | """Button D""" 73 | BUTTON_E = 4 74 | """Button E""" 75 | def __init__(self, i2c, i2c_addr=DEFAULT_ADDR): 76 | self.i2c_addr = i2c_addr 77 | self.i2c_device = I2CDevice(i2c,i2c_addr) 78 | 79 | # The LED is an APA102 driven via the i2c IO expander. 80 | # We must set and clear the Clock and Data pins 81 | # Each byte in _reg_queue represents a snapshot of the pin state 82 | 83 | self._errors = 0 84 | self._led_data = [] 85 | self._brightness = 0.5 86 | self._states = 0b00011111 87 | self._last_states = 0b00011111 88 | 89 | self._write_byte(REG_CONFIG, 0b00011111) 90 | self._write_byte(REG_POLARITY, 0b00000000) 91 | self._write_byte(REG_OUTPUT, 0b00000000) 92 | 93 | self._handlers = [Handler() for x in range(NUM_BUTTONS)] 94 | self.set_pixel(0, 0, 0) 95 | 96 | def _write_byte(self, register, value): 97 | with self.i2c_device as i2c: 98 | i2c.write(bytes([register])+bytes([value])) 99 | 100 | def _write_block(self, register, data): 101 | with self.i2c_device as i2c: 102 | i2c.write(bytes([register])+data) 103 | 104 | def _read_byte(self, register): 105 | return self._read_block(register,1) 106 | 107 | def _read_block(self, register, length): 108 | result = bytearray(length) 109 | with self.i2c_device as i2c: 110 | i2c.write_then_readinto(bytes([register]), result) 111 | return result 112 | return None 113 | 114 | def _set_bit(self,pin,value): 115 | if value: 116 | self._led_data[-1] |= (1 << pin) 117 | else: 118 | self._led_data[-1] &= ~(1 << pin) 119 | 120 | def _next(self): 121 | if len(self._led_data) == 0: 122 | self._led_data = [0b00000000] 123 | else: 124 | self._led_data.append(self._led_data[-1]) 125 | 126 | def _write_byte_io(self,byte): 127 | for x in range(8): 128 | self._next() 129 | self._set_bit(LED_CLOCK, 0) 130 | self._set_bit(LED_DATA, byte & 0b10000000) 131 | self._next() 132 | self._set_bit(LED_CLOCK, 1) 133 | byte <<= 1 134 | 135 | def _update_led(self): 136 | """ update led-state """ 137 | try: 138 | if self._led_data: 139 | for i in range(0,len(self._led_data)+1,32): 140 | chunk = self._led_data[i:i+32] 141 | self._write_block(REG_OUTPUT,bytes(chunk)) 142 | except: 143 | raise 144 | self._errors += 1 145 | if self._errors > ERROR_LIMIT: 146 | raise RuntimeError(f"More than {ERROR_LIMIT} IO errors have occurred!") 147 | 148 | def set_brightness(self,brightness): 149 | if not isinstance(brightness, int) and not isinstance(brightness, float): 150 | raise ValueError("Brightness should be an int or float") 151 | if brightness < 0.0 or brightness > 1.0: 152 | raise ValueError("Brightness should be between 0.0 and 1.0") 153 | self._brightness = brightness 154 | 155 | def set_pixel(self,r,g,b): 156 | """Set the Button SHIM RGB pixel 157 | 158 | Display an RGB colour on the Button SHIM pixel. 159 | 160 | :param r: Amount of red, from 0 to 255 161 | :param g: Amount of green, from 0 to 255 162 | :param b: Amount of blue, from 0 to 255 163 | 164 | You can use HTML colours directly with hexadecimal notation in Python. EG:: 165 | 166 | buttonshim.set_pixel(0xFF, 0x00, 0xFF) 167 | 168 | """ 169 | 170 | if not isinstance(r, int) or r < 0 or r > 255: 171 | raise ValueError("Argument r should be an int from 0 to 255") 172 | if not isinstance(g, int) or g < 0 or g > 255: 173 | raise ValueError("Argument g should be an int from 0 to 255") 174 | if not isinstance(b, int) or b < 0 or b > 255: 175 | raise ValueError("Argument b should be an int from 0 to 255") 176 | 177 | r, g, b = [int(x * self._brightness) for x in (r, g, b)] 178 | 179 | self._write_byte_io(0) 180 | self._write_byte_io(0) 181 | self._write_byte_io(0b11101111) 182 | self._write_byte_io(LED_GAMMA[b & 0xff]) 183 | self._write_byte_io(LED_GAMMA[g & 0xff]) 184 | self._write_byte_io(LED_GAMMA[r & 0xff]) 185 | self._write_byte_io(0) 186 | self._write_byte_io(0) 187 | self._update_led() 188 | 189 | def poll(self): 190 | """ update state of LEDs and query state of buttons """ 191 | 192 | try: 193 | _states = self._read_byte(REG_INPUT)[0] 194 | except: 195 | self._errors += 1 196 | if self._errors > ERROR_LIMIT: 197 | raise RuntimeError(f"More than {ERROR_LIMIT} IO errors have occurred!") 198 | 199 | for x in range(NUM_BUTTONS): 200 | last = (self._last_states >> x) & 1 201 | curr = (_states >> x) & 1 202 | handler = self._handlers[x] 203 | 204 | # If last > curr then it's a transition from 1 to 0 205 | # since the buttons are active low, that's a press event 206 | if last > curr: 207 | handler.t_pressed = time.time() 208 | 209 | if callable(handler.press): 210 | handler.t_repeat = time.time() 211 | handler.press(x,True) 212 | continue 213 | 214 | if last < curr and callable(handler.release): 215 | handler.release(x,True) 216 | continue 217 | 218 | self._last_states = _states 219 | 220 | def on_hold(self,buttons, handler=None, hold_time=2): 221 | """Attach a hold handler to one or more buttons. 222 | 223 | This handler is fired when you hold a button for hold_time seconds. 224 | 225 | When fired it will run in its own Thread. 226 | 227 | It will be passed one argument, the button index:: 228 | 229 | @buttonshim.on_hold(buttonshim.BUTTON_A) 230 | def handler(button): 231 | # Your code here 232 | 233 | :param buttons: A single button, or a list of buttons 234 | :param handler: Optional: a function to bind as the handler 235 | :param hold_time: Optional: the hold time in seconds (default 2) 236 | 237 | """ 238 | 239 | if buttons is None: 240 | buttons = [BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D, BUTTON_E] 241 | 242 | if isinstance(buttons, int): 243 | buttons = [buttons] 244 | 245 | def attach_handler(handler): 246 | for button in buttons: 247 | self._handlers[button].hold = handler 248 | self._handlers[button].hold_time = hold_time 249 | 250 | if handler is not None: 251 | attach_handler(handler) 252 | else: 253 | return attach_handler 254 | 255 | def on_press(self,buttons, handler=None, repeat=False, repeat_time=0.5): 256 | """Attach a press handler to one or more buttons. 257 | This handler is fired when you press a button. 258 | When fired it will be run in its own Thread. 259 | It will be passed two arguments, the button index and a 260 | boolean indicating whether the button has been pressed/released:: 261 | @buttonshim.on_press(buttonshim.BUTTON_A) 262 | def handler(button, pressed): 263 | # Your code here 264 | :param buttons: A single button, or a list of buttons 265 | :param handler: Optional: a function to bind as the handler 266 | :param repeat: Optional: Repeat the handler if the button is held 267 | :param repeat_time: Optional: Time, in seconds, after which to repeat 268 | """ 269 | 270 | if buttons is None: 271 | buttons = [BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D, BUTTON_E] 272 | 273 | if isinstance(buttons, int): 274 | buttons = [buttons] 275 | 276 | def attach_handler(handler): 277 | for button in buttons: 278 | self._handlers[button].press = handler 279 | self._handlers[button].repeat = repeat 280 | self._handlers[button].repeat_time = repeat_time 281 | 282 | if handler is not None: 283 | attach_handler(handler) 284 | else: 285 | return attach_handler 286 | 287 | def on_release(self,buttons=None, handler=None): 288 | """Attach a release handler to one or more buttons. 289 | This handler is fired when you let go of a button. 290 | When fired it will be run in its own Thread. 291 | It will be passed two arguments, the button index and a 292 | boolean indicating whether the button has been pressed/released:: 293 | @buttonshim.on_release(buttonshim.BUTTON_A) 294 | def handler(button, pressed): 295 | # Your code here 296 | :param buttons: A single button, or a list of buttons 297 | :param handler: Optional: a function to bind as the handler 298 | """ 299 | 300 | if buttons is None: 301 | buttons = [BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D, BUTTON_E] 302 | 303 | if isinstance(buttons, int): 304 | buttons = [buttons] 305 | 306 | def attach_handler(handler): 307 | for button in buttons: 308 | self._handlers[button].release = handler 309 | 310 | if handler is not None: 311 | attach_handler(handler) 312 | else: 313 | return attach_handler 314 | -------------------------------------------------------------------------------- /lib/dothat/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = '2.0.3' 2 | 3 | -------------------------------------------------------------------------------- /lib/dothat/backlight.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # CircuitPython version of the Linux-driver provided by Pimoroni. 3 | # (https://github.com/pimoroni/displayotron.git) 4 | # ---------------------------------------------------------------------------- 5 | 6 | import board 7 | import colorsys 8 | from sn3218 import SN3218 9 | import cap1xxx 10 | 11 | cap = cap1xxx.Cap1166(board.I2C(),i2c_addr=0x2C, skip_init=True) 12 | 13 | NUM_LEDS = 6 14 | STEP_VALUE = 16 15 | 16 | leds = [0x00] * 18 # B G R, B G R, B G R, B G R, B G R, B G R 17 | 18 | # set gamma correction for backlight to normalise brightness 19 | g_channel_gamma = [int(value / 1.6) for value in SN3218.default_gamma_table] 20 | r_channel_gamma = [int(value / 1.4) for value in SN3218.default_gamma_table] 21 | 22 | sn3218 = SN3218(board.I2C()) 23 | 24 | for x in range(0, 18, 3): 25 | sn3218.channel_gamma(x + 1, g_channel_gamma) 26 | sn3218.channel_gamma(x + 2, r_channel_gamma) 27 | 28 | sn3218.enable() 29 | 30 | graph_set_led_state = cap.set_led_state 31 | graph_set_led_polarity = cap.set_led_polarity 32 | graph_set_led_duty = cap.set_led_direct_duty 33 | 34 | 35 | def use_rbg(): 36 | """Does nothing. 37 | 38 | Implemented for library compatibility with Dot3k backlight. 39 | 40 | """ 41 | pass 42 | 43 | 44 | def graph_off(): 45 | cap._write_byte(cap1xxx.R_LED_POLARITY, 0b00000000) 46 | cap._write_byte(cap1xxx.R_LED_OUTPUT_CON, 0b00000000) 47 | 48 | 49 | def set_graph(percentage): 50 | """Light a number of bargraph LEDs depending upon value 51 | 52 | :param hue: hue value between 0.0 and 1.0 53 | 54 | """ 55 | 56 | cap._write_byte(cap1xxx.R_LED_DIRECT_RAMP, 0b00000000) 57 | cap._write_byte(cap1xxx.R_LED_BEHAVIOUR_1, 0b00000000) 58 | cap._write_byte(cap1xxx.R_LED_BEHAVIOUR_2, 0b00000000) 59 | 60 | # The Cap 1xxx chips do *not* have full per-LED PWM 61 | # brightness control. However... 62 | # They have the ability to define what on/off actually 63 | # means, plus invert the state of any LED. 64 | 65 | total_value = STEP_VALUE * NUM_LEDS 66 | actual_value = int(total_value * percentage) 67 | set_polarity = 0b00000000 68 | set_state = 0b00000000 69 | set_duty = 0 # Value from 0 to 15 70 | for x in range(NUM_LEDS): 71 | if actual_value >= STEP_VALUE: 72 | set_polarity |= 1 << (NUM_LEDS - 1 - x) 73 | if 0 < actual_value < STEP_VALUE: 74 | set_state |= 1 << (NUM_LEDS - 1 - x) 75 | set_duty = actual_value << 4 76 | actual_value -= STEP_VALUE 77 | cap._write_byte(cap1xxx.R_LED_DIRECT_DUT, set_duty) 78 | cap._write_byte(cap1xxx.R_LED_POLARITY, set_polarity) 79 | cap._write_byte(cap1xxx.R_LED_OUTPUT_CON, set_state) 80 | 81 | 82 | def set(index, value): 83 | """Set a specific backlight LED to a value 84 | 85 | :param index (int): index of the LED from 0 to 17 86 | :param value (int): brightness value from 0 to 255 87 | 88 | """ 89 | 90 | index = index if isinstance(index, list) else [index] 91 | for i in index: 92 | leds[i] = value 93 | update() 94 | 95 | 96 | def set_bar(index, value): 97 | """Does nothing. 98 | 99 | Implemented for library compatibility with Dot3k backlight. 100 | 101 | """ 102 | pass 103 | 104 | 105 | def hue_to_rgb(hue): 106 | """Convert a hue to RGB brightness values 107 | 108 | :param hue: hue value between 0.0 and 1.0 109 | 110 | """ 111 | 112 | rgb = colorsys.hsv_to_rgb(hue, 1.0, 1.0) 113 | return list(rgb) 114 | 115 | def hue(hue): 116 | """Set the backlight LEDs to supplied hue 117 | 118 | :param hue: hue value between 0.0 and 1.0 119 | 120 | """ 121 | 122 | col_rgb = hue_to_rgb(hue) 123 | rgb(col_rgb[0], col_rgb[1], col_rgb[2]) 124 | 125 | 126 | def sweep(hue, sweep_range=0.0833): 127 | """Set the backlight LEDs to a gradient centered on supplied hue 128 | 129 | Supplying zero to range would be the same as hue() 130 | 131 | :param hue: hue value between 0.0 and 1.0 132 | :param range: range value to deviate the left and right hue 133 | 134 | """ 135 | 136 | global leds 137 | for x in range(0, 18, 3): 138 | rgb = hue_to_rgb((hue + (sweep_range * (x / 3))) % 1) 139 | rgb.reverse() 140 | leds[x:x + 3] = rgb 141 | update() 142 | 143 | 144 | def left_hue(hue): 145 | """Set the left backlight to supplied hue 146 | 147 | :param hue: hue value between 0.0 and 1.0 148 | 149 | """ 150 | 151 | col_rgb = hue_to_rgb(hue) 152 | left_rgb(col_rgb[0], col_rgb[1], col_rgb[2]) 153 | update() 154 | 155 | 156 | def mid_hue(hue): 157 | """Set the middle backlight to supplied hue 158 | 159 | :param hue: hue value between 0.0 and 1.0 160 | 161 | """ 162 | 163 | col_rgb = hue_to_rgb(hue) 164 | mid_rgb(col_rgb[0], col_rgb[1], col_rgb[2]) 165 | update() 166 | 167 | 168 | def right_hue(hue): 169 | """Set the right backlight to supplied hue 170 | 171 | :param hue: hue value between 0.0 and 1.0 172 | 173 | """ 174 | 175 | col_rgb = hue_to_rgb(hue) 176 | right_rgb(col_rgb[0], col_rgb[1], col_rgb[2]) 177 | update() 178 | 179 | 180 | def left_rgb(r, g, b): 181 | """Set the left backlight to supplied r, g, b colour 182 | 183 | :param r: red value between 0 and 255 184 | :param g: green value between 0 and 255 185 | :param b: blue value between 0 and 255 186 | 187 | """ 188 | 189 | single_rgb(0, r, g, b, False) 190 | single_rgb(1, r, g, b, False) 191 | update() 192 | 193 | 194 | def mid_rgb(r, g, b): 195 | """Set the middle backlight to supplied r, g, b colour 196 | 197 | :param r: red value between 0 and 255 198 | :param g: green value between 0 and 255 199 | :param b: blue value between 0 and 255 200 | 201 | """ 202 | 203 | single_rgb(2, r, g, b, False) 204 | single_rgb(3, r, g, b, False) 205 | update() 206 | 207 | 208 | def right_rgb(r, g, b): 209 | """Set the right backlight to supplied r, g, b colour 210 | 211 | :param r: red value between 0 and 255 212 | :param g: green value between 0 and 255 213 | :param b: blue value between 0 and 255 214 | 215 | """ 216 | 217 | single_rgb(4, r, g, b, False) 218 | single_rgb(5, r, g, b, False) 219 | update() 220 | 221 | 222 | def single_rgb(led, r, g, b, auto_update=True): 223 | """A single backlight LED to the supplied r, g, b colour 224 | 225 | The `auto_update` parameter will trigger a write to the LEDs 226 | after the r, g, b colour has been set. Omit it and manually 227 | call `update()` to batch multiple LED changes into one update. 228 | 229 | :param r: red value between 0 and 255 230 | :param g: green value between 0 and 255 231 | :param b: blue value between 0 and 255 232 | :param auto_update: autmatically update the LEDs 233 | 234 | """ 235 | 236 | global leds 237 | leds[(led * 3)] = b 238 | leds[(led * 3) + 1] = g 239 | leds[(led * 3) + 2] = r 240 | if auto_update: 241 | update() 242 | 243 | 244 | def rgb(r, g, b): 245 | """Set all backlights to supplied r, g, b colour 246 | 247 | :param r: red value between 0 and 255 248 | :param g: green value between 0 and 255 249 | :param b: blue value between 0 and 255 250 | 251 | """ 252 | 253 | global leds 254 | leds = [b, g, r] * 6 255 | update() 256 | 257 | 258 | def off(): 259 | """Turn off the backlight.""" 260 | 261 | rgb(0, 0, 0) 262 | 263 | 264 | def update(): 265 | """Update backlight with changes to the LED buffer""" 266 | global sn3218, leds 267 | sn3218.output(leds) 268 | -------------------------------------------------------------------------------- /lib/dothat/lcd.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # CircuitPython version of the Linux-driver provided by Pimoroni. 3 | # (https://github.com/pimoroni/displayotron.git) 4 | # ---------------------------------------------------------------------------- 5 | 6 | import board 7 | import st7036 8 | 9 | ROWS = 3 10 | COLS = 16 11 | 12 | lcd = st7036.st7036(cs_register=board.GPIO25, 13 | reset_pin=board.GPIO12) 14 | lcd.clear() 15 | 16 | def write(value): 17 | """Write a string to the current cursor position. 18 | 19 | :param value: The string to write 20 | """ 21 | 22 | lcd.write(value) 23 | 24 | 25 | def clear(): 26 | """Clear the display and reset the cursor.""" 27 | 28 | lcd.clear() 29 | 30 | 31 | def set_contrast(contrast): 32 | """Set the display contrast. 33 | 34 | Raises TypeError if contrast is not an int 35 | Raises ValueError if contrast is not in the range 0..0x3F 36 | 37 | :param contrast: contrast value 38 | 39 | """ 40 | 41 | lcd.set_contrast(contrast) 42 | 43 | 44 | def set_display_mode(enable=True, cursor=False, blink=False): 45 | """Set the cursor position in DRAM 46 | 47 | :param offset: DRAM offset to place cursor 48 | 49 | """ 50 | 51 | lcd.set_display_mode(enable, cursor, blink) 52 | 53 | 54 | def set_cursor_offset(offset): 55 | """Set the cursor position in DRAM 56 | 57 | Calculates the cursor offset based on a row and column offset. 58 | 59 | Raises ValueError if row and column are not within defined screen size 60 | 61 | :param column: column to move the cursor to 62 | :param row: row to move the cursor to 63 | 64 | """ 65 | 66 | lcd.set_cursor_offset(offset) 67 | 68 | 69 | def set_cursor_position(column, row): 70 | """Sets the cursor position in DRAM based on a row and column offset. 71 | 72 | Args: 73 | column (int): column to move the cursor to 74 | row (int): row to move the cursor to 75 | Raises: 76 | ValueError: if row and column are not within defined screen size 77 | """ 78 | lcd.set_cursor_position(column, row) 79 | 80 | 81 | def create_animation(anim_pos, anim_map, frame_rate): 82 | """Create an animation in a given custom character slot 83 | 84 | Each definition should be a list of 8 bytes describing the custom character for that frame, 85 | 86 | :param anim_pos: Character slot from 0 to 7 to store animation 87 | :param anim_map: A list of custom character definitions 88 | :param frame_rate: Speed of animation in frames-per-second 89 | 90 | """ 91 | 92 | lcd.create_animation(anim_pos, anim_map, frame_rate) 93 | 94 | 95 | def update_animations(): 96 | """Update animations onto the LCD 97 | 98 | Uses wall time to figure out which frame is current for 99 | each animation, and then updates the animations character 100 | slot to the contents of that frame. 101 | 102 | Only one frame, the current one, is ever stored on the LCD. 103 | 104 | """ 105 | 106 | lcd.update_animations() 107 | 108 | 109 | def create_char(char_pos, char_map): 110 | """Create a character in the LCD memory 111 | 112 | The st7036 has 8 slots for custom characters. 113 | 114 | A char is defined as a list of 8 integers with the 115 | upper 5 bits setting the state of each row of pixels. 116 | 117 | Note: These slots are also used for animations! 118 | 119 | :param char_pos: Char slot to use (0-7) 120 | :param char_map: List of 8 integers containing bitmap 121 | 122 | """ 123 | 124 | lcd.create_char(char_pos, char_map) 125 | -------------------------------------------------------------------------------- /lib/dothat/touch.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # CircuitPython version of the Linux-driver provided by Pimoroni. 3 | # (https://github.com/pimoroni/displayotron.git) 4 | # ---------------------------------------------------------------------------- 5 | 6 | import board 7 | from cap1xxx import Cap1166, PID_CAP1166 8 | 9 | I2C_ADDR = 0x2c 10 | 11 | UP = 1 12 | DOWN = 2 13 | LEFT = 3 14 | RIGHT = 5 15 | BUTTON = 4 16 | CANCEL = 0 17 | 18 | _cap1166 = Cap1166(board.I2C(),i2c_addr=I2C_ADDR) 19 | _cap1166._write_byte(0x26, 0b00111111) # Force recalibration 20 | 21 | for x in range(6): 22 | _cap1166.set_led_linking(x, False) 23 | 24 | def high_sensitivity(): 25 | """Switch to high sensitivity mode 26 | 27 | This predetermined high sensitivity mode is for using 28 | touch through 3mm perspex or similar materials. 29 | 30 | """ 31 | 32 | _cap1166._write_byte(0x00, 0b11000000) 33 | _cap1166._write_byte(0x1f, 0b00000000) 34 | 35 | def enable_repeat(enable): 36 | """Enable touch hold repeat 37 | 38 | If enable is true, repeat will be enabled. This will 39 | trigger new touch events at the set repeat_rate when 40 | a touch input is held. 41 | 42 | :param enable: enable/disable repeat: True/False 43 | 44 | """ 45 | 46 | if enable: 47 | _cap1166.enable_repeat(0b11111111) 48 | else: 49 | _cap1166.enable_repeat(0b00000000) 50 | 51 | def set_repeat_rate(rate): 52 | """Set hold repeat rate 53 | 54 | Repeat rate values are clamped to the nearest 35ms, 55 | values from 35 to 560 are valid. 56 | 57 | :param rate: time in ms from 35 to 560 58 | 59 | """ 60 | 61 | _cap1166.set_repeat_rate(rate) 62 | 63 | def on(buttons, bounce=-1): 64 | """Handle a press of one or more buttons 65 | 66 | Decorator. Use with @captouch.on(UP) 67 | 68 | :param buttons: List, or single instance of cap touch button constant 69 | :param bounce: Maintained for compatibility with Dot3k joystick, unused 70 | 71 | """ 72 | buttons = buttons if isinstance(buttons, list) else [buttons] 73 | 74 | def register(handler): 75 | for button in buttons: 76 | _cap1166.on(channel=button, event='press', handler=handler) 77 | _cap1166.on(channel=button, event='held', handler=handler) 78 | 79 | return register 80 | 81 | def poll(): 82 | _cap1166.poll() 83 | -------------------------------------------------------------------------------- /lib/ili9486_waveshare_4in/bus_core.c.patch: -------------------------------------------------------------------------------- 1 | diff --git a/shared-module/displayio/bus_core.c b/shared-module/displayio/bus_core.c 2 | index 301606c1f3..0b434ccd05 100644 3 | --- a/shared-module/displayio/bus_core.c 4 | +++ b/shared-module/displayio/bus_core.c 5 | @@ -145,12 +145,12 @@ void displayio_display_bus_set_region_to_update(displayio_display_bus_t *self, d 6 | 7 | // Set column. 8 | displayio_display_bus_begin_transaction(self); 9 | - uint8_t data[5]; 10 | + uint8_t data[9]; 11 | data[0] = self->column_command; 12 | uint8_t data_length = 1; 13 | display_byte_type_t data_type = DISPLAY_DATA; 14 | if (!self->data_as_commands) { 15 | - self->send(self->bus, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data, 1); 16 | + self->send(self->bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, data, 1); 17 | data_length = 0; 18 | } else { 19 | data_type = DISPLAY_COMMAND; 20 | @@ -164,9 +164,13 @@ void displayio_display_bus_set_region_to_update(displayio_display_bus_t *self, d 21 | x1 = __builtin_bswap16(x1); 22 | x2 = __builtin_bswap16(x2); 23 | } 24 | + data[data_length++] = 0; 25 | data[data_length++] = x1 >> 8; 26 | + data[data_length++] = 0; 27 | data[data_length++] = x1 & 0xff; 28 | + data[data_length++] = 0; 29 | data[data_length++] = x2 >> 8; 30 | + data[data_length++] = 0; 31 | data[data_length++] = x2 & 0xff; 32 | } 33 | 34 | @@ -196,7 +200,7 @@ void displayio_display_bus_set_region_to_update(displayio_display_bus_t *self, d 35 | data[0] = self->row_command; 36 | data_length = 1; 37 | if (!self->data_as_commands) { 38 | - self->send(self->bus, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data, 1); 39 | + self->send(self->bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, data, 1); 40 | data_length = 0; 41 | } 42 | 43 | @@ -208,9 +212,13 @@ void displayio_display_bus_set_region_to_update(displayio_display_bus_t *self, d 44 | y1 = __builtin_bswap16(y1); 45 | y2 = __builtin_bswap16(y2); 46 | } 47 | + data[data_length++] = 0; 48 | data[data_length++] = y1 >> 8; 49 | + data[data_length++] = 0; 50 | data[data_length++] = y1 & 0xff; 51 | + data[data_length++] = 0; 52 | data[data_length++] = y2 >> 8; 53 | + data[data_length++] = 0; 54 | data[data_length++] = y2 & 0xff; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /lib/ili9486_waveshare_4in/ili9486_waveshare40.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------- 2 | # CircuitPython driver for Waveshare 4in Pi-display. 3 | # 4 | # The display uses an ILI9486-chip. Waveshare attaches SPI on one side 5 | # to a 16-bit parallel bus on the ILI9486 with two SIPO shift-registers 6 | # in between. 7 | # 8 | # This setup is incompatible with any standard software-driver. The 9 | # driver here only works with a special hacked CircuitPython-version. 10 | # 11 | # Author: Bernhard Bablok 12 | # License: MIT 13 | # 14 | # Website: https://github.com/bablokb/circuitpython-examples 15 | # 16 | # ------------------------------------------------------------------------- 17 | 18 | try: 19 | # used for typing only 20 | from typing import Any 21 | except ImportError: 22 | pass 23 | 24 | import busdisplay 25 | 26 | # init-sequence (16-bit) for Waveshare 4in display 27 | # source: 28 | # https://github.com/swkim01/waveshare-dtoverlays/blob/master/waveshare35a.dts 29 | # note: this display also needs a special hacked version of CircuitPython 30 | 31 | _INIT_SEQUENCE_16 = ( 32 | b"\x11\x80\x78" # SLPOUT + 120ms delay 33 | b"\x3a\x02\x00\x55" # PIXFMT 34 | b"\xc2\x02\x00\x44" # VDVVRHEN 35 | b"\xc5\x08\x00\x00\x00\x00\x00\x00\x00\x00" # VCMOFSET 36 | b"\xe0\x1e\x00\x0f\x00\x1f\x00\x1c\x00\x0c\x00\x0f\x00\x08\x00\x48\x00\x98\x00\x37\x00\x0a\x00\x13\x00\x04\x00\x11\x00\x0d\x00\x00" 37 | b"\xe1\x1e\x00\x0f\x00\x32\x00\x2e\x00\x0b\x00\x0d\x00\x05\x00\x47\x00\x75\x00\x37\x00\x06\x00\x10\x00\x03\x00\x24\x00\x20\x00\x00" 38 | b"\xe2\x1e\x00\x0f\x00\x32\x00\x2e\x00\x0b\x00\x0d\x00\x05\x00\x47\x00\x75\x00\x37\x00\x06\x00\x10\x00\x03\x00\x24\x00\x20\x00\x00" 39 | b"\x29\x00" # DISPLAY_ON 40 | b"\x21\x00" # INVON 41 | b"\x36\x02\x00" # MADCTL, must be last 42 | ) 43 | 44 | _MADCTL = { 45 | 0: (480,320,b"\xe8"), 46 | 90: (320,480,b"\x48"), 47 | 180: (480,320,b"\x28"), 48 | 270: (320,480,b"\x88") 49 | } 50 | 51 | class ILI9486(busdisplay.BusDisplay): 52 | """ 53 | ILI9488 display driver 54 | 55 | :param displayio.FourWire bus: bus that the display is connected to 56 | """ 57 | 58 | def __init__(self, bus: displayio.FourWire, rotation=0, **kwargs: Any): 59 | # fix width,height and rotation 60 | # instead of CP rotating the content, we delegate it to the chip 61 | width,height,madctl = _MADCTL[rotation] 62 | super().__init__(bus, _INIT_SEQUENCE_16+madctl, 63 | width=width, 64 | height=height, 65 | rotation=0, 66 | **kwargs) 67 | -------------------------------------------------------------------------------- /lib/phat.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------- 2 | # CircuitPython driver for Pimoroni's pHat e-ink display. 3 | # 4 | # This has only been tested for the black&white variant, but should also 5 | # work for the color-versions of this display. 6 | # 7 | # Author: Bernhard Bablok 8 | # License: MIT 9 | # 10 | # This is an adaption of the Adadruit_CircuitPython_SSD1608 driver. 11 | # The original MIT-License is 12 | # Copyright (c) 2019 Scott Shawcroft for Adafruit Industries 13 | # 14 | # Website: https://github.com/bablokb/pcb-pico-pi-base 15 | # 16 | # ------------------------------------------------------------------------- 17 | 18 | import displayio 19 | 20 | _START_SEQUENCE = ( 21 | b"\x12\x00" # Software reset 22 | b"\x01\x03\xf9\x00\x00" # driver output control 23 | b"\x3a\x01\x1b" # Set dummy line period 24 | b"\x3b\x01\x0b" # Set gate line width 25 | b"\x11\x01\x03" # Data entry sequence 26 | b"\x2c\x01\x70" # Vcom Voltage 27 | b"\x32\x1e\x02\x02\x01\x11\x12\x12\x22\x22\x66\x69\x69\x59\x58\x99\x99\x88\x00\x00\x00\x00\xf8" 28 | b"\xb4\x13\x51\x35\x51\x51\x19\x01\x00" # LUT 29 | b"\x3c\x01\x00" # border color (black) 30 | ) 31 | 32 | _STOP_SEQUENCE = b"\x10\x01\x01" # Enter deep sleep 33 | 34 | 35 | class Inky_pHat(displayio.EPaperDisplay): 36 | """ Inky_pHat driver """ 37 | 38 | def __init__(self, bus: displayio.FourWire, 39 | color='black', border_color='black', 40 | **kwargs) -> None: 41 | start_sequence = bytearray(_START_SEQUENCE) 42 | if border_color == 'red': 43 | start_sequence[-1] = 0x06 44 | elif border_color == 'yellow': 45 | start_sequence[-1] = 0x0f 46 | elif border_color == 'white': 47 | start_sequence[-1] = 0x01 48 | 49 | super().__init__( 50 | bus, 51 | start_sequence, 52 | _STOP_SEQUENCE, 53 | **kwargs, 54 | width=250, 55 | height=122, 56 | ram_width=240, 57 | ram_height=320, 58 | colstart=12, 59 | set_column_window_command=0x44, 60 | set_row_window_command=0x45, 61 | set_current_column_command=0x4E, 62 | set_current_row_command=0x4F, 63 | write_black_ram_command=0x24, 64 | refresh_display_command=0x20, 65 | seconds_per_frame=6, 66 | ) 67 | -------------------------------------------------------------------------------- /lib/sn3218.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # CircuitPython version of the Linux-driver provided by Pimoroni. 3 | # (https://github.com/pimoroni/sn3218-python) 4 | # ---------------------------------------------------------------------------- 5 | 6 | import board 7 | import time 8 | import digitalio 9 | import busio 10 | from adafruit_bus_device.i2c_device import I2CDevice 11 | 12 | I2C_ADDRESS = 0x54 13 | CMD_ENABLE_OUTPUT = 0x00 14 | CMD_SET_PWM_VALUES = 0x01 15 | CMD_ENABLE_LEDS = 0x13 16 | CMD_UPDATE = 0x16 17 | CMD_RESET = 0x17 18 | 19 | class SN3218: 20 | default_gamma_table = [int(pow(255, float(i - 1) / 255)) for i in range(256)] 21 | 22 | def __init__(self,i2c,enable_mask=0b111111111111111111): 23 | 24 | self._i2c_device = I2CDevice(i2c,I2C_ADDRESS) 25 | 26 | # generate a good default gamma table 27 | self.channel_gamma_table = [SN3218.default_gamma_table for _ in range(18)] 28 | 29 | self.enable_leds(enable_mask) 30 | 31 | def _write_block(self, register, data): 32 | with self._i2c_device as i2c: 33 | i2c.write(bytes([register])+bytes(data)) 34 | 35 | def enable(self): 36 | """Enable output.""" 37 | self._write_block(CMD_ENABLE_OUTPUT, [0x01]) 38 | 39 | def disable(self): 40 | """Disable output.""" 41 | self._write_block(CMD_ENABLE_OUTPUT, [0x00]) 42 | 43 | def reset(self): 44 | """Reset all internal registers.""" 45 | self._write_block(CMD_RESET, [0xFF]) 46 | 47 | def enable_leds(self, enable_mask): 48 | """Enable or disable each LED channel. 49 | 50 | The first 18 bit values are 51 | used to determine the state of each channel (1=on, 0=off) if fewer 52 | than 18 bits are provided the remaining channels are turned off. 53 | 54 | Args: 55 | enable_mask (int): up to 18 bits of data 56 | Raises: 57 | TypeError: if enable_mask is not an integer. 58 | """ 59 | if not isinstance(enable_mask, int): 60 | raise TypeError("enable_mask must be an integer") 61 | 62 | self._write_block(CMD_ENABLE_LEDS, [ 63 | enable_mask & 0x3F, 64 | (enable_mask >> 6) & 0x3F, 65 | (enable_mask >> 12) & 0X3F]) 66 | self._write_block(CMD_UPDATE, [0xFF]) 67 | 68 | def channel_gamma(self, channel, gamma_table): 69 | """Override the gamma table for a single channel. 70 | 71 | Args: 72 | channel (int): channel number 73 | gamma_table (list): list of 256 gamma correction values 74 | Raises: 75 | TypeError: if channel is not an integer. 76 | ValueError: if channel is not in the range 0..17. 77 | TypeError: if gamma_table is not a list. 78 | """ 79 | if not isinstance(channel, int): 80 | raise TypeError("channel must be an integer") 81 | 82 | if channel not in range(18): 83 | raise ValueError("channel be an integer in the range 0..17") 84 | 85 | if not isinstance(gamma_table, list) or len(gamma_table) != 256: 86 | raise TypeError("gamma_table must be a list of 256 integers") 87 | 88 | self.channel_gamma_table[channel] = gamma_table 89 | 90 | def output(self, values): 91 | """Output a new set of values to the driver. 92 | 93 | Args: 94 | values (list): channel number 95 | Raises: 96 | TypeError: if values is not a list of 18 integers. 97 | """ 98 | if not isinstance(values, list) or len(values) != 18: 99 | raise TypeError("values must be a list of 18 integers") 100 | 101 | self._write_block(CMD_SET_PWM_VALUES, 102 | [self.channel_gamma_table[i][values[i]] for i in range(18)]) 103 | self._write_block(CMD_UPDATE, [0xFF]) 104 | 105 | def output_raw(self, values): 106 | """Output a new set of values to the driver. 107 | 108 | Similar to output(), but does not use channel_gamma_table. 109 | 110 | Args: 111 | values (list): channel number 112 | Raises: 113 | TypeError: if values is not a list of 18 integers. 114 | """ 115 | if len(values) != 18: 116 | raise TypeError("values must be a list of 18 integers") 117 | 118 | self._write_block(CMD_SET_PWM_VALUES, values) 119 | self._write_block(CMD_UPDATE, [0xFF]) 120 | 121 | -------------------------------------------------------------------------------- /lib/st7036.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # CircuitPython version of the Linux-driver provided by Pimoroni. 3 | # (https://github.com/pimoroni/st7036) 4 | # ---------------------------------------------------------------------------- 5 | 6 | import time 7 | 8 | import board 9 | import time 10 | import busio 11 | import digitalio 12 | from adafruit_bus_device.spi_device import SPIDevice 13 | 14 | __version__ = '1.4.4' 15 | 16 | COMMAND_CLEAR = 0b00000001 17 | COMMAND_HOME = 0b00000010 18 | COMMAND_SCROLL = 0b00010000 19 | COMMAND_DOUBLE = 0b00010000 20 | COMMAND_BIAS = 0b00010100 21 | COMMAND_SET_DISPLAY_MODE = 0b00001000 22 | 23 | BLINK_ON = 0b00000001 24 | CURSOR_ON = 0b00000010 25 | DISPLAY_ON = 0b00000100 26 | TOP = 1 27 | BOTTOM = 0 28 | 29 | class st7036(): 30 | def __init__(self, 31 | cs_register, 32 | reset_pin=None, 33 | rows=3, 34 | columns=16, 35 | cs_spi=board.CE0, 36 | instruction_set_template=0b00111000): 37 | 38 | self._reset_pin = None 39 | if reset_pin is not None: 40 | self._reset_pin = digitalio.DigitalInOut(reset_pin) 41 | self._reset_pin.direction = digitalio.Direction.OUTPUT 42 | self.reset() 43 | 44 | self.row_offsets = ([0x00], [0x00, 0x40], [0x00, 0x10, 0x20])[rows - 1] 45 | self.rows = rows 46 | self.columns = columns 47 | 48 | self._cs_spi = digitalio.DigitalInOut(cs_spi) 49 | self._cs_spi.direction = digitalio.Direction.OUTPUT 50 | 51 | spi = busio.SPI(board.SCLK,board.MOSI,board.MISO) 52 | self._spi = SPIDevice(spi,self._cs_spi) 53 | 54 | self._cs_register = digitalio.DigitalInOut(cs_register) 55 | self._cs_register.direction = digitalio.Direction.OUTPUT 56 | 57 | self.instruction_set_template = instruction_set_template 58 | 59 | self._enabled = True 60 | self._cursor_enabled = False 61 | self._cursor_blink = False 62 | self._double_height = 0 63 | 64 | self.animations = [None] * 8 65 | 66 | self.update_display_mode() 67 | 68 | # set entry mode (no shift, cursor direction) 69 | self._write_command(0b00000100 | 0b00000010) 70 | 71 | self.set_bias(1) 72 | 73 | self.set_contrast(40) 74 | self.clear() 75 | 76 | def reset(self): 77 | if self._reset_pin is not None: 78 | self._reset_pin.value = False 79 | time.sleep(0.001) 80 | self._reset_pin.value = True 81 | 82 | def set_bias(self, bias=1): 83 | self._write_command(COMMAND_BIAS | (bias << 4) | 1, 1) 84 | 85 | def set_contrast(self, contrast): 86 | """ 87 | Sets the display contrast. 88 | 89 | Args: 90 | contrast (int): contrast value 91 | Raises: 92 | TypeError: if contrast is not an int 93 | ValueError: if contrast is not in the range 0..0x3F 94 | """ 95 | if type(contrast) is not int: 96 | raise TypeError("contrast must be an integer") 97 | 98 | if contrast not in range(0, 0x40): 99 | raise ValueError("contrast must be an integer in the range 0..0x3F") 100 | 101 | # For 3.3v operation the booster must be on, which is 102 | # on the same command as the (2-bit) high-nibble of contrast 103 | self._write_command((0b01010100 | ((contrast >> 4) & 0x03)), 1) 104 | self._write_command(0b01101011, 1) 105 | 106 | # Set low-nibble of the contrast 107 | self._write_command((0b01110000 | (contrast & 0x0F)), 1) 108 | 109 | def set_display_mode(self, enable=True, cursor=False, blink=False): 110 | """ 111 | Sets the display mode. 112 | 113 | Args: 114 | enable (boolean): enable display output 115 | cursor (boolean): show cursor 116 | blink (boolean): blink cursor (if shown) 117 | """ 118 | self._enabled = enable 119 | self._cursor_enabled = cursor 120 | self._cursor_blink = blink 121 | self.update_display_mode() 122 | 123 | def update_display_mode(self): 124 | mask = COMMAND_SET_DISPLAY_MODE 125 | mask |= DISPLAY_ON if self._enabled else 0 126 | mask |= CURSOR_ON if self._cursor_enabled else 0 127 | mask |= BLINK_ON if self._cursor_blink else 0 128 | self._write_command(mask) 129 | 130 | def enable_cursor(self, cursor=False): 131 | self._cursor_enabled = cursor 132 | self.update_display_mode() 133 | 134 | def enable_blink(self, blink=False): 135 | self._cursor_blink = blink 136 | self.update_display_mode() 137 | 138 | def set_cursor_offset(self, offset): 139 | """ 140 | Sets the cursor position in DRAM 141 | 142 | Args: 143 | offset (int): DRAM offset to place cursor 144 | """ 145 | self._write_command(0b10000000 | offset) 146 | 147 | def set_cursor_position(self, column, row): 148 | """ 149 | Sets the cursor position in DRAM based on 150 | a row and column offset 151 | 152 | Args: 153 | column (int): column to move the cursor to 154 | row (int): row to move the cursor to 155 | Raises: 156 | ValueError: if row and column are not within defined screen size 157 | """ 158 | if row not in range(self.rows) or column not in range(self.columns): 159 | raise ValueError("row and column must integers within the defined screen size") 160 | 161 | offset = self.row_offsets[row] + column 162 | 163 | self._write_command(0b10000000 | offset) 164 | 165 | time.sleep(0.0015) # Allow at least 1.08ms for command to execute 166 | 167 | def home(self): 168 | """ 169 | Sets the cursor position to 0,0 170 | """ 171 | self.set_cursor_position(0, 0) 172 | 173 | def clear(self): 174 | """ 175 | Clears the display and resets the cursor. 176 | """ 177 | self._write_command(COMMAND_CLEAR) 178 | time.sleep(0.0015) # Allow at least 1.08ms for clear command to execute 179 | self.home() 180 | 181 | def write(self, value): 182 | """ 183 | Write a string to the current cursor position. 184 | 185 | Args: 186 | value (string): The string to write 187 | """ 188 | self._cs_register.value = 1 189 | for i in [ord(char) for char in value]: 190 | self._write_spi([i]) 191 | time.sleep(0.00005) 192 | 193 | def create_animation(self, anim_pos, anim_map, frame_rate): 194 | """Creates an animation in a given custom character slot 195 | 196 | Args: 197 | anim_pos (int): Character slot from 0 to 7 where current animation frame should be store on LCD 198 | anim_map: A list of custom character definitions. Each definition should be a list of 8 bytes describing the custom character for that frame, 199 | frame_rate: Speed of animation in frames-per-second 200 | """ 201 | if anim_pos >= len(self.animations): 202 | raise ValueError("Valid animation positions are 0 to 7") 203 | 204 | if type(anim_map) is not list: 205 | raise ValueError("Animation map should be a list of animation frames") 206 | 207 | if type(anim_map[0]) is not list or len(anim_map[0]) < 8: 208 | raise ValueError("Animation frames should be lists of 8 bytes") 209 | 210 | self.create_char(anim_pos, anim_map[0]) 211 | self.animations[anim_pos] = [anim_map, frame_rate] 212 | 213 | def update_animations(self): 214 | for i, animation in enumerate(self.animations): 215 | if animation is not None and len(animation) == 2: 216 | anim = animation[0] 217 | fps = animation[1] 218 | frame = anim[int(round(time.time() * fps) % len(anim))] 219 | self.create_char(i, frame) 220 | 221 | def create_char(self, char_pos, char_map): 222 | if char_pos < 0 or char_pos > 7: 223 | return False 224 | 225 | baseAddress = char_pos * 8 226 | for i in range(0, 8): 227 | self._write_command((0x40 | (baseAddress + i))) 228 | self._write_char(char_map[i]) 229 | 230 | self.home() 231 | 232 | def cursor_left(self): 233 | self._write_command(COMMAND_SCROLL, 0) 234 | 235 | def cursor_right(self): 236 | self._write_command(COMMAND_SCROLL | (1 << 2), 0) 237 | 238 | def shift_left(self): 239 | self._write_command(COMMAND_SCROLL | (1 << 3), 0) # 0x18 240 | 241 | def shift_right(self): 242 | self._write_command(COMMAND_SCROLL | (1 << 3) | (1 << 2), 0) # 0x1C 243 | 244 | def double_height(self, enable=0, position=1): 245 | self._double_height = enable 246 | #self._write_instruction_set(0) # ??! 247 | self._write_command(COMMAND_DOUBLE | (position << 3), 2) 248 | 249 | def _write_char(self, value): 250 | self._cs_register.value = 1 251 | self._write_spi([value]) 252 | time.sleep(0.0001) 253 | 254 | def _write_instruction_set(self, instruction_set=0): 255 | self._cs_register.value = 0 256 | self._write_spi([self.instruction_set_template | instruction_set | (self._double_height << 2)]) 257 | time.sleep(0.00006) 258 | 259 | def _write_command(self, value, instruction_set=0): 260 | self._cs_register.value = 0 261 | # select correct instruction set 262 | self._write_instruction_set(instruction_set) 263 | # switch to command-mode 264 | self._write_spi([value]) 265 | time.sleep(0.00006) 266 | 267 | def _write_spi(self,value): 268 | with self._spi as spi: 269 | spi.write(bytes(value)) 270 | -------------------------------------------------------------------------------- /lib/touchphat/__init__.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # CircuitPython version of the Linux-driver provided by Pimoroni. 3 | # (https://github.com/pimoroni/touch-phat.git) 4 | # ---------------------------------------------------------------------------- 5 | 6 | import board 7 | import cap1xxx 8 | 9 | 10 | __version__ = '0.0.2' 11 | 12 | 13 | captouch = None 14 | auto_leds = True 15 | 16 | PADS = list(range(1, 7)) 17 | NAMES = ['Back', 'A', 'B', 'C', 'D', 'Enter'] 18 | LEDMAP = [5, 4, 3, 2, 1, 0] 19 | NUMMAP = [1, 2, 3, 4, 5, 6] 20 | 21 | _on_press = [None] * 6 22 | _on_release = [None] * 6 23 | _is_setup = False 24 | 25 | 26 | def on_touch(pad, handler=None): 27 | """Register a function to be called when a pad or pads are hit. 28 | 29 | The function should expect one argument: event. You can look at event.pad to determine which pad was hit. 30 | 31 | :param pad: A single integer 1 to 6, a pad name (Back, A, B, C, D, Enter), or a list 32 | :param handler: The handler function to call on hit 33 | """ 34 | global _on_press 35 | 36 | setup() 37 | 38 | if handler is None: 39 | def decorate(handler): 40 | global _on_press 41 | _bind_handler(_on_press, pad, handler) 42 | 43 | return decorate 44 | 45 | _bind_handler(_on_press, pad, handler) 46 | 47 | 48 | def on_release(pad, handler=None): 49 | """Register a function to be called when a pad or pads are released. 50 | 51 | The function should expect one argument: event. You can look at event.pad to determine which pad was released. 52 | 53 | :param pad: A single integer from 1 to 6, a pad name (Back, A, B, C, D, Enter), or a list 54 | :param handler: The handler function to call on release 55 | """ 56 | global _on_release 57 | 58 | setup() 59 | 60 | if handler is None: 61 | def decorate(handler): 62 | global _on_release 63 | _bind_handler(_on_release, pad, handler) 64 | 65 | return decorate 66 | 67 | _bind_handler(_on_release, pad, handler) 68 | 69 | 70 | def _bind_handler(target, pad, handler): 71 | if type(pad) == list: 72 | for p in pad: 73 | channel = _pad_to_channel(p) 74 | target[channel] = handler 75 | else: 76 | channel = _pad_to_channel(pad) 77 | target[channel] = handler 78 | 79 | 80 | def _pad_to_channel(pad): 81 | try: 82 | if type(pad) == str: 83 | return NAMES.index(pad) 84 | else: 85 | return NUMMAP.index(pad) 86 | 87 | except ValueError: 88 | raise ValueError("Invalid touch pad {}. Should be one of \"{}\" or \"{}\"".format(pad, ', '.join(NAMES), ', '.join(str(x) for x in NUMMAP))) 89 | 90 | 91 | def _handle_press(event): 92 | global _on_press 93 | channel = event.channel 94 | event.name = NAMES[channel] 95 | event.pad = NUMMAP[channel] 96 | 97 | if auto_leds: 98 | captouch.set_led_state(LEDMAP[channel], True) 99 | 100 | if callable(_on_press[channel]): 101 | try: 102 | _on_press[channel](event) 103 | except TypeError: 104 | _on_press[channel]() 105 | 106 | 107 | def _handle_release(event): 108 | global _on_release 109 | channel = event.channel 110 | event.name = NAMES[channel] 111 | event.pad = NUMMAP[channel] 112 | 113 | if auto_leds: 114 | captouch.set_led_state(LEDMAP[channel], False) 115 | 116 | if callable(_on_release[channel]): 117 | try: 118 | _on_release[channel](event) 119 | except TypeError: 120 | _on_release[channel]() 121 | 122 | 123 | def led_on(pad): 124 | """Turn on an LED corresponding to a single pad. 125 | 126 | :param pad: A single integer from 1 to 6 or a pad name (Back, A, B, C, D, Enter), corresponding to the pad whose LED you want to turn on. 127 | 128 | """ 129 | 130 | set_led(pad, True) 131 | 132 | 133 | def all_off(): 134 | """Turn off all LEDs""" 135 | 136 | for pad in PADS: 137 | led_off(pad) 138 | 139 | 140 | def all_on(): 141 | """Turn on all LEDs""" 142 | 143 | for pad in PADS: 144 | led_on(pad) 145 | 146 | 147 | def led_off(pad): 148 | """Turn off an LED corresponding to a single pad. 149 | 150 | :param pad: A single integer from 1 to 6 or a pad name (Back, A, B, C, D, Enter), corresponding to the pad whose LED you want to turn off. 151 | 152 | """ 153 | 154 | set_led(pad, False) 155 | 156 | 157 | def set_led(pad, value): 158 | setup() 159 | idx = _pad_to_channel(pad) 160 | led = LEDMAP[idx] 161 | captouch.set_led_state(led, value) 162 | 163 | 164 | def poll(): 165 | global captouch 166 | captouch.poll() 167 | 168 | def setup(): 169 | global _is_setup, captouch 170 | 171 | if _is_setup: 172 | return True 173 | 174 | captouch = cap1xxx.Cap1166(i2c=board.I2C(),i2c_addr=0x2c) 175 | 176 | captouch.handlers['press'] = [_handle_press for x in range(6)] 177 | captouch.handlers['release'] = [_handle_release for x in range(6)] 178 | 179 | # Unlink the LEDs since Touch pHAT's LEDs don't match up with the channels 180 | captouch._write_byte(cap1xxx.R_LED_LINKING, 0b00000000) 181 | 182 | _is_setup = True 183 | -------------------------------------------------------------------------------- /lib/what.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------- 2 | # CircuitPython driver for Pimoroni's wHat e-ink display. 3 | # 4 | # This has only been tested for the black&white variant, but should also 5 | # work for the color-versions of this display. 6 | # 7 | # Author: Bernhard Bablok 8 | # License: MIT 9 | # 10 | # This is a port of the what-driver from: https://github.com/pimoroni/inky 11 | # The original MIT-License is Copyright (c) 2018 Pimoroni Ltd. 12 | # 13 | # Website: https://github.com/bablokb/pcb-pico-pi-base 14 | # 15 | # ------------------------------------------------------------------------- 16 | 17 | import displayio 18 | 19 | _LUTS = { 20 | 'black': [ 21 | 0b01001000, 0b10100000, 0b00010000, 0b00010000, 0b00010011, 0b00000000, 0b00000000, 22 | 0b01001000, 0b10100000, 0b10000000, 0b00000000, 0b00000011, 0b00000000, 0b00000000, 23 | 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 24 | 0b01001000, 0b10100101, 0b00000000, 0b10111011, 0b00000000, 0b00000000, 0b00000000, 25 | 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 26 | 0x10, 0x04, 0x04, 0x04, 0x04, 27 | 0x10, 0x04, 0x04, 0x04, 0x04, 28 | 0x04, 0x08, 0x08, 0x10, 0x10, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0x00, 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 33 | ], 34 | 'red': [ 35 | 0b01001000, 0b10100000, 0b00010000, 0b00010000, 0b00010011, 0b00000000, 0b00000000, 36 | 0b01001000, 0b10100000, 0b10000000, 0b00000000, 0b00000011, 0b00000000, 0b00000000, 37 | 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 38 | 0b01001000, 0b10100101, 0b00000000, 0b10111011, 0b00000000, 0b00000000, 0b00000000, 39 | 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 40 | 0x40, 0x0C, 0x20, 0x0C, 0x06, 41 | 0x10, 0x08, 0x04, 0x04, 0x06, 42 | 0x04, 0x08, 0x08, 0x10, 0x10, 43 | 0x02, 0x02, 0x02, 0x40, 0x20, 44 | 0x02, 0x02, 0x02, 0x02, 0x02, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x00, 0x00, 0x00 47 | ], 48 | 'red_ht': [ 49 | 0b01001000, 0b10100000, 0b00010000, 0b00010000, 0b00010011, 0b00010000, 0b00010000, 50 | 0b01001000, 0b10100000, 0b10000000, 0b00000000, 0b00000011, 0b10000000, 0b10000000, 51 | 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 52 | 0b01001000, 0b10100101, 0b00000000, 0b10111011, 0b00000000, 0b01001000, 0b00000000, 53 | 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 54 | 0x43, 0x0A, 0x1F, 0x0A, 0x04, 55 | 0x10, 0x08, 0x04, 0x04, 0x06, 56 | 0x04, 0x08, 0x08, 0x10, 0x0B, 57 | 0x02, 0x04, 0x04, 0x40, 0x10, 58 | 0x06, 0x06, 0x06, 0x02, 0x02, 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 60 | 0x00, 0x00, 0x00, 0x00, 0x00 61 | ], 62 | 'yellow': [ 63 | 0b11111010, 0b10010100, 0b10001100, 0b11000000, 0b11010000, 0b00000000, 0b00000000, 64 | 0b11111010, 0b10010100, 0b00101100, 0b10000000, 0b11100000, 0b00000000, 0b00000000, 65 | 0b11111010, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 66 | 0b11111010, 0b10010100, 0b11111000, 0b10000000, 0b01010000, 0b00000000, 0b11001100, 67 | 0b10111111, 0b01011000, 0b11111100, 0b10000000, 0b11010000, 0b00000000, 0b00010001, 68 | 0x40, 0x10, 0x40, 0x10, 0x08, 69 | 0x08, 0x10, 0x04, 0x04, 0x10, 70 | 0x08, 0x08, 0x03, 0x08, 0x20, 71 | 0x08, 0x04, 0x00, 0x00, 0x10, 72 | 0x10, 0x08, 0x08, 0x00, 0x20, 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 74 | 0x00, 0x00, 0x00, 0x00, 0x00, 75 | ] 76 | } 77 | 78 | _INIT_SEQUENCE = ( 79 | b"\x74\x01\x54" # Set Analog Block Control 80 | b"\x7e\x01\x3b" # Set Digital Block Control 81 | b"\x01\x03\x2c\01\x00" # Gate setting 2c01: height 300= 0x012C 82 | b"\x03\x01\x17" # Gate Driving Voltage 83 | b"\x04\x03\x41\xAC\x32" # Source Driving Voltage 84 | b"\x3a\x01\x07" # Dummy line period 85 | b"\x3b\x01\x04" # Gate line width 86 | b"\x11\x01\x03" # Data entry mode setting 0x03 = X/Y increment 87 | b"\x2c\x01\x3c" # VCOM Register, 0x3c = -1.5v? 88 | b"\x3c\x01\x00" 89 | ) 90 | 91 | _REFRESH_SEQUENCE = ( 92 | b"\x22\x01\xC7" # Display Update Sequence 93 | b"\x20" # Trigger Display Update 94 | ) 95 | 96 | _STOP_SEQUENCE = ( 97 | b"\x10\x01" # Enter Deep Sleep 98 | ) 99 | 100 | class Inky_wHat(displayio.EPaperDisplay): 101 | """ Inky_wHat driver """ 102 | 103 | def __init__(self, bus: displayio.FourWire, 104 | color='black', border_color='black', 105 | **kwargs) -> None: 106 | 107 | if color not in ('red', 'black', 'yellow'): 108 | raise ValueError(f"color {color} is not supported!") 109 | if border_color not in ('red', 'black', 'yellow', 'white'): 110 | raise ValueError(f"border-color {border_color} is not supported!") 111 | 112 | if border_color == 'black': 113 | init_sequence = _INIT_SEQUENCE+b"\x3c\x01\x00" 114 | elif border_color == 'red': 115 | init_sequence = _INIT_SEQUENCE+b"\x3c\x01\x73" 116 | elif border_color == 'yellow': 117 | init_sequence = _INIT_SEQUENCE+b"\x3c\x01\x33" 118 | elif border_color == 'white': 119 | init_sequence = _INIT_SEQUENCE+b"\x3c\x01\x31" 120 | 121 | # Set voltage of VSH and VSL 122 | if color == 'yellow': 123 | init_sequence = init_sequence+b"\x04\x03\x07\xAC\x32" 124 | elif color == 'red': 125 | init_sequence = init_sequence+b"\x04\x03\x30\xAC\x22" 126 | 127 | # Set LUTs 128 | ll = len(_LUTS[color]) 129 | init_sequence = init_sequence+b"\x32"+bytes([ll])+bytes(_LUTS[color]) 130 | 131 | # Set RAM X Start/End: 400//8-1 = 49 = 0x31 132 | init_sequence = init_sequence+b"\x44\x02\x00\x31" 133 | # Set RAM Y Start/End: 300 = \x01\x2c -> \x2c\x01 134 | init_sequence = init_sequence+b"\x45\x04\x00\00\x2c\x01" 135 | 136 | super().__init__( 137 | bus, 138 | init_sequence, 139 | _STOP_SEQUENCE, 140 | **kwargs, 141 | width=400, 142 | height=300, 143 | ram_width=400, 144 | ram_height=300, 145 | busy_state=True, 146 | write_black_ram_command=0x24, 147 | write_color_ram_command=0x26, 148 | refresh_display_command=_REFRESH_SEQUENCE, 149 | seconds_per_frame=2, 150 | refresh_time=2.0, 151 | ) 152 | -------------------------------------------------------------------------------- /mapping.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/mapping.ods -------------------------------------------------------------------------------- /pcb-3D-bot-pi-base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/pcb-3D-bot-pi-base.png -------------------------------------------------------------------------------- /pcb-3D-bot-zero-base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/pcb-3D-bot-zero-base.png -------------------------------------------------------------------------------- /pcb-3D-top-pi-base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/pcb-3D-top-pi-base.png -------------------------------------------------------------------------------- /pcb-3D-top-zero-base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/pcb-3D-top-zero-base.png -------------------------------------------------------------------------------- /pcb-layout-pi-base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/pcb-layout-pi-base.png -------------------------------------------------------------------------------- /pcb-layout-zero-base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/pcb-layout-zero-base.png -------------------------------------------------------------------------------- /pico-pi-base.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/pico-pi-base.jpg -------------------------------------------------------------------------------- /pico-pi-base.kicad/pico-pi-base.kicad_prl: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "active_layer": 0, 4 | "active_layer_preset": "", 5 | "auto_track_width": true, 6 | "hidden_nets": [], 7 | "high_contrast_mode": 0, 8 | "net_color_mode": 1, 9 | "opacity": { 10 | "pads": 1.0, 11 | "tracks": 1.0, 12 | "vias": 1.0, 13 | "zones": 0.6 14 | }, 15 | "ratsnest_display_mode": 0, 16 | "selection_filter": { 17 | "dimensions": true, 18 | "footprints": true, 19 | "graphics": true, 20 | "keepouts": true, 21 | "lockedItems": true, 22 | "otherItems": true, 23 | "pads": true, 24 | "text": true, 25 | "tracks": true, 26 | "vias": true, 27 | "zones": true 28 | }, 29 | "visible_items": [ 30 | 0, 31 | 1, 32 | 2, 33 | 3, 34 | 4, 35 | 5, 36 | 6, 37 | 8, 38 | 9, 39 | 10, 40 | 11, 41 | 13, 42 | 14, 43 | 15, 44 | 16, 45 | 17, 46 | 18, 47 | 19, 48 | 20, 49 | 21, 50 | 22, 51 | 23, 52 | 24, 53 | 25, 54 | 32, 55 | 33, 56 | 34, 57 | 35, 58 | 36, 59 | 37, 60 | 38 61 | ], 62 | "visible_layers": "003ffff_80000001", 63 | "zone_display_mode": 1 64 | }, 65 | "meta": { 66 | "filename": "pico-pi-base.kicad_prl", 67 | "version": 3 68 | }, 69 | "project": { 70 | "files": [] 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /pico-pi-base.kicad/pico-pi-base.kicad_pro: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "design_settings": { 4 | "defaults": { 5 | "board_outline_line_width": 0.049999999999999996, 6 | "copper_line_width": 0.19999999999999998, 7 | "copper_text_italic": false, 8 | "copper_text_size_h": 1.5, 9 | "copper_text_size_v": 1.5, 10 | "copper_text_thickness": 0.3, 11 | "copper_text_upright": false, 12 | "courtyard_line_width": 0.049999999999999996, 13 | "dimension_precision": 4, 14 | "dimension_units": 3, 15 | "dimensions": { 16 | "arrow_length": 1270000, 17 | "extension_offset": 500000, 18 | "keep_text_aligned": true, 19 | "suppress_zeroes": false, 20 | "text_position": 0, 21 | "units_format": 1 22 | }, 23 | "fab_line_width": 0.09999999999999999, 24 | "fab_text_italic": false, 25 | "fab_text_size_h": 1.0, 26 | "fab_text_size_v": 1.0, 27 | "fab_text_thickness": 0.15, 28 | "fab_text_upright": false, 29 | "other_line_width": 0.09999999999999999, 30 | "other_text_italic": false, 31 | "other_text_size_h": 1.0, 32 | "other_text_size_v": 1.0, 33 | "other_text_thickness": 0.15, 34 | "other_text_upright": false, 35 | "pads": { 36 | "drill": 2.7, 37 | "height": 2.7, 38 | "width": 2.7 39 | }, 40 | "silk_line_width": 0.12, 41 | "silk_text_italic": false, 42 | "silk_text_size_h": 1.0, 43 | "silk_text_size_v": 1.0, 44 | "silk_text_thickness": 0.15, 45 | "silk_text_upright": false, 46 | "zones": { 47 | "45_degree_only": true, 48 | "min_clearance": 0.0 49 | } 50 | }, 51 | "diff_pair_dimensions": [ 52 | { 53 | "gap": 0.0, 54 | "via_gap": 0.0, 55 | "width": 0.0 56 | } 57 | ], 58 | "drc_exclusions": [ 59 | "courtyards_overlap|106000001|94968646|640aa317-cc8e-48cd-97e9-6e14b55e2913|7e8d827e-a7ed-44d4-95fc-a91af7cef820" 60 | ], 61 | "meta": { 62 | "version": 2 63 | }, 64 | "rule_severities": { 65 | "annular_width": "error", 66 | "clearance": "error", 67 | "copper_edge_clearance": "error", 68 | "courtyards_overlap": "error", 69 | "diff_pair_gap_out_of_range": "error", 70 | "diff_pair_uncoupled_length_too_long": "error", 71 | "drill_out_of_range": "error", 72 | "duplicate_footprints": "warning", 73 | "extra_footprint": "warning", 74 | "footprint_type_mismatch": "error", 75 | "hole_clearance": "error", 76 | "hole_near_hole": "error", 77 | "invalid_outline": "error", 78 | "item_on_disabled_layer": "error", 79 | "items_not_allowed": "error", 80 | "length_out_of_range": "error", 81 | "malformed_courtyard": "error", 82 | "microvia_drill_out_of_range": "error", 83 | "missing_courtyard": "ignore", 84 | "missing_footprint": "warning", 85 | "net_conflict": "warning", 86 | "npth_inside_courtyard": "ignore", 87 | "padstack": "error", 88 | "pth_inside_courtyard": "ignore", 89 | "shorting_items": "error", 90 | "silk_over_copper": "ignore", 91 | "silk_overlap": "ignore", 92 | "skew_out_of_range": "error", 93 | "through_hole_pad_without_hole": "error", 94 | "too_many_vias": "error", 95 | "track_dangling": "warning", 96 | "track_width": "error", 97 | "tracks_crossing": "error", 98 | "unconnected_items": "error", 99 | "unresolved_variable": "error", 100 | "via_dangling": "warning", 101 | "zone_has_empty_net": "error", 102 | "zones_intersect": "error" 103 | }, 104 | "rules": { 105 | "allow_blind_buried_vias": false, 106 | "allow_microvias": false, 107 | "max_error": 0.005, 108 | "min_clearance": 0.0, 109 | "min_copper_edge_clearance": 0.049999999999999996, 110 | "min_hole_clearance": 0.0, 111 | "min_hole_to_hole": 0.25, 112 | "min_microvia_diameter": 0.19999999999999998, 113 | "min_microvia_drill": 0.09999999999999999, 114 | "min_silk_clearance": 0.0, 115 | "min_through_hole_diameter": 0.3, 116 | "min_track_width": 0.19999999999999998, 117 | "min_via_annular_width": 0.049999999999999996, 118 | "min_via_diameter": 0.39999999999999997, 119 | "use_height_for_length_calcs": true 120 | }, 121 | "track_widths": [ 122 | 0.0 123 | ], 124 | "via_dimensions": [ 125 | { 126 | "diameter": 0.0, 127 | "drill": 0.0 128 | } 129 | ], 130 | "zones_allow_external_fillets": false, 131 | "zones_use_no_outline": true 132 | }, 133 | "layer_presets": [] 134 | }, 135 | "boards": [], 136 | "cvpcb": { 137 | "equivalence_files": [] 138 | }, 139 | "erc": { 140 | "erc_exclusions": [], 141 | "meta": { 142 | "version": 0 143 | }, 144 | "pin_map": [ 145 | [ 146 | 0, 147 | 0, 148 | 0, 149 | 0, 150 | 0, 151 | 0, 152 | 1, 153 | 0, 154 | 0, 155 | 0, 156 | 0, 157 | 2 158 | ], 159 | [ 160 | 0, 161 | 2, 162 | 0, 163 | 1, 164 | 0, 165 | 0, 166 | 1, 167 | 0, 168 | 2, 169 | 2, 170 | 2, 171 | 2 172 | ], 173 | [ 174 | 0, 175 | 0, 176 | 0, 177 | 0, 178 | 0, 179 | 0, 180 | 1, 181 | 0, 182 | 1, 183 | 0, 184 | 1, 185 | 2 186 | ], 187 | [ 188 | 0, 189 | 1, 190 | 0, 191 | 0, 192 | 0, 193 | 0, 194 | 1, 195 | 1, 196 | 2, 197 | 1, 198 | 1, 199 | 2 200 | ], 201 | [ 202 | 0, 203 | 0, 204 | 0, 205 | 0, 206 | 0, 207 | 0, 208 | 1, 209 | 0, 210 | 0, 211 | 0, 212 | 0, 213 | 2 214 | ], 215 | [ 216 | 0, 217 | 0, 218 | 0, 219 | 0, 220 | 0, 221 | 0, 222 | 0, 223 | 0, 224 | 0, 225 | 0, 226 | 0, 227 | 2 228 | ], 229 | [ 230 | 1, 231 | 1, 232 | 1, 233 | 1, 234 | 1, 235 | 0, 236 | 1, 237 | 1, 238 | 1, 239 | 1, 240 | 1, 241 | 2 242 | ], 243 | [ 244 | 0, 245 | 0, 246 | 0, 247 | 1, 248 | 0, 249 | 0, 250 | 1, 251 | 0, 252 | 0, 253 | 0, 254 | 0, 255 | 2 256 | ], 257 | [ 258 | 0, 259 | 2, 260 | 1, 261 | 2, 262 | 0, 263 | 0, 264 | 1, 265 | 0, 266 | 2, 267 | 2, 268 | 2, 269 | 2 270 | ], 271 | [ 272 | 0, 273 | 2, 274 | 0, 275 | 1, 276 | 0, 277 | 0, 278 | 1, 279 | 0, 280 | 2, 281 | 0, 282 | 0, 283 | 2 284 | ], 285 | [ 286 | 0, 287 | 2, 288 | 1, 289 | 1, 290 | 0, 291 | 0, 292 | 1, 293 | 0, 294 | 2, 295 | 0, 296 | 0, 297 | 2 298 | ], 299 | [ 300 | 2, 301 | 2, 302 | 2, 303 | 2, 304 | 2, 305 | 2, 306 | 2, 307 | 2, 308 | 2, 309 | 2, 310 | 2, 311 | 2 312 | ] 313 | ], 314 | "rule_severities": { 315 | "bus_definition_conflict": "error", 316 | "bus_entry_needed": "error", 317 | "bus_label_syntax": "error", 318 | "bus_to_bus_conflict": "error", 319 | "bus_to_net_conflict": "error", 320 | "different_unit_footprint": "error", 321 | "different_unit_net": "error", 322 | "duplicate_reference": "error", 323 | "duplicate_sheet_names": "error", 324 | "extra_units": "error", 325 | "global_label_dangling": "warning", 326 | "hier_label_mismatch": "error", 327 | "label_dangling": "error", 328 | "lib_symbol_issues": "warning", 329 | "multiple_net_names": "warning", 330 | "net_not_bus_member": "warning", 331 | "no_connect_connected": "warning", 332 | "no_connect_dangling": "warning", 333 | "pin_not_connected": "error", 334 | "pin_not_driven": "error", 335 | "pin_to_pin": "warning", 336 | "power_pin_not_driven": "error", 337 | "similar_labels": "warning", 338 | "unannotated": "error", 339 | "unit_value_mismatch": "error", 340 | "unresolved_variable": "error", 341 | "wire_dangling": "error" 342 | } 343 | }, 344 | "libraries": { 345 | "pinned_footprint_libs": [], 346 | "pinned_symbol_libs": [] 347 | }, 348 | "meta": { 349 | "filename": "pico-pi-base.kicad_pro", 350 | "version": 1 351 | }, 352 | "net_settings": { 353 | "classes": [ 354 | { 355 | "bus_width": 12.0, 356 | "clearance": 0.2, 357 | "diff_pair_gap": 0.25, 358 | "diff_pair_via_gap": 0.25, 359 | "diff_pair_width": 0.2, 360 | "line_style": 0, 361 | "microvia_diameter": 0.5, 362 | "microvia_drill": 0.1, 363 | "name": "Default", 364 | "pcb_color": "rgba(0, 0, 0, 0.000)", 365 | "schematic_color": "rgba(0, 0, 0, 0.000)", 366 | "track_width": 0.2, 367 | "via_diameter": 0.9, 368 | "via_drill": 0.6, 369 | "wire_width": 6.0 370 | }, 371 | { 372 | "bus_width": 12.0, 373 | "clearance": 0.2, 374 | "diff_pair_gap": 0.25, 375 | "diff_pair_via_gap": 0.25, 376 | "diff_pair_width": 0.2, 377 | "line_style": 0, 378 | "microvia_diameter": 0.5, 379 | "microvia_drill": 0.1, 380 | "name": "Power", 381 | "nets": [ 382 | "+3.3V", 383 | "+5V", 384 | "+BATT", 385 | "/VSYS" 386 | ], 387 | "pcb_color": "rgba(0, 0, 0, 0.000)", 388 | "schematic_color": "rgba(0, 0, 0, 0.000)", 389 | "track_width": 0.5, 390 | "via_diameter": 1.0, 391 | "via_drill": 0.7, 392 | "wire_width": 6.0 393 | } 394 | ], 395 | "meta": { 396 | "version": 2 397 | }, 398 | "net_colors": null 399 | }, 400 | "pcbnew": { 401 | "last_paths": { 402 | "gencad": "", 403 | "idf": "", 404 | "netlist": "", 405 | "specctra_dsn": "", 406 | "step": "", 407 | "vrml": "" 408 | }, 409 | "page_layout_descr_file": "" 410 | }, 411 | "schematic": { 412 | "annotate_start_num": 0, 413 | "drawing": { 414 | "default_bus_thickness": 12.0, 415 | "default_junction_size": 40.0, 416 | "default_line_thickness": 6.0, 417 | "default_text_size": 50.0, 418 | "default_wire_thickness": 6.0, 419 | "field_names": [], 420 | "intersheets_ref_own_page": false, 421 | "intersheets_ref_prefix": "", 422 | "intersheets_ref_short": false, 423 | "intersheets_ref_show": false, 424 | "intersheets_ref_suffix": "", 425 | "junction_size_choice": 3, 426 | "label_size_ratio": 0.3, 427 | "pin_symbol_size": 25.0, 428 | "text_offset_ratio": 0.3 429 | }, 430 | "legacy_lib_dir": "", 431 | "legacy_lib_list": [], 432 | "meta": { 433 | "version": 1 434 | }, 435 | "net_format_name": "", 436 | "ngspice": { 437 | "fix_include_paths": true, 438 | "fix_passive_vals": false, 439 | "meta": { 440 | "version": 0 441 | }, 442 | "model_mode": 0, 443 | "workbook_filename": "" 444 | }, 445 | "page_layout_descr_file": "", 446 | "plot_directory": "", 447 | "spice_adjust_passive_values": false, 448 | "spice_external_command": "spice \"%I\"", 449 | "subpart_first_id": 65, 450 | "subpart_id_separator": 0 451 | }, 452 | "sheets": [ 453 | [ 454 | "e63e39d7-6ac0-4ffd-8aa3-1841a4541b55", 455 | "" 456 | ] 457 | ], 458 | "text_variables": {} 459 | } 460 | -------------------------------------------------------------------------------- /pico-zero-base.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/pico-zero-base.jpg -------------------------------------------------------------------------------- /pico-zero-base.kicad/pico-zero-base.kicad_prl: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "active_layer": 0, 4 | "active_layer_preset": "All Layers", 5 | "auto_track_width": true, 6 | "hidden_nets": [], 7 | "high_contrast_mode": 0, 8 | "net_color_mode": 1, 9 | "opacity": { 10 | "pads": 1.0, 11 | "tracks": 1.0, 12 | "vias": 1.0, 13 | "zones": 0.6 14 | }, 15 | "ratsnest_display_mode": 0, 16 | "selection_filter": { 17 | "dimensions": true, 18 | "footprints": true, 19 | "graphics": true, 20 | "keepouts": true, 21 | "lockedItems": true, 22 | "otherItems": true, 23 | "pads": true, 24 | "text": true, 25 | "tracks": true, 26 | "vias": true, 27 | "zones": true 28 | }, 29 | "visible_items": [ 30 | 0, 31 | 1, 32 | 2, 33 | 3, 34 | 4, 35 | 5, 36 | 8, 37 | 9, 38 | 10, 39 | 11, 40 | 12, 41 | 13, 42 | 14, 43 | 15, 44 | 16, 45 | 17, 46 | 18, 47 | 19, 48 | 20, 49 | 21, 50 | 22, 51 | 23, 52 | 24, 53 | 25, 54 | 26, 55 | 27, 56 | 28, 57 | 29, 58 | 30, 59 | 32, 60 | 33, 61 | 34, 62 | 35, 63 | 36 64 | ], 65 | "visible_layers": "fffffff_ffffffff", 66 | "zone_display_mode": 1 67 | }, 68 | "meta": { 69 | "filename": "pico-zero-base.kicad_prl", 70 | "version": 3 71 | }, 72 | "project": { 73 | "files": [] 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /pico-zero-base.kicad/pico-zero-base.kicad_pro: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "design_settings": { 4 | "defaults": { 5 | "board_outline_line_width": 0.049999999999999996, 6 | "copper_line_width": 0.19999999999999998, 7 | "copper_text_italic": false, 8 | "copper_text_size_h": 1.5, 9 | "copper_text_size_v": 1.5, 10 | "copper_text_thickness": 0.3, 11 | "copper_text_upright": false, 12 | "courtyard_line_width": 0.049999999999999996, 13 | "dimension_precision": 4, 14 | "dimension_units": 3, 15 | "dimensions": { 16 | "arrow_length": 1270000, 17 | "extension_offset": 500000, 18 | "keep_text_aligned": true, 19 | "suppress_zeroes": false, 20 | "text_position": 0, 21 | "units_format": 1 22 | }, 23 | "fab_line_width": 0.09999999999999999, 24 | "fab_text_italic": false, 25 | "fab_text_size_h": 1.0, 26 | "fab_text_size_v": 1.0, 27 | "fab_text_thickness": 0.15, 28 | "fab_text_upright": false, 29 | "other_line_width": 0.09999999999999999, 30 | "other_text_italic": false, 31 | "other_text_size_h": 1.0, 32 | "other_text_size_v": 1.0, 33 | "other_text_thickness": 0.15, 34 | "other_text_upright": false, 35 | "pads": { 36 | "drill": 2.7, 37 | "height": 2.7, 38 | "width": 2.7 39 | }, 40 | "silk_line_width": 0.12, 41 | "silk_text_italic": false, 42 | "silk_text_size_h": 1.0, 43 | "silk_text_size_v": 1.0, 44 | "silk_text_thickness": 0.15, 45 | "silk_text_upright": false, 46 | "zones": { 47 | "45_degree_only": true, 48 | "min_clearance": 0.0 49 | } 50 | }, 51 | "diff_pair_dimensions": [ 52 | { 53 | "gap": 0.0, 54 | "via_gap": 0.0, 55 | "width": 0.0 56 | } 57 | ], 58 | "drc_exclusions": [], 59 | "meta": { 60 | "version": 2 61 | }, 62 | "rule_severities": { 63 | "annular_width": "error", 64 | "clearance": "error", 65 | "copper_edge_clearance": "error", 66 | "courtyards_overlap": "ignore", 67 | "diff_pair_gap_out_of_range": "error", 68 | "diff_pair_uncoupled_length_too_long": "error", 69 | "drill_out_of_range": "error", 70 | "duplicate_footprints": "warning", 71 | "extra_footprint": "warning", 72 | "footprint_type_mismatch": "error", 73 | "hole_clearance": "error", 74 | "hole_near_hole": "error", 75 | "invalid_outline": "error", 76 | "item_on_disabled_layer": "error", 77 | "items_not_allowed": "error", 78 | "length_out_of_range": "error", 79 | "malformed_courtyard": "error", 80 | "microvia_drill_out_of_range": "error", 81 | "missing_courtyard": "ignore", 82 | "missing_footprint": "warning", 83 | "net_conflict": "warning", 84 | "npth_inside_courtyard": "ignore", 85 | "padstack": "error", 86 | "pth_inside_courtyard": "ignore", 87 | "shorting_items": "error", 88 | "silk_over_copper": "ignore", 89 | "silk_overlap": "error", 90 | "skew_out_of_range": "error", 91 | "through_hole_pad_without_hole": "error", 92 | "too_many_vias": "error", 93 | "track_dangling": "warning", 94 | "track_width": "error", 95 | "tracks_crossing": "error", 96 | "unconnected_items": "error", 97 | "unresolved_variable": "error", 98 | "via_dangling": "warning", 99 | "zone_has_empty_net": "error", 100 | "zones_intersect": "error" 101 | }, 102 | "rules": { 103 | "allow_blind_buried_vias": false, 104 | "allow_microvias": false, 105 | "max_error": 0.005, 106 | "min_clearance": 0.0, 107 | "min_copper_edge_clearance": 0.049999999999999996, 108 | "min_hole_clearance": 0.0, 109 | "min_hole_to_hole": 0.25, 110 | "min_microvia_diameter": 0.19999999999999998, 111 | "min_microvia_drill": 0.09999999999999999, 112 | "min_silk_clearance": 0.0, 113 | "min_through_hole_diameter": 0.3, 114 | "min_track_width": 0.19999999999999998, 115 | "min_via_annular_width": 0.049999999999999996, 116 | "min_via_diameter": 0.39999999999999997, 117 | "use_height_for_length_calcs": true 118 | }, 119 | "track_widths": [ 120 | 0.0 121 | ], 122 | "via_dimensions": [ 123 | { 124 | "diameter": 0.0, 125 | "drill": 0.0 126 | } 127 | ], 128 | "zones_allow_external_fillets": false, 129 | "zones_use_no_outline": true 130 | }, 131 | "layer_presets": [] 132 | }, 133 | "boards": [], 134 | "cvpcb": { 135 | "equivalence_files": [] 136 | }, 137 | "erc": { 138 | "erc_exclusions": [], 139 | "meta": { 140 | "version": 0 141 | }, 142 | "pin_map": [ 143 | [ 144 | 0, 145 | 0, 146 | 0, 147 | 0, 148 | 0, 149 | 0, 150 | 1, 151 | 0, 152 | 0, 153 | 0, 154 | 0, 155 | 2 156 | ], 157 | [ 158 | 0, 159 | 2, 160 | 0, 161 | 1, 162 | 0, 163 | 0, 164 | 1, 165 | 0, 166 | 2, 167 | 2, 168 | 2, 169 | 2 170 | ], 171 | [ 172 | 0, 173 | 0, 174 | 0, 175 | 0, 176 | 0, 177 | 0, 178 | 1, 179 | 0, 180 | 1, 181 | 0, 182 | 1, 183 | 2 184 | ], 185 | [ 186 | 0, 187 | 1, 188 | 0, 189 | 0, 190 | 0, 191 | 0, 192 | 1, 193 | 1, 194 | 2, 195 | 1, 196 | 1, 197 | 2 198 | ], 199 | [ 200 | 0, 201 | 0, 202 | 0, 203 | 0, 204 | 0, 205 | 0, 206 | 1, 207 | 0, 208 | 0, 209 | 0, 210 | 0, 211 | 2 212 | ], 213 | [ 214 | 0, 215 | 0, 216 | 0, 217 | 0, 218 | 0, 219 | 0, 220 | 0, 221 | 0, 222 | 0, 223 | 0, 224 | 0, 225 | 2 226 | ], 227 | [ 228 | 1, 229 | 1, 230 | 1, 231 | 1, 232 | 1, 233 | 0, 234 | 1, 235 | 1, 236 | 1, 237 | 1, 238 | 1, 239 | 2 240 | ], 241 | [ 242 | 0, 243 | 0, 244 | 0, 245 | 1, 246 | 0, 247 | 0, 248 | 1, 249 | 0, 250 | 0, 251 | 0, 252 | 0, 253 | 2 254 | ], 255 | [ 256 | 0, 257 | 2, 258 | 1, 259 | 2, 260 | 0, 261 | 0, 262 | 1, 263 | 0, 264 | 2, 265 | 2, 266 | 2, 267 | 2 268 | ], 269 | [ 270 | 0, 271 | 2, 272 | 0, 273 | 1, 274 | 0, 275 | 0, 276 | 1, 277 | 0, 278 | 2, 279 | 0, 280 | 0, 281 | 2 282 | ], 283 | [ 284 | 0, 285 | 2, 286 | 1, 287 | 1, 288 | 0, 289 | 0, 290 | 1, 291 | 0, 292 | 2, 293 | 0, 294 | 0, 295 | 2 296 | ], 297 | [ 298 | 2, 299 | 2, 300 | 2, 301 | 2, 302 | 2, 303 | 2, 304 | 2, 305 | 2, 306 | 2, 307 | 2, 308 | 2, 309 | 2 310 | ] 311 | ], 312 | "rule_severities": { 313 | "bus_definition_conflict": "error", 314 | "bus_entry_needed": "error", 315 | "bus_label_syntax": "error", 316 | "bus_to_bus_conflict": "error", 317 | "bus_to_net_conflict": "error", 318 | "different_unit_footprint": "error", 319 | "different_unit_net": "error", 320 | "duplicate_reference": "error", 321 | "duplicate_sheet_names": "error", 322 | "extra_units": "error", 323 | "global_label_dangling": "warning", 324 | "hier_label_mismatch": "error", 325 | "label_dangling": "error", 326 | "lib_symbol_issues": "warning", 327 | "multiple_net_names": "warning", 328 | "net_not_bus_member": "warning", 329 | "no_connect_connected": "warning", 330 | "no_connect_dangling": "warning", 331 | "pin_not_connected": "error", 332 | "pin_not_driven": "error", 333 | "pin_to_pin": "warning", 334 | "power_pin_not_driven": "error", 335 | "similar_labels": "warning", 336 | "unannotated": "error", 337 | "unit_value_mismatch": "error", 338 | "unresolved_variable": "error", 339 | "wire_dangling": "error" 340 | } 341 | }, 342 | "libraries": { 343 | "pinned_footprint_libs": [], 344 | "pinned_symbol_libs": [] 345 | }, 346 | "meta": { 347 | "filename": "pico-zero-base.kicad_pro", 348 | "version": 1 349 | }, 350 | "net_settings": { 351 | "classes": [ 352 | { 353 | "bus_width": 12.0, 354 | "clearance": 0.2, 355 | "diff_pair_gap": 0.25, 356 | "diff_pair_via_gap": 0.25, 357 | "diff_pair_width": 0.2, 358 | "line_style": 0, 359 | "microvia_diameter": 0.5, 360 | "microvia_drill": 0.1, 361 | "name": "Default", 362 | "pcb_color": "rgba(0, 0, 0, 0.000)", 363 | "schematic_color": "rgba(0, 0, 0, 0.000)", 364 | "track_width": 0.2, 365 | "via_diameter": 0.9, 366 | "via_drill": 0.6, 367 | "wire_width": 6.0 368 | }, 369 | { 370 | "bus_width": 12.0, 371 | "clearance": 0.2, 372 | "diff_pair_gap": 0.25, 373 | "diff_pair_via_gap": 0.25, 374 | "diff_pair_width": 0.2, 375 | "line_style": 0, 376 | "microvia_diameter": 0.5, 377 | "microvia_drill": 0.1, 378 | "name": "Power", 379 | "nets": [ 380 | "+3.3V", 381 | "+5V" 382 | ], 383 | "pcb_color": "rgba(0, 0, 0, 0.000)", 384 | "schematic_color": "rgba(0, 0, 0, 0.000)", 385 | "track_width": 0.5, 386 | "via_diameter": 1.0, 387 | "via_drill": 0.7, 388 | "wire_width": 6.0 389 | } 390 | ], 391 | "meta": { 392 | "version": 2 393 | }, 394 | "net_colors": null 395 | }, 396 | "pcbnew": { 397 | "last_paths": { 398 | "gencad": "", 399 | "idf": "", 400 | "netlist": "", 401 | "specctra_dsn": "", 402 | "step": "", 403 | "vrml": "" 404 | }, 405 | "page_layout_descr_file": "" 406 | }, 407 | "schematic": { 408 | "annotate_start_num": 0, 409 | "drawing": { 410 | "default_bus_thickness": 12.0, 411 | "default_junction_size": 40.0, 412 | "default_line_thickness": 6.0, 413 | "default_text_size": 50.0, 414 | "default_wire_thickness": 6.0, 415 | "field_names": [], 416 | "intersheets_ref_own_page": false, 417 | "intersheets_ref_prefix": "", 418 | "intersheets_ref_short": false, 419 | "intersheets_ref_show": false, 420 | "intersheets_ref_suffix": "", 421 | "junction_size_choice": 3, 422 | "label_size_ratio": 0.3, 423 | "pin_symbol_size": 25.0, 424 | "text_offset_ratio": 0.3 425 | }, 426 | "legacy_lib_dir": "", 427 | "legacy_lib_list": [], 428 | "meta": { 429 | "version": 1 430 | }, 431 | "net_format_name": "", 432 | "ngspice": { 433 | "fix_include_paths": true, 434 | "fix_passive_vals": false, 435 | "meta": { 436 | "version": 0 437 | }, 438 | "model_mode": 0, 439 | "workbook_filename": "" 440 | }, 441 | "page_layout_descr_file": "", 442 | "plot_directory": "", 443 | "spice_adjust_passive_values": false, 444 | "spice_external_command": "spice \"%I\"", 445 | "subpart_first_id": 65, 446 | "subpart_id_separator": 0 447 | }, 448 | "sheets": [ 449 | [ 450 | "e63e39d7-6ac0-4ffd-8aa3-1841a4541b55", 451 | "" 452 | ] 453 | ], 454 | "text_variables": {} 455 | } 456 | -------------------------------------------------------------------------------- /production_files/BOM-pico-pi-base.csv: -------------------------------------------------------------------------------- 1 | Comment,Designator,Footprint,LCSC 2 | D_Schottky,D1,D_SMA,C2480 3 | 10K,"R1,R2",R_0603_1608Metric,C25804 4 | Micro_SD_TF_PUSH,J9,TF-Push,C393941 5 | -------------------------------------------------------------------------------- /production_files/BOM-pico-zero-base.csv: -------------------------------------------------------------------------------- 1 | Comment,Designator,Footprint,LCSC 2 | 10K,"R1,R2",R_1206_3216Metric_Pad1.30x1.75mm_HandSolder,C17902 3 | -------------------------------------------------------------------------------- /production_files/CPL-pico-pi-base.csv: -------------------------------------------------------------------------------- 1 | Designator,Val,Package,Mid X,Mid Y,Rotation,Layer 2 | D1,D_Schottky,D_SMA,3.74,10.97,-90.0,top 3 | J9,Micro_SD_TF_PUSH,TF-Push,75.0,9.9,90.0,top 4 | R1,10K,R_0603_1608Metric,8.38,48.59,180.0,top 5 | R2,10K,R_0603_1608Metric,8.38,47.04,180.0,top 6 | -------------------------------------------------------------------------------- /production_files/CPL-pico-zero-base.csv: -------------------------------------------------------------------------------- 1 | Designator,Val,Package,Mid X,Mid Y,Rotation,Layer 2 | R1,10K,R_1206_3216Metric_Pad1.30x1.75mm_HandSolder,15.3,14.9,0.0,bottom 3 | R2,10K,R_1206_3216Metric_Pad1.30x1.75mm_HandSolder,18.9,12.4,0.0,bottom 4 | -------------------------------------------------------------------------------- /production_files/GERBER-pico-pi-base.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/production_files/GERBER-pico-pi-base.zip -------------------------------------------------------------------------------- /production_files/GERBER-pico-zero-base.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/production_files/GERBER-pico-zero-base.zip -------------------------------------------------------------------------------- /schematic-pi-base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/schematic-pi-base.png -------------------------------------------------------------------------------- /schematic-zero-base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bablokb/pcb-pico-pi-base/c7b344deec712b216c306b30abdc375ef8bc62e6/schematic-zero-base.png --------------------------------------------------------------------------------