[
  {
    "path": ".cargo/config.toml",
    "content": "#\n# Cargo Configuration for the https://github.com/rp-rs/rp-hal.git repository.\n#\n# Copyright (c) The RP-RS Developers, 2021\n#\n# You might want to make a similar file in your own repository if you are\n# writing programs for Raspberry Silicon microcontrollers.\n#\n# This file is MIT or Apache-2.0 as per the repository README.md file\n#\n\n[build]\n# Set the default target to match the Cortex-M0+ in the RP2040\ntarget = \"thumbv6m-none-eabi\"\n\n# Target specific options\n[target.thumbv6m-none-eabi]\n# Pass some extra options to rustc, some of which get passed on to the linker.\n#\n# * linker argument --nmagic turns off page alignment of sections (which saves\n#   flash space)\n# * linker argument -Tlink.x tells the linker to use link.x as the linker\n#   script. This is usually provided by the cortex-m-rt crate, and by default\n#   the version in that crate will include a file called `memory.x` which\n#   describes the particular memory layout for your specific chip. \n# * no-vectorize-loops turns off the loop vectorizer (seeing as the M0+ doesn't\n#   have SIMD)\nrustflags = [\n    \"-C\", \"link-arg=--nmagic\",\n    \"-C\", \"link-arg=-Tlink.x\",\n    \"-C\", \"no-vectorize-loops\",\n]\n\n# This runner will make a UF2 file and then copy it to a mounted RP2040 in USB\n# Bootloader mode:\nrunner = \"elf2uf2-rs -d\"\n\n# This runner will find a supported SWD debug probe and flash your RP2040 over\n# SWD:\n# runner = \"probe-rs run --chip RP2040\"\n"
  },
  {
    "path": ".github/workflows/build_and_test.yml",
    "content": "on: [push, pull_request]\nname: Build and Test check\njobs:\n  builds:\n    name: Build checks\n    runs-on: ubuntu-24.04\n    strategy:\n      matrix:\n        features: [\"--features rp2040-hal/rtic-monotonic\", \"--features rp2040-e5\"]\n        mode: [\"\", \"--release\"]\n    steps:\n      - uses: actions/checkout@v3\n      - uses: dtolnay/rust-toolchain@stable\n        with:\n          target: thumbv6m-none-eabi\n      - name: Build workspace\n        run: cargo build ${{ matrix.mode }} --workspace ${{ matrix.features }}\n      - name: Build workspace and examples\n        run: cargo build ${{ matrix.mode }} --workspace --examples ${{ matrix.features }}\n      - name: List built examples and clean\n        run: rm -vrf target/thumbv6m-none-eabi/*/examples/* | sed -e \"s/removed '\\(.*\\)'/\\1/\" | xargs -l basename | grep -Ev '(-|\\.d)'\n      - name: Test\n        run: cargo test --tests --target x86_64-unknown-linux-gnu ${{ matrix.features }}\n      - name: Test docs\n        run: cargo test --doc --target x86_64-unknown-linux-gnu ${{ matrix.features }}\n      - name: Clean\n        run: cargo clean\n  udeps:\n    name: Check rp2040-hal for unused dependencies\n    runs-on: ubuntu-24.04\n    steps:\n      - uses: actions/checkout@v3\n      - uses: dtolnay/rust-toolchain@master\n        with:\n          toolchain: nightly-2024-01-30\n          target: thumbv6m-none-eabi\n      - name: Install cargo-udeps\n        uses: baptiste0928/cargo-install@v2\n        with:\n          crate: cargo-udeps\n          version: \"=0.1.41\"\n      - name: Check unused deps\n        run: cargo udeps ${{ matrix.mode }} --workspace ${{ matrix.features }}\n"
  },
  {
    "path": ".github/workflows/clippy.yml",
    "content": "on: [push, pull_request]\nname: Clippy check\njobs:\n  clippy_check:\n    runs-on: ubuntu-24.04\n    env:\n      RUSTFLAGS: \"-D warnings\"\n    steps:\n      - uses: actions/checkout@v3\n      - uses: dtolnay/rust-toolchain@stable\n        with:\n          target: thumbv6m-none-eabi\n          components: clippy\n      - run: cargo clippy --workspace --examples --features rp2040-hal/rtic-monotonic -- -Dwarnings\n"
  },
  {
    "path": ".github/workflows/rustfmt.yml",
    "content": "on: [push, pull_request]\nname: Code formatting check\njobs:\n  fmt:\n    name: Rustfmt\n    runs-on: ubuntu-24.04\n    env:\n      RUSTFLAGS: \"-D warnings\"\n    steps:\n      - uses: actions/checkout@v3\n      - uses: dtolnay/rust-toolchain@stable\n        with:\n          target: thumbv6m-none-eabi\n          components: rustfmt\n      - run: cargo fmt -- --check\n"
  },
  {
    "path": ".gitignore",
    "content": ".idea/\ntarget\nCargo.lock\n.vscode\n*.orig\n*.raw\n"
  },
  {
    "path": "APACHE2.0",
    "content": "Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2021 rp-rs organization\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# The Rust Code of Conduct\n\n## Conduct\n\n**Contact**: [rp-rs team][team]\n\n* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.\n* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.\n* Please be kind and courteous. There's no need to be mean or rude.\n* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.\n* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.\n* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term \"harassment\" as including the definition in the [Citizen Code of Conduct](http://citizencodeofconduct.org/); if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.\n* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [rp-rs team][team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back.\n* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.\n\n## Moderation\n\nThese are the policies for upholding our community's standards of conduct.\n\n1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.)\n2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed.\n3. Moderators will first respond to such remarks with a warning.\n4. If the warning is unheeded, the user will be \"kicked,\" i.e., kicked out of the communication channel to cool off.\n5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.\n6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology.\n7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a different moderator, **in private**. Complaints about bans in-channel are not allowed.\n8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate situation, they should expect less leeway than others.\n\nIn the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely.\n\nAnd if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust.\n\nThe enforcement policies listed above apply to all official embedded rp-rs venues; including official Matrix channels (##rp-rs) and GitHub repositories under rp-rs.\n\n*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*\n\n*Text kindly borrowed from the Rust Embedded Working Group*\n\n[team]: https://github.com/orgs/rp-rs/teams/rp-rs\n"
  },
  {
    "path": "Cargo.toml",
    "content": "[workspace]\nresolver = \"2\"\nmembers = [\n    \"boards/adafruit-feather-rp2040\",\n    \"boards/adafruit-itsy-bitsy-rp2040\",\n    \"boards/adafruit-kb2040\",\n    \"boards/adafruit-macropad\",\n    \"boards/adafruit-metro-rp2040\",\n    \"boards/adafruit-qt-py-rp2040\",\n    \"boards/adafruit-trinkey-qt2040\",\n    \"boards/arduino_nano_connect\",\n    \"boards/boardsource-blok\",\n    \"boards/framework-ledmatrix\",\n    \"boards/framework16-keyboard\",\n    \"boards/pimoroni_badger2040\",\n    \"boards/pimoroni-pico-explorer\",\n    \"boards/pimoroni-pico-lipo-16mb\",\n    \"boards/pimoroni-plasma-2040\",\n    \"boards/pimoroni-servo2040\",\n    \"boards/pimoroni-tiny2040\",\n    \"boards/pimoroni-tufty2040\",\n    \"boards/rp-pico\",\n    \"boards/seeeduino-xiao-rp2040\",\n    \"boards/solderparty-rp2040-stamp\",\n    \"boards/sparkfun-micromod-rp2040\",\n    \"boards/sparkfun-pro-micro-rp2040\",\n    \"boards/sparkfun-thing-plus-rp2040\",\n    \"boards/vcc-gnd-yd-rp2040\",\n    \"boards/waveshare-rp2040-zero\",\n    \"boards/waveshare-rp2040-lcd-0-96\",\n\t\"boards/waveshare-rp2040-lcd-1-28\",\n]\n\n[workspace.dependencies]\narrayvec = { version = \"0.7.4\", default-features = false }\ncortex-m = \"0.7.7\"\ncortex-m-rt = \"0.7.3\"\ncortex-m-rtic = \"1.1.4\"\ncritical-section = \"1.1.2\"\ndefmt = \"0.3.5\"\ndefmt-rtt = \"0.4.0\"\ndisplay-interface = \"0.4.1\"\ndisplay-interface-spi = \"0.4.1\"\nembedded-graphics = \"0.7.1\"\nembedded-hal = \"1.0.0\"\nembedded-hal-nb = \"1.0.0\"\nembedded-sdmmc = \"0.5.0\"\nembedded_hal_0_2 = { package = \"embedded-hal\", version = \"0.2.5\", features = [\"unproven\", ] }\nfugit = \"0.3.7\"\nhd44780-driver = \"0.4.0\"\nheapless = \"0.7.16\"\ni2c-pio = \"0.8.0\"\nnb = \"1.1\"\npanic-halt= \"0.2.0\"\npanic-probe = \"0.3.1\"\npio = \"0.2.1\"\npio-proc = \"0.2.2\"\nrp2040-boot2 = \"0.3.0\"\nrp2040-hal = \"0.10.0\"\nst7789 = \"0.6.1\"\nst7735-lcd = \"0.8.1\"\nsmart-leds = \"0.3.0\"\nssd1306 = \"0.7.1\"\nusb-device = \"0.3.1\"\nusbd-hid = \"0.7.0\"\nusbd-serial = \"0.2.1\"\nws2812-pio = \"0.8.0\"\ngc9a01a_driver = \"0.1.3\"\n"
  },
  {
    "path": "MIT",
    "content": "MIT License\n\nCopyright (c) 2021 rp-rs organization\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "<!-- PROJECT LOGO -->\n<br />\n<p align=\"center\">\n  <a href=\"https://github.com/rp-rs/rp-hal-boards\">\n    <img src=\"https://www.svgrepo.com/show/281119/microchip.svg\" alt=\"Logo\" width=\"140\" height=\"140\">\n  </a>\n\n   <h3 align=\"center\">rp-hal-boards</h3>\n\n  <p align=\"center\">\n    Rust support for boards based on the \"Raspberry Silicon\" family of microcontrollers\n    <br />\n    <br />\n    <a href=\"https://github.com/rp-rs/rp-hal/\">rp2040-hal</a>\n    ·\n    <a href=\"https://github.com/rp-rs/rp-hal/issues\">Report a Bug</a>\n    ·\n    <a href=\"https://matrix.to/#/#rp-rs:matrix.org\">Chat on Matrix</a>\n  </p>\n</p>\n\n\n<!-- TABLE OF CONTENTS -->\n<details open=\"open\">\n  <summary><h2 style=\"display: inline-block\">Table of Contents</h2></summary>\n  <ol>\n    <li><a href=\"#gettting_started\">Getting Started</a></li>\n    <li><a href=\"#programming\">Programming</a></li>\n    <li><a href=\"#roadmap\">Roadmap</a></li>\n    <li><a href=\"#contributing\">Contributing</a></li>\n    <li><a href=\"#license\">License</a></li>\n    <li><a href=\"#contact\">Contact</a></li>\n    <li><a href=\"#acknowledgements\">Acknowledgements</a></li>\n  </ol>\n</details>\n\n<!-- GETTING STARTED -->\n\n## Getting Started\n\nSo, you want to program your new Raspberry Silicon microcontroller, using the\nRust programming language. You've come to the right place!\n\nThese board support packages are based on\n[`rp-hal`](https://github.com/rp-rs/rp-hal) - a collection of high-level\ndrivers for the Raspberry Silicon RP2040 microcontroller and various\nassociated boards, like the Raspberry Pi Pico and the Adafruit Feather\nRP2040.\n\nIf you want to write an application for Raspberry Silicon, check out our\n[RP2040 Project Template](https://github.com/rp-rs/rp2040-project-template).\n\nIf you want to try out some examples on one of our supported boards, check out\nthe list of *Board Support Packages* below, and click through to see the various\nexamples for each board.\n\nBefore trying any of the examples, please ensure you have the latest stable\nversion of Rust installed, along with the right target support:\n\n```sh\nrustup self update\nrustup update stable\nrustup target add thumbv6m-none-eabi\n```\n\nYou may also want to install these helpful tools:\n\n```sh\n# Useful to creating UF2 images for the RP2040 USB Bootloader\ncargo install --locked elf2uf2-rs\n# Useful for flashing over the SWD pins using a supported JTAG probe\ncargo install --locked probe-rs-tools\n```\n\n## Packages\n\nThis git repository is organised as a [Cargo Workspace].\n\nIf you are writing code that should work on any RP2040 device, use\nthe [HAL crate]. If you are running code on a specific board, use\nthe appropriate _BSP_ crate (which will include the _HAL_ crate for\nyou). Please note, you cannot depend on multiple _BSP_ crates; you have\nto pick one, or use [Cargo Features] to select one at build time.\n\nEach BSP includes some examples to show off the features of that particular board.\n\n[HAL crate]: https://github.com/rp-rs/rp-hal\n[Cargo Workspace]: https://doc.rust-lang.org/cargo/reference/workspaces.html\n[Embedded HAL]: https://github.com/rust-embedded/embedded-hal\n[Cargo Features]: https://doc.rust-lang.org/cargo/reference/features.html\n[rp2040-hal]: https://crates.io/crates/rp2040-hal\n\n### [rp-pico] - Board Support for the [Raspberry Pi Pico]\n\nYou should include this crate if you are writing code that you want to run on\na [Raspberry Pi Pico] - the original launch PCB for the RP2040 chip.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Pico.\n\n[Raspberry Pi Pico]: https://www.raspberrypi.org/products/raspberry-pi-pico/\n[rp-pico]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/rp-pico\n\n### [adafruit-feather-rp2040] - Board Support for the [Adafruit Feather RP2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit Feather RP2040] - a Feather form-factor RP2040 board from Adafruit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Feather RP2040.\n\n[Adafruit Feather RP2040]: https://www.adafruit.com/product/4884\n[adafruit-feather-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-feather-rp2040\n\n### [adafruit-itsy-bitsy-rp2040] - Board Support for the [Adafruit ItsyBitsy RP2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit ItsyBitsy RP2040] - an RP2040 board in the ItsyBitsy family.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the ItsyBitsy RP2040.\n\n[Adafruit ItsyBitsy RP2040]: https://www.adafruit.com/product/4888\n[adafruit-itsy-bitsy-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-itsy-bitsy-rp2040\n\n### [adafruit-kb2040] - Board Support for the [Adafruit KB2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit KB2040] - an Arduino Pro Micro-shaped board for keyboards.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the KB2040.\n\n[Adafruit KB2040]: https://www.adafruit.com/product/5302\n[adafruit-kb2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-kb2040\n\n### [adafruit-macropad] - Board Support for the [Adafruit Macropad]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit Macropad] - a 3x4 keyboard and OLED combo board from Adafruit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Macropad.\n\n[adafruit-macropad]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-macropad\n[Adafruit Macropad]: https://www.adafruit.com/product/5128\n\n### [adafruit-metro-rp2040] - Board Support for the [Adafruit Metro RP2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit Metro RP2040] - an RP2040 board in the Metro family.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Metro RP2040.\n\n[Adafruit Metro RP2040]: https://www.adafruit.com/product/5786\n[adafruit-metro-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-metro-rp2040\n\n### [adafruit-qt-py-rp2040] - Board Support for the [Adafruit QT Py RP2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit QT Py RP2040] - an extremely small form-factor RP2040 board from Adafruit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Feather RP2040.\n\n[Adafruit QT Py RP2040]: https://www.adafruit.com/product/4900\n[adafruit-qt-py-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-qt-py-rp2040\n\n### [adafruit-trinkey-qt2040] - Board Support for the [Adafruit Trinkey QT2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit Trinkey QT2040] - a 3x4 keyboard and OLED combo board from Adafruit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Trinkey.\n\n[Adafruit-Trinkey-QT2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-trinkey-qt2040\n[adafruit trinkey qt2040]: https://www.adafruit.com/product/5056\n\n### [boardsource-blok] - Board Support for the [Blok]\n\nYou should include this crate if you are writing code that you want to run on\na [Blok] - an RP2040 based controller, made by [Boardsource],\nbuilt for the keyboard community.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Blok.\n\n[Blok]: https://boardsource.xyz/store/628b95b494dfa308a6581622\n[boardsource-blok]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/boardsource-blok\n[Boardsource]: https://boardsource.xyz/\n\n### [pimoroni_badger2040] - Board Support for the [Pimoroni Badger2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Badger2040] - a conference-style badge built around an e-paper\ndisplay and an rp2040\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Badger2040.\n\n[Pimoroni Badger2040]: https://shop.pimoroni.com/products/badger-2040\n[pimoroni_badger2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni_badger2040\n\n### [pimoroni-pico-explorer] - Board Support for the [Pimoroni Pico Explorer]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Pico Explorer] - a breakout board for the [Raspberry Pi Pico] featuring a small LCD screen, a\nbreadboard and some breakout headers.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Pico Explorer.\n\n[Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pimoroni-pico-explorer-base\n[pimoroni-pico-explorer]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-pico-explorer\n\n### [pimoroni-pico-lipo-16mb] - Board Support for the [Pimoroni Pico Lipo 16MB]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Pico Lipo 16MB] - a board with USB-C, STEMMA QT/Qwiic connectors,\nplus a Li-Po battery charging circuit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Pico Lipo.\n\nNote that if you use this crate the compiler will expect the full 16MB flash\nspace, and so it may not work if you only have the 4MB variant.\n\n[Pimoroni Pico Lipo 16MB]: https://shop.pimoroni.com/products/pimoroni-pico-lipo?variant=39335427080275\n[pimoroni-pico-lipo-16mb]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-pico-lipo-16mb\n\n### [pimoroni-plasma-2040] - Board Support for the [Pimoroni Plasma 2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Plasma 2040] - Swathe everything in rainbows with this all-in-one, USB-C powered controller\nfor WS2812/Neopixel and APA102/Dotstar addressable LED strip.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Pimoroni Plasma 2040.\n\n[Pimoroni Plasma 2040]: https://shop.pimoroni.com/products/plasma-2040\n[pimoroni-plasma-2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-plasma-2040\n\n### [pimoroni-servo2040] - Board Support for the [Pimoroni Servo2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Servo2040] - a standalone servo motor controller for up to 18 servos\nand 6 sensors.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Servo2040.\n\n[Pimoroni Servo2040]: https://shop.pimoroni.com/products/servo-2040\n[pimoroni-servo2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-servo2040\n\n### [pimoroni-tiny2040] - Board Support for the [Pimoroni Tiny2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Tiny2040] - one of the first third party RP2040 boards available, with 8MB flash and a 3 colour LED.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Tiny2040.\n\n[Pimoroni Tiny2040]: https://shop.pimoroni.com/products/tiny-2040\n[pimoroni-tiny2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-tiny2040\n\n### [solderparty-rp2040-stamp] - Board Support for the [SolderParty RP2040 Stamp]\n\nYou should include this crate if you are writing code that you want to run on\na [SolderParty RP2040 Stamp] - a square RP2040 board with castellated edges.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Stamp.\n\n[SolderParty RP2040 Stamp]: https://www.solder.party/docs/rp2040-stamp/\n[solderparty-rp2040-stamp]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/solderparty-rp2040-stamp\n\n### [sparkfun-micromod-rp2040] - Board Support for the [SparkFun MicroMod RP2040]\n\nYou should include this crate if you are writing code that you want to run on\na [SparkFun MicroMod RP2040] - the RP2040 processor board for the [SparkFun MicroMod] ecosystem.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the MicroMod RP2040.\n\n[SparkFun MicroMod RP2040]: https://www.sparkfun.com/products/17720\n[SparkFun MicroMod]: https://www.sparkfun.com/micromod\n[sparkfun-micromod-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-micromod-rp2040\n\n### [sparkfun-pro-micro-rp2040] - Board Support for the [Sparkfun Pro Micro RP2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Sparkfun Pro Micro RP2040] - a smaller RP2040 board with USB-C and a WS2812B addressable LED.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Pro Micro RP2040.\n\n[Sparkfun Pro Micro RP2040]: https://www.sparkfun.com/products/18288\n[sparkfun-pro-micro-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-pro-micro-rp2040\n\n### [sparkfun-thing-plus-rp2040] - Board Support for the [Sparkfun Thing Plus RP2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Sparkfun Thing Plus RP2040] - an RP2040 board with a Feather form factor, USB-C, and a WS2812B addressable LED.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Thing Plus RP2040.\n\n[Sparkfun Thing Plus RP2040]: https://www.sparkfun.com/products/17745\n[sparkfun-thing-plus-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-thing-plus-rp2040\n\n### [arduino_nano_connect] - Board Support for the [Arduino Nano RP2040 Connect]\n\nYou should include this crate if you are writing code that you want to run on\nan [Arduino Nano RP2040 Connect] - a development pcb with shortwave communication, IMU, and BLE package.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the nano connect.\n\n[Arduino Nano RP2040 Connect]: https://store-usa.arduino.cc/collections/boards/products/arduino-nano-rp2040-connect\n[arduino_nano_connect]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/arduino_nano_connect\n\n### [seeeduino-xiao-rp2040] - Board Support for the [Seeeduino XIAO RP2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Seeeduino XIAO RP2040] - a tiny board for wearable devices and small\nprojects.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the XIAO RP2040.\n\n[Seeeduino XIAO RP2040]: https://www.seeedstudio.com/XIAO-RP2040-v1-0-p-5026.html\n[seeeduino-xiao-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/seeeduino-xiao-rp2040\n\n### [vcc-gnd-yd-rp2040] - Board Support for the [VCC-GND Studio YD-RP2040]\n\nYou should include this crate if you are writing code that you want to run on\na [VCC-GND Studio YD-RP2040] - a PCB for the RP2040 chip with USB-C port, WS2812 RGB LED on GPIO23, user key on GPIO24 and built-in blue LED.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the YD-RP2040.\n\n[VCC-GND Studio YD-RP2040]: http://152.32.187.208:8080/yd-data/YD-RP2040/\n[vcc-gnd-yd-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/vcc-gnd-yd-rp2040\n\n### [waveshare-rp2040-zero] - Board Support for the [Waveshare RP2040 Zero]\n\nYou should include this crate if you are writing code that you want to run on\nan [Waveshare RP2040 Zero] - a very small RP2040 breakout board with USB-C and a RGB led from Waveshare.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the board.\n\n[Waveshare RP2040 Zero]: https://www.waveshare.com/wiki/RP2040-Zero\n[waveshare-rp2040-zero]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/waveshare-rp2040-zero\n\n### [waveshare-rp2040-lcd-0_96] - Board Support for the [Waveshare RP2040 LCD 0.96\"]\n\nYou should include this crate if you are writing code that you want to run on\nan [Waveshare RP2040 LCD 0.96\"] - a very small RP2040 breakout board with USB-C,\na 65K IPS LCD 160x80, 16MBit Flash and 1A battery charger from Waveshare.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the board.\n\n[Waveshare RP2040 LCD 0.96\"]: https://www.waveshare.com/wiki/RP2040-LCD-0.96\n[waveshare-rp2040-lcd-0_96]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/waveshare-rp2040-lcd-0-96\n\n<!-- PROGRAMMING -->\n## Programming\n\nRust generates standard Arm ELF files, which you can load onto your Raspberry Pi\nSilicon device with your favourite Arm flashing/debugging tool. In addition, the\nRP2040 contains a ROM bootloader which appears as a Mass Storage Device over USB\nthat accepts UF2 format images. You can use the `elf2uf2-rs` package to convert\nthe Arm ELF file to a UF2 format image.\n\nFor boards with USB Device support like the Raspberry Pi Pico, we recommend you\nuse the UF2 process.\n\nThe RP2040 contains two Cortex-M0+ processors, which execute Thumb-2 encoded\nARMv6-M instructions. There are no operating-specific features in the binaries\nproduced - they are for 'bare-metal' systems. For compatibilty with other Arm\ncode (e.g. as produced by GCC), Rust uses the *Arm Embedded-Application Binary\nInterface* standard or EABI. Therefore, any Rust code for the RP2040 should be\ncompiled with the target *`thumbv6m-none-eabi`*.\n\nMore details can be found in the [Project Template](https://github.com/rp-rs/rp2040-project-template).\n\n### Loading a UF2 over USB\n\n*Step 1* - Install [`elf2uf2-rs`](https://github.com/JoNil/elf2uf2-rs):\n\n```console\n$ cargo install elf2uf2-rs --locked\n```\n\n*Step 2* - Make sure your .cargo/config.toml contains the following (it should by\ndefault if you are working in this repository):\n\n```toml\n[target.thumbv6m-none-eabi]\nrunner = \"elf2uf2-rs -d\"\n```\n\nThe `thumbv6m-none-eabi` target may be replaced by the all-Arm wildcard\n`'cfg(all(target_arch = \"arm\", target_os = \"none\"))'`.\n\n*Step 3* - Boot your RP2040 into \"USB Bootloader mode\", typically by rebooting\nwhilst holding some kind of \"Boot Select\" button. On Linux, you will also need\nto 'mount' the device, like you would a USB Thumb Drive.\n\n*Step 4* - Use `cargo run`, which will compile the code and started the\nspecified 'runner'. As the 'runner' is the elf2uf2-rs tool, it will build a UF2\nfile and copy it to your RP2040.\n\n```console\n$ cargo run --release --example pico_pwm_blink\n```\n\n### Loading with probe-rs\n[probe-rs](https://github.com/probe-rs/probe-rs) is a library and a\ncommand-line tool which can flash a wide variety of microcontrollers\nusing a wide variety of debug/JTAG probes. Unlike using, say, OpenOCD,\nprobe-rs can autodetect your debug probe, which can make it easier to use.\n\n*Step 1* - Install `probe-rs`:\n\n```console\n$ cargo install --locked probe-rs-tools\n```\n\nAlternatively, follow the installation instructions on https://probe.rs/.\n\n*Step 2* - Make sure your .cargo/config.toml contains the following:\n\n```toml\n[target.thumbv6m-none-eabi]\nrunner = \"probe-rs run --chip RP2040\"\n```\n\n*Step 3* - Connect your USB JTAG/debug probe (such as a Raspberry Pi Pico\nrunning [this firmware](https://github.com/majbthrd/DapperMime)) to the SWD\nprogramming pins on your RP2040 board. Check the probe has been found by\nrunning:\n\n```console\n$ probe-rs list\nThe following debug probes were found:\n[0]: J-Link (J-Link) (VID: 1366, PID: 0101, Serial: 000099999999, JLink)\n```\n\nThere is a SEGGER J-Link connected in the example above - the mesage you see\nwill reflect the probe you have connected.\n\n*Step 4* - Use `cargo run`, which will compile the code and start the specified\n'runner'. As the 'runner' is the `probe-rs` tool, it will connect to the\nRP2040 via the first probe it finds, and install your firmware into the Flash\nconnected to the RP2040.\n\n```console\n$ cargo run --release --example pico_pwm_blink\n```\n\n### Loading with picotool\n\nAs ELF files produced by compiling Rust code are completely compatible with ELF\nfiles produced by compiling C or C++ code, you can also use the Raspberry Pi\ntool [picotool](https://github.com/raspberrypi/picotool). The only thing to be\naware of is that picotool expects your ELF files to have a `.elf` extension, and\nby default Rust does not give the ELF files any extension. You can fix this by\nsimply renaming the file.\n\nAlso of note is that the special\n[pico-sdk](https://github.com/raspberrypi/pico-sdk) macros which hide\ninformation in the ELF file in a way that `picotool info` can read it out, are\nnot supported in Rust. An alternative is TBC.\n\n<!-- ROADMAP -->\n## Roadmap\n\nNOTE These packages are under active development. As such, it is likely to\nremain volatile until a 1.0.0 release.\n\nSee the [open issues](https://github.com/rp-rs/rp-hal/issues) for a list of\nproposed features (and known issues).\n\n<!-- CONTRIBUTING -->\n## Contributing\n\nContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n<!-- CODE OF CONDUCT -->\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n<!-- LICENSE -->\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n\n<!-- CONTACT -->\n## Contact\n\nRaise an issue: [https://github.com/rp-rs/rp-hal-boards/issues](https://github.com/rp-rs/rp-hal-boards/issues)\nChat to us on Matrix: [#rp-rs:matrix.org](https://matrix.to/#/#rp-rs:matrix.org)\n\n<!-- ACKNOWLEDGEMENTS -->\n## Acknowledgements\n\n* [Othneil Drew's README template](https://github.com/othneildrew)\n* [Rust Embedded Working Group](https://github.com/rust-embedded)\n* [Raspberry Pi](https://raspberrypi.org) and the [Pico SDK](https://github.com/raspberrypi/pico-sdk)\n"
  },
  {
    "path": "boards/adafruit-feather-rp2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.8.0 - 2024-04-07\n\n### Changed\n\n- Update to embedded-hal 1.0.0\n- Update to rp2040-hal 0.10.0\n\n## 0.7.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.6.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.6.0\n\n## 0.5.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.4.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Bump `ws2812-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n## 0.3.0 - 2022-06-13\n\n### Changed\n\n- Update to rp2040-hal 0.5.0\n\n## 0.2.0 - 2022-03-11\n\n### Changed\n\n- Update to rp2040-hal 0.4.0\n\n## 0.1.0 - 2021-12-20\n\n- Initial release\n\n"
  },
  {
    "path": "boards/adafruit-feather-rp2040/Cargo.toml",
    "content": "[package]\nname = \"adafruit-feather-rp2040\"\nversion = \"0.8.0\"\nauthors = [\"Andrea Nall <anall@andreanal.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-feather-rp2040\"\ndescription = \"Board Support Package for the Adafruit Feather RP2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\npanic-halt.workspace = true\nembedded-hal.workspace = true\nfugit.workspace = true\nnb.workspace = true\nsmart-leds.workspace = true\nws2812-pio.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/adafruit-feather-rp2040/README.md",
    "content": "# [adafruit-feather-rp2040] - Board Support for the [Adafruit Feather RP2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit Feather RP2040] - a Feather form-factor RP2040 board from Adafruit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Feather.\n\n[Adafruit Feather RP2040]: https://www.adafruit.com/product/4884\n[adafruit-feather-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-feather-rp2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nadafruit-feather-rp2040 = \"0.8.0\"\n```\n\nIn your program, you will need to call `adafruit_feather_rp2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/adafruit-feather-rp2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/adafruit-feather-rp2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [adafruit_feather_blinky](./examples/adafruit_feather_blinky.rs)\n\nFlashes the Feather's onboard LED on and off.\n\n### [adafruit_feather_neopixel_rainbow](./examples/adafruit_feather_neopixel_rainbow.rs)\n\nFlows smoothly through various colors on the Feather's onboard NeoPixel LED.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe, learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs",
    "content": "//! Blinks the LED on a Adafruit Feather RP2040 board\n//!\n//! This will blink on-board LED.\n#![no_std]\n#![no_main]\n\nuse adafruit_feather_rp2040::entry;\nuse adafruit_feather_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\nuse embedded_hal::digital::OutputPin;\nuse panic_halt as _;\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n    let mut led_pin = pins.d13.into_push_pull_output();\n\n    loop {\n        led_pin.set_high().unwrap();\n        delay.delay_ms(1500);\n        led_pin.set_low().unwrap();\n        delay.delay_ms(1500);\n    }\n}\n"
  },
  {
    "path": "boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs",
    "content": "//! Rainbow effect color wheel using the onboard NeoPixel on an Adafruit Feather RP2040 board\n//!\n//! This flows smoothly through various colors on the onboard NeoPixel.\n//! Uses the `ws2812_pio` driver to control the NeoPixel, which in turns uses the\n//! RP2040's PIO block.\n#![no_std]\n#![no_main]\n\nuse adafruit_feather_rp2040::entry;\nuse adafruit_feather_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse ws2812_pio::Ws2812;\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        // The onboard NeoPixel is attached to GPIO pin #16 on the Feather RP2040.\n        pins.neopixel.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite colour wheel loop\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/adafruit-feather-rp2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_GD25Q64CS;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio0 {\n        name: tx,\n        aliases: { FunctionUart, PullNone: UartTx }\n    },\n    Gpio1 {\n        name: rx,\n        aliases: { FunctionUart, PullNone: UartRx }\n    },\n    Gpio2 {\n        name: sda,\n        aliases: { FunctionI2C, PullUp: Sda }\n    },\n    Gpio3 {\n        name: scl,\n        aliases: { FunctionI2C, PullUp: Scl }\n    },\n    Gpio6 { name: d4 },\n    Gpio7 { name: d5 },\n    Gpio8 { name: d6 },\n    Gpio9 { name: d9 },\n    Gpio10 { name: d10 },\n    Gpio11 { name: d11 },\n    Gpio12 { name: d12 },\n    Gpio13 { name: d13 },\n    Gpio16 { name: neopixel },\n    Gpio18 {\n        name: sclk,\n        aliases: { FunctionSpi, PullNone: Sclk }\n    },\n    Gpio19 {\n        name: mosi,\n        aliases: { FunctionSpi, PullNone: Mosi }\n    },\n    Gpio20 {\n        name: miso,\n        aliases: { FunctionSpi, PullNone: Miso }\n    },\n    Gpio24 { name: d24 },\n    Gpio25 { name: d25 },\n    Gpio26 { name: a0 },\n    Gpio27 { name: a1 },\n    Gpio28 { name: a2 },\n    Gpio29 { name: a3 },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/adafruit-itsy-bitsy-rp2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.8.0 - 2024-04-07\n\n### Changed\n\n- Update to embedded-hal 1.0.0\n- Update to rp2040-hal 0.10.0\n\n## 0.7.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.6.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n\n## 0.5.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.4.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Bump `ws2812-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n## 0.3.0 - 2022-06-13\n\n### Changed\n\n- Update to rp2040-hal 0.5.0\n\n## 0.2.0 - 2022-03-11\n\n### Changed\n\n- Update to rp2040-hal 0.4.0\n\n## 0.1.0 - 2021-12-20\n\n- Initial release\n\n"
  },
  {
    "path": "boards/adafruit-itsy-bitsy-rp2040/Cargo.toml",
    "content": "[package]\nname = \"adafruit-itsy-bitsy-rp2040\"\nversion = \"0.8.0\"\nauthors = [\"Andrew Christiansen <andrewtaylorchristiansen@gmail.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit_itsy_bitsy_rp2040\"\ndescription = \"Board Support Package for the Adafruit ItsyBitsy RP2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\npanic-halt.workspace = true\nembedded-hal.workspace = true\nsmart-leds.workspace = true\nnb.workspace = true\nws2812-pio.workspace = true\nfugit.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/adafruit-itsy-bitsy-rp2040/README.md",
    "content": "# [adafruit-itsy-bitsy-rp2040] - Board Support for the [Adafruit ItsyBitsy RP2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit ItsyBitsy RP2040] - an RP2040 board in the Itsy family from Adafruit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the ItsyBitsy RP2040.\n\n[Adafruit ItsyBitsy RP2040]: https://www.adafruit.com/product/4888\n[adafruit-itsy-bitsy-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-itsy-bitsy-rp2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nadafruit-itsy-bitsy-rp2040 = \"0.8.0\"\n```\n\nIn your program, you will need to call `adafruit_itsy_bitsy_rp2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/adafruit-itsy-bitsy-rp2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/adafruit-itsy-bitsy-rp2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [adafruit_itsy_bitsy_blinky](./examples/adafruit_itsy_bitsy_blinky.rs)\n\nBlink an LED on and off.\n\n### [adafruit_itsy_bitsy_rainbow](./examples/adafruit_itsy_bitsy_rainbow.rs)\n\nContinuously changes the color of the ItsyBitsy's onboard Neopixel.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs",
    "content": "//! # GPIO 'Blinky' Example\n//!\n//! Blinks the LED on a Adafruit itsy-bitsy RP2040 board\n//!\n//! It may need to be adapted to your particular board layout and/or pin assignment.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse adafruit_itsy_bitsy_rp2040::entry;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Some traits we need\nuse embedded_hal::digital::OutputPin;\n\nuse adafruit_itsy_bitsy_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        sio::Sio,\n        watchdog::Watchdog,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\n\nuse cortex_m::delay::Delay;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then toggles a GPIO pin in\n/// an infinite loop. If there is an LED connected to that pin, it will blink.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = Sio::new(pac.SIO);\n\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n    let mut led_pin = pins.d13.into_push_pull_output();\n\n    loop {\n        led_pin.set_high().unwrap();\n        delay.delay_ms(500);\n        led_pin.set_low().unwrap();\n        delay.delay_ms(500);\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs",
    "content": "//! Continuously changes the color of the Neopixel on a Adafruit ItsyBitsy RP2040 board\n#![no_std]\n#![no_main]\n\nuse adafruit_itsy_bitsy_rp2040::entry;\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse ws2812_pio::Ws2812;\n\nuse adafruit_itsy_bitsy_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        gpio::PinState,\n        pac,\n        pio::PIOExt,\n        watchdog::Watchdog,\n        Sio, Timer,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let led = pins.neopixel_data.into_function();\n\n    pins.neopixel_power\n        .into_push_pull_output_in_state(PinState::High);\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        led,\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/adafruit-itsy-bitsy-rp2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio0 {\n        name: tx,\n        aliases: { FunctionUart, PullNone: UartTx }\n    },\n    Gpio1 {\n        name: rx,\n        aliases: { FunctionUart, PullNone: UartRx }\n    },\n    Gpio2 {\n        name: sda,\n        aliases: { FunctionI2C, PullUp: Sda }\n    },\n    Gpio3 {\n        name: scl,\n        aliases: { FunctionI2C, PullUp: Scl }\n    },\n    Gpio4 { name: d4 },\n    Gpio5 { name: d3 },\n    Gpio6 { name: d7 },\n    Gpio7 { name: d9 },\n    Gpio8 { name: d10 },\n    Gpio9 { name: d11 },\n    Gpio10 { name: d12 },\n    Gpio11 { name: d13 },\n    Gpio12 { name: d2 },\n    Gpio14 { name: d5 },\n    Gpio16 { name: neopixel_power },\n    Gpio17 { name: neopixel_data },\n    Gpio18 {\n        name: sclk,\n        aliases: { FunctionSpi, PullNone: Sclk }\n    },\n    Gpio19 {\n        name: mosi,\n        aliases: { FunctionSpi, PullNone: Mosi }\n    },\n    Gpio20 {\n        name: miso\n        aliases: { FunctionSpi, PullNone: Miso }\n    },\n    Gpio24 { name: d24 },\n    Gpio25 { name: d25 },\n    Gpio26 { name: a0 },\n    Gpio27 { name: a1 },\n    Gpio28 { name: a2 },\n    Gpio29 { name: a3 },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/adafruit-kb2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.8.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.7.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.6.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n\n## 0.5.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.4.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Bump `ws2812-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n## 0.3.0 - 2022-06-13\n\n### Changed\n\n- Update to rp2040-hal 0.5.0\n\n## 0.2.0 - 2022-03-11\n\n### Changed\n\n- Update to rp2040-hal 0.4.0\n\n## 0.1.0 - 2021-12-20\n\n- Initial release\n\n"
  },
  {
    "path": "boards/adafruit-kb2040/Cargo.toml",
    "content": "[package]\nname = \"adafruit-kb2040\"\nversion = \"0.8.0\"\nauthors = [\"Andrew Christiansen <andrewtaylorchristiansen@gmail.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-kb2040\"\ndescription = \"Board Support Package for the Adafruit KB2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nembedded-hal = { workspace = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\nembedded-hal.workspace = true\nheapless.workspace = true\nfugit.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\nsmart-leds.workspace = true\nws2812-pio.workspace = true\nusb-device.workspace = true\nusbd-serial.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/adafruit-kb2040/README.md",
    "content": "# [adafruit-kb2040] - Board Support for the [Adafruit KB2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Adafruit KB2040] - an Arduino Pro Micro-shaped board for keyboards.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the KB2040.\n\n[Adafruit KB2040]: https://www.adafruit.com/product/5302\n[adafruit-kb2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-kb2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nadafruit-kb2040 = \"0.8.0\"\n```\n\nIn your program, you will need to call `adafruit-kb2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/adafruit-kb2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/adafruit-kb2040$ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [Rainbow](./examples/adafruit_kb2040_rainbow.rs)\n\nThis example will display a colour-wheel rainbow effect on the on-board LED.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs",
    "content": "//! # Rainbow Example for the Adafruit KB2040\n//!\n//! Runs a rainbow-effect colour wheel on the on-board LED.\n//!\n//! Uses the `ws2812_pio` driver to control the LED, which in turns uses the\n//! RP2040's PIO block.\n\n#![no_std]\n#![no_main]\n\nuse adafruit_kb2040::entry;\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\n\nuse adafruit_kb2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    XOSC_CRYSTAL_FREQ,\n};\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse ws2812_pio::Ws2812;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this\n/// function as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then the LED, then runs\n/// the colour wheel in an infinite loop.\n#[entry]\nfn main() -> ! {\n    // Configure the RP2040 peripherals\n\n    let mut pac = pac::Peripherals::take().unwrap();\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n\n    let pins = adafruit_kb2040::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n\n    let mut ws = Ws2812::new(\n        pins.neopixel.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite colour wheel loop\n\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/adafruit-kb2040/examples/adafruit_kb2040_usb_serial.rs",
    "content": "//! # Pico USB Serial Example\n//!\n//! Creates a USB Serial device on a Pico board, with the USB driver running in\n//! the main thread.\n//!\n//! This will create a USB Serial device echoing anything it receives. Incoming\n//! ASCII characters are converted to upercase, so you can tell it is working\n//! and not just local-echo!\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\nuse adafruit_kb2040 as bsp;\n\n// The macro for our start-up function\nuse bsp::entry;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse bsp::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse bsp::hal;\n\n// USB Device support\nuse usb_device::{class_prelude::*, prelude::*};\n\n// USB Communications Class Device support\nuse usbd_serial::SerialPort;\n\n// Used to demonstrate writing formatted strings\nuse core::fmt::Write;\nuse heapless::String;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then echoes any characters\n/// received over USB Serial.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        bsp::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    #[cfg(feature = \"rp2040-e5\")]\n    {\n        let sio = hal::Sio::new(pac.SIO);\n        let _pins = bsp::Pins::new(\n            pac.IO_BANK0,\n            pac.PADS_BANK0,\n            sio.gpio_bank0,\n            &mut pac.RESETS,\n        );\n    }\n\n    // Set up the USB driver\n    let usb_bus = UsbBusAllocator::new(hal::usb::UsbBus::new(\n        pac.USBCTRL_REGS,\n        pac.USBCTRL_DPRAM,\n        clocks.usb_clock,\n        true,\n        &mut pac.RESETS,\n    ));\n\n    // Set up the USB Communications Class Device driver\n    let mut serial = SerialPort::new(&usb_bus);\n\n    // Create a USB device with a fake VID and PID\n    let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))\n        .strings(&[StringDescriptors::default()\n            .manufacturer(\"Fake company\")\n            .product(\"Serial port\")\n            .serial_number(\"TEST\")])\n        .unwrap()\n        .device_class(2) // from: https://www.usb.org/defined-class-codes\n        .build();\n\n    let mut said_hello = false;\n    loop {\n        // A welcome message at the beginning\n        if !said_hello && timer.get_counter().ticks() >= 2_000_000 {\n            said_hello = true;\n            let _ = serial.write(b\"Hello, World!\\r\\n\");\n\n            let time = timer.get_counter().ticks();\n            let mut text: String<64> = String::new();\n            writeln!(&mut text, \"Current timer ticks: {}\", time).unwrap();\n\n            // This only works reliably because the number of bytes written to\n            // the serial port is smaller than the buffers available to the USB\n            // peripheral. In general, the return value should be handled, so that\n            // bytes not transferred yet don't get lost.\n            let _ = serial.write(text.as_bytes());\n        }\n\n        // Check for new data\n        if usb_dev.poll(&mut [&mut serial]) {\n            let mut buf = [0u8; 64];\n            match serial.read(&mut buf) {\n                Err(_e) => {\n                    // Do nothing\n                }\n                Ok(0) => {\n                    // Do nothing\n                }\n                Ok(count) => {\n                    // Convert to upper case\n                    buf.iter_mut().take(count).for_each(|b| {\n                        b.make_ascii_uppercase();\n                    });\n                    // Send back to the host\n                    let mut wr_ptr = &buf[..count];\n                    while !wr_ptr.is_empty() {\n                        match serial.write(wr_ptr) {\n                            Ok(len) => wr_ptr = &wr_ptr[len..],\n                            // On error, just drop unwritten data.\n                            // One possible error is Err(WouldBlock), meaning the USB\n                            // write buffer is full.\n                            Err(_) => break,\n                        };\n                    }\n                }\n            }\n        }\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/adafruit-kb2040/src/lib.rs",
    "content": "#![no_std]\n\npub use rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio0 {\n        name: tx,\n        aliases: { FunctionUart, PullNone: UartTx }\n    },\n    Gpio1 {\n        name: rx,\n        aliases: { FunctionUart, PullNone: UartRx }\n    },\n    Gpio2 { name: d2 },\n    Gpio3 { name: d3 },\n    Gpio4 { name: d4 },\n    Gpio5 { name: d5 },\n    Gpio6 { name: d6 },\n    Gpio7 { name: d7 },\n    Gpio8 { name: d8 },\n    Gpio9 { name: d9 },\n    Gpio10 { name: d10 },\n    Gpio11 { name: d11 },\n    Gpio12 {\n        name: sda,\n        aliases: { FunctionI2C, PullNone: Sda }\n    },\n    Gpio13 {\n        name: scl,\n        aliases: { FunctionI2C, PullNone: Scl }\n    },\n    Gpio17 { name: neopixel },\n    Gpio18 {\n        name: sclk,\n        aliases: { FunctionSpi, PullNone: Sclk }\n    },\n    Gpio19 {\n        name: mosi,\n        aliases: { FunctionSpi, PullNone: Mosi }\n    },\n    Gpio20 {\n        name: miso,\n        aliases: { FunctionSpi, PullNone: Miso }\n    },\n    Gpio26 { name: a0 },\n    Gpio27 { name: a1 },\n    Gpio28 { name: a2 },\n    Gpio29 { name: a3 },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/adafruit-macropad/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.8.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.7.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n\n## 0.6.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n\n## 0.5.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n\n## 0.4.0 - 2022-08-26\n\n### Changed\n\n- Use `rp2040-hal`'s entry function.\n- Migrate from `embedded-time` to `fugit`\n- Update to rp2040-hal 0.6.0\n\n## 0.3.0 - 2022-06-13\n\n### Changed\n\n- Update to rp2040-hal 0.5.0\n\n## 0.2.0 - 2022-03-11\n\n### Changed\n\n- Update to rp2040-hal 0.4.0\n\n## 0.1.0 - 2021-12-20\n\n- Initial release\n\n"
  },
  {
    "path": "boards/adafruit-macropad/Cargo.toml",
    "content": "[package]\nname = \"adafruit-macropad\"\nversion = \"0.8.0\"\nauthors = [\"Andrea Nall <anall@andreanal.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit_macropad\"\ndescription = \"Board Support Package for the Adafruit Macropad\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\nembedded-hal.workspace = true\npanic-halt.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/adafruit-macropad/README.md",
    "content": "# [adafruit-macropad] - Board Support for the [Adafruit Macropad]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit Macropad] - a 3x4 keyboard and OLED combo board from Adafruit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Feather.\n\n[adafruit-macropad]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-macropad\n[Adafruit Macropad]: https://www.adafruit.com/product/5128\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nadafruit-macropad = \"0.8.0\"\n```\n\nIn your program, you will need to call `adafruit_macropad::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/adafruit-macropad $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/adafruit-macropad $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/adafruit-macropad/examples/adafruit-macropad_blinky.rs",
    "content": "//! Blinks the LED on a Adafruit MacroPad board\n//!\n//! This will blink on-board LED.\n#![no_std]\n#![no_main]\n\nuse adafruit_macropad::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\nuse embedded_hal::digital::OutputPin;\nuse panic_halt as _;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[rp2040_hal::entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables and the spinlock are initialised.\n#[rp2040_hal::entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    loop {\n        led_pin.set_high().unwrap();\n        delay.delay_ms(1500);\n        led_pin.set_low().unwrap();\n        delay.delay_ms(1500);\n    }\n}\n"
  },
  {
    "path": "boards/adafruit-macropad/src/lib.rs",
    "content": "#![no_std]\n\npub use rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n// Adafruit macropad uses W25Q64JVxQ flash chip. Should work with BOOT_LOADER_W25Q080 (untested)\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio0 { name: button },\n    Gpio1 { name: key1 },\n    Gpio2 { name: key2 },\n    Gpio3 { name: key3 },\n    Gpio4 { name: key4 },\n    Gpio5 { name: key5 },\n    Gpio6 { name: key6 },\n    Gpio7 { name: key7 },\n    Gpio8 { name: key8 },\n    Gpio9 { name: key9 },\n    Gpio10 { name: key10 },\n    Gpio11 { name: key11 },\n    Gpio12 { name: key12 },\n    Gpio13 { name: led },\n    Gpio14 {\n        name: speaker_shutdown\n    },\n    Gpio16 { name: speaker },\n    Gpio17 {\n        name: encoder_rota,\n        aliases: { FunctionSioInput, PullUp: RotaryA }\n    },\n    Gpio18 {\n        name: encoder_rotb,\n        aliases: { FunctionSioInput, PullUp: RotaryB }\n    },\n    Gpio19 { name: neopixel },\n    Gpio20 {\n        name: sda,\n        aliases: { FunctionI2C, PullUp: Sda }\n    },\n    Gpio21 {\n        name: scl,\n        aliases: { FunctionI2C, PullUp: Scl }\n    },\n    // This CS is on the wrong SPI channel so cannot be controlled by the peripheral\n    Gpio22 { name: oled_cs },\n    Gpio23 { name: oled_reset },\n    Gpio24 { name: oled_dc },\n    Gpio26 {\n        name: sclk,\n        aliases: { FunctionSpi, PullNone: Sclk }\n    },\n    Gpio27 {\n        name: mosi,\n        aliases: { FunctionSpi, PullNone: Mosi }\n    },\n    Gpio28 {\n        name: miso,\n        aliases: { FunctionSpi, PullNone: Miso }\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/adafruit-metro-rp2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.1.0 - 2024-04-07\n\n- Initial release\n"
  },
  {
    "path": "boards/adafruit-metro-rp2040/Cargo.toml",
    "content": "[package]\nname = \"adafruit-metro-rp2040\"\nversion = \"0.1.0\"\nauthors = [\"Thad House <thadhouse1@gmail.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-metro-rp2040\"\ndescription = \"Board Support Package for the Adafruit Metro RP2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\npanic-halt.workspace = true\nembedded-hal.workspace = true\nsmart-leds.workspace = true\nnb.workspace = true\nws2812-pio.workspace = true\nfugit.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/adafruit-metro-rp2040/README.md",
    "content": "# [adafruit-metro-rp2040] - Board Support for the [Adafruit Metro RP2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit Metro RP2040] - an RP2040 board in the Metro family from Adafruit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Metro RP2040.\n\n[Adafruit Metro RP2040]: https://www.adafruit.com/product/5786\n[adafruit-metro-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-metro-rp2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nadafruit-metro-rp2040 = \"0.1.0\"\n```\n\nIn your program, you will need to call `adafruit_metro_rp2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/adafruit-metro-rp2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/adafruit-metro-rp2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [adafruit_metro_blinky](./examples/adafruit_metro_blinky.rs)\n\nBlink an LED on and off.\n\n### [adafruit_metro_rainbow](./examples/adafruit_metro_rainbow.rs)\n\nContinuously changes the color of the Metro's onboard Neopixel.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/adafruit-metro-rp2040/examples/adafruit_metro_blinky.rs",
    "content": "//! # GPIO 'Blinky' Example\n//!\n//! Blinks the LED on a Adafruit Metro RP2040 board\n//!\n//! It may need to be adapted to your particular board layout and/or pin assignment.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse adafruit_metro_rp2040::entry;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Some traits we need\nuse embedded_hal::digital::OutputPin;\n\nuse adafruit_metro_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        sio::Sio,\n        watchdog::Watchdog,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\n\nuse cortex_m::delay::Delay;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then toggles a GPIO pin in\n/// an infinite loop. If there is an LED connected to that pin, it will blink.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = Sio::new(pac.SIO);\n\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n    let mut led_pin = pins.d13.into_push_pull_output();\n\n    loop {\n        led_pin.set_high().unwrap();\n        delay.delay_ms(500);\n        led_pin.set_low().unwrap();\n        delay.delay_ms(500);\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs",
    "content": "//! Continuously changes the color of the Neopixel on a Adafruit Metro RP2040 board\n#![no_std]\n#![no_main]\n\nuse adafruit_metro_rp2040::entry;\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse ws2812_pio::Ws2812;\n\nuse adafruit_metro_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        watchdog::Watchdog,\n        Sio, Timer,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let led = pins.neopixel_data.into_function();\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        led,\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/adafruit-metro-rp2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio0 {\n        name: tx,\n        aliases: { FunctionUart, PullNone: UartTx }\n    },\n    Gpio1 {\n        name: rx,\n        aliases: { FunctionUart, PullNone: UartRx }\n    },\n    Gpio2 { name: d2 },\n    Gpio3 { name: d3 },\n    Gpio4 { name: d4 },\n    Gpio5 { name: d5 },\n    Gpio6 { name: d6 },\n    Gpio7 { name: d7 },\n    Gpio8 { name: d8 },\n    Gpio9 { name: d9 },\n    Gpio10 { name: d10 },\n    Gpio11 { name: d11 },\n    Gpio12 { name: d12 },\n    Gpio13 { name: d13 },\n    Gpio14 { name: neopixel_data },\n    Gpio15 { name: sd_cd, },\n    Gpio16 {\n        name: sda,\n        aliases: { FunctionI2C, PullUp: Sda }\n    },\n    Gpio17 {\n        name: scl,\n        aliases: { FunctionI2C, PullUp: Scl }\n    },\n    Gpio18 {\n        name: sclk,\n        aliases: { FunctionSpi, PullNone: Sclk }\n    },\n    Gpio19 {\n        name: mosi,\n        aliases: { FunctionSpi, PullNone: Mosi }\n    },\n    Gpio20 {\n        name: miso\n        aliases: { FunctionSpi, PullNone: Miso }\n    },\n    Gpio21 { name: sdio_data1 },\n    Gpio22 { name: sdio_data2 },\n    Gpio23 { name: sd_cs },\n    Gpio24 { name: d24 },\n    Gpio25 { name: d25 },\n    Gpio26 { name: a0 },\n    Gpio27 { name: a1 },\n    Gpio28 { name: a2 },\n    Gpio29 { name: a3 },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/adafruit-qt-py-rp2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.8.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to ws2812-pio 0.8.0\n- Update to embedded-hal 1.0.0\n\n## 0.7.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.6.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n\n## 0.5.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.4.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Bump `ws2812-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n## 0.3.0 - 2022-06-13\n\n### Changed\n\n- Update to rp2040-hal 0.5.0\n\n## 0.2.0 - 2022-03-11\n\n### Changed\n\n- Update to rp2040-hal 0.4.0\n\n## 0.1.0 - 2021-12-20\n\n- Initial release\n\n"
  },
  {
    "path": "boards/adafruit-qt-py-rp2040/Cargo.toml",
    "content": "[package]\nname = \"adafruit-qt-py-rp2040\"\nversion = \"0.8.0\"\nauthors = [\"Stephen Onnen <stephen.onnen@gmail.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-qt-py-rp2040\"\ndescription = \"Board Support Package for the Adafruit QT Py RP2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\npanic-halt.workspace = true\nembedded-hal.workspace = true\nsmart-leds.workspace = true\nnb.workspace = true\nws2812-pio.workspace = true\nfugit.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/adafruit-qt-py-rp2040/README.md",
    "content": "# [adafruit-qt-py-rp2040] - Board Support for the [Adafruit QT Py RP2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit QT Py RP2040] - an extremely small form-factor RP2040 board from Adafruit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the QT Py.\n\n[Adafruit QT Py RP2040]: https://www.adafruit.com/product/4900\n[adafruit-qt-py-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-qt-py-rp2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nadafruit-qt-py-rp2040 = \"0.8.0\"\n```\n\nIn your program, you will need to call `adafruit_qt_py_rp2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/adafruit-qt-py-rp2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/adafruit-qt-py-rp2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [adafruit_qt_py_rp2040_rainbow](./examples/adafruit_qt_py_rp2040_rainbow.rs)\n\nContinuously changes the color of the QT Py's onboard Neopixel.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs",
    "content": "//! Continuously changes the color of the Neopixel on a Adafruit QT Py RP2040 board\n#![no_std]\n#![no_main]\n\nuse adafruit_qt_py_rp2040::entry;\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse ws2812_pio::Ws2812;\n\nuse adafruit_qt_py_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        gpio::PinState,\n        pac,\n        pio::PIOExt,\n        watchdog::Watchdog,\n        Sio, Timer,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let led = pins.neopixel_data.into_function();\n\n    pins.neopixel_power\n        .into_push_pull_output_in_state(PinState::High);\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        led,\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/adafruit-qt-py-rp2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_GD25Q64CS;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio3 {\n        name: mosi,\n        aliases: { FunctionSpi, PullNone: Mosi }\n    },\n    Gpio4 {\n        name: miso\n        aliases: { FunctionSpi, PullNone: Miso }\n    },\n    Gpio5 {\n        name: rx,\n        aliases: { FunctionUart, PullNone: UartRx }\n    },\n    Gpio6 {\n        name: sclk,\n        aliases: { FunctionSpi, PullNone: Sclk }\n    },\n    Gpio11 { name: neopixel_power },\n    Gpio12 { name: neopixel_data },\n    Gpio20 {\n        name: tx,\n        aliases: { FunctionUart, PullNone: UartTx }\n    },\n    Gpio21 {\n        name: button\n    },\n    Gpio22 {\n        name: sda1,\n        aliases: { FunctionI2C, PullUp: Sda1 }\n    },\n    Gpio23 {\n        name: scl1,\n        aliases: { FunctionI2C, PullUp: Scl1 }\n    },\n    Gpio24 {\n        name: sda,\n        aliases: { FunctionI2C, PullUp: Sda }\n    },\n    Gpio25 {\n        name: scl,\n        aliases: { FunctionI2C, PullUp: Scl }\n    },\n    Gpio26 { name: a3 },\n    Gpio27 { name: a2 },\n    Gpio28 { name: a1 },\n    Gpio29 { name: a0 },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/adafruit-trinkey-qt2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.7.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.6.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.5.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n\n## 0.4.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.3.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Bump `ws2812-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n"
  },
  {
    "path": "boards/adafruit-trinkey-qt2040/Cargo.toml",
    "content": "[package]\nname = \"adafruit-trinkey-qt2040\"\nversion = \"0.7.0\"\nauthors = [\"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-trinkey-qt2040\"\ndescription = \"Board Support Package for the Adafruit Trinkey QT2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\npanic-halt.workspace = true\nembedded-hal.workspace = true\nsmart-leds.workspace = true\nnb.workspace = true\nws2812-pio.workspace = true\nfugit.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/adafruit-trinkey-qt2040/README.md",
    "content": "# [adafruit-trinkey-qt2040] - Board Support for the [Adafruit Trinkey QT2040]\n\nYou should include this crate if you are writing code that you want to run on\nan [Adafruit Trinkey QT2040] - a 3x4 keyboard and OLED combo board from Adafruit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Trinkey.\n\n[adafruit-trinkey-qt2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-trinkey-qt2040\n[adafruit trinkey qt2040]: https://www.adafruit.com/product/5056\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nadafruit-trinkey-qt2040 = \"0.7.0\"\n```\n\nIn your program, you will need to call `adafruit-trinkey-qt2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/adafruit-trinkey-qt2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/adafruit-trinkey-qt2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [Rainbow](./examples/adafruit_trinkey_qt2040_rainbow.rs)\n\nThis example will display a colour-wheel rainbow effect on the on-board LED.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][coc], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[coc]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs",
    "content": "//! # Rainbow Example for the Adafruit Trinkey QT2040\n//!\n//! Runs a rainbow-effect colour wheel on the on-board LED.\n//!\n//! Uses the `ws2812_pio` driver to control the LED, which in turns uses the\n//! RP2040's PIO block.\n\n#![no_std]\n#![no_main]\n\nuse adafruit_trinkey_qt2040::entry;\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\n\nuse adafruit_trinkey_qt2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    XOSC_CRYSTAL_FREQ,\n};\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse ws2812_pio::Ws2812;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this\n/// function as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then the LED, then runs\n/// the colour wheel in an infinite loop.\n#[entry]\nfn main() -> ! {\n    // Configure the RP2040 peripherals\n\n    let mut pac = pac::Peripherals::take().unwrap();\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n\n    let pins = adafruit_trinkey_qt2040::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n\n    let mut ws = Ws2812::new(\n        pins.neopixel.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite colour wheel loop\n\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/adafruit-trinkey-qt2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio12 { name: button },\n    Gpio16 {\n        name: sda,\n        aliases: { FunctionI2C, PullUp: Sda }\n    },\n    Gpio17 {\n        name: scl,\n        aliases: { FunctionI2C, PullUp: Scl }\n    },\n    Gpio27 { name: neopixel },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/arduino_nano_connect/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/arduino_nano_connect/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.7.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.6.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n\n## 0.5.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n\n## 0.4.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n\n## 0.3.0 - 2022-08-26\n\n### Changed\n\n- Use `rp2040-hal`'s entry function.\n- Migrate from `embedded-time` to `fugit`\n- Update to rp2040-hal 0.6.0\n\n### Removed\n\n- Unused dependencies\n\n"
  },
  {
    "path": "boards/arduino_nano_connect/Cargo.toml",
    "content": "[package]\nname = \"arduino_nano_connect\"\nversion = \"0.7.0\"\nauthors = [\"splicedbread <dxbunrated@gmail.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/arduino_nano_connect\"\ndescription = \"Board Support Package for the Arduino Nano RP2040 Connect\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nembedded-hal = { workspace = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\npanic-halt.workspace = true\nembedded-hal.workspace = true\nnb.workspace = true\nfugit.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/arduino_nano_connect/README.md",
    "content": "# [arduino_nano_connect] - Board Support for the [Arduino Nano RP2040 Connect]\n\nYou should include this crate if you are writing code that you want to run on\nan [Arduino Nano RP2040 Connect] - a development pcb with shortwave communication, IMU, and BLE package.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the nano connect.\n\n[Arduino Nano RP2040 Connect]: https://store-usa.arduino.cc/collections/boards/products/arduino-nano-rp2040-connect\n[arduino_nano_connect]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/arduino_nano_connect\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\narduino_nano_connect = \"0.7.0\"\n```\n# TODO - down and out\nIn your program, you will need to call `arduino_nano_connect::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n[nano_blinky](./examples/nano_blinky.rs)\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/arduino_nano_connect $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/arduino_nano_connect $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\nthen try repeating the `cargo run` command above.\n\n### [nano_blinky](./examples/nano_blinky.rs)\n\nFlashes the Arduino Nano Connect's on-board LED on and off.\n\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can chose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/arduino_nano_connect/examples/nano_blinky.rs",
    "content": "//! # Nano Blinky Example\n//!\n//! Blinks the LED on a Arduino Nano Connect board.\n//!\n//! This will blink an LED attached to GP25, which is the pin the Nano uses for\n//! the on-board LED.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\nuse embedded_hal::digital::OutputPin;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\nuse arduino_nano_connect as bsp;\n\n// Pull in any important traits\nuse bsp::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse bsp::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse bsp::hal;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[arduino_nano_connect::entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables and the spinlock are initialised.\n///\n/// The function configures the RP2040 peripherals, then blinks the LED in an\n/// infinite loop.\n#[arduino_nano_connect::entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        bsp::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = bsp::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Set the LED to be an output\n    let mut led_pin = pins.sck0.into_push_pull_output();\n\n    // Blink the LED at 1 Hz\n    loop {\n        led_pin.set_high().unwrap();\n        delay.delay_ms(500);\n        led_pin.set_low().unwrap();\n        delay.delay_ms(500);\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/arduino_nano_connect/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\npub use rp2040_hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n///\n/// According to [the Arduino store]\n/// the board should contain a AT25SF128A flash chip. But\n/// there are [reports] of board with different flash chips,\n/// where the boot loader BOOT_LOADER_AT25SF128A does not\n/// work.\n///\n/// Therefore, the generic boot loader is used by default. For a specific\n/// board, the flash performance can be increased by switching to the\n/// matching boot loader.\n///\n/// [the Arduino store]: https://store.arduino.cc/products/arduino-nano-rp2040-connect\n/// [reports]: https://github.com/rp-rs/rp-hal/issues/503\n///\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;\n// pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_AT25SF128A;\n\npub use hal::pac;\n\n// borrowed some pin defs from rp-pico from a dicussion on the bsp_pins! macro\n// stripped out functions from connected lines that are no available through\n// any of the header pins\nhal::bsp_pins!(\n    /// GPIO 0 supports following functions:\n    /// | Default      | UART0 TX (arduino nano connect)\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp0Spi0Rx]          |\n    /// | `UART0 TX`   | [crate::Gp0Uart0Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp0I2C0Sda]         |\n    /// | `PWM0 A`     | [crate::Gp0Pwm0A]           |\n    /// | `PIO0`       | [crate::Gp0Pio0]            |\n    /// | `PIO1`       | [crate::Gp0Pio1]            |\n    Gpio0   {\n        name: tx,\n        aliases:\n            {\n                /// UART Function alias for pin [crate::Pins::gpio0].\n                FunctionUart, PullNone:   Gp0Uart0Tx\n            }\n    },\n\n    /// GPIO 1 supports following functions:\n    /// | Default      | UART0 RX (arduino nano connect)\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp1Spi0Csn]         |\n    /// | `UART0 RX`   | [crate::Gp1Uart0Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp1I2C0Scl]         |\n    /// | `PWM0 B`     | [crate::Gp1Pwm0B]           |\n    /// | `PIO0`       | [crate::Gp1Pio0]            |\n    /// | `PIO1`       | [crate::Gp1Pio1]            |\n    Gpio1   {\n        name: rx,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio1].\n            FunctionUart, PullNone:   Gp1Uart0Rx\n        }\n    },\n\n    /// GPIO 2 supports following functions:\n    /// | Default      | GPIO0 on nina, relates to BLE CTS\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp2Spi0Sck]         |\n    /// | `UART0 CTS`  | [crate::Gp2Uart0Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp2I2C1Sda]         |\n    /// | `PWM1 A`     | [crate::Gp2Pwm1A]           |\n    /// | `PIO0`       | [crate::Gp2Pio0]            |\n    /// | `PIO1`       | [crate::Gp2Pio1]            |\n    Gpio2   {\n        // name indicates BLE CTS on nina module, so outgoing line is bleRts using UART\n        name: ble_rts,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio2].\n            FunctionUart, PullNone:   Gp2Uart0Cts\n        }\n    },\n\n    /// GPIO 3 supports following functions:\n    /// | Default      | Line for reset of Nina Wifi Module\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp3Spi0Tx]          |\n    /// | `UART0 RTS`  | [crate::Gp3Uart0Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp3I2C1Scl]         |\n    /// | `PWM1 B`     | [crate::Gp3Pwm1B]           |\n    /// | `PIO0`       | [crate::Gp3Pio0]            |\n    /// | `PIO1`       | [crate::Gp3Pio1]            |\n    Gpio3   {\n        name: nina_reset_n\n    },\n\n    /// GPIO 4 supports following functions:\n    /// | Default      | SpiRx\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp4Spi0Rx]          |\n    /// | `UART1 TX`   | [crate::Gp4Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp4I2C0Sda]         |\n    /// | `PWM2 A`     | [crate::Gp4Pwm2A]           |\n    /// | `PIO0`       | [crate::Gp4Pio0]            |\n    /// | `PIO1`       | [crate::Gp4Pio1]            |\n    Gpio4   {\n        // Conflicting information between schematic and 'latest' pinnout diagram.\n        // MISO in schematic, CIPO in 'latest' arduino pinnout diagram. same thing really\n        // SPIRX in schematic line label.\n        name: cipo,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio4].\n            FunctionUart, PullNone: Gp4Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio4].\n            FunctionSpi, PullNone: Gp4Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio4].\n            FunctionI2C, PullUp: Gp4I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio4].\n            FunctionPwm, PullNone: Gp4Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio0, PullNone: Gp4Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio1, PullNone: Gp4Pio1\n        }\n    },\n\n    /// GPIO 5 supports following functions:\n    /// | Default      | Generic Digital pin D10\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp5Spi0Csn]         |\n    /// | `UART1 RX`   | [crate::Gp5Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp5I2C0Scl]         |\n    /// | `PWM2 B`     | [crate::Gp5Pwm2B]           |\n    /// | `PIO0`       | [crate::Gp5Pio0]            |\n    /// | `PIO1`       | [crate::Gp5Pio1]            |\n    Gpio5   {\n        name: d10,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio5].\n            FunctionUart, PullNone:   Gp5Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio5].\n            FunctionSpi, PullNone:    Gp5Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio5].\n            FunctionI2C, PullUp:    Gp5I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio5].\n            FunctionPwm, PullNone:    Gp5Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio0, PullNone:   Gp5Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio1, PullNone:   Gp5Pio1\n        }\n    },\n\n    /// GPIO 6 supports following functions:\n    /// | Default      | SPI0 SCK (tied to on board led)\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp6Spi0Sck]         |\n    /// | `UART1 CTS`  | [crate::Gp6Uart1Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp6I2C1Sda]         |\n    /// | `PWM3 A`     | [crate::Gp6Pwm3A]           |\n    /// | `PIO0`       | [crate::Gp6Pio0]            |\n    /// | `PIO1`       | [crate::Gp6Pio1]            |\n    Gpio6   {\n        // also tied to on board led, on pin 13\n        name: sck0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio6].\n            FunctionUart, PullNone: Gp6Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio6].\n            FunctionSpi, PullNone: Gp6Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio6].\n            FunctionI2C, PullUp: Gp6I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio6].\n            FunctionPwm, PullNone: Gp6Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio0, PullNone: Gp6Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio1, PullNone: Gp6Pio1\n        }\n    },\n\n    /// GPIO 7 supports following functions:\n    /// | Default      | SPI0 TX\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp7Spi0Tx]          |\n    /// | `UART1 RTS`  | [crate::Gp7Uart1Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp7I2C1Scl]         |\n    /// | `PWM3 B`     | [crate::Gp7Pwm3B]           |\n    /// | `PIO0`       | [crate::Gp7Pio0]            |\n    /// | `PIO1`       | [crate::Gp7Pio1]            |\n    Gpio7   {\n        // Conflicting information between schematic and 'latest' pinnout diagram.\n        // MOSI in schematic, COPI in 'latest' arduino pinnout diagram.\n        // SPITX in schematic line label.\n        name: copi,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio7].\n            FunctionUart, PullNone: Gp7Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio7].\n            FunctionSpi, PullNone: Gp7Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio7].\n            FunctionI2C, PullUp: Gp7I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio7].\n            FunctionPwm, PullNone: Gp7Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio0, PullNone: Gp7Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio1, PullNone: Gp7Pio1\n        }\n    },\n\n    /// GPIO 8 supports following functions:\n    /// | Default      | SPI1 CIPO / UART1 TX connection to Nina Module\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp8Spi1Rx]          |\n    /// | `UART1 TX`   | [crate::Gp8Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp8I2C0Sda]         |\n    /// | `PWM4 A`     | [crate::Gp8Pwm4A]           |\n    /// | `PIO0`       | [crate::Gp8Pio0]            |\n    /// | `PIO1`       | [crate::Gp8Pio1]            |\n    Gpio8 {\n        // name indicates port to BLE RX on nina module and SPI CIPO for wifi\n        name: ble_tx_cipo,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio8].\n            FunctionUart, PullNone:   Gp8Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio8].\n            FunctionSpi, PullNone:    Gp8Spi1Rx\n        }\n    },\n\n    /// GPIO 9 supports following functions:\n    /// | Default      | SPI1 CS / UART1 RX\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp9Spi1Csn]         |\n    /// | `UART1 RX`   | [crate::Gp9Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp9I2C0Scl]         |\n    /// | `PWM4 B`     | [crate::Gp9Pwm4B]           |\n    /// | `PIO0`       | [crate::Gp9Pio0]            |\n    /// | `PIO1`       | [crate::Gp9Pio1]            |\n    Gpio9 {\n        // name indicates BLE TX on nina module and spi1 cs signal to wifi\n        name: ble_rx_cs,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio9].\n            FunctionUart, PullNone:   Gp9Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio9].\n            FunctionSpi, PullNone:    Gp9Spi1Csn\n        }\n    },\n\n    /// GPIO 10 supports following functions:\n    /// | Default      | SPI1 ACK / UART1 CTS\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp10Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp10Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp10I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp10Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp10Pio0]           |\n    /// | `PIO1`       | [crate::Gp10Pio1]           |\n    Gpio10 {\n        // name indicates BLE RTS on nina module and spi1 ack\n        name: ble_cts_ack,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio10].\n            FunctionUart, PullNone:   Gp10Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio10].\n            FunctionSpi, PullNone:    Gp10Spi1Sck\n        }\n    },\n\n    /// GPIO 11 supports following functions:\n    /// | Default      | SPI1 COPI / UART1 RTS\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp11Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp11Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp11I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp11Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp11Pio0]           |\n    /// | `PIO1`       | [crate::Gp11Pio1]           |\n    Gpio11 {\n        // ninaCOPI is\n        name: nina_copi,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio11].\n            FunctionUart, PullNone:   Gp11Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio11].\n            FunctionSpi, PullNone:    Gp11Spi1Tx\n        }\n    },\n\n    /// GPIO 12 supports following functions:\n    /// | Default      | I2C0 SDA / A4 ~ goes to pullups and auth\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp12Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp12Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp12I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp12Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp12Pio0]           |\n    /// | `PIO1`       | [crate::Gp12Pio1]           |\n    Gpio12  {\n        // Also SDA Crypto\n        name: a4,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio12].\n            FunctionUart, PullNone: Gp12Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio12].\n            FunctionSpi, PullNone: Gp12Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio12].\n            FunctionI2C, PullUp: Gp12I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio12].\n            FunctionPwm, PullNone: Gp12Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio0, PullNone: Gp12Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio1, PullNone: Gp12Pio1\n        }\n    },\n\n    /// GPIO 13 supports following functions:\n    /// | Default      | I2C0 SCL / A5 ~ goes to pullups\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp13Spi1Csn]        |\n    /// | `UART0 RX`   | [crate::Gp13Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp13I2C0Scl]        |\n    /// | `PWM6 B`     | [crate::Gp13Pwm6B]          |\n    /// | `PIO0`       | [crate::Gp13Pio0]           |\n    /// | `PIO1`       | [crate::Gp13Pio1]           |\n    Gpio13  {\n        // Also SCL Crypto\n        name: a5,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio13].\n            FunctionUart, PullNone: Gp13Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio13].\n            FunctionSpi, PullNone: Gp13Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio13].\n            FunctionI2C, PullUp: Gp13I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio13].\n            FunctionPwm, PullNone: Gp13Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio0, PullNone: Gp13Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio1, PullNone: Gp13Pio1\n        }\n    },\n\n    /// GPIO 14 supports following functions:\n    /// | Default      | SPI1 SCK ~ nina SCK\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp14Spi1Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp14Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp14I2C1Sda]        |\n    /// | `PWM7 A`     | [crate::Gp14Pwm7A]          |\n    /// | `PIO0`       | [crate::Gp14Pio0]           |\n    /// | `PIO1`       | [crate::Gp14Pio1]           |\n    Gpio14 {\n        name: nina_sck,\n        aliases: {\n            /// SPI Function alias for pin [crate::Pins::gpio14].\n            FunctionSpi, PullNone:    Gp14Spi1Sck\n        }\n    },\n\n    /// GPIO 15 supports following functions:\n    /// | Default      | General Digital pin D3\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp15Spi1Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp15Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp15I2C1Scl]        |\n    /// | `PWM7 B`     | [crate::Gp15Pwm7B]          |\n    /// | `PIO0`       | [crate::Gp15Pio0]           |\n    /// | `PIO1`       | [crate::Gp15Pio1]           |\n    Gpio15  {\n        name: d3,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio15].\n            FunctionUart, PullNone:   Gp15Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio15].\n            FunctionSpi, PullNone:    Gp15Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio15].\n            FunctionI2C, PullUp:      Gp15I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio15].\n            FunctionPwm, PullNone:    Gp15Pwm7B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio0, PullNone:   Gp15Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio1, PullNone:   Gp15Pio1\n        }\n    },\n\n    /// GPIO 16 supports following functions:\n    /// | Default      | General Digital pin D4\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp16Spi0Rx]         |\n    /// | `UART0 TX`   | [crate::Gp16Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp16I2C0Sda]        |\n    /// | `PWM0 A`     | [crate::Gp16Pwm0A]          |\n    /// | `PIO0`       | [crate::Gp16Pio0]           |\n    /// | `PIO1`       | [crate::Gp16Pio1]           |\n    Gpio16  {\n        name: d4,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio16].\n            FunctionUart, PullNone:   Gp16Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio16].\n            FunctionSpi, PullNone:    Gp16Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio16].\n            FunctionI2C, PullUp:      Gp16I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio16].\n            FunctionPwm, PullNone:    Gp16Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio16].\n            FunctionPio0, PullNone:   Gp16Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio16].\n            FunctionPio1, PullNone:   Gp16Pio1\n        }\n    },\n\n    /// GPIO 17 supports following functions:\n    /// | Default      | General Digital pin D5\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp17Spi0Csn]        |\n    /// | `UART0 RX`   | [crate::Gp17Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp17I2C0Scl]        |\n    /// | `PWM0 B`     | [crate::Gp17Pwm0B]          |\n    /// | `PIO0`       | [crate::Gp17Pio0]           |\n    /// | `PIO1`       | [crate::Gp17Pio1]           |\n    Gpio17  {\n        name: d5,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio17].\n            FunctionUart, PullNone:   Gp17Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio17].\n            FunctionSpi, PullNone:    Gp17Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio17].\n            FunctionI2C, PullUp:      Gp17I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio17].\n            FunctionPwm, PullNone:    Gp17Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio0, PullNone:   Gp17Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio1, PullNone:   Gp17Pio1\n        }\n    },\n\n    /// GPIO 18 supports following functions:\n    /// | Default      | General Digital pin D6\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp18Spi0Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp18Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp18I2C1Sda]        |\n    /// | `PWM1 A`     | [crate::Gp18Pwm1A]          |\n    /// | `PIO0`       | [crate::Gp18Pio0]           |\n    /// | `PIO1`       | [crate::Gp18Pio1]           |\n    Gpio18  {\n        name: d6,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio18].\n            FunctionUart, PullNone:   Gp18Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio18].\n            FunctionSpi, PullNone:    Gp18Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio18].\n            FunctionI2C, PullUp:      Gp18I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio18].\n            FunctionPwm, PullNone:    Gp18Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio0, PullNone:   Gp18Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio1, PullNone:   Gp18Pio1\n        }\n    },\n\n    /// GPIO 19 supports following functions:\n    /// | Default      | General Digital Pin D7\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp19Spi0Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp19Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp19I2C1Scl]        |\n    /// | `PWM1 B`     | [crate::Gp19Pwm1B]          |\n    /// | `PIO0`       | [crate::Gp19Pio0]           |\n    /// | `PIO1`       | [crate::Gp19Pio1]           |\n    Gpio19  {\n        name: d7,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio19].\n            FunctionUart, PullNone:   Gp19Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio19].\n            FunctionSpi, PullNone:    Gp19Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio19].\n            FunctionI2C, PullUp:      Gp19I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio19].\n            FunctionPwm, PullNone:    Gp19Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio0, PullNone:   Gp19Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio1, PullNone:   Gp19Pio1\n        }\n    },\n\n    /// GPIO 20 supports following functions:\n    /// | Default      | General Digital pin D8\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp20Spi0Rx]         |\n    /// | `UART1 TX`   | [crate::Gp20Uart1Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp20I2C0Sda]        |\n    /// | `PWM2 A`     | [crate::Gp20Pwm2A]          |\n    /// | `PIO0`       | [crate::Gp20Pio0]           |\n    /// | `PIO1`       | [crate::Gp20Pio1]           |\n    Gpio20  {\n        name: d8,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio20].\n            FunctionUart, PullNone:   Gp20Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio20].\n            FunctionSpi, PullNone:    Gp20Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio20].\n            FunctionI2C, PullUp:      Gp20I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio20].\n            FunctionPwm, PullNone:    Gp20Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio0, PullNone:   Gp20Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio1, PullNone:   Gp20Pio1\n        }\n    },\n\n    /// GPIO 21 supports following functions:\n    /// | Default      | General Digital pin D9\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp21Spi0Csn]        |\n    /// | `UART1 RX`   | [crate::Gp21Uart1Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp21I2C0Scl]        |\n    /// | `PWM2 B`     | [crate::Gp21Pwm2B]          |\n    /// | `PIO0`       | [crate::Gp21Pio0]           |\n    /// | `PIO1`       | [crate::Gp21Pio1]           |\n    Gpio21  {\n        name: d9,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio21].\n            FunctionUart, PullNone:   Gp21Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio21].\n            FunctionSpi, PullNone:    Gp21Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio21].\n            FunctionI2C, PullUp:      Gp21I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio21].\n            FunctionPwm, PullNone:    Gp21Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio0, PullNone:   Gp21Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio1, PullNone:   Gp21Pio1\n        }\n    },\n\n    /// GPIO 22 supports following functions:\n    /// | Default      | PDMDIN\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp22Spi0Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp22Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp22I2C1Sda]        |\n    /// | `PWM3 A`     | [crate::Gp22Pwm3A]          |\n    /// | `PIO0`       | [crate::Gp22Pio0]           |\n    /// | `PIO1`       | [crate::Gp22Pio1]           |\n    Gpio22 {\n        // this connects to the microphone module\n        name: pdmdin\n    },\n\n    /// GPIO 23 supports following functions:\n    /// | Default      | PDMCLK\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`   | [crate::Gp23Spi0Tx]        |\n    /// | `UART1 RTS`  | [crate::Gp23Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp23I2C1Scl]        |\n    /// | `PWM3 B`     | [crate::Gp23Pwm3B]          |\n    /// | `PIO0`       | [crate::Gp23Pio0]           |\n    /// | `PIO1`       | [crate::Gp23Pio1]           |\n    Gpio23 {\n        name: pdmclk\n    },\n\n    /// GPIO 24 supports following functions:\n    /// | Default      | INT1 ~ connected to INT1 on the IMU\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`   | [crate::Gp24Spi1Rx]        |\n    /// | `UART1 TX`  | [crate::Gp24Uart1Tx]       |\n    /// | `I2C0 SDA`   | [crate::Gp24I2C0Sda]        |\n    /// | `PWM4 A`     | [crate::Gp24Pwm4A]          |\n    /// | `PIO0`       | [crate::Gp24Pio0]           |\n    /// | `PIO1`       | [crate::Gp24Pio1]           |\n    Gpio24 {\n        name: int1\n    },\n\n    /// GPIO 25 supports following functions:\n    /// | Default      |\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp25Spi1Csn]        |\n    /// | `UART1 RX`  | [crate::Gp25Uart1Rx]       |\n    /// | `I2C0 SCL`   | [crate::Gp25I2C0Scl]        |\n    /// | `PWM4 B`     | [crate::Gp25Pwm4B]          |\n    /// | `PIO0`       | [crate::Gp25Pio0]           |\n    /// | `PIO1`       | [crate::Gp25Pio1]           |\n    Gpio25  {\n        name: d2,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio25].\n            FunctionUart, PullNone:   Gp25Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio25].\n            FunctionSpi, PullNone:    Gp25Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio25].\n            FunctionI2C, PullUp:      Gp25I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio25].\n            FunctionPwm, PullNone:    Gp25Pwm4B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio25].\n            FunctionPio0, PullNone:   Gp25Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio25].\n            FunctionPio1, PullNone:   Gp25Pio1\n        }\n    },\n\n    /// GPIO 26 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp26Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp26Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp26I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp26Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp26Pio0]           |\n    /// | `PIO1`       | [crate::Gp26Pio1]           |\n    Gpio26  {\n        name: a0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio26].\n            FunctionUart, PullNone: Gp26Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio26].\n            FunctionSpi, PullNone: Gp26Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio26].\n            FunctionPwm, PullNone: Gp26Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio0, PullNone: Gp26Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio1, PullNone: Gp26Pio1\n        }\n    },\n\n    /// GPIO 27 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp27Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp27Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp27I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp27Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp27Pio0]           |\n    /// | `PIO1`       | [crate::Gp27Pio1]           |\n    Gpio27  {\n        name: a1,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio27].\n            FunctionUart, PullNone: Gp27Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio27].\n            FunctionSpi, PullNone: Gp27Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio27].\n            FunctionPwm, PullNone: Gp27Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio0, PullNone: Gp27Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio1, PullNone: Gp27Pio1\n        }\n    },\n\n    /// GPIO 28 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp28Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp28Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp28I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp28Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp28Pio0]           |\n    /// | `PIO1`       | [crate::Gp28Pio1]           |\n    Gpio28  {\n        name: a2,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp28Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp28Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp28I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp28Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp28Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp28Pio1\n        }\n    },\n\n    /// GPIO 29 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CS`    | [crate::Gp29Spi1CSn]         |\n    /// | `UART0 RX`   | [crate::Gp29Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp29I2C0Scl]        |\n    /// | `PWM6 B`     | [crate::Gp29Pwm6B]          |\n    /// | `PIO0`       | [crate::Gp29Pio0]           |\n    /// | `PIO1`       | [crate::Gp29Pio1]           |\n    Gpio29  {\n        name: a3,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp29Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp29Spi1CSn,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp29I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp29Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp29Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp29Pio1\n        }\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/boardsource-blok/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/boardsource-blok/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.3.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.2.1 - 2023-10-25\n\n### Changed\n\n- Updated pinout\n\n## 0.2.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.1.0 - 2023-6-8\n\n- Initial release\n"
  },
  {
    "path": "boards/boardsource-blok/Cargo.toml",
    "content": "[package]\nname = \"boardsource-blok\"\nversion = \"0.3.0\"\nedition = \"2021\"\nauthors = [\"Agent59 <agent59@ripakewitz.net>\", \"The rp-rs Developers\"]\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/boardsource-blok\"\ndescription = \"Board Support Package for the rp2040 based Blok\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m.workspace = true\nrp2040-boot2 = { workspace = true, optional = true}\nrp2040-hal.workspace = true\ncortex-m-rt = { workspace = true, optional = true}\nfugit.workspace = true\n\n[dev-dependencies]\npanic-halt.workspace = true\nembedded-hal.workspace = true\nnb.workspace = true\nsmart-leds.workspace = true\nws2812-pio.workspace = true\nusb-device.workspace = true\nusbd-hid.workspace = true\ncritical-section.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/boardsource-blok/README.md",
    "content": "# [boardsource-blok] - Board Support for the [Blok]\n\nYou should include this crate if you are writing code that you want to run on\na [Blok] - an RP2040 based controller, made by [Boardsource],\nbuilt for the keyboard community. \nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Blok.\nMore Information about the pin layout at [Peg].\n\n[Blok]: https://boardsource.xyz/store/628b95b494dfa308a6581622\n[boardsource-blok]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/boardsource-blok\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Boardsource]: https://boardsource.xyz/\n[Peg]: https://peg.software/docs/blok\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nboardsource-blok = \"0.3.0\"\n```\n\nIn your program, you will need to call `blok::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/boardsource-blok $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/boardsource-blok $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\nthen try repeating the `cargo run` command above.\n\n### From Scratch\n\nTo start a basic project from scratch, create a project using `cargo new project-name`. Within the\nproject directory, run `cargo add blok`, `cargo add cortex-m-rt`, and `cargo add panic-halt`. The\nfirst command will add this HAL (Hardware Abstraction Layer), the second is required for the `#[entry]` macro, and _panic-halt_ creates a simple panic function, which just halts.\n\nYou'll also need to copy the cargo config file from the [repo](https://github.com/rp-rs/rp-hal-boards/blob/main/.cargo/config.toml). It specifies the target and optimizing flags to the linker. You'll also need to copy [_memory.x_](https://github.com/rp-rs/rp-hal-boards/blob/main/memory.x) to your project root. This file tells the linker the flash and RAM layout, so it won't clobber the bootloader or write to an out of bounds memory address.\n\nThe simplest working example, which does nothing except loop forever, is:\n\n```ignore\n#![no_std]\n#![no_main]\nuse blok::entry;\nuse panic_halt as _;\n#[entry]\nfn see_doesnt_have_to_be_called_main() -> ! {\n  loop {}\n}\n```\n\nIt can be placed in _/src/main.rs_. \n\nYou can use `cargo run` to compile and install it. \n**Note**: You won't see any activity since this program does nothing. You can use the examples provided\nto add more functionality. \n### [blok_rainbow](./examples/blok_rainbow.rs)\n\nRuns a rainbow-effect color wheel on the on-board neopixel.\n\n### [blok_reset_to_usb_boot](./examples/blok_reset_to_usb_boot.rs)\n\nResets the Blok after 10 seconds to usb boot mode.\n\n### [blok_usb_keyboard_input](./examples/blok_usb_keyboard_input.rs)\n\nDemonstrates emulating a USB Human Input Device (HID) Keyboard. The keyboard\nwill type \"HELLO\" five times.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/boardsource-blok/examples/blok_rainbow.rs",
    "content": "//! # Rainbow Example for the Blok\n//!\n//! Runs a rainbow-effect colour wheel on the on-board neopixel.\n//! Uses the `ws2821_pio` driver to control the NeoPixel, which in turn uses the\n//! RP2040's PIO block\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\nuse boardsource_blok::entry;\nuse boardsource_blok::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse ws2812_pio::Ws2812;\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        // The onboard neopixel is attached to GPIO pin 25\n        pins.neopixel.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite colour wheel loop\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/boardsource-blok/examples/blok_reset_to_usb_boot.rs",
    "content": "//! # Reset To Usb Boot Example for the Blok\n//!\n//! Resets the Blok after 10 seconds to usb boot mode.\n//!\n//! Afterwards the microcontroller should be automatically mounted as a drive,\n//! just like when booted while holding down the boot button.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\nuse boardsource_blok::{entry, hal};\nuse boardsource_blok::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\nuse panic_halt as _;\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n    let _pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let _timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    let core = pac::CorePeripherals::take().unwrap();\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    loop {\n        // waits 10 seconds\n        delay.delay_ms(10_000);\n\n        // resets to usb boot mode\n        hal::rom_data::reset_to_usb_boot(0, 0);\n    }\n}\n"
  },
  {
    "path": "boards/boardsource-blok/examples/blok_usb_keyboard_input.rs",
    "content": "//! # Keyboard Input Example for the Blok\n//!\n//! Creates a USB HID Class Keyboard device on a Blok,\n//! with the USB driver running in the main thread.\n//!\n//! It generates keyboard reports which all together\n//! type the word \"HELLO\" on the computer.\n//!\n//! This behaviour will be repeated 5 times\n//! after which the Blok will reset to usb boot mode.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n#![allow(static_mut_refs)]\n\nuse boardsource_blok::{entry, hal};\nuse boardsource_blok::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pac::interrupt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\nuse panic_halt as _;\nuse usb_device::{\n    bus::UsbBusAllocator,\n    device::{StringDescriptors, UsbDevice, UsbDeviceBuilder, UsbVidPid},\n};\nuse usbd_hid::{descriptor::KeyboardReport, descriptor::SerializedDescriptor, hid_class::HIDClass};\n\n// shared with the interrupt\nstatic mut USB_BUS: Option<UsbBusAllocator<hal::usb::UsbBus>> = None;\nstatic mut USB_HID: Option<HIDClass<hal::usb::UsbBus>> = None;\nstatic mut USB_DEVICE: Option<UsbDevice<hal::usb::UsbBus>> = None;\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n    let _pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let _timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    let usb_bus = UsbBusAllocator::new(hal::usb::UsbBus::new(\n        pac.USBCTRL_REGS,\n        pac.USBCTRL_DPRAM,\n        clocks.usb_clock,\n        true,\n        &mut pac.RESETS,\n    ));\n    unsafe {\n        USB_BUS = Some(usb_bus);\n    }\n\n    let bus_ref = unsafe { USB_BUS.as_ref().unwrap() };\n\n    let usb_hid = HIDClass::new(bus_ref, KeyboardReport::desc(), 10);\n    unsafe {\n        USB_HID = Some(usb_hid);\n    }\n\n    let usb_device = UsbDeviceBuilder::new(bus_ref, UsbVidPid(0x1209, 0x0001))\n        .strings(&[StringDescriptors::default().product(\"keyboard input\")])\n        .unwrap()\n        .build();\n    unsafe {\n        USB_DEVICE = Some(usb_device);\n    }\n\n    // enable usb interrupt\n    unsafe {\n        pac::NVIC::unmask(hal::pac::Interrupt::USBCTRL_IRQ);\n    }\n\n    let core = pac::CorePeripherals::take().unwrap();\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    let mut i = 0;\n\n    loop {\n        // wait 5 seconds on the first loop, otherwise the first keyboard reports\n        // might not be processed by the computer\n        if i == 0 {\n            delay.delay_ms(5_000);\n        }\n\n        delay.delay_ms(100);\n        push_report(KeyboardReport {\n            modifier: 0b0000_0010, // LeftShift\n            reserved: 0x00,\n            leds: 0x00,\n            keycodes: [0x0b, 0x00, 0x00, 0x00, 0x00, 0x00], // H\n        });\n\n        delay.delay_ms(100);\n        push_report(KeyboardReport {\n            modifier: 0b0000_0010, // LeftShift\n            reserved: 0x00,\n            leds: 0x00,\n            keycodes: [0x08, 0x00, 0x00, 0x00, 0x00, 0x00], // E\n        });\n\n        delay.delay_ms(100);\n        push_report(KeyboardReport {\n            modifier: 0b0000_0010, // LeftShift\n            reserved: 0x00,\n            leds: 0x00,\n            keycodes: [0x0f, 0x00, 0x00, 0x00, 0x00, 0x00], // L\n        });\n\n        delay.delay_ms(100);\n        push_report(KeyboardReport {\n            modifier: 0x00,\n            reserved: 0x00,\n            leds: 0x00,\n            keycodes: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00], // no keys pressed\n        });\n\n        delay.delay_ms(100);\n        push_report(KeyboardReport {\n            modifier: 0b0000_0010, // LeftShift\n            reserved: 0x00,\n            leds: 0x00,\n            keycodes: [0x0f, 0x00, 0x00, 0x00, 0x00, 0x00], // L\n        });\n\n        delay.delay_ms(100);\n        push_report(KeyboardReport {\n            modifier: 0b0000_0010, // LeftShift\n            reserved: 0x00,\n            leds: 0x00,\n            keycodes: [0x12, 0x00, 0x00, 0x00, 0x00, 0x00], // O\n        });\n\n        delay.delay_ms(100);\n        push_report(KeyboardReport {\n            modifier: 0x00,\n            reserved: 0x00,\n            leds: 0x00,\n            keycodes: [0x2c, 0x00, 0x00, 0x00, 0x00, 0x00], // space\n        });\n\n        i += 1;\n        if i >= 5 {\n            hal::rom_data::reset_to_usb_boot(0, 0);\n        }\n    }\n}\n\n/// Submit a new Keyboard Report to the USB stack.\n///\n/// We do this with interrupts disabled, to avoid a race hazard with the USB IRQ.\nfn push_report(report: KeyboardReport) {\n    let _ = critical_section::with(|_| unsafe {\n        // Now interrupts are disabled\n        USB_HID.as_mut().map(|hid| hid.push_input(&report))\n    })\n    .unwrap();\n}\n\n/// This function is called whenever the USB Hardware generates\n/// an Interrupt Request\n#[allow(non_snake_case)]\n#[interrupt]\nunsafe fn USBCTRL_IRQ() {\n    let usb_device = USB_DEVICE.as_mut().unwrap();\n    let usb_hid = USB_HID.as_mut().unwrap();\n    usb_device.poll(&mut [usb_hid]);\n}\n"
  },
  {
    "path": "boards/boardsource-blok/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n\n    /// GPIO 0 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp0Spi0Rx]          |\n    /// | `UART0 TX`   | [crate::Gp0Uart0Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp0I2C0Sda]         |\n    /// | `PWM0 A`     | [crate::Gp0Pwm0A]           |\n    /// | `PIO0`       | [crate::Gp0Pio0]            |\n    /// | `PIO1`       | [crate::Gp0Pio1]            |\n    Gpio0 {\n        name: gpio0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio0].\n            FunctionUart, PullNone: Gp0Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio0].\n            FunctionSpi, PullNone: Gp0Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio0].\n            FunctionI2C, PullUp: Gp0I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio0].\n            FunctionPwm, PullNone: Gp0Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio0, PullNone: Gp0Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio1, PullNone: Gp0Pio1\n        }\n    },\n\n    /// GPIO 1 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp1Spi0Csn]         |\n    /// | `UART0 RX`   | [crate::Gp1Uart0Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp1I2C0Scl]         |\n    /// | `PWM0 B`     | [crate::Gp1Pwm0B]           |\n    /// | `PIO0`       | [crate::Gp1Pio0]            |\n    /// | `PIO1`       | [crate::Gp1Pio1]            |\n    Gpio1 {\n        name: gpio1,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio1].\n            FunctionUart, PullNone: Gp1Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio1].\n            FunctionSpi, PullNone: Gp1Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio1].\n            FunctionI2C, PullUp: Gp1I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio1].\n            FunctionPwm, PullNone: Gp1Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio0, PullNone: Gp1Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio1, PullNone: Gp1Pio1\n        }\n    },\n\n    /// GPIO 16 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp16Spi0Rx]         |\n    /// | `UART0 TX`   | [crate::Gp16Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp16I2C0Sda]        |\n    /// | `PWM0 A`     | [crate::Gp16Pwm0A]          |\n    /// | `PIO0`       | [crate::Gp16Pio0]           |\n    /// | `PIO1`       | [crate::Gp16Pio1]           |\n    Gpio16 {\n        name: gpio16,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio16].\n            FunctionUart, PullNone: Gp16Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio16].\n            FunctionSpi, PullNone: Gp16Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio16].\n            FunctionI2C, PullUp: Gp16I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio16].\n            FunctionPwm, PullNone: Gp16Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio16].\n            FunctionPio0, PullNone: Gp16Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio16].\n            FunctionPio1, PullNone: Gp16Pio1\n        }\n    },\n\n    /// GPIO 17 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp17Spi0Csn]        |\n    /// | `UART0 RX`   | [crate::Gp17Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp17I2C0Scl]        |\n    /// | `PWM0 B`     | [crate::Gp17Pwm0B]          |\n    /// | `PIO0`       | [crate::Gp17Pio0]           |\n    /// | `PIO1`       | [crate::Gp17Pio1]           |\n    Gpio17 {\n        name: gpio17,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio17].\n            FunctionUart, PullNone: Gp17Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio17].\n            FunctionSpi, PullNone: Gp17Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio17].\n            FunctionI2C, PullUp: Gp17I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio17].\n            FunctionPwm, PullNone: Gp17Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio0, PullNone: Gp17Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio1, PullNone: Gp17Pio1\n        }\n    },\n\n    /// GPIO 4 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp4Spi0Rx]          |\n    /// | `UART1 TX`   | [crate::Gp4Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp4I2C0Sda]         |\n    /// | `PWM2 A`     | [crate::Gp4Pwm2A]           |\n    /// | `PIO0`       | [crate::Gp4Pio0]            |\n    /// | `PIO1`       | [crate::Gp4Pio1]            |\n    Gpio4 {\n        name: gpio4,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio4].\n            FunctionUart, PullNone: Gp4Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio4].\n            FunctionSpi, PullNone: Gp4Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio4].\n            FunctionI2C, PullUp: Gp4I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio4].\n            FunctionPwm, PullNone: Gp4Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio0, PullNone: Gp4Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio1, PullNone: Gp4Pio1\n        }\n    },\n\n    /// GPIO 5 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp5Spi0Csn]         |\n    /// | `UART1 RX`   | [crate::Gp5Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp5I2C0Scl]         |\n    /// | `PWM2 B`     | [crate::Gp5Pwm2B]           |\n    /// | `PIO0`       | [crate::Gp5Pio0]            |\n    /// | `PIO1`       | [crate::Gp5Pio1]            |\n    Gpio5 {\n        name: gpio5,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio5].\n            FunctionUart, PullNone: Gp5Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio5].\n            FunctionSpi, PullNone: Gp5Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio5].\n            FunctionI2C, PullUp: Gp5I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio5].\n            FunctionPwm, PullNone: Gp5Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio0, PullNone: Gp5Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio1, PullNone: Gp5Pio1\n        }\n    },\n\n    /// GPIO 6 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp6Spi0Sck]         |\n    /// | `UART1 CTS`  | [crate::Gp6Uart1Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp6I2C1Sda]         |\n    /// | `PWM3 A`     | [crate::Gp6Pwm3A]           |\n    /// | `PIO0`       | [crate::Gp6Pio0]            |\n    /// | `PIO1`       | [crate::Gp6Pio1]            |\n    Gpio6 {\n        name: gpio6,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio6].\n            FunctionUart, PullNone: Gp6Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio6].\n            FunctionSpi, PullNone: Gp6Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio6].\n            FunctionI2C, PullUp: Gp6I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio6].\n            FunctionPwm, PullNone: Gp6Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio0, PullNone: Gp6Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio1, PullNone: Gp6Pio1\n        }\n    },\n\n    /// GPIO 7 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp7Spi0Tx]          |\n    /// | `UART1 RTS`  | [crate::Gp7Uart1Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp7I2C1Scl]         |\n    /// | `PWM3 B`     | [crate::Gp7Pwm3B]           |\n    /// | `PIO0`       | [crate::Gp7Pio0]            |\n    /// | `PIO1`       | [crate::Gp7Pio1]            |\n    Gpio7 {\n        name: gpio7,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio7].\n            FunctionUart, PullNone: Gp7Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio7].\n            FunctionSpi, PullNone: Gp7Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio7].\n            FunctionI2C, PullUp: Gp7I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio7].\n            FunctionPwm, PullNone: Gp7Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio0, PullNone: Gp7Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio1, PullNone: Gp7Pio1\n        }\n    },\n\n    /// GPIO 8 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp8Spi1Rx]          |\n    /// | `UART1 TX`   | [crate::Gp8Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp8I2C0Sda]         |\n    /// | `PWM4 A`     | [crate::Gp8Pwm4A]           |\n    /// | `PIO0`       | [crate::Gp8Pio0]            |\n    /// | `PIO1`       | [crate::Gp8Pio1]            |\n    Gpio8 {\n        name: gpio8,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio8].\n            FunctionUart, PullNone: Gp8Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio8].\n            FunctionSpi, PullNone: Gp8Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio8].\n            FunctionI2C, PullUp: Gp8I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio8].\n            FunctionPwm, PullNone: Gp8Pwm4A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio0, PullNone: Gp8Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio1, PullNone: Gp8Pio1\n        }\n    },\n\n    /// GPIO 9 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp9Spi1Csn]         |\n    /// | `UART1 RX`   | [crate::Gp9Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp9I2C0Scl]         |\n    /// | `PWM4 B`     | [crate::Gp9Pwm4B]           |\n    /// | `PIO0`       | [crate::Gp9Pio0]            |\n    /// | `PIO1`       | [crate::Gp9Pio1]            |\n    Gpio9 {\n        name: gpio9,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio9].\n            FunctionUart, PullNone: Gp9Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio9].\n            FunctionSpi, PullNone: Gp9Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio9].\n            FunctionI2C, PullUp: Gp9I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio9].\n            FunctionPwm, PullNone: Gp9Pwm4B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio0, PullNone: Gp9Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio1, PullNone: Gp9Pio1\n        }\n    },\n\n    /// GPIO 29 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp29Spi1Csn]         |\n    /// | `UART0 RX`   | [crate::Gp29Uart0Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp29I2C0Scl]         |\n    /// | `PWM4 B`     | [crate::Gp29Pwm6B]           |\n    /// | `PIO0`       | [crate::Gp29Pio0]            |\n    /// | `PIO1`       | [crate::Gp29Pio1]            |\n    Gpio29 {\n        name: gpio29,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio29].\n            FunctionUart, PullNone: Gp29Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio29].\n            FunctionSpi, PullNone: Gp29Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio29].\n            FunctionI2C, PullUp: Gp29I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio29].\n            FunctionPwm, PullNone: Gp29Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio29].\n            FunctionPio0, PullNone: Gp29Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio29].\n            FunctionPio1, PullNone: Gp29Pio1\n        }\n    },\n\n    /// GPIO 28 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp28Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp28Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp28I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp28Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp28Pio0]           |\n    /// | `PIO1`       | [crate::Gp28Pio1]           |\n    Gpio28 {\n        name: gpio28,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp28Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp28Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp28I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp28Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp28Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp28Pio1\n        }\n    },\n\n    /// GPIO 27 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp27Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp27Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp27I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp27Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp27Pio0]           |\n    /// | `PIO1`       | [crate::Gp27Pio1]           |\n    Gpio27 {\n        name: gpio27,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio27].\n            FunctionUart, PullNone: Gp27Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio27].\n            FunctionSpi, PullNone: Gp27Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio27].\n            FunctionPwm, PullNone: Gp27Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio0, PullNone: Gp27Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio1, PullNone: Gp27Pio1\n        }\n    },\n\n    /// GPIO 26 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp26Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp26Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp26I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp26Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp26Pio0]           |\n    /// | `PIO1`       | [crate::Gp26Pio1]           |\n    Gpio26 {\n        name: gpio26,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio26].\n            FunctionUart, PullNone: Gp26Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio26].\n            FunctionSpi, PullNone: Gp26Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio26].\n            FunctionPwm, PullNone: Gp26Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio0, PullNone: Gp26Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio1, PullNone: Gp26Pio1\n        }\n    },\n\n    /// GPIO 22 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp22Spi0Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp22Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp22I2C1Sda]        |\n    /// | `PWM3 A`     | [crate::Gp22Pwm3A]          |\n    /// | `PIO0`       | [crate::Gp22Pio0]           |\n    /// | `PIO1`       | [crate::Gp22Pio1]           |\n    Gpio22 {\n        name: gpio22,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio22].\n            FunctionUart, PullNone: Gp22Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio22].\n            FunctionSpi, PullNone: Gp22Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio22].\n            FunctionI2C, PullUp: Gp22I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio22].\n            FunctionPwm, PullNone: Gp22Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio0, PullNone: Gp22Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio1, PullNone: Gp22Pio1\n        }\n    },\n\n    /// GPIO 20 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp20Spi0Rx]         |\n    /// | `UART1 TX`   | [crate::Gp20Uart1Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp20I2C0Sda]        |\n    /// | `PWM2 A`     | [crate::Gp20Pwm2A]          |\n    /// | `PIO0`       | [crate::Gp20Pio0]           |\n    /// | `PIO1`       | [crate::Gp20Pio1]           |\n    Gpio20 {\n        name: gpio20,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio20].\n            FunctionUart, PullNone: Gp20Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio20].\n            FunctionSpi, PullNone: Gp20Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio20].\n            FunctionI2C, PullUp: Gp20I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio20].\n            FunctionPwm, PullNone: Gp20Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio0, PullNone: Gp20Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio1, PullNone: Gp20Pio1\n        }\n    },\n\n    /// GPIO 23 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`   | [crate::Gp23Spi0Tx]        |\n    /// | `UART1 RTS`   | [crate::Gp23Uart1Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp23I2C1Scl]        |\n    /// | `PWM3 B`     | [crate::Gp23Pwm3B]          |\n    /// | `PIO0`       | [crate::Gp23Pio0]           |\n    /// | `PIO1`       | [crate::Gp23Pio1]           |\n    Gpio23 {\n        name: gpio23,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio21].\n            FunctionUart, PullNone: Gp23Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio21].\n            FunctionSpi, PullNone: Gp23Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio21].\n            FunctionI2C, PullUp: Gp23I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio21].\n            FunctionPwm, PullNone: Gp23Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio0, PullNone: Gp23Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio1, PullNone: Gp23Pio1\n        }\n    },\n\n    /// GPIO 21 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp21Spi0Csn]        |\n    /// | `UART1 RX`   | [crate::Gp21Uart1Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp21I2C0Scl]        |\n    /// | `PWM2 B`     | [crate::Gp21Pwm2B]          |\n    /// | `PIO0`       | [crate::Gp21Pio0]           |\n    /// | `PIO1`       | [crate::Gp21Pio1]           |\n    Gpio21 {\n        name: gpio21,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio21].\n            FunctionUart, PullNone: Gp21Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio21].\n            FunctionSpi, PullNone: Gp21Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio21].\n            FunctionI2C, PullUp: Gp21I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio21].\n            FunctionPwm, PullNone: Gp21Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio0, PullNone: Gp21Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio1, PullNone: Gp21Pio1\n        }\n    },\n\n    /// GPIO 25 is connected to a neopixel on the top right of the board\n    Gpio25 {\n        name: neopixel,\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/framework-ledmatrix/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/framework-ledmatrix/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.1.0 - 2024-10-21\n\n### Added\n\n- Initial release of Framework LED Matrix HAL\n"
  },
  {
    "path": "boards/framework-ledmatrix/Cargo.toml",
    "content": "[package]\nname = \"framework-ledmatrix\"\nversion = \"0.1.0\"\nauthors = [\"Daniel Schaefer <dhs@frame.work>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/framework-ledmatrix\"\ndescription = \"Board Support Package for the Framework LED Matrix\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nfugit.workspace = true\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\ncritical-section.workspace = true\nembedded-graphics.workspace = true\nembedded-hal.workspace = true\nheapless.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\nrp2040-hal = { workspace = true, features = [ \"defmt\" ] }\nis31fl3741 = { version = \"0.4.0\", features = [ \"framework_ledmatrix\" ] }\n\ndefmt.workspace = true\ndefmt-rtt.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/framework-ledmatrix/README.md",
    "content": "# [framework-ledmatrix] - Board Support for the [Framework LED Matrix]\n\nYou should include this crate if you are writing code that you want to run on\na [Frameworkg LED Matrix].\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the module.\n\n[Framework LED Matrix]: https://frame.work/tw/en/products/16-led-matrix\n[framework-ledmatrix]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/framework-ledmatrix\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nframework-ledmatrix = \"0.1.0\"\n```\n\nIn your program, you will need to call `framework_ledmatrix::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/framework-ledmatrix $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/framework-ledmatrix $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\nthen try repeating the `cargo run` command above.\n\n### From Scratch\n\nTo start a basic project from scratch, create a project using `cargo new project-name`. Within the\nproject directory, run `cargo add framework-ledmatrix`, `cargo add cortex-m-rt`, and `cargo add panic-halt`. The\nfirst command will add this HAL (Hardware Abstraction Layer), the second is required for the `#[entry]` macro, and _panic-halt_ creates a simple panic function, which just halts.\n\nYou'll also need to copy the cargo config file from the [repo](https://github.com/rp-rs/rp-hal-boards/blob/main/.cargo/config.toml). It specifies the target and optimizing flags to the linker. You'll also need to copy [_memory.x_](https://github.com/rp-rs/rp-hal-boards/blob/main/memory.x) to your project root. This file tells the linker the flash and RAM layout, so it won't clobber the bootloader or write to an out of bounds memory address. \n\nThe simplest working example, which does nothing except loop forever, is:\n\n```ignore\n#![no_std]\n#![no_main]\nuse framework_ledmatrix::entry;\nuse panic_halt as _;\n#[entry]\nfn see_doesnt_have_to_be_called_main() -> ! {\n  loop {}\n}\n```\n\nIt can be placed in _/src/main.rs_. \n\nYou can use `cargo run` to compile and install it. \n**Note**: You won't see any activity since this program does nothing. You can use the examples provided\nto add more functionality. \n\n### [ledtest](./examples/ledtest.rs)\n\nLights up every single LED one after another. It goes back into bootloader mode\nwhen the system goes to sleep. This makes it easy for you to reflash it to\nother firmware.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/framework-ledmatrix/build.rs",
    "content": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n    println!(\"cargo:rustc-link-arg-examples=-Tdefmt.x\");\n}\n"
  },
  {
    "path": "boards/framework-ledmatrix/examples/ledtest.rs",
    "content": "//! # Framework LED Matrix Module LED Test Example\n//!\n//! Lights up every single LED one after another.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n#![allow(clippy::needless_range_loop)]\n\n// The macro for our start-up function\nuse framework_ledmatrix::entry;\nuse framework_ledmatrix::{Pins, XOSC_CRYSTAL_FREQ};\n\nuse embedded_hal::digital::{InputPin, OutputPin};\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse framework_ledmatrix::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse framework_ledmatrix::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse framework_ledmatrix::hal;\n\nuse fugit::RateExtU32;\n\n/// Maximum brightness out of 255\n///\n/// 100/255 results in 250mA current draw and is plenty bright.\n///  50/255 results in 160mA current draw and is plenty bright.\nconst MAX_BRIGHTNESS: u8 = 50;\n\nuse is31fl3741::devices::{LedMatrix, CALC_PIXEL};\n\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // Enable LED controller\n    // SDB - Gpio29\n    let mut led_enable = pins.sdb.into_push_pull_output();\n    led_enable.set_high().unwrap();\n    // INTB. Currently ignoring\n    pins.intb.into_floating_input();\n\n    let sda_pin: hal::gpio::Pin<_, hal::gpio::FunctionI2C, _> = pins.gpio26.reconfigure();\n    let scl_pin: hal::gpio::Pin<_, hal::gpio::FunctionI2C, _> = pins.gpio27.reconfigure();\n\n    let i2c = hal::I2C::i2c1(\n        pac.I2C1,\n        sda_pin,\n        scl_pin,\n        1000.kHz(),\n        &mut pac.RESETS,\n        &clocks.peripheral_clock,\n    );\n\n    let mut dip1 = pins.dip1.into_pull_up_input();\n    let _ = dip1.is_high().unwrap();\n\n    // Detect whether the sleep pin is connected\n    // Early revisions of the hardware didn't have it wired up, if that is the\n    // case we have to ignore its state.\n    let mut sleep_present = false;\n    let mut sleep = pins.sleep.into_pull_up_input();\n    if sleep.is_low().unwrap() {\n        sleep_present = true;\n    }\n    let mut sleep = sleep.into_pull_down_input();\n    if sleep.is_high().unwrap() {\n        sleep_present = true;\n    }\n\n    let mut matrix = LedMatrix::new(i2c, CALC_PIXEL);\n    matrix\n        .setup(&mut delay)\n        .expect(\"failed to setup RGB controller\");\n\n    // Enable only the SW pins that we're using.\n    // Otherwise driving the unused pins might result in audible noise.\n    matrix\n        .device\n        .sw_enablement(is31fl3741::SwSetting::Sw1Sw8)\n        .unwrap();\n\n    matrix\n        .set_scaling(MAX_BRIGHTNESS)\n        .expect(\"failed to set scaling\");\n\n    loop {\n        // Light up each LED, one by one\n        for y in 0..matrix.device.height {\n            for x in 0..matrix.device.width {\n                matrix.device.pixel(x, y, 0xFF).expect(\"couldn't turn on\");\n                delay.delay_ms(100);\n                matrix.device.pixel(x, y, 0).expect(\"couldn't turn off\");\n\n                // Reset into bootloader if system asleep\n                if sleep_present && sleep.is_low().unwrap() {\n                    hal::rom_data::reset_to_usb_boot(0, 0);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "boards/framework-ledmatrix/src/lib.rs",
    "content": "#![no_std]\n\n//! A Hardware Abstraction Layer for the Framework LED Matrix\n//!\n//! This crate serves as a HAL (Hardware Abstraction Layer) for the Framework LED Matrix. Since it\n//! is based on the RP2040 chip, it re-exports the [rp2040_hal] crate which contains the tooling to work with the\n//! rp2040 chip.\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 is connected to the SLEEP# pin of the EC\n    Gpio0 { name: sleep },\n    /// GPIO 25 is connected to the DIP Switch #1\n    Gpio25 { name: dip1 },\n    /// GPIO 26 is connected to I2C SDA of the LED controller\n    Gpio26 {\n        name: gpio26,\n        aliases: {\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda\n        }\n    },\n    /// GPIO 27 is connected to I2C SCL of the LED controller\n    Gpio27 {\n        name: gpio27,\n        aliases: {\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl\n        }\n    },\n    /// GPIO 29 is connected to the INTB pin of the LED controller\n    Gpio28 { name: intb },\n    /// GPIO 29 is connected to the SDB pin of the LED controller\n    Gpio29 { name: sdb },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/framework16-keyboard/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/framework16-keyboard/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.1.0 - 2024-10-21\n\n### Added\n\n- Initial release of Frameworkt 16 Keyboard HAL\n"
  },
  {
    "path": "boards/framework16-keyboard/Cargo.toml",
    "content": "[package]\nname = \"framework16-keyboard\"\nversion = \"0.1.0\"\nauthors = [\"Daniel Schaefer <dhs@frame.work>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/framework16-keyboard\"\ndescription = \"Board Support Package for the Framework 16 Keyboards\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\ncritical-section.workspace = true\nembedded-hal.workspace = true\nheapless.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\nrp2040-hal = { workspace = true, features = [ \"defmt\" ] }\n\ndefmt.workspace = true\ndefmt-rtt.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/framework16-keyboard/README.md",
    "content": "# [framework16-keyboard] - Board Support for the [Framework 16 Keyboard]\n\nYou should include this crate if you are writing code that you want to run on\na [Framework 16 Keyboard].\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the module.\n\n[Framework 16 Keyboard]: https://frame.work/tw/en/products/keyboard-module\n[framework16-keyboard]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/framework16-keyboard\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nframework16-keyboard = \"0.1.0\"\n```\n\nIn your program, you will need to call `framewogk16_keyboard::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/framework16-keyboard $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/framework16-keyboard $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\nthen try repeating the `cargo run` command above.\n\n### From Scratch\n\nTo start a basic project from scratch, create a project using `cargo new project-name`. Within the\nproject directory, run `cargo add framework16-keyboard`, `cargo add cortex-m-rt`, and `cargo add panic-halt`. The\nfirst command will add this HAL (Hardware Abstraction Layer), the second is required for the `#[entry]` macro, and _panic-halt_ creates a simple panic function, which just halts.\n\nYou'll also need to copy the cargo config file from the [repo](https://github.com/rp-rs/rp-hal-boards/blob/main/.cargo/config.toml). It specifies the target and optimizing flags to the linker. You'll also need to copy [_memory.x_](https://github.com/rp-rs/rp-hal-boards/blob/main/memory.x) to your project root. This file tells the linker the flash and RAM layout, so it won't clobber the bootloader or write to an out of bounds memory address. \n\nThe simplest working example, which does nothing except loop forever, is:\n\n```ignore\n#![no_std]\n#![no_main]\nuse framework16_keyboard::entry;\nuse panic_halt as _;\n#[entry]\nfn see_doesnt_have_to_be_called_main() -> ! {\n  loop {}\n}\n```\n\nIt can be placed in _/src/main.rs_. \n\nYou can use `cargo run` to compile and install it. \n**Note**: You won't see any activity since this program does nothing. You can use the examples provided\nto add more functionality. \n\n### [capslock](./examples/capslock.rs)\n\nFlashes the keyboard's capslock LED on and off.\n\nOnly works on keyboards, not the numpad or macropad.\n\n### [white_backlight](./examples/white_backlight.rs)\n\nPulses the backlight on and off.\n\nOnly works on white backlight keyboard or numpad.\nNot on RGB keyboards or the macropad.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/framework16-keyboard/build.rs",
    "content": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n    println!(\"cargo:rustc-link-arg-examples=-Tdefmt.x\");\n}\n"
  },
  {
    "path": "boards/framework16-keyboard/examples/capslock.rs",
    "content": "//! # Framework 16 Keyboard Capslock Example\n//!\n//! Blink the capslock LED on Framework 16 keyboards\n//!\n//! Note: This won't work on the numpad or macropad, as they don't have capslock\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse framework16_keyboard::entry;\nuse framework16_keyboard::{Pins, XOSC_CRYSTAL_FREQ};\n\nuse embedded_hal::digital::{InputPin, OutputPin};\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse framework16_keyboard::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse framework16_keyboard::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse framework16_keyboard::hal;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then fades the LED in an\n/// infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    let mut caps_led = pins.caps_led.into_push_pull_output();\n    let mut sleep = pins.sleep.into_floating_input();\n\n    loop {\n        // Turn off LED in sleep\n        if sleep.is_low().unwrap() {\n            caps_led.set_low().unwrap();\n            delay.delay_ms(100);\n            continue;\n        }\n\n        // Blink LED otherwise\n        caps_led.set_high().unwrap();\n        delay.delay_ms(500);\n        caps_led.set_low().unwrap();\n        delay.delay_ms(500);\n    }\n}\n"
  },
  {
    "path": "boards/framework16-keyboard/examples/white_backlight.rs",
    "content": "//! # Framework 16 Keyboard/Numpad Backlight Example\n//!\n//! Blink the white backlight on Framework 16 keyboards or numpads\n//!\n//! Note this won't work on RGB keyboards or the macropad.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse framework16_keyboard::entry;\nuse framework16_keyboard::{Pins, XOSC_CRYSTAL_FREQ};\n\n// GPIO traits\nuse embedded_hal::digital::InputPin;\nuse embedded_hal::pwm::SetDutyCycle;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse framework16_keyboard::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse framework16_keyboard::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse framework16_keyboard::hal;\n\n// The minimum PWM value (i.e. LED brightness) we want\nconst LOW: u16 = 0;\n\n// The maximum PWM value (i.e. LED brightness) we want\nconst HIGH: u16 = 25000;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then fades the LED in an\n/// infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    let mut sleep = pins.sleep.into_floating_input();\n\n    // Init PWMs\n    let mut pwm_slices = hal::pwm::Slices::new(pac.PWM, &mut pac.RESETS);\n\n    // Configure PWM4\n    let pwm = &mut pwm_slices.pwm4;\n    pwm.set_ph_correct();\n    pwm.enable();\n\n    // Output channel B on PWM4 to the LED pin\n    let channel = &mut pwm.channel_b;\n    channel.output_to(pins.backlight);\n\n    // Infinite loop, fading backlight up and down\n    loop {\n        // Turn off backlight in sleep\n        if sleep.is_low().unwrap() {\n            let _ = channel.set_duty_cycle(LOW);\n            delay.delay_ms(100);\n            continue;\n        }\n\n        // Ramp brightness up\n        for i in (LOW..=HIGH).skip(100) {\n            delay.delay_us(8);\n            let _ = channel.set_duty_cycle(i);\n        }\n\n        // Ramp brightness down\n        for i in (LOW..=HIGH).rev().skip(100) {\n            delay.delay_us(8);\n            let _ = channel.set_duty_cycle(i);\n        }\n\n        delay.delay_ms(500);\n    }\n}\n"
  },
  {
    "path": "boards/framework16-keyboard/src/lib.rs",
    "content": "#![no_std]\n\n//! A Hardware Abstraction Layer for the Framework 16 Keyboards\n//!\n//! This crate serves as a HAL (Hardware Abstraction Layer) for the Framework 16 Keyboards. Since they\n//! is based on the RP2040 chip, it re-exports the [rp2040_hal] crate which contains the tooling to work with the\n//! rp2040 chip.\n//!\n//! # Examples:\n//!\n//! The following example turns on the onboard LED. Note that most of the logic works through the [rp2040_hal] crate.\n//! ```ignore\n//! #![no_main]\n//! use framework16_keyboard::entry;\n//! use panic_halt as _;\n//! use embedded_hal::digital::v2::OutputPin;\n//! use framework16_keyboard::hal::pac;\n//! use framework16_keyboard::hal;\n\n//! #[entry]\n//! fn does_not_have_to_be_main() -> ! {\n//!   let mut pac = pac::Peripherals::take().unwrap();\n//!   let sio = hal::Sio::new(pac.SIO);\n//!   let pins = framework16_keyboard::Pins::new(\n//!        pac.IO_BANK0,\n//!        pac.PADS_BANK0,\n//!        sio.gpio_bank0,\n//!        &mut pac.RESETS,\n//!   );\n//!   let mut led_pin = pins.caps_led.into_push_pull_output();\n//!   led_pin.set_high().unwrap();\n//!   loop {\n//!   }\n//! }\n//! ```\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 is connected to the SLEEP# pin of the EC\n    Gpio0 { name: sleep },\n    /// Mux selector A\n    Gpio1 { name: mux_a },\n    /// Mux selector B\n    Gpio2 { name: mux_b },\n    /// Mux selector C\n    Gpio3 { name: mux_c },\n    /// Mux enable\n    Gpio4 { name: mux_enable },\n    /// Pull low when firmware has started to turn off bootloader logic\n    Gpio5 { name: boot_done },\n    /// Connected to KSI5 but unused, should use high-Z\n    Gpio6 {\n        name: ksi5_reserved\n    },\n    /// Connected to KSI5 but unused, should use high-Z\n    Gpio7 {\n        name: ksi6_reserved\n    },\n    /// Keyboard column drive\n    Gpio8 { name: kso0 },\n    /// Keyboard column drive\n    Gpio9 { name: kso1 },\n    /// Keyboard column drive\n    Gpio10 { name: kso2 },\n    /// Keyboard column drive\n    Gpio11 { name: kso3 },\n    /// Keyboard column drive\n    Gpio12 { name: kso4 },\n    /// Keyboard column drive\n    Gpio13 { name: kso5 },\n    /// Keyboard column drive\n    Gpio14 { name: kso6 },\n    /// Keyboard column drive\n    Gpio15 { name: kso7 },\n    /// Keyboard column drive\n    Gpio16 { name: kso13 },\n    /// Keyboard column drive\n    Gpio17 { name: kso12 },\n    /// Keyboard column drive\n    Gpio18 { name: kso11 },\n    /// Keyboard column drive\n    Gpio19 { name: kso10 },\n    /// Keyboard column drive\n    Gpio20 { name: kso9 },\n    /// Keyboard column drive\n    Gpio21 { name: kso8 },\n    /// Keyboard column drive\n    Gpio22 { name: kso15 },\n    /// Keyboard column drive\n    Gpio23 { name: kso14 },\n    /// Capslock LED\n    Gpio24 { name: caps_led },\n    /// Single zone backlight (unused on RGB keyboard)\n    Gpio25 {\n        name: backlight,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::gpio25].\n            FunctionPwm, PullNone: Gp25Pwm4B\n        }\n    },\n    /// GPIO 26 is connected to I2C SDA of the LED controller\n    Gpio26 {\n        name: gpio26,\n        aliases: {\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda\n        }\n    },\n    /// GPIO 27 is connected to I2C SCL of the LED controller\n    Gpio27 {\n        name: gpio27,\n        aliases: {\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl\n        }\n    },\n    /// Analog IN from mux\n    Gpio28 { name: analog_in },\n    /// GPIO 29 is connected to the SDB pin of the LED controller\n    Gpio29 { name: sdb },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/pimoroni-pico-explorer/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.8.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.7.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n\n## 0.6.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n\n## 0.5.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n\n## 0.4.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Update to rp2040-hal 0.6.0\n\n## 0.3.0 - 2022-06-13\n\n### Changed\n\n- Update to rp2040-hal 0.5.0\n\n## 0.2.0 - 2022-03-11\n\n### Changed\n\n- Update to rp2040-hal 0.4.0\n\n## 0.1.0 - 2021-12-20\n\n- Initial release\n\n"
  },
  {
    "path": "boards/pimoroni-pico-explorer/Cargo.toml",
    "content": "[package]\nname = \"pimoroni-pico-explorer\"\nversion = \"0.8.0\"\nauthors = [\"Hmvp <hmvp@users.noreply.github.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-pico-explorer\"\ndescription = \"Board Support Package for the Pico Explorer\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\ndisplay-interface-spi.workspace = true\nembedded-graphics.workspace = true\nembedded-hal = { workspace = true }\nembedded_hal_0_2.workspace = true\nfugit.workspace = true\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\nst7789.workspace = true\n\n[dev-dependencies]\narrayvec.workspace = true\ncortex-m.workspace = true\ndisplay-interface.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\", \"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/pimoroni-pico-explorer/README.md",
    "content": "# [pimoroni-pico-explorer] - Board Support for the [Pimoroni Pico Explorer]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Pico Explorer] - a board featuring a small LCD screen, a\nbreadboard and some breakout headers.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Pico Explorer.\n\n[Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pimoroni-pico-explorer-base\n[pimoroni-pico-explorer]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-pico-explorer\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\npimoroni-pico-explorer = \"0.8.0\"\n```\n\nIn your program, you will need to call `pimoroni_pico_explorer::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/pimoroni-pico-explorer $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/pimoroni-pico-explorer $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [pimoroni_pico_explorer_showcase](./examples/pimoroni_pico_explorer_showcase.rs)\n\nDisplays the current temperature on the Pico Explorer's on-board LCD screen.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/pimoroni-pico-explorer/examples/pimoroni_pico_explorer_showcase.rs",
    "content": "#![no_std]\n#![no_main]\n\nuse arrayvec::ArrayString;\nuse core::fmt::Write;\nuse embedded_graphics::{\n    mono_font::{ascii::FONT_10X20, MonoTextStyleBuilder},\n    pixelcolor::Rgb565,\n    prelude::*,\n    text::{Alignment, Text},\n};\nuse embedded_hal::digital::OutputPin;\nuse hal::{adc::Adc, clocks::*, watchdog::Watchdog, Sio};\nuse panic_halt as _;\nuse pimoroni_pico_explorer::entry;\nuse pimoroni_pico_explorer::{hal, pac, Button, PicoExplorer, XOSC_CRYSTAL_FREQ};\n\n// See 4.9.5 from RP2040 datasheet\nfn calc_temp(adc_value: f32, refv: f64) -> f64 {\n    let vbe: f64 = f64::from(adc_value) * refv;\n    27f64 - (vbe - 0.706) / 0.001721\n}\n\n#[entry]\nfn main() -> ! {\n    let mut p = pac::Peripherals::take().unwrap();\n    let cp = pac::CorePeripherals::take().unwrap();\n\n    // Enable watchdog and clocks\n    let mut watchdog = Watchdog::new(p.WATCHDOG);\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        p.XOSC,\n        p.CLOCKS,\n        p.PLL_SYS,\n        p.PLL_USB,\n        &mut p.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let mut delay = cortex_m::delay::Delay::new(cp.SYST, clocks.system_clock.get_freq().to_Hz());\n\n    // Enable adc\n    let mut adc = Adc::new(p.ADC, &mut p.RESETS);\n    let mut temp_sense = adc.take_temp_sensor().unwrap();\n\n    let sio = Sio::new(p.SIO);\n\n    let (mut explorer, pins) = PicoExplorer::new(\n        p.IO_BANK0,\n        p.PADS_BANK0,\n        sio.gpio_bank0,\n        p.SPI0,\n        adc,\n        &mut p.RESETS,\n        &mut delay,\n    );\n\n    let mut led = pins.led.into_push_pull_output();\n\n    let mut even = true;\n    loop {\n        delay.delay_ms(500);\n\n        // Set GPIO25 to be low\n        led.set_low().unwrap();\n\n        delay.delay_ms(500);\n\n        // Set GPIO25 to be high\n        led.set_high().unwrap();\n\n        let adc_value = explorer.get_adc(&mut temp_sense);\n        let temp: f64 = calc_temp(adc_value, 3.3);\n\n        // Create a fixed buffer to store screen contents\n        let mut buf = ArrayString::<100>::new();\n\n        // Write to buffer\n        writeln!(&mut buf, \"Hello World {}\", if even { '|' } else { '-' }).unwrap();\n        writeln!(&mut buf, \"Temp: {:.1}\", temp).unwrap();\n        writeln!(\n            &mut buf,\n            \"A:{:.1} B:{:.1}\\nX:{:.1} Y:{:.1}\",\n            explorer.is_pressed(Button::A),\n            explorer.is_pressed(Button::B),\n            explorer.is_pressed(Button::X),\n            explorer.is_pressed(Button::Y)\n        )\n        .unwrap();\n\n        // Draw buffer on screen\n        let style = MonoTextStyleBuilder::new()\n            .font(&FONT_10X20)\n            .text_color(Rgb565::GREEN)\n            .background_color(Rgb565::BLACK)\n            .build();\n        Text::with_alignment(&buf, Point::new(20, 30), style, Alignment::Left)\n            .draw(&mut explorer.screen)\n            .unwrap();\n\n        even = !even;\n    }\n}\n"
  },
  {
    "path": "boards/pimoroni-pico-explorer/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n///\n/// This currently assumes an rp-pico or pimoroni-pico-lipo is used as the brains.\n/// Currently those are the only boards that have the right pin out to be able to be used\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\nuse display_interface_spi::SPIInterface;\nuse embedded_graphics::{\n    draw_target::DrawTarget,\n    pixelcolor::{Rgb565, RgbColor},\n};\nuse embedded_hal_0_2::{\n    adc::{Channel, OneShot},\n    blocking::delay::DelayUs,\n    digital::v2::{InputPin, OutputPin},\n    spi::MODE_0,\n};\nuse fugit::RateExtU32;\npub use hal::pac;\nuse hal::{\n    adc::Adc,\n    gpio::{\n        bank0::{\n            Gpio0, Gpio1, Gpio12, Gpio13, Gpio14, Gpio15, Gpio16, Gpio17, Gpio2, Gpio22, Gpio23,\n            Gpio24, Gpio25, Gpio26, Gpio27, Gpio28, Gpio29, Gpio3, Gpio4, Gpio5, Gpio6, Gpio7,\n        },\n        FunctionNull, FunctionPwm, FunctionSioInput, FunctionSioOutput, Pin, PullNone, PullUp,\n    },\n    pac::{RESETS, SPI0},\n    sio::SioGpioBank0,\n    spi::{Enabled, Spi},\n};\nuse st7789::ST7789;\n\npub mod all_pins {\n    hal::bsp_pins!(\n        Gpio0 { name: gpio0 },\n        Gpio1 { name: gpio1 },\n        Gpio2 { name: gpio2 },\n        Gpio3 { name: gpio3 },\n        Gpio4 { name: gpio4 },\n        Gpio5 { name: gpio5 },\n        Gpio6 { name: gpio6 },\n        Gpio7 { name: gpio7 },\n        Gpio8 {\n            name: motor1_neg,\n            aliases: { FunctionPwm, PullNone: Motor1Neg }\n        },\n        Gpio9 {\n            name: motor1_pos,\n            aliases: { FunctionPwm, PullNone: Motor1Pos }\n        },\n        Gpio10 {\n            name: motor2_neg,\n            aliases: { FunctionPwm, PullNone: Motor2Neg }\n        },\n        Gpio11 {\n            name: motor2_pos,\n            aliases: { FunctionPwm, PullNone: Motor2Pos }\n        },\n        Gpio12 { name: switch_a },\n        Gpio13 { name: switch_b },\n        Gpio14 { name: switch_x },\n        Gpio15 { name: switch_y },\n        Gpio16 {\n            name: spi_miso,\n            aliases: { FunctionSpi, PullNone: Miso }\n        },\n        Gpio17 {\n            name: lcd_cs,\n            aliases: { FunctionSpi, PullNone: LcdCs }\n        },\n        Gpio18 {\n            name: spi_sclk,\n            aliases: { FunctionSpi, PullNone: Sclk }\n        },\n        Gpio19 {\n            name: spi_mosi,\n            aliases: { FunctionSpi, PullNone: Mosi }\n        },\n        Gpio20 {\n            name: i2c_sda,\n            aliases: { FunctionI2C, PullUp: Sda }\n        },\n        Gpio21 {\n            name: i2c_scl,\n            aliases: { FunctionI2C, PullUp: Scl }\n        },\n        Gpio22 { name: i2c_int },\n        Gpio23 { name: b_power_save },\n        Gpio24 { name: vbus_detect },\n        Gpio25 { name: led },\n        Gpio26 { name: adc0 },\n        Gpio27 { name: adc1 },\n        Gpio28 { name: adc2 },\n        Gpio29 {\n            name: voltage_monitor\n        },\n    );\n}\n\n// Can't use `hal::bsp_pins!` here because some pins are not set to their reset state\npub struct Pins {\n    pub gpio0: Pin<Gpio0, FunctionNull, PullNone>,\n    pub gpio1: Pin<Gpio1, FunctionNull, PullNone>,\n    pub gpio2: Pin<Gpio2, FunctionNull, PullNone>,\n    pub gpio3: Pin<Gpio3, FunctionNull, PullNone>,\n    pub gpio4: Pin<Gpio4, FunctionNull, PullNone>,\n    pub gpio5: Pin<Gpio5, FunctionNull, PullNone>,\n    pub gpio6: Pin<Gpio6, FunctionNull, PullNone>,\n    pub gpio7: Pin<Gpio7, FunctionNull, PullNone>,\n    pub i2c_sda: all_pins::Sda,\n    pub i2c_scl: all_pins::Scl,\n    pub i2c_int: Pin<Gpio22, FunctionSioInput, PullUp>,\n    pub b_power_save: Pin<Gpio23, FunctionNull, PullNone>,\n    pub vbus_detect: Pin<Gpio24, FunctionNull, PullNone>,\n    pub led: Pin<Gpio25, FunctionNull, PullNone>,\n    pub adc0: Pin<Gpio26, FunctionNull, PullNone>,\n    pub adc1: Pin<Gpio27, FunctionNull, PullNone>,\n    pub adc2: Pin<Gpio28, FunctionNull, PullNone>,\n    pub voltage_monitor: Pin<Gpio29, FunctionNull, PullNone>,\n}\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\npub enum Button {\n    A,\n    B,\n    X,\n    Y,\n}\n\npub enum Motor {\n    _1,\n    _2,\n}\n\npub enum MotorAction {\n    Forward(f32),\n    Reverse(f32),\n    Stop,\n}\n\npub type Screen = ST7789<\n    SPIInterface<\n        Spi<Enabled, SPI0, (all_pins::Mosi, all_pins::Sclk), 8>,\n        Pin<Gpio16, FunctionSioOutput, PullNone>,\n        Pin<Gpio17, FunctionSioOutput, PullNone>,\n    >,\n    DummyPin,\n>;\n\npub struct PicoExplorer {\n    pub a: Pin<Gpio12, FunctionSioInput, PullUp>,\n    pub b: Pin<Gpio13, FunctionSioInput, PullUp>,\n    pub x: Pin<Gpio14, FunctionSioInput, PullUp>,\n    pub y: Pin<Gpio15, FunctionSioInput, PullUp>,\n    adc: Adc,\n    pub screen: Screen,\n}\n\npub struct DummyPin;\n\nimpl OutputPin for DummyPin {\n    type Error = ();\n    fn set_high(&mut self) -> Result<(), Self::Error> {\n        Ok(())\n    }\n    fn set_low(&mut self) -> Result<(), Self::Error> {\n        Ok(())\n    }\n}\n\nimpl PicoExplorer {\n    pub fn new(\n        io: pac::IO_BANK0,\n        pads: pac::PADS_BANK0,\n        sio: SioGpioBank0,\n        spi0: SPI0,\n        adc: Adc,\n        resets: &mut RESETS,\n        delay: &mut impl DelayUs<u32>,\n    ) -> (Self, Pins) {\n        let internal_pins = all_pins::Pins::new(io, pads, sio, resets);\n\n        let a = internal_pins.switch_a.into_pull_up_input();\n        let b = internal_pins.switch_b.into_pull_up_input();\n        let x = internal_pins.switch_x.into_pull_up_input();\n        let y = internal_pins.switch_y.into_pull_up_input();\n\n        internal_pins.motor1_pos.into_function::<FunctionPwm>();\n        internal_pins.motor1_neg.into_function::<FunctionPwm>();\n        internal_pins.motor2_pos.into_function::<FunctionPwm>();\n        internal_pins.motor2_neg.into_function::<FunctionPwm>();\n\n        let dc = internal_pins.spi_miso.reconfigure();\n        let cs = internal_pins.lcd_cs.reconfigure();\n        let spi_sclk = internal_pins.spi_sclk.reconfigure();\n        let spi_mosi = internal_pins.spi_mosi.reconfigure();\n\n        let spi_screen =\n            Spi::new(spi0, (spi_mosi, spi_sclk)).init(resets, 125u32.MHz(), 16u32.MHz(), MODE_0);\n\n        let spii_screen = SPIInterface::new(spi_screen, dc, cs);\n\n        let mut screen = ST7789::new(spii_screen, DummyPin, 240, 240);\n\n        screen.init(delay).unwrap();\n        screen\n            .set_orientation(st7789::Orientation::Portrait)\n            .unwrap();\n        screen.clear(Rgb565::BLACK).unwrap();\n\n        (\n            PicoExplorer {\n                a,\n                b,\n                x,\n                y,\n                adc,\n                screen,\n            },\n            Pins {\n                gpio0: internal_pins.gpio0.reconfigure(),\n                gpio1: internal_pins.gpio1.reconfigure(),\n                gpio2: internal_pins.gpio2.reconfigure(),\n                gpio3: internal_pins.gpio3.reconfigure(),\n                gpio4: internal_pins.gpio4.reconfigure(),\n                gpio5: internal_pins.gpio5.reconfigure(),\n                gpio6: internal_pins.gpio6.reconfigure(),\n                gpio7: internal_pins.gpio7.reconfigure(),\n                i2c_sda: internal_pins.i2c_sda.reconfigure(),\n                i2c_scl: internal_pins.i2c_scl.reconfigure(),\n                i2c_int: internal_pins.i2c_int.reconfigure(),\n                b_power_save: internal_pins.b_power_save.reconfigure(),\n                vbus_detect: internal_pins.vbus_detect.reconfigure(),\n                led: internal_pins.led.reconfigure(),\n                adc0: internal_pins.adc0.reconfigure(),\n                adc1: internal_pins.adc1.reconfigure(),\n                adc2: internal_pins.adc2.reconfigure(),\n                voltage_monitor: internal_pins.voltage_monitor.reconfigure(),\n            },\n        )\n    }\n\n    pub fn is_pressed(&self, button: Button) -> bool {\n        use Button::*;\n        match button {\n            A => self.a.is_low().unwrap(),\n            B => self.b.is_low().unwrap(),\n            X => self.x.is_low().unwrap(),\n            Y => self.y.is_low().unwrap(),\n        }\n    }\n\n    pub fn get_adc<Pin: Channel<Adc, ID = u8>>(&mut self, channel: &mut Pin) -> f32 {\n        // scale raw 12-bit adc value to 0 .. 1 float\n        let adc_value: u16 = self.adc.read(channel).unwrap();\n        let result: f32 = f32::from(adc_value) / f32::from(1u16 << 12);\n        result.clamp(0.0, 1.0)\n    }\n}\n"
  },
  {
    "path": "boards/pimoroni-pico-lipo-16mb/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.8.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.7.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n\n## 0.6.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n\n## 0.5.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n\n## 0.4.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Update to rp2040-hal 0.6.0\n\n## 0.3.0 - 2022-06-13\n\n### Changed\n\n- Update to rp2040-hal 0.5.0\n\n## 0.2.0 - 2022-03-11\n\n### Changed\n\n- Update to rp2040-hal 0.4.0\n\n## 0.1.0 - 2021-12-20\n\n- Initial release\n\n"
  },
  {
    "path": "boards/pimoroni-pico-lipo-16mb/Cargo.toml",
    "content": "[package]\nname = \"pimoroni-pico-lipo-16mb\"\nversion = \"0.8.0\"\nauthors = [\"Hmvp <hmvp@users.noreply.github.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-pico-lipo-16mb\"\ndescription = \"Board Support Package for the Pico LiPo 16MB\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\npanic-halt.workspace = true\nembedded-hal.workspace = true\nnb.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/pimoroni-pico-lipo-16mb/README.md",
    "content": "# [pimoroni-pico-lipo-16mb] - Board Support for the [Pimoroni Pico Lipo 16MB]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Pico Lipo 16MB] - a board with USB-C, STEMMA QT/Qwiic connectors,\nplus a Li-Po battery charging circuit.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Pico Lipo.\n\nNote that if you use this crate the compiler will expect the full 16MB flash\nspace, and so it may not work if you only have the 4MB variant. \n\n[Pimoroni Pico Lipo 16MB]: https://shop.pimoroni.com/products/pimoroni-pico-lipo?variant=39335427080275\n[pimoroni-pico-lipo-16mb]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-pico-lipo-16mb\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\npimoroni-pico-lipo-16mb = \"0.8.0\"\n```\n\nIn your program, you will need to call `pimoroni_pico_lipo_16mb::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/pimoroni-pico-lipo-16mb $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/pimoroni-pico-lipo-16mb $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [pimoroni_pico_lipo_16mb_blinky](./examples/pimoroni_pico_lipo_16mb_blinky.rs)\n\nFlashes the Pico Lipo's on-board LED on and off.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/pimoroni-pico-lipo-16mb/examples/pimoroni_pico_lipo_16mb_blinky.rs",
    "content": "//! # Pimoroni Pico Lipo Blinky Example\n//!\n//! Blinks the LED on a Pimoroni Pico Lipo 16MB board.\n//!\n//! This will blink an LED attached to GPIO25, which is the pin the Pico Lipo uses\n//! for the on-board LED.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse pimoroni_pico_lipo_16mb::entry;\n\n// GPIO traits\nuse embedded_hal::digital::OutputPin;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse pimoroni_pico_lipo_16mb::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse pimoroni_pico_lipo_16mb::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse pimoroni_pico_lipo_16mb::hal;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then blinks the LED in an\n/// infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        pimoroni_pico_lipo_16mb::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = pimoroni_pico_lipo_16mb::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Set the LED to be an output\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    // Blink the LED at 1 Hz\n    loop {\n        led_pin.set_high().unwrap();\n        delay.delay_ms(500);\n        led_pin.set_low().unwrap();\n        delay.delay_ms(500);\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/pimoroni-pico-lipo-16mb/src/lib.rs",
    "content": "#![no_std]\n\npub use rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio0 { name: gpio0 },\n    Gpio1 { name: gpio1 },\n    Gpio2 { name: gpio2 },\n    Gpio3 { name: gpio3 },\n    Gpio4 { name: gpio4 },\n    Gpio5 { name: gpio5 },\n    Gpio6 { name: gpio6 },\n    Gpio7 { name: gpio7 },\n    Gpio8 { name: gpio8 },\n    Gpio9 { name: gpio9 },\n    Gpio10 { name: gpio10 },\n    Gpio11 { name: gpio11 },\n    Gpio12 { name: gpio12 },\n    Gpio13 { name: gpio13 },\n    Gpio14 { name: gpio14 },\n    Gpio15 { name: gpio15 },\n    Gpio16 { name: gpio16 },\n    Gpio17 { name: gpio17 },\n    Gpio18 { name: gpio18 },\n    Gpio19 { name: gpio19 },\n    Gpio20 { name: gpio20 },\n    Gpio21 { name: gpio21 },\n    Gpio22 { name: gpio22 },\n    Gpio23 { name: user_sw },\n    Gpio24 { name: vbus_detect },\n    Gpio25 { name: led },\n    Gpio26 { name: gpio26 },\n    Gpio27 { name: gpio27 },\n    Gpio28 { name: gpio28 },\n    Gpio29 { name: batt_sense },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/pimoroni-plasma-2040/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/pimoroni-plasma-2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.7.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.6.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.5.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n\n## 0.4.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.3.0 - 2022-08-26\n\n### Changed\n\n- Use `rp2040-hal`'s entry function.\n- Migrate from `embedded-time` to `fugit`\n- Bump `ws2812-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n"
  },
  {
    "path": "boards/pimoroni-plasma-2040/Cargo.toml",
    "content": "[package]\nname = \"pimoroni-plasma-2040\"\nversion = \"0.7.0\"\nauthors = [\"Jordan Williams <jordan@jwillikers.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-plasma-2040\"\ndescription = \"Board Support Package for the Pimoroni Plasma 2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\nembedded-hal.workspace = true\nfugit.workspace = true\npanic-halt.workspace = true\nrp2040-hal = { workspace = true, features = [ \"defmt\" ] }\nsmart-leds.workspace = true\nws2812-pio.workspace = true\n\ndefmt.workspace = true\ndefmt-rtt.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/pimoroni-plasma-2040/README.md",
    "content": "# [pimoroni-plasma-2040] - Board Support for the [Pimoroni Plasma 2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Plasma 2040] - Swathe everything in rainbows with this all-in-one, USB-C powered controller for WS2812/Neopixel and APA102/Dotstar addressable LED strip.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Pimoroni Plasma 2040.\n\n[Pimoroni Plasma 2040]: https://shop.pimoroni.com/products/plasma-2040\n[pimoroni-plasma-2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-plasma-2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\npimoroni-plasma-2040 = \"0.7.0\"\n```\n\nIn your program, you will need to call `pimoroni_plasma_2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/pimoroni-plasma-2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/pimoroni-plasma-2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\n\nthen try repeating the `cargo run` command above.\n\n### [pimoroni_plasma_2040_blinky](./examples/pimoroni_plasma_2040_blinky.rs)\n\nFlashes the Plasma 2040's three on-board LEDs in sequence.\n\n### [pimoroni_plasma_2040_ws2812_led](./examples/pimoroni_plasma_2040_ws2812_led.rs)\n\nDrives 3 WS2812 LEDs connected directly to the Pimoroni Plasma 2040 via its onboard terminal block.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/pimoroni-plasma-2040/build.rs",
    "content": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n    println!(\"cargo:rustc-link-arg-examples=-Tdefmt.x\");\n}\n"
  },
  {
    "path": "boards/pimoroni-plasma-2040/examples/pimoroni_plasma_2040_blinky.rs",
    "content": "//! Blinks the 3 colour LEDs on a Pimoroni Plasma 2040 in sequence\n#![no_std]\n#![no_main]\n\nuse defmt::*;\nuse defmt_rtt as _;\nuse embedded_hal::digital::OutputPin;\nuse panic_halt as _;\n\nuse pimoroni_plasma_2040 as bsp;\n\nuse bsp::hal::{\n    clocks::{init_clocks_and_plls, Clock},\n    gpio::PinState,\n    pac,\n    sio::Sio,\n    watchdog::Watchdog,\n};\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[rp2040_hal::entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables and the spinlock are initialised.\n#[rp2040_hal::entry]\nfn main() -> ! {\n    info!(\"Program start\");\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n    let sio = Sio::new(pac.SIO);\n\n    let clocks = init_clocks_and_plls(\n        bsp::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    let pins = bsp::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let mut led_green = pins\n        .led_green\n        .into_push_pull_output_in_state(PinState::High);\n    let mut led_red = pins.led_red.into_push_pull_output_in_state(PinState::High);\n    let mut led_blue = pins.led_blue.into_push_pull_output_in_state(PinState::High);\n\n    loop {\n        led_green.set_low().unwrap();\n        delay.delay_ms(500);\n        led_green.set_high().unwrap();\n        led_blue.set_low().unwrap();\n        delay.delay_ms(500);\n        led_blue.set_high().unwrap();\n        led_red.set_low().unwrap();\n        delay.delay_ms(500);\n        led_red.set_high().unwrap();\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/pimoroni-plasma-2040/examples/pimoroni_plasma_2040_ws2812_led.rs",
    "content": "//! # Pimoroni Plasma 2040 WS2812 RGB LED Example\n//!\n//! Drives 3 WS2812 LEDs connected directly to the Pimoroni Plasma 2040 via its terminal block.\n//! Derived from the [pico_ws2812_led](../../rp-pico/examples/pico_ws2812_led.rs) example for the Raspberry Pi Pico.\n\n#![no_std]\n#![no_main]\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse pimoroni_plasma_2040::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse pimoroni_plasma_2040::hal::pac;\n\n// Import the Timer for Ws2812:\nuse pimoroni_plasma_2040::hal::timer::Timer;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse pimoroni_plasma_2040::hal;\n\n// PIOExt for the split() method that is needed to bring\n// PIO0 into useable form for Ws2812:\nuse pimoroni_plasma_2040::hal::pio::PIOExt;\n\n// Import useful traits to handle the ws2812 LEDs:\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\n\n// Import the actual crate to handle the Ws2812 protocol:\nuse ws2812_pio::Ws2812;\n\n// Currently 3 consecutive LEDs are driven by this example\n// to keep the power draw compatible with USB:\nconst STRIP_LEN: usize = 3;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[pimoroni_plasma_2040::entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables and the spinlock are initialised.\n#[pimoroni_plasma_2040::entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        pimoroni_plasma_2040::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = pimoroni_plasma_2040::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Setup a delay for the LED blink signals:\n    let mut frame_delay =\n        cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // Import the `sin` function for a smooth hue animation from the\n    // Pico rp2040 ROM:\n    let sin = hal::rom_data::float_funcs::fsin::ptr();\n\n    // Create a count down timer for the Ws2812 instance:\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Split the PIO state machine 0 into individual objects, so that\n    // Ws2812 can use it:\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n\n    // Instantiate a Ws2812 LED strip:\n    let mut ws = Ws2812::new(\n        pins.data.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    let mut leds: [RGB8; STRIP_LEN] = [(0, 0, 0).into(); STRIP_LEN];\n    let mut t = 0.0;\n\n    // Bring down the overall brightness of the strip to not blow\n    // the USB power supply: every LED draws ~60mA, RGB means 3 LEDs per\n    // ws2812 LED, for 3 LEDs that would be: 3 * 3 * 60mA, which is\n    // already 540mA for just 3 white LEDs!\n    let strip_brightness = 64u8; // Limit brightness to 64/256\n\n    // Slow down timer by this factor (0.1 will result in 10 seconds):\n    let animation_speed = 0.1;\n\n    loop {\n        for (i, led) in leds.iter_mut().enumerate() {\n            // An offset to give 3 consecutive LEDs a different color:\n            let hue_offs = match i % 3 {\n                1 => 0.25,\n                2 => 0.5,\n                _ => 0.0,\n            };\n\n            let sin_11 = sin((t + hue_offs) * 2.0 * core::f32::consts::PI);\n            // Bring -1..1 sine range to 0..1 range:\n            let sin_01 = (sin_11 + 1.0) * 0.5;\n\n            let hue = 360.0 * sin_01;\n            let sat = 1.0;\n            let val = 1.0;\n\n            let rgb = hsv2rgb_u8(hue, sat, val);\n            *led = rgb.into();\n        }\n\n        // Here the magic happens and the `leds` buffer is written to the\n        // ws2812 LEDs:\n        ws.write(brightness(leds.iter().copied(), strip_brightness))\n            .unwrap();\n\n        // Wait a bit until calculating the next frame:\n        frame_delay.delay_ms(16); // ~60 FPS\n\n        // Increase the time counter variable and make sure it\n        // stays inbetween 0.0 to 1.0 range:\n        t += (16.0 / 1000.0) * animation_speed;\n        while t > 1.0 {\n            t -= 1.0;\n        }\n    }\n}\n\npub fn hsv2rgb(hue: f32, sat: f32, val: f32) -> (f32, f32, f32) {\n    let c = val * sat;\n    let v = (hue / 60.0) % 2.0 - 1.0;\n    let v = if v < 0.0 { -v } else { v };\n    let x = c * (1.0 - v);\n    let m = val - c;\n    let (r, g, b) = if hue < 60.0 {\n        (c, x, 0.0)\n    } else if hue < 120.0 {\n        (x, c, 0.0)\n    } else if hue < 180.0 {\n        (0.0, c, x)\n    } else if hue < 240.0 {\n        (0.0, x, c)\n    } else if hue < 300.0 {\n        (x, 0.0, c)\n    } else {\n        (c, 0.0, x)\n    };\n    (r + m, g + m, b + m)\n}\n\npub fn hsv2rgb_u8(h: f32, s: f32, v: f32) -> (u8, u8, u8) {\n    let r = hsv2rgb(h, s, v);\n\n    (\n        (r.0 * 255.0) as u8,\n        (r.1 * 255.0) as u8,\n        (r.2 * 255.0) as u8,\n    )\n}\n"
  },
  {
    "path": "boards/pimoroni-plasma-2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\npub use rp2040_hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 is connected to I2C0_SDA\n    Gpio0 { name: i2c0_sda },\n    /// GPIO 1 is connected to I2C0_SCL\n    Gpio1 { name: i2c0_scl },\n    /// GPIO 2 is connected to I2C1_SDA\n    Gpio2 { name: i2c1_sda },\n    /// GPIO 3 is connected to I2C1_SCL\n    Gpio3 { name: i2c1_scl },\n    Gpio4 { name: gpio4 },\n    Gpio5 { name: gpio5 },\n    /// GPIO 12 is connected to button A, active low\n    Gpio12 { name: button_a },\n    /// GPIO 13 is connected to button B, active low\n    Gpio13 { name: button_b },\n    /// GPIO 14 is connected to CLK for APA102 only\n    Gpio14 { name: clk },\n    /// GPIO 15 is connected to DAT for Apa102 and Ws2812\n    Gpio15 { name: data },\n    /// GPIO 16 is red LED, active low\n    Gpio16 { name: led_red },\n    /// GPIO 17 is green LED, active low\n    Gpio17 { name: led_green },\n    /// GPIO 18 is blue LED, active low\n    Gpio18 { name: led_blue },\n    /// GPIO 19 is I2C_INT\n    Gpio19 { name: i2c_int },\n    /// GPIO 20 is I2C_SDA\n    Gpio20 {\n        name: i2c_sda,\n        aliases: { FunctionI2C, PullUp: Sda }\n    },\n    /// GPIO 21 is I2C_SCL\n    Gpio21 {\n        name: i2c_scl,\n        aliases: { FunctionI2C, PullUp: Scl }\n    },\n    /// GPIO 23 is connected to the USER_SW, the BOOT button, active low\n    Gpio23 { name: user_sw },\n    /// GPIO 26 is connected to ADC0\n    Gpio26 { name: adc0 },\n    /// GPIO 27 is connected to ADC1\n    Gpio27 { name: adc1 },\n    /// GPIO 28 is connected to ADC2\n    Gpio28 { name: adc2 },\n    /// GPIO 29 is connected to ADC3 which is used for low side current sensing\n    Gpio29 {\n        name: current_sense,\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n\npub const ADC_GAIN: u32 = 50;\npub const SHUNT_RESISTOR: f32 = 0.015;\n"
  },
  {
    "path": "boards/pimoroni-servo2040/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/pimoroni-servo2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.5.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.4.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.3.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n\n## 0.2.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.1.0 - 2022-09-06\n\n### Changed\n"
  },
  {
    "path": "boards/pimoroni-servo2040/Cargo.toml",
    "content": "[package]\nname = \"pimoroni-servo2040\"\nversion = \"0.5.0\"\nauthors = [\"Paul Daniel Faria <nashenas88@gmail.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-servo2040\"\ndescription = \"Board Support Package for the Pimoroni Servo2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ndefmt.workspace = true\ndefmt-rtt.workspace = true\nembedded-hal.workspace = true\nfugit.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\nrp2040-hal = { workspace = true, features = [ \"defmt\" ] }\nsmart-leds.workspace = true\nws2812-pio.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/pimoroni-servo2040/README.md",
    "content": "# [pimoroni-servo2040] - Board Support for the [Pimoroni Servo2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Servo2040] - a standalone servo motor controller for up to 18 servos\nand 6 sensors.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Servo2040.\n\n[Pimoroni Servo2040]: https://shop.pimoroni.com/products/servo-2040\n[pimoroni-servo2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-servo2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\npimoroni-servo2040 = \"0.5.0\"\n```\n\nIn your program, you will need to call `pimoroni_servo2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/pimoroni-servo2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/pimoroni-servo2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\nthen try repeating the `cargo run` command above.\n\n### [pimoroni_servo2040_rainbow](./examples/pimoroni_servo2040_rainbow.rs)\n\nAnimates a rainbow wheel on the Servo2040's six on-board LEDs in sequence.\n\n![Servo 2040 Rainbow LED Animation](\n    https://user-images.githubusercontent.com/1673130/190923083-4cd9794a-6775-4f9e-92c3-64d6d25c61dd.gif)\n\n### [pimoroni_servo2040_pwm_servo](./examples/pimoroni_servo2040_pwm_servo.rs)\n\nMoves a micro servo connected to pin Servo 1 on a Servo2040 board using the PWM\nperipheral.\n\n![Servo 2040 Servo Animation](\n    https://user-images.githubusercontent.com/1673130/190923094-1e7dc85d-2742-4d2f-9b9d-f3337b03cda2.gif)\n![Servo 2040 Oscilloscope Waveform Animation](\n    https://user-images.githubusercontent.com/1673130/190923098-f725bf4a-541b-4e4c-9f79-eb435e8d2d27.gif)\n![Servo 2040 Oscilloscope Waveform Image with Frequency](\n    https://user-images.githubusercontent.com/1673130/190923130-43bab8aa-8773-42f8-90cb-9bc684368027.jpg)\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/pimoroni-servo2040/build.rs",
    "content": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n    println!(\"cargo:rustc-link-arg-examples=-Tdefmt.x\");\n}\n"
  },
  {
    "path": "boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs",
    "content": "//! # Pimoroni Servo2040 PWM Micro Servo Example\n//!\n//! Moves the micro servo on a Servo2040 board using the PWM peripheral.\n//!\n//! This will move in different positions the motor attached to GP0.\n#![no_std]\n#![no_main]\n\n// GPIO traits\nuse embedded_hal::delay::DelayNs;\nuse embedded_hal::pwm::SetDutyCycle;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse pimoroni_servo2040::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse pimoroni_servo2040::hal;\n\n/// Number of microseconds for the pwm signal period.\nconst PERIOD_US: u32 = 20_000;\n/// Max resolution for the pwm signal.\nconst TOP: u16 = u16::MAX;\n\n#[pimoroni_servo2040::entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    let sio = hal::Sio::new(pac.SIO);\n\n    let clocks = hal::clocks::init_clocks_and_plls(\n        pimoroni_servo2040::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // Configure the Timer peripheral in count-down mode\n    let mut timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    let pins = pimoroni_servo2040::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let pwm_slices = hal::pwm::Slices::new(pac.PWM, &mut pac.RESETS);\n\n    const MIN_PULSE: u16 = 1000;\n    const MID_PULSE: u16 = 1500;\n    const MAX_PULSE: u16 = 2000;\n\n    let mut pwm: hal::pwm::Slice<_, _> = pwm_slices.pwm0;\n\n    // 50Hz desired frequency\n    // Rp2040 clock = 125MHz\n    // Top = 65_535, resolution for counter (maximum possible u16 value)\n    // Wrap = Top+1 (number of possible values)\n    // Phase correction multiplier = 2 if phase correction enabled, else 1\n\n    // Divider = rp2040_clock / (Wrap * phase_correction_multiplier * desired_frequency)\n    // Divider = 125,000,000/(65_536 * 1 * 50)\n    // Divider = 38.14639\n    // Divider int = 38\n    // Divider frac = 3 (3/16 = 0.1875, smallest frac greater than desired clock divider).\n    pwm.set_div_int(38);\n    pwm.set_div_frac(3);\n\n    // If phase correction enabled, then values would be:\n    // Divider = rp2040_clock / (Wrap * phase_correction_multiplier * desired_frequency)\n    // Divider = 125,000,000/(65_536 * 2 * 50)\n    // Divider = 19.073195\n    // Divider int = 19\n    // Divider frac = 2 (2/16 = .1250, smallest frac greater than desired clock divider).\n\n    // pwm.set_ph_correct();\n    // pwm.set_div_int(19);\n    // pwm.set_div_frac(2);\n    pwm.set_top(TOP);\n    pwm.enable();\n\n    // Output channel A on PWM0 to the GPIO0/servo1 pin\n    let mut channel_a = pwm.channel_a;\n    let _channel_a_pin = channel_a.output_to(pins.servo1);\n    let movement_delay_ms = 400;\n\n    // Infinite loop, moving micro servo from one position to another.\n    // You may need to adjust the pulse width since several servos from\n    // different manufacturers respond differently.\n    loop {\n        // move to 0°\n        let _ = channel_a.set_duty_cycle(us_to_duty(MID_PULSE));\n        timer.delay_ms(movement_delay_ms);\n\n        // 0° to 90°\n        let _ = channel_a.set_duty_cycle(us_to_duty(MAX_PULSE));\n        timer.delay_ms(movement_delay_ms);\n\n        // 90° to 0°\n        let _ = channel_a.set_duty_cycle(us_to_duty(MID_PULSE));\n        timer.delay_ms(movement_delay_ms);\n\n        // 0° to -90°\n        let _ = channel_a.set_duty_cycle(us_to_duty(MIN_PULSE));\n        timer.delay_ms(movement_delay_ms);\n    }\n}\n\n/// Convert microseconds to duty value.\n///\n/// This function uses the constants TOP and PERIOD_US defined at the top of the file.\nfn us_to_duty(us: u16) -> u16 {\n    // Do math in u32 so we maintain higher precision. If we do math in u16, we need to divide first\n    // and lose some precision when truncating the remainder.\n    (TOP as u32 * us as u32 / PERIOD_US) as u16\n}\n"
  },
  {
    "path": "boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs",
    "content": "//! Animates a rainbow wheel on the 6 color LEDs on a Servo2040 in sequence\n#![no_std]\n#![no_main]\n\nuse bsp::entry;\nuse bsp::hal::{\n    clocks::{init_clocks_and_plls, Clock},\n    pac,\n    sio::Sio,\n    watchdog::Watchdog,\n};\nuse defmt::*;\nuse defmt_rtt as _;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse pimoroni_servo2040 as bsp;\nuse rp2040_hal::pio::PIOExt;\nuse rp2040_hal::Timer;\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse ws2812_pio::Ws2812;\n\n#[entry]\nfn main() -> ! {\n    info!(\"Program start\");\n    let mut pac = pac::Peripherals::take().unwrap();\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let sio = Sio::new(pac.SIO);\n\n    let clocks = init_clocks_and_plls(\n        bsp::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let pins = bsp::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n\n    let mut ws = Ws2812::new(\n        pins.led_data.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite color wheel loop\n\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    let offset = (256u16 / bsp::NUM_LEDS as u16) as u8;\n    loop {\n        ws.write(brightness(\n            IntoIterator::into_iter([\n                wheel(n),\n                wheel(n.wrapping_add(offset)),\n                wheel(n.wrapping_add(offset * 2)),\n                wheel(n.wrapping_add(offset * 3)),\n                wheel(n.wrapping_add(offset * 4)),\n                wheel(n.wrapping_add(offset * 5)),\n            ]),\n            32,\n        ))\n        .unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/pimoroni-servo2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub const NUM_SERVOS: u8 = 18;\npub const NUM_SENSORS: u8 = 6;\npub const NUM_LEDS: u8 = 6;\n\npub const SENSOR_1_ADDR: u8 = 0b_0000;\npub const SENSOR_2_ADDR: u8 = 0b_0001;\npub const SENSOR_3_ADDR: u8 = 0b_0010;\npub const SENSOR_4_ADDR: u8 = 0b_0011;\npub const SENSOR_5_ADDR: u8 = 0b_0100;\npub const SENSOR_6_ADDR: u8 = 0b_0101;\npub const VOLTAGE_SENSE_ADDR: u8 = 0b_0110;\npub const CURRENT_SENSE_ADDR: u8 = 0b_0111;\n\npub const VOLTAGE_GAIN: f32 = 0.28058;\npub const SHUNT_RESISTOR: f32 = 0.003;\npub const CURRENT_GAIN: u8 = 69;\npub const CURRENT_OFFSET: f32 = -0.02;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM0 A`     | [crate::Servo1Pwm0A]           |\n    /// | `PIO0`       | [crate::Servo1Pio0]            |\n    /// | `PIO1`       | [crate::Servo1Pio1]            |\n    Gpio0 {\n        name: servo1,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo1].\n            FunctionPwm, PullNone: Servo1Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::servo1].\n            FunctionPio0, PullNone: Servo1Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo1].\n            FunctionPio1, PullNone: Servo1Pio1\n        }\n    },\n\n    /// GPIO 1 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM0 B`     | [crate::Servo2Pwm0B]           |\n    /// | `PIO0`       | [crate::Servo2Pio0]            |\n    /// | `PIO1`       | [crate::Servo2Pio1]            |\n    Gpio1 {\n        name: servo2,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo2].\n            FunctionPwm, PullNone: Servo2Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::servo2].\n            FunctionPio0, PullNone: Servo2Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo2].\n            FunctionPio1, PullNone: Servo2Pio1\n        }\n    },\n\n    /// GPIO 2 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM1 A`     | [crate::Servo3Pwm1A]           |\n    /// | `PIO0`       | [crate::Servo3Pio0]            |\n    /// | `PIO1`       | [crate::Servo3Pio1]            |\n    Gpio2 {\n        name: servo3,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo3].\n            FunctionPwm, PullNone: Servo3Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::servo3].\n            FunctionPio0, PullNone: Servo3Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo3].\n            FunctionPio1, PullNone: Servo3Pio1\n        }\n    },\n\n    /// GPIO 3 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM1 B`     | [crate::Servo4Pwm1B]           |\n    /// | `PIO0`       | [crate::Servo4Pio0]            |\n    /// | `PIO1`       | [crate::Servo4Pio1]            |\n    Gpio3 {\n        name: servo4,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo4].\n            FunctionPwm, PullNone: Servo4Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::servo4].\n            FunctionPio0, PullNone: Servo4Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo4].\n            FunctionPio1, PullNone: Servo4Pio1\n        }\n    },\n\n    /// GPIO 4 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM2 A`     | [crate::Servo5Pwm2A]           |\n    /// | `PIO0`       | [crate::Servo5Pio0]            |\n    /// | `PIO1`       | [crate::Servo5Pio1]            |\n    Gpio4 {\n        name: servo5,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo5].\n            FunctionPwm, PullNone: Servo5Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::servo5].\n            FunctionPio0, PullNone: Servo5Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo5].\n            FunctionPio1, PullNone: Servo5Pio1\n        }\n    },\n\n    /// GPIO 5 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM2 B`     | [crate::Servo6Pwm2B]           |\n    /// | `PIO0`       | [crate::Servo6Pio0]            |\n    /// | `PIO1`       | [crate::Servo6Pio1]            |\n    Gpio5 {\n        name: servo6,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo6].\n            FunctionPwm, PullNone: Servo6Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::servo6].\n            FunctionPio0, PullNone: Servo6Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo6].\n            FunctionPio1, PullNone: Servo6Pio1\n        }\n    },\n\n    /// GPIO 6 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM3 A`     | [crate::Servo7Pwm3A]           |\n    /// | `PIO0`       | [crate::Servo7Pio0]            |\n    /// | `PIO1`      | [crate::Servo7Pio1]            |\n    Gpio6 {\n        name: servo7,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo7].\n            FunctionPwm, PullNone: Servo7Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::servo7].\n            FunctionPio0, PullNone: Servo7Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo7].\n            FunctionPio1, PullNone: Servo7Pio1\n        }\n    },\n\n    /// GPIO 7 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM3 B`     | [crate::Servo8Pwm3B]           |\n    /// | `PIO0`       | [crate::Servo8Pio0]            |\n    /// | `PIO1`       | [crate::Servo8Pio1]            |\n    Gpio7 {\n        name: servo8,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo8].\n            FunctionPwm, PullNone: Servo8Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::servo8].\n            FunctionPio0, PullNone: Servo8Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo8].\n            FunctionPio1, PullNone: Servo8Pio1\n        }\n    },\n\n    /// GPIO 8 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM4 A`     | [crate::Servo9Pwm4A]           |\n    /// | `PIO0`       | [crate::Servo9Pio0]            |\n    /// | `PIO1`       | [crate::Servo9Pio1]            |\n    Gpio8 {\n        name: servo9,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo9].\n            FunctionPwm, PullNone: Servo9Pwm4A,\n            /// PIO0 Function alias for pin [crate::Pins::servo9].\n            FunctionPio0, PullNone: Servo9Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo9].\n            FunctionPio1, PullNone: Servo9Pio1\n        }\n    },\n\n    /// GPIO 9 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM4 B`     | [crate::Servo10Pwm4B]           |\n    /// | `PIO0`       | [crate::Servo10Pio0]            |\n    /// | `PIO1`       | [crate::Servo10Pio1]            |\n    Gpio9 {\n        name: servo10,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo10].\n            FunctionPwm, PullNone: Servo10Pwm4B,\n            /// PIO0 Function alias for pin [crate::Pins::servo10].\n            FunctionPio0, PullNone: Servo10Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo10].\n            FunctionPio1, PullNone: Servo10Pio1\n        }\n    },\n\n    /// GPIO 10 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM5 A`     | [crate::Servo11Pwm5A]          |\n    /// | `PIO0`       | [crate::Servo11Pio0]           |\n    /// | `PIO1`       | [crate::Servo11Pio1]           |\n    Gpio10 {\n        name: servo11,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo11].\n            FunctionPwm, PullNone: Servo11Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::servo11].\n            FunctionPio0, PullNone: Servo11Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo11].\n            FunctionPio1, PullNone: Servo11Pio1\n        }\n    },\n\n    /// GPIO 11 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM5 B`     | [crate::Servo12Pwm5B]          |\n    /// | `PIO0`       | [crate::Servo12Pio0]           |\n    /// | `PIO1`       | [crate::Servo12Pio1]           |\n    Gpio11 {\n        name: servo12,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo12].\n            FunctionPwm, PullNone: Servo12Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::servo12].\n            FunctionPio0, PullNone: Servo12Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo12].\n            FunctionPio1, PullNone: Servo12Pio1\n        }\n    },\n\n    /// GPIO 12 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM6 A`     | [crate::Servo13Pwm6A]          |\n    /// | `PIO0`       | [crate::Servo13Pio0]           |\n    /// | `PIO1`       | [crate::Servo13Pio1]           |\n    Gpio12 {\n        name: servo13,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo13].\n            FunctionPwm, PullNone: Servo13Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::servo13].\n            FunctionPio0, PullNone: Servo13Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo13].\n            FunctionPio1, PullNone: Servo13Pio1\n        }\n    },\n\n    /// GPIO 13 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM6 B`     | [crate::Servo14Pwm6B]          |\n    /// | `PIO0`       | [crate::Servo14Pio0]           |\n    /// | `PIO1`       | [crate::Servo14Pio1]           |\n    Gpio13 {\n        name: servo14,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo14].\n            FunctionPwm, PullNone: Servo14Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::servo14].\n            FunctionPio0, PullNone: Servo14Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo14].\n            FunctionPio1, PullNone: Servo14Pio1\n        }\n    },\n\n    /// GPIO 14 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM7 A`     | [crate::Servo15Pwm7A]          |\n    /// | `PIO0`       | [crate::Servo15Pio0]           |\n    /// | `PIO1`       | [crate::Servo15Pio1]           |\n    Gpio14 {\n        name: servo15,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo15].\n            FunctionPwm, PullNone: Servo15Pwm7A,\n            /// PIO0 Function alias for pin [crate::Pins::servo15].\n            FunctionPio0, PullNone: Servo15Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo15].\n            FunctionPio1, PullNone: Servo15Pio1\n        }\n    },\n\n    /// GPIO 15 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM7 B`     | [crate::Servo16Pwm7B]          |\n    /// | `PIO0`       | [crate::Servo16Pio0]           |\n    /// | `PIO1`       | [crate::Servo16Pio1]           |\n    Gpio15 {\n        name: servo16,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo16].\n            FunctionPwm, PullNone: Servo16Pwm7B,\n            /// PIO0 Function alias for pin [crate::Pins::servo16].\n            FunctionPio0, PullNone: Servo16Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo16].\n            FunctionPio1, PullNone: Servo16Pio1\n        }\n    },\n\n    /// GPIO 16 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM0 A`     | [crate::Servo17Pwm0A]          |\n    /// | `PIO0`       | [crate::Servo17Pio0]           |\n    /// | `PIO1`       | [crate::Servo17Pio1]           |\n    Gpio16 {\n        name: servo17,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo17].\n            FunctionPwm, PullNone: Servo17Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::servo17].\n            FunctionPio0, PullNone: Servo17Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo17].\n            FunctionPio1, PullNone: Servo17Pio1\n        }\n    },\n\n    /// GPIO 17 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `PWM0 B`     | [crate::Servo18Pwm0B]          |\n    /// | `PIO0`       | [crate::Servo18Pio0]           |\n    /// | `PIO1`       | [crate::Servo18Pio1]           |\n    Gpio17 {\n        name: servo18,\n        aliases: {\n            /// PWM Function alias for pin [crate::Pins::servo18].\n            FunctionPwm, PullNone: Servo18Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::servo18].\n            FunctionPio0, PullNone: Servo18Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::servo18].\n            FunctionPio1, PullNone: Servo18Pio1\n        }\n    },\n\n    /// GPIO 18 is connected to the leds of the Servo 2040 board.\n    Gpio18 {\n        name: led_data\n    },\n\n    /// GPIO 19 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp19Spi0Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp19Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp19I2C1Scl]        |\n    /// | `PWM1 B`     | [crate::Gp19Pwm1B]          |\n    /// | `PIO0`       | [crate::Gp19Pio0]           |\n    /// | `PIO1`       | [crate::Gp19Pio1]           |\n    Gpio19 {\n        name: int_,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::int_].\n            FunctionUart, PullNone: Gp19Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::int_].\n            FunctionSpi, PullNone: Gp19Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::int_].\n            FunctionI2C, PullUp: Gp19I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::int_].\n            FunctionPwm, PullNone: Gp19Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::int_].\n            FunctionPio0, PullNone: Gp19Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::int_].\n            FunctionPio1, PullNone: Gp19Pio1\n        }\n    },\n\n    /// GPIO 20 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp20Spi0Rx]         |\n    /// | `UART1 TX`   | [crate::Gp20Uart1Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp20I2C0Sda]        |\n    /// | `PWM2 A`     | [crate::Gp20Pwm2A]          |\n    /// | `PIO0`       | [crate::Gp20Pio0]           |\n    /// | `PIO1`       | [crate::Gp20Pio1]           |\n    Gpio20 {\n        name: sda,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::sda].\n            FunctionUart, PullNone: Gp20Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::sda].\n            FunctionSpi, PullNone: Gp20Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::sda].\n            FunctionI2C, PullUp: Gp20I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::sda].\n            FunctionPwm, PullNone: Gp20Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::sda].\n            FunctionPio0, PullNone: Gp20Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::sda].\n            FunctionPio1, PullNone: Gp20Pio1\n        }\n    },\n\n    /// GPIO 21 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp21Spi0Csn]        |\n    /// | `UART1 RX`   | [crate::Gp21Uart1Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp21I2C0Scl]        |\n    /// | `PWM2 B`     | [crate::Gp21Pwm2B]          |\n    /// | `PIO0`       | [crate::Gp21Pio0]           |\n    /// | `PIO1`       | [crate::Gp21Pio1]           |\n    Gpio21 {\n        name: scl,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::scl].\n            FunctionUart, PullNone: Gp21Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::scl].\n            FunctionSpi, PullNone: Gp21Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::scl].\n            FunctionI2C, PullUp: Gp21I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::scl].\n            FunctionPwm, PullNone: Gp21Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::scl].\n            FunctionPio0, PullNone: Gp21Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::scl].\n            FunctionPio1, PullNone: Gp21Pio1\n        }\n    },\n\n    /// GPIO 22 is connected to adc_addr_0 of the Servo 2040 board.\n    Gpio22 {\n        name: adc_addr_0,\n    },\n\n    /// GPIO 23 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp23Spi0Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp23Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp23I2C1Scl]        |\n    /// | `PWM3 B`     | [crate::Gp23Pwm3B]          |\n    /// | `PIO0`       | [crate::Gp23Pio0]           |\n    /// | `PIO1`       | [crate::Gp23Pio1]           |\n    Gpio23 {\n        name: user_sw,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::user_sw].\n            FunctionUart, PullNone: Gp23Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::user_sw].\n            FunctionSpi, PullNone: Gp23Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::user_sw].\n            FunctionI2C, PullUp: Gp23I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::user_sw].\n            FunctionPwm, PullNone: Gp23Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::user_sw].\n            FunctionPio0, PullNone: Gp23Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::user_sw].\n            FunctionPio1, PullNone: Gp23Pio1\n        }\n    },\n\n    /// GPIO 24 is connected to adc_addr_1 of the Servo 2040 board.\n    Gpio24 {\n        name: adc_addr_1,\n    },\n\n    /// GPIO 25 is connected to adc_addr_2 of the Servo 2040 board.\n    Gpio25 {\n        name: adc_addr_2,\n    },\n\n    /// GPIO 26 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp26Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp26Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp26I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp26Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp26Pio0]           |\n    /// | `PIO1`       | [crate::Gp26Pio1]           |\n    Gpio26 {\n        name: adc0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio26].\n            FunctionUart, PullNone: Gp26Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio26].\n            FunctionSpi, PullNone: Gp26Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio26].\n            FunctionPwm, PullNone: Gp26Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio0, PullNone: Gp26Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio1, PullNone: Gp26Pio1\n        }\n    },\n\n    /// GPIO 27 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp27Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp27Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp27I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp27Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp27Pio0]           |\n    /// | `PIO1`       | [crate::Gp27Pio1]           |\n    Gpio27 {\n        name: adc1,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio27].\n            FunctionUart, PullNone: Gp27Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio27].\n            FunctionSpi, PullNone: Gp27Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio27].\n            FunctionPwm, PullNone: Gp27Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio0, PullNone: Gp27Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio1, PullNone: Gp27Pio1\n        }\n    },\n\n    /// GPIO 28 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp28Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp28Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp28I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp28Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp28Pio0]           |\n    /// | `PIO1`       | [crate::Gp28Pio1]           |\n    Gpio28 {\n        name: adc2,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp28Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp28Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp28I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp28Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp28Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp28Pio1\n        }\n    },\n\n    /// GPIO 29 is connected to shared adc of the Servo2040 board.\n    Gpio29 {\n        name: shared_adc,\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/pimoroni-tiny2040/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/pimoroni-tiny2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.7.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.6.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n\n## 0.5.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n\n## 0.4.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n\n## 0.3.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Update to rp2040-hal 0.6.0\n\n"
  },
  {
    "path": "boards/pimoroni-tiny2040/Cargo.toml",
    "content": "[package]\nname = \"pimoroni-tiny2040\"\nversion = \"0.7.0\"\nauthors = [\"Mike Bell <mdb036@gmail.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-tiny2040\"\ndescription = \"Board Support Package for the Pimoroni Tiny2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m.workspace = true\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\nembedded-hal.workspace = true\nfugit.workspace = true\npanic-halt.workspace = true\nrp2040-hal = { workspace = true, features = [ \"defmt\" ]  }\n\ndefmt = \"0.3.5\"\ndefmt-rtt = \"0.4.0\"\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/pimoroni-tiny2040/README.md",
    "content": "# [pimoroni-tiny2040] - Board Support for the [Pimoroni Tiny2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Tiny2040] - one of the first third party RP2040 boards available, with 8MB flash and a 3 colour LED.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Tiny2040.\n\n[Pimoroni Tiny2040]: https://shop.pimoroni.com/products/tiny-2040\n[pimoroni-tiny2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-tiny2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\npimoroni-tiny2040 = \"0.7.0\"\n```\n\nIn your program, you will need to call `pimoroni_tiny2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/pimoroni-tiny2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/pimoroni-tiny2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\nthen try repeating the `cargo run` command above.\n\n### [tiny2040_blinky](./examples/tiny2040_blinky.rs)\n\nFlashes the Tiny2040's three on-board LEDs in sequence.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/pimoroni-tiny2040/build.rs",
    "content": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n    println!(\"cargo:rustc-link-arg-examples=-Tdefmt.x\");\n}\n"
  },
  {
    "path": "boards/pimoroni-tiny2040/examples/tiny2040_blinky.rs",
    "content": "//! Blinks the 3 colour LEDs on a Tiny2040 in sequence\n#![no_std]\n#![no_main]\n\nuse bsp::entry;\nuse defmt::*;\nuse defmt_rtt as _;\nuse embedded_hal::digital::OutputPin;\nuse panic_halt as _;\n\nuse pimoroni_tiny2040 as bsp;\n\nuse bsp::hal::{\n    clocks::{init_clocks_and_plls, Clock},\n    pac,\n    sio::Sio,\n    watchdog::Watchdog,\n};\n\n#[entry]\nfn main() -> ! {\n    info!(\"Program start\");\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n    let sio = Sio::new(pac.SIO);\n\n    let clocks = init_clocks_and_plls(\n        bsp::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    let pins = bsp::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let mut led_green = pins.led_green.into_push_pull_output();\n    let mut led_red = pins.led_red.into_push_pull_output();\n    let mut led_blue = pins.led_blue.into_push_pull_output();\n    led_green.set_high().unwrap();\n    led_red.set_high().unwrap();\n    led_blue.set_high().unwrap();\n\n    loop {\n        led_green.set_low().unwrap();\n        delay.delay_ms(500);\n        led_green.set_high().unwrap();\n        led_blue.set_low().unwrap();\n        delay.delay_ms(500);\n        led_blue.set_high().unwrap();\n        led_red.set_low().unwrap();\n        delay.delay_ms(500);\n        led_red.set_high().unwrap();\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/pimoroni-tiny2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp0Spi0Rx]          |\n    /// | `UART0 TX`   | [crate::Gp0Uart0Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp0I2C0Sda]         |\n    /// | `PWM0 A`     | [crate::Gp0Pwm0A]           |\n    /// | `PIO0`       | [crate::Gp0Pio0]            |\n    /// | `PIO1`       | [crate::Gp0Pio1]            |\n    Gpio0 {\n        name: gpio0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio0].\n            FunctionUart, PullNone: Gp0Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio0].\n            FunctionSpi, PullNone: Gp0Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio0].\n            FunctionI2C, PullUp: Gp0I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio0].\n            FunctionPwm, PullNone: Gp0Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio0, PullNone: Gp0Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio1, PullNone: Gp0Pio1\n        }\n    },\n\n    /// GPIO 1 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp1Spi0Csn]         |\n    /// | `UART0 RX`   | [crate::Gp1Uart0Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp1I2C0Scl]         |\n    /// | `PWM0 B`     | [crate::Gp1Pwm0B]           |\n    /// | `PIO0`       | [crate::Gp1Pio0]            |\n    /// | `PIO1`       | [crate::Gp1Pio1]            |\n    Gpio1 {\n        name: gpio1,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio1].\n            FunctionUart, PullNone: Gp1Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio1].\n            FunctionSpi, PullNone: Gp1Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio1].\n            FunctionI2C, PullUp: Gp1I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio1].\n            FunctionPwm, PullNone: Gp1Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio0, PullNone: Gp1Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio1, PullNone: Gp1Pio1\n        }\n    },\n\n    /// GPIO 2 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp2Spi0Sck]         |\n    /// | `UART0 CTS`  | [crate::Gp2Uart0Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp2I2C1Sda]         |\n    /// | `PWM1 A`     | [crate::Gp2Pwm1A]           |\n    /// | `PIO0`       | [crate::Gp2Pio0]            |\n    /// | `PIO1`       | [crate::Gp2Pio1]            |\n    Gpio2 {\n        name: gpio2,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio2].\n            FunctionUart, PullNone: Gp2Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio2].\n            FunctionSpi, PullNone: Gp2Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio2].\n            FunctionI2C, PullUp: Gp2I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio2].\n            FunctionPwm, PullNone: Gp2Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio0, PullNone: Gp2Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio1, PullNone: Gp2Pio1\n        }\n    },\n\n    /// GPIO 3 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp3Spi0Tx]          |\n    /// | `UART0 RTS`  | [crate::Gp3Uart0Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp3I2C1Scl]         |\n    /// | `PWM1 B`     | [crate::Gp3Pwm1B]           |\n    /// | `PIO0`       | [crate::Gp3Pio0]            |\n    /// | `PIO1`       | [crate::Gp3Pio1]            |\n    Gpio3 {\n        name: gpio3,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio3].\n            FunctionUart, PullNone: Gp3Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio3].\n            FunctionSpi, PullNone: Gp3Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio3].\n            FunctionI2C, PullUp: Gp3I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio3].\n            FunctionPwm, PullNone: Gp3Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio0, PullNone: Gp3Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio1, PullNone: Gp3Pio1\n        }\n    },\n\n    /// GPIO 4 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp4Spi0Rx]          |\n    /// | `UART1 TX`   | [crate::Gp4Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp4I2C0Sda]         |\n    /// | `PWM2 A`     | [crate::Gp4Pwm2A]           |\n    /// | `PIO0`       | [crate::Gp4Pio0]            |\n    /// | `PIO1`       | [crate::Gp4Pio1]            |\n    Gpio4 {\n        name: gpio4,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio4].\n            FunctionUart, PullNone: Gp4Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio4].\n            FunctionSpi, PullNone: Gp4Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio4].\n            FunctionI2C, PullUp: Gp4I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio4].\n            FunctionPwm, PullNone: Gp4Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio0, PullNone: Gp4Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio1, PullNone: Gp4Pio1\n        }\n    },\n\n    /// GPIO 5 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp5Spi0Csn]         |\n    /// | `UART1 RX`   | [crate::Gp5Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp5I2C0Scl]         |\n    /// | `PWM2 B`     | [crate::Gp5Pwm2B]           |\n    /// | `PIO0`       | [crate::Gp5Pio0]            |\n    /// | `PIO1`       | [crate::Gp5Pio1]            |\n    Gpio5 {\n        name: gpio5,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio5].\n            FunctionUart, PullNone: Gp5Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio5].\n            FunctionSpi, PullNone: Gp5Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio5].\n            FunctionI2C, PullUp: Gp5I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio5].\n            FunctionPwm, PullNone: Gp5Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio0, PullNone: Gp5Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio1, PullNone: Gp5Pio1\n        }\n    },\n\n    /// GPIO 6 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp6Spi0Sck]         |\n    /// | `UART1 CTS`  | [crate::Gp6Uart1Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp6I2C1Sda]         |\n    /// | `PWM3 A`     | [crate::Gp6Pwm3A]           |\n    /// | `PIO0`       | [crate::Gp6Pio0]            |\n    /// | `PIO1`       | [crate::Gp6Pio1]            |\n    Gpio6 {\n        name: gpio6,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio6].\n            FunctionUart, PullNone: Gp6Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio6].\n            FunctionSpi, PullNone: Gp6Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio6].\n            FunctionI2C, PullUp: Gp6I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio6].\n            FunctionPwm, PullNone: Gp6Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio0, PullNone: Gp6Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio1, PullNone: Gp6Pio1\n        }\n    },\n\n    /// GPIO 7 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp7Spi0Tx]          |\n    /// | `UART1 RTS`  | [crate::Gp7Uart1Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp7I2C1Scl]         |\n    /// | `PWM3 B`     | [crate::Gp7Pwm3B]           |\n    /// | `PIO0`       | [crate::Gp7Pio0]            |\n    /// | `PIO1`       | [crate::Gp7Pio1]            |\n    Gpio7 {\n        name: gpio7,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio7].\n            FunctionUart, PullNone: Gp7Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio7].\n            FunctionSpi, PullNone: Gp7Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio7].\n            FunctionI2C, PullUp: Gp7I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio7].\n            FunctionPwm, PullNone: Gp7Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio0, PullNone: Gp7Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio1, PullNone: Gp7Pio1\n        }\n    },\n\n    /// GPIO 18 is red LED, active low\n    Gpio18 {\n        name: led_red\n    },\n\n    /// GPIO 19 is green LED, active low\n    Gpio19 {\n        name: led_green\n    },\n\n    /// GPIO 20 is blue LED, active low\n    Gpio20 {\n        name: led_blue\n    },\n\n    /// GPIO 23 is connected to bootsel button, active low\n    Gpio23 {\n        name: bootsel\n    },\n\n    /// GPIO 26 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp26Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp26Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp26I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp26Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp26Pio0]           |\n    /// | `PIO1`       | [crate::Gp26Pio1]           |\n    Gpio26 {\n        name: gpio26,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio26].\n            FunctionUart, PullNone: Gp26Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio26].\n            FunctionSpi, PullNone: Gp26Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio26].\n            FunctionPwm, PullNone: Gp26Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio0, PullNone: Gp26Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio1, PullNone: Gp26Pio1\n        }\n    },\n\n    /// GPIO 27 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp27Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp27Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp27I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp27Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp27Pio0]           |\n    /// | `PIO1`       | [crate::Gp27Pio1]           |\n    Gpio27 {\n        name: gpio27,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio27].\n            FunctionUart, PullNone: Gp27Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio27].\n            FunctionSpi, PullNone: Gp27Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio27].\n            FunctionPwm, PullNone: Gp27Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio0, PullNone: Gp27Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio1, PullNone: Gp27Pio1\n        }\n    },\n\n    /// GPIO 28 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp28Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp28Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp28I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp28Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp28Pio0]           |\n    /// | `PIO1`       | [crate::Gp28Pio1]           |\n    Gpio28 {\n        name: gpio28,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp28Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp28Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp28I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp28Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp28Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp28Pio1\n        }\n    },\n\n    /// GPIO 29 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp29Spi1Csn]        |\n    /// | `UART0 RX`   | [crate::Gp29Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp29I2C0Scl]        |\n    /// | `PWM6 B`     | [crate::Gp29Pwm6B]          |\n    /// | `PIO0`       | [crate::Gp29Pio0]           |\n    /// | `PIO1`       | [crate::Gp29Pio1]           |\n    Gpio29 {\n        name: gpio29,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp29Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp29Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp29I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp29Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp29Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp29Pio1\n        }\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/pimoroni-tufty2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.1.0 - 2024-04-07\nInitial release"
  },
  {
    "path": "boards/pimoroni-tufty2040/Cargo.toml",
    "content": "[package]\nname = \"pimoroni-tufty2040\"\nversion = \"0.1.0\"\nauthors = [\"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-tufty2040\"\ndescription = \"Board Support Package for the Pimoroni Tufty2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m.workspace = true\ncortex-m-rt = { workspace = true, optional = true }\nembedded-hal.workspace = true\nembedded_hal_0_2.workspace = true\nfugit.workspace = true\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\ndisplay-interface.workspace = true\npio.workspace = true\npio-proc.workspace = true\n\n[dev-dependencies]\nembedded-graphics.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\nst7789.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\", \"rom-v2-intrinsics\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\", \"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/pimoroni-tufty2040/README.md",
    "content": "# [pimoroni-tufty2040] - Board Support for the [Pimoroni Tufty2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Tufty2040] - a hackable, programmable badge with a LCD colour\ndisplay, powered by a Raspberry Pi RP2040.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Tufty2040.\n\n[Pimoroni Tufty2040]: https://shop.pimoroni.com/products/tufty-2040/\n[pimoroni-tufty2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-tufty2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\npimoroni_tufty2040 = \"0.1.0\"\n```\n\nIn your program, you will need to call `pimoroni_tufty2040::Board::take().unwrap()` to create\na new `Boards` structure. This will set up all the GPIOs for any on-board\ndevices and configure common clocks. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/pimoroni-tufty2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/pimoroni-tufty2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\nthen try repeating the `cargo run` command above.\n\n### [tufty_demo](./examples/tufty_demo)\n\nFlashes the Tufty2040's LED and draws a circle on the screen.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can chose either the MIT licence or the\nApache-2.0 licence when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific licence.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/pimoroni-tufty2040/examples/tufty_demo.rs",
    "content": "//! # Tufty2040 Demo Example\n//!\n//! Draws a circle on the LCD screen and then blinks the user LED on the Tufty 2040.\n//!\n//! See the `Cargo.toml` file for Copyright and licence details.\n\n#![no_std]\n#![no_main]\n\nuse pimoroni_tufty2040 as tufty;\n\n// The macro for our start-up function\nuse tufty::entry;\n\n// GPIO traits\nuse embedded_hal::digital::{OutputPin, PinState};\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse tufty::hal;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse hal::pac;\n\nuse hal::clocks::ClockSource;\nuse hal::gpio::{FunctionPio0, PullNone};\nuse hal::Clock;\nuse hal::Timer;\n\nuse tufty::DummyPin;\n\nuse embedded_graphics::draw_target::DrawTarget;\nuse embedded_graphics::geometry::Point;\nuse embedded_graphics::pixelcolor::{Rgb565, RgbColor};\nuse embedded_graphics::primitives::{Circle, Primitive, PrimitiveStyleBuilder};\nuse embedded_graphics::Drawable;\nuse embedded_hal::delay::DelayNs;\nuse st7789::ST7789;\n\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let cp = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        tufty::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = tufty::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Configure the timer peripheral for our blinky delay\n    let mut timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    let mut delay = cortex_m::delay::Delay::new(cp.SYST, clocks.system_clock.get_freq().to_Hz());\n\n    // Set the LED to be an output\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    pins.lcd_backlight\n        .into_push_pull_output_in_state(PinState::High);\n    pins.lcd_rd.into_push_pull_output_in_state(PinState::High);\n\n    let display_data = {\n        use hal::dma::DMAExt;\n        use hal::pio::PIOExt;\n\n        let dma = pac.DMA.split(&mut pac.RESETS);\n        let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n\n        let wr = pins.lcd_wr.reconfigure::<FunctionPio0, PullNone>();\n        let d0 = pins.lcd_db0.reconfigure::<FunctionPio0, PullNone>();\n        pins.lcd_db1.reconfigure::<FunctionPio0, PullNone>();\n        pins.lcd_db2.reconfigure::<FunctionPio0, PullNone>();\n        pins.lcd_db3.reconfigure::<FunctionPio0, PullNone>();\n        pins.lcd_db4.reconfigure::<FunctionPio0, PullNone>();\n        pins.lcd_db5.reconfigure::<FunctionPio0, PullNone>();\n        pins.lcd_db6.reconfigure::<FunctionPio0, PullNone>();\n        pins.lcd_db7.reconfigure::<FunctionPio0, PullNone>();\n\n        tufty::PioDataLines::new(\n            &mut pio,\n            clocks.system_clock.freq(),\n            wr.id(),\n            d0.id(),\n            sm0,\n            dma.ch0,\n        )\n    };\n\n    let display_interface = tufty::ParallelDisplayInterface::new(\n        pins.lcd_cs.into_push_pull_output_in_state(PinState::High),\n        pins.lcd_dc.into_push_pull_output_in_state(PinState::High),\n        display_data,\n    );\n\n    let mut display = ST7789::new(display_interface, DummyPin, 240, 320);\n    display.init(&mut delay).unwrap();\n    display.clear(Rgb565::BLUE).unwrap();\n\n    let style = PrimitiveStyleBuilder::default()\n        .fill_color(Rgb565::RED)\n        .build();\n    Circle::new(Point::new(50, 50), 10)\n        .into_styled(style)\n        .draw(&mut display)\n        .unwrap();\n\n    // Blink the LED at 1 Hz\n    loop {\n        // LED on, and wait for 500ms\n        led_pin.set_high().unwrap();\n        timer.delay_ms(500);\n\n        // LED off, and wait for 500ms\n        led_pin.set_low().unwrap();\n        timer.delay_ms(500);\n    }\n}\n"
  },
  {
    "path": "boards/pimoroni-tufty2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\npub use hal::pac;\n\nuse display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};\nuse embedded_hal_0_2::digital::v2::OutputPin;\nuse fugit::HertzU32;\nuse hal::dma::{single_buffer, Channel, ChannelIndex, WriteTarget};\nuse hal::gpio::PinId;\nuse hal::pio::{\n    Buffers, PIOBuilder, PIOExt, PinDir, PinState, StateMachineIndex, Tx, UninitStateMachine,\n};\nuse pio_proc::pio_file;\n\n#[cfg(feature = \"rt\")]\npub use rp2040_hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\nhal::bsp_pins!(\n    Gpio0 {\n        name: gpio0,\n        aliases: {\n            /// UART Function alias for pin [Pins::gpio0].\n            FunctionUart, PullNone: UartTx\n        }\n    },\n    Gpio1 {\n        name: gpio1,\n        aliases: {\n            /// UART Function alias for pin [Pins::gpio1].\n            FunctionUart, PullNone: UartRx\n        }\n    },\n    Gpio2 { name: lcd_backlight },\n    Gpio3 { name: i2c_int },\n    Gpio4 {\n        name: gpio4,\n        aliases: {\n            /// I2C Function alias for pin [Pins::gpio4].\n            FunctionI2C, PullUp: I2cSda\n        }\n    },\n    Gpio5 {\n        name: gpio5,\n        aliases: {\n            /// I2C Function alias for pin [Pins::gpio5].\n            FunctionI2C, PullUp: I2cScl\n        }\n    },\n    Gpio6 { name: sw_down },\n    Gpio7 { name: sw_a },\n    Gpio8 { name: sw_b },\n    Gpio9 { name: sw_c },\n    Gpio10 { name: lcd_cs },\n    Gpio11 { name: lcd_dc },\n    Gpio12 { name: lcd_wr },\n    Gpio13 { name: lcd_rd },\n    Gpio14 { name: lcd_db0 },\n    Gpio15 { name: lcd_db1 },\n    Gpio16 { name: lcd_db2 },\n    Gpio17 { name: lcd_db3 },\n    Gpio18 { name: lcd_db4 },\n    Gpio19 { name: lcd_db5 },\n    Gpio20 { name: lcd_db6 },\n    Gpio21 { name: lcd_db7 },\n    Gpio22 { name: sw_up },\n    Gpio23 { name: user_sw },\n    Gpio24 { name: vbus_detect },\n    Gpio25 { name: led },\n    Gpio26 { name: light_sense },\n    Gpio27 { name: sensor_power },\n    Gpio28 { name: vref_1v24 },\n    Gpio29 { name: vbat_sense },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n\n#[inline]\nfn set_pin_bit<P: OutputPin>(pin: &mut P, bit: u8, value: u8) -> Result<(), DisplayError> {\n    pin.set_state(((bit & value) != 0).into())\n        .map_err(|_| DisplayError::BusWriteError)\n}\n\nstruct WriteBytes<T>(T);\n\n// Allow DMA to do byte-size writes to an existing target,\n// SAFETY: This is only used with the PIO as a target, which is valid to write\n// byte-width.\nunsafe impl<T: WriteTarget> WriteTarget for WriteBytes<T> {\n    type TransmittedWord = u8;\n\n    #[inline]\n    fn tx_treq() -> Option<u8> {\n        T::tx_treq()\n    }\n\n    #[inline]\n    fn tx_address_count(&mut self) -> (u32, u32) {\n        self.0.tx_address_count()\n    }\n\n    #[inline]\n    fn tx_increment(&self) -> bool {\n        self.0.tx_increment()\n    }\n}\n\npub trait DisplayDataLines {\n    fn flush(&mut self) {}\n\n    fn write_u8(&mut self, value: u8) -> Result<(), DisplayError>;\n\n    fn write_slice(&mut self, data: &[u8]) -> Result<(), DisplayError> {\n        for b in data.iter().copied() {\n            self.write_u8(b)?;\n        }\n\n        Ok(())\n    }\n\n    fn write_format(&mut self, data: DataFormat<'_>) -> Result<(), DisplayError> {\n        match data {\n            DataFormat::U8(bytes) => self.write_slice(bytes)?,\n            DataFormat::U16(items) => {\n                for value in items.iter().copied() {\n                    self.write_u8(value as u8)?;\n                    self.write_u8((value >> 8) as u8)?;\n                }\n            }\n            DataFormat::U16BE(items) => {\n                for value in items.iter().copied() {\n                    self.write_u8((value >> 8) as u8)?;\n                    self.write_u8(value as u8)?;\n                }\n            }\n            DataFormat::U16LE(items) => {\n                for value in items.iter().copied() {\n                    self.write_u8(value as u8)?;\n                    self.write_u8((value >> 8) as u8)?;\n                }\n            }\n            DataFormat::U8Iter(iter) => {\n                for value in iter {\n                    self.write_u8(value)?;\n                }\n            }\n            DataFormat::U16BEIter(iter) => {\n                for value in iter {\n                    self.write_u8((value >> 8) as u8)?;\n                    self.write_u8(value as u8)?;\n                }\n            }\n            DataFormat::U16LEIter(iter) => {\n                for value in iter {\n                    self.write_u8(value as u8)?;\n                    self.write_u8((value >> 8) as u8)?;\n                }\n            }\n            _ => unimplemented!(),\n        }\n\n        Ok(())\n    }\n}\n\npub struct GpioDataLines<WR, D0, D1, D2, D3, D4, D5, D6, D7> {\n    pub wr: WR,\n    pub d0: D0,\n    pub d1: D1,\n    pub d2: D2,\n    pub d3: D3,\n    pub d4: D4,\n    pub d5: D5,\n    pub d6: D6,\n    pub d7: D7,\n}\n\nimpl<\n        WR: OutputPin,\n        D0: OutputPin,\n        D1: OutputPin,\n        D2: OutputPin,\n        D3: OutputPin,\n        D4: OutputPin,\n        D5: OutputPin,\n        D6: OutputPin,\n        D7: OutputPin,\n    > GpioDataLines<WR, D0, D1, D2, D3, D4, D5, D6, D7>\n{\n    #[inline]\n    fn write_u8_inner(&mut self, value: u8) -> Result<(), DisplayError> {\n        set_pin_bit(&mut self.d0, value, 1 << 0)?;\n        set_pin_bit(&mut self.d1, value, 1 << 1)?;\n        set_pin_bit(&mut self.d2, value, 1 << 2)?;\n        set_pin_bit(&mut self.d3, value, 1 << 3)?;\n        set_pin_bit(&mut self.d4, value, 1 << 4)?;\n        set_pin_bit(&mut self.d5, value, 1 << 5)?;\n        set_pin_bit(&mut self.d6, value, 1 << 6)?;\n        set_pin_bit(&mut self.d7, value, 1 << 7)?;\n        Ok(())\n    }\n}\n\nimpl<\n        WR: OutputPin,\n        D0: OutputPin,\n        D1: OutputPin,\n        D2: OutputPin,\n        D3: OutputPin,\n        D4: OutputPin,\n        D5: OutputPin,\n        D6: OutputPin,\n        D7: OutputPin,\n    > DisplayDataLines for GpioDataLines<WR, D0, D1, D2, D3, D4, D5, D6, D7>\n{\n    fn write_u8(&mut self, value: u8) -> Result<(), DisplayError> {\n        self.wr.set_low().map_err(|_| DisplayError::BusWriteError)?;\n        let err = self.write_u8_inner(value);\n        self.wr.set_high().ok();\n        err\n    }\n}\n\ntype PioTx<P, SM, CH> = (Tx<(P, SM)>, Channel<CH>);\n\npub struct PioDataLines<P: PIOExt, SM: StateMachineIndex, CH: ChannelIndex> {\n    tx: Option<PioTx<P, SM, CH>>,\n}\n\nimpl<P: PIOExt, SM: StateMachineIndex, CH: ChannelIndex> PioDataLines<P, SM, CH> {\n    pub fn new(\n        pio: &mut hal::pio::PIO<P>,\n        sys_freq: HertzU32,\n        wr: impl PinId,\n        d0: impl PinId,\n        sm: UninitStateMachine<(P, SM)>,\n        ch: Channel<CH>,\n    ) -> PioDataLines<P, SM, CH> {\n        let d0 = d0.as_dyn().num;\n        let wr = wr.as_dyn().num;\n\n        let max_pio_clk = HertzU32::MHz(32);\n        let divider = (sys_freq + max_pio_clk - HertzU32::Hz(1)) / max_pio_clk;\n\n        let program = pio_file!(\"./src/st7789_parallel.pio\");\n        let program = pio.install(&program.program).unwrap();\n        let (mut sm, _rx, tx) = PIOBuilder::from_installed_program(program)\n            .out_pins(d0, 8)\n            .side_set_pin_base(wr)\n            .buffers(Buffers::OnlyTx)\n            .pull_threshold(8)\n            .autopull(true)\n            .clock_divisor_fixed_point(divider as u16, 0)\n            .build(sm);\n        sm.set_pindirs([\n            (d0, PinDir::Output),\n            (d0 + 1, PinDir::Output),\n            (d0 + 2, PinDir::Output),\n            (d0 + 3, PinDir::Output),\n            (d0 + 4, PinDir::Output),\n            (d0 + 5, PinDir::Output),\n            (d0 + 6, PinDir::Output),\n            (d0 + 7, PinDir::Output),\n            (wr, PinDir::Output),\n        ]);\n        sm.set_pins([(wr, PinState::High)]);\n        sm.start();\n\n        PioDataLines { tx: Some((tx, ch)) }\n    }\n}\n\nimpl<P: PIOExt, SM: StateMachineIndex, CH: ChannelIndex> DisplayDataLines\n    for PioDataLines<P, SM, CH>\n{\n    fn flush(&mut self) {\n        if let Some((tx, _)) = self.tx.as_mut() {\n            while !tx.is_empty() {}\n        }\n    }\n\n    fn write_u8(&mut self, value: u8) -> Result<(), DisplayError> {\n        if let Some((tx, _)) = self.tx.as_mut() {\n            while !tx.write(value as u32) {}\n            Ok(())\n        } else {\n            Err(DisplayError::BusWriteError)\n        }\n    }\n\n    fn write_slice(&mut self, data: &[u8]) -> Result<(), DisplayError> {\n        // SAFETY: transmute away lifetime, since we will always wait for DMA completion here.\n        let data: &'static [u8] = unsafe { core::mem::transmute(data) };\n\n        let (tx, ch) = self.tx.take().expect(\"DMA already in use\");\n        let xfer = single_buffer::Config::new(ch, data, WriteBytes(tx)).start();\n        let (ch, _, WriteBytes(tx)) = xfer.wait();\n        self.tx = Some((tx, ch));\n        Ok(())\n    }\n}\n\npub struct ParallelDisplayInterface<CS, DC, D> {\n    cs: CS,\n    dc: DC,\n    data_lines: D,\n}\n\nimpl<CS: OutputPin, DC: OutputPin, D: DisplayDataLines> ParallelDisplayInterface<CS, DC, D> {\n    pub fn new(cs: CS, dc: DC, data_lines: D) -> ParallelDisplayInterface<CS, DC, D> {\n        ParallelDisplayInterface { cs, dc, data_lines }\n    }\n}\n\nimpl<CS: OutputPin, DC: OutputPin, D: DisplayDataLines> WriteOnlyDataCommand\n    for ParallelDisplayInterface<CS, DC, D>\n{\n    fn send_commands(&mut self, cmds: DataFormat<'_>) -> Result<(), DisplayError> {\n        self.cs.set_low().map_err(|_| DisplayError::CSError)?;\n        self.dc.set_low().map_err(|_| DisplayError::DCError)?;\n\n        let err = self.data_lines.write_format(cmds);\n        self.data_lines.flush();\n\n        err\n    }\n\n    fn send_data(&mut self, buf: DataFormat<'_>) -> Result<(), DisplayError> {\n        self.dc.set_high().map_err(|_| DisplayError::DCError)?;\n\n        let err = self.data_lines.write_format(buf);\n        self.data_lines.flush();\n\n        err\n    }\n}\n\npub struct DummyPin;\n\nimpl OutputPin for DummyPin {\n    type Error = ();\n\n    fn set_high(&mut self) -> Result<(), Self::Error> {\n        Ok(())\n    }\n\n    fn set_low(&mut self) -> Result<(), Self::Error> {\n        Ok(())\n    }\n}\n"
  },
  {
    "path": "boards/pimoroni-tufty2040/src/st7789_parallel.pio",
    "content": ".program st7789_parallel\n.side_set 1\n\nout pins, 32 side 0\nnop side 1\n"
  },
  {
    "path": "boards/pimoroni_badger2040/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/pimoroni_badger2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.6.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.5.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n\n## 0.4.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n\n## 0.3.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n\n## 0.2.0 - 2022-08-26\n\n### Changed\n\n- Use `rp2040-hal`'s entry function.\n- Migrate from `embedded-time` to `fugit`\n- Update to rp2040-hal 0.6.0\n\n### Removed\n\n- Unused dependencies\n\n"
  },
  {
    "path": "boards/pimoroni_badger2040/Cargo.toml",
    "content": "[package]\nname = \"pimoroni_badger2040\"\nversion = \"0.6.0\"\nauthors = [\"9names\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni_badger2040\"\ndescription = \"Board Support Package for the Pimoroni Badger2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nembedded-hal.workspace = true\nfugit.workspace = true\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\npanic-halt.workspace = true\nnb.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\", \"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/pimoroni_badger2040/README.md",
    "content": "# [pimoroni_badger2040] - Board Support for the [Pimoroni Badger2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Pimoroni Badger2040] - a conference-style badge built around an e-paper\ndisplay and an rp2040\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Badger2040.\n\n[Pimoroni Badger2040]: https://shop.pimoroni.com/products/badger-2040/\n[pimoroni_badger2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni_badger2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\npimoroni_badger2040 = \"0.6.0\"\n```\n\nIn your program, you will need to call `pimoroni_badger2040::Board::take().unwrap()` to create\na new `Boards` structure. This will set up all the GPIOs for any on-board\ndevices and configure common clocks. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/pimoroni_badger2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/pimoroni_badger2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\nthen try repeating the `cargo run` command above.\n\n### [badger_blinky](./examples/badger_blinky.rs)\n\nFlashes the Badger2040's activity LED on and off.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can chose either the MIT licence or the\nApache-2.0 licence when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific licence.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/pimoroni_badger2040/examples/badger_blinky.rs",
    "content": "//! # Badger2040 Blinky Example\n//!\n//! Blinks the activity LED on a badger2040 board, using an RP2040 Timer in Count-down mode.\n//!\n//! See the `Cargo.toml` file for Copyright and licence details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse pimoroni_badger2040::entry;\n\n// GPIO traits\nuse embedded_hal::digital::OutputPin;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse pimoroni_badger2040::hal::pac;\nuse pimoroni_badger2040::hal::Timer;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse pimoroni_badger2040::hal;\n\n// A few traits required for using the delay with timer\nuse embedded_hal::delay::DelayNs;\n\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        pimoroni_badger2040::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = pimoroni_badger2040::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Configure the timer peripheral for our blinky delay\n    let mut timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Set the LED to be an output\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    // Blink the LED at 1 Hz\n    loop {\n        // LED on, and wait for 500ms\n        led_pin.set_high().unwrap();\n        timer.delay_ms(500);\n\n        // LED off, and wait for 500ms\n        led_pin.set_low().unwrap();\n        timer.delay_ms(500);\n    }\n}\n"
  },
  {
    "path": "boards/pimoroni_badger2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\npub use hal::pac;\n\n#[cfg(feature = \"rt\")]\npub use rp2040_hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\nhal::bsp_pins!(\n    Gpio0 {\n        name: gpio0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio0].\n            FunctionUart, PullNone: UartTx\n        }\n    },\n    Gpio1 {\n        name: gpio1,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio1].\n            FunctionUart, PullNone: UartRx\n        }\n    },\n    Gpio3 { name: i2c_int },\n    Gpio4 {\n        name: gpio4,\n        aliases: {\n            /// I2C Function alias for pin [crate::Pins::gpio4].\n            FunctionI2C, PullUp: I2cSda\n        }\n    },\n    Gpio5 {\n        name: gpio5,\n        aliases: {\n            /// I2C Function alias for pin [crate::Pins::gpio5].\n            FunctionI2C, PullUp: I2cScl\n        }\n    },\n    Gpio10 { name: p3v3_en },\n    Gpio11 { name: sw_down },\n    Gpio12 { name: sw_a },\n    Gpio13 { name: sw_b },\n    Gpio14 { name: sw_c },\n    Gpio15 { name: sw_up },\n    Gpio16 {\n        name: miso,\n        aliases: {\n            /// SPI Function alias for pin [crate::Pins::gpio16].\n            FunctionSpi, PullNone: Miso\n        }\n    },\n    Gpio17 {\n        name: inky_cs_gpio,\n        aliases: {\n            /// SPI Function alias for pin [crate::Pins::gpio17].\n            FunctionSpi, PullNone: InkyCs\n        }\n    },\n    Gpio18 {\n        name: sclk,\n        aliases: {\n            /// SPI Function alias for pin [crate::Pins::gpio18].\n            FunctionSpi, PullNone: Sclk\n        }\n    },\n    Gpio19 {\n        name: mosi,\n        aliases: {\n            /// SPI Function alias for pin [crate::Pins::gpio19].\n            FunctionSpi, PullNone: Mosi\n        }\n    },\n    Gpio20 { name: inky_dc },\n    Gpio21 { name: inky_res },\n    Gpio23 { name: user_sw },\n    /// GPIO 24 is connected to vbus_detect of the badger2040.\n    Gpio24 { name: vbus_detect },\n    /// GPIO 25 is connected to activity LED of the badger2040.\n    Gpio25 { name: led },\n    Gpio26 { name: inky_busy },\n    Gpio27 { name: vref_power },\n    Gpio28 { name: vref_1v24 },\n    /// GPIO 29 is connected to battery monitor of the badger2040\n    Gpio29 { name: vbat_sense },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/rp-pico/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/rp-pico/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.9.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to ws2812-pio 0.8.0\n- Update to i2c-pio 0.8.0\n- Update to embedded-sdmmc 0.5.0\n- Update to embedded-hal 1.0.0\n- Update to usbd-hid 0.7.0\n- Update to usbd-serial 0.2.1\n\n## 0.8.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n- Update to i2c-pio 0.7.0\n\n## 0.7.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n- Update to i2c-pio 0.6.0\n- Update to embedded-sdmmc 0.4.0\n\n## 0.6.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n- Update to i2c-pio 0.5.0\n\n## 0.5.0 - 2022-08-26\n\n### Added\n\n- `rp2040-e5` feature enabling the workaround for errata 5 on the USB device peripheral.\n- Support for critical-section 1.0.0 in the examples.\n- Example for the interpolator\n\n### Changed\n\n- Use `rp2040-hal`'s entry function.\n- Migrate from `embedded-time` to `fugit`\n- Bump `ws2812-pio` to 0.4.0\n- Bump `i2c-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n### Removed\n\n- Unused dependencies\n\n## 0.4.0 - 2022-06-13\n\n### Changed\n\n- Update to rp2040-hal 0.5.0\n\n## 0.3.0 - 2022-03-11\n\n### Changed\n\n- Update to rp-hal 0.4.0\n\n## 0.2.0 - 2021-12-23\n\n### Added\n\n- Lots of things!\n\n### Changed\n\n- Basically re-written.\n\n## 0.1.3 - 2021-02-03\n\n- Last release outside the [rp-rs] organisation by [@jannic].\n\n[@jannic]: https://github.com/jannic\n[rp-rs]: https://github.com/rp-rs\n"
  },
  {
    "path": "boards/rp-pico/Cargo.toml",
    "content": "[package]\nname = \"rp-pico\"\nversion = \"0.9.0\"\nauthors = [\"evan <evanmolder@gmail.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/rp-pico\"\ndescription = \"Board Support Package for the Raspberry Pi Pico\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nfugit.workspace = true\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\nusb-device.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\ncortex-m-rtic.workspace = true\ncritical-section.workspace = true\nembedded-graphics.workspace = true\nembedded-hal.workspace = true\nembedded-hal-nb.workspace = true\nembedded-sdmmc.workspace = true\nhd44780-driver.workspace = true\nheapless.workspace = true\ni2c-pio.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\npio.workspace = true\npio-proc.workspace = true\nrp2040-hal = { workspace = true, features = [ \"defmt\" ] }\nsmart-leds.workspace = true\nssd1306.workspace = true\nusbd-hid.workspace = true\nusbd-serial.workspace = true\nws2812-pio.workspace = true\n\ndefmt.workspace = true\ndefmt-rtt.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n\n[[example]]\nname = \"pico_rtic_monotonic\"\nrequired-features = [\"rp2040-hal/rtic-monotonic\"]\n"
  },
  {
    "path": "boards/rp-pico/README.md",
    "content": "# [rp-pico] - Board Support for the [Raspberry Pi Pico]\n\nYou should include this crate if you are writing code that you want to run on\na [Raspberry Pi Pico] - the original launch PCB for the RP2040 chip.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Pico.\n\n[Raspberry Pi Pico]: https://www.raspberrypi.org/products/raspberry-pi-pico/\n[rp-pico]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/rp-pico\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nrp-pico = \"0.9.0\"\n```\n\nIn your program, you will need to call `rp_pico::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/rp-pico $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/rp-pico $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\nthen try repeating the `cargo run` command above.\n\n### From Scratch\n\nTo start a basic project from scratch, create a project using `cargo new project-name`. Within the\nproject directory, run `cargo add rp-pico`, `cargo add cortex-m-rt`, and `cargo add panic-halt`. The\nfirst command will add this HAL (Hardware Abstraction Layer), the second is required for the `#[entry]` macro, and _panic-halt_ creates a simple panic function, which just halts.\n\nYou'll also need to copy the cargo config file from the [repo](https://github.com/rp-rs/rp-hal-boards/blob/main/.cargo/config.toml). It specifies the target and optimizing flags to the linker. You'll also need to copy [_memory.x_](https://github.com/rp-rs/rp-hal-boards/blob/main/memory.x) to your project root. This file tells the linker the flash and RAM layout, so it won't clobber the bootloader or write to an out of bounds memory address. \n\nThe simplest working example, which does nothing except loop forever, is:\n\n```ignore\n#![no_std]\n#![no_main]\nuse rp_pico::entry;\nuse panic_halt as _;\n#[entry]\nfn see_doesnt_have_to_be_called_main() -> ! {\n  loop {}\n}\n```\n\nIt can be placed in _/src/main.rs_. \n\nYou can use `cargo run` to compile and install it. \n**Note**: You won't see any activity since this program does nothing. You can use the examples provided\nto add more functionality. \n### [pico_blinky](./examples/pico_blinky.rs)\n\nFlashes the Pico's on-board LED on and off.\n\n### [pico_gpio_in_out](./examples/pico_gpio_in_out.rs)\n\nReads a push button attached to GPIO 15 and drives the on-board LED to match it (i.e. on when pressed, off when not pressed).\n\n### [pico_rtic](./examples/pico_rtic.rs)\n\nDemonstrates the use of the [Real-Time Interrupt-driven Concurrency Framework] on the Raspberry Pi Pico.\n\n[Real-Time Interrupt-driven Concurrency Framework]: https://rtic.rs\n\n### [pico_countdown_blinky](./examples/pico_countdown_blinky.rs)\n\nAnother LED blinking example, but using a Timer in count-down mode.\n\n### [pico_pwm_blink](./examples/pico_pwm_blink.rs)\n\nPuts out an analog 'triangle wave' on GPIO 25, using the PWM hardware.\n\n### [pico_pwm_servo](./examples/pico_pwm_servo.rs)\n\nDemonstrates handling a micro servo, using the PWM hardware.\n\n### [pico_usb_serial](./examples/pico_usb_serial.rs)\n\nCreates a USB Serial device on a Pico board.\n\nThe USB Serial device will print `HelloWorld` on start-up, and then echo any\nincoming characters - except that any lower-case ASCII characters are\nconverted to the upper-case equivalent.\n\n### [pico_usb_serial_interrupt](./examples/pico_usb_serial_interrupt.rs)\n\nCreates a USB Serial device on a Pico board, but demonstrating handling\ninterrupts when USB data arrives.\n\n### [pico_usb_twitchy_mouse](./examples/pico_usb_twitchy_mouse.rs)\n\nDemonstrates emulating a USB Human Input Device (HID) Mouse. The mouse\ncursor will jiggle up and down.\n\n### [pico_spi_sd_card](./examples/pico_spi_sd_card.rs)\n\nExample that shows how to use the\n[embedded_sdmmc crate](https://github.com/rust-embedded-community/embedded-sdmmc-rs)\nwith the Raspberry Pi Pico.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/rp-pico/build.rs",
    "content": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n    println!(\"cargo:rustc-link-arg-examples=-Tdefmt.x\");\n}\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_blinky.rs",
    "content": "//! # Pico Blinky Example\n//!\n//! Blinks the LED on a Pico board.\n//!\n//! This will blink an LED attached to GP25, which is the pin the Pico uses for\n//! the on-board LED.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// GPIO traits\nuse embedded_hal::digital::OutputPin;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse rp_pico::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then blinks the LED in an\n/// infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Set the LED to be an output\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    // Blink the LED at 1 Hz\n    loop {\n        led_pin.set_high().unwrap();\n        delay.delay_ms(500);\n        led_pin.set_low().unwrap();\n        delay.delay_ms(500);\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_countdown_blinky.rs",
    "content": "//! # Pico Countdown Blinky Example\n//!\n//! Blinks the LED on a Pico board, using an RP2040 Timer in Count-down mode.\n//!\n//! This will blink an LED attached to GP25, which is the pin the Pico uses for\n//! the on-board LED.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\nuse cortex_m::prelude::*;\n\n// GPIO traits\nuse embedded_hal::digital::OutputPin;\n\n// Traits for converting integers to amounts of time\nuse fugit::ExtU32;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // Configure the Timer peripheral in count-down mode\n    let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n    let mut count_down = timer.count_down();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    // Blink the LED at 1 Hz\n    loop {\n        // LED on, and wait for 500ms\n        led_pin.set_high().unwrap();\n        count_down.start(500.millis());\n        let _ = nb::block!(count_down.wait());\n\n        // LED off, and wait for 500ms\n        led_pin.set_low().unwrap();\n        count_down.start(500.millis());\n        let _ = nb::block!(count_down.wait());\n    }\n}\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_gpio_in_out.rs",
    "content": "//! # Pico GPIO In/Out Example\n//!\n//! Toggles the LED based on GPIO input.\n//!\n//! This will control an LED on GP25 based on a button hooked up to GP15. The\n//! button should cause the line to be grounded, as the input pin is pulled high\n//! internally by this example. When the button is pressed, the LED will turn\n//! off.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// GPIO traits\nuse embedded_hal::digital::{InputPin, OutputPin};\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then just reads the button\n/// and sets the LED appropriately.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    // Note - we don't do any clock set-up in this example. The RP2040 will run\n    // at it's default clock speed.\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Our LED output\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    // Our button input\n    let mut button_pin = pins.gpio15.into_pull_up_input();\n\n    // Run forever, setting the LED according to the button\n    loop {\n        if button_pin.is_low().unwrap() {\n            led_pin.set_high().unwrap();\n        } else {\n            led_pin.set_low().unwrap();\n        }\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_hd44780_display.rs",
    "content": "//! # LCD Display Example\n//!\n//! In this example, the RP2040 is configured to drive a small two-line\n//! alphanumeric LCD using the\n//! [HD44780](https://crates.io/crates/hd44780-driver) driver.\n//!\n//! This example drives the LCD by pushing data out of six GPIO pins, writing\n//! the data four bits at a time. A faster alternative can be created using\n//! HD44780::new_8bit() but requiring an additional four GPIO pins.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n//!\n//! ```text\n//!                      /--------------------------------------\\\n//!  ____________        |        /-------------------------\\   |\n//! | 1       GND|-------+---\\    |           _|USB|_       |   |\n//! | 2       VDD|-------+---+----/          |1  R 40|-VBUS-o   v\n//! | 3        VS|-------/   |               |2  P 39|       ||POT||\n//! | 4        RS|--\\        o-----------GND-|3    38|-GND----------o\n//! | 5        RW|--+--------/    /------GP2-|4  P 37|\n//! | 6        EN|--+-\\        /--+------GP3-|5  I 36|\n//! | 7          |  | |     /--+--+------GP4-|6  C   |\n//! | 8          |  | |  /--+--+--+------GP5-|7  O   |\n//! | 9          |  | \\--+--+--+--+---\\      |8      |\n//! | 10         |  \\----+--+--+--+-\\  \\-GP6-|9      |\n//! | 11       D4|-------/  |  |  |  \\---GP7-|10     |\n//! | 12       D5|----------/  |  |          .........\n//! | 13       D6|-------------/  |          |20   21|\n//! | 14       D7|----------------/           \"\"\"\"\"\"\"\n//! ..............\n//! Symbols:\n//!     - (+) crossing lines, not connected\n//!     - (o) connected lines\n//! ```\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse rp_pico::hal::prelude::*;\n\n// GPIO traits\nuse embedded_hal::digital::OutputPin;\n\n// For LCD display\nuse hd44780_driver::HD44780;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[rp_pico::entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables and the spinlock are initialised.\n#[rp_pico::entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = rp_pico::hal::pac::Peripherals::take().unwrap();\n    let core = rp_pico::hal::pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = rp_pico::hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    // The default is to generate a 125 MHz system clock\n    let clocks = rp_pico::hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = rp_pico::hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    // The delay object lets us wait for specified amounts of time\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // Init pins\n    let rs = pins.gpio7.into_push_pull_output();\n    let en = pins.gpio6.into_push_pull_output();\n    let d4 = pins.gpio5.into_push_pull_output();\n    let d5 = pins.gpio4.into_push_pull_output();\n    let d6 = pins.gpio3.into_push_pull_output();\n    let d7 = pins.gpio2.into_push_pull_output();\n\n    // LCD Init\n    let mut lcd = HD44780::new_4bit(rs, en, d4, d5, d6, d7, &mut delay).unwrap();\n\n    loop {\n        // Clear the screen\n        lcd.reset(&mut delay).unwrap();\n        lcd.clear(&mut delay).unwrap();\n\n        // Write to the top line\n        lcd.write_str(\"rp-hal on\", &mut delay).unwrap();\n\n        // Move the cursor\n        lcd.set_cursor_pos(40, &mut delay).unwrap();\n\n        // Write more more text\n        lcd.write_str(\"HD44780! \", &mut delay).unwrap();\n        let mut char_count = 9;\n        for ch in \"move along!.. \".chars() {\n            if char_count > 15 {\n                // Switch autoscroll on\n                lcd.set_autoscroll(true, &mut delay).unwrap();\n            }\n            led_pin.set_high().unwrap();\n            lcd.write_char(ch, &mut delay).unwrap();\n            char_count += 1;\n            delay.delay_us(400_000); //0.4s\n            led_pin.set_low().unwrap();\n            delay.delay_us(100_000); //0.1s\n        }\n        lcd.set_autoscroll(false, &mut delay).unwrap();\n    }\n}\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs",
    "content": "//! # Raspberry Pi Pico (monochome) 128x64 OLED Display with SSD1306 Driver Example\n//!\n//! This example assumes you got an 128x64 OLED Display with an SSD1306 driver\n//! connected to your Raspberry Pi Pico. The +3.3V voltage source of the\n//! Raspberry Pi Pico will be used, and the output pins 21 and 22 of the board\n//! (on the lower right).\n//!\n//! It will demonstrate how to get an I2C device and use it with the ssd1306 crate.\n//! Additionally you can also see how to format a number into a string using\n//! [core::fmt].\n//!\n//! The following diagram will show how things should be connected.\n//! These displays usually can take 3.3V up to 5V.\n//!\n//! ```text\n//!                              VCC   SCL\n//!                   /------------\\    /----------\\\n//!                   |        GND  \\  /  SDA      |\n//!   _|USB|_         |    /-----\\  |  |  /--------+--\\\n//!  |1  R 40|        |   /    __|__|__|__|___     |  |\n//!  |2  P 39|        |  /    | ____________  |    |  |\n//!  |3    38|- GND --+-/     | |Hello worl|  |    |  |\n//!  |4  P 37|        |       | |Hello Rust|  |    |  |\n//!  |5  I 36|-+3.3V -/       | |counter: 1|  |    |  |\n//!  |6  C   |                | |          |  |    |  |\n//!  |7  O   |                | \"\"\"\"\"\"\"\"\"\"\"\"  |    |  |\n//!  |       |                 \"\"\"\"\"\"\"\"\"\"\"\"\"\"\"     |  |\n//!  |       |       (SSD1306 128x64 OLED Display) |  |\n//!  .........                                     /  /\n//!  |       |                                    /  /\n//!  |     22|-GP17 I2C0 SCL---------------------/  /\n//!  |20   21|-GP16 I2C0 SDA-----------------------/\n//!   \"\"\"\"\"\"\"\n//! Symbols:\n//!     - (+) crossing lines, not connected\n//!     - (o) connected lines\n//! ```\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// For string formatting.\nuse core::fmt::Write;\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// Time handling traits:\nuse fugit::RateExtU32;\n\n// Timer for the delay on the display:\nuse embedded_hal::delay::DelayNs;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n// For in the graphics drawing utilities like the font\n// and the drawing routines:\nuse embedded_graphics::{\n    mono_font::{ascii::FONT_9X18_BOLD, MonoTextStyleBuilder},\n    pixelcolor::BinaryColor,\n    prelude::*,\n    text::{Baseline, Text},\n};\n\n// The display driver:\nuse ssd1306::{prelude::*, Ssd1306};\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals,\n/// gets a handle on the I2C peripheral,\n/// initializes the SSD1306 driver, initializes the text builder\n/// and then draws some text on the display.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Configure two pins as being I²C, not GPIO\n    let sda_pin: hal::gpio::Pin<_, hal::gpio::FunctionI2C, _> = pins.gpio16.reconfigure();\n    let scl_pin: hal::gpio::Pin<_, hal::gpio::FunctionI2C, _> = pins.gpio17.reconfigure();\n\n    // Create the I²C driver, using the two pre-configured pins. This will fail\n    // at compile time if the pins are in the wrong mode, or if this I²C\n    // peripheral isn't available on these pins!\n    let i2c = hal::I2C::i2c0(\n        pac.I2C0,\n        sda_pin,\n        scl_pin,\n        400.kHz(),\n        &mut pac.RESETS,\n        &clocks.peripheral_clock,\n    );\n\n    // Create the I²C display interface:\n    let interface = ssd1306::I2CDisplayInterface::new(i2c);\n\n    // Create a driver instance and initialize:\n    let mut display = Ssd1306::new(interface, DisplaySize128x64, DisplayRotation::Rotate0)\n        .into_buffered_graphics_mode();\n    display.init().unwrap();\n\n    // Create a text style for drawing the font:\n    let text_style = MonoTextStyleBuilder::new()\n        .font(&FONT_9X18_BOLD)\n        .text_color(BinaryColor::On)\n        .build();\n\n    let mut timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    let mut count = 0;\n\n    let mut buf = FmtBuf::new();\n    loop {\n        buf.reset();\n        // Format some text into a static buffer:\n        write!(&mut buf, \"counter: {}\", count).unwrap();\n        count += 1;\n\n        // Empty the display:\n        display.clear();\n\n        // Draw 3 lines of text:\n        Text::with_baseline(\"Hello world!\", Point::zero(), text_style, Baseline::Top)\n            .draw(&mut display)\n            .unwrap();\n\n        Text::with_baseline(\"Hello Rust!\", Point::new(0, 16), text_style, Baseline::Top)\n            .draw(&mut display)\n            .unwrap();\n\n        Text::with_baseline(buf.as_str(), Point::new(0, 32), text_style, Baseline::Top)\n            .draw(&mut display)\n            .unwrap();\n\n        display.flush().unwrap();\n\n        // Wait a bit:\n        timer.delay_ms(500);\n    }\n}\n\n/// This is a very simple buffer to pre format a short line of text\n/// limited arbitrarily to 64 bytes.\nstruct FmtBuf {\n    buf: [u8; 64],\n    ptr: usize,\n}\n\nimpl FmtBuf {\n    fn new() -> Self {\n        Self {\n            buf: [0; 64],\n            ptr: 0,\n        }\n    }\n\n    fn reset(&mut self) {\n        self.ptr = 0;\n    }\n\n    fn as_str(&self) -> &str {\n        core::str::from_utf8(&self.buf[0..self.ptr]).unwrap()\n    }\n}\n\nimpl core::fmt::Write for FmtBuf {\n    fn write_str(&mut self, s: &str) -> core::fmt::Result {\n        let rest_len = self.buf.len() - self.ptr;\n        let len = if rest_len < s.len() {\n            rest_len\n        } else {\n            s.len()\n        };\n        self.buf[self.ptr..(self.ptr + len)].copy_from_slice(&s.as_bytes()[0..len]);\n        self.ptr += len;\n        Ok(())\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_i2c_pio.rs",
    "content": "//! # Pico I2C PIO Example\n//!\n//! Reads the temperature from an LM75B\n//!\n//! This read over I2C the temerature from an LM75B temperature sensor wired on pins 20 and 21\n//! using the PIO peripheral as an I2C bus controller.\n//! The pins used for the I2C can be remapped to any other pin available to the PIO0 peripheral.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The trait used by formatting macros like write! and writeln!\nuse core::fmt::Write as FmtWrite;\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// I2C HAL traits & Types.\nuse embedded_hal::i2c::{I2c, Operation};\n\n// Time handling traits\nuse fugit::RateExtU32;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse rp_pico::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n// UART related types\nuse hal::uart::{DataBits, StopBits, UartConfig};\n\n/// Prints the temperature received from the sensor\nfn print_temperature(serial: &mut impl FmtWrite, temp: [u8; 2]) {\n    let temp_i16 = i16::from_be_bytes(temp) >> 5;\n    let temp_f32 = f32::from(temp_i16) * 0.125;\n\n    // Write formatted output but ignore any error.\n    let _ = writeln!(serial, \"Temperature: {:0.2}°C\", temp_f32);\n}\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, reads the temperature from\n/// the attached LM75B using PIO0.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let uart_pins = (\n        // UART TX (characters sent from RP2040) on pin 1 (GPIO0)\n        pins.gpio0.into_function::<hal::gpio::FunctionUart>(),\n        // UART RX (characters received by RP2040) on pin 2 (GPIO1)\n        pins.gpio1.into_function::<hal::gpio::FunctionUart>(),\n    );\n\n    let mut uart = hal::uart::UartPeripheral::new(pac.UART0, uart_pins, &mut pac.RESETS)\n        .enable(\n            UartConfig::new(115_200.Hz(), DataBits::Eight, None, StopBits::One),\n            clocks.peripheral_clock.freq(),\n        )\n        .unwrap();\n\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n\n    let mut i2c_pio = i2c_pio::I2C::new(\n        &mut pio,\n        pins.gpio20,\n        pins.gpio21,\n        sm0,\n        100.kHz(),\n        clocks.system_clock.freq(),\n    );\n\n    let mut temp = [0; 2];\n    i2c_pio\n        .read(0x48u8, &mut temp)\n        .expect(\"Failed to read from the peripheral\");\n    print_temperature(&mut uart, temp);\n\n    i2c_pio\n        .write(0x48u8, &[0])\n        .expect(\"Failed to write to the peripheral\");\n\n    let mut temp = [0; 2];\n    i2c_pio\n        .read(0x48u8, &mut temp)\n        .expect(\"Failed to read from the peripheral\");\n    print_temperature(&mut uart, temp);\n\n    let mut config = [0];\n    let mut thyst = [0; 2];\n    let mut tos = [0; 2];\n    let mut temp = [0; 2];\n    let mut operations = [\n        Operation::Write(&[1]),\n        Operation::Read(&mut config),\n        Operation::Write(&[2]),\n        Operation::Read(&mut thyst),\n        Operation::Write(&[3]),\n        Operation::Read(&mut tos),\n        Operation::Write(&[0]),\n        Operation::Read(&mut temp),\n    ];\n    i2c_pio\n        .transaction(0x48u8, &mut operations)\n        .expect(\"Failed to run all operations\");\n    print_temperature(&mut uart, temp);\n\n    loop {\n        cortex_m::asm::wfi();\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_interpolator.rs",
    "content": "//! # Pico Interpolator Example\n//!\n//! Example demonstrating the usage of the hardware interpolator.\n//!\n//! Runs several test programs, outputs the result on LEDs.\n//! Green led for successful test connects to GPIO3.\n//! Red led for unsuccessful test connects to GPIO4.\n//! In case of failure, the system LED blinks the number of the test.\n//! In case of success, the system LED stays lit.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// GPIO traits\nuse embedded_hal::digital::OutputPin;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n// Pull in any important traits\nuse rp_pico::hal::prelude::*;\n\nuse rp_pico::hal::sio::{Interp, Interp0, Interp1, Lane, LaneCtrl};\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then just reads the button\n/// and sets the LED appropriately.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let mut sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Our LED outputs\n    let mut system_led_pin = pins.led.into_push_pull_output();\n    let mut green_led_pin = pins.gpio3.into_push_pull_output();\n    let mut red_led_pin = pins.gpio4.into_push_pull_output();\n\n    system_led_pin.set_low().unwrap();\n    green_led_pin.set_low().unwrap();\n    red_led_pin.set_low().unwrap();\n\n    let mut choose_led = |index: u32, result: bool| {\n        if result {\n            // blink the green led once to indicate success\n            green_led_pin.set_high().unwrap();\n            delay.delay_ms(500);\n            green_led_pin.set_low().unwrap();\n            delay.delay_ms(500);\n        } else {\n            // turn the red led on to indicate failure\n            // and blink the on board led to indicate which test failed, looping forever\n            red_led_pin.set_high().unwrap();\n            loop {\n                for _ in 0..index {\n                    system_led_pin.set_high().unwrap();\n                    delay.delay_ms(200);\n                    system_led_pin.set_low().unwrap();\n                    delay.delay_ms(200);\n                }\n                delay.delay_ms(1000);\n            }\n        }\n    };\n\n    // Run forever, setting the LED according to the button\n\n    choose_led(1, multiplication_table(&mut sio.interp0));\n    choose_led(2, moving_mask(&mut sio.interp0));\n    choose_led(3, cross_lanes(&mut sio.interp0));\n    choose_led(4, simple_blend1(&mut sio.interp0));\n    choose_led(5, simple_blend2(&mut sio.interp0));\n    choose_led(6, clamp(&mut sio.interp1));\n    choose_led(7, texture_mapping(&mut sio.interp0));\n\n    // turn the on board led on to indicate testing is done\n    system_led_pin.set_high().unwrap();\n    loop {\n        delay.delay_ms(1000);\n    }\n}\n\nfn multiplication_table(interp: &mut Interp0) -> bool {\n    //get the default configuration that just keep adding base into accum\n    let config = LaneCtrl::new();\n\n    //write the configuration to the hardware.\n    interp.get_lane0().set_ctrl(config.encode());\n\n    //set the accumulator to 0 and the base to 9\n    interp.get_lane0().set_accum(0);\n    interp.get_lane0().set_base(9);\n\n    //the expected output for comparison\n    let expected = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90];\n\n    for i in expected {\n        //returns the value of accum + base and sets accum to the same value\n        let value = interp.get_lane0().pop();\n\n        if value != i {\n            return false; //inform that the interpolator did not return the expected value\n        }\n    }\n    true\n}\n\nfn moving_mask(interp: &mut Interp0) -> bool {\n    //get the default configuration that just keep adding base into accum\n    let mut config = LaneCtrl::new();\n\n    interp.get_lane0().set_accum(0x1234ABCD);\n\n    let expected = [\n        0x0000_000D,\n        0x0000_00C0,\n        0x0000_0B00,\n        0x0000_A000,\n        0x0004_0000,\n        0x0030_0000,\n        0x0200_0000,\n        0x1000_0000,\n    ];\n    for i in 0..8 {\n        // LSB, then MSB. These are inclusive, so 0,31 means \"the entire 32 bit register\"\n        config.mask_lsb = i * 4;\n        config.mask_msb = i * 4 + 3;\n        interp.get_lane0().set_ctrl(config.encode());\n\n        // Reading read_raw() returns the lane data\n        //   after shifting, masking and sign extending, without adding base\n        if interp.get_lane0().read_raw() != expected[i as usize] {\n            return false;\n        }\n    }\n\n    let signed_expected = [\n        0xFFFF_FFFD,\n        0xFFFF_FFC0,\n        0xFFFF_FB00,\n        0xFFFF_A000,\n        0x0004_0000,\n        0x0030_0000,\n        0x0200_0000,\n        0x1000_0000,\n    ];\n\n    config.signed = true;\n    for i in 0..8 {\n        config.mask_lsb = i * 4;\n        config.mask_msb = i * 4 + 3;\n        interp.get_lane0().set_ctrl(config.encode());\n\n        if interp.get_lane0().read_raw() != signed_expected[i as usize] {\n            return false;\n        }\n    }\n    true\n}\n\nfn cross_lanes(interp: &mut Interp0) -> bool {\n    // this configuration will at the time of pop()\n    // when applied to lane0 : set lane0 accumulator to the result from lane1\n    // when applied to lane1 : set lane1 accumulator to the result from lane0\n    let config = LaneCtrl {\n        cross_result: true,\n        ..LaneCtrl::new()\n    };\n    let encoded_config = config.encode();\n\n    // each lane is used through an accessor,\n    // as lanes mutate each other, they can not be borrowed at the same time\n    interp.get_lane0().set_ctrl(encoded_config);\n    interp.get_lane1().set_ctrl(encoded_config);\n\n    interp.get_lane0().set_accum(123);\n    interp.get_lane1().set_accum(456);\n\n    // lane0 will add 1 to its result, lane1 will add nothing\n    interp.get_lane0().set_base(1);\n    interp.get_lane1().set_base(0);\n\n    let expected = [\n        (124, 456),\n        (457, 124),\n        (125, 457),\n        (458, 125),\n        (126, 458),\n        (459, 126),\n        (127, 459),\n        (460, 127),\n        (128, 460),\n        (461, 128),\n    ];\n\n    for i in expected {\n        if i != (interp.get_lane0().peek(), interp.get_lane1().pop()) {\n            return false;\n        }\n    }\n    true\n}\n\nfn simple_blend1(interp: &mut Interp0) -> bool {\n    let config = LaneCtrl {\n        blend: true,\n        ..LaneCtrl::new()\n    };\n\n    //enable blend mode\n    interp.get_lane0().set_ctrl(config.encode());\n    //make sure the default configuration is in lane1 as the value may be shifted and masked.\n    interp.get_lane1().set_ctrl(LaneCtrl::new().encode());\n\n    //set the minimum value for interp.get_lane0().set_accum(0) 0/256\n    interp.get_lane0().set_base(500);\n    //set the maximum value which is inaccessible\n    // as the blend is done between 0/256 and 255/256\n    interp.get_lane1().set_base(1000);\n\n    let expected = [500, 582, 666, 748, 832, 914, 998];\n    for i in 0..=6 {\n        interp.get_lane1().set_accum(255 * i / 6);\n        if expected[i as usize] != interp.get_lane1().peek() {\n            return false;\n        }\n    }\n    true\n}\n\nfn simple_blend2(interp: &mut Interp0) -> bool {\n    let config = LaneCtrl {\n        blend: true,\n        ..LaneCtrl::new()\n    };\n    //enable blend mode\n    interp.get_lane0().set_ctrl(config.encode());\n\n    interp.get_lane0().set_base((-1000i32) as u32);\n    interp.get_lane1().set_base(1000);\n\n    let mut config1 = LaneCtrl {\n        signed: true,\n        ..LaneCtrl::new()\n    };\n    interp.get_lane1().set_ctrl(config1.encode());\n    let expected_signed = [-1000, -672, -336, -8, 328, 656, 992];\n    for i in 0..=6 {\n        // write a value between 0 and 256 (exclusive)\n        interp.get_lane1().set_accum(255 * i / 6);\n        // reads it as a value between -1000 and 1000 (exclusive)\n        if interp.get_lane1().peek() as i32 != expected_signed[i as usize] {\n            return false;\n        }\n    }\n    config1.signed = false;\n    interp.get_lane1().set_ctrl(config1.encode());\n    let expected_unsigned = [\n        0xfffffc18, 0xd5fffd60, 0xaafffeb0, 0x80fffff8, 0x56000148, 0x2c000290, 0x010003e0,\n    ];\n    for i in 0..=6 {\n        interp.get_lane1().set_accum(255 * i / 6);\n        // reads a value between 4294966296 and 1000\n        if interp.get_lane1().peek() != expected_unsigned[i as usize] {\n            return false;\n        }\n    }\n    true\n}\n\n///Divides by 4 and clamp the value between 0 and 255 inclusive\nfn clamp(interp: &mut Interp1) -> bool {\n    // Enables Clamp ONLY AVAILABLE ON Interp1\n    // shift two bits to the right and mask the two most significant bits\n    // because sign extension is made after the mask\n    let config = LaneCtrl {\n        clamp: true,\n        shift: 2,\n        mask_lsb: 0,\n        mask_msb: 29,\n        signed: true,\n        ..LaneCtrl::new()\n    };\n    interp.get_lane0().set_ctrl(config.encode());\n    //set minimum value of result\n    interp.get_lane0().set_base(0);\n    //set maximum value of result\n    interp.get_lane1().set_base(255);\n    let values: [(i32, i32); 9] = [\n        (-1024, 0),\n        (-768, 0),\n        (-512, 0),\n        (-256, 0),\n        (0, 0),\n        (256, 64),\n        (512, 128),\n        (768, 192),\n        (1024, 255),\n    ];\n    for (arg, result) in values {\n        interp.get_lane0().set_accum(arg as u32);\n        if result != interp.get_lane0().peek() as i32 {\n            return false;\n        }\n    }\n    true\n}\n\nfn texture_mapping(interp: &mut Interp0) -> bool {\n    #[rustfmt::skip]\n    let texture: [u8;16] = [\n        0x00, 0x01, 0x02, 0x03,\n        0x10, 0x11, 0x12, 0x13,\n        0x20, 0x21, 0x22, 0x23,\n        0x30, 0x31, 0x32, 0x33,\n    ];\n\n    // the position will be given in fixed point with 16 bits\n    // fractional part\n    let uv_fractional_bits = 16;\n    let texture_width_bits = 2;\n    let texture_height_bits = 2;\n\n    // bits\n    //                       3322222222221111 1111110000000000\n    //                       1098765432109876 5432109876543210\n    // accum0 u axis coordinate            xx xxxxxxxxxxxxxxxx  18 bits\n    // after shift and mask                                 xx\n    // accum1 v axis                       xx xxxxxxxxxxxxxxxx  18 bits\n    // after shift and mask                               xx\n\n    // add_raw make the interpolator increment the accumulator\n    // with the base value without masking or shifting\n    let config0 = LaneCtrl {\n        add_raw: true,\n        shift: uv_fractional_bits,\n        mask_lsb: 0,\n        mask_msb: texture_width_bits - 1,\n        ..LaneCtrl::new()\n    };\n    interp.get_lane0().set_ctrl(config0.encode());\n    let config1 = LaneCtrl {\n        add_raw: true,\n        shift: uv_fractional_bits - texture_width_bits,\n        mask_lsb: texture_width_bits,\n        mask_msb: texture_width_bits + texture_height_bits - 1,\n        ..LaneCtrl::new()\n    };\n    interp.get_lane1().set_ctrl(config1.encode());\n\n    interp.set_base(0);\n\n    // set starting position to 0x0\n    // will move 1/2 a pixel horizontally\n    // and 1/3 a pixel vertically per call to pop()\n    interp.get_lane0().set_accum(0);\n    interp.get_lane0().set_base(65536 / 2);\n    interp.get_lane1().set_accum(0);\n    interp.get_lane1().set_base(65536 / 3);\n\n    let expected = [\n        0x00, 0x00, 0x01, 0x01, 0x12, 0x12, 0x13, 0x23, 0x20, 0x20, 0x31, 0x31,\n    ];\n\n    for i in expected {\n        if i != texture[interp.pop() as usize] {\n            return false;\n        }\n    }\n\n    // reset the starting position\n    interp.get_lane0().set_accum(0);\n    interp.get_lane1().set_accum(0);\n    interp.set_base(texture.as_ptr() as u32);\n\n    for i in expected {\n        // This is unsafe and should be done extremely carefully\n        // remember to follow memory alignment,\n        // reading or writing an unaligned address will crash\n        if i != unsafe { *(interp.pop() as *const u8) } {\n            return false;\n        }\n    }\n\n    true\n}\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_pio_pwm.rs",
    "content": "//! # Pico PIO PWM Blink Example\n//!\n//! Fades the LED on a Pico board using the PIO peripheral with an pwm program.\n//!\n//! This will fade in the LED attached to GP25, which is the pin the Pico\n//! uses for the on-board LED.\n//!\n//! This example uses a few advance pio tricks such as side setting pins and instruction injection.\n//!\n//! See the `Cargo.toml` file for Copyright and license details. Except for the pio program which is subject to a different license.\n\n#![no_std]\n#![no_main]\n\nuse defmt::info;\nuse defmt_rtt as _;\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse rp_pico::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n// Import pio crates\nuse hal::pio::{PIOBuilder, Running, StateMachine, Tx, ValidStateMachine, SM0};\nuse pio::{Instruction, InstructionOperands, OutDestination};\nuse pio_proc::pio_file;\n\n/// Set pio pwm period\n///\n/// This uses a sneaky trick to set a second value besides the duty cycle.\n/// We first write a value to the tx fifo. But instead of the normal instructions we\n/// have stopped the state machine and inject our own instructions that move the written value to the ISR.\nfn pio_pwm_set_period<T: ValidStateMachine>(\n    sm: StateMachine<(hal::pac::PIO0, SM0), Running>,\n    tx: &mut Tx<T>,\n    period: u32,\n) -> StateMachine<(hal::pac::PIO0, SM0), Running> {\n    // To make sure the inserted instructions actually use our newly written value\n    // We first busy loop to empty the queue. (Which typically should be the case)\n    while !tx.is_empty() {}\n\n    let mut sm = sm.stop();\n    tx.write(period);\n    sm.exec_instruction(Instruction {\n        operands: InstructionOperands::PULL {\n            if_empty: false,\n            block: false,\n        },\n        delay: 0,\n        side_set: None,\n    });\n    sm.exec_instruction(Instruction {\n        operands: InstructionOperands::OUT {\n            destination: OutDestination::ISR,\n            bit_count: 32,\n        },\n        delay: 0,\n        side_set: None,\n    });\n    sm.start()\n}\n\n/// Set pio pwm duty cycle\n///\n/// The value written to the TX FIFO is used directly by the normal pio program\nfn pio_pwm_set_level<T: ValidStateMachine>(tx: &mut Tx<T>, level: u32) {\n    // Write duty cycle to TX Fifo\n    tx.write(level);\n}\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then fades the LED in an\n/// infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    let (mut pio0, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n\n    // Create a pio program\n    let program = pio_file!(\"./examples/pwm.pio\", select_program(\"pwm\"),);\n    let installed = pio0.install(&program.program).unwrap();\n\n    // Set gpio25 to pio\n    let _led: hal::gpio::Pin<_, hal::gpio::FunctionPio0, hal::gpio::PullNone> =\n        pins.led.reconfigure();\n    let led_pin_id = 25;\n\n    // Build the pio program and set pin both for set and side set!\n    // We are running with the default divider which is 1 (max speed)\n    let (mut sm, _, mut tx) = PIOBuilder::from_installed_program(installed)\n        .set_pins(led_pin_id, 1)\n        .side_set_pin_base(led_pin_id)\n        .build(sm0);\n\n    // Set pio pindir for gpio25\n    sm.set_pindirs([(led_pin_id, hal::pio::PinDir::Output)]);\n\n    // Start state machine\n    let sm = sm.start();\n\n    // Set period\n    pio_pwm_set_period(sm, &mut tx, u16::MAX as u32 - 1);\n\n    // Loop forever and adjust duty cycle to make te led brighter\n    let mut level = 0;\n    loop {\n        info!(\"Level = {}\", level);\n        pio_pwm_set_level(&mut tx, level * level);\n        level = (level + 1) % 256;\n        delay.delay_ms(10);\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_pwm_blink.rs",
    "content": "//! # Pico PWM Blink Example\n//!\n//! Fades the LED on a Pico board using the PWM peripheral.\n//!\n//! This will fade in/out the LED attached to GP25, which is the pin the Pico\n//! uses for the on-board LED.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// GPIO traits\nuse embedded_hal::pwm::SetDutyCycle;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse rp_pico::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n// The minimum PWM value (i.e. LED brightness) we want\nconst LOW: u16 = 0;\n\n// The maximum PWM value (i.e. LED brightness) we want\nconst HIGH: u16 = 25000;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then fades the LED in an\n/// infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // Init PWMs\n    let mut pwm_slices = hal::pwm::Slices::new(pac.PWM, &mut pac.RESETS);\n\n    // Configure PWM4\n    let pwm = &mut pwm_slices.pwm4;\n    pwm.set_ph_correct();\n    pwm.enable();\n\n    // Output channel B on PWM4 to the LED pin\n    let channel = &mut pwm.channel_b;\n    channel.output_to(pins.led);\n\n    // Infinite loop, fading LED up and down\n    loop {\n        // Ramp brightness up\n        for i in (LOW..=HIGH).skip(100) {\n            delay.delay_us(8);\n            let _ = channel.set_duty_cycle(i);\n        }\n\n        // Ramp brightness down\n        for i in (LOW..=HIGH).rev().skip(100) {\n            delay.delay_us(8);\n            let _ = channel.set_duty_cycle(i);\n        }\n\n        delay.delay_ms(500);\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_pwm_servo.rs",
    "content": "//! # Pico PWM Micro Servo Example\n//!\n//! Moves the micro servo on a Pico board using the PWM peripheral.\n//!\n//! This will move in different positions the motor attached to GP1.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\nuse cortex_m::prelude::*;\n\n// GPIO traits\nuse embedded_hal::pwm::SetDutyCycle;\n\n// Traits for converting integers to amounts of time\nuse fugit::ExtU32;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[rp2040_hal::entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables and the spinlock are initialised.\n///\n/// The function configures the RP2040 peripherals, then fades the LED in an\n/// infinite loop.\n#[rp2040_hal::entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // Configure the Timer peripheral in count-down mode\n    let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n    let mut count_down = timer.count_down();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Init PWMs\n    let mut pwm_slices = hal::pwm::Slices::new(pac.PWM, &mut pac.RESETS);\n\n    // Configure PWM0\n    let pwm = &mut pwm_slices.pwm0;\n    pwm.set_ph_correct();\n    pwm.set_div_int(20u8); // 50 hz\n    pwm.enable();\n\n    // Output channel B on PWM0 to the GPIO1 pin\n    let channel = &mut pwm.channel_b;\n    channel.output_to(pins.gpio1);\n\n    // Infinite loop, moving micro servo from one position to another.\n    // You may need to adjust the pulse width since several servos from\n    // different manufacturers respond differently.\n    loop {\n        // move to 0°\n        let _ = channel.set_duty_cycle(2500);\n        count_down.start(400.millis());\n        let _ = nb::block!(count_down.wait());\n\n        // 0° to 90°\n        let _ = channel.set_duty_cycle(3930);\n        count_down.start(400.millis());\n        let _ = nb::block!(count_down.wait());\n\n        // 90° to 180°\n        let _ = channel.set_duty_cycle(7860);\n        count_down.start(400.millis());\n        let _ = nb::block!(count_down.wait());\n\n        // 180° to 90°\n        let _ = channel.set_duty_cycle(3930);\n        count_down.start(400.millis());\n        let _ = nb::block!(count_down.wait());\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_rtic.rs",
    "content": "#![no_std]\n#![no_main]\n\nuse panic_halt as _;\n\n#[rtic::app(device = rp_pico::hal::pac, peripherals = true)]\nmod app {\n\n    use embedded_hal::digital::OutputPin;\n    use fugit::MicrosDurationU32;\n    use rp_pico::{\n        hal::{self, clocks::init_clocks_and_plls, timer::Alarm, watchdog::Watchdog, Sio},\n        XOSC_CRYSTAL_FREQ,\n    };\n\n    const SCAN_TIME_US: MicrosDurationU32 = MicrosDurationU32::secs(1);\n\n    #[shared]\n    struct Shared {\n        timer: hal::Timer,\n        alarm: hal::timer::Alarm0,\n        led: hal::gpio::Pin<\n            hal::gpio::bank0::Gpio25,\n            hal::gpio::FunctionSioOutput,\n            hal::gpio::PullNone,\n        >,\n    }\n\n    #[local]\n    struct Local {}\n\n    #[init]\n    fn init(c: init::Context) -> (Shared, Local, init::Monotonics) {\n        // Soft-reset does not release the hardware spinlocks\n        // Release them now to avoid a deadlock after debug or watchdog reset\n        unsafe {\n            hal::sio::spinlock_reset();\n        }\n        let mut resets = c.device.RESETS;\n        let mut watchdog = Watchdog::new(c.device.WATCHDOG);\n        let clocks = init_clocks_and_plls(\n            XOSC_CRYSTAL_FREQ,\n            c.device.XOSC,\n            c.device.CLOCKS,\n            c.device.PLL_SYS,\n            c.device.PLL_USB,\n            &mut resets,\n            &mut watchdog,\n        )\n        .ok()\n        .unwrap();\n\n        let sio = Sio::new(c.device.SIO);\n        let pins = rp_pico::Pins::new(\n            c.device.IO_BANK0,\n            c.device.PADS_BANK0,\n            sio.gpio_bank0,\n            &mut resets,\n        );\n        let mut led = pins.led.reconfigure();\n        led.set_low().unwrap();\n\n        let mut timer = hal::Timer::new(c.device.TIMER, &mut resets, &clocks);\n        let mut alarm = timer.alarm_0().unwrap();\n        let _ = alarm.schedule(SCAN_TIME_US);\n        alarm.enable_interrupt();\n\n        (Shared { timer, alarm, led }, Local {}, init::Monotonics())\n    }\n\n    #[task(\n        binds = TIMER_IRQ_0,\n        priority = 1,\n        shared = [timer, alarm, led],\n        local = [tog: bool = true],\n    )]\n    fn timer_irq(mut c: timer_irq::Context) {\n        if *c.local.tog {\n            c.shared.led.lock(|l| l.set_high().unwrap());\n        } else {\n            c.shared.led.lock(|l| l.set_low().unwrap());\n        }\n        *c.local.tog = !*c.local.tog;\n\n        let mut alarm = c.shared.alarm;\n        (alarm).lock(|a| {\n            a.clear_interrupt();\n            let _ = a.schedule(SCAN_TIME_US);\n        });\n    }\n}\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_rtic_monotonic.rs",
    "content": "#![no_std]\n#![no_main]\n\nuse panic_halt as _;\n\n#[rtic::app(device = rp_pico::hal::pac, peripherals = true, dispatchers = [I2C0_IRQ])]\nmod app {\n\n    use embedded_hal::digital::OutputPin;\n    use fugit::ExtU64;\n    use rp_pico::{\n        hal::{\n            self,\n            clocks::init_clocks_and_plls,\n            timer::{monotonic::Monotonic, Alarm0},\n            watchdog::Watchdog,\n            Sio,\n        },\n        XOSC_CRYSTAL_FREQ,\n    };\n\n    #[shared]\n    struct Shared {\n        led: hal::gpio::Pin<\n            hal::gpio::bank0::Gpio25,\n            hal::gpio::FunctionSioOutput,\n            hal::gpio::PullNone,\n        >,\n    }\n\n    #[monotonic(binds = TIMER_IRQ_0, default = true)]\n    type MyMono = Monotonic<Alarm0>;\n\n    #[local]\n    struct Local {}\n\n    #[init]\n    fn init(c: init::Context) -> (Shared, Local, init::Monotonics) {\n        // Soft-reset does not release the hardware spinlocks\n        // Release them now to avoid a deadlock after debug or watchdog reset\n        unsafe {\n            hal::sio::spinlock_reset();\n        }\n        let mut resets = c.device.RESETS;\n        let mut watchdog = Watchdog::new(c.device.WATCHDOG);\n        let clocks = init_clocks_and_plls(\n            XOSC_CRYSTAL_FREQ,\n            c.device.XOSC,\n            c.device.CLOCKS,\n            c.device.PLL_SYS,\n            c.device.PLL_USB,\n            &mut resets,\n            &mut watchdog,\n        )\n        .ok()\n        .unwrap();\n\n        let sio = Sio::new(c.device.SIO);\n        let pins = rp_pico::Pins::new(\n            c.device.IO_BANK0,\n            c.device.PADS_BANK0,\n            sio.gpio_bank0,\n            &mut resets,\n        );\n        let mut led = pins.led.reconfigure();\n        led.set_low().unwrap();\n\n        let mut timer = hal::Timer::new(c.device.TIMER, &mut resets, &clocks);\n        let alarm = timer.alarm_0().unwrap();\n        blink_led::spawn_after(500.millis()).unwrap();\n\n        (\n            Shared { led },\n            Local {},\n            init::Monotonics(Monotonic::new(timer, alarm)),\n        )\n    }\n\n    #[task(\n        shared = [led],\n        local = [tog: bool = true],\n    )]\n    fn blink_led(mut c: blink_led::Context) {\n        if *c.local.tog {\n            c.shared.led.lock(|l| l.set_high().unwrap());\n        } else {\n            c.shared.led.lock(|l| l.set_low().unwrap());\n        }\n        *c.local.tog = !*c.local.tog;\n\n        blink_led::spawn_after(500.millis()).unwrap();\n    }\n}\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_spi_sd_card.rs",
    "content": "//! # Pico SD Card Example\n//!\n//! Reads and writes a file from/to the SD Card that is formatted in FAT32.\n//! This example uses the SPI0 device of the Raspberry Pi Pico on the\n//! pins 4,5,6 and 7. If you don't use an external 3.3V power source,\n//! you can connect the +3.3V output on pin 36 to the SD card.\n//!\n//! SD Cards up to 2TB are supported by the `embedded_sdmmc` crate.\n//! I've tested this with a 64GB micro SD card.\n//!\n//! You need to format the card with an regular old FAT32 filesystem\n//! and also make sure the first partition has the right type. This is how your\n//! `fdisk` output should look like:\n//!\n//! ```text\n//!     fdisk /dev/sdj\n//!\n//!     Welcome to fdisk (util-linux 2.34).\n//!     Changes will remain in memory only, until you decide to write them.\n//!     Be careful before using the write command.\n//!\n//!     Command (m for help): Disk /dev/sdj:\n//!     59,49 GiB, 63864569856 bytes, 124735488 sectors\n//!     Disk model: SD/MMC/MS/MSPRO\n//!     Units: sectors of 1 * 512 = 512 bytes\n//!     Sector size (logical/physical): 512 bytes / 512 bytes\n//!     I/O size (minimum/optimal): 512 bytes / 512 bytes\n//!     Disklabel type: dos\n//!     Disk identifier: 0x00000000\n//!\n//!     Device     Boot Start       End   Sectors  Size Id Type\n//!     /dev/sdj1        2048 124735487 124733440 59,5G  c W95 FAT32 (LBA)\n//! ```\n//!\n//! The important bit here is the _Type_ with `W95 FAT32 (LBA)`, other types\n//! are rejected by the `embedded_sdmmc` filesystem implementation.\n//!\n//! Formatting the partition can be done using `mkfs.fat`:\n//!\n//!     $ mkfs.fat /dev/sdj1\n//!\n//! The example can either be used with a probe to receive debug output\n//! and also the LED is used as status output. There are different blinking\n//! patterns.\n//!\n//! For every successful stage in the example the LED will blink long once.\n//! If everything is successful (9 long blink signals), the example will go\n//! into a loop and either blink in a _\"short long\"_ or _\"short short long\"_ pattern.\n//!\n//! If there are 4 different error patterns, all with short blinking pulses:\n//!\n//! - **3 short blink (in a loop)**: Card size could not be retrieved.\n//! - **4 short blink (in a loop)**: Error getting volume/partition 0.\n//! - **5 short blink (in a loop)**: Error opening root directory.\n//! - **6 short blink (in a loop)**: Could not open file 'O.TST'.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// info!() and error!() macros for printing information to the debug output\nuse defmt::*;\nuse defmt_rtt as _;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse rp_pico::hal::prelude::*;\n\n// Embed the `Hz` function/trait:\nuse fugit::RateExtU32;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// Import the SPI abstraction:\nuse rp_pico::hal::spi;\n\n// Import the GPIO abstraction:\nuse rp_pico::hal::gpio;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n// Link in the embedded_sdmmc crate.\n// The `SdMmcSpi` is used for block level access to the card.\n// And the `VolumeManager` gives access to the FAT filesystem functions.\nuse embedded_sdmmc::{SdCard, TimeSource, Timestamp, VolumeIdx, VolumeManager};\n\n// Get the file open mode enum:\nuse embedded_sdmmc::filesystem::Mode;\n\nuse embedded_hal::delay::DelayNs;\nuse rp2040_hal::Timer;\n\n/// A dummy timesource, which is mostly important for creating files.\n#[derive(Default)]\npub struct DummyTimesource();\n\nimpl TimeSource for DummyTimesource {\n    // In theory you could use the RTC of the rp2040 here, if you had\n    // any external time synchronizing device.\n    fn get_timestamp(&self) -> Timestamp {\n        Timestamp {\n            year_since_1970: 0,\n            zero_indexed_month: 0,\n            zero_indexed_day: 0,\n            hours: 0,\n            minutes: 0,\n            seconds: 0,\n        }\n    }\n}\n\n// Setup some blinking codes:\nconst BLINK_OK_LONG: [u8; 1] = [8u8];\nconst BLINK_OK_SHORT_LONG: [u8; 4] = [1u8, 0u8, 6u8, 0u8];\nconst BLINK_OK_SHORT_SHORT_LONG: [u8; 6] = [1u8, 0u8, 1u8, 0u8, 6u8, 0u8];\nconst BLINK_ERR_3_SHORT: [u8; 6] = [1u8, 0u8, 1u8, 0u8, 1u8, 0u8];\nconst BLINK_ERR_4_SHORT: [u8; 8] = [1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0u8];\nconst BLINK_ERR_5_SHORT: [u8; 10] = [1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0u8];\nconst BLINK_ERR_6_SHORT: [u8; 12] = [1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0u8];\n\nfn blink_signals(\n    pin: &mut dyn embedded_hal::digital::OutputPin<Error = core::convert::Infallible>,\n    delay: &mut dyn DelayNs,\n    sig: &[u8],\n) {\n    for bit in sig {\n        if *bit != 0 {\n            pin.set_high().unwrap();\n        } else {\n            pin.set_low().unwrap();\n        }\n\n        let length = if *bit > 0 { *bit } else { 1 };\n\n        for _ in 0..length {\n            delay.delay_ms(100);\n        }\n    }\n\n    pin.set_low().unwrap();\n\n    delay.delay_ms(500);\n}\n\nfn blink_signals_loop(\n    pin: &mut dyn embedded_hal::digital::OutputPin<Error = core::convert::Infallible>,\n    delay: &mut dyn DelayNs,\n    sig: &[u8],\n) -> ! {\n    loop {\n        blink_signals(pin, delay, sig);\n        delay.delay_ms(1000);\n    }\n}\n\n#[entry]\nfn main() -> ! {\n    info!(\"Program start\");\n\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let _core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Set the LED to be an output\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    // Set up our SPI pins into the correct mode\n    let spi_sclk: gpio::Pin<_, gpio::FunctionSpi, gpio::PullNone> = pins.gpio2.reconfigure();\n    let spi_mosi: gpio::Pin<_, gpio::FunctionSpi, gpio::PullNone> = pins.gpio3.reconfigure();\n    let spi_miso: gpio::Pin<_, gpio::FunctionSpi, gpio::PullUp> = pins.gpio4.reconfigure();\n    let spi_cs = pins.gpio5.into_push_pull_output();\n\n    // Create the SPI driver instance for the SPI0 device\n    let spi = spi::Spi::<_, _, _, 8>::new(pac.SPI0, (spi_mosi, spi_miso, spi_sclk));\n\n    // Exchange the uninitialised SPI driver for an initialised one\n    let spi = spi.init(\n        &mut pac.RESETS,\n        clocks.peripheral_clock.freq(),\n        400.kHz(), // card initialization happens at low baud rate\n        embedded_hal::spi::MODE_0,\n    );\n\n    let mut delay = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    info!(\"Initialize SPI SD/MMC data structures...\");\n    let sdcard = SdCard::new(spi, spi_cs, delay);\n    let mut volume_mgr = VolumeManager::new(sdcard, DummyTimesource::default());\n\n    blink_signals(&mut led_pin, &mut delay, &BLINK_OK_LONG);\n\n    info!(\"Init SD card controller and retrieve card size...\");\n    match volume_mgr.device().num_bytes() {\n        Ok(size) => info!(\"card size is {} bytes\", size),\n        Err(e) => {\n            error!(\"Error retrieving card size: {}\", defmt::Debug2Format(&e));\n            blink_signals_loop(&mut led_pin, &mut delay, &BLINK_ERR_3_SHORT);\n        }\n    }\n\n    blink_signals(&mut led_pin, &mut delay, &BLINK_OK_LONG);\n\n    // Now that the card is initialized, clock can go faster\n    volume_mgr\n        .device()\n        .spi(|spi| spi.set_baudrate(clocks.peripheral_clock.freq(), 16.MHz()));\n\n    info!(\"Getting Volume 0...\");\n    let mut volume = match volume_mgr.get_volume(VolumeIdx(0)) {\n        Ok(v) => v,\n        Err(e) => {\n            error!(\"Error getting volume 0: {}\", defmt::Debug2Format(&e));\n            blink_signals_loop(&mut led_pin, &mut delay, &BLINK_ERR_4_SHORT);\n        }\n    };\n\n    blink_signals(&mut led_pin, &mut delay, &BLINK_OK_LONG);\n\n    // After we have the volume (partition) of the drive we got to open the\n    // root directory:\n    let dir = match volume_mgr.open_root_dir(&volume) {\n        Ok(dir) => dir,\n        Err(e) => {\n            error!(\"Error opening root dir: {}\", defmt::Debug2Format(&e));\n            blink_signals_loop(&mut led_pin, &mut delay, &BLINK_ERR_5_SHORT);\n        }\n    };\n\n    info!(\"Root directory opened!\");\n    blink_signals(&mut led_pin, &mut delay, &BLINK_OK_LONG);\n\n    // This shows how to iterate through the directory and how\n    // to get the file names (and print them in hope they are UTF-8 compatible):\n    volume_mgr\n        .iterate_dir(&volume, &dir, |ent| {\n            info!(\n                \"/{}.{}\",\n                core::str::from_utf8(ent.name.base_name()).unwrap(),\n                core::str::from_utf8(ent.name.extension()).unwrap()\n            );\n        })\n        .unwrap();\n\n    blink_signals(&mut led_pin, &mut delay, &BLINK_OK_LONG);\n\n    let mut successful_read = false;\n\n    // Next we going to read a file from the SD card:\n    if let Ok(mut file) = volume_mgr.open_file_in_dir(&mut volume, &dir, \"O.TST\", Mode::ReadOnly) {\n        let mut buf = [0u8; 32];\n        let read_count = volume_mgr.read(&volume, &mut file, &mut buf).unwrap();\n        volume_mgr.close_file(&volume, file).unwrap();\n\n        if read_count >= 2 {\n            info!(\"READ {} bytes: {}\", read_count, buf);\n\n            // If we read what we wrote before the last reset,\n            // we set a flag so that the success blinking at the end\n            // changes it's pattern.\n            if buf[0] == 0x42 && buf[1] == 0x1E {\n                successful_read = true;\n            }\n        }\n    }\n\n    blink_signals(&mut led_pin, &mut delay, &BLINK_OK_LONG);\n\n    match volume_mgr.open_file_in_dir(&mut volume, &dir, \"O.TST\", Mode::ReadWriteCreateOrTruncate) {\n        Ok(mut file) => {\n            volume_mgr\n                .write(&mut volume, &mut file, b\"\\x42\\x1E\")\n                .unwrap();\n            volume_mgr.close_file(&volume, file).unwrap();\n        }\n        Err(e) => {\n            error!(\"Error opening file 'O.TST': {}\", defmt::Debug2Format(&e));\n            blink_signals_loop(&mut led_pin, &mut delay, &BLINK_ERR_6_SHORT);\n        }\n    }\n\n    volume_mgr.free();\n\n    blink_signals(&mut led_pin, &mut delay, &BLINK_OK_LONG);\n\n    if successful_read {\n        info!(\"Successfully read previously written file 'O.TST'\");\n    } else {\n        info!(\"Could not read file, which is ok for the first run.\");\n        info!(\"Reboot the pico!\");\n    }\n\n    loop {\n        if successful_read {\n            blink_signals(&mut led_pin, &mut delay, &BLINK_OK_SHORT_SHORT_LONG);\n        } else {\n            blink_signals(&mut led_pin, &mut delay, &BLINK_OK_SHORT_LONG);\n        }\n\n        delay.delay_ms(1000);\n    }\n}\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_uart_irq_buffer.rs",
    "content": "//! # UART IRQ TX Buffer Example\n//!\n//! This application demonstrates how to use the UART Driver to talk to a\n//! serial connection. In this example, the IRQ owns the UART and you cannot\n//! do any UART access from the main thread. You can, however, write to a\n//! static queue, and have the queue contents transferred to the UART under\n//! interrupt.\n//!\n//! The pinouts are:\n//!\n//! * GPIO 0 - UART TX (out of the RP2040)\n//! * GPIO 1 - UART RX (in to the RP2040)\n//! * GPIO 25 - An LED we can blink (active high)\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n#![allow(static_mut_refs)]\n\n// These are the traits we need from Embedded HAL to treat our hardware\n// objects as generic embedded devices.\nuse embedded_hal::digital::OutputPin;\nuse embedded_hal_nb::serial::Write as UartWrite;\n\n// The writeln! trait.\nuse core::fmt::Write;\n\n// We also need this for the 'Delay' object to work.\nuse rp2040_hal::Clock;\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// Time handling traits\nuse fugit::RateExtU32;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Alias for our HAL crate\nuse rp2040_hal as hal;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse hal::pac;\n\n// Our interrupt macro\nuse pac::interrupt;\n\n// Some short-cuts to useful types\nuse core::cell::RefCell;\nuse critical_section::Mutex;\nuse heapless::spsc::Queue;\n\n/// Import the GPIO pins we use\nuse hal::gpio::bank0::{Gpio0, Gpio1};\n\n// UART related types\nuse hal::uart::{DataBits, StopBits, UartConfig};\n\n/// Alias the type for our UART pins to make things clearer.\ntype UartPins = (\n    hal::gpio::Pin<Gpio0, hal::gpio::FunctionUart, hal::gpio::PullNone>,\n    hal::gpio::Pin<Gpio1, hal::gpio::FunctionUart, hal::gpio::PullNone>,\n);\n\n/// Alias the type for our UART to make things clearer.\ntype Uart = hal::uart::UartPeripheral<hal::uart::Enabled, pac::UART0, UartPins>;\n\n/// This describes the queue we use for outbound UART data\nstruct UartQueue {\n    mutex_cell_queue: Mutex<RefCell<Queue<u8, 64>>>,\n    interrupt: pac::Interrupt,\n}\n\n/// This how we transfer the UART into the Interrupt Handler\nstatic GLOBAL_UART: Mutex<RefCell<Option<Uart>>> = Mutex::new(RefCell::new(None));\n\n/// This is our outbound UART queue. We write to it from the main thread, and\n/// read from it in the UART IRQ.\nstatic UART_TX_QUEUE: UartQueue = UartQueue {\n    mutex_cell_queue: Mutex::new(RefCell::new(Queue::new())),\n    interrupt: hal::pac::Interrupt::UART0_IRQ,\n};\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then writes to the UART in\n/// an infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // Lets us wait for fixed periods of time\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins to their default state\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let uart_pins = (\n        // UART TX (characters sent from RP2040) on pin 1 (GPIO0)\n        pins.gpio0.reconfigure(),\n        // UART RX (characters received by RP2040) on pin 2 (GPIO1)\n        pins.gpio1.reconfigure(),\n    );\n\n    // Make a UART on the given pins\n    let mut uart = hal::uart::UartPeripheral::new(pac.UART0, uart_pins, &mut pac.RESETS)\n        .enable(\n            UartConfig::new(9600.Hz(), DataBits::Eight, None, StopBits::One),\n            clocks.peripheral_clock.freq(),\n        )\n        .unwrap();\n\n    // Tell the UART to raise its interrupt line on the NVIC when the TX FIFO\n    // has space in it.\n    uart.enable_tx_interrupt();\n\n    // Now we give away the entire UART peripheral, via the variable\n    // `GLOBAL_UART`. We can no longer access the UART from this main thread.\n    critical_section::with(|cs| {\n        GLOBAL_UART.borrow(cs).replace(Some(uart));\n    });\n\n    // But we can blink an LED.\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    loop {\n        // Light the LED whilst the main thread is in the transmit routine. It\n        // shouldn't be on very long, but it will be on until we get enough\n        // data /out/ of the queue and over the UART for this remainder of\n        // this string to fit.\n        led_pin.set_high().unwrap();\n        // Note we can only write to &UART_TX_QUEUE, because it's not mutable and\n        // `core::fmt::Write` takes mutable references.\n        writeln!(\n            &UART_TX_QUEUE,\n            \"Hello, this was sent under interrupt! It's quite a \\\n            long message, designed not to fit in either the \\\n            hardware FIFO or the software queue.\"\n        )\n        .unwrap();\n        led_pin.set_low().unwrap();\n        // Wait for a second - the UART TX IRQ will transmit the remainder of\n        // our queue contents in the background.\n        delay.delay_ms(1000);\n    }\n}\n\nimpl UartQueue {\n    /// Try and get some data out of the UART Queue. Returns None if queue empty.\n    fn read_byte(&self) -> Option<u8> {\n        critical_section::with(|cs| {\n            let cell_queue = self.mutex_cell_queue.borrow(cs);\n            let mut queue = cell_queue.borrow_mut();\n            queue.dequeue()\n        })\n    }\n\n    /// Peek at the next byte in the queue without removing it.\n    fn peek_byte(&self) -> Option<u8> {\n        critical_section::with(|cs| {\n            let cell_queue = self.mutex_cell_queue.borrow(cs);\n            let queue = cell_queue.borrow_mut();\n            queue.peek().cloned()\n        })\n    }\n\n    /// Write some data to the queue, spinning until it all fits.\n    fn write_bytes_blocking(&self, data: &[u8]) {\n        // Go through all the bytes we need to write.\n        for byte in data.iter() {\n            // Keep trying until there is space in the queue. But release the\n            // mutex between each attempt, otherwise the IRQ will never run\n            // and we will never have space!\n            let mut written = false;\n            while !written {\n                // Grab the mutex, by turning interrupts off. NOTE: This\n                // doesn't work if you are using Core 1 as we only turn\n                // interrupts off on one core.\n                critical_section::with(|cs| {\n                    // Grab the mutex contents.\n                    let cell_queue = self.mutex_cell_queue.borrow(cs);\n                    // Grab mutable access to the queue. This can't fail\n                    // because there are no interrupts running.\n                    let mut queue = cell_queue.borrow_mut();\n                    // Try and put the byte in the queue.\n                    if queue.enqueue(*byte).is_ok() {\n                        // It worked! We must have had space.\n                        if !pac::NVIC::is_enabled(self.interrupt) {\n                            unsafe {\n                                // Now enable the UART interrupt in the *Nested\n                                // Vectored Interrupt Controller*, which is part\n                                // of the Cortex-M0+ core. If the FIFO has space,\n                                // the interrupt will run as soon as we're out of\n                                // the closure.\n                                pac::NVIC::unmask(self.interrupt);\n                                // We also have to kick the IRQ in case the FIFO\n                                // was already below the threshold level.\n                                pac::NVIC::pend(self.interrupt);\n                            }\n                        }\n                        written = true;\n                    }\n                });\n            }\n        }\n    }\n}\n\nimpl core::fmt::Write for &UartQueue {\n    /// This function allows us to `writeln!` on our global static UART queue.\n    /// Note we have an impl for &UartQueue, because our global static queue\n    /// is not mutable and `core::fmt::Write` takes mutable references.\n    fn write_str(&mut self, data: &str) -> core::fmt::Result {\n        self.write_bytes_blocking(data.as_bytes());\n        Ok(())\n    }\n}\n\n#[interrupt]\nfn UART0_IRQ() {\n    // This variable is special. It gets mangled by the `#[interrupt]` macro\n    // into something that we can access without the `unsafe` keyword. It can\n    // do this because this function cannot be called re-entrantly. We know\n    // this because the function's 'real' name is unknown, and hence it cannot\n    // be called from the main thread. We also know that the NVIC will not\n    // re-entrantly call an interrupt.\n    static mut UART: Option<hal::uart::UartPeripheral<hal::uart::Enabled, pac::UART0, UartPins>> =\n        None;\n\n    // This is one-time lazy initialisation. We steal the variable given to us\n    // via `GLOBAL_UART`.\n    if UART.is_none() {\n        critical_section::with(|cs| {\n            *UART = GLOBAL_UART.borrow(cs).take();\n        });\n    }\n\n    // Check if we have a UART to work with\n    if let Some(uart) = UART {\n        // Check if we have data to transmit\n        while let Some(byte) = UART_TX_QUEUE.peek_byte() {\n            if uart.write(byte).is_ok() {\n                // The UART took it, so pop it off the queue.\n                let _ = UART_TX_QUEUE.read_byte();\n            } else {\n                break;\n            }\n        }\n\n        if UART_TX_QUEUE.peek_byte().is_none() {\n            pac::NVIC::mask(UART_TX_QUEUE.interrupt);\n        }\n    }\n\n    // Set an event to ensure the main thread always wakes up, even if it's in\n    // the process of going to sleep.\n    cortex_m::asm::sev();\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_uart_irq_echo.rs",
    "content": "//! # UART IRQ Echo Example\n//!\n//! This application demonstrates how to use the UART Driver to talk to a serial\n//! connection. In this example, the IRQ owns the UART and you cannot do any UART\n//! access from the main thread.\n//!\n//! The pinouts are:\n//!\n//! * GPIO 0 - UART TX (out of the RP2040)\n//! * GPIO 1 - UART RX (in to the RP2040)\n//! * GPIO 25 - An LED we can blink (active high)\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n#![allow(static_mut_refs)]\n\n// These are the traits we need from Embedded HAL to treat our hardware\n// objects as generic embedded devices.\nuse embedded_hal::digital::OutputPin;\nuse embedded_hal_nb::serial::{Read, Write};\n\n// We also need this for the 'Delay' object to work.\nuse rp2040_hal::Clock;\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// Time handling traits\nuse fugit::RateExtU32;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Alias for our HAL crate\nuse rp2040_hal as hal;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse hal::pac;\n\n// Our interrupt macro\nuse hal::pac::interrupt;\n\n// Some short-cuts to useful types\nuse core::cell::RefCell;\nuse critical_section::Mutex;\n\n/// Import the GPIO pins we use\nuse hal::gpio::bank0::{Gpio0, Gpio1};\n\n// UART related types\nuse hal::uart::{DataBits, StopBits, UartConfig};\n\n/// Alias the type for our UART pins to make things clearer.\ntype UartPins = (\n    hal::gpio::Pin<Gpio0, hal::gpio::FunctionUart, hal::gpio::PullNone>,\n    hal::gpio::Pin<Gpio1, hal::gpio::FunctionUart, hal::gpio::PullNone>,\n);\n\n/// Alias the type for our UART to make things clearer.\ntype Uart = hal::uart::UartPeripheral<hal::uart::Enabled, pac::UART0, UartPins>;\n\n/// This how we transfer the UART into the Interrupt Handler\nstatic GLOBAL_UART: Mutex<RefCell<Option<Uart>>> = Mutex::new(RefCell::new(None));\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then writes to the UART in\n/// an infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // Lets us wait for fixed periods of time\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins to their default state\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let uart_pins = (\n        // UART TX (characters sent from RP2040) on pin 1 (GPIO0)\n        pins.gpio0.reconfigure(),\n        // UART RX (characters received by RP2040) on pin 2 (GPIO1)\n        pins.gpio1.reconfigure(),\n    );\n\n    // Make a UART on the given pins\n    let mut uart = hal::uart::UartPeripheral::new(pac.UART0, uart_pins, &mut pac.RESETS)\n        .enable(\n            UartConfig::new(9600.Hz(), DataBits::Eight, None, StopBits::One),\n            clocks.peripheral_clock.freq(),\n        )\n        .unwrap();\n\n    unsafe {\n        // Enable the UART interrupt in the *Nested Vectored Interrupt\n        // Controller*, which is part of the Cortex-M0+ core.\n        pac::NVIC::unmask(hal::pac::Interrupt::UART0_IRQ);\n    }\n\n    // Tell the UART to raise its interrupt line on the NVIC when the RX FIFO\n    // has data in it.\n    uart.enable_rx_interrupt();\n\n    // Write something to the UART on start-up so we can check the output pin\n    // is wired correctly.\n    uart.write_full_blocking(b\"uart_interrupt example started...\\n\");\n\n    // Now we give away the entire UART peripheral, via the variable\n    // `GLOBAL_UART`. We can no longer access the UART from this main thread.\n    critical_section::with(|cs| {\n        GLOBAL_UART.borrow(cs).replace(Some(uart));\n    });\n\n    // But we can blink an LED.\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    loop {\n        // The normal *Wait For Interrupts* (WFI) has a race-hazard - the\n        // interrupt could occur between the CPU checking for interrupts and\n        // the CPU going to sleep. We wait for events (and interrupts), and\n        // then we set an event in every interrupt handler. This ensures we\n        // always wake up correctly.\n        cortex_m::asm::wfe();\n        // Light the LED to indicate we saw an interrupt.\n        led_pin.set_high().unwrap();\n        delay.delay_ms(100);\n        led_pin.set_low().unwrap();\n    }\n}\n\n#[interrupt]\nfn UART0_IRQ() {\n    // This variable is special. It gets mangled by the `#[interrupt]` macro\n    // into something that we can access without the `unsafe` keyword. It can\n    // do this because this function cannot be called re-entrantly. We know\n    // this because the function's 'real' name is unknown, and hence it cannot\n    // be called from the main thread. We also know that the NVIC will not\n    // re-entrantly call an interrupt.\n    static mut UART: Option<hal::uart::UartPeripheral<hal::uart::Enabled, pac::UART0, UartPins>> =\n        None;\n\n    // This is one-time lazy initialisation. We steal the variable given to us\n    // via `GLOBAL_UART`.\n    if UART.is_none() {\n        critical_section::with(|cs| {\n            *UART = GLOBAL_UART.borrow(cs).take();\n        });\n    }\n\n    // Check if we have a UART to work with\n    if let Some(uart) = UART {\n        // Echo the input back to the output until the FIFO is empty. Reading\n        // from the UART should also clear the UART interrupt flag.\n        while let Ok(byte) = uart.read() {\n            let _ = uart.write(byte);\n        }\n    }\n\n    // Set an event to ensure the main thread always wakes up, even if it's in\n    // the process of going to sleep.\n    cortex_m::asm::sev();\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_usb_serial.rs",
    "content": "//! # Pico USB Serial Example\n//!\n//! Creates a USB Serial device on a Pico board, with the USB driver running in\n//! the main thread.\n//!\n//! This will create a USB Serial device echoing anything it receives. Incoming\n//! ASCII characters are converted to upercase, so you can tell it is working\n//! and not just local-echo!\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n// USB Device support\nuse usb_device::{class_prelude::*, prelude::*};\n\n// USB Communications Class Device support\nuse usbd_serial::SerialPort;\n\n// Used to demonstrate writing formatted strings\nuse core::fmt::Write;\nuse heapless::String;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then echoes any characters\n/// received over USB Serial.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    #[cfg(feature = \"rp2040-e5\")]\n    {\n        let sio = hal::Sio::new(pac.SIO);\n        let _pins = rp_pico::Pins::new(\n            pac.IO_BANK0,\n            pac.PADS_BANK0,\n            sio.gpio_bank0,\n            &mut pac.RESETS,\n        );\n    }\n\n    // Set up the USB driver\n    let usb_bus = UsbBusAllocator::new(hal::usb::UsbBus::new(\n        pac.USBCTRL_REGS,\n        pac.USBCTRL_DPRAM,\n        clocks.usb_clock,\n        true,\n        &mut pac.RESETS,\n    ));\n\n    // Set up the USB Communications Class Device driver\n    let mut serial = SerialPort::new(&usb_bus);\n\n    // Create a USB device with a fake VID and PID\n    let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))\n        .strings(&[StringDescriptors::default()\n            .manufacturer(\"Fake company\")\n            .product(\"Serial port\")\n            .serial_number(\"TEST\")])\n        .unwrap()\n        .device_class(2) // from: https://www.usb.org/defined-class-codes\n        .build();\n\n    let mut said_hello = false;\n    loop {\n        // A welcome message at the beginning\n        if !said_hello && timer.get_counter().ticks() >= 2_000_000 {\n            said_hello = true;\n            let _ = serial.write(b\"Hello, World!\\r\\n\");\n\n            let time = timer.get_counter().ticks();\n            let mut text: String<64> = String::new();\n            writeln!(&mut text, \"Current timer ticks: {}\", time).unwrap();\n\n            // This only works reliably because the number of bytes written to\n            // the serial port is smaller than the buffers available to the USB\n            // peripheral. In general, the return value should be handled, so that\n            // bytes not transferred yet don't get lost.\n            let _ = serial.write(text.as_bytes());\n        }\n\n        // Check for new data\n        if usb_dev.poll(&mut [&mut serial]) {\n            let mut buf = [0u8; 64];\n            match serial.read(&mut buf) {\n                Err(_e) => {\n                    // Do nothing\n                }\n                Ok(0) => {\n                    // Do nothing\n                }\n                Ok(count) => {\n                    // Convert to upper case\n                    buf.iter_mut().take(count).for_each(|b| {\n                        b.make_ascii_uppercase();\n                    });\n                    // Send back to the host\n                    let mut wr_ptr = &buf[..count];\n                    while !wr_ptr.is_empty() {\n                        match serial.write(wr_ptr) {\n                            Ok(len) => wr_ptr = &wr_ptr[len..],\n                            // On error, just drop unwritten data.\n                            // One possible error is Err(WouldBlock), meaning the USB\n                            // write buffer is full.\n                            Err(_) => break,\n                        };\n                    }\n                }\n            }\n        }\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_usb_serial_interrupt.rs",
    "content": "//! # Pico USB Serial (with Interrupts) Example\n//!\n//! Creates a USB Serial device on a Pico board, with the USB driver running in\n//! the USB interrupt.\n//!\n//! This will create a USB Serial device echoing anything it receives. Incoming\n//! ASCII characters are converted to upercase, so you can tell it is working\n//! and not just local-echo!\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n#![allow(static_mut_refs)]\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// The macro for marking our interrupt functions\nuse rp_pico::hal::pac::interrupt;\n\n// GPIO traits\nuse embedded_hal::digital::OutputPin;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse rp_pico::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n// USB Device support\nuse usb_device::{class_prelude::*, prelude::*};\n\n// USB Communications Class Device support\nuse usbd_serial::SerialPort;\n\n/// The USB Device Driver (shared with the interrupt).\nstatic mut USB_DEVICE: Option<UsbDevice<hal::usb::UsbBus>> = None;\n\n/// The USB Bus Driver (shared with the interrupt).\nstatic mut USB_BUS: Option<UsbBusAllocator<hal::usb::UsbBus>> = None;\n\n/// The USB Serial Device Driver (shared with the interrupt).\nstatic mut USB_SERIAL: Option<SerialPort<hal::usb::UsbBus>> = None;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then blinks the LED in an\n/// infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // Set up the USB driver\n    let usb_bus = UsbBusAllocator::new(hal::usb::UsbBus::new(\n        pac.USBCTRL_REGS,\n        pac.USBCTRL_DPRAM,\n        clocks.usb_clock,\n        true,\n        &mut pac.RESETS,\n    ));\n    unsafe {\n        // Note (safety): This is safe as interrupts haven't been started yet\n        USB_BUS = Some(usb_bus);\n    }\n\n    // Grab a reference to the USB Bus allocator. We are promising to the\n    // compiler not to take mutable access to this global variable whilst this\n    // reference exists!\n    let bus_ref = unsafe { USB_BUS.as_ref().unwrap() };\n\n    // Set up the USB Communications Class Device driver\n    let serial = SerialPort::new(bus_ref);\n    unsafe {\n        USB_SERIAL = Some(serial);\n    }\n\n    // Create a USB device with a fake VID and PID\n    let usb_dev = UsbDeviceBuilder::new(bus_ref, UsbVidPid(0x16c0, 0x27dd))\n        .strings(&[StringDescriptors::default()\n            .manufacturer(\"Fake company\")\n            .product(\"Serial port\")\n            .serial_number(\"TEST\")])\n        .unwrap()\n        .device_class(2) // from: https://www.usb.org/defined-class-codes\n        .build();\n    unsafe {\n        // Note (safety): This is safe as interrupts haven't been started yet\n        USB_DEVICE = Some(usb_dev);\n    }\n\n    // Enable the USB interrupt\n    unsafe {\n        pac::NVIC::unmask(hal::pac::Interrupt::USBCTRL_IRQ);\n    };\n\n    // No more USB code after this point in main! We can do anything we want in\n    // here since USB is handled in the interrupt - let's blink an LED!\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Set the LED to be an output\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    // Blink the LED at 1 Hz\n    loop {\n        led_pin.set_high().unwrap();\n        delay.delay_ms(500);\n        led_pin.set_low().unwrap();\n        delay.delay_ms(500);\n    }\n}\n\n/// This function is called whenever the USB Hardware generates an Interrupt\n/// Request.\n///\n/// We do all our USB work under interrupt, so the main thread can continue on\n/// knowing nothing about USB.\n#[allow(non_snake_case)]\n#[interrupt]\nunsafe fn USBCTRL_IRQ() {\n    use core::sync::atomic::{AtomicBool, Ordering};\n\n    /// Note whether we've already printed the \"hello\" message.\n    static SAID_HELLO: AtomicBool = AtomicBool::new(false);\n\n    // Grab the global objects. This is OK as we only access them under interrupt.\n    let usb_dev = USB_DEVICE.as_mut().unwrap();\n    let serial = USB_SERIAL.as_mut().unwrap();\n\n    // Say hello exactly once on start-up\n    if !SAID_HELLO.load(Ordering::Relaxed) {\n        SAID_HELLO.store(true, Ordering::Relaxed);\n        let _ = serial.write(b\"Hello, World!\\r\\n\");\n    }\n\n    // Poll the USB driver with all of our supported USB Classes\n    if usb_dev.poll(&mut [serial]) {\n        let mut buf = [0u8; 64];\n        match serial.read(&mut buf) {\n            Err(_e) => {\n                // Do nothing\n            }\n            Ok(0) => {\n                // Do nothing\n            }\n            Ok(count) => {\n                // Convert to upper case\n                buf.iter_mut().take(count).for_each(|b| {\n                    b.make_ascii_uppercase();\n                });\n\n                // Send back to the host\n                let mut wr_ptr = &buf[..count];\n                while !wr_ptr.is_empty() {\n                    let _ = serial.write(wr_ptr).map(|len| {\n                        wr_ptr = &wr_ptr[len..];\n                    });\n                }\n            }\n        }\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_usb_twitchy_mouse.rs",
    "content": "//! # Pico USB 'Twitchy' Mouse Example\n//!\n//! Creates a USB HID Class Pointing device (i.e. a virtual mouse) on a Pico\n//! board, with the USB driver running in the main thread.\n//!\n//! It generates movement reports which will twitch the cursor up and down by a\n//! few pixels, several times a second.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n//!\n//! This is a port of\n//! https://github.com/atsamd-rs/atsamd/blob/master/boards/itsybitsy_m0/examples/twitching_usb_mouse.rs\n\n#![no_std]\n#![no_main]\n#![allow(static_mut_refs)]\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// The macro for marking our interrupt functions\nuse rp_pico::hal::pac::interrupt;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse rp_pico::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n// USB Device support\nuse usb_device::{class_prelude::*, prelude::*};\n\n// USB Human Interface Device (HID) Class support\nuse usbd_hid::descriptor::generator_prelude::*;\nuse usbd_hid::descriptor::MouseReport;\nuse usbd_hid::hid_class::HIDClass;\n\n/// The USB Device Driver (shared with the interrupt).\nstatic mut USB_DEVICE: Option<UsbDevice<hal::usb::UsbBus>> = None;\n\n/// The USB Bus Driver (shared with the interrupt).\nstatic mut USB_BUS: Option<UsbBusAllocator<hal::usb::UsbBus>> = None;\n\n/// The USB Human Interface Device Driver (shared with the interrupt).\nstatic mut USB_HID: Option<HIDClass<hal::usb::UsbBus>> = None;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then submits cursor movement\n/// updates periodically.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    #[cfg(feature = \"rp2040-e5\")]\n    {\n        let sio = hal::Sio::new(pac.SIO);\n        let _pins = rp_pico::Pins::new(\n            pac.IO_BANK0,\n            pac.PADS_BANK0,\n            sio.gpio_bank0,\n            &mut pac.RESETS,\n        );\n    }\n\n    // Set up the USB driver\n    let usb_bus = UsbBusAllocator::new(hal::usb::UsbBus::new(\n        pac.USBCTRL_REGS,\n        pac.USBCTRL_DPRAM,\n        clocks.usb_clock,\n        true,\n        &mut pac.RESETS,\n    ));\n    unsafe {\n        // Note (safety): This is safe as interrupts haven't been started yet\n        USB_BUS = Some(usb_bus);\n    }\n\n    // Grab a reference to the USB Bus allocator. We are promising to the\n    // compiler not to take mutable access to this global variable whilst this\n    // reference exists!\n    let bus_ref = unsafe { USB_BUS.as_ref().unwrap() };\n\n    // Set up the USB HID Class Device driver, providing Mouse Reports\n    let usb_hid = HIDClass::new(bus_ref, MouseReport::desc(), 60);\n    unsafe {\n        // Note (safety): This is safe as interrupts haven't been started yet.\n        USB_HID = Some(usb_hid);\n    }\n\n    // Create a USB device with a fake VID and PID\n    let usb_dev = UsbDeviceBuilder::new(bus_ref, UsbVidPid(0x16c0, 0x27da))\n        .strings(&[StringDescriptors::default()\n            .manufacturer(\"Fake company\")\n            .product(\"Twitchy Mousey\")\n            .serial_number(\"TEST\")])\n        .unwrap()\n        .device_class(0)\n        .build();\n    unsafe {\n        // Note (safety): This is safe as interrupts haven't been started yet\n        USB_DEVICE = Some(usb_dev);\n    }\n\n    unsafe {\n        // Enable the USB interrupt\n        pac::NVIC::unmask(hal::pac::Interrupt::USBCTRL_IRQ);\n    };\n    let core = pac::CorePeripherals::take().unwrap();\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // Move the cursor up and down every 200ms\n    loop {\n        delay.delay_ms(100);\n\n        let rep_up = MouseReport {\n            x: 0,\n            y: 4,\n            buttons: 0,\n            wheel: 0,\n            pan: 0,\n        };\n        push_mouse_movement(rep_up).ok().unwrap_or(0);\n\n        delay.delay_ms(100);\n\n        let rep_down = MouseReport {\n            x: 0,\n            y: -4,\n            buttons: 0,\n            wheel: 0,\n            pan: 0,\n        };\n        push_mouse_movement(rep_down).ok().unwrap_or(0);\n    }\n}\n\n/// Submit a new mouse movement report to the USB stack.\n///\n/// We do this with interrupts disabled, to avoid a race hazard with the USB IRQ.\nfn push_mouse_movement(report: MouseReport) -> Result<usize, usb_device::UsbError> {\n    critical_section::with(|_| unsafe {\n        // Now interrupts are disabled, grab the global variable and, if\n        // available, send it a HID report\n        USB_HID.as_mut().map(|hid| hid.push_input(&report))\n    })\n    .unwrap()\n}\n\n/// This function is called whenever the USB Hardware generates an Interrupt\n/// Request.\n#[allow(non_snake_case)]\n#[interrupt]\nunsafe fn USBCTRL_IRQ() {\n    // Handle USB request\n    let usb_dev = USB_DEVICE.as_mut().unwrap();\n    let usb_hid = USB_HID.as_mut().unwrap();\n    usb_dev.poll(&mut [usb_hid]);\n}\n\n// End of file\n"
  },
  {
    "path": "boards/rp-pico/examples/pico_ws2812_led.rs",
    "content": "//! # Pico WS2812 RGB LED Example\n//!\n//! Drives 3 WS2812 LEDs connected directly to the Raspberry Pi Pico.\n//! This assumes you drive the Raspberry Pi Pico via USB power, so that VBUS\n//! delivers the 5V and at least enough amperes to drive the LEDs.\n//!\n//! For a more large scale and longer strips you should use an extra power\n//! supply for the LED strip (or know what you are doing ;-) ).\n//!\n//! The example also comes with an utility function to calculate the colors\n//! from HSV color space. It also limits the brightness a bit to save a\n//! few milliamperes - be careful if you increase the strip length you will\n//! quickly get into power consumption of multiple amperes.\n//!\n//! The example assumes you connected the data input to pin 6 of the\n//! Raspberry Pi Pico, which is GPIO4 of the rp2040. Here is a circuit\n//! diagram that shows the assumed setup:\n//!\n//! ```text\n//!  _______________      /----------------------\\\n//! |+5V  /---\\  +5V|----/         _|USB|_       |\n//! |DO <-|LED|<- DI|-\\           |1  R 40|-VBUS-/\n//! |GND  \\---/  GND|--+---\\      |2  P 39|\n//!  \"\"\"\"\"\"\"\"\"\"\"\"\"\"\"   |    \\-GND-|3    38|\n//!                    |          |4  P 37|\n//!                    |          |5  I 36|\n//!                    \\------GP4-|6  C   |\n//!                               |7  O   |\n//!                               |       |\n//!                               .........\n//!                               |20   21|\n//!                                \"\"\"\"\"\"\"\n//! Symbols:\n//!     - (+) crossing lines, not connected\n//!     - (o) connected lines\n//! ```\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse rp_pico::entry;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse rp_pico::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse rp_pico::hal::pac;\n\n// Import the Timer for Ws2812:\nuse rp_pico::hal::timer::Timer;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse rp_pico::hal;\n\n// PIOExt for the split() method that is needed to bring\n// PIO0 into useable form for Ws2812:\nuse rp_pico::hal::pio::PIOExt;\n\n// Import useful traits to handle the ws2812 LEDs:\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\n\n// Import the actual crate to handle the Ws2812 protocol:\nuse ws2812_pio::Ws2812;\n\n// Currently 3 consecutive LEDs are driven by this example\n// to keep the power draw compatible with USB:\nconst STRIP_LEN: usize = 3;\n\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        rp_pico::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = rp_pico::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Setup a delay for the LED blink signals:\n    let mut frame_delay =\n        cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // Import the `sin` function for a smooth hue animation from the\n    // Pico rp2040 ROM:\n    let sin = hal::rom_data::float_funcs::fsin::ptr();\n\n    // Create a count down timer for the Ws2812 instance:\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Split the PIO state machine 0 into individual objects, so that\n    // Ws2812 can use it:\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n\n    // Instanciate a Ws2812 LED strip:\n    let mut ws = Ws2812::new(\n        // Use pin 6 on the Raspberry Pi Pico (which is GPIO4 of the rp2040 chip)\n        // for the LED data output:\n        pins.gpio4.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    let mut leds: [RGB8; STRIP_LEN] = [(0, 0, 0).into(); STRIP_LEN];\n    let mut t = 0.0;\n\n    // Bring down the overall brightness of the strip to not blow\n    // the USB power supply: every LED draws ~60mA, RGB means 3 LEDs per\n    // ws2812 LED, for 3 LEDs that would be: 3 * 3 * 60mA, which is\n    // already 540mA for just 3 white LEDs!\n    let strip_brightness = 64u8; // Limit brightness to 64/256\n\n    // Slow down timer by this factor (0.1 will result in 10 seconds):\n    let animation_speed = 0.1;\n\n    loop {\n        for (i, led) in leds.iter_mut().enumerate() {\n            // An offset to give 3 consecutive LEDs a different color:\n            let hue_offs = match i % 3 {\n                1 => 0.25,\n                2 => 0.5,\n                _ => 0.0,\n            };\n\n            let sin_11 = sin((t + hue_offs) * 2.0 * core::f32::consts::PI);\n            // Bring -1..1 sine range to 0..1 range:\n            let sin_01 = (sin_11 + 1.0) * 0.5;\n\n            let hue = 360.0 * sin_01;\n            let sat = 1.0;\n            let val = 1.0;\n\n            let rgb = hsv2rgb_u8(hue, sat, val);\n            *led = rgb.into();\n        }\n\n        // Here the magic happens and the `leds` buffer is written to the\n        // ws2812 LEDs:\n        ws.write(brightness(leds.iter().copied(), strip_brightness))\n            .unwrap();\n\n        // Wait a bit until calculating the next frame:\n        frame_delay.delay_ms(16); // ~60 FPS\n\n        // Increase the time counter variable and make sure it\n        // stays inbetween 0.0 to 1.0 range:\n        t += (16.0 / 1000.0) * animation_speed;\n        while t > 1.0 {\n            t -= 1.0;\n        }\n    }\n}\n\npub fn hsv2rgb(hue: f32, sat: f32, val: f32) -> (f32, f32, f32) {\n    let c = val * sat;\n    let v = (hue / 60.0) % 2.0 - 1.0;\n    let v = if v < 0.0 { -v } else { v };\n    let x = c * (1.0 - v);\n    let m = val - c;\n    let (r, g, b) = if hue < 60.0 {\n        (c, x, 0.0)\n    } else if hue < 120.0 {\n        (x, c, 0.0)\n    } else if hue < 180.0 {\n        (0.0, c, x)\n    } else if hue < 240.0 {\n        (0.0, x, c)\n    } else if hue < 300.0 {\n        (x, 0.0, c)\n    } else {\n        (c, 0.0, x)\n    };\n    (r + m, g + m, b + m)\n}\n\npub fn hsv2rgb_u8(h: f32, s: f32, v: f32) -> (u8, u8, u8) {\n    let r = hsv2rgb(h, s, v);\n\n    (\n        (r.0 * 255.0) as u8,\n        (r.1 * 255.0) as u8,\n        (r.2 * 255.0) as u8,\n    )\n}\n"
  },
  {
    "path": "boards/rp-pico/examples/pwm.pio",
    "content": ";\n; Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n;\n; SPDX-License-Identifier: BSD-3-Clause\n;\n\n; Side-set pin 0 is used for PWM output\n\n.program pwm\n.side_set 1 opt\n\n    pull noblock    side 0 ; Pull from FIFO to OSR if available, else copy X to OSR.\n    mov x, osr             ; Copy most-recently-pulled value back to scratch X\n    mov y, isr             ; ISR contains PWM period. Y used as counter.\ncountloop:\n    jmp x!=y noset         ; Set pin high if X == Y, keep the two paths length matched\n    jmp skip        side 1\nnoset:\n    nop                    ; Single dummy cycle to keep the two paths the same length\nskip:\n    jmp y-- countloop      ; Loop until Y hits 0, then pull a fresh PWM value from FIFO\n\n% c-sdk {\nstatic inline void pwm_program_init(PIO pio, uint sm, uint offset, uint pin) {\n   pio_gpio_init(pio, pin);\n   pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true);\n   pio_sm_config c = pwm_program_get_default_config(offset);\n   sm_config_set_sideset_pins(&c, pin);\n   pio_sm_init(pio, sm, offset, &c);\n}\n%}"
  },
  {
    "path": "boards/rp-pico/src/lib.rs",
    "content": "#![no_std]\n\n//! A Hardware Abstraction Layer for the Raspberry Pi Pico.\n//!\n//! This crate serves as a HAL (Hardware Abstraction Layer) for the Raspberry Pi Pico. Since the Raspberry Pi Pico\n//! is based on the RP2040 chip, it re-exports the [rp2040_hal] crate which contains the tooling to work with the\n//! rp2040 chip.\n//!\n//! # Examples:\n//!\n//! The following example turns on the onboard LED. Note that most of the logic works through the [rp2040_hal] crate.\n//! ```ignore\n//! #![no_main]\n//! use rp_pico::entry;\n//! use panic_halt as _;\n//! use embedded_hal::digital::v2::OutputPin;\n//! use rp_pico::hal::pac;\n//! use rp_pico::hal;\n\n//! #[entry]\n//! fn does_not_have_to_be_main() -> ! {\n//!   let mut pac = pac::Peripherals::take().unwrap();\n//!   let sio = hal::Sio::new(pac.SIO);\n//!   let pins = rp_pico::Pins::new(\n//!        pac.IO_BANK0,\n//!        pac.PADS_BANK0,\n//!        sio.gpio_bank0,\n//!        &mut pac.RESETS,\n//!   );\n//!   let mut led_pin = pins.led.into_push_pull_output();\n//!   led_pin.set_high().unwrap();\n//!   loop {\n//!   }\n//! }\n//! ```\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n\n/// The `entry` macro declares the starting function to the linker.\n/// This is similar to the `main` function in console applications.\n///\n/// It is based on the [cortex_m_rt](https://docs.rs/cortex-m-rt/latest/cortex_m_rt/attr.entry.html) crate.\n///\n/// # Examples\n/// ```ignore\n/// #![no_std]\n/// #![no_main]\n/// use rp_pico::entry;\n/// #[entry]\n/// fn you_can_use_a_custom_main_name_here() -> ! {\n///   loop {}\n/// }\n/// ```\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp0Spi0Rx]          |\n    /// | `UART0 TX`   | [crate::Gp0Uart0Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp0I2C0Sda]         |\n    /// | `PWM0 A`     | [crate::Gp0Pwm0A]           |\n    /// | `PIO0`       | [crate::Gp0Pio0]            |\n    /// | `PIO1`       | [crate::Gp0Pio1]            |\n    Gpio0 {\n        name: gpio0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio0].\n            FunctionUart, PullNone: Gp0Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio0].\n            FunctionSpi, PullNone: Gp0Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio0].\n            FunctionI2C, PullUp: Gp0I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio0].\n            FunctionPwm, PullNone: Gp0Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio0, PullNone: Gp0Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio1, PullNone: Gp0Pio1\n        }\n    },\n\n    /// GPIO 1 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp1Spi0Csn]         |\n    /// | `UART0 RX`   | [crate::Gp1Uart0Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp1I2C0Scl]         |\n    /// | `PWM0 B`     | [crate::Gp1Pwm0B]           |\n    /// | `PIO0`       | [crate::Gp1Pio0]            |\n    /// | `PIO1`       | [crate::Gp1Pio1]            |\n    Gpio1 {\n        name: gpio1,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio1].\n            FunctionUart, PullNone: Gp1Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio1].\n            FunctionSpi, PullNone: Gp1Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio1].\n            FunctionI2C, PullUp: Gp1I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio1].\n            FunctionPwm, PullNone: Gp1Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio0, PullNone: Gp1Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio1, PullNone: Gp1Pio1\n        }\n    },\n\n    /// GPIO 2 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp2Spi0Sck]         |\n    /// | `UART0 CTS`  | [crate::Gp2Uart0Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp2I2C1Sda]         |\n    /// | `PWM1 A`     | [crate::Gp2Pwm1A]           |\n    /// | `PIO0`       | [crate::Gp2Pio0]            |\n    /// | `PIO1`       | [crate::Gp2Pio1]            |\n    Gpio2 {\n        name: gpio2,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio2].\n            FunctionUart, PullNone: Gp2Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio2].\n            FunctionSpi, PullNone: Gp2Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio2].\n            FunctionI2C, PullUp: Gp2I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio2].\n            FunctionPwm, PullNone: Gp2Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio0, PullNone: Gp2Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio1, PullNone: Gp2Pio1\n        }\n    },\n\n    /// GPIO 3 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp3Spi0Tx]          |\n    /// | `UART0 RTS`  | [crate::Gp3Uart0Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp3I2C1Scl]         |\n    /// | `PWM1 B`     | [crate::Gp3Pwm1B]           |\n    /// | `PIO0`       | [crate::Gp3Pio0]            |\n    /// | `PIO1`       | [crate::Gp3Pio1]            |\n    Gpio3 {\n        name: gpio3,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio3].\n            FunctionUart, PullNone: Gp3Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio3].\n            FunctionSpi, PullNone: Gp3Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio3].\n            FunctionI2C, PullUp: Gp3I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio3].\n            FunctionPwm, PullNone: Gp3Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio0, PullNone: Gp3Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio1, PullNone: Gp3Pio1\n        }\n    },\n\n    /// GPIO 4 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp4Spi0Rx]          |\n    /// | `UART1 TX`   | [crate::Gp4Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp4I2C0Sda]         |\n    /// | `PWM2 A`     | [crate::Gp4Pwm2A]           |\n    /// | `PIO0`       | [crate::Gp4Pio0]            |\n    /// | `PIO1`       | [crate::Gp4Pio1]            |\n    Gpio4 {\n        name: gpio4,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio4].\n            FunctionUart, PullNone: Gp4Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio4].\n            FunctionSpi, PullNone: Gp4Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio4].\n            FunctionI2C, PullUp: Gp4I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio4].\n            FunctionPwm, PullNone: Gp4Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio0, PullNone: Gp4Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio1, PullNone: Gp4Pio1\n        }\n    },\n\n    /// GPIO 5 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp5Spi0Csn]         |\n    /// | `UART1 RX`   | [crate::Gp5Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp5I2C0Scl]         |\n    /// | `PWM2 B`     | [crate::Gp5Pwm2B]           |\n    /// | `PIO0`       | [crate::Gp5Pio0]            |\n    /// | `PIO1`       | [crate::Gp5Pio1]            |\n    Gpio5 {\n        name: gpio5,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio5].\n            FunctionUart, PullNone: Gp5Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio5].\n            FunctionSpi, PullNone: Gp5Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio5].\n            FunctionI2C, PullUp: Gp5I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio5].\n            FunctionPwm, PullNone: Gp5Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio0, PullNone: Gp5Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio1, PullNone: Gp5Pio1\n        }\n    },\n\n    /// GPIO 6 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp6Spi0Sck]         |\n    /// | `UART1 CTS`  | [crate::Gp6Uart1Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp6I2C1Sda]         |\n    /// | `PWM3 A`     | [crate::Gp6Pwm3A]           |\n    /// | `PIO0`       | [crate::Gp6Pio0]            |\n    /// | `PIO1`       | [crate::Gp6Pio1]            |\n    Gpio6 {\n        name: gpio6,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio6].\n            FunctionUart, PullNone: Gp6Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio6].\n            FunctionSpi, PullNone: Gp6Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio6].\n            FunctionI2C, PullUp: Gp6I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio6].\n            FunctionPwm, PullNone: Gp6Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio0, PullNone: Gp6Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio1, PullNone: Gp6Pio1\n        }\n    },\n\n    /// GPIO 7 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp7Spi0Tx]          |\n    /// | `UART1 RTS`  | [crate::Gp7Uart1Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp7I2C1Scl]         |\n    /// | `PWM3 B`     | [crate::Gp7Pwm3B]           |\n    /// | `PIO0`       | [crate::Gp7Pio0]            |\n    /// | `PIO1`       | [crate::Gp7Pio1]            |\n    Gpio7 {\n        name: gpio7,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio7].\n            FunctionUart, PullNone: Gp7Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio7].\n            FunctionSpi, PullNone: Gp7Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio7].\n            FunctionI2C, PullUp: Gp7I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio7].\n            FunctionPwm, PullNone: Gp7Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio0, PullNone: Gp7Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio1, PullNone: Gp7Pio1\n        }\n    },\n\n    /// GPIO 8 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp8Spi1Rx]          |\n    /// | `UART1 TX`   | [crate::Gp8Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp8I2C0Sda]         |\n    /// | `PWM4 A`     | [crate::Gp8Pwm4A]           |\n    /// | `PIO0`       | [crate::Gp8Pio0]            |\n    /// | `PIO1`       | [crate::Gp8Pio1]            |\n    Gpio8 {\n        name: gpio8,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio8].\n            FunctionUart, PullNone: Gp8Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio8].\n            FunctionSpi, PullNone: Gp8Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio8].\n            FunctionI2C, PullUp: Gp8I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio8].\n            FunctionPwm, PullNone: Gp8Pwm4A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio0, PullNone: Gp8Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio1, PullNone: Gp8Pio1\n        }\n    },\n\n    /// GPIO 9 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp9Spi1Csn]         |\n    /// | `UART1 RX`   | [crate::Gp9Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp9I2C0Scl]         |\n    /// | `PWM4 B`     | [crate::Gp9Pwm4B]           |\n    /// | `PIO0`       | [crate::Gp9Pio0]            |\n    /// | `PIO1`       | [crate::Gp9Pio1]            |\n    Gpio9 {\n        name: gpio9,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio9].\n            FunctionUart, PullNone: Gp9Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio9].\n            FunctionSpi, PullNone: Gp9Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio9].\n            FunctionI2C, PullUp: Gp9I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio9].\n            FunctionPwm, PullNone: Gp9Pwm4B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio0, PullNone: Gp9Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio1, PullNone: Gp9Pio1\n        }\n    },\n\n    /// GPIO 10 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp10Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp10Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp10I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp10Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp10Pio0]           |\n    /// | `PIO1`       | [crate::Gp10Pio1]           |\n    Gpio10 {\n        name: gpio10,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio10].\n            FunctionUart, PullNone: Gp10Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio10].\n            FunctionSpi, PullNone: Gp10Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio10].\n            FunctionI2C, PullUp: Gp10I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio10].\n            FunctionPwm, PullNone: Gp10Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio10].\n            FunctionPio0, PullNone: Gp10Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio10].\n            FunctionPio1, PullNone: Gp10Pio1\n        }\n    },\n\n    /// GPIO 11 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp11Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp11Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp11I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp11Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp11Pio0]           |\n    /// | `PIO1`       | [crate::Gp11Pio1]           |\n    Gpio11 {\n        name: gpio11,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio11].\n            FunctionUart, PullNone: Gp11Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio11].\n            FunctionSpi, PullNone: Gp11Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio11].\n            FunctionI2C, PullUp: Gp11I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio11].\n            FunctionPwm, PullNone: Gp11Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio11].\n            FunctionPio0, PullNone: Gp11Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio11].\n            FunctionPio1, PullNone: Gp11Pio1\n        }\n    },\n\n    /// GPIO 12 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp12Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp12Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp12I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp12Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp12Pio0]           |\n    /// | `PIO1`       | [crate::Gp12Pio1]           |\n    Gpio12 {\n        name: gpio12,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio12].\n            FunctionUart, PullNone: Gp12Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio12].\n            FunctionSpi, PullNone: Gp12Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio12].\n            FunctionI2C, PullUp: Gp12I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio12].\n            FunctionPwm, PullNone: Gp12Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio0, PullNone: Gp12Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio1, PullNone: Gp12Pio1\n        }\n    },\n\n    /// GPIO 13 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp13Spi1Csn]        |\n    /// | `UART0 RX`   | [crate::Gp13Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp13I2C0Scl]        |\n    /// | `PWM6 B`     | [crate::Gp13Pwm6B]          |\n    /// | `PIO0`       | [crate::Gp13Pio0]           |\n    /// | `PIO1`       | [crate::Gp13Pio1]           |\n    Gpio13 {\n        name: gpio13,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio13].\n            FunctionUart, PullNone: Gp13Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio13].\n            FunctionSpi, PullNone: Gp13Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio13].\n            FunctionI2C, PullUp: Gp13I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio13].\n            FunctionPwm, PullNone: Gp13Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio0, PullNone: Gp13Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio1, PullNone: Gp13Pio1\n        }\n    },\n\n    /// GPIO 14 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp14Spi1Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp14Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp14I2C1Sda]        |\n    /// | `PWM7 A`     | [crate::Gp14Pwm7A]          |\n    /// | `PIO0`       | [crate::Gp14Pio0]           |\n    /// | `PIO1`       | [crate::Gp14Pio1]           |\n    Gpio14 {\n        name: gpio14,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio14].\n            FunctionUart, PullNone: Gp14Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio14].\n            FunctionSpi, PullNone: Gp14Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio14].\n            FunctionI2C, PullUp: Gp14I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio14].\n            FunctionPwm, PullNone: Gp14Pwm7A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio14].\n            FunctionPio0, PullNone: Gp14Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio14].\n            FunctionPio1, PullNone: Gp14Pio1\n        }\n    },\n\n    /// GPIO 15 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp15Spi1Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp15Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp15I2C1Scl]        |\n    /// | `PWM7 B`     | [crate::Gp15Pwm7B]          |\n    /// | `PIO0`       | [crate::Gp15Pio0]           |\n    /// | `PIO1`       | [crate::Gp15Pio1]           |\n    Gpio15 {\n        name: gpio15,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio15].\n            FunctionUart, PullNone: Gp15Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio15].\n            FunctionSpi, PullNone: Gp15Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio15].\n            FunctionI2C, PullUp: Gp15I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio15].\n            FunctionPwm, PullNone: Gp15Pwm7B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio0, PullNone: Gp15Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio1, PullNone: Gp15Pio1\n        }\n    },\n\n    /// GPIO 16 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp16Spi0Rx]         |\n    /// | `UART0 TX`   | [crate::Gp16Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp16I2C0Sda]        |\n    /// | `PWM0 A`     | [crate::Gp16Pwm0A]          |\n    /// | `PIO0`       | [crate::Gp16Pio0]           |\n    /// | `PIO1`       | [crate::Gp16Pio1]           |\n    Gpio16 {\n        name: gpio16,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio16].\n            FunctionUart, PullNone: Gp16Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio16].\n            FunctionSpi, PullNone: Gp16Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio16].\n            FunctionI2C, PullUp: Gp16I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio16].\n            FunctionPwm, PullNone: Gp16Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio16].\n            FunctionPio0, PullNone: Gp16Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio16].\n            FunctionPio1, PullNone: Gp16Pio1\n        }\n    },\n\n    /// GPIO 17 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp17Spi0Csn]        |\n    /// | `UART0 RX`   | [crate::Gp17Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp17I2C0Scl]        |\n    /// | `PWM0 B`     | [crate::Gp17Pwm0B]          |\n    /// | `PIO0`       | [crate::Gp17Pio0]           |\n    /// | `PIO1`       | [crate::Gp17Pio1]           |\n    Gpio17 {\n        name: gpio17,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio17].\n            FunctionUart, PullNone: Gp17Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio17].\n            FunctionSpi, PullNone: Gp17Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio17].\n            FunctionI2C, PullUp: Gp17I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio17].\n            FunctionPwm, PullNone: Gp17Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio0, PullNone: Gp17Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio1, PullNone: Gp17Pio1\n        }\n    },\n\n    /// GPIO 18 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp18Spi0Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp18Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp18I2C1Sda]        |\n    /// | `PWM1 A`     | [crate::Gp18Pwm1A]          |\n    /// | `PIO0`       | [crate::Gp18Pio0]           |\n    /// | `PIO1`       | [crate::Gp18Pio1]           |\n    Gpio18 {\n        name: gpio18,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio18].\n            FunctionUart, PullNone: Gp18Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio18].\n            FunctionSpi, PullNone: Gp18Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio18].\n            FunctionI2C, PullUp: Gp18I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio18].\n            FunctionPwm, PullNone: Gp18Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio0, PullNone: Gp18Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio1, PullNone: Gp18Pio1\n        }\n    },\n\n    /// GPIO 19 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp19Spi0Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp19Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp19I2C1Scl]        |\n    /// | `PWM1 B`     | [crate::Gp19Pwm1B]          |\n    /// | `PIO0`       | [crate::Gp19Pio0]           |\n    /// | `PIO1`       | [crate::Gp19Pio1]           |\n    Gpio19 {\n        name: gpio19,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio19].\n            FunctionUart, PullNone: Gp19Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio19].\n            FunctionSpi, PullNone: Gp19Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio19].\n            FunctionI2C, PullUp: Gp19I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio19].\n            FunctionPwm, PullNone: Gp19Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio0, PullNone: Gp19Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio1, PullNone: Gp19Pio1\n        }\n    },\n\n    /// GPIO 20 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp20Spi0Rx]         |\n    /// | `UART1 TX`   | [crate::Gp20Uart1Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp20I2C0Sda]        |\n    /// | `PWM2 A`     | [crate::Gp20Pwm2A]          |\n    /// | `PIO0`       | [crate::Gp20Pio0]           |\n    /// | `PIO1`       | [crate::Gp20Pio1]           |\n    Gpio20 {\n        name: gpio20,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio20].\n            FunctionUart, PullNone: Gp20Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio20].\n            FunctionSpi, PullNone: Gp20Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio20].\n            FunctionI2C, PullUp: Gp20I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio20].\n            FunctionPwm, PullNone: Gp20Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio0, PullNone: Gp20Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio1, PullNone: Gp20Pio1\n        }\n    },\n\n    /// GPIO 21 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp21Spi0Csn]        |\n    /// | `UART1 RX`   | [crate::Gp21Uart1Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp21I2C0Scl]        |\n    /// | `PWM2 B`     | [crate::Gp21Pwm2B]          |\n    /// | `PIO0`       | [crate::Gp21Pio0]           |\n    /// | `PIO1`       | [crate::Gp21Pio1]           |\n    Gpio21 {\n        name: gpio21,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio21].\n            FunctionUart, PullNone: Gp21Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio21].\n            FunctionSpi, PullNone: Gp21Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio21].\n            FunctionI2C, PullUp: Gp21I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio21].\n            FunctionPwm, PullNone: Gp21Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio0, PullNone: Gp21Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio1, PullNone: Gp21Pio1\n        }\n    },\n\n    /// GPIO 22 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp22Spi0Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp22Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp22I2C1Sda]        |\n    /// | `PWM3 A`     | [crate::Gp22Pwm3A]          |\n    /// | `PIO0`       | [crate::Gp22Pio0]           |\n    /// | `PIO1`       | [crate::Gp22Pio1]           |\n    Gpio22 {\n        name: gpio22,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio22].\n            FunctionUart, PullNone: Gp22Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio22].\n            FunctionSpi, PullNone: Gp22Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio22].\n            FunctionI2C, PullUp: Gp22I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio22].\n            FunctionPwm, PullNone: Gp22Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio0, PullNone: Gp22Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio1, PullNone: Gp22Pio1\n        }\n    },\n\n    /// GPIO 23 is connected to b_power_save of the Raspberry Pi Pico board.\n    Gpio23 {\n        name: b_power_save,\n    },\n\n    /// GPIO 24 is connected to vbus_detect of the Raspberry Pi Pico board.\n    Gpio24 {\n        name: vbus_detect,\n    },\n\n    /// GPIO 25 is connected to led of the Raspberry Pi Pico board.\n    Gpio25 {\n        name: led,\n    },\n\n    /// GPIO 26 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp26Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp26Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp26I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp26Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp26Pio0]           |\n    /// | `PIO1`       | [crate::Gp26Pio1]           |\n    Gpio26 {\n        name: gpio26,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio26].\n            FunctionUart, PullNone: Gp26Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio26].\n            FunctionSpi, PullNone: Gp26Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio26].\n            FunctionPwm, PullNone: Gp26Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio0, PullNone: Gp26Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio1, PullNone: Gp26Pio1\n        }\n    },\n\n    /// GPIO 27 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp27Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp27Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp27I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp27Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp27Pio0]           |\n    /// | `PIO1`       | [crate::Gp27Pio1]           |\n    Gpio27 {\n        name: gpio27,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio27].\n            FunctionUart, PullNone: Gp27Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio27].\n            FunctionSpi, PullNone: Gp27Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio27].\n            FunctionPwm, PullNone: Gp27Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio0, PullNone: Gp27Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio1, PullNone: Gp27Pio1\n        }\n    },\n\n    /// GPIO 28 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp28Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp28Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp28I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp28Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp28Pio0]           |\n    /// | `PIO1`       | [crate::Gp28Pio1]           |\n    Gpio28 {\n        name: gpio28,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp28Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp28Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp28I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp28Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp28Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp28Pio1\n        }\n    },\n\n    /// GPIO 29 is connected to voltage_monitor of the Raspberry Pi Pico board.\n    Gpio29 {\n        name: voltage_monitor,\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/seeeduino-xiao-rp2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.6.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.5.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n\n## 0.4.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n\n## 0.3.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n\n## 0.2.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Update to rp2040-hal 0.6.0\n\n## 0.1.0 - 2022-06-26\n\n- Initial release\n\n"
  },
  {
    "path": "boards/seeeduino-xiao-rp2040/Cargo.toml",
    "content": "[package]\nname = \"seeeduino-xiao-rp2040\"\nversion = \"0.6.0\"\nauthors = [\"Philip L. McMahon <plm@users.noreply.github.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/seeeduino-xiao-rp02040\"\ndescription = \"Board Support Package for the Seeediuno XIAO RP2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\nembedded-hal.workspace = true\nfugit.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\nsmart-leds.workspace = true\nws2812-pio.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/seeeduino-xiao-rp2040/README.md",
    "content": "# [seeeduino-xiao-rp2040] - Board Support for the [Seeeduino XIAO RP2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Seeeduino XIAO RP2040] - a tiny board for wearable devices and small\nprojects.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the XIAO RP2040.\n\n[Seeeduino XIAO RP2040]: https://www.seeedstudio.com/XIAO-RP2040-v1-0-p-5026.html\n[seeeduino-xiao-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/seeeduino-xiao-rp2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nseeeduino-xiao-rp2040 = \"0.6.0\"\n```\n\nIn your program, you will need to call `seeeduino-xiao-rp2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/seeeduino-xiao-rp2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/seeeduino-xiao-rp2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\n\nAfter installing `elf2uf2-rs`, retry the `cargo run` command above.\n\n### [seeeduino_xiao_rp2040_blinky](./examples/seeeduino_xiao_rp2040_blinky.rs)\n\nFlashes the XIAO RP2040's on-board LED on and off.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/seeeduino-xiao-rp2040/examples/seeeduino_xiao_rp2040_blinky.rs",
    "content": "//! # Seeeduino XIAO RP2040 Blinky Example\n//!\n//! Blinks the LED on a Seeeduino XIAO RP2040 16MB board.\n//!\n//! This will blink an LED attached to GPIO25, which is the pin the XIAO RP2040\n//! uses for the on-board LED.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse seeeduino_xiao_rp2040::entry;\n\n// GPIO traits\nuse embedded_hal::digital::OutputPin;\nuse embedded_hal::pwm::SetDutyCycle;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse seeeduino_xiao_rp2040::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse seeeduino_xiao_rp2040::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse seeeduino_xiao_rp2040::hal;\n\nuse hal::gpio::PinState;\n\n// The minimum PWM value (i.e. LED brightness) we want\nconst LOW: u16 = 0;\n\n// The maximum PWM value (i.e. LED brightness) we want\nconst HIGH: u16 = 60000;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then blinks the LED in an\n/// infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        seeeduino_xiao_rp2040::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = seeeduino_xiao_rp2040::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // Init PWMs\n    let mut pwm_slices = hal::pwm::Slices::new(pac.PWM, &mut pac.RESETS);\n\n    // Configure PWM4\n    let pwm = &mut pwm_slices.pwm0;\n    pwm.set_ph_correct();\n    pwm.enable();\n\n    // Output channel B on PWM0 to the red LED pin, initially off\n    let channel = &mut pwm.channel_b;\n    channel.output_to(pins.led_red);\n    let _ = channel.set_duty_cycle(u16::MAX);\n\n    // Set the blue LED to be an output, initially off\n    let mut led_blue_pin = pins.led_blue.into_push_pull_output_in_state(PinState::High);\n\n    // Turn off the green LED\n    let mut _led_green_pin = pins\n        .led_green\n        .into_push_pull_output_in_state(PinState::High);\n\n    loop {\n        // Blink blue LED at 1 Hz\n        for _ in 0..5 {\n            led_blue_pin.set_low().unwrap();\n            delay.delay_ms(500);\n            led_blue_pin.set_high().unwrap();\n            delay.delay_ms(500);\n        }\n\n        // Ramp red LED brightness up\n        for i in (LOW..=HIGH).skip(30) {\n            delay.delay_us(100);\n            let _ = channel.set_duty_cycle(u16::MAX - i);\n        }\n\n        // Ramp red LED brightness down\n        for i in (LOW..=HIGH).rev().skip(30) {\n            delay.delay_us(100);\n            let _ = channel.set_duty_cycle(u16::MAX - i);\n        }\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/seeeduino-xiao-rp2040/examples/seeeduino_xiao_rp2040_neopixel_rainbow.rs",
    "content": "//! Rainbow effect color wheel using the onboard NeoPixel on a Seeed XIAO RP2040 board\n//!\n//! This flows smoothly through various colours on the onboard NeoPixel.\n//! Uses the `ws2812_pio` driver to control the NeoPixel, which in turns uses the\n//! RP2040's PIO block.\n#![no_std]\n#![no_main]\n\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\n\nuse seeeduino_xiao_rp2040::{\n    entry,\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        gpio::PinState,\n        pac,\n        pio::PIOExt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\n\nuse ws2812_pio::Ws2812;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then infinitely cycles the built-in LED colour from red, to green,\n/// to blue and back to red.\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Turn on neopixel power\n    pins.neopixel_power\n        .into_push_pull_output_in_state(PinState::High);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        // The onboard NeoPixel is attached to GPIO pin #16 on the Waveshare RP2040-Zero.\n        pins.neopixel_data.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite colour wheel loop\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/seeeduino-xiao-rp2040/src/lib.rs",
    "content": "#![no_std]\n\npub use rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio0 {\n        name: tx,\n        aliases: { FunctionUart, PullNone: UartTx }\n    },\n    Gpio1 {\n        name: rx\n        aliases: { FunctionUart, PullNone: UartRx, FunctionSpi, PullNone: Csn }\n    },\n    Gpio2 {\n        name: sck,\n        aliases: { FunctionSpi, PullNone: Sck }\n    },\n    Gpio3 {\n         name: mosi,\n         aliases: { FunctionSpi, PullNone: Mosi }\n    },\n    Gpio4 {\n         name: miso,\n         aliases: { FunctionSpi, PullNone: Miso }\n    },\n    Gpio6 {\n        name: sda,\n        aliases: { FunctionI2C, PullUp: Sda }\n    },\n    Gpio7 {\n        name: scl,\n        aliases: { FunctionI2C, PullUp: Scl }\n    },\n    Gpio11 { name: neopixel_power },\n    Gpio12 { name: neopixel_data },\n    Gpio16 {\n        name: led_green,\n        aliases: { FunctionPwm, PullNone: LedGreenPwm }\n    },\n    Gpio17 {\n        name: led_red,\n        aliases: { FunctionPwm, PullNone: LedRedPwm }\n    },\n    Gpio25 {\n        name: led_blue,\n        aliases: { FunctionPwm, PullNone: LedBluePwm }\n    },\n    Gpio26 { name: a0 },\n    Gpio27 { name: a1 },\n    Gpio28 { name: a2 },\n    Gpio29 { name: a3 },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/solderparty-rp2040-stamp/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.7.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.6.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.5.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n\n## 0.4.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.3.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Bump `pio` to 0.2.0\n- Bump `ws2812-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n"
  },
  {
    "path": "boards/solderparty-rp2040-stamp/Cargo.toml",
    "content": "[package]\nname = \"solderparty-rp2040-stamp\"\nversion = \"0.7.0\"\nauthors = [\"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/solderparty-rp2040-stamp\"\ndescription = \"Board Support Package for the Solder Party RP2040 Stamp\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\nembedded-hal.workspace = true\nfugit.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\npio.workspace = true\nsmart-leds.workspace = true\nws2812-pio.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/solderparty-rp2040-stamp/README.md",
    "content": "# [solderparty-rp2040-stamp] - Board Support for the [Solder Party RP2040 Stamp]\n\nYou should include this crate if you are writing code that you want to run on\na [Solder Party RP2040 Stamp]\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Stamp\n\n[Solder Party RP2040 Stamp]: https://www.solder.party/docs/rp2040-stamp/\n[solderparty-rp2040-stamp]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/solderparty-rp2040-stamp\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nsolderparty-rp2040-stamp = \"0.7.0\"\n```\n\nIn your program, you will need to call `solderparty_rp2040_stamp::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal_ repository and run:\n\n```console\nrp-hal-boards/boards/solderparty-rp2040-stamp $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/solderparty-rp2040-stamp $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [solderparty_stamp_neopixel_rainbow](./examples/solderparty_stamp_neopixel_rainbow.rs)\n\nFlows smoothly through various colors on the Feather's onboard NeoPixel LED.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe, learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs",
    "content": "//! Rainbow effect color wheel using the onboard NeoPixel on an Solder Party Stamp RP2040 board\n//!\n//! This flows smoothly through various colors on the onboard NeoPixel.\n//! Uses the `ws2812_pio` driver to control the NeoPixel, which in turns uses the\n//! RP2040's PIO block.\n#![no_std]\n#![no_main]\n\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse solderparty_rp2040_stamp::entry;\nuse solderparty_rp2040_stamp::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\nuse ws2812_pio::Ws2812;\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        // The onboard NeoPixel is attached to GPIO pin #21 on the RP2040 Stamp.\n        pins.neopixel.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite colour wheel loop\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/solderparty-rp2040-stamp/src/lib.rs",
    "content": "#![no_std]\n\npub use rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_GD25Q64CS;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio0 { name: gpio0 },\n    Gpio1 { name: gpio1 },\n    Gpio2 { name: gpio2 },\n    Gpio3 { name: gpio3 },\n    Gpio4 { name: gpio4 },\n    Gpio5 { name: gpio5 },\n    Gpio6 { name: gpio6 },\n    Gpio7 { name: gpio7 },\n    Gpio8 { name: gpio8 },\n    Gpio9 { name: gpio9 },\n    Gpio10 { name: gpio10 },\n    Gpio11 { name: gpio11 },\n    Gpio12 { name: gpio12 },\n    Gpio13 { name: gpio13 },\n    Gpio14 { name: gpio14 },\n    Gpio15 { name: gpio15 },\n    Gpio16 { name: gpio16 },\n    Gpio17 { name: gpio17 },\n    Gpio18 { name: gpio18 },\n    Gpio19 { name: gpio19 },\n    Gpio20 { name: gpio20 },\n    Gpio21 { name: neopixel },\n    Gpio22 { name: gpio22 },\n    Gpio23 { name: gpio23 },\n    Gpio24 { name: gpio24 },\n    Gpio25 { name: gpio25 },\n    Gpio26 { name: gpio26 },\n    Gpio27 { name: gpio27 },\n    Gpio28 { name: gpio28 },\n    Gpio29 { name: gpio29 },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/sparkfun-micromod-rp2040/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/sparkfun-micromod-rp2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.3.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.1.1 - 2023-06-22\n\n- Improve README and Documentation\n\n## 0.1.0 - 2023-05-20\n\n- Initial release\n"
  },
  {
    "path": "boards/sparkfun-micromod-rp2040/Cargo.toml",
    "content": "[package]\nname = \"sparkfun-micromod-rp2040\"\nversion = \"0.3.0\"\nauthors = [\"Finomnis <finomnis@gmail.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-micromod-rp2040\"\ndescription = \"Board Support Package for the SparkFun MicroMod RP2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m.workspace = true\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\ncortex-m-rt = { workspace = true, optional = true }\nembedded-hal.workspace = true\nembedded_hal_0_2 = { workspace = true }\nnb.workspace = true\n\n[dev-dependencies]\npanic-probe = { workspace = true, features = [\"print-defmt\"] }\npanic-halt.workspace = true\nrp2040-hal = { workspace = true, features = [\"defmt\"] }\ndefmt.workspace = true\ndefmt-rtt.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\", \"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/sparkfun-micromod-rp2040/README.md",
    "content": "# [sparkfun-micromod-rp2040] - Board Support for the [SparkFun MicroMod RP2040]\n\nYou should include this crate if you are writing code that you want to run on\na [SparkFun MicroMod RP2040] - the RP2040 processor board for the [SparkFun MicroMod] ecosystem.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the MicroMod RP2040.\n\n[SparkFun MicroMod RP2040]: https://www.sparkfun.com/products/17720\n[SparkFun MicroMod]: https://www.sparkfun.com/micromod\n[sparkfun-micromod-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-micromod-rp2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nsparkfun-micromod-rp2040 = \"0.3.0\"\n```\n\nIn your program, you will need to call `sparkfun_micromod_rp2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/sparkfun-micromod-rp2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/sparkfun-micromod-rp2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\n\nThen repeat the `cargo run` command above.\n\n### [Blinky](./examples/sparkfun_micromod_blinky.rs)\n\nThis example will blink the on-board LED.\n\n### [Battery Voltage](./examples/sparkfun_micromod_battery_voltage.rs)\n\nThis example will continuously print the current supply voltage.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/sparkfun-micromod-rp2040/build.rs",
    "content": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n    println!(\"cargo:rustc-link-arg-examples=-Tdefmt.x\");\n}\n"
  },
  {
    "path": "boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_battery_voltage.rs",
    "content": "//! # SparkFun MicroMod Battery Voltage Example\n//!\n//! Continuously reads the battery voltage and prints it over defmt-rtt.\n//!\n//! Note that for this example to work, you need to change the runner\n//! to `probe-rs run` (in `.cargo/config.toml` at the root of the repository)\n//! and connect to the RP2040 via SWD, preferredly via the Raspberry\n//! Pi Debug Probe.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse sparkfun_micromod_rp2040 as bsp;\n\n// Import log macros and register global logger\nuse defmt::*;\nuse defmt_rtt as _;\n\n// Register panic handler\nuse panic_probe as _;\n#[defmt::panic_handler]\nfn panic() -> ! {\n    // don't print a panic message\n    // this prevents the panic message being printed *twice* when `defmt::panic` is invoked\n    cortex_m::asm::udf()\n}\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse bsp::hal;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse hal::pac;\n\n// Pull in any important traits\nuse hal::prelude::*;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then blinks the LED in an\n/// infinite loop.\n#[bsp::entry]\nfn main() -> ! {\n    info!(\"Battery Voltage Example!\");\n\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        bsp::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = bsp::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let mut adc = hal::Adc::new(pac.ADC, &mut pac.RESETS);\n    let mut battery_voltage = bsp::BatteryVoltage::new(\n        hal::adc::AdcPin::new(pins.batt_vin.into_floating_input()).unwrap(),\n    );\n\n    // Print battery voltage once per second\n    loop {\n        println!(\"Battery: {} mV\", battery_voltage.read(&mut adc));\n        delay.delay_ms(1000);\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_blinky.rs",
    "content": "//! # SparkFun MicroMod Blinky Example\n//!\n//! Blinks the LED on a SparkFun MicroMod RP2040 board.\n//!\n//! This will blink an LED attached to GP25, which is the pin the SparkFun MicroMod RP2040 uses for\n//! the on-board LED.\n//!\n//! See the `Cargo.toml` file for Copyright and license details.\n\n#![no_std]\n#![no_main]\n\n// The macro for our start-up function\nuse sparkfun_micromod_rp2040::entry;\n\n// GPIO traits\nuse embedded_hal::digital::OutputPin;\n\n// Ensure we halt the program on panic (if we don't mention this crate it won't\n// be linked)\nuse panic_halt as _;\n\n// Pull in any important traits\nuse sparkfun_micromod_rp2040::hal::prelude::*;\n\n// A shorter alias for the Peripheral Access Crate, which provides low-level\n// register access\nuse sparkfun_micromod_rp2040::hal::pac;\n\n// A shorter alias for the Hardware Abstraction Layer, which provides\n// higher-level drivers.\nuse sparkfun_micromod_rp2040::hal;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then blinks the LED in an\n/// infinite loop.\n#[entry]\nfn main() -> ! {\n    // Grab our singleton objects\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Set up the watchdog driver - needed by the clock setup code\n    let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);\n\n    // Configure the clocks\n    //\n    // The default is to generate a 125 MHz system clock\n    let clocks = hal::clocks::init_clocks_and_plls(\n        sparkfun_micromod_rp2040::XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // The delay object lets us wait for specified amounts of time (in\n    // milliseconds)\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    // The single-cycle I/O block controls our GPIO pins\n    let sio = hal::Sio::new(pac.SIO);\n\n    // Set the pins up according to their function on this particular board\n    let pins = sparkfun_micromod_rp2040::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Set the LED to be an output\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    // Blink the LED at 1 Hz\n    loop {\n        led_pin.set_high().unwrap();\n        delay.delay_ms(500);\n        led_pin.set_low().unwrap();\n        delay.delay_ms(500);\n    }\n}\n\n// End of file\n"
  },
  {
    "path": "boards/sparkfun-micromod-rp2040/src/lib.rs",
    "content": "#![no_std]\n\n//! Board Support Package for the SparkFun MicroMod RP2040.\n//!\n//! This crate serves as a HAL (Hardware Abstraction Layer) for the SparkFun MicroMod RP2040. Since the SparkFun MicroMod RP2040\n//! is based on the RP2040 chip, it re-exports the [rp2040_hal] crate which contains the tooling to work with the\n//! rp2040 chip.\n//!\n//! # Examples:\n//!\n//! The following example turns on the onboard LED. Note that most of the logic works through the [rp2040_hal] crate.\n//! ```ignore\n//! #![no_main]\n//! use sparkfun_micromod_rp2040::entry;\n//! use panic_halt as _;\n//! use embedded_hal::digital::v2::OutputPin;\n//! use sparkfun_micromod_rp2040::hal::pac;\n//! use sparkfun_micromod_rp2040::hal;\n\n//! #[entry]\n//! fn does_not_have_to_be_main() -> ! {\n//!   let mut pac = pac::Peripherals::take().unwrap();\n//!   let sio = hal::Sio::new(pac.SIO);\n//!   let pins = rp_pico::Pins::new(\n//!        pac.IO_BANK0,\n//!        pac.PADS_BANK0,\n//!        sio.gpio_bank0,\n//!        &mut pac.RESETS,\n//!   );\n//!   let mut led_pin = pins.led.into_push_pull_output();\n//!   led_pin.set_high().unwrap();\n//!   loop {\n//!   }\n//! }\n//! ```\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n\n/// The `entry` macro declares the starting function to the linker.\n/// This is similar to the `main` function in console applications.\n///\n/// It is based on the [cortex_m_rt](https://docs.rs/cortex-m-rt/latest/cortex_m_rt/attr.entry.html) crate.\n///\n/// # Examples\n/// ```ignore\n/// #![no_std]\n/// #![no_main]\n/// use sparkfun_micromod_rp2040::entry;\n/// #[entry]\n/// fn you_can_use_a_custom_main_name_here() -> ! {\n///   loop {}\n/// }\n/// ```\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\nuse hal::gpio::{bank0::Gpio29, FunctionSioInput, PullNone};\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 can serve as:\n    /// - `UART_TX1`\n    Gpio0 {\n        name: gpio0,\n        aliases: {\n            FunctionUart, PullNone: UartTx1\n        }\n    },\n    /// GPIO 1 can serve as:\n    /// - `UART_RX1`\n    Gpio1 {\n        name: gpio1,\n        aliases: {\n            FunctionUart, PullNone: UartRx1\n        }\n    },\n    /// GPIO 2 can serve as:\n    /// - `UART_CTS1`\n    /// - `AUD_LRCLK`\n    Gpio2 {\n        name: gpio2,\n        aliases: {\n            FunctionUart, PullNone: UartCts1,\n            FunctionPio0, PullNone: AudLrclkPio0,\n            FunctionPio1, PullNone: AudLrclkPio1\n        }\n    },\n    /// GPIO 3 can serve as:\n    /// - `UART_RTS1`\n    /// - `AUD_BCLK`\n    Gpio3 {\n        name: gpio3,\n        aliases: {\n            FunctionUart, PullNone: UartRts1,\n            FunctionPio0, PullNone: AudBclkPio0,\n            FunctionPio1, PullNone: AudBclkPio1\n        }\n    },\n    /// GPIO 4 can serve as:\n    /// - `I2C_SDA`\n    Gpio4 {\n        name: gpio4,\n        aliases: {\n            FunctionI2C, PullUp: I2CSda\n        }\n    },\n    /// GPIO 5 can serve as:\n    /// - `I2C_SCL`\n    Gpio5 {\n        name: gpio5,\n        aliases: {\n            FunctionI2C, PullUp: I2CScl\n        }\n    },\n    /// GPIO 6 can serve as:\n    /// - `D0`\n    Gpio6 {\n        name: gpio6,\n        aliases: {\n            FunctionPwm, PullNone: D0Pwm,\n            FunctionPio0, PullNone: D0Pio0,\n            FunctionPio1, PullNone: D0Pio1\n        }\n    },\n    /// GPIO 7 can serve as:\n    /// - `D1`\n    Gpio7 {\n        name: gpio7,\n        aliases: {\n            FunctionPwm, PullNone: D1Pwm,\n            FunctionPio0, PullNone: D1Pio0,\n            FunctionPio1, PullNone: D1Pio1\n        }\n    },\n    /// GPIO 8 can serve as:\n    /// - `I2C_INT`\n    /// - `UART_TX2`\n    Gpio8 {\n        name: gpio8,\n        aliases: {\n            FunctionI2C, PullUp: I2CInt,\n            FunctionUart, PullNone: UartTx2\n        }\n    },\n    /// GPIO 9 can serve as:\n    /// - `SPI_CS1`\n    /// - `UART_RX2`\n    /// - `SDIO_DATA3`\n    Gpio9 {\n        name: gpio9,\n        aliases: {\n            FunctionUart, PullNone: UartRx2,\n            FunctionSpi, PullNone: SpiCs1,\n            FunctionPio0, PullNone: SdioData3Pio0,\n            FunctionPio1, PullNone: SdioData3Pio1\n        }\n    },\n    /// GPIO 10 can serve as:\n    /// - `SDIO_DATA2`\n    /// - `AUD_OUT`\n    Gpio10 {\n        name: gpio10,\n        aliases: {\n            FunctionPio0, PullNone: SdioData2Pio0,\n            FunctionPio1, PullNone: SdioData2Pio1,\n            FunctionPio0, PullNone: AudOutPio0,\n            FunctionPio1, PullNone: AudOutPio1\n        }\n    },\n    /// GPIO 11 can serve as:\n    /// - `SDIO_DATA1`\n    /// - `AUD_IN`\n    Gpio11 {\n        name: gpio11,\n        aliases: {\n            FunctionPio0, PullNone: SdioData1Pio0,\n            FunctionPio1, PullNone: SdioData1Pio1,\n            FunctionPio0, PullNone: AudInPio0,\n            FunctionPio1, PullNone: AudInPio1\n        }\n    },\n    /// GPIO 12 can serve as:\n    /// - `SPI_COPI1`\n    /// - `SDIO_DATA0`\n    Gpio12 {\n        name: gpio12,\n        aliases: {\n            FunctionSpi, PullNone: SpiCipo1,\n            FunctionPio0, PullNone: SdioData0Pio0,\n            FunctionPio1, PullNone: SdioData0Pio1\n        }\n    },\n    /// GPIO 13 can serve as:\n    /// - `PWM0`\n    Gpio13 {\n        name: gpio13,\n        aliases: {\n            FunctionPwm, PullNone: Pwm0\n        }\n    },\n    /// GPIO 14 can serve as:\n    /// - `SPI_SCK1`\n    /// - `SDIO_SCK`\n    Gpio14 {\n        name: gpio14,\n        aliases: {\n            FunctionSpi, PullNone: SpiSck1,\n            FunctionPio0, PullNone: SdioSckPio0,\n            FunctionPio1, PullNone: SdioSckPio1\n        }\n    },\n    /// GPIO 15 can serve as:\n    /// - `SPI_COPI1`\n    /// - `SDIO_CMD`\n    Gpio15 {\n        name: gpio15,\n        aliases: {\n            FunctionSpi, PullNone: SpiCopi1,\n            FunctionPio0, PullNone: SdioCmdPio0,\n            FunctionPio1, PullNone: SdioCmdPio1\n        }\n    },\n    /// GPIO 16 can serve as:\n    /// - `G0`\n    Gpio16 {\n        name: gpio16,\n        aliases: {\n            FunctionPwm, PullNone: G0Pwm,\n            FunctionPio0, PullNone: G0Pio0,\n            FunctionPio1, PullNone: G0Pio1\n        }\n    },\n    /// GPIO 17 can serve as:\n    /// - `G1`\n    Gpio17 {\n        name: gpio17,\n        aliases: {\n            FunctionPwm, PullNone: G1Pwm,\n            FunctionPio0, PullNone: G1Pio0,\n            FunctionPio1, PullNone: G1Pio1\n        }\n    },\n    /// GPIO 18 can serve as:\n    /// - `G2`\n    Gpio18 {\n        name: gpio18,\n        aliases: {\n            FunctionPwm, PullNone: G2Pwm,\n            FunctionPio0, PullNone: G2Pio0,\n            FunctionPio1, PullNone: G2Pio1\n        }\n    },\n    /// GPIO 19 can serve as:\n    /// - `G3`\n    Gpio19 {\n        name: gpio19,\n        aliases: {\n            FunctionPwm, PullNone: G3Pwm,\n            FunctionPio0, PullNone: G3Pio0,\n            FunctionPio1, PullNone: G3Pio1\n        }\n    },\n    /// GPIO 20 can serve as:\n    /// - `SPI_CIPO`\n    /// - `G4`\n    Gpio20 {\n        name: gpio20,\n        aliases: {\n            FunctionSpi, PullNone: SpiCipo,\n            FunctionPwm, PullNone: G4Pwm,\n            FunctionPio0, PullNone: G4Pio0,\n            FunctionPio1, PullNone: G4Pio1\n        }\n    },\n    /// GPIO 21 can serve as:\n    /// - `SPI_CS`\n    /// - `G5`\n    Gpio21 {\n        name: gpio21,\n        aliases: {\n            FunctionSpi, PullNone: SpiCs,\n            FunctionPwm, PullNone: G5Pwm,\n            FunctionPio0, PullNone: G5Pio0,\n            FunctionPio1, PullNone: G5Pio1\n        }\n    },\n    /// GPIO 22 can serve as:\n    /// - `SPI_SCK`\n    /// - `G6`\n    Gpio22 {\n        name: gpio22,\n        aliases: {\n            FunctionSpi, PullNone: SpiSck,\n            FunctionPwm, PullNone: G6Pwm,\n            FunctionPio0, PullNone: G6Pio0,\n            FunctionPio1, PullNone: G6Pio1\n        }\n    },\n    /// GPIO 23 can serve as:\n    /// - `SPI_COPI`\n    /// - `G7`\n    Gpio23 {\n        name: gpio23,\n        aliases: {\n            FunctionSpi, PullNone: SpiCopi,\n            FunctionPwm, PullNone: G7Pwm,\n            FunctionPio0, PullNone: G7Pio0,\n            FunctionPio1, PullNone: G7Pio1\n        }\n    },\n    /// GPIO 24 can serve as:\n    /// - `PWM1`\n    /// - `AUD_MCLK`\n    Gpio24 {\n        name: gpio24,\n        aliases: {\n            FunctionPwm, PullNone: Pwm1,\n            FunctionPio0, PullNone: AudMclkPio0,\n            FunctionPio1, PullNone: AudMclkPio1\n        }\n    },\n    /// GPIO 25 can serve as:\n    /// - Builtin LED\n    /// - `G10`\n    Gpio25 {\n        name: led,\n        aliases: {\n            FunctionPwm, PullNone: G10Pwm,\n            FunctionPio0, PullNone: G10Pio0,\n            FunctionPio1, PullNone: G10Pio1\n        }\n    },\n    /// ADC 0 can serve as:\n    /// - `ADC0`\n    Gpio26 {\n        name: adc0,\n    },\n    /// ADC 1 can serve as:\n    /// - `ADC1`\n    Gpio27 {\n        name: adc1,\n    },\n    /// GPIO 28 can serve as:\n    /// - `G9`\n    Gpio28 {\n        name: gpio28,\n        aliases: {\n            FunctionPwm, PullNone: G9Pwm,\n            FunctionPio0, PullNone: G9Pio0,\n            FunctionPio1, PullNone: G9Pio1\n        }\n    },\n    /// ADC 3 can serve as:\n    /// - `BATT_VIN`\n    Gpio29 {\n        name: batt_vin,\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n\n/// Alias for a configured pin\npub type BattVin = hal::adc::AdcPin<hal::gpio::Pin<Gpio29, FunctionSioInput, PullNone>>;\n/// Driver for reading the battery volatage\npub struct BatteryVoltage {\n    pin: BattVin,\n}\n\nimpl BatteryVoltage {\n    /// Creates a new battery voltage reader\n    pub fn new(pin: BattVin) -> Self {\n        Self { pin }\n    }\n\n    /// Reads the current battery voltage\n    ///\n    /// # Return\n    ///\n    /// The current voltage in millivolts\n    pub fn read(&mut self, adc: &mut hal::Adc) -> u16 {\n        use embedded_hal_0_2::adc::OneShot;\n\n        let raw_value: u32 = loop {\n            match adc.read(&mut self.pin) {\n                Ok(val) => break val,\n                Err(nb::Error::WouldBlock) => (),\n                Err(nb::Error::Other(_)) => unreachable!(),\n            }\n        };\n\n        // Convert value to millivolts\n        // The raw ADC value is in in the range of 0..4096,\n        // where 0 = 0V and 4096 = 3.3V.\n        // The MicroMod interface defines that the voltage is divided by 3,\n        // so the conversion formula:\n        // value / 4096 * 3300(mV) * 3\n        let value = (raw_value * 3300 * 3) / 4096;\n\n        // The maximum possible value is 9900, so it's safe to convert\n        // back to u16.\n        value as u16\n    }\n}\n"
  },
  {
    "path": "boards/sparkfun-pro-micro-rp2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.8.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.7.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.6.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n\n## 0.5.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.4.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Bump `pio` to 0.2.0\n- Bump `ws2812-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n## 0.3.0 - 2022-06-13\n\n### Changed\n\n- Update to rp2040-hal 0.5.0\n\n## 0.2.0 - 2022-03-11\n\n### Changed\n\n- Update to rp-hal 0.4.0\n\n## 0.1.0 - 2021-12-20\n\n- Initial release\n\n"
  },
  {
    "path": "boards/sparkfun-pro-micro-rp2040/Cargo.toml",
    "content": "[package]\nname = \"sparkfun-pro-micro-rp2040\"\nversion = \"0.8.0\"\nauthors = [\"Wilfried Chauveau <wilfried.chauveau@ithinuel.me>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-pro-micro-rp2040\"\ndescription = \"Board Support Package for the Sparkfun Pro Micro RP2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nembedded-hal = { workspace = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\nfugit.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\npio.workspace = true\nsmart-leds.workspace = true\nws2812-pio.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/sparkfun-pro-micro-rp2040/README.md",
    "content": "# [sparkfun-pro-micro-rp2040] - Board Support for the [Sparkfun Pro Micro RP2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Sparkfun Pro Micro RP2040] - a smaller [RP2040][Raspberry Silicon RP2040]\nboard with USB-C and a WS2812B addressable LED.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Pro Micro RP2040.\n\n[Sparkfun Pro Micro RP2040]: https://www.sparkfun.com/products/18288\n[sparkfun-pro-micro-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-pro-micro-rp2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nsparkfun-pro-micro-rp2040 = \"0.8.0\"\n```\n\nIn your program, you will need to call `sparkfun_pro_micro_rp2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/sparkfun-pro-micro-rp2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/sparkfun-pro-micro-rp2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [Rainbow](./examples/sparkfun_pro_micro_rainbow.rs)\n\nThis example will display a colour-wheel rainbow effect on the on-board LED.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs",
    "content": "//! # Rainbow Example for the Pro Micro RP2040\n//!\n//! Runs a rainbow-effect colour wheel on the on-board LED.\n//!\n//! Uses the `ws2812_pio` driver to control the LED, which in turns uses the\n//! RP2040's PIO block.\n\n#![no_std]\n#![no_main]\n\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse sparkfun_pro_micro_rp2040::entry;\n\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse sparkfun_pro_micro_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    XOSC_CRYSTAL_FREQ,\n};\nuse ws2812_pio::Ws2812;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this\n/// function as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then the LED, then runs\n/// the colour wheel in an infinite loop.\n#[entry]\nfn main() -> ! {\n    // Configure the RP2040 peripherals\n\n    let mut pac = pac::Peripherals::take().unwrap();\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n\n    let pins = sparkfun_pro_micro_rp2040::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        pins.led.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite colour wheel loop\n\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/sparkfun-pro-micro-rp2040/src/lib.rs",
    "content": "#![no_std]\n\npub use rp2040_hal as hal;\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio0 { name: tx0 },\n    Gpio1 { name: rx0 },\n    Gpio2 { name: gpio2 },\n    Gpio3 { name: gpio3 },\n    Gpio4 { name: gpio4 },\n    Gpio5 { name: gpio5 },\n    Gpio6 { name: gpio6 },\n    Gpio7 { name: gpio7 },\n    Gpio8 { name: tx1 },\n    Gpio9 { name: rx1 },\n    Gpio16 { name: sda },\n    Gpio17 { name: scl },\n    Gpio20 { name: cipo },\n    Gpio21 { name: ncs },\n    Gpio22 { name: sck },\n    Gpio23 { name: copi },\n    Gpio25 { name: led },\n    Gpio26 { name: adc0 },\n    Gpio27 { name: adc1 },\n    Gpio28 { name: adc2 },\n    Gpio29 { name: adc3 },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/sparkfun-thing-plus-rp2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.7.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.6.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.5.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n\n## 0.4.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.3.0 - 2022-08-26\n\n### Changed\n\n- Use `rp2040-hal`'s entry function.\n- Migrate from `embedded-time` to `fugit`\n- Bump `pio` to 0.2.0\n- Bump `ws2812-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n## 0.2.0 - 2022-06-13\n\n### Changed\n\n- Update to rp2040-hal 0.5.0\n\n## 0.1.0 - 2022-04-28\n\n- Initial release\n\n"
  },
  {
    "path": "boards/sparkfun-thing-plus-rp2040/Cargo.toml",
    "content": "[package]\nname = \"sparkfun-thing-plus-rp2040\"\nversion = \"0.7.0\"\nauthors = [\"Tyler Pottenger <tyler.pottenger@gmail.com>\", \"Wilfried Chauveau <wilfried.chauveau@ithinuel.me>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-thing-plus-rp2040\"\ndescription = \"Board Support Package for the Sparkfun Thing Plus RP2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nembedded-hal = { workspace = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\npanic-halt.workspace = true\nsmart-leds.workspace = true\nnb.workspace = true\npio.workspace = true\nws2812-pio.workspace = true\nfugit.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/sparkfun-thing-plus-rp2040/README.md",
    "content": "# [sparkfun-thing-plus-rp2040] - Board Support for the [Sparkfun Thing Plus RP2040]\n\nYou should include this crate if you are writing code that you want to run on\na [Sparkfun Thing Plus RP2040] - a smaller [RP2040][Raspberry Silicon RP2040]\nboard with USB-C and a WS2812B addressable LED.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Thing Plus RP2040.\n\n[Sparkfun Thing Plus RP2040]: https://www.sparkfun.com/products/17745\n[sparkfun-thing-plus-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-thing-plus-rp2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nsparkfun-thing-plus-rp2040 = \"0.7.0\"\n```\n\nIn your program, you will need to call `sparkfun_thing_plus_rp2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/sparkfun-thing-plus-rp2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/sparkfun-thing-plus-rp2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [Rainbow](./examples/sparkfun_thing_plus_rainbow.rs)\n\nThis example will display a colour-wheel rainbow effect on the on-board LED.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT licence or the\nApache-2.0 licence when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific licence.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs",
    "content": "//! # Rainbow Example for the Thing Plus RP2040\n//!\n//! Runs a rainbow-effect colour wheel on the on-board LED.\n//!\n//! Uses the `ws2812_pio` driver to control the LED, which in turns uses the\n//! RP2040's PIO block.\n\n#![no_std]\n#![no_main]\n\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\n\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse sparkfun_thing_plus_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    XOSC_CRYSTAL_FREQ,\n};\nuse ws2812_pio::Ws2812;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[sparkfun_thing_plus_rp2040::entry]` macro ensures the Cortex-M start-up code calls this\n/// function as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then the LED, then runs\n/// the colour wheel in an infinite loop.\n#[sparkfun_thing_plus_rp2040::entry]\nfn main() -> ! {\n    // Configure the RP2040 peripherals\n\n    let mut pac = pac::Peripherals::take().unwrap();\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n\n    let pins = sparkfun_thing_plus_rp2040::Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        pins.ws2812.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite colour wheel loop\n\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/sparkfun-thing-plus-rp2040/src/lib.rs",
    "content": "#![no_std]\n\npub use rp2040_hal as hal;\n#[cfg(feature = \"rt\")]\npub use rp2040_hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    Gpio0 { name: tx },\n    Gpio1 { name: rx },\n    Gpio2 { name: sck },\n    Gpio3 { name: copi },\n    Gpio4 { name: cipo },\n    Gpio6 { name: sda },\n    Gpio7 { name: scl },\n    Gpio8 { name: ws2812 },\n    Gpio16 { name: gpio16 },\n    Gpio17 { name: gpio17 },\n    Gpio18 { name: gpio18 },\n    Gpio19 { name: gpio19 },\n    Gpio20 { name: gpio20 },\n    Gpio21 { name: gpio21 },\n    Gpio22 { name: gpio22 },\n    Gpio25 { name: led },\n    Gpio26 { name: adc0 },\n    Gpio27 { name: adc1 },\n    Gpio28 { name: adc2 },\n    Gpio29 { name: adc3 },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/vcc-gnd-yd-rp2040/.gitignore",
    "content": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries\n# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html\nCargo.lock\n\n# These are backup files generated by rustfmt\n**/*.rs.bk\n"
  },
  {
    "path": "boards/vcc-gnd-yd-rp2040/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.6.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n- Update to usb-device 0.3\n\n## 0.5.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.4.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n- Update to i2c-pio 0.6.0\n\n## 0.3.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n- Update to i2c-pio 0.5.0\n\n### Changed\n\n- Bump `i2c-pio` to 0.5.0\n\n## 0.2.0 - 2022-08-26\n\n### Changed\n\n- Migrate from `embedded-time` to `fugit`\n- Bump `ws2812-pio` to 0.4.0\n- Bump `i2c-pio` to 0.4.0\n- Update to rp2040-hal 0.6.0\n\n### Removed\n\n- Unused dependencies\n\n## 0.1.0 - 2022-07-17\n\n- Initial release\n\n"
  },
  {
    "path": "boards/vcc-gnd-yd-rp2040/Cargo.toml",
    "content": "[package]\nname = \"vcc-gnd-yd-rp2040\"\nversion = \"0.6.0\"\nauthors = [\"Nicolas <nleguen@gmail.com>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/vcc-gnd-yd-rp2040\"\ndescription = \"Board Support Package for the VCC-GND Studio YD-RP2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nfugit.workspace = true\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\nusb-device.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\nembedded-hal.workspace = true\nnb.workspace = true\npanic-halt.workspace = true\npio.workspace = true\nsmart-leds.workspace = true\nws2812-pio.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/vcc-gnd-yd-rp2040/README.md",
    "content": "# [vcc-gnd-yd-rp2040] - Board Support for the [VCC-GND Studio YD-RP2040]\n\nYou should include this crate if you are writing code that you want to run on\na [VCC-GND Studio YD-RP2040] - a PCB for the RP2040 chip with USB-C port, WS2812 RGB LED on GPIO23, user key on GPIO24 and built-in blue LED.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the YD-RP2040.\n\n[VCC-GND Studio YD-RP2040]: http://152.32.187.208:8080/yd-data/YD-RP2040/\n[vcc-gnd-yd-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/vcc-gnd-yd-rp2040\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nvcc-gnd-yd-rp2040 = \"0.6.0\"\n```\n\nIn your program, you will need to call `vcc_gnd_studio_yd_rp2040::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/vcc-gnd-yd-rp2040 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/vcc-gnd-yd-rp2040 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs\n```\nthen try repeating the `cargo run` command above.\n\n### [yd_rp2040_blinky](./examples/yd_rp2040_blinky.rs)\n\nFlashes the YD-RP2040's onboard LED on and off.\n\n### [yd_rp2040_neopixel_rainbow](./examples/yd_rp2040_neopixel_rainbow.rs)\n\nFlows smoothly through various colors on the YD-RP2040's onboard NeoPixel LED.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_blinky.rs",
    "content": "//! Blinks the LED on a VCC-GND Studio YD-RP2040 board\n//!\n//! This will blink on-board LED.\n#![no_std]\n#![no_main]\n\nuse embedded_hal::digital::OutputPin;\nuse panic_halt as _;\nuse vcc_gnd_yd_rp2040::entry;\nuse vcc_gnd_yd_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());\n\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n    let mut led_pin = pins.led.into_push_pull_output();\n\n    loop {\n        led_pin.set_high().unwrap();\n        delay.delay_ms(1500);\n        led_pin.set_low().unwrap();\n        delay.delay_ms(1500);\n    }\n}\n"
  },
  {
    "path": "boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs",
    "content": "//! Rainbow effect color wheel using the onboard NeoPixel on a VCC-GND Studio YD-RP2040 board\n//!\n//! This flows smoothly through various colors on the onboard NeoPixel.\n//! Uses the `ws2812_pio` driver to control the NeoPixel, which in turns uses the\n//! RP2040's PIO block.\n#![no_std]\n#![no_main]\n\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse vcc_gnd_yd_rp2040::entry;\nuse vcc_gnd_yd_rp2040::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\nuse ws2812_pio::Ws2812;\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        // The onboard NeoPixel is attached to GPIO pin #16 on the Feather RP2040.\n        pins.neopixel.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite colour wheel loop\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/vcc-gnd-yd-rp2040/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp0Spi0Rx]          |\n    /// | `UART0 TX`   | [crate::Gp0Uart0Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp0I2C0Sda]         |\n    /// | `PWM0 A`     | [crate::Gp0Pwm0A]           |\n    /// | `PIO0`       | [crate::Gp0Pio0]            |\n    /// | `PIO1`       | [crate::Gp0Pio1]            |\n    Gpio0 {\n        name: gpio0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio0].\n            FunctionUart, PullNone: Gp0Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio0].\n            FunctionSpi, PullNone: Gp0Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio0].\n            FunctionI2C, PullUp: Gp0I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio0].\n            FunctionPwm, PullNone: Gp0Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio0, PullNone: Gp0Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio1, PullNone: Gp0Pio1\n        }\n    },\n\n    /// GPIO 1 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp1Spi0Csn]         |\n    /// | `UART0 RX`   | [crate::Gp1Uart0Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp1I2C0Scl]         |\n    /// | `PWM0 B`     | [crate::Gp1Pwm0B]           |\n    /// | `PIO0`       | [crate::Gp1Pio0]            |\n    /// | `PIO1`       | [crate::Gp1Pio1]            |\n    Gpio1 {\n        name: gpio1,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio1].\n            FunctionUart, PullNone: Gp1Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio1].\n            FunctionSpi, PullNone: Gp1Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio1].\n            FunctionI2C, PullUp: Gp1I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio1].\n            FunctionPwm, PullNone: Gp1Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio0, PullNone: Gp1Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio1, PullNone: Gp1Pio1\n        }\n    },\n\n    /// GPIO 2 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp2Spi0Sck]         |\n    /// | `UART0 CTS`  | [crate::Gp2Uart0Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp2I2C1Sda]         |\n    /// | `PWM1 A`     | [crate::Gp2Pwm1A]           |\n    /// | `PIO0`       | [crate::Gp2Pio0]            |\n    /// | `PIO1`       | [crate::Gp2Pio1]            |\n    Gpio2 {\n        name: gpio2,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio2].\n            FunctionUart, PullNone: Gp2Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio2].\n            FunctionSpi, PullNone: Gp2Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio2].\n            FunctionI2C, PullUp: Gp2I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio2].\n            FunctionPwm, PullNone: Gp2Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio0, PullNone: Gp2Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio1, PullNone: Gp2Pio1\n        }\n    },\n\n    /// GPIO 3 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp3Spi0Tx]          |\n    /// | `UART0 RTS`  | [crate::Gp3Uart0Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp3I2C1Scl]         |\n    /// | `PWM1 B`     | [crate::Gp3Pwm1B]           |\n    /// | `PIO0`       | [crate::Gp3Pio0]            |\n    /// | `PIO1`       | [crate::Gp3Pio1]            |\n    Gpio3 {\n        name: gpio3,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio3].\n            FunctionUart, PullNone: Gp3Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio3].\n            FunctionSpi, PullNone: Gp3Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio3].\n            FunctionI2C, PullUp: Gp3I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio3].\n            FunctionPwm, PullNone: Gp3Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio0, PullNone: Gp3Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio1, PullNone: Gp3Pio1\n        }\n    },\n\n    /// GPIO 4 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp4Spi0Rx]          |\n    /// | `UART1 TX`   | [crate::Gp4Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp4I2C0Sda]         |\n    /// | `PWM2 A`     | [crate::Gp4Pwm2A]           |\n    /// | `PIO0`       | [crate::Gp4Pio0]            |\n    /// | `PIO1`       | [crate::Gp4Pio1]            |\n    Gpio4 {\n        name: gpio4,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio4].\n            FunctionUart, PullNone: Gp4Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio4].\n            FunctionSpi, PullNone: Gp4Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio4].\n            FunctionI2C, PullUp: Gp4I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio4].\n            FunctionPwm, PullNone: Gp4Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio0, PullNone: Gp4Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio1, PullNone: Gp4Pio1\n        }\n    },\n\n    /// GPIO 5 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp5Spi0Csn]         |\n    /// | `UART1 RX`   | [crate::Gp5Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp5I2C0Scl]         |\n    /// | `PWM2 B`     | [crate::Gp5Pwm2B]           |\n    /// | `PIO0`       | [crate::Gp5Pio0]            |\n    /// | `PIO1`       | [crate::Gp5Pio1]            |\n    Gpio5 {\n        name: gpio5,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio5].\n            FunctionUart, PullNone: Gp5Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio5].\n            FunctionSpi, PullNone: Gp5Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio5].\n            FunctionI2C, PullUp: Gp5I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio5].\n            FunctionPwm, PullNone: Gp5Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio0, PullNone: Gp5Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio1, PullNone: Gp5Pio1\n        }\n    },\n\n    /// GPIO 6 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp6Spi0Sck]         |\n    /// | `UART1 CTS`  | [crate::Gp6Uart1Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp6I2C1Sda]         |\n    /// | `PWM3 A`     | [crate::Gp6Pwm3A]           |\n    /// | `PIO0`       | [crate::Gp6Pio0]            |\n    /// | `PIO1`       | [crate::Gp6Pio1]            |\n    Gpio6 {\n        name: gpio6,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio6].\n            FunctionUart, PullNone: Gp6Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio6].\n            FunctionSpi, PullNone: Gp6Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio6].\n            FunctionI2C, PullUp: Gp6I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio6].\n            FunctionPwm, PullNone: Gp6Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio0, PullNone: Gp6Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio1, PullNone: Gp6Pio1\n        }\n    },\n\n    /// GPIO 7 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp7Spi0Tx]          |\n    /// | `UART1 RTS`  | [crate::Gp7Uart1Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp7I2C1Scl]         |\n    /// | `PWM3 B`     | [crate::Gp7Pwm3B]           |\n    /// | `PIO0`       | [crate::Gp7Pio0]            |\n    /// | `PIO1`       | [crate::Gp7Pio1]            |\n    Gpio7 {\n        name: gpio7,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio7].\n            FunctionUart, PullNone: Gp7Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio7].\n            FunctionSpi, PullNone: Gp7Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio7].\n            FunctionI2C, PullUp: Gp7I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio7].\n            FunctionPwm, PullNone: Gp7Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio0, PullNone: Gp7Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio1, PullNone: Gp7Pio1\n        }\n    },\n\n    /// GPIO 8 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp8Spi1Rx]          |\n    /// | `UART1 TX`   | [crate::Gp8Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp8I2C0Sda]         |\n    /// | `PWM4 A`     | [crate::Gp8Pwm4A]           |\n    /// | `PIO0`       | [crate::Gp8Pio0]            |\n    /// | `PIO1`       | [crate::Gp8Pio1]            |\n    Gpio8 {\n        name: gpio8,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio8].\n            FunctionUart, PullNone: Gp8Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio8].\n            FunctionSpi, PullNone: Gp8Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio8].\n            FunctionI2C, PullUp: Gp8I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio8].\n            FunctionPwm, PullNone: Gp8Pwm4A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio0, PullNone: Gp8Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio1, PullNone: Gp8Pio1\n        }\n    },\n\n    /// GPIO 9 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp9Spi1Csn]         |\n    /// | `UART1 RX`   | [crate::Gp9Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp9I2C0Scl]         |\n    /// | `PWM4 B`     | [crate::Gp9Pwm4B]           |\n    /// | `PIO0`       | [crate::Gp9Pio0]            |\n    /// | `PIO1`       | [crate::Gp9Pio1]            |\n    Gpio9 {\n        name: gpio9,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio9].\n            FunctionUart, PullNone: Gp9Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio9].\n            FunctionSpi, PullNone: Gp9Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio9].\n            FunctionI2C, PullUp: Gp9I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio9].\n            FunctionPwm, PullNone: Gp9Pwm4B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio0, PullNone: Gp9Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio1, PullNone: Gp9Pio1\n        }\n    },\n\n    /// GPIO 10 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp10Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp10Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp10I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp10Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp10Pio0]           |\n    /// | `PIO1`       | [crate::Gp10Pio1]           |\n    Gpio10 {\n        name: gpio10,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio10].\n            FunctionUart, PullNone: Gp10Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio10].\n            FunctionSpi, PullNone: Gp10Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio10].\n            FunctionI2C, PullUp: Gp10I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio10].\n            FunctionPwm, PullNone: Gp10Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio10].\n            FunctionPio0, PullNone: Gp10Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio10].\n            FunctionPio1, PullNone: Gp10Pio1\n        }\n    },\n\n    /// GPIO 11 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp11Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp11Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp11I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp11Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp11Pio0]           |\n    /// | `PIO1`       | [crate::Gp11Pio1]           |\n    Gpio11 {\n        name: gpio11,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio11].\n            FunctionUart, PullNone: Gp11Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio11].\n            FunctionSpi, PullNone: Gp11Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio11].\n            FunctionI2C, PullUp: Gp11I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio11].\n            FunctionPwm, PullNone: Gp11Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio11].\n            FunctionPio0, PullNone: Gp11Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio11].\n            FunctionPio1, PullNone: Gp11Pio1\n        }\n    },\n\n    /// GPIO 12 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp12Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp12Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp12I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp12Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp12Pio0]           |\n    /// | `PIO1`       | [crate::Gp12Pio1]           |\n    Gpio12 {\n        name: gpio12,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio12].\n            FunctionUart, PullNone: Gp12Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio12].\n            FunctionSpi, PullNone: Gp12Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio12].\n            FunctionI2C, PullUp: Gp12I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio12].\n            FunctionPwm, PullNone: Gp12Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio0, PullNone: Gp12Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio1, PullNone: Gp12Pio1\n        }\n    },\n\n    /// GPIO 13 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp13Spi1Csn]        |\n    /// | `UART0 RX`   | [crate::Gp13Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp13I2C0Scl]        |\n    /// | `PWM6 B`     | [crate::Gp13Pwm6B]          |\n    /// | `PIO0`       | [crate::Gp13Pio0]           |\n    /// | `PIO1`       | [crate::Gp13Pio1]           |\n    Gpio13 {\n        name: gpio13,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio13].\n            FunctionUart, PullNone: Gp13Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio13].\n            FunctionSpi, PullNone: Gp13Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio13].\n            FunctionI2C, PullUp: Gp13I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio13].\n            FunctionPwm, PullNone: Gp13Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio0, PullNone: Gp13Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio1, PullNone: Gp13Pio1\n        }\n    },\n\n    /// GPIO 14 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp14Spi1Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp14Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp14I2C1Sda]        |\n    /// | `PWM7 A`     | [crate::Gp14Pwm7A]          |\n    /// | `PIO0`       | [crate::Gp14Pio0]           |\n    /// | `PIO1`       | [crate::Gp14Pio1]           |\n    Gpio14 {\n        name: gpio14,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio14].\n            FunctionUart, PullNone: Gp14Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio14].\n            FunctionSpi, PullNone: Gp14Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio14].\n            FunctionI2C, PullUp: Gp14I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio14].\n            FunctionPwm, PullNone: Gp14Pwm7A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio14].\n            FunctionPio0, PullNone: Gp14Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio14].\n            FunctionPio1, PullNone: Gp14Pio1\n        }\n    },\n\n    /// GPIO 15 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp15Spi1Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp15Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp15I2C1Scl]        |\n    /// | `PWM7 B`     | [crate::Gp15Pwm7B]          |\n    /// | `PIO0`       | [crate::Gp15Pio0]           |\n    /// | `PIO1`       | [crate::Gp15Pio1]           |\n    Gpio15 {\n        name: gpio15,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio15].\n            FunctionUart, PullNone: Gp15Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio15].\n            FunctionSpi, PullNone: Gp15Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio15].\n            FunctionI2C, PullUp: Gp15I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio15].\n            FunctionPwm, PullNone: Gp15Pwm7B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio0, PullNone: Gp15Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio1, PullNone: Gp15Pio1\n        }\n    },\n\n    /// GPIO 16 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp16Spi0Rx]         |\n    /// | `UART0 TX`   | [crate::Gp16Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp16I2C0Sda]        |\n    /// | `PWM0 A`     | [crate::Gp16Pwm0A]          |\n    /// | `PIO0`       | [crate::Gp16Pio0]           |\n    /// | `PIO1`       | [crate::Gp16Pio1]           |\n    Gpio16 {\n        name: gpio16,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio16].\n            FunctionUart, PullNone: Gp16Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio16].\n            FunctionSpi, PullNone: Gp16Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio16].\n            FunctionI2C, PullUp: Gp16I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio16].\n            FunctionPwm, PullNone: Gp16Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio16].\n            FunctionPio0, PullNone: Gp16Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio16].\n            FunctionPio1, PullNone: Gp16Pio1\n        }\n    },\n\n    /// GPIO 17 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp17Spi0Csn]        |\n    /// | `UART0 RX`   | [crate::Gp17Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp17I2C0Scl]        |\n    /// | `PWM0 B`     | [crate::Gp17Pwm0B]          |\n    /// | `PIO0`       | [crate::Gp17Pio0]           |\n    /// | `PIO1`       | [crate::Gp17Pio1]           |\n    Gpio17 {\n        name: gpio17,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio17].\n            FunctionUart, PullNone: Gp17Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio17].\n            FunctionSpi, PullNone: Gp17Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio17].\n            FunctionI2C, PullUp: Gp17I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio17].\n            FunctionPwm, PullNone: Gp17Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio0, PullNone: Gp17Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio1, PullNone: Gp17Pio1\n        }\n    },\n\n    /// GPIO 18 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp18Spi0Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp18Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp18I2C1Sda]        |\n    /// | `PWM1 A`     | [crate::Gp18Pwm1A]          |\n    /// | `PIO0`       | [crate::Gp18Pio0]           |\n    /// | `PIO1`       | [crate::Gp18Pio1]           |\n    Gpio18 {\n        name: gpio18,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio18].\n            FunctionUart, PullNone: Gp18Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio18].\n            FunctionSpi, PullNone: Gp18Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio18].\n            FunctionI2C, PullUp: Gp18I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio18].\n            FunctionPwm, PullNone: Gp18Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio0, PullNone: Gp18Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio1, PullNone: Gp18Pio1\n        }\n    },\n\n    /// GPIO 19 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp19Spi0Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp19Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp19I2C1Scl]        |\n    /// | `PWM1 B`     | [crate::Gp19Pwm1B]          |\n    /// | `PIO0`       | [crate::Gp19Pio0]           |\n    /// | `PIO1`       | [crate::Gp19Pio1]           |\n    Gpio19 {\n        name: gpio19,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio19].\n            FunctionUart, PullNone: Gp19Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio19].\n            FunctionSpi, PullNone: Gp19Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio19].\n            FunctionI2C, PullUp: Gp19I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio19].\n            FunctionPwm, PullNone: Gp19Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio0, PullNone: Gp19Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio1, PullNone: Gp19Pio1\n        }\n    },\n\n    /// GPIO 20 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp20Spi0Rx]         |\n    /// | `UART1 TX`   | [crate::Gp20Uart1Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp20I2C0Sda]        |\n    /// | `PWM2 A`     | [crate::Gp20Pwm2A]          |\n    /// | `PIO0`       | [crate::Gp20Pio0]           |\n    /// | `PIO1`       | [crate::Gp20Pio1]           |\n    Gpio20 {\n        name: gpio20,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio20].\n            FunctionUart, PullNone: Gp20Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio20].\n            FunctionSpi, PullNone: Gp20Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio20].\n            FunctionI2C, PullUp: Gp20I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio20].\n            FunctionPwm, PullNone: Gp20Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio0, PullNone: Gp20Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio1, PullNone: Gp20Pio1\n        }\n    },\n\n    /// GPIO 21 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp21Spi0Csn]        |\n    /// | `UART1 RX`   | [crate::Gp21Uart1Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp21I2C0Scl]        |\n    /// | `PWM2 B`     | [crate::Gp21Pwm2B]          |\n    /// | `PIO0`       | [crate::Gp21Pio0]           |\n    /// | `PIO1`       | [crate::Gp21Pio1]           |\n    Gpio21 {\n        name: gpio21,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio21].\n            FunctionUart, PullNone: Gp21Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio21].\n            FunctionSpi, PullNone: Gp21Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio21].\n            FunctionI2C, PullUp: Gp21I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio21].\n            FunctionPwm, PullNone: Gp21Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio0, PullNone: Gp21Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio1, PullNone: Gp21Pio1\n        }\n    },\n\n    /// GPIO 22 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp22Spi0Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp22Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp22I2C1Sda]        |\n    /// | `PWM3 A`     | [crate::Gp22Pwm3A]          |\n    /// | `PIO0`       | [crate::Gp22Pio0]           |\n    /// | `PIO1`       | [crate::Gp22Pio1]           |\n    Gpio22 {\n        name: gpio22,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio22].\n            FunctionUart, PullNone: Gp22Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio22].\n            FunctionSpi, PullNone: Gp22Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio22].\n            FunctionI2C, PullUp: Gp22I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio22].\n            FunctionPwm, PullNone: Gp22Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio0, PullNone: Gp22Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio1, PullNone: Gp22Pio1\n        }\n    },\n\n    /// GPIO 23 is connected to the WS2812 RGB LED of the YD-RP2040 board.\n    Gpio23 {\n        name: neopixel,\n    },\n\n    /// GPIO 24 is connected to the user key of the YD-RP2040 board.\n    Gpio24 {\n        name: user_key,\n    },\n\n    /// GPIO 25 is connected to the blue LED of the YD-RP2040 board.\n    Gpio25 {\n        name: led,\n    },\n\n    /// GPIO 26 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp26Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp26Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp26I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp26Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp26Pio0]           |\n    /// | `PIO1`       | [crate::Gp26Pio1]           |\n    Gpio26 {\n        name: gpio26,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio26].\n            FunctionUart, PullNone: Gp26Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio26].\n            FunctionSpi, PullNone: Gp26Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio26].\n            FunctionPwm, PullNone: Gp26Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio0, PullNone: Gp26Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio1, PullNone: Gp26Pio1\n        }\n    },\n\n    /// GPIO 27 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp27Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp27Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp27I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp27Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp27Pio0]           |\n    /// | `PIO1`       | [crate::Gp27Pio1]           |\n    Gpio27 {\n        name: gpio27,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio27].\n            FunctionUart, PullNone: Gp27Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio27].\n            FunctionSpi, PullNone: Gp27Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio27].\n            FunctionPwm, PullNone: Gp27Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio0, PullNone: Gp27Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio1, PullNone: Gp27Pio1\n        }\n    },\n\n    /// GPIO 28 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp28Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp28Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp28I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp28Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp28Pio0]           |\n    /// | `PIO1`       | [crate::Gp28Pio1]           |\n    Gpio28 {\n        name: gpio28,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp28Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp28Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp28I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp28Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp28Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp28Pio1\n        }\n    },\n\n    /// GPIO 29 is connected to voltage_monitor of the YD-RP2040 board.\n    Gpio29 {\n        name: gpio29,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio29].\n            FunctionUart, PullNone: Gp29Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio29].\n            FunctionSpi, PullNone: Gp29Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio29].\n            FunctionI2C, PullUp: Gp29I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio29].\n            FunctionPwm, PullNone: Gp29Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio29].\n            FunctionPio0, PullNone: Gp29Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio29].\n            FunctionPio1, PullNone: Gp29Pio1\n        }\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/waveshare-rp2040-lcd-0-96/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.8.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.7.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n\n## 0.6.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n\n## 0.5.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n\n## 0.4.0 - 2022-11-15\n\n### Changed\n\n- Inital release\n- Copied from waveshare-rp2040-zero\n- Update board name\n\n"
  },
  {
    "path": "boards/waveshare-rp2040-lcd-0-96/Cargo.toml",
    "content": "[package]\nname = \"waveshare-rp2040-lcd-0-96\"\nversion = \"0.8.0\"\nauthors = [\"René van Dorst <opensource@vdorst.com>\", \"Andrea Nall <anall@andreanal.com>\", \"TilCreator <contact.github@tc-j.de>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/waveshare-rp2040-lcd-0_96\"\ndescription = \"Board Support Package for the Waveshare RP2040 LCD 0.96 inch\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\npanic-halt.workspace = true\nembedded-hal.workspace = true\nfugit.workspace = true\nnb.workspace = true\nembedded-graphics.workspace = true\nst7735-lcd = { workspace = true, features = [\"graphics\"] }\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/waveshare-rp2040-lcd-0-96/README.md",
    "content": "# [waveshare-rp2040-lcd-0-96] - Board Support for the [Waveshare RP2040 LCD 0.96]\n\nYou should include this crate if you are writing code that you want to run on\nan [Waveshare RP2040 LCD 0.96] - a very small RP2040 breakout board with USB-C, \na 65K IPS LCD 160x80, 16MBit Flash and 1A battery charger from Waveshare.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Feather.\n\n[Waveshare RP2040 LCD 0.96]: https://www.waveshare.com/wiki/RP2040-LCD-0.96\n[waveshare-rp2040-lcd-0-96]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/waveshare-rp2040-lcd-0-96\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nwaveshare-rp2040-lcd-0-96 = \"0.8.0\"\n```\n\nIn your program, you will need to call `waveshare_rp2040_lcd_0_96::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/waveshare-rp2040-lcd-0-96 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/waveshare-rp2040-lcd-0-96 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [waveshare_rp2040_lcd_demo](./examples/waveshare_rp2040_lcd_demo.rs)\n\nDraws a red and green line with a blue regtangle.\nAfter that is fills the screen line for line, that end it starts over with an\nother colour, RED, GREEN and BLUE.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe, learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/waveshare-rp2040-lcd-0-96/examples/waveshare_rp2040_lcd_demo.rs",
    "content": "//! Example of graphics on the LCD of the Waveshare RP2040-LCD-0.96\n//!\n//! Draws a red and green line with a blue rectangle.\n//! After that it fills the screen line for line, at the end it starts over with\n//! another colour, RED, GREEN and BLUE.\n#![no_std]\n#![no_main]\n\nuse cortex_m::delay::Delay;\nuse embedded_graphics::primitives::Line;\nuse fugit::RateExtU32;\nuse panic_halt as _;\n\nuse waveshare_rp2040_lcd_0_96::entry;\nuse waveshare_rp2040_lcd_0_96::{\n    hal::{\n        self,\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\n\nuse embedded_graphics::{\n    pixelcolor::Rgb565,\n    prelude::*,\n    primitives::{PrimitiveStyle, PrimitiveStyleBuilder, Rectangle},\n};\nuse st7735_lcd::{Orientation, ST7735};\n\nconst LCD_WIDTH: u32 = 160;\nconst LCD_HEIGHT: u32 = 80;\n\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Set up the delay for the first core.\n    let sys_freq = clocks.system_clock.freq().to_Hz();\n    let mut delay = Delay::new(core.SYST, sys_freq);\n\n    let (mut _pio, _sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n\n    // https://www.waveshare.com/wiki/RP2040-LCD-0.96\n    // ST7735S LCD\n    let lcd_dc = pins.gp8.into_push_pull_output();\n    let lcd_clk = pins.gp10.into_function::<hal::gpio::FunctionSpi>();\n    let lcd_mosi = pins.gp11.into_function::<hal::gpio::FunctionSpi>();\n    let lcd_rst = pins\n        .gp12\n        .into_push_pull_output_in_state(hal::gpio::PinState::High);\n    let mut _lcd_bl = pins\n        .gp25\n        .into_push_pull_output_in_state(hal::gpio::PinState::High);\n\n    let spi = hal::Spi::<_, _, _, 8>::new(pac.SPI1, (lcd_mosi, lcd_clk));\n\n    // Exchange the uninitialised SPI driver for an initialised one\n    let spi = spi.init(\n        &mut pac.RESETS,\n        clocks.peripheral_clock.freq(),\n        10.MHz(),\n        embedded_hal::spi::MODE_0,\n    );\n\n    // LCD is a 65K IPS LCD 160x80, color order is BGR and a offset 1,26 pixel.\n    // LCD controller can correct this by settings the order bit (bit 3) in MADCTL register.\n    // Also the colours are inverted, LCD controller can also correct this by writing to INVON register with no paramters.\n    // All this is handled by the ST7735 crate.\n    let mut display = ST7735::new(spi, lcd_dc, lcd_rst, false, true, LCD_WIDTH, LCD_HEIGHT);\n\n    display.init(&mut delay).unwrap();\n    display.set_orientation(&Orientation::Landscape).unwrap();\n\n    display.set_offset(1, 26);\n\n    let lcd_zero = Point::zero();\n    let lcd_max_corner = Point::new((LCD_WIDTH - 1) as i32, (LCD_HEIGHT - 1) as i32);\n\n    let style = PrimitiveStyleBuilder::new()\n        .fill_color(Rgb565::BLUE)\n        .build();\n\n    Rectangle::with_corners(lcd_zero, lcd_max_corner)\n        .into_styled(style)\n        .draw(&mut display)\n        .unwrap();\n\n    let style = PrimitiveStyleBuilder::new()\n        .fill_color(Rgb565::BLACK)\n        .build();\n\n    Rectangle::with_corners(\n        Point::new(1, 1),\n        Point::new((LCD_WIDTH - 2) as i32, (LCD_HEIGHT - 2) as i32),\n    )\n    .into_styled(style)\n    .draw(&mut display)\n    .unwrap();\n\n    Line::new(lcd_zero, lcd_max_corner)\n        .into_styled(PrimitiveStyle::with_stroke(Rgb565::RED, 1))\n        .draw(&mut display)\n        .unwrap();\n\n    Line::new(\n        Point::new(0, (LCD_HEIGHT - 1) as i32),\n        Point::new((LCD_WIDTH - 1) as i32, 0),\n    )\n    .into_styled(PrimitiveStyle::with_stroke(Rgb565::GREEN, 1))\n    .draw(&mut display)\n    .unwrap();\n\n    // Infinite colour wheel loop\n    let mut l: i32 = 0;\n    let mut c = Rgb565::RED;\n    loop {\n        Line::new(Point::new(0, l), Point::new((LCD_WIDTH - 1) as i32, l))\n            .into_styled(PrimitiveStyle::with_stroke(c, 1))\n            .draw(&mut display)\n            .unwrap();\n        delay.delay_ms(10);\n        l += 1;\n        if l == LCD_HEIGHT as i32 {\n            l = 0;\n            c = match c {\n                Rgb565::RED => Rgb565::GREEN,\n                Rgb565::GREEN => Rgb565::BLUE,\n                _ => Rgb565::RED,\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "boards/waveshare-rp2040-lcd-0-96/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp0Spi0Rx]          |\n    /// | `UART0 TX`   | [crate::Gp0Uart0Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp0I2C0Sda]         |\n    /// | `PWM0 A`     | [crate::Gp0Pwm0A]           |\n    /// | `PIO0`       | [crate::Gp0Pio0]            |\n    /// | `PIO1`       | [crate::Gp0Pio1]            |\n    Gpio0 {\n        name: gp0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio0].\n            FunctionUart, PullNone: Gp0Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio0].\n            FunctionSpi, PullNone: Gp0Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio0].\n            FunctionI2C, PullUp: Gp0I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio0].\n            FunctionPwm, PullNone: Gp0Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio0, PullNone: Gp0Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio1, PullNone: Gp0Pio1\n        }\n    },\n\n    /// GPIO 1 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp1Spi0Csn]         |\n    /// | `UART0 RX`   | [crate::Gp1Uart0Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp1I2C0Scl]         |\n    /// | `PWM0 B`     | [crate::Gp1Pwm0B]           |\n    /// | `PIO0`       | [crate::Gp1Pio0]            |\n    /// | `PIO1`       | [crate::Gp1Pio1]            |\n    Gpio1 {\n        name: gp1,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio1].\n            FunctionUart, PullNone: Gp1Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio1].\n            FunctionSpi, PullNone: Gp1Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio1].\n            FunctionI2C, PullUp: Gp1I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio1].\n            FunctionPwm, PullNone: Gp1Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio0, PullNone: Gp1Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio1, PullNone: Gp1Pio1\n        }\n    },\n\n    /// GPIO 2 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp2Spi0Sck]         |\n    /// | `UART0 CTS`  | [crate::Gp2Uart0Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp2I2C1Sda]         |\n    /// | `PWM1 A`     | [crate::Gp2Pwm1A]           |\n    /// | `PIO0`       | [crate::Gp2Pio0]            |\n    /// | `PIO1`       | [crate::Gp2Pio1]            |\n    Gpio2 {\n        name: gp2,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio2].\n            FunctionUart, PullNone: Gp2Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio2].\n            FunctionSpi, PullNone: Gp2Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio2].\n            FunctionI2C, PullUp: Gp2I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio2].\n            FunctionPwm, PullNone: Gp2Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio0, PullNone: Gp2Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio1, PullNone: Gp2Pio1\n        }\n    },\n\n    /// GPIO 3 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp3Spi0Tx]          |\n    /// | `UART0 RTS`  | [crate::Gp3Uart0Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp3I2C1Scl]         |\n    /// | `PWM1 B`     | [crate::Gp3Pwm1B]           |\n    /// | `PIO0`       | [crate::Gp3Pio0]            |\n    /// | `PIO1`       | [crate::Gp3Pio1]            |\n    Gpio3 {\n        name: gp3,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio3].\n            FunctionUart, PullNone: Gp3Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio3].\n            FunctionSpi, PullNone: Gp3Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio3].\n            FunctionI2C, PullUp: Gp3I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio3].\n            FunctionPwm, PullNone: Gp3Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio0, PullNone: Gp3Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio1, PullNone: Gp3Pio1\n        }\n    },\n\n    /// GPIO 4 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp4Spi0Rx]          |\n    /// | `UART1 TX`   | [crate::Gp4Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp4I2C0Sda]         |\n    /// | `PWM2 A`     | [crate::Gp4Pwm2A]           |\n    /// | `PIO0`       | [crate::Gp4Pio0]            |\n    /// | `PIO1`       | [crate::Gp4Pio1]            |\n    Gpio4 {\n        name: gp4,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio4].\n            FunctionUart, PullNone: Gp4Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio4].\n            FunctionSpi, PullNone: Gp4Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio4].\n            FunctionI2C, PullUp: Gp4I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio4].\n            FunctionPwm, PullNone: Gp4Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio0, PullNone: Gp4Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio1, PullNone: Gp4Pio1\n        }\n    },\n\n    /// GPIO 5 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp5Spi0Csn]         |\n    /// | `UART1 RX`   | [crate::Gp5Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp5I2C0Scl]         |\n    /// | `PWM2 B`     | [crate::Gp5Pwm2B]           |\n    /// | `PIO0`       | [crate::Gp5Pio0]            |\n    /// | `PIO1`       | [crate::Gp5Pio1]            |\n    Gpio5 {\n        name: gp5,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio5].\n            FunctionUart, PullNone: Gp5Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio5].\n            FunctionSpi, PullNone: Gp5Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio5].\n            FunctionI2C, PullUp: Gp5I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio5].\n            FunctionPwm, PullNone: Gp5Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio0, PullNone: Gp5Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio1, PullNone: Gp5Pio1\n        }\n    },\n\n    /// GPIO 6 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp6Spi0Sck]         |\n    /// | `UART1 CTS`  | [crate::Gp6Uart1Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp6I2C1Sda]         |\n    /// | `PWM3 A`     | [crate::Gp6Pwm3A]           |\n    /// | `PIO0`       | [crate::Gp6Pio0]            |\n    /// | `PIO1`       | [crate::Gp6Pio1]            |\n    Gpio6 {\n        name: gp6,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio6].\n            FunctionUart, PullNone: Gp6Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio6].\n            FunctionSpi, PullNone: Gp6Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio6].\n            FunctionI2C, PullUp: Gp6I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio6].\n            FunctionPwm, PullNone: Gp6Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio0, PullNone: Gp6Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio1, PullNone: Gp6Pio1\n        }\n    },\n\n    /// GPIO 7 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp7Spi0Tx]          |\n    /// | `UART1 RTS`  | [crate::Gp7Uart1Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp7I2C1Scl]         |\n    /// | `PWM3 B`     | [crate::Gp7Pwm3B]           |\n    /// | `PIO0`       | [crate::Gp7Pio0]            |\n    /// | `PIO1`       | [crate::Gp7Pio1]            |\n    Gpio7 {\n        name: gp7,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio7].\n            FunctionUart, PullNone: Gp7Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio7].\n            FunctionSpi, PullNone: Gp7Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio7].\n            FunctionI2C, PullUp: Gp7I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio7].\n            FunctionPwm, PullNone: Gp7Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio0, PullNone: Gp7Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio1, PullNone: Gp7Pio1\n        }\n    },\n\n    /// GPIO 8 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp8Spi1Rx]          |\n    /// | `UART1 TX`   | [crate::Gp8Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp8I2C0Sda]         |\n    /// | `PWM4 A`     | [crate::Gp8Pwm4A]           |\n    /// | `PIO0`       | [crate::Gp8Pio0]            |\n    /// | `PIO1`       | [crate::Gp8Pio1]            |\n    Gpio8 {\n        name: gp8,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio8].\n            FunctionUart, PullNone: Gp8Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio8].\n            FunctionSpi, PullNone: Gp8Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio8].\n            FunctionI2C, PullUp: Gp8I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio8].\n            FunctionPwm, PullNone: Gp8Pwm4A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio0, PullNone: Gp8Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio1, PullNone: Gp8Pio1\n        }\n    },\n\n    /// GPIO 9 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp9Spi1Csn]         |\n    /// | `UART1 RX`   | [crate::Gp9Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp9I2C0Scl]         |\n    /// | `PWM4 B`     | [crate::Gp9Pwm4B]           |\n    /// | `PIO0`       | [crate::Gp9Pio0]            |\n    /// | `PIO1`       | [crate::Gp9Pio1]            |\n    Gpio9 {\n        name: gp9,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio9].\n            FunctionUart, PullNone: Gp9Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio9].\n            FunctionSpi, PullNone: Gp9Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio9].\n            FunctionI2C, PullUp: Gp9I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio9].\n            FunctionPwm, PullNone: Gp9Pwm4B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio0, PullNone: Gp9Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio1, PullNone: Gp9Pio1\n        }\n    },\n\n    /// GPIO 10 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp10Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp10Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp10I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp10Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp10Pio0]           |\n    /// | `PIO1`       | [crate::Gp10Pio1]           |\n    Gpio10 {\n        name: gp10,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio10].\n            FunctionUart, PullNone: Gp10Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio10].\n            FunctionSpi, PullNone: Gp10Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio10].\n            FunctionI2C, PullUp: Gp10I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio10].\n            FunctionPwm, PullNone: Gp10Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio10].\n            FunctionPio0, PullNone: Gp10Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio10].\n            FunctionPio1, PullNone: Gp10Pio1\n        }\n    },\n\n    /// GPIO 11 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp11Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp11Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp11I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp11Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp11Pio0]           |\n    /// | `PIO1`       | [crate::Gp11Pio1]           |\n    Gpio11 {\n        name: gp11,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio11].\n            FunctionUart, PullNone: Gp11Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio11].\n            FunctionSpi, PullNone: Gp11Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio11].\n            FunctionI2C, PullUp: Gp11I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio11].\n            FunctionPwm, PullNone: Gp11Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio11].\n            FunctionPio0, PullNone: Gp11Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio11].\n            FunctionPio1, PullNone: Gp11Pio1\n        }\n    },\n\n    /// GPIO 12 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp12Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp12Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp12I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp12Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp12Pio0]           |\n    /// | `PIO1`       | [crate::Gp12Pio1]           |\n    Gpio12 {\n        name: gp12,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio12].\n            FunctionUart, PullNone: Gp12Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio12].\n            FunctionSpi, PullNone: Gp12Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio12].\n            FunctionI2C, PullUp: Gp12I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio12].\n            FunctionPwm, PullNone: Gp12Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio0, PullNone: Gp12Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio1, PullNone: Gp12Pio1\n        }\n    },\n\n    /// GPIO 13 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp13Spi1Csn]        |\n    /// | `UART0 RX`   | [crate::Gp13Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp13I2C0Scl]        |\n    /// | `PWM6 B`     | [crate::Gp13Pwm6B]          |\n    /// | `PIO0`       | [crate::Gp13Pio0]           |\n    /// | `PIO1`       | [crate::Gp13Pio1]           |\n    Gpio13 {\n        name: gp13,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio13].\n            FunctionUart, PullNone: Gp13Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio13].\n            FunctionSpi, PullNone: Gp13Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio13].\n            FunctionI2C, PullUp: Gp13I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio13].\n            FunctionPwm, PullNone: Gp13Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio0, PullNone: Gp13Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio1, PullNone: Gp13Pio1\n        }\n    },\n\n    /// GPIO 14 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp14Spi1Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp14Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp14I2C1Sda]        |\n    /// | `PWM7 A`     | [crate::Gp14Pwm7A]          |\n    /// | `PIO0`       | [crate::Gp14Pio0]           |\n    /// | `PIO1`       | [crate::Gp14Pio1]           |\n    Gpio14 {\n        name: gp14,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio14].\n            FunctionUart, PullNone: Gp14Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio14].\n            FunctionSpi, PullNone: Gp14Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio14].\n            FunctionI2C, PullUp: Gp14I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio14].\n            FunctionPwm, PullNone: Gp14Pwm7A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio14].\n            FunctionPio0, PullNone: Gp14Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio14].\n            FunctionPio1, PullNone: Gp14Pio1\n        }\n    },\n\n    /// GPIO 15 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp15Spi1Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp15Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp15I2C1Scl]        |\n    /// | `PWM7 B`     | [crate::Gp15Pwm7B]          |\n    /// | `PIO0`       | [crate::Gp15Pio0]           |\n    /// | `PIO1`       | [crate::Gp15Pio1]           |\n    Gpio15 {\n        name: gp15,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio15].\n            FunctionUart, PullNone: Gp15Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio15].\n            FunctionSpi, PullNone: Gp15Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio15].\n            FunctionI2C, PullUp: Gp15I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio15].\n            FunctionPwm, PullNone: Gp15Pwm7B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio0, PullNone: Gp15Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio1, PullNone: Gp15Pio1\n        }\n    },\n\n    /// GPIO 16 is connected internally to a single Neopixel RGB LED\n    Gpio16 { name: neopixel },\n\n    /// GPIO 17 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp17Spi0Csn]        |\n    /// | `UART0 RX`   | [crate::Gp17Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp17I2C0Scl]        |\n    /// | `PWM0 B`     | [crate::Gp17Pwm0B]          |\n    /// | `PIO0`       | [crate::Gp17Pio0]           |\n    /// | `PIO1`       | [crate::Gp17Pio1]           |\n    Gpio17 {\n        name: gpio17,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio17].\n            FunctionUart, PullNone: Gp17Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio17].\n            FunctionSpi, PullNone: Gp17Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio17].\n            FunctionI2C, PullUp: Gp17I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio17].\n            FunctionPwm, PullNone: Gp17Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio0, PullNone: Gp17Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio1, PullNone: Gp17Pio1\n        }\n    },\n\n    /// GPIO 18 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp18Spi0Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp18Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp18I2C1Sda]        |\n    /// | `PWM1 A`     | [crate::Gp18Pwm1A]          |\n    /// | `PIO0`       | [crate::Gp18Pio0]           |\n    /// | `PIO1`       | [crate::Gp18Pio1]           |\n    Gpio18 {\n        name: gpio18,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio18].\n            FunctionUart, PullNone: Gp18Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio18].\n            FunctionSpi, PullNone: Gp18Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio18].\n            FunctionI2C, PullUp: Gp18I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio18].\n            FunctionPwm, PullNone: Gp18Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio0, PullNone: Gp18Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio1, PullNone: Gp18Pio1\n        }\n    },\n\n    /// GPIO 19 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp19Spi0Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp19Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp19I2C1Scl]        |\n    /// | `PWM1 B`     | [crate::Gp19Pwm1B]          |\n    /// | `PIO0`       | [crate::Gp19Pio0]           |\n    /// | `PIO1`       | [crate::Gp19Pio1]           |\n    Gpio19 {\n        name: gpio19,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio19].\n            FunctionUart, PullNone: Gp19Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio19].\n            FunctionSpi, PullNone: Gp19Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio19].\n            FunctionI2C, PullUp: Gp19I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio19].\n            FunctionPwm, PullNone: Gp19Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio0, PullNone: Gp19Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio1, PullNone: Gp19Pio1\n        }\n    },\n\n    /// GPIO 20 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp20Spi0Rx]         |\n    /// | `UART1 TX`   | [crate::Gp20Uart1Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp20I2C0Sda]        |\n    /// | `PWM2 A`     | [crate::Gp20Pwm2A]          |\n    /// | `PIO0`       | [crate::Gp20Pio0]           |\n    /// | `PIO1`       | [crate::Gp20Pio1]           |\n    Gpio20 {\n        name: gpio20,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio20].\n            FunctionUart, PullNone: Gp20Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio20].\n            FunctionSpi, PullNone: Gp20Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio20].\n            FunctionI2C, PullUp: Gp20I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio20].\n            FunctionPwm, PullNone: Gp20Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio0, PullNone: Gp20Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio1, PullNone: Gp20Pio1\n        }\n    },\n\n    /// GPIO 21 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp21Spi0Csn]        |\n    /// | `UART1 RX`   | [crate::Gp21Uart1Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp21I2C0Scl]        |\n    /// | `PWM2 B`     | [crate::Gp21Pwm2B]          |\n    /// | `PIO0`       | [crate::Gp21Pio0]           |\n    /// | `PIO1`       | [crate::Gp21Pio1]           |\n    Gpio21 {\n        name: gpio21,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio21].\n            FunctionUart, PullNone: Gp21Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio21].\n            FunctionSpi, PullNone: Gp21Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio21].\n            FunctionI2C, PullUp: Gp21I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio21].\n            FunctionPwm, PullNone: Gp21Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio0, PullNone: Gp21Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio1, PullNone: Gp21Pio1\n        }\n    },\n\n    /// GPIO 22 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp22Spi0Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp22Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp22I2C1Sda]        |\n    /// | `PWM3 A`     | [crate::Gp22Pwm3A]          |\n    /// | `PIO0`       | [crate::Gp22Pio0]           |\n    /// | `PIO1`       | [crate::Gp22Pio1]           |\n    Gpio22 {\n        name: gpio22,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio22].\n            FunctionUart, PullNone: Gp22Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio22].\n            FunctionSpi, PullNone: Gp22Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio22].\n            FunctionI2C, PullUp: Gp22I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio22].\n            FunctionPwm, PullNone: Gp22Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio0, PullNone: Gp22Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio1, PullNone: Gp22Pio1\n        }\n    },\n\n    /// GPIO 23\n    Gpio23 {\n        name: gp23,\n        aliases: {\n            FunctionUart, PullNone: Gp23Uart1Rts,\n            FunctionSpi, PullNone: Gp23Spi0Tx,\n            FunctionI2C, PullUp: Gp23I2C1Scl,\n            FunctionPwm, PullNone: Gp23Pwm3B,\n            FunctionPio0, PullNone: Gp23Pio0,\n            FunctionPio1, PullNone: Gp23Pio1\n        }\n    },\n\n    /// GPIO 24\n    Gpio24 {\n        name: gp24,\n        aliases: {\n            FunctionUart, PullNone: Gp24Uart1Tx,\n            FunctionSpi, PullNone: Gp24Spi1Rx,\n            FunctionI2C, PullUp: Gp24I2C0Sda,\n            FunctionPwm, PullNone: Gp24Pwm4A,\n            FunctionPio0, PullNone: Gp24Pio0,\n            FunctionPio1, PullNone: Gp24Pio1\n        }\n    },\n\n    /// GPIO 25\n    Gpio25 {\n        name: gp25,\n        aliases: {\n            FunctionUart, PullNone: Gp25Uart1Rx,\n            FunctionSpi, PullNone: Gp25Spi1Csn,\n            FunctionI2C, PullUp: Gp25I2C0Scl,\n            FunctionPwm, PullNone: Gp25Pwm4B,\n            FunctionPio0, PullNone: Gp25Pio0,\n            FunctionPio1, PullNone: Gp25Pio1\n        }\n    },\n\n    /// GPIO 26 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp26Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp26Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp26I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp26Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp26Pio0]           |\n    /// | `PIO1`       | [crate::Gp26Pio1]           |\n    ///\n    /// ADC0\n    Gpio26 {\n        name: gp26,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio26].\n            FunctionUart, PullNone: Gp26Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio26].\n            FunctionSpi, PullNone: Gp26Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio26].\n            FunctionPwm, PullNone: Gp26Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio0, PullNone: Gp26Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio1, PullNone: Gp26Pio1\n        }\n    },\n\n    /// GPIO 27 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp27Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp27Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp27I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp27Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp27Pio0]           |\n    /// | `PIO1`       | [crate::Gp27Pio1]           |\n    ///\n    /// ADC1\n    Gpio27 {\n        name: gp27,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio27].\n            FunctionUart, PullNone: Gp27Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio27].\n            FunctionSpi, PullNone: Gp27Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio27].\n            FunctionPwm, PullNone: Gp27Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio0, PullNone: Gp27Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio1, PullNone: Gp27Pio1\n        }\n    },\n\n    /// GPIO 28 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp28Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp28Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp28I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp28Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp28Pio0]           |\n    /// | `PIO1`       | [crate::Gp28Pio1]           |\n    ///\n    /// ADC2\n    Gpio28 {\n        name: gp28,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp28Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp28Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp28I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp28Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp28Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp28Pio1\n        }\n    },\n\n    /// GPIO 29\n    ///\n    /// ADC3\n    Gpio29 {\n        name: gp29,\n        aliases: {\n            FunctionUart, PullNone: Gp29Uart0Rx,\n            FunctionSpi, PullNone: Gp29Spi1Csn,\n            FunctionI2C, PullUp: Gp29I2C0Scl,\n            FunctionPwm, PullNone: Gp29Pwm6B,\n            FunctionPio0, PullNone: Gp29Pio0,\n            FunctionPio1, PullNone: Gp29Pio1\n        }\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/waveshare-rp2040-lcd-1-28/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.1.0 - 2024-07-29\n\n### Changed\n\n- Inital release\n- Copied from waveshare-rp2040-0.96\n- Update board name\n\n"
  },
  {
    "path": "boards/waveshare-rp2040-lcd-1-28/Cargo.toml",
    "content": "[package]\nname = \"waveshare-rp2040-lcd-1-28\"\nversion = \"0.8.0\"\nauthors = [\"René van Dorst <opensource@vdorst.com>\", \"Andrea Nall <anall@andreanal.com>\", \"TilCreator <contact.github@tc-j.de>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/waveshare-rp2040-lcd-0_96\"\ndescription = \"Board Support Package for the Waveshare RP2040 LCD 0.96 inch\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\npanic-halt.workspace = true\nembedded-hal.workspace = true\nfugit.workspace = true\nnb.workspace = true\nembedded-graphics.workspace = true\ngc9a01a_driver = { workspace = true }\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/waveshare-rp2040-lcd-1-28/README.md",
    "content": "# [waveshare-rp2040-lcd-1-28] - Board Support for the [Waveshare RP2040 LCD 1.28]\n\nYou should include this crate if you are writing code that you want to run on\nan [Waveshare RP2040 LCD 1.28] - a very small RP2040 breakout board with USB-C, \na 65K IPS LCD 240x240, 16MBit Flash and 1A battery charger from Waveshare.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Feather.\n\n[Waveshare RP2040 LCD 1.28]: https://www.waveshare.com/wiki/RP2040-LCD-1.28\n[waveshare-rp2040-lcd-1-28]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/waveshare-rp2040-lcd-1-28\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nwaveshare_rp2040_lcd_1_28 = \"0.8.0\"\n```\n\nIn your program, you will need to call `waveshare_rp2040_lcd_1_28::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/waveshare-rp2040-lcd-1-28 $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/waveshare-rp2040-lcd-1-28 $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [waveshare_rp2040_lcd_demo](./examples/waveshare_rp2040_lcd_demo.rs)\n\nDraws a red and green line with a blue regtangle.\nAfter that is fills the screen line for line, that end it starts over with an\nother colour, RED, GREEN and BLUE.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe, learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/waveshare-rp2040-lcd-1-28/examples/waveshare_rp2040_lcd_demo.rs",
    "content": "//! Example of graphics on the LCD of the Waveshare RP2040-LCD-1.28\n//!\n//! Draws a red and green line with a blue rectangle.\n//! After that it fills the screen line for line, at the end it starts over with\n//! another colour, RED, GREEN and BLUE.\n#![no_std]\n#![no_main]\n\nuse cortex_m::delay::Delay;\nuse fugit::RateExtU32;\nuse gc9a01a_driver::{Orientation, GC9A01A};\nuse panic_halt as _;\n\nuse waveshare_rp2040_lcd_1_28::entry;\nuse waveshare_rp2040_lcd_1_28::{\n    hal::{\n        self,\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\n\nuse embedded_graphics::{\n    pixelcolor::Rgb565,\n    prelude::*,\n    primitives::{Line, PrimitiveStyle, PrimitiveStyleBuilder, Rectangle},\n};\n\nconst LCD_WIDTH: u32 = 240;\nconst LCD_HEIGHT: u32 = 240;\n// Define static buffers\n\n/// Main entry point for the application\n#[entry]\nfn main() -> ! {\n    // Take ownership of peripheral instances\n    let mut pac = pac::Peripherals::take().unwrap();\n    let core = pac::CorePeripherals::take().unwrap();\n\n    // Initialize watchdog\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    // Initialize clocks and PLLs\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    // Initialize SIO\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    // Set up the delay for the first core\n    let sys_freq = clocks.system_clock.freq().to_Hz();\n    let mut delay = Delay::new(core.SYST, sys_freq);\n\n    let (mut _pio, _sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n\n    // Initialize LCD pins\n    let lcd_dc = pins.gp8.into_push_pull_output();\n    let lcd_cs = pins.gp9.into_push_pull_output();\n    let lcd_clk = pins.gp10.into_function::<hal::gpio::FunctionSpi>();\n    let lcd_mosi = pins.gp11.into_function::<hal::gpio::FunctionSpi>();\n    let lcd_rst = pins\n        .gp12\n        .into_push_pull_output_in_state(hal::gpio::PinState::High);\n    let mut _lcd_bl = pins\n        .gp25\n        .into_push_pull_output_in_state(hal::gpio::PinState::Low);\n\n    // Initialize SPI\n    let spi = hal::Spi::<_, _, _, 8>::new(pac.SPI1, (lcd_mosi, lcd_clk));\n    let spi = spi.init(\n        &mut pac.RESETS,\n        clocks.peripheral_clock.freq(),\n        40.MHz(),\n        embedded_hal::spi::MODE_0,\n    );\n\n    // Initialize the display\n    let mut display = GC9A01A::new(spi, lcd_dc, lcd_cs, lcd_rst, false, LCD_WIDTH, LCD_HEIGHT);\n    display.init(&mut delay).unwrap();\n    display.set_orientation(&Orientation::Landscape).unwrap();\n\n    // Clear the screen before turning on the backlight\n    display.clear(Rgb565::BLACK).unwrap();\n    _lcd_bl.into_push_pull_output_in_state(hal::gpio::PinState::High);\n    delay.delay_ms(1000);\n\n    let lcd_zero = Point::zero();\n    let lcd_max_corner = Point::new((LCD_WIDTH - 1) as i32, (LCD_HEIGHT - 1) as i32);\n\n    let style = PrimitiveStyleBuilder::new()\n        .fill_color(Rgb565::BLUE)\n        .build();\n\n    Rectangle::with_corners(lcd_zero, lcd_max_corner)\n        .into_styled(style)\n        .draw(&mut display)\n        .unwrap();\n    delay.delay_ms(1000);\n\n    let style = PrimitiveStyleBuilder::new()\n        .fill_color(Rgb565::BLACK)\n        .build();\n\n    Rectangle::with_corners(\n        Point::new(1, 1),\n        Point::new((LCD_WIDTH - 2) as i32, (LCD_HEIGHT - 2) as i32),\n    )\n    .into_styled(style)\n    .draw(&mut display)\n    .unwrap();\n\n    Line::new(lcd_zero, lcd_max_corner)\n        .into_styled(PrimitiveStyle::with_stroke(Rgb565::RED, 1))\n        .draw(&mut display)\n        .unwrap();\n\n    Line::new(\n        Point::new(0, (LCD_HEIGHT - 1) as i32),\n        Point::new((LCD_WIDTH - 1) as i32, 0),\n    )\n    .into_styled(PrimitiveStyle::with_stroke(Rgb565::GREEN, 1))\n    .draw(&mut display)\n    .unwrap();\n\n    // Infinite colour wheel loop\n    let mut l: i32 = 0;\n    let mut c = Rgb565::RED;\n    loop {\n        Line::new(Point::new(0, l), Point::new((LCD_WIDTH - 1) as i32, l))\n            .into_styled(PrimitiveStyle::with_stroke(c, 1))\n            .draw(&mut display)\n            .unwrap();\n        delay.delay_ms(10);\n        l += 1;\n        if l == LCD_HEIGHT as i32 {\n            l = 0;\n            c = match c {\n                Rgb565::RED => Rgb565::GREEN,\n                Rgb565::GREEN => Rgb565::BLUE,\n                _ => Rgb565::RED,\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "boards/waveshare-rp2040-lcd-1-28/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp0Spi0Rx]          |\n    /// | `UART0 TX`   | [crate::Gp0Uart0Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp0I2C0Sda]         |\n    /// | `PWM0 A`     | [crate::Gp0Pwm0A]           |\n    /// | `PIO0`       | [crate::Gp0Pio0]            |\n    /// | `PIO1`       | [crate::Gp0Pio1]            |\n    Gpio0 {\n        name: gp0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio0].\n            FunctionUart, PullNone: Gp0Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio0].\n            FunctionSpi, PullNone: Gp0Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio0].\n            FunctionI2C, PullUp: Gp0I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio0].\n            FunctionPwm, PullNone: Gp0Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio0, PullNone: Gp0Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio1, PullNone: Gp0Pio1\n        }\n    },\n\n    /// GPIO 1 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp1Spi0Csn]         |\n    /// | `UART0 RX`   | [crate::Gp1Uart0Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp1I2C0Scl]         |\n    /// | `PWM0 B`     | [crate::Gp1Pwm0B]           |\n    /// | `PIO0`       | [crate::Gp1Pio0]            |\n    /// | `PIO1`       | [crate::Gp1Pio1]            |\n    Gpio1 {\n        name: gp1,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio1].\n            FunctionUart, PullNone: Gp1Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio1].\n            FunctionSpi, PullNone: Gp1Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio1].\n            FunctionI2C, PullUp: Gp1I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio1].\n            FunctionPwm, PullNone: Gp1Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio0, PullNone: Gp1Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio1, PullNone: Gp1Pio1\n        }\n    },\n\n    /// GPIO 2 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp2Spi0Sck]         |\n    /// | `UART0 CTS`  | [crate::Gp2Uart0Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp2I2C1Sda]         |\n    /// | `PWM1 A`     | [crate::Gp2Pwm1A]           |\n    /// | `PIO0`       | [crate::Gp2Pio0]            |\n    /// | `PIO1`       | [crate::Gp2Pio1]            |\n    Gpio2 {\n        name: gp2,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio2].\n            FunctionUart, PullNone: Gp2Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio2].\n            FunctionSpi, PullNone: Gp2Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio2].\n            FunctionI2C, PullUp: Gp2I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio2].\n            FunctionPwm, PullNone: Gp2Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio0, PullNone: Gp2Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio1, PullNone: Gp2Pio1\n        }\n    },\n\n    /// GPIO 3 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp3Spi0Tx]          |\n    /// | `UART0 RTS`  | [crate::Gp3Uart0Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp3I2C1Scl]         |\n    /// | `PWM1 B`     | [crate::Gp3Pwm1B]           |\n    /// | `PIO0`       | [crate::Gp3Pio0]            |\n    /// | `PIO1`       | [crate::Gp3Pio1]            |\n    Gpio3 {\n        name: gp3,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio3].\n            FunctionUart, PullNone: Gp3Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio3].\n            FunctionSpi, PullNone: Gp3Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio3].\n            FunctionI2C, PullUp: Gp3I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio3].\n            FunctionPwm, PullNone: Gp3Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio0, PullNone: Gp3Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio1, PullNone: Gp3Pio1\n        }\n    },\n\n    /// GPIO 4 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp4Spi0Rx]          |\n    /// | `UART1 TX`   | [crate::Gp4Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp4I2C0Sda]         |\n    /// | `PWM2 A`     | [crate::Gp4Pwm2A]           |\n    /// | `PIO0`       | [crate::Gp4Pio0]            |\n    /// | `PIO1`       | [crate::Gp4Pio1]            |\n    Gpio4 {\n        name: gp4,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio4].\n            FunctionUart, PullNone: Gp4Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio4].\n            FunctionSpi, PullNone: Gp4Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio4].\n            FunctionI2C, PullUp: Gp4I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio4].\n            FunctionPwm, PullNone: Gp4Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio0, PullNone: Gp4Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio1, PullNone: Gp4Pio1\n        }\n    },\n\n    /// GPIO 5 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp5Spi0Csn]         |\n    /// | `UART1 RX`   | [crate::Gp5Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp5I2C0Scl]         |\n    /// | `PWM2 B`     | [crate::Gp5Pwm2B]           |\n    /// | `PIO0`       | [crate::Gp5Pio0]            |\n    /// | `PIO1`       | [crate::Gp5Pio1]            |\n    Gpio5 {\n        name: gp5,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio5].\n            FunctionUart, PullNone: Gp5Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio5].\n            FunctionSpi, PullNone: Gp5Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio5].\n            FunctionI2C, PullUp: Gp5I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio5].\n            FunctionPwm, PullNone: Gp5Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio0, PullNone: Gp5Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio1, PullNone: Gp5Pio1\n        }\n    },\n\n    /// GPIO 6 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp6Spi0Sck]         |\n    /// | `UART1 CTS`  | [crate::Gp6Uart1Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp6I2C1Sda]         |\n    /// | `PWM3 A`     | [crate::Gp6Pwm3A]           |\n    /// | `PIO0`       | [crate::Gp6Pio0]            |\n    /// | `PIO1`       | [crate::Gp6Pio1]            |\n    Gpio6 {\n        name: gp6,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio6].\n            FunctionUart, PullNone: Gp6Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio6].\n            FunctionSpi, PullNone: Gp6Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio6].\n            FunctionI2C, PullUp: Gp6I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio6].\n            FunctionPwm, PullNone: Gp6Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio0, PullNone: Gp6Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio1, PullNone: Gp6Pio1\n        }\n    },\n\n    /// GPIO 7 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp7Spi0Tx]          |\n    /// | `UART1 RTS`  | [crate::Gp7Uart1Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp7I2C1Scl]         |\n    /// | `PWM3 B`     | [crate::Gp7Pwm3B]           |\n    /// | `PIO0`       | [crate::Gp7Pio0]            |\n    /// | `PIO1`       | [crate::Gp7Pio1]            |\n    Gpio7 {\n        name: gp7,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio7].\n            FunctionUart, PullNone: Gp7Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio7].\n            FunctionSpi, PullNone: Gp7Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio7].\n            FunctionI2C, PullUp: Gp7I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio7].\n            FunctionPwm, PullNone: Gp7Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio0, PullNone: Gp7Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio1, PullNone: Gp7Pio1\n        }\n    },\n\n    /// GPIO 8 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp8Spi1Rx]          |\n    /// | `UART1 TX`   | [crate::Gp8Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp8I2C0Sda]         |\n    /// | `PWM4 A`     | [crate::Gp8Pwm4A]           |\n    /// | `PIO0`       | [crate::Gp8Pio0]            |\n    /// | `PIO1`       | [crate::Gp8Pio1]            |\n    Gpio8 {\n        name: gp8,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio8].\n            FunctionUart, PullNone: Gp8Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio8].\n            FunctionSpi, PullNone: Gp8Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio8].\n            FunctionI2C, PullUp: Gp8I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio8].\n            FunctionPwm, PullNone: Gp8Pwm4A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio0, PullNone: Gp8Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio1, PullNone: Gp8Pio1\n        }\n    },\n\n    /// GPIO 9 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp9Spi1Csn]         |\n    /// | `UART1 RX`   | [crate::Gp9Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp9I2C0Scl]         |\n    /// | `PWM4 B`     | [crate::Gp9Pwm4B]           |\n    /// | `PIO0`       | [crate::Gp9Pio0]            |\n    /// | `PIO1`       | [crate::Gp9Pio1]            |\n    Gpio9 {\n        name: gp9,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio9].\n            FunctionUart, PullNone: Gp9Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio9].\n            FunctionSpi, PullNone: Gp9Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio9].\n            FunctionI2C, PullUp: Gp9I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio9].\n            FunctionPwm, PullNone: Gp9Pwm4B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio0, PullNone: Gp9Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio1, PullNone: Gp9Pio1\n        }\n    },\n\n    /// GPIO 10 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp10Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp10Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp10I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp10Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp10Pio0]           |\n    /// | `PIO1`       | [crate::Gp10Pio1]           |\n    Gpio10 {\n        name: gp10,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio10].\n            FunctionUart, PullNone: Gp10Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio10].\n            FunctionSpi, PullNone: Gp10Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio10].\n            FunctionI2C, PullUp: Gp10I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio10].\n            FunctionPwm, PullNone: Gp10Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio10].\n            FunctionPio0, PullNone: Gp10Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio10].\n            FunctionPio1, PullNone: Gp10Pio1\n        }\n    },\n\n    /// GPIO 11 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp11Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp11Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp11I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp11Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp11Pio0]           |\n    /// | `PIO1`       | [crate::Gp11Pio1]           |\n    Gpio11 {\n        name: gp11,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio11].\n            FunctionUart, PullNone: Gp11Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio11].\n            FunctionSpi, PullNone: Gp11Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio11].\n            FunctionI2C, PullUp: Gp11I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio11].\n            FunctionPwm, PullNone: Gp11Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio11].\n            FunctionPio0, PullNone: Gp11Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio11].\n            FunctionPio1, PullNone: Gp11Pio1\n        }\n    },\n\n    /// GPIO 12 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp12Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp12Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp12I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp12Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp12Pio0]           |\n    /// | `PIO1`       | [crate::Gp12Pio1]           |\n    Gpio12 {\n        name: gp12,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio12].\n            FunctionUart, PullNone: Gp12Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio12].\n            FunctionSpi, PullNone: Gp12Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio12].\n            FunctionI2C, PullUp: Gp12I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio12].\n            FunctionPwm, PullNone: Gp12Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio0, PullNone: Gp12Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio1, PullNone: Gp12Pio1\n        }\n    },\n\n    /// GPIO 13 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp13Spi1Csn]        |\n    /// | `UART0 RX`   | [crate::Gp13Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp13I2C0Scl]        |\n    /// | `PWM6 B`     | [crate::Gp13Pwm6B]          |\n    /// | `PIO0`       | [crate::Gp13Pio0]           |\n    /// | `PIO1`       | [crate::Gp13Pio1]           |\n    Gpio13 {\n        name: gp13,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio13].\n            FunctionUart, PullNone: Gp13Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio13].\n            FunctionSpi, PullNone: Gp13Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio13].\n            FunctionI2C, PullUp: Gp13I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio13].\n            FunctionPwm, PullNone: Gp13Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio0, PullNone: Gp13Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio1, PullNone: Gp13Pio1\n        }\n    },\n\n    /// GPIO 14 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp14Spi1Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp14Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp14I2C1Sda]        |\n    /// | `PWM7 A`     | [crate::Gp14Pwm7A]          |\n    /// | `PIO0`       | [crate::Gp14Pio0]           |\n    /// | `PIO1`       | [crate::Gp14Pio1]           |\n    Gpio14 {\n        name: gp14,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio14].\n            FunctionUart, PullNone: Gp14Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio14].\n            FunctionSpi, PullNone: Gp14Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio14].\n            FunctionI2C, PullUp: Gp14I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio14].\n            FunctionPwm, PullNone: Gp14Pwm7A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio14].\n            FunctionPio0, PullNone: Gp14Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio14].\n            FunctionPio1, PullNone: Gp14Pio1\n        }\n    },\n\n    /// GPIO 15 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp15Spi1Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp15Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp15I2C1Scl]        |\n    /// | `PWM7 B`     | [crate::Gp15Pwm7B]          |\n    /// | `PIO0`       | [crate::Gp15Pio0]           |\n    /// | `PIO1`       | [crate::Gp15Pio1]           |\n    Gpio15 {\n        name: gp15,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio15].\n            FunctionUart, PullNone: Gp15Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio15].\n            FunctionSpi, PullNone: Gp15Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio15].\n            FunctionI2C, PullUp: Gp15I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio15].\n            FunctionPwm, PullNone: Gp15Pwm7B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio0, PullNone: Gp15Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio1, PullNone: Gp15Pio1\n        }\n    },\n\n    /// GPIO 16 is connected internally to a single Neopixel RGB LED\n    Gpio16 { name: neopixel },\n\n    /// GPIO 17 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp17Spi0Csn]        |\n    /// | `UART0 RX`   | [crate::Gp17Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp17I2C0Scl]        |\n    /// | `PWM0 B`     | [crate::Gp17Pwm0B]          |\n    /// | `PIO0`       | [crate::Gp17Pio0]           |\n    /// | `PIO1`       | [crate::Gp17Pio1]           |\n    Gpio17 {\n        name: gpio17,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio17].\n            FunctionUart, PullNone: Gp17Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio17].\n            FunctionSpi, PullNone: Gp17Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio17].\n            FunctionI2C, PullUp: Gp17I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio17].\n            FunctionPwm, PullNone: Gp17Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio0, PullNone: Gp17Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio1, PullNone: Gp17Pio1\n        }\n    },\n\n    /// GPIO 18 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp18Spi0Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp18Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp18I2C1Sda]        |\n    /// | `PWM1 A`     | [crate::Gp18Pwm1A]          |\n    /// | `PIO0`       | [crate::Gp18Pio0]           |\n    /// | `PIO1`       | [crate::Gp18Pio1]           |\n    Gpio18 {\n        name: gpio18,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio18].\n            FunctionUart, PullNone: Gp18Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio18].\n            FunctionSpi, PullNone: Gp18Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio18].\n            FunctionI2C, PullUp: Gp18I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio18].\n            FunctionPwm, PullNone: Gp18Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio0, PullNone: Gp18Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio1, PullNone: Gp18Pio1\n        }\n    },\n\n    /// GPIO 19 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp19Spi0Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp19Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp19I2C1Scl]        |\n    /// | `PWM1 B`     | [crate::Gp19Pwm1B]          |\n    /// | `PIO0`       | [crate::Gp19Pio0]           |\n    /// | `PIO1`       | [crate::Gp19Pio1]           |\n    Gpio19 {\n        name: gpio19,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio19].\n            FunctionUart, PullNone: Gp19Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio19].\n            FunctionSpi, PullNone: Gp19Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio19].\n            FunctionI2C, PullUp: Gp19I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio19].\n            FunctionPwm, PullNone: Gp19Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio0, PullNone: Gp19Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio1, PullNone: Gp19Pio1\n        }\n    },\n\n    /// GPIO 20 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp20Spi0Rx]         |\n    /// | `UART1 TX`   | [crate::Gp20Uart1Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp20I2C0Sda]        |\n    /// | `PWM2 A`     | [crate::Gp20Pwm2A]          |\n    /// | `PIO0`       | [crate::Gp20Pio0]           |\n    /// | `PIO1`       | [crate::Gp20Pio1]           |\n    Gpio20 {\n        name: gpio20,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio20].\n            FunctionUart, PullNone: Gp20Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio20].\n            FunctionSpi, PullNone: Gp20Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio20].\n            FunctionI2C, PullUp: Gp20I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio20].\n            FunctionPwm, PullNone: Gp20Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio0, PullNone: Gp20Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio1, PullNone: Gp20Pio1\n        }\n    },\n\n    /// GPIO 21 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp21Spi0Csn]        |\n    /// | `UART1 RX`   | [crate::Gp21Uart1Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp21I2C0Scl]        |\n    /// | `PWM2 B`     | [crate::Gp21Pwm2B]          |\n    /// | `PIO0`       | [crate::Gp21Pio0]           |\n    /// | `PIO1`       | [crate::Gp21Pio1]           |\n    Gpio21 {\n        name: gpio21,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio21].\n            FunctionUart, PullNone: Gp21Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio21].\n            FunctionSpi, PullNone: Gp21Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio21].\n            FunctionI2C, PullUp: Gp21I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio21].\n            FunctionPwm, PullNone: Gp21Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio0, PullNone: Gp21Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio1, PullNone: Gp21Pio1\n        }\n    },\n\n    /// GPIO 22 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp22Spi0Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp22Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp22I2C1Sda]        |\n    /// | `PWM3 A`     | [crate::Gp22Pwm3A]          |\n    /// | `PIO0`       | [crate::Gp22Pio0]           |\n    /// | `PIO1`       | [crate::Gp22Pio1]           |\n    Gpio22 {\n        name: gpio22,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio22].\n            FunctionUart, PullNone: Gp22Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio22].\n            FunctionSpi, PullNone: Gp22Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio22].\n            FunctionI2C, PullUp: Gp22I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio22].\n            FunctionPwm, PullNone: Gp22Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio0, PullNone: Gp22Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio1, PullNone: Gp22Pio1\n        }\n    },\n\n    /// GPIO 23\n    Gpio23 {\n        name: gp23,\n        aliases: {\n            FunctionUart, PullNone: Gp23Uart1Rts,\n            FunctionSpi, PullNone: Gp23Spi0Tx,\n            FunctionI2C, PullUp: Gp23I2C1Scl,\n            FunctionPwm, PullNone: Gp23Pwm3B,\n            FunctionPio0, PullNone: Gp23Pio0,\n            FunctionPio1, PullNone: Gp23Pio1\n        }\n    },\n\n    /// GPIO 24\n    Gpio24 {\n        name: gp24,\n        aliases: {\n            FunctionUart, PullNone: Gp24Uart1Tx,\n            FunctionSpi, PullNone: Gp24Spi1Rx,\n            FunctionI2C, PullUp: Gp24I2C0Sda,\n            FunctionPwm, PullNone: Gp24Pwm4A,\n            FunctionPio0, PullNone: Gp24Pio0,\n            FunctionPio1, PullNone: Gp24Pio1\n        }\n    },\n\n    /// GPIO 25\n    Gpio25 {\n        name: gp25,\n        aliases: {\n            FunctionUart, PullNone: Gp25Uart1Rx,\n            FunctionSpi, PullNone: Gp25Spi1Csn,\n            FunctionI2C, PullUp: Gp25I2C0Scl,\n            FunctionPwm, PullNone: Gp25Pwm4B,\n            FunctionPio0, PullNone: Gp25Pio0,\n            FunctionPio1, PullNone: Gp25Pio1\n        }\n    },\n\n    /// GPIO 26 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp26Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp26Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp26I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp26Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp26Pio0]           |\n    /// | `PIO1`       | [crate::Gp26Pio1]           |\n    ///\n    /// ADC0\n    Gpio26 {\n        name: gp26,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio26].\n            FunctionUart, PullNone: Gp26Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio26].\n            FunctionSpi, PullNone: Gp26Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio26].\n            FunctionPwm, PullNone: Gp26Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio0, PullNone: Gp26Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio1, PullNone: Gp26Pio1\n        }\n    },\n\n    /// GPIO 27 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp27Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp27Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp27I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp27Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp27Pio0]           |\n    /// | `PIO1`       | [crate::Gp27Pio1]           |\n    ///\n    /// ADC1\n    Gpio27 {\n        name: gp27,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio27].\n            FunctionUart, PullNone: Gp27Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio27].\n            FunctionSpi, PullNone: Gp27Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio27].\n            FunctionPwm, PullNone: Gp27Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio0, PullNone: Gp27Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio1, PullNone: Gp27Pio1\n        }\n    },\n\n    /// GPIO 28 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp28Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp28Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp28I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp28Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp28Pio0]           |\n    /// | `PIO1`       | [crate::Gp28Pio1]           |\n    ///\n    /// ADC2\n    Gpio28 {\n        name: gp28,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp28Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp28Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp28I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp28Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp28Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp28Pio1\n        }\n    },\n\n    /// GPIO 29\n    ///\n    /// ADC3\n    Gpio29 {\n        name: gp29,\n        aliases: {\n            FunctionUart, PullNone: Gp29Uart0Rx,\n            FunctionSpi, PullNone: Gp29Spi1Csn,\n            FunctionI2C, PullUp: Gp29I2C0Scl,\n            FunctionPwm, PullNone: Gp29Pwm6B,\n            FunctionPio0, PullNone: Gp29Pio0,\n            FunctionPio1, PullNone: Gp29Pio1\n        }\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "boards/waveshare-rp2040-zero/CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.8.0 - 2024-04-07\n\n### Changed\n\n- Update to rp2040-hal 0.10.0\n- Update to embedded-hal 1.0.0\n\n## 0.7.0 - 2023-09-02\n\n### Changed\n\n- Update to rp2040-hal 0.9.0\n- Update to ws2812-pio 0.7.0\n\n## 0.6.0 - 2023-02-18\n\n### Changed\n\n- Update to rp2040-hal 0.8.0\n- Update to ws2812-pio 0.6.0\n\n## 0.5.0 - 2022-12-11\n\n### Changed\n\n- Update to rp2040-hal 0.7.0\n- Update to ws2812-pio 0.5.0\n\n## 0.4.0 - 2022-11-15\n\n### Changed\n\n- Inital release\n- Copied from adafruit-feather-rp2040\n- Update pin names\n- Update board name\n\n"
  },
  {
    "path": "boards/waveshare-rp2040-zero/Cargo.toml",
    "content": "[package]\nname = \"waveshare-rp2040-zero\"\nversion = \"0.8.0\"\nauthors = [\"Andrea Nall <anall@andreanal.com>\", \"TilCreator <contact.github@tc-j.de>\", \"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \"https://github.com/rp-rs/rp-hal-boards/tree/main/boards/waveshare-rp2040-zero\"\ndescription = \"Board Support Package for the Adafruit Feather RP2040\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/rp-rs/rp-hal-boards.git\"\n\n# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html\n\n[dependencies]\ncortex-m-rt = { workspace = true, optional = true }\nrp2040-boot2 = { workspace = true, optional = true }\nrp2040-hal.workspace = true\n\n[dev-dependencies]\ncortex-m.workspace = true\npanic-halt.workspace = true\nembedded-hal.workspace = true\nfugit.workspace = true\nnb.workspace = true\nsmart-leds.workspace = true\nws2812-pio.workspace = true\n\n[features]\n# This is the set of features we enable by default\ndefault = [\"boot2\", \"rt\", \"critical-section-impl\", \"rom-func-cache\"]\n\n# critical section that is safe for multicore use\ncritical-section-impl = [\"rp2040-hal/critical-section-impl\"]\n\n# 2nd stage bootloaders for rp2040\nboot2 = [\"rp2040-boot2\"]\n\n# Minimal startup / runtime for Cortex-M microcontrollers\nrt = [\"cortex-m-rt\",\"rp2040-hal/rt\"]\n\n# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.\n# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it\nrp2040-e5 = [\"rp2040-hal/rp2040-e5\"]\n\n# Memoize(cache) ROM function pointers on first use to improve performance\nrom-func-cache = [\"rp2040-hal/rom-func-cache\"]\n\n# Disable automatic mapping of language features (like floating point math) to ROM functions\ndisable-intrinsics = [\"rp2040-hal/disable-intrinsics\"]\n\n# This enables ROM functions for f64 math that were not present in the earliest RP2040s\nrom-v2-intrinsics = [\"rp2040-hal/rom-v2-intrinsics\"]\n"
  },
  {
    "path": "boards/waveshare-rp2040-zero/README.md",
    "content": "# [waveshare-rp2040-zero] - Board Support for the [Waveshare RP2040 Zero]\n\nYou should include this crate if you are writing code that you want to run on\nan [Waveshare RP2040 Zero] - a very small RP2040 breakout board with USB-C and a RGB led from Waveshare.\n\nThis crate includes the [rp2040-hal], but also configures each pin of the\nRP2040 chip according to how it is connected up on the Feather.\n\n[Waveshare RP2040 Zero]: https://www.waveshare.com/wiki/RP2040-Zero\n[waveshare-rp2040-zero]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/waveshare-rp2040-zero\n[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal\n[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/\n\n## Using\n\nTo use this crate, your `Cargo.toml` file should contain:\n\n```toml\nwaveshare-rp2040-zero = \"0.8.0\"\n```\n\nIn your program, you will need to call `waveshare_rp2040_zero::Pins::new` to create\na new `Pins` structure. This will set up all the GPIOs for any on-board\ndevices. See the [examples](./examples) folder for more details.\n\n## Examples\n\n### General Instructions\n\nTo compile an example, clone the _rp-hal-boards_ repository and run:\n\n```console\nrp-hal-boards/boards/waveshare-rp2040-zero $ cargo build --release --example <name>\n```\n\nYou will get an ELF file called\n`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`\nfolder is located at the top of the _rp-hal-boards_ repository checkout. Normally\nyou would also need to specify `--target=thumbv6m-none-eabi` but when\nbuilding examples from this git repository, that is set as the default.\n\nIf you want to convert the ELF file to a UF2 and automatically copy it to the\nUSB drive exported by the RP2040 bootloader, simply boot your board into\nbootloader mode and run:\n\n```console\nrp-hal-boards/boards/waveshare-rp2040-zero $ cargo run --release --example <name>\n```\n\nIf you get an error about not being able to find `elf2uf2-rs`, try:\n\n```console\n$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.\n```\n\n### [waveshare_rp2040_zero_neopixel_rainbow](./examples/waveshare_rp2040_zero_neopixel_rainbow.rs)\n\nFlows smoothly through various colors on the onboard NeoPixel LED.\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe, learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nThe steps are:\n\n1. Fork the Project by clicking the 'Fork' button at the top of the page.\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Make some changes to the code or documentation.\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)\n6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)\n7. An admin will review the Pull Request and discuss any changes that may be required.\n8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], and the maintainer of this crate, the [rp-rs team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs\n\n## License\n\nThe contents of this repository are dual-licensed under the _MIT OR Apache\n2.0_ License. That means you can choose either the MIT license or the\nApache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more\ninformation on each specific license.\n\nAny submissions to this project (e.g. as Pull Requests) must be made available\nunder these terms.\n"
  },
  {
    "path": "boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs",
    "content": "//! Rainbow effect color wheel using the onboard NeoPixel on an Waveshare RP2040-Zero board\n//!\n//! This flows smoothly through various colours on the onboard NeoPixel.\n//! Uses the `ws2812_pio` driver to control the NeoPixel, which in turns uses the\n//! RP2040's PIO block.\n#![no_std]\n#![no_main]\n\nuse core::iter::once;\nuse embedded_hal::delay::DelayNs;\nuse panic_halt as _;\nuse smart_leds::{brightness, SmartLedsWrite, RGB8};\nuse waveshare_rp2040_zero::entry;\nuse waveshare_rp2040_zero::{\n    hal::{\n        clocks::{init_clocks_and_plls, Clock},\n        pac,\n        pio::PIOExt,\n        timer::Timer,\n        watchdog::Watchdog,\n        Sio,\n    },\n    Pins, XOSC_CRYSTAL_FREQ,\n};\nuse ws2812_pio::Ws2812;\n\n/// Entry point to our bare-metal application.\n///\n/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function\n/// as soon as all global variables are initialised.\n///\n/// The function configures the RP2040 peripherals, then infinitely cycles the built-in LED colour from red, to green,\n/// to blue and back to red.\n#[entry]\nfn main() -> ! {\n    let mut pac = pac::Peripherals::take().unwrap();\n\n    let mut watchdog = Watchdog::new(pac.WATCHDOG);\n\n    let clocks = init_clocks_and_plls(\n        XOSC_CRYSTAL_FREQ,\n        pac.XOSC,\n        pac.CLOCKS,\n        pac.PLL_SYS,\n        pac.PLL_USB,\n        &mut pac.RESETS,\n        &mut watchdog,\n    )\n    .ok()\n    .unwrap();\n\n    let sio = Sio::new(pac.SIO);\n    let pins = Pins::new(\n        pac.IO_BANK0,\n        pac.PADS_BANK0,\n        sio.gpio_bank0,\n        &mut pac.RESETS,\n    );\n\n    let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);\n\n    // Configure the addressable LED\n    let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);\n    let mut ws = Ws2812::new(\n        // The onboard NeoPixel is attached to GPIO pin #16 on the Waveshare RP2040-Zero.\n        pins.neopixel.into_function(),\n        &mut pio,\n        sm0,\n        clocks.peripheral_clock.freq(),\n        timer.count_down(),\n    );\n\n    // Infinite colour wheel loop\n    let mut n: u8 = 128;\n    let mut timer = timer; // rebind to force a copy of the timer\n    loop {\n        ws.write(brightness(once(wheel(n)), 32)).unwrap();\n        n = n.wrapping_add(1);\n\n        timer.delay_ms(25);\n    }\n}\n\n/// Convert a number from `0..=255` to an RGB color triplet.\n///\n/// The colours are a transition from red, to green, to blue and back to red.\nfn wheel(mut wheel_pos: u8) -> RGB8 {\n    wheel_pos = 255 - wheel_pos;\n    if wheel_pos < 85 {\n        // No green in this sector - red and blue only\n        (255 - (wheel_pos * 3), 0, wheel_pos * 3).into()\n    } else if wheel_pos < 170 {\n        // No red in this sector - green and blue only\n        wheel_pos -= 85;\n        (0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()\n    } else {\n        // No blue in this sector - red and green only\n        wheel_pos -= 170;\n        (wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()\n    }\n}\n"
  },
  {
    "path": "boards/waveshare-rp2040-zero/src/lib.rs",
    "content": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use hal::entry;\n\n/// The linker will place this boot block at the start of our program image. We\n/// need this to help the ROM bootloader get our code up and running.\n#[cfg(feature = \"boot2\")]\n#[link_section = \".boot2\"]\n#[no_mangle]\n#[used]\npub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;\n\npub use hal::pac;\n\nhal::bsp_pins!(\n    /// GPIO 0 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp0Spi0Rx]          |\n    /// | `UART0 TX`   | [crate::Gp0Uart0Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp0I2C0Sda]         |\n    /// | `PWM0 A`     | [crate::Gp0Pwm0A]           |\n    /// | `PIO0`       | [crate::Gp0Pio0]            |\n    /// | `PIO1`       | [crate::Gp0Pio1]            |\n    Gpio0 {\n        name: gp0,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio0].\n            FunctionUart, PullNone: Gp0Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio0].\n            FunctionSpi, PullNone: Gp0Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio0].\n            FunctionI2C, PullUp: Gp0I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio0].\n            FunctionPwm, PullNone: Gp0Pwm0A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio0, PullNone: Gp0Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio0].\n            FunctionPio1, PullNone: Gp0Pio1\n        }\n    },\n\n    /// GPIO 1 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp1Spi0Csn]         |\n    /// | `UART0 RX`   | [crate::Gp1Uart0Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp1I2C0Scl]         |\n    /// | `PWM0 B`     | [crate::Gp1Pwm0B]           |\n    /// | `PIO0`       | [crate::Gp1Pio0]            |\n    /// | `PIO1`       | [crate::Gp1Pio1]            |\n    Gpio1 {\n        name: gp1,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio1].\n            FunctionUart, PullNone: Gp1Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio1].\n            FunctionSpi, PullNone: Gp1Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio1].\n            FunctionI2C, PullUp: Gp1I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio1].\n            FunctionPwm, PullNone: Gp1Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio0, PullNone: Gp1Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio1].\n            FunctionPio1, PullNone: Gp1Pio1\n        }\n    },\n\n    /// GPIO 2 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp2Spi0Sck]         |\n    /// | `UART0 CTS`  | [crate::Gp2Uart0Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp2I2C1Sda]         |\n    /// | `PWM1 A`     | [crate::Gp2Pwm1A]           |\n    /// | `PIO0`       | [crate::Gp2Pio0]            |\n    /// | `PIO1`       | [crate::Gp2Pio1]            |\n    Gpio2 {\n        name: gp2,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio2].\n            FunctionUart, PullNone: Gp2Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio2].\n            FunctionSpi, PullNone: Gp2Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio2].\n            FunctionI2C, PullUp: Gp2I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio2].\n            FunctionPwm, PullNone: Gp2Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio0, PullNone: Gp2Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio2].\n            FunctionPio1, PullNone: Gp2Pio1\n        }\n    },\n\n    /// GPIO 3 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp3Spi0Tx]          |\n    /// | `UART0 RTS`  | [crate::Gp3Uart0Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp3I2C1Scl]         |\n    /// | `PWM1 B`     | [crate::Gp3Pwm1B]           |\n    /// | `PIO0`       | [crate::Gp3Pio0]            |\n    /// | `PIO1`       | [crate::Gp3Pio1]            |\n    Gpio3 {\n        name: gp3,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio3].\n            FunctionUart, PullNone: Gp3Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio3].\n            FunctionSpi, PullNone: Gp3Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio3].\n            FunctionI2C, PullUp: Gp3I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio3].\n            FunctionPwm, PullNone: Gp3Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio0, PullNone: Gp3Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio3].\n            FunctionPio1, PullNone: Gp3Pio1\n        }\n    },\n\n    /// GPIO 4 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp4Spi0Rx]          |\n    /// | `UART1 TX`   | [crate::Gp4Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp4I2C0Sda]         |\n    /// | `PWM2 A`     | [crate::Gp4Pwm2A]           |\n    /// | `PIO0`       | [crate::Gp4Pio0]            |\n    /// | `PIO1`       | [crate::Gp4Pio1]            |\n    Gpio4 {\n        name: gp4,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio4].\n            FunctionUart, PullNone: Gp4Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio4].\n            FunctionSpi, PullNone: Gp4Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio4].\n            FunctionI2C, PullUp: Gp4I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio4].\n            FunctionPwm, PullNone: Gp4Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio0, PullNone: Gp4Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio4].\n            FunctionPio1, PullNone: Gp4Pio1\n        }\n    },\n\n    /// GPIO 5 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp5Spi0Csn]         |\n    /// | `UART1 RX`   | [crate::Gp5Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp5I2C0Scl]         |\n    /// | `PWM2 B`     | [crate::Gp5Pwm2B]           |\n    /// | `PIO0`       | [crate::Gp5Pio0]            |\n    /// | `PIO1`       | [crate::Gp5Pio1]            |\n    Gpio5 {\n        name: gp5,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio5].\n            FunctionUart, PullNone: Gp5Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio5].\n            FunctionSpi, PullNone: Gp5Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio5].\n            FunctionI2C, PullUp: Gp5I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio5].\n            FunctionPwm, PullNone: Gp5Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio0, PullNone: Gp5Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio5].\n            FunctionPio1, PullNone: Gp5Pio1\n        }\n    },\n\n    /// GPIO 6 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp6Spi0Sck]         |\n    /// | `UART1 CTS`  | [crate::Gp6Uart1Cts]        |\n    /// | `I2C1 SDA`   | [crate::Gp6I2C1Sda]         |\n    /// | `PWM3 A`     | [crate::Gp6Pwm3A]           |\n    /// | `PIO0`       | [crate::Gp6Pio0]            |\n    /// | `PIO1`       | [crate::Gp6Pio1]            |\n    Gpio6 {\n        name: gp6,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio6].\n            FunctionUart, PullNone: Gp6Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio6].\n            FunctionSpi, PullNone: Gp6Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio6].\n            FunctionI2C, PullUp: Gp6I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio6].\n            FunctionPwm, PullNone: Gp6Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio0, PullNone: Gp6Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio6].\n            FunctionPio1, PullNone: Gp6Pio1\n        }\n    },\n\n    /// GPIO 7 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp7Spi0Tx]          |\n    /// | `UART1 RTS`  | [crate::Gp7Uart1Rts]        |\n    /// | `I2C1 SCL`   | [crate::Gp7I2C1Scl]         |\n    /// | `PWM3 B`     | [crate::Gp7Pwm3B]           |\n    /// | `PIO0`       | [crate::Gp7Pio0]            |\n    /// | `PIO1`       | [crate::Gp7Pio1]            |\n    Gpio7 {\n        name: gp7,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio7].\n            FunctionUart, PullNone: Gp7Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio7].\n            FunctionSpi, PullNone: Gp7Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio7].\n            FunctionI2C, PullUp: Gp7I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio7].\n            FunctionPwm, PullNone: Gp7Pwm3B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio0, PullNone: Gp7Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio7].\n            FunctionPio1, PullNone: Gp7Pio1\n        }\n    },\n\n    /// GPIO 8 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp8Spi1Rx]          |\n    /// | `UART1 TX`   | [crate::Gp8Uart1Tx]         |\n    /// | `I2C0 SDA`   | [crate::Gp8I2C0Sda]         |\n    /// | `PWM4 A`     | [crate::Gp8Pwm4A]           |\n    /// | `PIO0`       | [crate::Gp8Pio0]            |\n    /// | `PIO1`       | [crate::Gp8Pio1]            |\n    Gpio8 {\n        name: gp8,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio8].\n            FunctionUart, PullNone: Gp8Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio8].\n            FunctionSpi, PullNone: Gp8Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio8].\n            FunctionI2C, PullUp: Gp8I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio8].\n            FunctionPwm, PullNone: Gp8Pwm4A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio0, PullNone: Gp8Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio8].\n            FunctionPio1, PullNone: Gp8Pio1\n        }\n    },\n\n    /// GPIO 9 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp9Spi1Csn]         |\n    /// | `UART1 RX`   | [crate::Gp9Uart1Rx]         |\n    /// | `I2C0 SCL`   | [crate::Gp9I2C0Scl]         |\n    /// | `PWM4 B`     | [crate::Gp9Pwm4B]           |\n    /// | `PIO0`       | [crate::Gp9Pio0]            |\n    /// | `PIO1`       | [crate::Gp9Pio1]            |\n    Gpio9 {\n        name: gp9,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio9].\n            FunctionUart, PullNone: Gp9Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio9].\n            FunctionSpi, PullNone: Gp9Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio9].\n            FunctionI2C, PullUp: Gp9I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio9].\n            FunctionPwm, PullNone: Gp9Pwm4B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio0, PullNone: Gp9Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio9].\n            FunctionPio1, PullNone: Gp9Pio1\n        }\n    },\n\n    /// GPIO 10 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp10Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp10Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp10I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp10Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp10Pio0]           |\n    /// | `PIO1`       | [crate::Gp10Pio1]           |\n    Gpio10 {\n        name: gp10,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio10].\n            FunctionUart, PullNone: Gp10Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio10].\n            FunctionSpi, PullNone: Gp10Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio10].\n            FunctionI2C, PullUp: Gp10I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio10].\n            FunctionPwm, PullNone: Gp10Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio10].\n            FunctionPio0, PullNone: Gp10Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio10].\n            FunctionPio1, PullNone: Gp10Pio1\n        }\n    },\n\n    /// GPIO 11 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp11Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp11Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp11I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp11Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp11Pio0]           |\n    /// | `PIO1`       | [crate::Gp11Pio1]           |\n    Gpio11 {\n        name: gp11,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio11].\n            FunctionUart, PullNone: Gp11Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio11].\n            FunctionSpi, PullNone: Gp11Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio11].\n            FunctionI2C, PullUp: Gp11I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio11].\n            FunctionPwm, PullNone: Gp11Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio11].\n            FunctionPio0, PullNone: Gp11Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio11].\n            FunctionPio1, PullNone: Gp11Pio1\n        }\n    },\n\n    /// GPIO 12 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp12Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp12Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp12I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp12Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp12Pio0]           |\n    /// | `PIO1`       | [crate::Gp12Pio1]           |\n    Gpio12 {\n        name: gp12,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio12].\n            FunctionUart, PullNone: Gp12Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio12].\n            FunctionSpi, PullNone: Gp12Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio12].\n            FunctionI2C, PullUp: Gp12I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio12].\n            FunctionPwm, PullNone: Gp12Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio0, PullNone: Gp12Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio12].\n            FunctionPio1, PullNone: Gp12Pio1\n        }\n    },\n\n    /// GPIO 13 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 CSn`   | [crate::Gp13Spi1Csn]        |\n    /// | `UART0 RX`   | [crate::Gp13Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp13I2C0Scl]        |\n    /// | `PWM6 B`     | [crate::Gp13Pwm6B]          |\n    /// | `PIO0`       | [crate::Gp13Pio0]           |\n    /// | `PIO1`       | [crate::Gp13Pio1]           |\n    Gpio13 {\n        name: gp13,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio13].\n            FunctionUart, PullNone: Gp13Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio13].\n            FunctionSpi, PullNone: Gp13Spi1Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio13].\n            FunctionI2C, PullUp: Gp13I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio13].\n            FunctionPwm, PullNone: Gp13Pwm6B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio0, PullNone: Gp13Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio13].\n            FunctionPio1, PullNone: Gp13Pio1\n        }\n    },\n\n    /// GPIO 14 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp14Spi1Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp14Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp14I2C1Sda]        |\n    /// | `PWM7 A`     | [crate::Gp14Pwm7A]          |\n    /// | `PIO0`       | [crate::Gp14Pio0]           |\n    /// | `PIO1`       | [crate::Gp14Pio1]           |\n    Gpio14 {\n        name: gp14,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio14].\n            FunctionUart, PullNone: Gp14Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio14].\n            FunctionSpi, PullNone: Gp14Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio14].\n            FunctionI2C, PullUp: Gp14I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio14].\n            FunctionPwm, PullNone: Gp14Pwm7A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio14].\n            FunctionPio0, PullNone: Gp14Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio14].\n            FunctionPio1, PullNone: Gp14Pio1\n        }\n    },\n\n    /// GPIO 15 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp15Spi1Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp15Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp15I2C1Scl]        |\n    /// | `PWM7 B`     | [crate::Gp15Pwm7B]          |\n    /// | `PIO0`       | [crate::Gp15Pio0]           |\n    /// | `PIO1`       | [crate::Gp15Pio1]           |\n    Gpio15 {\n        name: gp15,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio15].\n            FunctionUart, PullNone: Gp15Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio15].\n            FunctionSpi, PullNone: Gp15Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio15].\n            FunctionI2C, PullUp: Gp15I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio15].\n            FunctionPwm, PullNone: Gp15Pwm7B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio0, PullNone: Gp15Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio15].\n            FunctionPio1, PullNone: Gp15Pio1\n        }\n    },\n\n    /// GPIO 16 is connected internally to a single Neopixel RGB LED\n    Gpio16 { name: neopixel },\n\n    /// GPIO 17 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp17Spi0Csn]        |\n    /// | `UART0 RX`   | [crate::Gp17Uart0Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp17I2C0Scl]        |\n    /// | `PWM0 B`     | [crate::Gp17Pwm0B]          |\n    /// | `PIO0`       | [crate::Gp17Pio0]           |\n    /// | `PIO1`       | [crate::Gp17Pio1]           |\n    Gpio17 {\n        name: gpio17,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio17].\n            FunctionUart, PullNone: Gp17Uart0Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio17].\n            FunctionSpi, PullNone: Gp17Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio17].\n            FunctionI2C, PullUp: Gp17I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio17].\n            FunctionPwm, PullNone: Gp17Pwm0B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio0, PullNone: Gp17Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio17].\n            FunctionPio1, PullNone: Gp17Pio1\n        }\n    },\n\n    /// GPIO 18 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp18Spi0Sck]        |\n    /// | `UART0 CTS`  | [crate::Gp18Uart0Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp18I2C1Sda]        |\n    /// | `PWM1 A`     | [crate::Gp18Pwm1A]          |\n    /// | `PIO0`       | [crate::Gp18Pio0]           |\n    /// | `PIO1`       | [crate::Gp18Pio1]           |\n    Gpio18 {\n        name: gpio18,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio18].\n            FunctionUart, PullNone: Gp18Uart0Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio18].\n            FunctionSpi, PullNone: Gp18Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio18].\n            FunctionI2C, PullUp: Gp18I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio18].\n            FunctionPwm, PullNone: Gp18Pwm1A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio0, PullNone: Gp18Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio18].\n            FunctionPio1, PullNone: Gp18Pio1\n        }\n    },\n\n    /// GPIO 19 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 TX`    | [crate::Gp19Spi0Tx]         |\n    /// | `UART0 RTS`  | [crate::Gp19Uart0Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp19I2C1Scl]        |\n    /// | `PWM1 B`     | [crate::Gp19Pwm1B]          |\n    /// | `PIO0`       | [crate::Gp19Pio0]           |\n    /// | `PIO1`       | [crate::Gp19Pio1]           |\n    Gpio19 {\n        name: gpio19,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio19].\n            FunctionUart, PullNone: Gp19Uart0Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio19].\n            FunctionSpi, PullNone: Gp19Spi0Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio19].\n            FunctionI2C, PullUp: Gp19I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio19].\n            FunctionPwm, PullNone: Gp19Pwm1B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio0, PullNone: Gp19Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio19].\n            FunctionPio1, PullNone: Gp19Pio1\n        }\n    },\n\n    /// GPIO 20 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 RX`    | [crate::Gp20Spi0Rx]         |\n    /// | `UART1 TX`   | [crate::Gp20Uart1Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp20I2C0Sda]        |\n    /// | `PWM2 A`     | [crate::Gp20Pwm2A]          |\n    /// | `PIO0`       | [crate::Gp20Pio0]           |\n    /// | `PIO1`       | [crate::Gp20Pio1]           |\n    Gpio20 {\n        name: gpio20,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio20].\n            FunctionUart, PullNone: Gp20Uart1Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio20].\n            FunctionSpi, PullNone: Gp20Spi0Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio20].\n            FunctionI2C, PullUp: Gp20I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio20].\n            FunctionPwm, PullNone: Gp20Pwm2A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio0, PullNone: Gp20Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio20].\n            FunctionPio1, PullNone: Gp20Pio1\n        }\n    },\n\n    /// GPIO 21 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 CSn`   | [crate::Gp21Spi0Csn]        |\n    /// | `UART1 RX`   | [crate::Gp21Uart1Rx]        |\n    /// | `I2C0 SCL`   | [crate::Gp21I2C0Scl]        |\n    /// | `PWM2 B`     | [crate::Gp21Pwm2B]          |\n    /// | `PIO0`       | [crate::Gp21Pio0]           |\n    /// | `PIO1`       | [crate::Gp21Pio1]           |\n    Gpio21 {\n        name: gpio21,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio21].\n            FunctionUart, PullNone: Gp21Uart1Rx,\n            /// SPI Function alias for pin [crate::Pins::gpio21].\n            FunctionSpi, PullNone: Gp21Spi0Csn,\n            /// I2C Function alias for pin [crate::Pins::gpio21].\n            FunctionI2C, PullUp: Gp21I2C0Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio21].\n            FunctionPwm, PullNone: Gp21Pwm2B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio0, PullNone: Gp21Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio21].\n            FunctionPio1, PullNone: Gp21Pio1\n        }\n    },\n\n    /// GPIO 22 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI0 SCK`   | [crate::Gp22Spi0Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp22Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp22I2C1Sda]        |\n    /// | `PWM3 A`     | [crate::Gp22Pwm3A]          |\n    /// | `PIO0`       | [crate::Gp22Pio0]           |\n    /// | `PIO1`       | [crate::Gp22Pio1]           |\n    Gpio22 {\n        name: gpio22,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio22].\n            FunctionUart, PullNone: Gp22Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio22].\n            FunctionSpi, PullNone: Gp22Spi0Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio22].\n            FunctionI2C, PullUp: Gp22I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio22].\n            FunctionPwm, PullNone: Gp22Pwm3A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio0, PullNone: Gp22Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio22].\n            FunctionPio1, PullNone: Gp22Pio1\n        }\n    },\n\n    /// GPIO 23\n    Gpio23 {\n        name: gp23,\n        aliases: {\n            FunctionUart, PullNone: Gp23Uart1Rts,\n            FunctionSpi, PullNone: Gp23Spi0Tx,\n            FunctionI2C, PullUp: Gp23I2C1Scl,\n            FunctionPwm, PullNone: Gp23Pwm3B,\n            FunctionPio0, PullNone: Gp23Pio0,\n            FunctionPio1, PullNone: Gp23Pio1\n        }\n    },\n\n    /// GPIO 24\n    Gpio24 {\n        name: gp24,\n        aliases: {\n            FunctionUart, PullNone: Gp24Uart1Tx,\n            FunctionSpi, PullNone: Gp24Spi1Rx,\n            FunctionI2C, PullUp: Gp24I2C0Sda,\n            FunctionPwm, PullNone: Gp24Pwm4A,\n            FunctionPio0, PullNone: Gp24Pio0,\n            FunctionPio1, PullNone: Gp24Pio1\n        }\n    },\n\n    /// GPIO 25\n    Gpio25 {\n        name: gp25,\n        aliases: {\n            FunctionUart, PullNone: Gp25Uart1Rx,\n            FunctionSpi, PullNone: Gp25Spi1Csn,\n            FunctionI2C, PullUp: Gp25I2C0Scl,\n            FunctionPwm, PullNone: Gp25Pwm4B,\n            FunctionPio0, PullNone: Gp25Pio0,\n            FunctionPio1, PullNone: Gp25Pio1\n        }\n    },\n\n    /// GPIO 26 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 SCK`   | [crate::Gp26Spi1Sck]        |\n    /// | `UART1 CTS`  | [crate::Gp26Uart1Cts]       |\n    /// | `I2C1 SDA`   | [crate::Gp26I2C1Sda]        |\n    /// | `PWM5 A`     | [crate::Gp26Pwm5A]          |\n    /// | `PIO0`       | [crate::Gp26Pio0]           |\n    /// | `PIO1`       | [crate::Gp26Pio1]           |\n    ///\n    /// ADC0\n    Gpio26 {\n        name: gp26,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio26].\n            FunctionUart, PullNone: Gp26Uart1Cts,\n            /// SPI Function alias for pin [crate::Pins::gpio26].\n            FunctionSpi, PullNone: Gp26Spi1Sck,\n            /// I2C Function alias for pin [crate::Pins::gpio26].\n            FunctionI2C, PullUp: Gp26I2C1Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio26].\n            FunctionPwm, PullNone: Gp26Pwm5A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio0, PullNone: Gp26Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio26].\n            FunctionPio1, PullNone: Gp26Pio1\n        }\n    },\n\n    /// GPIO 27 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 TX`    | [crate::Gp27Spi1Tx]         |\n    /// | `UART1 RTS`  | [crate::Gp27Uart1Rts]       |\n    /// | `I2C1 SCL`   | [crate::Gp27I2C1Scl]        |\n    /// | `PWM5 B`     | [crate::Gp27Pwm5B]          |\n    /// | `PIO0`       | [crate::Gp27Pio0]           |\n    /// | `PIO1`       | [crate::Gp27Pio1]           |\n    ///\n    /// ADC1\n    Gpio27 {\n        name: gp27,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio27].\n            FunctionUart, PullNone: Gp27Uart1Rts,\n            /// SPI Function alias for pin [crate::Pins::gpio27].\n            FunctionSpi, PullNone: Gp27Spi1Tx,\n            /// I2C Function alias for pin [crate::Pins::gpio27].\n            FunctionI2C, PullUp: Gp27I2C1Scl,\n            /// PWM Function alias for pin [crate::Pins::gpio27].\n            FunctionPwm, PullNone: Gp27Pwm5B,\n            /// PIO0 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio0, PullNone: Gp27Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio27].\n            FunctionPio1, PullNone: Gp27Pio1\n        }\n    },\n\n    /// GPIO 28 supports following functions:\n    ///\n    /// | Function     | Alias with applied function |\n    /// |--------------|-----------------------------|\n    /// | `SPI1 RX`    | [crate::Gp28Spi1Rx]         |\n    /// | `UART0 TX`   | [crate::Gp28Uart0Tx]        |\n    /// | `I2C0 SDA`   | [crate::Gp28I2C0Sda]        |\n    /// | `PWM6 A`     | [crate::Gp28Pwm6A]          |\n    /// | `PIO0`       | [crate::Gp28Pio0]           |\n    /// | `PIO1`       | [crate::Gp28Pio1]           |\n    ///\n    /// ADC2\n    Gpio28 {\n        name: gp28,\n        aliases: {\n            /// UART Function alias for pin [crate::Pins::gpio28].\n            FunctionUart, PullNone: Gp28Uart0Tx,\n            /// SPI Function alias for pin [crate::Pins::gpio28].\n            FunctionSpi, PullNone: Gp28Spi1Rx,\n            /// I2C Function alias for pin [crate::Pins::gpio28].\n            FunctionI2C, PullUp: Gp28I2C0Sda,\n            /// PWM Function alias for pin [crate::Pins::gpio28].\n            FunctionPwm, PullNone: Gp28Pwm6A,\n            /// PIO0 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio0, PullNone: Gp28Pio0,\n            /// PIO1 Function alias for pin [crate::Pins::gpio28].\n            FunctionPio1, PullNone: Gp28Pio1\n        }\n    },\n\n    /// GPIO 29\n    ///\n    /// ADC3\n    Gpio29 {\n        name: gp29,\n        aliases: {\n            FunctionUart, PullNone: Gp29Uart0Rx,\n            FunctionSpi, PullNone: Gp29Spi1Csn,\n            FunctionI2C, PullUp: Gp29I2C0Scl,\n            FunctionPwm, PullNone: Gp29Pwm6B,\n            FunctionPio0, PullNone: Gp29Pio0,\n            FunctionPio1, PullNone: Gp29Pio1\n        }\n    },\n);\n\npub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;\n"
  },
  {
    "path": "memory.x",
    "content": "MEMORY {\n    BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100\n    FLASH : ORIGIN = 0x10000100, LENGTH = 2048K - 0x100\n    RAM   : ORIGIN = 0x20000000, LENGTH = 256K\n}\n\nEXTERN(BOOT2_FIRMWARE)\n\nSECTIONS {\n    /* ### Boot loader */\n    .boot2 ORIGIN(BOOT2) :\n    {\n        KEEP(*(.boot2));\n    } > BOOT2\n} INSERT BEFORE .text;\n"
  }
]