Showing preview only (822K chars total). Download the full file or copy to clipboard to get everything.
Repository: rp-rs/rp-hal-boards
Branch: main
Commit: 5135e3dafe3e
Files: 201
Total size: 762.5 KB
Directory structure:
gitextract_xdh1uctv/
├── .cargo/
│ └── config.toml
├── .github/
│ └── workflows/
│ ├── build_and_test.yml
│ ├── clippy.yml
│ └── rustfmt.yml
├── .gitignore
├── APACHE2.0
├── CODE_OF_CONDUCT.md
├── Cargo.toml
├── MIT
├── README.md
├── boards/
│ ├── adafruit-feather-rp2040/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ ├── adafruit_feather_blinky.rs
│ │ │ └── adafruit_feather_neopixel_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── adafruit-itsy-bitsy-rp2040/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ ├── adafruit_itsy_bitsy_blinky.rs
│ │ │ └── adafruit_itsy_bitsy_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── adafruit-kb2040/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ ├── adafruit_kb2040_rainbow.rs
│ │ │ └── adafruit_kb2040_usb_serial.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── adafruit-macropad/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── adafruit-macropad_blinky.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── adafruit-metro-rp2040/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ ├── adafruit_metro_blinky.rs
│ │ │ └── adafruit_metro_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── adafruit-qt-py-rp2040/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── adafruit_qt_py_rp2040_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── adafruit-trinkey-qt2040/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── adafruit_trinkey_qt2040_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── arduino_nano_connect/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── nano_blinky.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── boardsource-blok/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ ├── blok_rainbow.rs
│ │ │ ├── blok_reset_to_usb_boot.rs
│ │ │ └── blok_usb_keyboard_input.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── framework-ledmatrix/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── build.rs
│ │ ├── examples/
│ │ │ └── ledtest.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── framework16-keyboard/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── build.rs
│ │ ├── examples/
│ │ │ ├── capslock.rs
│ │ │ └── white_backlight.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── pimoroni-pico-explorer/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── pimoroni_pico_explorer_showcase.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── pimoroni-pico-lipo-16mb/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── pimoroni_pico_lipo_16mb_blinky.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── pimoroni-plasma-2040/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── build.rs
│ │ ├── examples/
│ │ │ ├── pimoroni_plasma_2040_blinky.rs
│ │ │ └── pimoroni_plasma_2040_ws2812_led.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── pimoroni-servo2040/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── build.rs
│ │ ├── examples/
│ │ │ ├── pimoroni_servo2040_pwm_servo.rs
│ │ │ └── pimoroni_servo2040_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── pimoroni-tiny2040/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── build.rs
│ │ ├── examples/
│ │ │ └── tiny2040_blinky.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── pimoroni-tufty2040/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── tufty_demo.rs
│ │ └── src/
│ │ ├── lib.rs
│ │ └── st7789_parallel.pio
│ ├── pimoroni_badger2040/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── badger_blinky.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── rp-pico/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── build.rs
│ │ ├── examples/
│ │ │ ├── pico_blinky.rs
│ │ │ ├── pico_countdown_blinky.rs
│ │ │ ├── pico_gpio_in_out.rs
│ │ │ ├── pico_hd44780_display.rs
│ │ │ ├── pico_i2c_oled_display_ssd1306.rs
│ │ │ ├── pico_i2c_pio.rs
│ │ │ ├── pico_interpolator.rs
│ │ │ ├── pico_pio_pwm.rs
│ │ │ ├── pico_pwm_blink.rs
│ │ │ ├── pico_pwm_servo.rs
│ │ │ ├── pico_rtic.rs
│ │ │ ├── pico_rtic_monotonic.rs
│ │ │ ├── pico_spi_sd_card.rs
│ │ │ ├── pico_uart_irq_buffer.rs
│ │ │ ├── pico_uart_irq_echo.rs
│ │ │ ├── pico_usb_serial.rs
│ │ │ ├── pico_usb_serial_interrupt.rs
│ │ │ ├── pico_usb_twitchy_mouse.rs
│ │ │ ├── pico_ws2812_led.rs
│ │ │ └── pwm.pio
│ │ └── src/
│ │ └── lib.rs
│ ├── seeeduino-xiao-rp2040/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ ├── seeeduino_xiao_rp2040_blinky.rs
│ │ │ └── seeeduino_xiao_rp2040_neopixel_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── solderparty-rp2040-stamp/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── solderparty_stamp_neopixel_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── sparkfun-micromod-rp2040/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── build.rs
│ │ ├── examples/
│ │ │ ├── sparkfun_micromod_battery_voltage.rs
│ │ │ └── sparkfun_micromod_blinky.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── sparkfun-pro-micro-rp2040/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── sparkfun_pro_micro_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── sparkfun-thing-plus-rp2040/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── sparkfun_thing_plus_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── vcc-gnd-yd-rp2040/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ ├── yd_rp2040_blinky.rs
│ │ │ └── yd_rp2040_neopixel_rainbow.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── waveshare-rp2040-lcd-0-96/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── waveshare_rp2040_lcd_demo.rs
│ │ └── src/
│ │ └── lib.rs
│ ├── waveshare-rp2040-lcd-1-28/
│ │ ├── CHANGELOG.md
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── examples/
│ │ │ └── waveshare_rp2040_lcd_demo.rs
│ │ └── src/
│ │ └── lib.rs
│ └── waveshare-rp2040-zero/
│ ├── CHANGELOG.md
│ ├── Cargo.toml
│ ├── README.md
│ ├── examples/
│ │ └── waveshare_rp2040_zero_neopixel_rainbow.rs
│ └── src/
│ └── lib.rs
└── memory.x
================================================
FILE CONTENTS
================================================
================================================
FILE: .cargo/config.toml
================================================
#
# Cargo Configuration for the https://github.com/rp-rs/rp-hal.git repository.
#
# Copyright (c) The RP-RS Developers, 2021
#
# You might want to make a similar file in your own repository if you are
# writing programs for Raspberry Silicon microcontrollers.
#
# This file is MIT or Apache-2.0 as per the repository README.md file
#
[build]
# Set the default target to match the Cortex-M0+ in the RP2040
target = "thumbv6m-none-eabi"
# Target specific options
[target.thumbv6m-none-eabi]
# Pass some extra options to rustc, some of which get passed on to the linker.
#
# * linker argument --nmagic turns off page alignment of sections (which saves
# flash space)
# * linker argument -Tlink.x tells the linker to use link.x as the linker
# script. This is usually provided by the cortex-m-rt crate, and by default
# the version in that crate will include a file called `memory.x` which
# describes the particular memory layout for your specific chip.
# * no-vectorize-loops turns off the loop vectorizer (seeing as the M0+ doesn't
# have SIMD)
rustflags = [
"-C", "link-arg=--nmagic",
"-C", "link-arg=-Tlink.x",
"-C", "no-vectorize-loops",
]
# This runner will make a UF2 file and then copy it to a mounted RP2040 in USB
# Bootloader mode:
runner = "elf2uf2-rs -d"
# This runner will find a supported SWD debug probe and flash your RP2040 over
# SWD:
# runner = "probe-rs run --chip RP2040"
================================================
FILE: .github/workflows/build_and_test.yml
================================================
on: [push, pull_request]
name: Build and Test check
jobs:
builds:
name: Build checks
runs-on: ubuntu-24.04
strategy:
matrix:
features: ["--features rp2040-hal/rtic-monotonic", "--features rp2040-e5"]
mode: ["", "--release"]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv6m-none-eabi
- name: Build workspace
run: cargo build ${{ matrix.mode }} --workspace ${{ matrix.features }}
- name: Build workspace and examples
run: cargo build ${{ matrix.mode }} --workspace --examples ${{ matrix.features }}
- name: List built examples and clean
run: rm -vrf target/thumbv6m-none-eabi/*/examples/* | sed -e "s/removed '\(.*\)'/\1/" | xargs -l basename | grep -Ev '(-|\.d)'
- name: Test
run: cargo test --tests --target x86_64-unknown-linux-gnu ${{ matrix.features }}
- name: Test docs
run: cargo test --doc --target x86_64-unknown-linux-gnu ${{ matrix.features }}
- name: Clean
run: cargo clean
udeps:
name: Check rp2040-hal for unused dependencies
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-01-30
target: thumbv6m-none-eabi
- name: Install cargo-udeps
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-udeps
version: "=0.1.41"
- name: Check unused deps
run: cargo udeps ${{ matrix.mode }} --workspace ${{ matrix.features }}
================================================
FILE: .github/workflows/clippy.yml
================================================
on: [push, pull_request]
name: Clippy check
jobs:
clippy_check:
runs-on: ubuntu-24.04
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv6m-none-eabi
components: clippy
- run: cargo clippy --workspace --examples --features rp2040-hal/rtic-monotonic -- -Dwarnings
================================================
FILE: .github/workflows/rustfmt.yml
================================================
on: [push, pull_request]
name: Code formatting check
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-24.04
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv6m-none-eabi
components: rustfmt
- run: cargo fmt -- --check
================================================
FILE: .gitignore
================================================
.idea/
target
Cargo.lock
.vscode
*.orig
*.raw
================================================
FILE: APACHE2.0
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2021 rp-rs organization
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# The Rust Code of Conduct
## Conduct
**Contact**: [rp-rs team][team]
* 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.
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
* Please be kind and courteous. There's no need to be mean or rude.
* 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.
* 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.
* 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.
* 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.
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.
## Moderation
These are the policies for upholding our community's standards of conduct.
1. 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.)
2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed.
3. Moderators will first respond to such remarks with a warning.
4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of the communication channel to cool off.
5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.
6. 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.
7. 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.
8. 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.
In 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.
And 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.
The enforcement policies listed above apply to all official embedded rp-rs venues; including official Matrix channels (##rp-rs) and GitHub repositories under rp-rs.
*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/).*
*Text kindly borrowed from the Rust Embedded Working Group*
[team]: https://github.com/orgs/rp-rs/teams/rp-rs
================================================
FILE: Cargo.toml
================================================
[workspace]
resolver = "2"
members = [
"boards/adafruit-feather-rp2040",
"boards/adafruit-itsy-bitsy-rp2040",
"boards/adafruit-kb2040",
"boards/adafruit-macropad",
"boards/adafruit-metro-rp2040",
"boards/adafruit-qt-py-rp2040",
"boards/adafruit-trinkey-qt2040",
"boards/arduino_nano_connect",
"boards/boardsource-blok",
"boards/framework-ledmatrix",
"boards/framework16-keyboard",
"boards/pimoroni_badger2040",
"boards/pimoroni-pico-explorer",
"boards/pimoroni-pico-lipo-16mb",
"boards/pimoroni-plasma-2040",
"boards/pimoroni-servo2040",
"boards/pimoroni-tiny2040",
"boards/pimoroni-tufty2040",
"boards/rp-pico",
"boards/seeeduino-xiao-rp2040",
"boards/solderparty-rp2040-stamp",
"boards/sparkfun-micromod-rp2040",
"boards/sparkfun-pro-micro-rp2040",
"boards/sparkfun-thing-plus-rp2040",
"boards/vcc-gnd-yd-rp2040",
"boards/waveshare-rp2040-zero",
"boards/waveshare-rp2040-lcd-0-96",
"boards/waveshare-rp2040-lcd-1-28",
]
[workspace.dependencies]
arrayvec = { version = "0.7.4", default-features = false }
cortex-m = "0.7.7"
cortex-m-rt = "0.7.3"
cortex-m-rtic = "1.1.4"
critical-section = "1.1.2"
defmt = "0.3.5"
defmt-rtt = "0.4.0"
display-interface = "0.4.1"
display-interface-spi = "0.4.1"
embedded-graphics = "0.7.1"
embedded-hal = "1.0.0"
embedded-hal-nb = "1.0.0"
embedded-sdmmc = "0.5.0"
embedded_hal_0_2 = { package = "embedded-hal", version = "0.2.5", features = ["unproven", ] }
fugit = "0.3.7"
hd44780-driver = "0.4.0"
heapless = "0.7.16"
i2c-pio = "0.8.0"
nb = "1.1"
panic-halt= "0.2.0"
panic-probe = "0.3.1"
pio = "0.2.1"
pio-proc = "0.2.2"
rp2040-boot2 = "0.3.0"
rp2040-hal = "0.10.0"
st7789 = "0.6.1"
st7735-lcd = "0.8.1"
smart-leds = "0.3.0"
ssd1306 = "0.7.1"
usb-device = "0.3.1"
usbd-hid = "0.7.0"
usbd-serial = "0.2.1"
ws2812-pio = "0.8.0"
gc9a01a_driver = "0.1.3"
================================================
FILE: MIT
================================================
MIT License
Copyright (c) 2021 rp-rs organization
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
<!-- PROJECT LOGO -->
<br />
<p align="center">
<a href="https://github.com/rp-rs/rp-hal-boards">
<img src="https://www.svgrepo.com/show/281119/microchip.svg" alt="Logo" width="140" height="140">
</a>
<h3 align="center">rp-hal-boards</h3>
<p align="center">
Rust support for boards based on the "Raspberry Silicon" family of microcontrollers
<br />
<br />
<a href="https://github.com/rp-rs/rp-hal/">rp2040-hal</a>
·
<a href="https://github.com/rp-rs/rp-hal/issues">Report a Bug</a>
·
<a href="https://matrix.to/#/#rp-rs:matrix.org">Chat on Matrix</a>
</p>
</p>
<!-- TABLE OF CONTENTS -->
<details open="open">
<summary><h2 style="display: inline-block">Table of Contents</h2></summary>
<ol>
<li><a href="#gettting_started">Getting Started</a></li>
<li><a href="#programming">Programming</a></li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#acknowledgements">Acknowledgements</a></li>
</ol>
</details>
<!-- GETTING STARTED -->
## Getting Started
So, you want to program your new Raspberry Silicon microcontroller, using the
Rust programming language. You've come to the right place!
These board support packages are based on
[`rp-hal`](https://github.com/rp-rs/rp-hal) - a collection of high-level
drivers for the Raspberry Silicon RP2040 microcontroller and various
associated boards, like the Raspberry Pi Pico and the Adafruit Feather
RP2040.
If you want to write an application for Raspberry Silicon, check out our
[RP2040 Project Template](https://github.com/rp-rs/rp2040-project-template).
If you want to try out some examples on one of our supported boards, check out
the list of *Board Support Packages* below, and click through to see the various
examples for each board.
Before trying any of the examples, please ensure you have the latest stable
version of Rust installed, along with the right target support:
```sh
rustup self update
rustup update stable
rustup target add thumbv6m-none-eabi
```
You may also want to install these helpful tools:
```sh
# Useful to creating UF2 images for the RP2040 USB Bootloader
cargo install --locked elf2uf2-rs
# Useful for flashing over the SWD pins using a supported JTAG probe
cargo install --locked probe-rs-tools
```
## Packages
This git repository is organised as a [Cargo Workspace].
If you are writing code that should work on any RP2040 device, use
the [HAL crate]. If you are running code on a specific board, use
the appropriate _BSP_ crate (which will include the _HAL_ crate for
you). Please note, you cannot depend on multiple _BSP_ crates; you have
to pick one, or use [Cargo Features] to select one at build time.
Each BSP includes some examples to show off the features of that particular board.
[HAL crate]: https://github.com/rp-rs/rp-hal
[Cargo Workspace]: https://doc.rust-lang.org/cargo/reference/workspaces.html
[Embedded HAL]: https://github.com/rust-embedded/embedded-hal
[Cargo Features]: https://doc.rust-lang.org/cargo/reference/features.html
[rp2040-hal]: https://crates.io/crates/rp2040-hal
### [rp-pico] - Board Support for the [Raspberry Pi Pico]
You should include this crate if you are writing code that you want to run on
a [Raspberry Pi Pico] - the original launch PCB for the RP2040 chip.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Pico.
[Raspberry Pi Pico]: https://www.raspberrypi.org/products/raspberry-pi-pico/
[rp-pico]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/rp-pico
### [adafruit-feather-rp2040] - Board Support for the [Adafruit Feather RP2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit Feather RP2040] - a Feather form-factor RP2040 board from Adafruit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Feather RP2040.
[Adafruit Feather RP2040]: https://www.adafruit.com/product/4884
[adafruit-feather-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-feather-rp2040
### [adafruit-itsy-bitsy-rp2040] - Board Support for the [Adafruit ItsyBitsy RP2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit ItsyBitsy RP2040] - an RP2040 board in the ItsyBitsy family.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the ItsyBitsy RP2040.
[Adafruit ItsyBitsy RP2040]: https://www.adafruit.com/product/4888
[adafruit-itsy-bitsy-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-itsy-bitsy-rp2040
### [adafruit-kb2040] - Board Support for the [Adafruit KB2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit KB2040] - an Arduino Pro Micro-shaped board for keyboards.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the KB2040.
[Adafruit KB2040]: https://www.adafruit.com/product/5302
[adafruit-kb2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-kb2040
### [adafruit-macropad] - Board Support for the [Adafruit Macropad]
You should include this crate if you are writing code that you want to run on
an [Adafruit Macropad] - a 3x4 keyboard and OLED combo board from Adafruit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Macropad.
[adafruit-macropad]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-macropad
[Adafruit Macropad]: https://www.adafruit.com/product/5128
### [adafruit-metro-rp2040] - Board Support for the [Adafruit Metro RP2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit Metro RP2040] - an RP2040 board in the Metro family.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Metro RP2040.
[Adafruit Metro RP2040]: https://www.adafruit.com/product/5786
[adafruit-metro-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-metro-rp2040
### [adafruit-qt-py-rp2040] - Board Support for the [Adafruit QT Py RP2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit QT Py RP2040] - an extremely small form-factor RP2040 board from Adafruit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Feather RP2040.
[Adafruit QT Py RP2040]: https://www.adafruit.com/product/4900
[adafruit-qt-py-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-qt-py-rp2040
### [adafruit-trinkey-qt2040] - Board Support for the [Adafruit Trinkey QT2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit Trinkey QT2040] - a 3x4 keyboard and OLED combo board from Adafruit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Trinkey.
[Adafruit-Trinkey-QT2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-trinkey-qt2040
[adafruit trinkey qt2040]: https://www.adafruit.com/product/5056
### [boardsource-blok] - Board Support for the [Blok]
You should include this crate if you are writing code that you want to run on
a [Blok] - an RP2040 based controller, made by [Boardsource],
built for the keyboard community.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Blok.
[Blok]: https://boardsource.xyz/store/628b95b494dfa308a6581622
[boardsource-blok]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/boardsource-blok
[Boardsource]: https://boardsource.xyz/
### [pimoroni_badger2040] - Board Support for the [Pimoroni Badger2040]
You should include this crate if you are writing code that you want to run on
a [Pimoroni Badger2040] - a conference-style badge built around an e-paper
display and an rp2040
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Badger2040.
[Pimoroni Badger2040]: https://shop.pimoroni.com/products/badger-2040
[pimoroni_badger2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni_badger2040
### [pimoroni-pico-explorer] - Board Support for the [Pimoroni Pico Explorer]
You should include this crate if you are writing code that you want to run on
a [Pimoroni Pico Explorer] - a breakout board for the [Raspberry Pi Pico] featuring a small LCD screen, a
breadboard and some breakout headers.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Pico Explorer.
[Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pimoroni-pico-explorer-base
[pimoroni-pico-explorer]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-pico-explorer
### [pimoroni-pico-lipo-16mb] - Board Support for the [Pimoroni Pico Lipo 16MB]
You should include this crate if you are writing code that you want to run on
a [Pimoroni Pico Lipo 16MB] - a board with USB-C, STEMMA QT/Qwiic connectors,
plus a Li-Po battery charging circuit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Pico Lipo.
Note that if you use this crate the compiler will expect the full 16MB flash
space, and so it may not work if you only have the 4MB variant.
[Pimoroni Pico Lipo 16MB]: https://shop.pimoroni.com/products/pimoroni-pico-lipo?variant=39335427080275
[pimoroni-pico-lipo-16mb]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-pico-lipo-16mb
### [pimoroni-plasma-2040] - Board Support for the [Pimoroni Plasma 2040]
You should include this crate if you are writing code that you want to run on
a [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.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Pimoroni Plasma 2040.
[Pimoroni Plasma 2040]: https://shop.pimoroni.com/products/plasma-2040
[pimoroni-plasma-2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-plasma-2040
### [pimoroni-servo2040] - Board Support for the [Pimoroni Servo2040]
You should include this crate if you are writing code that you want to run on
a [Pimoroni Servo2040] - a standalone servo motor controller for up to 18 servos
and 6 sensors.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Servo2040.
[Pimoroni Servo2040]: https://shop.pimoroni.com/products/servo-2040
[pimoroni-servo2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-servo2040
### [pimoroni-tiny2040] - Board Support for the [Pimoroni Tiny2040]
You should include this crate if you are writing code that you want to run on
a [Pimoroni Tiny2040] - one of the first third party RP2040 boards available, with 8MB flash and a 3 colour LED.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Tiny2040.
[Pimoroni Tiny2040]: https://shop.pimoroni.com/products/tiny-2040
[pimoroni-tiny2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/pimoroni-tiny2040
### [solderparty-rp2040-stamp] - Board Support for the [SolderParty RP2040 Stamp]
You should include this crate if you are writing code that you want to run on
a [SolderParty RP2040 Stamp] - a square RP2040 board with castellated edges.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Stamp.
[SolderParty RP2040 Stamp]: https://www.solder.party/docs/rp2040-stamp/
[solderparty-rp2040-stamp]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/solderparty-rp2040-stamp
### [sparkfun-micromod-rp2040] - Board Support for the [SparkFun MicroMod RP2040]
You should include this crate if you are writing code that you want to run on
a [SparkFun MicroMod RP2040] - the RP2040 processor board for the [SparkFun MicroMod] ecosystem.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the MicroMod RP2040.
[SparkFun MicroMod RP2040]: https://www.sparkfun.com/products/17720
[SparkFun MicroMod]: https://www.sparkfun.com/micromod
[sparkfun-micromod-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-micromod-rp2040
### [sparkfun-pro-micro-rp2040] - Board Support for the [Sparkfun Pro Micro RP2040]
You should include this crate if you are writing code that you want to run on
a [Sparkfun Pro Micro RP2040] - a smaller RP2040 board with USB-C and a WS2812B addressable LED.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Pro Micro RP2040.
[Sparkfun Pro Micro RP2040]: https://www.sparkfun.com/products/18288
[sparkfun-pro-micro-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-pro-micro-rp2040
### [sparkfun-thing-plus-rp2040] - Board Support for the [Sparkfun Thing Plus RP2040]
You should include this crate if you are writing code that you want to run on
a [Sparkfun Thing Plus RP2040] - an RP2040 board with a Feather form factor, USB-C, and a WS2812B addressable LED.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Thing Plus RP2040.
[Sparkfun Thing Plus RP2040]: https://www.sparkfun.com/products/17745
[sparkfun-thing-plus-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/sparkfun-thing-plus-rp2040
### [arduino_nano_connect] - Board Support for the [Arduino Nano RP2040 Connect]
You should include this crate if you are writing code that you want to run on
an [Arduino Nano RP2040 Connect] - a development pcb with shortwave communication, IMU, and BLE package.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the nano connect.
[Arduino Nano RP2040 Connect]: https://store-usa.arduino.cc/collections/boards/products/arduino-nano-rp2040-connect
[arduino_nano_connect]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/arduino_nano_connect
### [seeeduino-xiao-rp2040] - Board Support for the [Seeeduino XIAO RP2040]
You should include this crate if you are writing code that you want to run on
a [Seeeduino XIAO RP2040] - a tiny board for wearable devices and small
projects.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the XIAO RP2040.
[Seeeduino XIAO RP2040]: https://www.seeedstudio.com/XIAO-RP2040-v1-0-p-5026.html
[seeeduino-xiao-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/seeeduino-xiao-rp2040
### [vcc-gnd-yd-rp2040] - Board Support for the [VCC-GND Studio YD-RP2040]
You should include this crate if you are writing code that you want to run on
a [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.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the YD-RP2040.
[VCC-GND Studio YD-RP2040]: http://152.32.187.208:8080/yd-data/YD-RP2040/
[vcc-gnd-yd-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/vcc-gnd-yd-rp2040
### [waveshare-rp2040-zero] - Board Support for the [Waveshare RP2040 Zero]
You should include this crate if you are writing code that you want to run on
an [Waveshare RP2040 Zero] - a very small RP2040 breakout board with USB-C and a RGB led from Waveshare.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the board.
[Waveshare RP2040 Zero]: https://www.waveshare.com/wiki/RP2040-Zero
[waveshare-rp2040-zero]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/waveshare-rp2040-zero
### [waveshare-rp2040-lcd-0_96] - Board Support for the [Waveshare RP2040 LCD 0.96"]
You should include this crate if you are writing code that you want to run on
an [Waveshare RP2040 LCD 0.96"] - a very small RP2040 breakout board with USB-C,
a 65K IPS LCD 160x80, 16MBit Flash and 1A battery charger from Waveshare.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the board.
[Waveshare RP2040 LCD 0.96"]: https://www.waveshare.com/wiki/RP2040-LCD-0.96
[waveshare-rp2040-lcd-0_96]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/waveshare-rp2040-lcd-0-96
<!-- PROGRAMMING -->
## Programming
Rust generates standard Arm ELF files, which you can load onto your Raspberry Pi
Silicon device with your favourite Arm flashing/debugging tool. In addition, the
RP2040 contains a ROM bootloader which appears as a Mass Storage Device over USB
that accepts UF2 format images. You can use the `elf2uf2-rs` package to convert
the Arm ELF file to a UF2 format image.
For boards with USB Device support like the Raspberry Pi Pico, we recommend you
use the UF2 process.
The RP2040 contains two Cortex-M0+ processors, which execute Thumb-2 encoded
ARMv6-M instructions. There are no operating-specific features in the binaries
produced - they are for 'bare-metal' systems. For compatibilty with other Arm
code (e.g. as produced by GCC), Rust uses the *Arm Embedded-Application Binary
Interface* standard or EABI. Therefore, any Rust code for the RP2040 should be
compiled with the target *`thumbv6m-none-eabi`*.
More details can be found in the [Project Template](https://github.com/rp-rs/rp2040-project-template).
### Loading a UF2 over USB
*Step 1* - Install [`elf2uf2-rs`](https://github.com/JoNil/elf2uf2-rs):
```console
$ cargo install elf2uf2-rs --locked
```
*Step 2* - Make sure your .cargo/config.toml contains the following (it should by
default if you are working in this repository):
```toml
[target.thumbv6m-none-eabi]
runner = "elf2uf2-rs -d"
```
The `thumbv6m-none-eabi` target may be replaced by the all-Arm wildcard
`'cfg(all(target_arch = "arm", target_os = "none"))'`.
*Step 3* - Boot your RP2040 into "USB Bootloader mode", typically by rebooting
whilst holding some kind of "Boot Select" button. On Linux, you will also need
to 'mount' the device, like you would a USB Thumb Drive.
*Step 4* - Use `cargo run`, which will compile the code and started the
specified 'runner'. As the 'runner' is the elf2uf2-rs tool, it will build a UF2
file and copy it to your RP2040.
```console
$ cargo run --release --example pico_pwm_blink
```
### Loading with probe-rs
[probe-rs](https://github.com/probe-rs/probe-rs) is a library and a
command-line tool which can flash a wide variety of microcontrollers
using a wide variety of debug/JTAG probes. Unlike using, say, OpenOCD,
probe-rs can autodetect your debug probe, which can make it easier to use.
*Step 1* - Install `probe-rs`:
```console
$ cargo install --locked probe-rs-tools
```
Alternatively, follow the installation instructions on https://probe.rs/.
*Step 2* - Make sure your .cargo/config.toml contains the following:
```toml
[target.thumbv6m-none-eabi]
runner = "probe-rs run --chip RP2040"
```
*Step 3* - Connect your USB JTAG/debug probe (such as a Raspberry Pi Pico
running [this firmware](https://github.com/majbthrd/DapperMime)) to the SWD
programming pins on your RP2040 board. Check the probe has been found by
running:
```console
$ probe-rs list
The following debug probes were found:
[0]: J-Link (J-Link) (VID: 1366, PID: 0101, Serial: 000099999999, JLink)
```
There is a SEGGER J-Link connected in the example above - the mesage you see
will reflect the probe you have connected.
*Step 4* - Use `cargo run`, which will compile the code and start the specified
'runner'. As the 'runner' is the `probe-rs` tool, it will connect to the
RP2040 via the first probe it finds, and install your firmware into the Flash
connected to the RP2040.
```console
$ cargo run --release --example pico_pwm_blink
```
### Loading with picotool
As ELF files produced by compiling Rust code are completely compatible with ELF
files produced by compiling C or C++ code, you can also use the Raspberry Pi
tool [picotool](https://github.com/raspberrypi/picotool). The only thing to be
aware of is that picotool expects your ELF files to have a `.elf` extension, and
by default Rust does not give the ELF files any extension. You can fix this by
simply renaming the file.
Also of note is that the special
[pico-sdk](https://github.com/raspberrypi/pico-sdk) macros which hide
information in the ELF file in a way that `picotool info` can read it out, are
not supported in Rust. An alternative is TBC.
<!-- ROADMAP -->
## Roadmap
NOTE These packages are under active development. As such, it is likely to
remain volatile until a 1.0.0 release.
See the [open issues](https://github.com/rp-rs/rp-hal/issues) for a list of
proposed features (and known issues).
<!-- CONTRIBUTING -->
## Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
The steps are:
1. Fork the Project by clicking the 'Fork' button at the top of the page.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Make some changes to the code or documentation.
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)
6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)
7. An admin will review the Pull Request and discuss any changes that may be required.
8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!
<!-- CODE OF CONDUCT -->
## Code of Conduct
Contribution to this crate is organized under the terms of the [Rust Code of
Conduct][CoC], and the maintainer of this crate, the [rp-rs team], promises
to intervene to uphold that code of conduct.
[CoC]: CODE_OF_CONDUCT.md
[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs
<!-- LICENSE -->
## License
The contents of this repository are dual-licensed under the _MIT OR Apache
2.0_ License. That means you can choose either the MIT license or the
Apache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more
information on each specific license.
Any submissions to this project (e.g. as Pull Requests) must be made available
under these terms.
<!-- CONTACT -->
## Contact
Raise an issue: [https://github.com/rp-rs/rp-hal-boards/issues](https://github.com/rp-rs/rp-hal-boards/issues)
Chat to us on Matrix: [#rp-rs:matrix.org](https://matrix.to/#/#rp-rs:matrix.org)
<!-- ACKNOWLEDGEMENTS -->
## Acknowledgements
* [Othneil Drew's README template](https://github.com/othneildrew)
* [Rust Embedded Working Group](https://github.com/rust-embedded)
* [Raspberry Pi](https://raspberrypi.org) and the [Pico SDK](https://github.com/raspberrypi/pico-sdk)
================================================
FILE: boards/adafruit-feather-rp2040/CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 0.8.0 - 2024-04-07
### Changed
- Update to embedded-hal 1.0.0
- Update to rp2040-hal 0.10.0
## 0.7.0 - 2023-09-02
### Changed
- Update to rp2040-hal 0.9.0
- Update to ws2812-pio 0.7.0
## 0.6.0 - 2023-02-18
### Changed
- Update to rp2040-hal 0.7.0
- Update to ws2812-pio 0.6.0
## 0.5.0 - 2022-12-11
### Changed
- Update to rp2040-hal 0.7.0
- Update to ws2812-pio 0.5.0
## 0.4.0 - 2022-08-26
### Changed
- Migrate from `embedded-time` to `fugit`
- Bump `ws2812-pio` to 0.4.0
- Update to rp2040-hal 0.6.0
## 0.3.0 - 2022-06-13
### Changed
- Update to rp2040-hal 0.5.0
## 0.2.0 - 2022-03-11
### Changed
- Update to rp2040-hal 0.4.0
## 0.1.0 - 2021-12-20
- Initial release
================================================
FILE: boards/adafruit-feather-rp2040/Cargo.toml
================================================
[package]
name = "adafruit-feather-rp2040"
version = "0.8.0"
authors = ["Andrea Nall <anall@andreanal.com>", "The rp-rs Developers"]
edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-feather-rp2040"
description = "Board Support Package for the Adafruit Feather RP2040"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal-boards.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m-rt = { workspace = true, optional = true }
rp2040-boot2 = { workspace = true, optional = true }
rp2040-hal.workspace = true
[dev-dependencies]
cortex-m.workspace = true
panic-halt.workspace = true
embedded-hal.workspace = true
fugit.workspace = true
nb.workspace = true
smart-leds.workspace = true
ws2812-pio.workspace = true
[features]
# This is the set of features we enable by default
default = ["boot2", "rt", "critical-section-impl", "rom-func-cache"]
# critical section that is safe for multicore use
critical-section-impl = ["rp2040-hal/critical-section-impl"]
# 2nd stage bootloaders for rp2040
boot2 = ["rp2040-boot2"]
# Minimal startup / runtime for Cortex-M microcontrollers
rt = ["cortex-m-rt","rp2040-hal/rt"]
# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.
# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it
rp2040-e5 = ["rp2040-hal/rp2040-e5"]
# Memoize(cache) ROM function pointers on first use to improve performance
rom-func-cache = ["rp2040-hal/rom-func-cache"]
# Disable automatic mapping of language features (like floating point math) to ROM functions
disable-intrinsics = ["rp2040-hal/disable-intrinsics"]
# This enables ROM functions for f64 math that were not present in the earliest RP2040s
rom-v2-intrinsics = ["rp2040-hal/rom-v2-intrinsics"]
================================================
FILE: boards/adafruit-feather-rp2040/README.md
================================================
# [adafruit-feather-rp2040] - Board Support for the [Adafruit Feather RP2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit Feather RP2040] - a Feather form-factor RP2040 board from Adafruit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Feather.
[Adafruit Feather RP2040]: https://www.adafruit.com/product/4884
[adafruit-feather-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-feather-rp2040
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
## Using
To use this crate, your `Cargo.toml` file should contain:
```toml
adafruit-feather-rp2040 = "0.8.0"
```
In your program, you will need to call `adafruit_feather_rp2040::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details.
## Examples
### General Instructions
To compile an example, clone the _rp-hal-boards_ repository and run:
```console
rp-hal-boards/boards/adafruit-feather-rp2040 $ cargo build --release --example <name>
```
You will get an ELF file called
`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`
folder is located at the top of the _rp-hal-boards_ repository checkout. Normally
you would also need to specify `--target=thumbv6m-none-eabi` but when
building examples from this git repository, that is set as the default.
If you want to convert the ELF file to a UF2 and automatically copy it to the
USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run:
```console
rp-hal-boards/boards/adafruit-feather-rp2040 $ cargo run --release --example <name>
```
If you get an error about not being able to find `elf2uf2-rs`, try:
```console
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
```
### [adafruit_feather_blinky](./examples/adafruit_feather_blinky.rs)
Flashes the Feather's onboard LED on and off.
### [adafruit_feather_neopixel_rainbow](./examples/adafruit_feather_neopixel_rainbow.rs)
Flows smoothly through various colors on the Feather's onboard NeoPixel LED.
## Contributing
Contributions are what make the open source community such an amazing place to
be, learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
The steps are:
1. Fork the Project by clicking the 'Fork' button at the top of the page.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Make some changes to the code or documentation.
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)
6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)
7. An admin will review the Pull Request and discuss any changes that may be required.
8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!
## Code of Conduct
Contribution to this crate is organized under the terms of the [Rust Code of
Conduct][CoC], and the maintainer of this crate, the [rp-rs team], promises
to intervene to uphold that code of conduct.
[CoC]: CODE_OF_CONDUCT.md
[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs
## License
The contents of this repository are dual-licensed under the _MIT OR Apache
2.0_ License. That means you can choose either the MIT license or the
Apache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more
information on each specific license.
Any submissions to this project (e.g. as Pull Requests) must be made available
under these terms.
================================================
FILE: boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs
================================================
//! Blinks the LED on a Adafruit Feather RP2040 board
//!
//! This will blink on-board LED.
#![no_std]
#![no_main]
use adafruit_feather_rp2040::entry;
use adafruit_feather_rp2040::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
watchdog::Watchdog,
Sio,
},
Pins, XOSC_CRYSTAL_FREQ,
};
use embedded_hal::digital::OutputPin;
use panic_halt as _;
#[entry]
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let core = pac::CorePeripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
let sio = Sio::new(pac.SIO);
let pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let mut led_pin = pins.d13.into_push_pull_output();
loop {
led_pin.set_high().unwrap();
delay.delay_ms(1500);
led_pin.set_low().unwrap();
delay.delay_ms(1500);
}
}
================================================
FILE: boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs
================================================
//! Rainbow effect color wheel using the onboard NeoPixel on an Adafruit Feather RP2040 board
//!
//! This flows smoothly through various colors on the onboard NeoPixel.
//! Uses the `ws2812_pio` driver to control the NeoPixel, which in turns uses the
//! RP2040's PIO block.
#![no_std]
#![no_main]
use adafruit_feather_rp2040::entry;
use adafruit_feather_rp2040::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
pio::PIOExt,
timer::Timer,
watchdog::Watchdog,
Sio,
},
Pins, XOSC_CRYSTAL_FREQ,
};
use core::iter::once;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
#[entry]
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let sio = Sio::new(pac.SIO);
let pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
// Configure the addressable LED
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
// The onboard NeoPixel is attached to GPIO pin #16 on the Feather RP2040.
pins.neopixel.into_function(),
&mut pio,
sm0,
clocks.peripheral_clock.freq(),
timer.count_down(),
);
// Infinite colour wheel loop
let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);
timer.delay_ms(25);
}
}
/// Convert a number from `0..=255` to an RGB color triplet.
///
/// The colours are a transition from red, to green, to blue and back to red.
fn wheel(mut wheel_pos: u8) -> RGB8 {
wheel_pos = 255 - wheel_pos;
if wheel_pos < 85 {
// No green in this sector - red and blue only
(255 - (wheel_pos * 3), 0, wheel_pos * 3).into()
} else if wheel_pos < 170 {
// No red in this sector - green and blue only
wheel_pos -= 85;
(0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()
} else {
// No blue in this sector - red and green only
wheel_pos -= 170;
(wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()
}
}
================================================
FILE: boards/adafruit-feather-rp2040/src/lib.rs
================================================
#![no_std]
pub extern crate rp2040_hal as hal;
#[cfg(feature = "rt")]
extern crate cortex_m_rt;
#[cfg(feature = "rt")]
pub use hal::entry;
/// The linker will place this boot block at the start of our program image. We
/// need this to help the ROM bootloader get our code up and running.
#[cfg(feature = "boot2")]
#[link_section = ".boot2"]
#[no_mangle]
#[used]
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_GD25Q64CS;
pub use hal::pac;
hal::bsp_pins!(
Gpio0 {
name: tx,
aliases: { FunctionUart, PullNone: UartTx }
},
Gpio1 {
name: rx,
aliases: { FunctionUart, PullNone: UartRx }
},
Gpio2 {
name: sda,
aliases: { FunctionI2C, PullUp: Sda }
},
Gpio3 {
name: scl,
aliases: { FunctionI2C, PullUp: Scl }
},
Gpio6 { name: d4 },
Gpio7 { name: d5 },
Gpio8 { name: d6 },
Gpio9 { name: d9 },
Gpio10 { name: d10 },
Gpio11 { name: d11 },
Gpio12 { name: d12 },
Gpio13 { name: d13 },
Gpio16 { name: neopixel },
Gpio18 {
name: sclk,
aliases: { FunctionSpi, PullNone: Sclk }
},
Gpio19 {
name: mosi,
aliases: { FunctionSpi, PullNone: Mosi }
},
Gpio20 {
name: miso,
aliases: { FunctionSpi, PullNone: Miso }
},
Gpio24 { name: d24 },
Gpio25 { name: d25 },
Gpio26 { name: a0 },
Gpio27 { name: a1 },
Gpio28 { name: a2 },
Gpio29 { name: a3 },
);
pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
================================================
FILE: boards/adafruit-itsy-bitsy-rp2040/CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 0.8.0 - 2024-04-07
### Changed
- Update to embedded-hal 1.0.0
- Update to rp2040-hal 0.10.0
## 0.7.0 - 2023-09-02
### Changed
- Update to rp2040-hal 0.9.0
- Update to ws2812-pio 0.7.0
## 0.6.0 - 2023-02-18
### Changed
- Update to rp2040-hal 0.8.0
- Update to ws2812-pio 0.6.0
## 0.5.0 - 2022-12-11
### Changed
- Update to rp2040-hal 0.7.0
- Update to ws2812-pio 0.5.0
## 0.4.0 - 2022-08-26
### Changed
- Migrate from `embedded-time` to `fugit`
- Bump `ws2812-pio` to 0.4.0
- Update to rp2040-hal 0.6.0
## 0.3.0 - 2022-06-13
### Changed
- Update to rp2040-hal 0.5.0
## 0.2.0 - 2022-03-11
### Changed
- Update to rp2040-hal 0.4.0
## 0.1.0 - 2021-12-20
- Initial release
================================================
FILE: boards/adafruit-itsy-bitsy-rp2040/Cargo.toml
================================================
[package]
name = "adafruit-itsy-bitsy-rp2040"
version = "0.8.0"
authors = ["Andrew Christiansen <andrewtaylorchristiansen@gmail.com>", "The rp-rs Developers"]
edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit_itsy_bitsy_rp2040"
description = "Board Support Package for the Adafruit ItsyBitsy RP2040"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal-boards.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m-rt = { workspace = true, optional = true }
rp2040-boot2 = { workspace = true, optional = true }
rp2040-hal.workspace = true
[dev-dependencies]
cortex-m.workspace = true
panic-halt.workspace = true
embedded-hal.workspace = true
smart-leds.workspace = true
nb.workspace = true
ws2812-pio.workspace = true
fugit.workspace = true
[features]
# This is the set of features we enable by default
default = ["boot2", "rt", "critical-section-impl", "rom-func-cache"]
# critical section that is safe for multicore use
critical-section-impl = ["rp2040-hal/critical-section-impl"]
# 2nd stage bootloaders for rp2040
boot2 = ["rp2040-boot2"]
# Minimal startup / runtime for Cortex-M microcontrollers
rt = ["cortex-m-rt","rp2040-hal/rt"]
# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.
# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it
rp2040-e5 = ["rp2040-hal/rp2040-e5"]
# Memoize(cache) ROM function pointers on first use to improve performance
rom-func-cache = ["rp2040-hal/rom-func-cache"]
# Disable automatic mapping of language features (like floating point math) to ROM functions
disable-intrinsics = ["rp2040-hal/disable-intrinsics"]
# This enables ROM functions for f64 math that were not present in the earliest RP2040s
rom-v2-intrinsics = ["rp2040-hal/rom-v2-intrinsics"]
================================================
FILE: boards/adafruit-itsy-bitsy-rp2040/README.md
================================================
# [adafruit-itsy-bitsy-rp2040] - Board Support for the [Adafruit ItsyBitsy RP2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit ItsyBitsy RP2040] - an RP2040 board in the Itsy family from Adafruit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the ItsyBitsy RP2040.
[Adafruit ItsyBitsy RP2040]: https://www.adafruit.com/product/4888
[adafruit-itsy-bitsy-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-itsy-bitsy-rp2040
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
## Using
To use this crate, your `Cargo.toml` file should contain:
```toml
adafruit-itsy-bitsy-rp2040 = "0.8.0"
```
In your program, you will need to call `adafruit_itsy_bitsy_rp2040::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details.
## Examples
### General Instructions
To compile an example, clone the _rp-hal-boards_ repository and run:
```console
rp-hal-boards/boards/adafruit-itsy-bitsy-rp2040 $ cargo build --release --example <name>
```
You will get an ELF file called
`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`
folder is located at the top of the _rp-hal-boards_ repository checkout. Normally
you would also need to specify `--target=thumbv6m-none-eabi` but when
building examples from this git repository, that is set as the default.
If you want to convert the ELF file to a UF2 and automatically copy it to the
USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run:
```console
rp-hal-boards/boards/adafruit-itsy-bitsy-rp2040 $ cargo run --release --example <name>
```
If you get an error about not being able to find `elf2uf2-rs`, try:
```console
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
```
### [adafruit_itsy_bitsy_blinky](./examples/adafruit_itsy_bitsy_blinky.rs)
Blink an LED on and off.
### [adafruit_itsy_bitsy_rainbow](./examples/adafruit_itsy_bitsy_rainbow.rs)
Continuously changes the color of the ItsyBitsy's onboard Neopixel.
## Contributing
Contributions are what make the open source community such an amazing place to
be learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
The steps are:
1. Fork the Project by clicking the 'Fork' button at the top of the page.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Make some changes to the code or documentation.
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)
6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)
7. An admin will review the Pull Request and discuss any changes that may be required.
8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!
## Code of Conduct
Contribution to this crate is organized under the terms of the [Rust Code of
Conduct][CoC], and the maintainer of this crate, the [rp-rs team], promises
to intervene to uphold that code of conduct.
[CoC]: CODE_OF_CONDUCT.md
[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs
## License
The contents of this repository are dual-licensed under the _MIT OR Apache
2.0_ License. That means you can choose either the MIT license or the
Apache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more
information on each specific license.
Any submissions to this project (e.g. as Pull Requests) must be made available
under these terms.
================================================
FILE: boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs
================================================
//! # GPIO 'Blinky' Example
//!
//! Blinks the LED on a Adafruit itsy-bitsy RP2040 board
//!
//! It may need to be adapted to your particular board layout and/or pin assignment.
//!
//! See the `Cargo.toml` file for Copyright and license details.
#![no_std]
#![no_main]
// The macro for our start-up function
use adafruit_itsy_bitsy_rp2040::entry;
// Ensure we halt the program on panic (if we don't mention this crate it won't
// be linked)
use panic_halt as _;
// Some traits we need
use embedded_hal::digital::OutputPin;
use adafruit_itsy_bitsy_rp2040::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
sio::Sio,
watchdog::Watchdog,
},
Pins, XOSC_CRYSTAL_FREQ,
};
use cortex_m::delay::Delay;
/// Entry point to our bare-metal application.
///
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
/// as soon as all global variables are initialised.
///
/// The function configures the RP2040 peripherals, then toggles a GPIO pin in
/// an infinite loop. If there is an LED connected to that pin, it will blink.
#[entry]
fn main() -> ! {
// Grab our singleton objects
let mut pac = pac::Peripherals::take().unwrap();
let core = pac::CorePeripherals::take().unwrap();
// Set up the watchdog driver - needed by the clock setup code
let mut watchdog = Watchdog::new(pac.WATCHDOG);
// Configure the clocks
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
// The single-cycle I/O block controls our GPIO pins
let sio = Sio::new(pac.SIO);
let pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let mut led_pin = pins.d13.into_push_pull_output();
loop {
led_pin.set_high().unwrap();
delay.delay_ms(500);
led_pin.set_low().unwrap();
delay.delay_ms(500);
}
}
// End of file
================================================
FILE: boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs
================================================
//! Continuously changes the color of the Neopixel on a Adafruit ItsyBitsy RP2040 board
#![no_std]
#![no_main]
use adafruit_itsy_bitsy_rp2040::entry;
use core::iter::once;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
use adafruit_itsy_bitsy_rp2040::{
hal::{
clocks::{init_clocks_and_plls, Clock},
gpio::PinState,
pac,
pio::PIOExt,
watchdog::Watchdog,
Sio, Timer,
},
Pins, XOSC_CRYSTAL_FREQ,
};
#[entry]
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let sio = Sio::new(pac.SIO);
let pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let led = pins.neopixel_data.into_function();
pins.neopixel_power
.into_push_pull_output_in_state(PinState::High);
let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
led,
&mut pio,
sm0,
clocks.peripheral_clock.freq(),
timer.count_down(),
);
let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);
timer.delay_ms(25);
}
}
/// Convert a number from `0..=255` to an RGB color triplet.
///
/// The colours are a transition from red, to green, to blue and back to red.
fn wheel(mut wheel_pos: u8) -> RGB8 {
wheel_pos = 255 - wheel_pos;
if wheel_pos < 85 {
// No green in this sector - red and blue only
(255 - (wheel_pos * 3), 0, wheel_pos * 3).into()
} else if wheel_pos < 170 {
// No red in this sector - green and blue only
wheel_pos -= 85;
(0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()
} else {
// No blue in this sector - red and green only
wheel_pos -= 170;
(wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()
}
}
================================================
FILE: boards/adafruit-itsy-bitsy-rp2040/src/lib.rs
================================================
#![no_std]
pub extern crate rp2040_hal as hal;
#[cfg(feature = "rt")]
extern crate cortex_m_rt;
#[cfg(feature = "rt")]
pub use hal::entry;
/// The linker will place this boot block at the start of our program image. We
/// need this to help the ROM bootloader get our code up and running.
#[cfg(feature = "boot2")]
#[link_section = ".boot2"]
#[no_mangle]
#[used]
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
pub use hal::pac;
hal::bsp_pins!(
Gpio0 {
name: tx,
aliases: { FunctionUart, PullNone: UartTx }
},
Gpio1 {
name: rx,
aliases: { FunctionUart, PullNone: UartRx }
},
Gpio2 {
name: sda,
aliases: { FunctionI2C, PullUp: Sda }
},
Gpio3 {
name: scl,
aliases: { FunctionI2C, PullUp: Scl }
},
Gpio4 { name: d4 },
Gpio5 { name: d3 },
Gpio6 { name: d7 },
Gpio7 { name: d9 },
Gpio8 { name: d10 },
Gpio9 { name: d11 },
Gpio10 { name: d12 },
Gpio11 { name: d13 },
Gpio12 { name: d2 },
Gpio14 { name: d5 },
Gpio16 { name: neopixel_power },
Gpio17 { name: neopixel_data },
Gpio18 {
name: sclk,
aliases: { FunctionSpi, PullNone: Sclk }
},
Gpio19 {
name: mosi,
aliases: { FunctionSpi, PullNone: Mosi }
},
Gpio20 {
name: miso
aliases: { FunctionSpi, PullNone: Miso }
},
Gpio24 { name: d24 },
Gpio25 { name: d25 },
Gpio26 { name: a0 },
Gpio27 { name: a1 },
Gpio28 { name: a2 },
Gpio29 { name: a3 },
);
pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
================================================
FILE: boards/adafruit-kb2040/CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 0.8.0 - 2024-04-07
### Changed
- Update to rp2040-hal 0.10.0
- Update to embedded-hal 1.0.0
## 0.7.0 - 2023-09-02
### Changed
- Update to rp2040-hal 0.9.0
- Update to ws2812-pio 0.7.0
## 0.6.0 - 2023-02-18
### Changed
- Update to rp2040-hal 0.8.0
- Update to ws2812-pio 0.6.0
## 0.5.0 - 2022-12-11
### Changed
- Update to rp2040-hal 0.7.0
- Update to ws2812-pio 0.5.0
## 0.4.0 - 2022-08-26
### Changed
- Migrate from `embedded-time` to `fugit`
- Bump `ws2812-pio` to 0.4.0
- Update to rp2040-hal 0.6.0
## 0.3.0 - 2022-06-13
### Changed
- Update to rp2040-hal 0.5.0
## 0.2.0 - 2022-03-11
### Changed
- Update to rp2040-hal 0.4.0
## 0.1.0 - 2021-12-20
- Initial release
================================================
FILE: boards/adafruit-kb2040/Cargo.toml
================================================
[package]
name = "adafruit-kb2040"
version = "0.8.0"
authors = ["Andrew Christiansen <andrewtaylorchristiansen@gmail.com>", "The rp-rs Developers"]
edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-kb2040"
description = "Board Support Package for the Adafruit KB2040"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal-boards.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m-rt = { workspace = true, optional = true }
embedded-hal = { workspace = true }
rp2040-boot2 = { workspace = true, optional = true }
rp2040-hal.workspace = true
[dev-dependencies]
embedded-hal.workspace = true
heapless.workspace = true
fugit.workspace = true
nb.workspace = true
panic-halt.workspace = true
smart-leds.workspace = true
ws2812-pio.workspace = true
usb-device.workspace = true
usbd-serial.workspace = true
[features]
# This is the set of features we enable by default
default = ["boot2", "rt", "critical-section-impl", "rom-func-cache"]
# critical section that is safe for multicore use
critical-section-impl = ["rp2040-hal/critical-section-impl"]
# 2nd stage bootloaders for rp2040
boot2 = ["rp2040-boot2"]
# Minimal startup / runtime for Cortex-M microcontrollers
rt = ["cortex-m-rt","rp2040-hal/rt"]
# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.
# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it
rp2040-e5 = ["rp2040-hal/rp2040-e5"]
# Memoize(cache) ROM function pointers on first use to improve performance
rom-func-cache = ["rp2040-hal/rom-func-cache"]
# Disable automatic mapping of language features (like floating point math) to ROM functions
disable-intrinsics = ["rp2040-hal/disable-intrinsics"]
# This enables ROM functions for f64 math that were not present in the earliest RP2040s
rom-v2-intrinsics = ["rp2040-hal/rom-v2-intrinsics"]
================================================
FILE: boards/adafruit-kb2040/README.md
================================================
# [adafruit-kb2040] - Board Support for the [Adafruit KB2040]
You should include this crate if you are writing code that you want to run on
a [Adafruit KB2040] - an Arduino Pro Micro-shaped board for keyboards.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the KB2040.
[Adafruit KB2040]: https://www.adafruit.com/product/5302
[adafruit-kb2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-kb2040
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
## Using
To use this crate, your `Cargo.toml` file should contain:
```toml
adafruit-kb2040 = "0.8.0"
```
In your program, you will need to call `adafruit-kb2040::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details.
## Examples
### General Instructions
To compile an example, clone the _rp-hal-boards_ repository and run:
```console
rp-hal-boards/boards/adafruit-kb2040 $ cargo build --release --example <name>
```
You will get an ELF file called
`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`
folder is located at the top of the _rp-hal-boards_ repository checkout. Normally
you would also need to specify `--target=thumbv6m-none-eabi` but when
building examples from this git repository, that is set as the default.
If you want to convert the ELF file to a UF2 and automatically copy it to the
USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run:
```console
rp-hal-boards/boards/adafruit-kb2040$ cargo run --release --example <name>
```
If you get an error about not being able to find `elf2uf2-rs`, try:
```console
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
```
### [Rainbow](./examples/adafruit_kb2040_rainbow.rs)
This example will display a colour-wheel rainbow effect on the on-board LED.
## Contributing
Contributions are what make the open source community such an amazing place to
be learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
The steps are:
1. Fork the Project by clicking the 'Fork' button at the top of the page.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Make some changes to the code or documentation.
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)
6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)
7. An admin will review the Pull Request and discuss any changes that may be required.
8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!
## Code of Conduct
Contribution to this crate is organized under the terms of the [Rust Code of
Conduct][CoC], and the maintainer of this crate, the [rp-rs team], promises
to intervene to uphold that code of conduct.
[CoC]: CODE_OF_CONDUCT.md
[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs
## License
The contents of this repository are dual-licensed under the _MIT OR Apache
2.0_ License. That means you can choose either the MIT license or the
Apache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more
information on each specific license.
Any submissions to this project (e.g. as Pull Requests) must be made available
under these terms.
================================================
FILE: boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs
================================================
//! # Rainbow Example for the Adafruit KB2040
//!
//! Runs a rainbow-effect colour wheel on the on-board LED.
//!
//! Uses the `ws2812_pio` driver to control the LED, which in turns uses the
//! RP2040's PIO block.
#![no_std]
#![no_main]
use adafruit_kb2040::entry;
use core::iter::once;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use adafruit_kb2040::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
pio::PIOExt,
timer::Timer,
watchdog::Watchdog,
Sio,
},
XOSC_CRYSTAL_FREQ,
};
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
/// Entry point to our bare-metal application.
///
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this
/// function as soon as all global variables are initialised.
///
/// The function configures the RP2040 peripherals, then the LED, then runs
/// the colour wheel in an infinite loop.
#[entry]
fn main() -> ! {
// Configure the RP2040 peripherals
let mut pac = pac::Peripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let sio = Sio::new(pac.SIO);
let pins = adafruit_kb2040::Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
// Configure the addressable LED
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
pins.neopixel.into_function(),
&mut pio,
sm0,
clocks.peripheral_clock.freq(),
timer.count_down(),
);
// Infinite colour wheel loop
let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);
timer.delay_ms(25);
}
}
/// Convert a number from `0..=255` to an RGB color triplet.
///
/// The colours are a transition from red, to green, to blue and back to red.
fn wheel(mut wheel_pos: u8) -> RGB8 {
wheel_pos = 255 - wheel_pos;
if wheel_pos < 85 {
// No green in this sector - red and blue only
(255 - (wheel_pos * 3), 0, wheel_pos * 3).into()
} else if wheel_pos < 170 {
// No red in this sector - green and blue only
wheel_pos -= 85;
(0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()
} else {
// No blue in this sector - red and green only
wheel_pos -= 170;
(wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()
}
}
================================================
FILE: boards/adafruit-kb2040/examples/adafruit_kb2040_usb_serial.rs
================================================
//! # Pico USB Serial Example
//!
//! Creates a USB Serial device on a Pico board, with the USB driver running in
//! the main thread.
//!
//! This will create a USB Serial device echoing anything it receives. Incoming
//! ASCII characters are converted to upercase, so you can tell it is working
//! and not just local-echo!
//!
//! See the `Cargo.toml` file for Copyright and license details.
#![no_std]
#![no_main]
use adafruit_kb2040 as bsp;
// The macro for our start-up function
use bsp::entry;
// Ensure we halt the program on panic (if we don't mention this crate it won't
// be linked)
use panic_halt as _;
// A shorter alias for the Peripheral Access Crate, which provides low-level
// register access
use bsp::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers.
use bsp::hal;
// USB Device support
use usb_device::{class_prelude::*, prelude::*};
// USB Communications Class Device support
use usbd_serial::SerialPort;
// Used to demonstrate writing formatted strings
use core::fmt::Write;
use heapless::String;
/// Entry point to our bare-metal application.
///
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
/// as soon as all global variables are initialised.
///
/// The function configures the RP2040 peripherals, then echoes any characters
/// received over USB Serial.
#[entry]
fn main() -> ! {
// Grab our singleton objects
let mut pac = pac::Peripherals::take().unwrap();
// Set up the watchdog driver - needed by the clock setup code
let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);
// Configure the clocks
//
// The default is to generate a 125 MHz system clock
let clocks = hal::clocks::init_clocks_and_plls(
bsp::XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
#[cfg(feature = "rp2040-e5")]
{
let sio = hal::Sio::new(pac.SIO);
let _pins = bsp::Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
}
// Set up the USB driver
let usb_bus = UsbBusAllocator::new(hal::usb::UsbBus::new(
pac.USBCTRL_REGS,
pac.USBCTRL_DPRAM,
clocks.usb_clock,
true,
&mut pac.RESETS,
));
// Set up the USB Communications Class Device driver
let mut serial = SerialPort::new(&usb_bus);
// Create a USB device with a fake VID and PID
let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))
.strings(&[StringDescriptors::default()
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")])
.unwrap()
.device_class(2) // from: https://www.usb.org/defined-class-codes
.build();
let mut said_hello = false;
loop {
// A welcome message at the beginning
if !said_hello && timer.get_counter().ticks() >= 2_000_000 {
said_hello = true;
let _ = serial.write(b"Hello, World!\r\n");
let time = timer.get_counter().ticks();
let mut text: String<64> = String::new();
writeln!(&mut text, "Current timer ticks: {}", time).unwrap();
// This only works reliably because the number of bytes written to
// the serial port is smaller than the buffers available to the USB
// peripheral. In general, the return value should be handled, so that
// bytes not transferred yet don't get lost.
let _ = serial.write(text.as_bytes());
}
// Check for new data
if usb_dev.poll(&mut [&mut serial]) {
let mut buf = [0u8; 64];
match serial.read(&mut buf) {
Err(_e) => {
// Do nothing
}
Ok(0) => {
// Do nothing
}
Ok(count) => {
// Convert to upper case
buf.iter_mut().take(count).for_each(|b| {
b.make_ascii_uppercase();
});
// Send back to the host
let mut wr_ptr = &buf[..count];
while !wr_ptr.is_empty() {
match serial.write(wr_ptr) {
Ok(len) => wr_ptr = &wr_ptr[len..],
// On error, just drop unwritten data.
// One possible error is Err(WouldBlock), meaning the USB
// write buffer is full.
Err(_) => break,
};
}
}
}
}
}
}
// End of file
================================================
FILE: boards/adafruit-kb2040/src/lib.rs
================================================
#![no_std]
pub use rp2040_hal as hal;
#[cfg(feature = "rt")]
extern crate cortex_m_rt;
#[cfg(feature = "rt")]
pub use hal::entry;
/// The linker will place this boot block at the start of our program image. We
/// need this to help the ROM bootloader get our code up and running.
#[cfg(feature = "boot2")]
#[link_section = ".boot2"]
#[no_mangle]
#[used]
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
pub use hal::pac;
hal::bsp_pins!(
Gpio0 {
name: tx,
aliases: { FunctionUart, PullNone: UartTx }
},
Gpio1 {
name: rx,
aliases: { FunctionUart, PullNone: UartRx }
},
Gpio2 { name: d2 },
Gpio3 { name: d3 },
Gpio4 { name: d4 },
Gpio5 { name: d5 },
Gpio6 { name: d6 },
Gpio7 { name: d7 },
Gpio8 { name: d8 },
Gpio9 { name: d9 },
Gpio10 { name: d10 },
Gpio11 { name: d11 },
Gpio12 {
name: sda,
aliases: { FunctionI2C, PullNone: Sda }
},
Gpio13 {
name: scl,
aliases: { FunctionI2C, PullNone: Scl }
},
Gpio17 { name: neopixel },
Gpio18 {
name: sclk,
aliases: { FunctionSpi, PullNone: Sclk }
},
Gpio19 {
name: mosi,
aliases: { FunctionSpi, PullNone: Mosi }
},
Gpio20 {
name: miso,
aliases: { FunctionSpi, PullNone: Miso }
},
Gpio26 { name: a0 },
Gpio27 { name: a1 },
Gpio28 { name: a2 },
Gpio29 { name: a3 },
);
pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
================================================
FILE: boards/adafruit-macropad/CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 0.8.0 - 2024-04-07
### Changed
- Update to rp2040-hal 0.10.0
- Update to embedded-hal 1.0.0
## 0.7.0 - 2023-09-02
### Changed
- Update to rp2040-hal 0.9.0
## 0.6.0 - 2023-02-18
### Changed
- Update to rp2040-hal 0.8.0
## 0.5.0 - 2022-12-11
### Changed
- Update to rp2040-hal 0.7.0
## 0.4.0 - 2022-08-26
### Changed
- Use `rp2040-hal`'s entry function.
- Migrate from `embedded-time` to `fugit`
- Update to rp2040-hal 0.6.0
## 0.3.0 - 2022-06-13
### Changed
- Update to rp2040-hal 0.5.0
## 0.2.0 - 2022-03-11
### Changed
- Update to rp2040-hal 0.4.0
## 0.1.0 - 2021-12-20
- Initial release
================================================
FILE: boards/adafruit-macropad/Cargo.toml
================================================
[package]
name = "adafruit-macropad"
version = "0.8.0"
authors = ["Andrea Nall <anall@andreanal.com>", "The rp-rs Developers"]
edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit_macropad"
description = "Board Support Package for the Adafruit Macropad"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal-boards.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m-rt = { workspace = true, optional = true }
rp2040-boot2 = { workspace = true, optional = true }
rp2040-hal.workspace = true
[dev-dependencies]
cortex-m.workspace = true
embedded-hal.workspace = true
panic-halt.workspace = true
[features]
# This is the set of features we enable by default
default = ["boot2", "rt", "critical-section-impl", "rom-func-cache"]
# critical section that is safe for multicore use
critical-section-impl = ["rp2040-hal/critical-section-impl"]
# 2nd stage bootloaders for rp2040
boot2 = ["rp2040-boot2"]
# Minimal startup / runtime for Cortex-M microcontrollers
rt = ["cortex-m-rt","rp2040-hal/rt"]
# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.
# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it
rp2040-e5 = ["rp2040-hal/rp2040-e5"]
# Memoize(cache) ROM function pointers on first use to improve performance
rom-func-cache = ["rp2040-hal/rom-func-cache"]
# Disable automatic mapping of language features (like floating point math) to ROM functions
disable-intrinsics = ["rp2040-hal/disable-intrinsics"]
# This enables ROM functions for f64 math that were not present in the earliest RP2040s
rom-v2-intrinsics = ["rp2040-hal/rom-v2-intrinsics"]
================================================
FILE: boards/adafruit-macropad/README.md
================================================
# [adafruit-macropad] - Board Support for the [Adafruit Macropad]
You should include this crate if you are writing code that you want to run on
an [Adafruit Macropad] - a 3x4 keyboard and OLED combo board from Adafruit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Feather.
[adafruit-macropad]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-macropad
[Adafruit Macropad]: https://www.adafruit.com/product/5128
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
## Using
To use this crate, your `Cargo.toml` file should contain:
```toml
adafruit-macropad = "0.8.0"
```
In your program, you will need to call `adafruit_macropad::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details.
## Examples
### General Instructions
To compile an example, clone the _rp-hal-boards_ repository and run:
```console
rp-hal-boards/boards/adafruit-macropad $ cargo build --release --example <name>
```
You will get an ELF file called
`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`
folder is located at the top of the _rp-hal-boards_ repository checkout. Normally
you would also need to specify `--target=thumbv6m-none-eabi` but when
building examples from this git repository, that is set as the default.
If you want to convert the ELF file to a UF2 and automatically copy it to the
USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run:
```console
rp-hal-boards/boards/adafruit-macropad $ cargo run --release --example <name>
```
If you get an error about not being able to find `elf2uf2-rs`, try:
```console
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
```
## Contributing
Contributions are what make the open source community such an amazing place to
be learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
The steps are:
1. Fork the Project by clicking the 'Fork' button at the top of the page.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Make some changes to the code or documentation.
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)
6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)
7. An admin will review the Pull Request and discuss any changes that may be required.
8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!
## Code of Conduct
Contribution to this crate is organized under the terms of the [Rust Code of
Conduct][CoC], and the maintainer of this crate, the [rp-rs team], promises
to intervene to uphold that code of conduct.
[CoC]: CODE_OF_CONDUCT.md
[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs
## License
The contents of this repository are dual-licensed under the _MIT OR Apache
2.0_ License. That means you can choose either the MIT license or the
Apache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more
information on each specific license.
Any submissions to this project (e.g. as Pull Requests) must be made available
under these terms.
================================================
FILE: boards/adafruit-macropad/examples/adafruit-macropad_blinky.rs
================================================
//! Blinks the LED on a Adafruit MacroPad board
//!
//! This will blink on-board LED.
#![no_std]
#![no_main]
use adafruit_macropad::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
watchdog::Watchdog,
Sio,
},
Pins, XOSC_CRYSTAL_FREQ,
};
use embedded_hal::digital::OutputPin;
use panic_halt as _;
/// Entry point to our bare-metal application.
///
/// The `#[rp2040_hal::entry]` macro ensures the Cortex-M start-up code calls this function
/// as soon as all global variables and the spinlock are initialised.
#[rp2040_hal::entry]
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let core = pac::CorePeripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
let sio = Sio::new(pac.SIO);
let pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let mut led_pin = pins.led.into_push_pull_output();
loop {
led_pin.set_high().unwrap();
delay.delay_ms(1500);
led_pin.set_low().unwrap();
delay.delay_ms(1500);
}
}
================================================
FILE: boards/adafruit-macropad/src/lib.rs
================================================
#![no_std]
pub use rp2040_hal as hal;
#[cfg(feature = "rt")]
extern crate cortex_m_rt;
#[cfg(feature = "rt")]
pub use hal::entry;
// Adafruit macropad uses W25Q64JVxQ flash chip. Should work with BOOT_LOADER_W25Q080 (untested)
/// The linker will place this boot block at the start of our program image. We
/// need this to help the ROM bootloader get our code up and running.
#[cfg(feature = "boot2")]
#[link_section = ".boot2"]
#[no_mangle]
#[used]
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
pub use hal::pac;
hal::bsp_pins!(
Gpio0 { name: button },
Gpio1 { name: key1 },
Gpio2 { name: key2 },
Gpio3 { name: key3 },
Gpio4 { name: key4 },
Gpio5 { name: key5 },
Gpio6 { name: key6 },
Gpio7 { name: key7 },
Gpio8 { name: key8 },
Gpio9 { name: key9 },
Gpio10 { name: key10 },
Gpio11 { name: key11 },
Gpio12 { name: key12 },
Gpio13 { name: led },
Gpio14 {
name: speaker_shutdown
},
Gpio16 { name: speaker },
Gpio17 {
name: encoder_rota,
aliases: { FunctionSioInput, PullUp: RotaryA }
},
Gpio18 {
name: encoder_rotb,
aliases: { FunctionSioInput, PullUp: RotaryB }
},
Gpio19 { name: neopixel },
Gpio20 {
name: sda,
aliases: { FunctionI2C, PullUp: Sda }
},
Gpio21 {
name: scl,
aliases: { FunctionI2C, PullUp: Scl }
},
// This CS is on the wrong SPI channel so cannot be controlled by the peripheral
Gpio22 { name: oled_cs },
Gpio23 { name: oled_reset },
Gpio24 { name: oled_dc },
Gpio26 {
name: sclk,
aliases: { FunctionSpi, PullNone: Sclk }
},
Gpio27 {
name: mosi,
aliases: { FunctionSpi, PullNone: Mosi }
},
Gpio28 {
name: miso,
aliases: { FunctionSpi, PullNone: Miso }
},
);
pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
================================================
FILE: boards/adafruit-metro-rp2040/CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 0.1.0 - 2024-04-07
- Initial release
================================================
FILE: boards/adafruit-metro-rp2040/Cargo.toml
================================================
[package]
name = "adafruit-metro-rp2040"
version = "0.1.0"
authors = ["Thad House <thadhouse1@gmail.com>", "The rp-rs Developers"]
edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-metro-rp2040"
description = "Board Support Package for the Adafruit Metro RP2040"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal-boards.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m-rt = { workspace = true, optional = true }
rp2040-boot2 = { workspace = true, optional = true }
rp2040-hal.workspace = true
[dev-dependencies]
cortex-m.workspace = true
panic-halt.workspace = true
embedded-hal.workspace = true
smart-leds.workspace = true
nb.workspace = true
ws2812-pio.workspace = true
fugit.workspace = true
[features]
# This is the set of features we enable by default
default = ["boot2", "rt", "critical-section-impl", "rom-func-cache"]
# critical section that is safe for multicore use
critical-section-impl = ["rp2040-hal/critical-section-impl"]
# 2nd stage bootloaders for rp2040
boot2 = ["rp2040-boot2"]
# Minimal startup / runtime for Cortex-M microcontrollers
rt = ["cortex-m-rt","rp2040-hal/rt"]
# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.
# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it
rp2040-e5 = ["rp2040-hal/rp2040-e5"]
# Memoize(cache) ROM function pointers on first use to improve performance
rom-func-cache = ["rp2040-hal/rom-func-cache"]
# Disable automatic mapping of language features (like floating point math) to ROM functions
disable-intrinsics = ["rp2040-hal/disable-intrinsics"]
# This enables ROM functions for f64 math that were not present in the earliest RP2040s
rom-v2-intrinsics = ["rp2040-hal/rom-v2-intrinsics"]
================================================
FILE: boards/adafruit-metro-rp2040/README.md
================================================
# [adafruit-metro-rp2040] - Board Support for the [Adafruit Metro RP2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit Metro RP2040] - an RP2040 board in the Metro family from Adafruit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Metro RP2040.
[Adafruit Metro RP2040]: https://www.adafruit.com/product/5786
[adafruit-metro-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-metro-rp2040
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
## Using
To use this crate, your `Cargo.toml` file should contain:
```toml
adafruit-metro-rp2040 = "0.1.0"
```
In your program, you will need to call `adafruit_metro_rp2040::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details.
## Examples
### General Instructions
To compile an example, clone the _rp-hal-boards_ repository and run:
```console
rp-hal-boards/boards/adafruit-metro-rp2040 $ cargo build --release --example <name>
```
You will get an ELF file called
`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`
folder is located at the top of the _rp-hal-boards_ repository checkout. Normally
you would also need to specify `--target=thumbv6m-none-eabi` but when
building examples from this git repository, that is set as the default.
If you want to convert the ELF file to a UF2 and automatically copy it to the
USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run:
```console
rp-hal-boards/boards/adafruit-metro-rp2040 $ cargo run --release --example <name>
```
If you get an error about not being able to find `elf2uf2-rs`, try:
```console
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
```
### [adafruit_metro_blinky](./examples/adafruit_metro_blinky.rs)
Blink an LED on and off.
### [adafruit_metro_rainbow](./examples/adafruit_metro_rainbow.rs)
Continuously changes the color of the Metro's onboard Neopixel.
## Contributing
Contributions are what make the open source community such an amazing place to
be learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
The steps are:
1. Fork the Project by clicking the 'Fork' button at the top of the page.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Make some changes to the code or documentation.
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)
6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)
7. An admin will review the Pull Request and discuss any changes that may be required.
8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!
## Code of Conduct
Contribution to this crate is organized under the terms of the [Rust Code of
Conduct][CoC], and the maintainer of this crate, the [rp-rs team], promises
to intervene to uphold that code of conduct.
[CoC]: CODE_OF_CONDUCT.md
[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs
## License
The contents of this repository are dual-licensed under the _MIT OR Apache
2.0_ License. That means you can choose either the MIT license or the
Apache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more
information on each specific license.
Any submissions to this project (e.g. as Pull Requests) must be made available
under these terms.
================================================
FILE: boards/adafruit-metro-rp2040/examples/adafruit_metro_blinky.rs
================================================
//! # GPIO 'Blinky' Example
//!
//! Blinks the LED on a Adafruit Metro RP2040 board
//!
//! It may need to be adapted to your particular board layout and/or pin assignment.
//!
//! See the `Cargo.toml` file for Copyright and license details.
#![no_std]
#![no_main]
// The macro for our start-up function
use adafruit_metro_rp2040::entry;
// Ensure we halt the program on panic (if we don't mention this crate it won't
// be linked)
use panic_halt as _;
// Some traits we need
use embedded_hal::digital::OutputPin;
use adafruit_metro_rp2040::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
sio::Sio,
watchdog::Watchdog,
},
Pins, XOSC_CRYSTAL_FREQ,
};
use cortex_m::delay::Delay;
/// Entry point to our bare-metal application.
///
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
/// as soon as all global variables are initialised.
///
/// The function configures the RP2040 peripherals, then toggles a GPIO pin in
/// an infinite loop. If there is an LED connected to that pin, it will blink.
#[entry]
fn main() -> ! {
// Grab our singleton objects
let mut pac = pac::Peripherals::take().unwrap();
let core = pac::CorePeripherals::take().unwrap();
// Set up the watchdog driver - needed by the clock setup code
let mut watchdog = Watchdog::new(pac.WATCHDOG);
// Configure the clocks
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
// The single-cycle I/O block controls our GPIO pins
let sio = Sio::new(pac.SIO);
let pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let mut led_pin = pins.d13.into_push_pull_output();
loop {
led_pin.set_high().unwrap();
delay.delay_ms(500);
led_pin.set_low().unwrap();
delay.delay_ms(500);
}
}
// End of file
================================================
FILE: boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs
================================================
//! Continuously changes the color of the Neopixel on a Adafruit Metro RP2040 board
#![no_std]
#![no_main]
use adafruit_metro_rp2040::entry;
use core::iter::once;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
use adafruit_metro_rp2040::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
pio::PIOExt,
watchdog::Watchdog,
Sio, Timer,
},
Pins, XOSC_CRYSTAL_FREQ,
};
#[entry]
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let sio = Sio::new(pac.SIO);
let pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let led = pins.neopixel_data.into_function();
let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
led,
&mut pio,
sm0,
clocks.peripheral_clock.freq(),
timer.count_down(),
);
let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);
timer.delay_ms(25);
}
}
/// Convert a number from `0..=255` to an RGB color triplet.
///
/// The colours are a transition from red, to green, to blue and back to red.
fn wheel(mut wheel_pos: u8) -> RGB8 {
wheel_pos = 255 - wheel_pos;
if wheel_pos < 85 {
// No green in this sector - red and blue only
(255 - (wheel_pos * 3), 0, wheel_pos * 3).into()
} else if wheel_pos < 170 {
// No red in this sector - green and blue only
wheel_pos -= 85;
(0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()
} else {
// No blue in this sector - red and green only
wheel_pos -= 170;
(wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()
}
}
================================================
FILE: boards/adafruit-metro-rp2040/src/lib.rs
================================================
#![no_std]
pub extern crate rp2040_hal as hal;
#[cfg(feature = "rt")]
extern crate cortex_m_rt;
#[cfg(feature = "rt")]
pub use hal::entry;
/// The linker will place this boot block at the start of our program image. We
/// need this to help the ROM bootloader get our code up and running.
#[cfg(feature = "boot2")]
#[link_section = ".boot2"]
#[no_mangle]
#[used]
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
pub use hal::pac;
hal::bsp_pins!(
Gpio0 {
name: tx,
aliases: { FunctionUart, PullNone: UartTx }
},
Gpio1 {
name: rx,
aliases: { FunctionUart, PullNone: UartRx }
},
Gpio2 { name: d2 },
Gpio3 { name: d3 },
Gpio4 { name: d4 },
Gpio5 { name: d5 },
Gpio6 { name: d6 },
Gpio7 { name: d7 },
Gpio8 { name: d8 },
Gpio9 { name: d9 },
Gpio10 { name: d10 },
Gpio11 { name: d11 },
Gpio12 { name: d12 },
Gpio13 { name: d13 },
Gpio14 { name: neopixel_data },
Gpio15 { name: sd_cd, },
Gpio16 {
name: sda,
aliases: { FunctionI2C, PullUp: Sda }
},
Gpio17 {
name: scl,
aliases: { FunctionI2C, PullUp: Scl }
},
Gpio18 {
name: sclk,
aliases: { FunctionSpi, PullNone: Sclk }
},
Gpio19 {
name: mosi,
aliases: { FunctionSpi, PullNone: Mosi }
},
Gpio20 {
name: miso
aliases: { FunctionSpi, PullNone: Miso }
},
Gpio21 { name: sdio_data1 },
Gpio22 { name: sdio_data2 },
Gpio23 { name: sd_cs },
Gpio24 { name: d24 },
Gpio25 { name: d25 },
Gpio26 { name: a0 },
Gpio27 { name: a1 },
Gpio28 { name: a2 },
Gpio29 { name: a3 },
);
pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
================================================
FILE: boards/adafruit-qt-py-rp2040/CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 0.8.0 - 2024-04-07
### Changed
- Update to rp2040-hal 0.10.0
- Update to ws2812-pio 0.8.0
- Update to embedded-hal 1.0.0
## 0.7.0 - 2023-09-02
### Changed
- Update to rp2040-hal 0.9.0
- Update to ws2812-pio 0.7.0
## 0.6.0 - 2023-02-18
### Changed
- Update to rp2040-hal 0.8.0
- Update to ws2812-pio 0.6.0
## 0.5.0 - 2022-12-11
### Changed
- Update to rp2040-hal 0.7.0
- Update to ws2812-pio 0.5.0
## 0.4.0 - 2022-08-26
### Changed
- Migrate from `embedded-time` to `fugit`
- Bump `ws2812-pio` to 0.4.0
- Update to rp2040-hal 0.6.0
## 0.3.0 - 2022-06-13
### Changed
- Update to rp2040-hal 0.5.0
## 0.2.0 - 2022-03-11
### Changed
- Update to rp2040-hal 0.4.0
## 0.1.0 - 2021-12-20
- Initial release
================================================
FILE: boards/adafruit-qt-py-rp2040/Cargo.toml
================================================
[package]
name = "adafruit-qt-py-rp2040"
version = "0.8.0"
authors = ["Stephen Onnen <stephen.onnen@gmail.com>", "The rp-rs Developers"]
edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-qt-py-rp2040"
description = "Board Support Package for the Adafruit QT Py RP2040"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal-boards.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m-rt = { workspace = true, optional = true }
rp2040-boot2 = { workspace = true, optional = true }
rp2040-hal.workspace = true
[dev-dependencies]
panic-halt.workspace = true
embedded-hal.workspace = true
smart-leds.workspace = true
nb.workspace = true
ws2812-pio.workspace = true
fugit.workspace = true
[features]
# This is the set of features we enable by default
default = ["boot2", "rt", "critical-section-impl", "rom-func-cache"]
# critical section that is safe for multicore use
critical-section-impl = ["rp2040-hal/critical-section-impl"]
# 2nd stage bootloaders for rp2040
boot2 = ["rp2040-boot2"]
# Minimal startup / runtime for Cortex-M microcontrollers
rt = ["cortex-m-rt","rp2040-hal/rt"]
# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.
# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above
rp2040-e5 = ["rp2040-hal/rp2040-e5"]
# Memoize(cache) ROM function pointers on first use to improve performance
rom-func-cache = ["rp2040-hal/rom-func-cache"]
# Disable automatic mapping of language features (like floating point math) to ROM functions
disable-intrinsics = ["rp2040-hal/disable-intrinsics"]
# This enables ROM functions for f64 math that were not present in the earliest RP2040s
rom-v2-intrinsics = ["rp2040-hal/rom-v2-intrinsics"]
================================================
FILE: boards/adafruit-qt-py-rp2040/README.md
================================================
# [adafruit-qt-py-rp2040] - Board Support for the [Adafruit QT Py RP2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit QT Py RP2040] - an extremely small form-factor RP2040 board from Adafruit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the QT Py.
[Adafruit QT Py RP2040]: https://www.adafruit.com/product/4900
[adafruit-qt-py-rp2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-qt-py-rp2040
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
## Using
To use this crate, your `Cargo.toml` file should contain:
```toml
adafruit-qt-py-rp2040 = "0.8.0"
```
In your program, you will need to call `adafruit_qt_py_rp2040::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details.
## Examples
### General Instructions
To compile an example, clone the _rp-hal-boards_ repository and run:
```console
rp-hal-boards/boards/adafruit-qt-py-rp2040 $ cargo build --release --example <name>
```
You will get an ELF file called
`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`
folder is located at the top of the _rp-hal-boards_ repository checkout. Normally
you would also need to specify `--target=thumbv6m-none-eabi` but when
building examples from this git repository, that is set as the default.
If you want to convert the ELF file to a UF2 and automatically copy it to the
USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run:
```console
rp-hal-boards/boards/adafruit-qt-py-rp2040 $ cargo run --release --example <name>
```
If you get an error about not being able to find `elf2uf2-rs`, try:
```console
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
```
### [adafruit_qt_py_rp2040_rainbow](./examples/adafruit_qt_py_rp2040_rainbow.rs)
Continuously changes the color of the QT Py's onboard Neopixel.
## Contributing
Contributions are what make the open source community such an amazing place to
be learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
The steps are:
1. Fork the Project by clicking the 'Fork' button at the top of the page.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Make some changes to the code or documentation.
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)
6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)
7. An admin will review the Pull Request and discuss any changes that may be required.
8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!
## Code of Conduct
Contribution to this crate is organized under the terms of the [Rust Code of
Conduct][CoC], and the maintainer of this crate, the [rp-rs team], promises
to intervene to uphold that code of conduct.
[CoC]: CODE_OF_CONDUCT.md
[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs
## License
The contents of this repository are dual-licensed under the _MIT OR Apache
2.0_ License. That means you can choose either the MIT license or the
Apache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more
information on each specific license.
Any submissions to this project (e.g. as Pull Requests) must be made available
under these terms.
================================================
FILE: boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs
================================================
//! Continuously changes the color of the Neopixel on a Adafruit QT Py RP2040 board
#![no_std]
#![no_main]
use adafruit_qt_py_rp2040::entry;
use core::iter::once;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
use adafruit_qt_py_rp2040::{
hal::{
clocks::{init_clocks_and_plls, Clock},
gpio::PinState,
pac,
pio::PIOExt,
watchdog::Watchdog,
Sio, Timer,
},
Pins, XOSC_CRYSTAL_FREQ,
};
#[entry]
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let sio = Sio::new(pac.SIO);
let pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let led = pins.neopixel_data.into_function();
pins.neopixel_power
.into_push_pull_output_in_state(PinState::High);
let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
led,
&mut pio,
sm0,
clocks.peripheral_clock.freq(),
timer.count_down(),
);
let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);
timer.delay_ms(25);
}
}
/// Convert a number from `0..=255` to an RGB color triplet.
///
/// The colours are a transition from red, to green, to blue and back to red.
fn wheel(mut wheel_pos: u8) -> RGB8 {
wheel_pos = 255 - wheel_pos;
if wheel_pos < 85 {
// No green in this sector - red and blue only
(255 - (wheel_pos * 3), 0, wheel_pos * 3).into()
} else if wheel_pos < 170 {
// No red in this sector - green and blue only
wheel_pos -= 85;
(0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()
} else {
// No blue in this sector - red and green only
wheel_pos -= 170;
(wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()
}
}
================================================
FILE: boards/adafruit-qt-py-rp2040/src/lib.rs
================================================
#![no_std]
pub extern crate rp2040_hal as hal;
#[cfg(feature = "rt")]
extern crate cortex_m_rt;
#[cfg(feature = "rt")]
pub use hal::entry;
/// The linker will place this boot block at the start of our program image. We
/// need this to help the ROM bootloader get our code up and running.
#[cfg(feature = "boot2")]
#[link_section = ".boot2"]
#[no_mangle]
#[used]
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_GD25Q64CS;
pub use hal::pac;
hal::bsp_pins!(
Gpio3 {
name: mosi,
aliases: { FunctionSpi, PullNone: Mosi }
},
Gpio4 {
name: miso
aliases: { FunctionSpi, PullNone: Miso }
},
Gpio5 {
name: rx,
aliases: { FunctionUart, PullNone: UartRx }
},
Gpio6 {
name: sclk,
aliases: { FunctionSpi, PullNone: Sclk }
},
Gpio11 { name: neopixel_power },
Gpio12 { name: neopixel_data },
Gpio20 {
name: tx,
aliases: { FunctionUart, PullNone: UartTx }
},
Gpio21 {
name: button
},
Gpio22 {
name: sda1,
aliases: { FunctionI2C, PullUp: Sda1 }
},
Gpio23 {
name: scl1,
aliases: { FunctionI2C, PullUp: Scl1 }
},
Gpio24 {
name: sda,
aliases: { FunctionI2C, PullUp: Sda }
},
Gpio25 {
name: scl,
aliases: { FunctionI2C, PullUp: Scl }
},
Gpio26 { name: a3 },
Gpio27 { name: a2 },
Gpio28 { name: a1 },
Gpio29 { name: a0 },
);
pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
================================================
FILE: boards/adafruit-trinkey-qt2040/CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 0.7.0 - 2024-04-07
### Changed
- Update to rp2040-hal 0.10.0
- Update to embedded-hal 1.0.0
## 0.6.0 - 2023-09-02
### Changed
- Update to rp2040-hal 0.9.0
- Update to ws2812-pio 0.7.0
## 0.5.0 - 2023-02-18
### Changed
- Update to rp2040-hal 0.8.0
- Update to ws2812-pio 0.6.0
## 0.4.0 - 2022-12-11
### Changed
- Update to rp2040-hal 0.7.0
- Update to ws2812-pio 0.5.0
## 0.3.0 - 2022-08-26
### Changed
- Migrate from `embedded-time` to `fugit`
- Bump `ws2812-pio` to 0.4.0
- Update to rp2040-hal 0.6.0
================================================
FILE: boards/adafruit-trinkey-qt2040/Cargo.toml
================================================
[package]
name = "adafruit-trinkey-qt2040"
version = "0.7.0"
authors = ["The rp-rs Developers"]
edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-trinkey-qt2040"
description = "Board Support Package for the Adafruit Trinkey QT2040"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal-boards.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m-rt = { workspace = true, optional = true }
rp2040-boot2 = { workspace = true, optional = true }
rp2040-hal.workspace = true
[dev-dependencies]
panic-halt.workspace = true
embedded-hal.workspace = true
smart-leds.workspace = true
nb.workspace = true
ws2812-pio.workspace = true
fugit.workspace = true
[features]
# This is the set of features we enable by default
default = ["boot2", "rt", "critical-section-impl", "rom-func-cache"]
# critical section that is safe for multicore use
critical-section-impl = ["rp2040-hal/critical-section-impl"]
# 2nd stage bootloaders for rp2040
boot2 = ["rp2040-boot2"]
# Minimal startup / runtime for Cortex-M microcontrollers
rt = ["cortex-m-rt","rp2040-hal/rt"]
# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.
# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above
rp2040-e5 = ["rp2040-hal/rp2040-e5"]
# Memoize(cache) ROM function pointers on first use to improve performance
rom-func-cache = ["rp2040-hal/rom-func-cache"]
# Disable automatic mapping of language features (like floating point math) to ROM functions
disable-intrinsics = ["rp2040-hal/disable-intrinsics"]
# This enables ROM functions for f64 math that were not present in the earliest RP2040s
rom-v2-intrinsics = ["rp2040-hal/rom-v2-intrinsics"]
================================================
FILE: boards/adafruit-trinkey-qt2040/README.md
================================================
# [adafruit-trinkey-qt2040] - Board Support for the [Adafruit Trinkey QT2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit Trinkey QT2040] - a 3x4 keyboard and OLED combo board from Adafruit.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Trinkey.
[adafruit-trinkey-qt2040]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/adafruit-trinkey-qt2040
[adafruit trinkey qt2040]: https://www.adafruit.com/product/5056
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
## Using
To use this crate, your `Cargo.toml` file should contain:
```toml
adafruit-trinkey-qt2040 = "0.7.0"
```
In your program, you will need to call `adafruit-trinkey-qt2040::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details.
## Examples
### General Instructions
To compile an example, clone the _rp-hal-boards_ repository and run:
```console
rp-hal-boards/boards/adafruit-trinkey-qt2040 $ cargo build --release --example <name>
```
You will get an ELF file called
`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`
folder is located at the top of the _rp-hal-boards_ repository checkout. Normally
you would also need to specify `--target=thumbv6m-none-eabi` but when
building examples from this git repository, that is set as the default.
If you want to convert the ELF file to a UF2 and automatically copy it to the
USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run:
```console
rp-hal-boards/boards/adafruit-trinkey-qt2040 $ cargo run --release --example <name>
```
If you get an error about not being able to find `elf2uf2-rs`, try:
```console
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
```
### [Rainbow](./examples/adafruit_trinkey_qt2040_rainbow.rs)
This example will display a colour-wheel rainbow effect on the on-board LED.
## Contributing
Contributions are what make the open source community such an amazing place to
be learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
The steps are:
1. Fork the Project by clicking the 'Fork' button at the top of the page.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Make some changes to the code or documentation.
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)
6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)
7. An admin will review the Pull Request and discuss any changes that may be required.
8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!
## Code of Conduct
Contribution to this crate is organized under the terms of the [Rust Code of
Conduct][coc], and the maintainer of this crate, the [rp-rs team], promises
to intervene to uphold that code of conduct.
[coc]: CODE_OF_CONDUCT.md
[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs
## License
The contents of this repository are dual-licensed under the _MIT OR Apache
2.0_ License. That means you can choose either the MIT license or the
Apache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more
information on each specific license.
Any submissions to this project (e.g. as Pull Requests) must be made available
under these terms.
================================================
FILE: boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs
================================================
//! # Rainbow Example for the Adafruit Trinkey QT2040
//!
//! Runs a rainbow-effect colour wheel on the on-board LED.
//!
//! Uses the `ws2812_pio` driver to control the LED, which in turns uses the
//! RP2040's PIO block.
#![no_std]
#![no_main]
use adafruit_trinkey_qt2040::entry;
use core::iter::once;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use adafruit_trinkey_qt2040::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
pio::PIOExt,
timer::Timer,
watchdog::Watchdog,
Sio,
},
XOSC_CRYSTAL_FREQ,
};
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
/// Entry point to our bare-metal application.
///
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this
/// function as soon as all global variables are initialised.
///
/// The function configures the RP2040 peripherals, then the LED, then runs
/// the colour wheel in an infinite loop.
#[entry]
fn main() -> ! {
// Configure the RP2040 peripherals
let mut pac = pac::Peripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let sio = Sio::new(pac.SIO);
let pins = adafruit_trinkey_qt2040::Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
// Configure the addressable LED
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
pins.neopixel.into_function(),
&mut pio,
sm0,
clocks.peripheral_clock.freq(),
timer.count_down(),
);
// Infinite colour wheel loop
let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);
timer.delay_ms(25);
}
}
/// Convert a number from `0..=255` to an RGB color triplet.
///
/// The colours are a transition from red, to green, to blue and back to red.
fn wheel(mut wheel_pos: u8) -> RGB8 {
wheel_pos = 255 - wheel_pos;
if wheel_pos < 85 {
// No green in this sector - red and blue only
(255 - (wheel_pos * 3), 0, wheel_pos * 3).into()
} else if wheel_pos < 170 {
// No red in this sector - green and blue only
wheel_pos -= 85;
(0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()
} else {
// No blue in this sector - red and green only
wheel_pos -= 170;
(wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()
}
}
================================================
FILE: boards/adafruit-trinkey-qt2040/src/lib.rs
================================================
#![no_std]
pub extern crate rp2040_hal as hal;
#[cfg(feature = "rt")]
extern crate cortex_m_rt;
#[cfg(feature = "rt")]
pub use hal::entry;
/// The linker will place this boot block at the start of our program image. We
/// need this to help the ROM bootloader get our code up and running.
#[cfg(feature = "boot2")]
#[link_section = ".boot2"]
#[no_mangle]
#[used]
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
pub use hal::pac;
hal::bsp_pins!(
Gpio12 { name: button },
Gpio16 {
name: sda,
aliases: { FunctionI2C, PullUp: Sda }
},
Gpio17 {
name: scl,
aliases: { FunctionI2C, PullUp: Scl }
},
Gpio27 { name: neopixel },
);
pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
================================================
FILE: boards/arduino_nano_connect/.gitignore
================================================
# Generated by Cargo
# will have compiled files and executables
debug/
target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
================================================
FILE: boards/arduino_nano_connect/CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 0.7.0 - 2024-04-07
### Changed
- Update to rp2040-hal 0.10.0
- Update to embedded-hal 1.0.0
## 0.6.0 - 2023-09-02
### Changed
- Update to rp2040-hal 0.9.0
## 0.5.0 - 2023-02-18
### Changed
- Update to rp2040-hal 0.8.0
## 0.4.0 - 2022-12-11
### Changed
- Update to rp2040-hal 0.7.0
## 0.3.0 - 2022-08-26
### Changed
- Use `rp2040-hal`'s entry function.
- Migrate from `embedded-time` to `fugit`
- Update to rp2040-hal 0.6.0
### Removed
- Unused dependencies
================================================
FILE: boards/arduino_nano_connect/Cargo.toml
================================================
[package]
name = "arduino_nano_connect"
version = "0.7.0"
authors = ["splicedbread <dxbunrated@gmail.com>", "The rp-rs Developers"]
edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal-boards/tree/main/boards/arduino_nano_connect"
description = "Board Support Package for the Arduino Nano RP2040 Connect"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal-boards.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m-rt = { workspace = true, optional = true }
embedded-hal = { workspace = true }
rp2040-boot2 = { workspace = true, optional = true }
rp2040-hal.workspace = true
[dev-dependencies]
cortex-m.workspace = true
panic-halt.workspace = true
embedded-hal.workspace = true
nb.workspace = true
fugit.workspace = true
[features]
# This is the set of features we enable by default
default = ["boot2", "rt", "critical-section-impl", "rom-func-cache"]
# critical section that is safe for multicore use
critical-section-impl = ["rp2040-hal/critical-section-impl"]
# 2nd stage bootloaders for rp2040
boot2 = ["rp2040-boot2"]
# Minimal startup / runtime for Cortex-M microcontrollers
rt = ["cortex-m-rt","rp2040-hal/rt"]
# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.
# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above
rp2040-e5 = ["rp2040-hal/rp2040-e5"]
# Memoize(cache) ROM function pointers on first use to improve performance
rom-func-cache = ["rp2040-hal/rom-func-cache"]
# Disable automatic mapping of language features (like floating point math) to ROM functions
disable-intrinsics = ["rp2040-hal/disable-intrinsics"]
# This enables ROM functions for f64 math that were not present in the earliest RP2040s
rom-v2-intrinsics = ["rp2040-hal/rom-v2-intrinsics"]
================================================
FILE: boards/arduino_nano_connect/README.md
================================================
# [arduino_nano_connect] - Board Support for the [Arduino Nano RP2040 Connect]
You should include this crate if you are writing code that you want to run on
an [Arduino Nano RP2040 Connect] - a development pcb with shortwave communication, IMU, and BLE package.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the nano connect.
[Arduino Nano RP2040 Connect]: https://store-usa.arduino.cc/collections/boards/products/arduino-nano-rp2040-connect
[arduino_nano_connect]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/arduino_nano_connect
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
## Using
To use this crate, your `Cargo.toml` file should contain:
```toml
arduino_nano_connect = "0.7.0"
```
# TODO - down and out
In your program, you will need to call `arduino_nano_connect::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details.
## Examples
[nano_blinky](./examples/nano_blinky.rs)
### General Instructions
To compile an example, clone the _rp-hal-boards_ repository and run:
```console
rp-hal-boards/boards/arduino_nano_connect $ cargo build --release --example <name>
```
You will get an ELF file called
`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`
folder is located at the top of the _rp-hal-boards_ repository checkout. Normally
you would also need to specify `--target=thumbv6m-none-eabi` but when
building examples from this git repository, that is set as the default.
If you want to convert the ELF file to a UF2 and automatically copy it to the
USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run:
```console
rp-hal-boards/boards/arduino_nano_connect $ cargo run --release --example <name>
```
If you get an error about not being able to find `elf2uf2-rs`, try:
```console
$ cargo install elf2uf2-rs
```
then try repeating the `cargo run` command above.
### [nano_blinky](./examples/nano_blinky.rs)
Flashes the Arduino Nano Connect's on-board LED on and off.
## Contributing
Contributions are what make the open source community such an amazing place to
be learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
The steps are:
1. Fork the Project by clicking the 'Fork' button at the top of the page.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Make some changes to the code or documentation.
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)
6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)
7. An admin will review the Pull Request and discuss any changes that may be required.
8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!
## Code of Conduct
Contribution to this crate is organized under the terms of the [Rust Code of
Conduct][CoC], and the maintainer of this crate, the [rp-rs team], promises
to intervene to uphold that code of conduct.
[CoC]: CODE_OF_CONDUCT.md
[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs
## License
The contents of this repository are dual-licensed under the _MIT OR Apache
2.0_ License. That means you can chose either the MIT license or the
Apache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more
information on each specific license.
Any submissions to this project (e.g. as Pull Requests) must be made available
under these terms.
================================================
FILE: boards/arduino_nano_connect/examples/nano_blinky.rs
================================================
//! # Nano Blinky Example
//!
//! Blinks the LED on a Arduino Nano Connect board.
//!
//! This will blink an LED attached to GP25, which is the pin the Nano uses for
//! the on-board LED.
//!
//! See the `Cargo.toml` file for Copyright and license details.
#![no_std]
#![no_main]
use embedded_hal::digital::OutputPin;
// Ensure we halt the program on panic (if we don't mention this crate it won't
// be linked)
use panic_halt as _;
use arduino_nano_connect as bsp;
// Pull in any important traits
use bsp::hal::prelude::*;
// A shorter alias for the Peripheral Access Crate, which provides low-level
// register access
use bsp::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers.
use bsp::hal;
/// Entry point to our bare-metal application.
///
/// The `#[arduino_nano_connect::entry]` macro ensures the Cortex-M start-up code calls this function
/// as soon as all global variables and the spinlock are initialised.
///
/// The function configures the RP2040 peripherals, then blinks the LED in an
/// infinite loop.
#[arduino_nano_connect::entry]
fn main() -> ! {
// Grab our singleton objects
let mut pac = pac::Peripherals::take().unwrap();
let core = pac::CorePeripherals::take().unwrap();
// Set up the watchdog driver - needed by the clock setup code
let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);
// Configure the clocks
//
// The default is to generate a 125 MHz system clock
let clocks = hal::clocks::init_clocks_and_plls(
bsp::XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
// The delay object lets us wait for specified amounts of time (in
// milliseconds)
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
// The single-cycle I/O block controls our GPIO pins
let sio = hal::Sio::new(pac.SIO);
// Set the pins up according to their function on this particular board
let pins = bsp::Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
// Set the LED to be an output
let mut led_pin = pins.sck0.into_push_pull_output();
// Blink the LED at 1 Hz
loop {
led_pin.set_high().unwrap();
delay.delay_ms(500);
led_pin.set_low().unwrap();
delay.delay_ms(500);
}
}
// End of file
================================================
FILE: boards/arduino_nano_connect/src/lib.rs
================================================
#![no_std]
pub extern crate rp2040_hal as hal;
#[cfg(feature = "rt")]
pub use rp2040_hal::entry;
/// The linker will place this boot block at the start of our program image. We
/// need this to help the ROM bootloader get our code up and running.
///
/// According to [the Arduino store]
/// the board should contain a AT25SF128A flash chip. But
/// there are [reports] of board with different flash chips,
/// where the boot loader BOOT_LOADER_AT25SF128A does not
/// work.
///
/// Therefore, the generic boot loader is used by default. For a specific
/// board, the flash performance can be increased by switching to the
/// matching boot loader.
///
/// [the Arduino store]: https://store.arduino.cc/products/arduino-nano-rp2040-connect
/// [reports]: https://github.com/rp-rs/rp-hal/issues/503
///
#[cfg(feature = "boot2")]
#[link_section = ".boot2"]
#[no_mangle]
#[used]
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
// pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_AT25SF128A;
pub use hal::pac;
// borrowed some pin defs from rp-pico from a dicussion on the bsp_pins! macro
// stripped out functions from connected lines that are no available through
// any of the header pins
hal::bsp_pins!(
/// GPIO 0 supports following functions:
/// | Default | UART0 TX (arduino nano connect)
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 RX` | [crate::Gp0Spi0Rx] |
/// | `UART0 TX` | [crate::Gp0Uart0Tx] |
/// | `I2C0 SDA` | [crate::Gp0I2C0Sda] |
/// | `PWM0 A` | [crate::Gp0Pwm0A] |
/// | `PIO0` | [crate::Gp0Pio0] |
/// | `PIO1` | [crate::Gp0Pio1] |
Gpio0 {
name: tx,
aliases:
{
/// UART Function alias for pin [crate::Pins::gpio0].
FunctionUart, PullNone: Gp0Uart0Tx
}
},
/// GPIO 1 supports following functions:
/// | Default | UART0 RX (arduino nano connect)
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 CSn` | [crate::Gp1Spi0Csn] |
/// | `UART0 RX` | [crate::Gp1Uart0Rx] |
/// | `I2C0 SCL` | [crate::Gp1I2C0Scl] |
/// | `PWM0 B` | [crate::Gp1Pwm0B] |
/// | `PIO0` | [crate::Gp1Pio0] |
/// | `PIO1` | [crate::Gp1Pio1] |
Gpio1 {
name: rx,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio1].
FunctionUart, PullNone: Gp1Uart0Rx
}
},
/// GPIO 2 supports following functions:
/// | Default | GPIO0 on nina, relates to BLE CTS
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 SCK` | [crate::Gp2Spi0Sck] |
/// | `UART0 CTS` | [crate::Gp2Uart0Cts] |
/// | `I2C1 SDA` | [crate::Gp2I2C1Sda] |
/// | `PWM1 A` | [crate::Gp2Pwm1A] |
/// | `PIO0` | [crate::Gp2Pio0] |
/// | `PIO1` | [crate::Gp2Pio1] |
Gpio2 {
// name indicates BLE CTS on nina module, so outgoing line is bleRts using UART
name: ble_rts,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio2].
FunctionUart, PullNone: Gp2Uart0Cts
}
},
/// GPIO 3 supports following functions:
/// | Default | Line for reset of Nina Wifi Module
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 TX` | [crate::Gp3Spi0Tx] |
/// | `UART0 RTS` | [crate::Gp3Uart0Rts] |
/// | `I2C1 SCL` | [crate::Gp3I2C1Scl] |
/// | `PWM1 B` | [crate::Gp3Pwm1B] |
/// | `PIO0` | [crate::Gp3Pio0] |
/// | `PIO1` | [crate::Gp3Pio1] |
Gpio3 {
name: nina_reset_n
},
/// GPIO 4 supports following functions:
/// | Default | SpiRx
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 RX` | [crate::Gp4Spi0Rx] |
/// | `UART1 TX` | [crate::Gp4Uart1Tx] |
/// | `I2C0 SDA` | [crate::Gp4I2C0Sda] |
/// | `PWM2 A` | [crate::Gp4Pwm2A] |
/// | `PIO0` | [crate::Gp4Pio0] |
/// | `PIO1` | [crate::Gp4Pio1] |
Gpio4 {
// Conflicting information between schematic and 'latest' pinnout diagram.
// MISO in schematic, CIPO in 'latest' arduino pinnout diagram. same thing really
// SPIRX in schematic line label.
name: cipo,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio4].
FunctionUart, PullNone: Gp4Uart1Tx,
/// SPI Function alias for pin [crate::Pins::gpio4].
FunctionSpi, PullNone: Gp4Spi0Rx,
/// I2C Function alias for pin [crate::Pins::gpio4].
FunctionI2C, PullUp: Gp4I2C0Sda,
/// PWM Function alias for pin [crate::Pins::gpio4].
FunctionPwm, PullNone: Gp4Pwm2A,
/// PIO0 Function alias for pin [crate::Pins::gpio4].
FunctionPio0, PullNone: Gp4Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio4].
FunctionPio1, PullNone: Gp4Pio1
}
},
/// GPIO 5 supports following functions:
/// | Default | Generic Digital pin D10
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 CSn` | [crate::Gp5Spi0Csn] |
/// | `UART1 RX` | [crate::Gp5Uart1Rx] |
/// | `I2C0 SCL` | [crate::Gp5I2C0Scl] |
/// | `PWM2 B` | [crate::Gp5Pwm2B] |
/// | `PIO0` | [crate::Gp5Pio0] |
/// | `PIO1` | [crate::Gp5Pio1] |
Gpio5 {
name: d10,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio5].
FunctionUart, PullNone: Gp5Uart1Rx,
/// SPI Function alias for pin [crate::Pins::gpio5].
FunctionSpi, PullNone: Gp5Spi0Csn,
/// I2C Function alias for pin [crate::Pins::gpio5].
FunctionI2C, PullUp: Gp5I2C0Scl,
/// PWM Function alias for pin [crate::Pins::gpio5].
FunctionPwm, PullNone: Gp5Pwm2B,
/// PIO0 Function alias for pin [crate::Pins::gpio5].
FunctionPio0, PullNone: Gp5Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio5].
FunctionPio1, PullNone: Gp5Pio1
}
},
/// GPIO 6 supports following functions:
/// | Default | SPI0 SCK (tied to on board led)
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 SCK` | [crate::Gp6Spi0Sck] |
/// | `UART1 CTS` | [crate::Gp6Uart1Cts] |
/// | `I2C1 SDA` | [crate::Gp6I2C1Sda] |
/// | `PWM3 A` | [crate::Gp6Pwm3A] |
/// | `PIO0` | [crate::Gp6Pio0] |
/// | `PIO1` | [crate::Gp6Pio1] |
Gpio6 {
// also tied to on board led, on pin 13
name: sck0,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio6].
FunctionUart, PullNone: Gp6Uart1Cts,
/// SPI Function alias for pin [crate::Pins::gpio6].
FunctionSpi, PullNone: Gp6Spi0Sck,
/// I2C Function alias for pin [crate::Pins::gpio6].
FunctionI2C, PullUp: Gp6I2C1Sda,
/// PWM Function alias for pin [crate::Pins::gpio6].
FunctionPwm, PullNone: Gp6Pwm3A,
/// PIO0 Function alias for pin [crate::Pins::gpio6].
FunctionPio0, PullNone: Gp6Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio6].
FunctionPio1, PullNone: Gp6Pio1
}
},
/// GPIO 7 supports following functions:
/// | Default | SPI0 TX
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 TX` | [crate::Gp7Spi0Tx] |
/// | `UART1 RTS` | [crate::Gp7Uart1Rts] |
/// | `I2C1 SCL` | [crate::Gp7I2C1Scl] |
/// | `PWM3 B` | [crate::Gp7Pwm3B] |
/// | `PIO0` | [crate::Gp7Pio0] |
/// | `PIO1` | [crate::Gp7Pio1] |
Gpio7 {
// Conflicting information between schematic and 'latest' pinnout diagram.
// MOSI in schematic, COPI in 'latest' arduino pinnout diagram.
// SPITX in schematic line label.
name: copi,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio7].
FunctionUart, PullNone: Gp7Uart1Rts,
/// SPI Function alias for pin [crate::Pins::gpio7].
FunctionSpi, PullNone: Gp7Spi0Tx,
/// I2C Function alias for pin [crate::Pins::gpio7].
FunctionI2C, PullUp: Gp7I2C1Scl,
/// PWM Function alias for pin [crate::Pins::gpio7].
FunctionPwm, PullNone: Gp7Pwm3B,
/// PIO0 Function alias for pin [crate::Pins::gpio7].
FunctionPio0, PullNone: Gp7Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio7].
FunctionPio1, PullNone: Gp7Pio1
}
},
/// GPIO 8 supports following functions:
/// | Default | SPI1 CIPO / UART1 TX connection to Nina Module
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 RX` | [crate::Gp8Spi1Rx] |
/// | `UART1 TX` | [crate::Gp8Uart1Tx] |
/// | `I2C0 SDA` | [crate::Gp8I2C0Sda] |
/// | `PWM4 A` | [crate::Gp8Pwm4A] |
/// | `PIO0` | [crate::Gp8Pio0] |
/// | `PIO1` | [crate::Gp8Pio1] |
Gpio8 {
// name indicates port to BLE RX on nina module and SPI CIPO for wifi
name: ble_tx_cipo,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio8].
FunctionUart, PullNone: Gp8Uart1Tx,
/// SPI Function alias for pin [crate::Pins::gpio8].
FunctionSpi, PullNone: Gp8Spi1Rx
}
},
/// GPIO 9 supports following functions:
/// | Default | SPI1 CS / UART1 RX
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 CSn` | [crate::Gp9Spi1Csn] |
/// | `UART1 RX` | [crate::Gp9Uart1Rx] |
/// | `I2C0 SCL` | [crate::Gp9I2C0Scl] |
/// | `PWM4 B` | [crate::Gp9Pwm4B] |
/// | `PIO0` | [crate::Gp9Pio0] |
/// | `PIO1` | [crate::Gp9Pio1] |
Gpio9 {
// name indicates BLE TX on nina module and spi1 cs signal to wifi
name: ble_rx_cs,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio9].
FunctionUart, PullNone: Gp9Uart1Rx,
/// SPI Function alias for pin [crate::Pins::gpio9].
FunctionSpi, PullNone: Gp9Spi1Csn
}
},
/// GPIO 10 supports following functions:
/// | Default | SPI1 ACK / UART1 CTS
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 SCK` | [crate::Gp10Spi1Sck] |
/// | `UART1 CTS` | [crate::Gp10Uart1Cts] |
/// | `I2C1 SDA` | [crate::Gp10I2C1Sda] |
/// | `PWM5 A` | [crate::Gp10Pwm5A] |
/// | `PIO0` | [crate::Gp10Pio0] |
/// | `PIO1` | [crate::Gp10Pio1] |
Gpio10 {
// name indicates BLE RTS on nina module and spi1 ack
name: ble_cts_ack,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio10].
FunctionUart, PullNone: Gp10Uart1Cts,
/// SPI Function alias for pin [crate::Pins::gpio10].
FunctionSpi, PullNone: Gp10Spi1Sck
}
},
/// GPIO 11 supports following functions:
/// | Default | SPI1 COPI / UART1 RTS
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 TX` | [crate::Gp11Spi1Tx] |
/// | `UART1 RTS` | [crate::Gp11Uart1Rts] |
/// | `I2C1 SCL` | [crate::Gp11I2C1Scl] |
/// | `PWM5 B` | [crate::Gp11Pwm5B] |
/// | `PIO0` | [crate::Gp11Pio0] |
/// | `PIO1` | [crate::Gp11Pio1] |
Gpio11 {
// ninaCOPI is
name: nina_copi,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio11].
FunctionUart, PullNone: Gp11Uart1Rts,
/// SPI Function alias for pin [crate::Pins::gpio11].
FunctionSpi, PullNone: Gp11Spi1Tx
}
},
/// GPIO 12 supports following functions:
/// | Default | I2C0 SDA / A4 ~ goes to pullups and auth
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 RX` | [crate::Gp12Spi1Rx] |
/// | `UART0 TX` | [crate::Gp12Uart0Tx] |
/// | `I2C0 SDA` | [crate::Gp12I2C0Sda] |
/// | `PWM6 A` | [crate::Gp12Pwm6A] |
/// | `PIO0` | [crate::Gp12Pio0] |
/// | `PIO1` | [crate::Gp12Pio1] |
Gpio12 {
// Also SDA Crypto
name: a4,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio12].
FunctionUart, PullNone: Gp12Uart0Tx,
/// SPI Function alias for pin [crate::Pins::gpio12].
FunctionSpi, PullNone: Gp12Spi1Rx,
/// I2C Function alias for pin [crate::Pins::gpio12].
FunctionI2C, PullUp: Gp12I2C0Sda,
/// PWM Function alias for pin [crate::Pins::gpio12].
FunctionPwm, PullNone: Gp12Pwm6A,
/// PIO0 Function alias for pin [crate::Pins::gpio12].
FunctionPio0, PullNone: Gp12Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio12].
FunctionPio1, PullNone: Gp12Pio1
}
},
/// GPIO 13 supports following functions:
/// | Default | I2C0 SCL / A5 ~ goes to pullups
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 CSn` | [crate::Gp13Spi1Csn] |
/// | `UART0 RX` | [crate::Gp13Uart0Rx] |
/// | `I2C0 SCL` | [crate::Gp13I2C0Scl] |
/// | `PWM6 B` | [crate::Gp13Pwm6B] |
/// | `PIO0` | [crate::Gp13Pio0] |
/// | `PIO1` | [crate::Gp13Pio1] |
Gpio13 {
// Also SCL Crypto
name: a5,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio13].
FunctionUart, PullNone: Gp13Uart0Rx,
/// SPI Function alias for pin [crate::Pins::gpio13].
FunctionSpi, PullNone: Gp13Spi1Csn,
/// I2C Function alias for pin [crate::Pins::gpio13].
FunctionI2C, PullUp: Gp13I2C0Scl,
/// PWM Function alias for pin [crate::Pins::gpio13].
FunctionPwm, PullNone: Gp13Pwm6B,
/// PIO0 Function alias for pin [crate::Pins::gpio13].
FunctionPio0, PullNone: Gp13Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio13].
FunctionPio1, PullNone: Gp13Pio1
}
},
/// GPIO 14 supports following functions:
/// | Default | SPI1 SCK ~ nina SCK
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 SCK` | [crate::Gp14Spi1Sck] |
/// | `UART0 CTS` | [crate::Gp14Uart0Cts] |
/// | `I2C1 SDA` | [crate::Gp14I2C1Sda] |
/// | `PWM7 A` | [crate::Gp14Pwm7A] |
/// | `PIO0` | [crate::Gp14Pio0] |
/// | `PIO1` | [crate::Gp14Pio1] |
Gpio14 {
name: nina_sck,
aliases: {
/// SPI Function alias for pin [crate::Pins::gpio14].
FunctionSpi, PullNone: Gp14Spi1Sck
}
},
/// GPIO 15 supports following functions:
/// | Default | General Digital pin D3
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 TX` | [crate::Gp15Spi1Tx] |
/// | `UART0 RTS` | [crate::Gp15Uart0Rts] |
/// | `I2C1 SCL` | [crate::Gp15I2C1Scl] |
/// | `PWM7 B` | [crate::Gp15Pwm7B] |
/// | `PIO0` | [crate::Gp15Pio0] |
/// | `PIO1` | [crate::Gp15Pio1] |
Gpio15 {
name: d3,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio15].
FunctionUart, PullNone: Gp15Uart0Rts,
/// SPI Function alias for pin [crate::Pins::gpio15].
FunctionSpi, PullNone: Gp15Spi1Tx,
/// I2C Function alias for pin [crate::Pins::gpio15].
FunctionI2C, PullUp: Gp15I2C1Scl,
/// PWM Function alias for pin [crate::Pins::gpio15].
FunctionPwm, PullNone: Gp15Pwm7B,
/// PIO0 Function alias for pin [crate::Pins::gpio15].
FunctionPio0, PullNone: Gp15Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio15].
FunctionPio1, PullNone: Gp15Pio1
}
},
/// GPIO 16 supports following functions:
/// | Default | General Digital pin D4
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 RX` | [crate::Gp16Spi0Rx] |
/// | `UART0 TX` | [crate::Gp16Uart0Tx] |
/// | `I2C0 SDA` | [crate::Gp16I2C0Sda] |
/// | `PWM0 A` | [crate::Gp16Pwm0A] |
/// | `PIO0` | [crate::Gp16Pio0] |
/// | `PIO1` | [crate::Gp16Pio1] |
Gpio16 {
name: d4,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio16].
FunctionUart, PullNone: Gp16Uart0Tx,
/// SPI Function alias for pin [crate::Pins::gpio16].
FunctionSpi, PullNone: Gp16Spi0Rx,
/// I2C Function alias for pin [crate::Pins::gpio16].
FunctionI2C, PullUp: Gp16I2C0Sda,
/// PWM Function alias for pin [crate::Pins::gpio16].
FunctionPwm, PullNone: Gp16Pwm0A,
/// PIO0 Function alias for pin [crate::Pins::gpio16].
FunctionPio0, PullNone: Gp16Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio16].
FunctionPio1, PullNone: Gp16Pio1
}
},
/// GPIO 17 supports following functions:
/// | Default | General Digital pin D5
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 CSn` | [crate::Gp17Spi0Csn] |
/// | `UART0 RX` | [crate::Gp17Uart0Rx] |
/// | `I2C0 SCL` | [crate::Gp17I2C0Scl] |
/// | `PWM0 B` | [crate::Gp17Pwm0B] |
/// | `PIO0` | [crate::Gp17Pio0] |
/// | `PIO1` | [crate::Gp17Pio1] |
Gpio17 {
name: d5,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio17].
FunctionUart, PullNone: Gp17Uart0Rx,
/// SPI Function alias for pin [crate::Pins::gpio17].
FunctionSpi, PullNone: Gp17Spi0Csn,
/// I2C Function alias for pin [crate::Pins::gpio17].
FunctionI2C, PullUp: Gp17I2C0Scl,
/// PWM Function alias for pin [crate::Pins::gpio17].
FunctionPwm, PullNone: Gp17Pwm0B,
/// PIO0 Function alias for pin [crate::Pins::gpio17].
FunctionPio0, PullNone: Gp17Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio17].
FunctionPio1, PullNone: Gp17Pio1
}
},
/// GPIO 18 supports following functions:
/// | Default | General Digital pin D6
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 SCK` | [crate::Gp18Spi0Sck] |
/// | `UART0 CTS` | [crate::Gp18Uart0Cts] |
/// | `I2C1 SDA` | [crate::Gp18I2C1Sda] |
/// | `PWM1 A` | [crate::Gp18Pwm1A] |
/// | `PIO0` | [crate::Gp18Pio0] |
/// | `PIO1` | [crate::Gp18Pio1] |
Gpio18 {
name: d6,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio18].
FunctionUart, PullNone: Gp18Uart0Cts,
/// SPI Function alias for pin [crate::Pins::gpio18].
FunctionSpi, PullNone: Gp18Spi0Sck,
/// I2C Function alias for pin [crate::Pins::gpio18].
FunctionI2C, PullUp: Gp18I2C1Sda,
/// PWM Function alias for pin [crate::Pins::gpio18].
FunctionPwm, PullNone: Gp18Pwm1A,
/// PIO0 Function alias for pin [crate::Pins::gpio18].
FunctionPio0, PullNone: Gp18Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio18].
FunctionPio1, PullNone: Gp18Pio1
}
},
/// GPIO 19 supports following functions:
/// | Default | General Digital Pin D7
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 TX` | [crate::Gp19Spi0Tx] |
/// | `UART0 RTS` | [crate::Gp19Uart0Rts] |
/// | `I2C1 SCL` | [crate::Gp19I2C1Scl] |
/// | `PWM1 B` | [crate::Gp19Pwm1B] |
/// | `PIO0` | [crate::Gp19Pio0] |
/// | `PIO1` | [crate::Gp19Pio1] |
Gpio19 {
name: d7,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio19].
FunctionUart, PullNone: Gp19Uart0Rts,
/// SPI Function alias for pin [crate::Pins::gpio19].
FunctionSpi, PullNone: Gp19Spi0Tx,
/// I2C Function alias for pin [crate::Pins::gpio19].
FunctionI2C, PullUp: Gp19I2C1Scl,
/// PWM Function alias for pin [crate::Pins::gpio19].
FunctionPwm, PullNone: Gp19Pwm1B,
/// PIO0 Function alias for pin [crate::Pins::gpio19].
FunctionPio0, PullNone: Gp19Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio19].
FunctionPio1, PullNone: Gp19Pio1
}
},
/// GPIO 20 supports following functions:
/// | Default | General Digital pin D8
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 RX` | [crate::Gp20Spi0Rx] |
/// | `UART1 TX` | [crate::Gp20Uart1Tx] |
/// | `I2C0 SDA` | [crate::Gp20I2C0Sda] |
/// | `PWM2 A` | [crate::Gp20Pwm2A] |
/// | `PIO0` | [crate::Gp20Pio0] |
/// | `PIO1` | [crate::Gp20Pio1] |
Gpio20 {
name: d8,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio20].
FunctionUart, PullNone: Gp20Uart1Tx,
/// SPI Function alias for pin [crate::Pins::gpio20].
FunctionSpi, PullNone: Gp20Spi0Rx,
/// I2C Function alias for pin [crate::Pins::gpio20].
FunctionI2C, PullUp: Gp20I2C0Sda,
/// PWM Function alias for pin [crate::Pins::gpio20].
FunctionPwm, PullNone: Gp20Pwm2A,
/// PIO0 Function alias for pin [crate::Pins::gpio20].
FunctionPio0, PullNone: Gp20Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio20].
FunctionPio1, PullNone: Gp20Pio1
}
},
/// GPIO 21 supports following functions:
/// | Default | General Digital pin D9
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 CSn` | [crate::Gp21Spi0Csn] |
/// | `UART1 RX` | [crate::Gp21Uart1Rx] |
/// | `I2C0 SCL` | [crate::Gp21I2C0Scl] |
/// | `PWM2 B` | [crate::Gp21Pwm2B] |
/// | `PIO0` | [crate::Gp21Pio0] |
/// | `PIO1` | [crate::Gp21Pio1] |
Gpio21 {
name: d9,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio21].
FunctionUart, PullNone: Gp21Uart1Rx,
/// SPI Function alias for pin [crate::Pins::gpio21].
FunctionSpi, PullNone: Gp21Spi0Csn,
/// I2C Function alias for pin [crate::Pins::gpio21].
FunctionI2C, PullUp: Gp21I2C0Scl,
/// PWM Function alias for pin [crate::Pins::gpio21].
FunctionPwm, PullNone: Gp21Pwm2B,
/// PIO0 Function alias for pin [crate::Pins::gpio21].
FunctionPio0, PullNone: Gp21Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio21].
FunctionPio1, PullNone: Gp21Pio1
}
},
/// GPIO 22 supports following functions:
/// | Default | PDMDIN
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 SCK` | [crate::Gp22Spi0Sck] |
/// | `UART1 CTS` | [crate::Gp22Uart1Cts] |
/// | `I2C1 SDA` | [crate::Gp22I2C1Sda] |
/// | `PWM3 A` | [crate::Gp22Pwm3A] |
/// | `PIO0` | [crate::Gp22Pio0] |
/// | `PIO1` | [crate::Gp22Pio1] |
Gpio22 {
// this connects to the microphone module
name: pdmdin
},
/// GPIO 23 supports following functions:
/// | Default | PDMCLK
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 TX` | [crate::Gp23Spi0Tx] |
/// | `UART1 RTS` | [crate::Gp23Uart1Rts] |
/// | `I2C1 SCL` | [crate::Gp23I2C1Scl] |
/// | `PWM3 B` | [crate::Gp23Pwm3B] |
/// | `PIO0` | [crate::Gp23Pio0] |
/// | `PIO1` | [crate::Gp23Pio1] |
Gpio23 {
name: pdmclk
},
/// GPIO 24 supports following functions:
/// | Default | INT1 ~ connected to INT1 on the IMU
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 RX` | [crate::Gp24Spi1Rx] |
/// | `UART1 TX` | [crate::Gp24Uart1Tx] |
/// | `I2C0 SDA` | [crate::Gp24I2C0Sda] |
/// | `PWM4 A` | [crate::Gp24Pwm4A] |
/// | `PIO0` | [crate::Gp24Pio0] |
/// | `PIO1` | [crate::Gp24Pio1] |
Gpio24 {
name: int1
},
/// GPIO 25 supports following functions:
/// | Default |
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 CSn` | [crate::Gp25Spi1Csn] |
/// | `UART1 RX` | [crate::Gp25Uart1Rx] |
/// | `I2C0 SCL` | [crate::Gp25I2C0Scl] |
/// | `PWM4 B` | [crate::Gp25Pwm4B] |
/// | `PIO0` | [crate::Gp25Pio0] |
/// | `PIO1` | [crate::Gp25Pio1] |
Gpio25 {
name: d2,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio25].
FunctionUart, PullNone: Gp25Uart1Rx,
/// SPI Function alias for pin [crate::Pins::gpio25].
FunctionSpi, PullNone: Gp25Spi1Csn,
/// I2C Function alias for pin [crate::Pins::gpio25].
FunctionI2C, PullUp: Gp25I2C0Scl,
/// PWM Function alias for pin [crate::Pins::gpio25].
FunctionPwm, PullNone: Gp25Pwm4B,
/// PIO0 Function alias for pin [crate::Pins::gpio25].
FunctionPio0, PullNone: Gp25Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio25].
FunctionPio1, PullNone: Gp25Pio1
}
},
/// GPIO 26 supports following functions:
///
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 SCK` | [crate::Gp26Spi1Sck] |
/// | `UART1 CTS` | [crate::Gp26Uart1Cts] |
/// | `I2C1 SDA` | [crate::Gp26I2C1Sda] |
/// | `PWM5 A` | [crate::Gp26Pwm5A] |
/// | `PIO0` | [crate::Gp26Pio0] |
/// | `PIO1` | [crate::Gp26Pio1] |
Gpio26 {
name: a0,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio26].
FunctionUart, PullNone: Gp26Uart1Cts,
/// SPI Function alias for pin [crate::Pins::gpio26].
FunctionSpi, PullNone: Gp26Spi1Sck,
/// I2C Function alias for pin [crate::Pins::gpio26].
FunctionI2C, PullUp: Gp26I2C1Sda,
/// PWM Function alias for pin [crate::Pins::gpio26].
FunctionPwm, PullNone: Gp26Pwm5A,
/// PIO0 Function alias for pin [crate::Pins::gpio26].
FunctionPio0, PullNone: Gp26Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio26].
FunctionPio1, PullNone: Gp26Pio1
}
},
/// GPIO 27 supports following functions:
///
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 TX` | [crate::Gp27Spi1Tx] |
/// | `UART1 RTS` | [crate::Gp27Uart1Rts] |
/// | `I2C1 SCL` | [crate::Gp27I2C1Scl] |
/// | `PWM5 B` | [crate::Gp27Pwm5B] |
/// | `PIO0` | [crate::Gp27Pio0] |
/// | `PIO1` | [crate::Gp27Pio1] |
Gpio27 {
name: a1,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio27].
FunctionUart, PullNone: Gp27Uart1Rts,
/// SPI Function alias for pin [crate::Pins::gpio27].
FunctionSpi, PullNone: Gp27Spi1Tx,
/// I2C Function alias for pin [crate::Pins::gpio27].
FunctionI2C, PullUp: Gp27I2C1Scl,
/// PWM Function alias for pin [crate::Pins::gpio27].
FunctionPwm, PullNone: Gp27Pwm5B,
/// PIO0 Function alias for pin [crate::Pins::gpio27].
FunctionPio0, PullNone: Gp27Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio27].
FunctionPio1, PullNone: Gp27Pio1
}
},
/// GPIO 28 supports following functions:
///
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 RX` | [crate::Gp28Spi1Rx] |
/// | `UART0 TX` | [crate::Gp28Uart0Tx] |
/// | `I2C0 SDA` | [crate::Gp28I2C0Sda] |
/// | `PWM6 A` | [crate::Gp28Pwm6A] |
/// | `PIO0` | [crate::Gp28Pio0] |
/// | `PIO1` | [crate::Gp28Pio1] |
Gpio28 {
name: a2,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio28].
FunctionUart, PullNone: Gp28Uart0Tx,
/// SPI Function alias for pin [crate::Pins::gpio28].
FunctionSpi, PullNone: Gp28Spi1Rx,
/// I2C Function alias for pin [crate::Pins::gpio28].
FunctionI2C, PullUp: Gp28I2C0Sda,
/// PWM Function alias for pin [crate::Pins::gpio28].
FunctionPwm, PullNone: Gp28Pwm6A,
/// PIO0 Function alias for pin [crate::Pins::gpio28].
FunctionPio0, PullNone: Gp28Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio28].
FunctionPio1, PullNone: Gp28Pio1
}
},
/// GPIO 29 supports following functions:
///
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI1 CS` | [crate::Gp29Spi1CSn] |
/// | `UART0 RX` | [crate::Gp29Uart0Rx] |
/// | `I2C0 SCL` | [crate::Gp29I2C0Scl] |
/// | `PWM6 B` | [crate::Gp29Pwm6B] |
/// | `PIO0` | [crate::Gp29Pio0] |
/// | `PIO1` | [crate::Gp29Pio1] |
Gpio29 {
name: a3,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio28].
FunctionUart, PullNone: Gp29Uart0Rx,
/// SPI Function alias for pin [crate::Pins::gpio28].
FunctionSpi, PullNone: Gp29Spi1CSn,
/// I2C Function alias for pin [crate::Pins::gpio28].
FunctionI2C, PullUp: Gp29I2C0Scl,
/// PWM Function alias for pin [crate::Pins::gpio28].
FunctionPwm, PullNone: Gp29Pwm6B,
/// PIO0 Function alias for pin [crate::Pins::gpio28].
FunctionPio0, PullNone: Gp29Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio28].
FunctionPio1, PullNone: Gp29Pio1
}
},
);
pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
================================================
FILE: boards/boardsource-blok/.gitignore
================================================
# Generated by Cargo
# will have compiled files and executables
debug/
target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
================================================
FILE: boards/boardsource-blok/CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 0.3.0 - 2024-04-07
### Changed
- Update to rp2040-hal 0.10.0
- Update to embedded-hal 1.0.0
## 0.2.1 - 2023-10-25
### Changed
- Updated pinout
## 0.2.0 - 2023-09-02
### Changed
- Update to rp2040-hal 0.9.0
- Update to ws2812-pio 0.7.0
## 0.1.0 - 2023-6-8
- Initial release
================================================
FILE: boards/boardsource-blok/Cargo.toml
================================================
[package]
name = "boardsource-blok"
version = "0.3.0"
edition = "2021"
authors = ["Agent59 <agent59@ripakewitz.net>", "The rp-rs Developers"]
homepage = "https://github.com/rp-rs/rp-hal-boards/tree/main/boards/boardsource-blok"
description = "Board Support Package for the rp2040 based Blok"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal-boards.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m.workspace = true
rp2040-boot2 = { workspace = true, optional = true}
rp2040-hal.workspace = true
cortex-m-rt = { workspace = true, optional = true}
fugit.workspace = true
[dev-dependencies]
panic-halt.workspace = true
embedded-hal.workspace = true
nb.workspace = true
smart-leds.workspace = true
ws2812-pio.workspace = true
usb-device.workspace = true
usbd-hid.workspace = true
critical-section.workspace = true
[features]
# This is the set of features we enable by default
default = ["boot2", "rt", "critical-section-impl", "rom-func-cache"]
# critical section that is safe for multicore use
critical-section-impl = ["rp2040-hal/critical-section-impl"]
# 2nd stage bootloaders for rp2040
boot2 = ["rp2040-boot2"]
# Minimal startup / runtime for Cortex-M microcontrollers
rt = ["cortex-m-rt","rp2040-hal/rt"]
# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus.
# Only required for RP2040 B0 and RP2040 B1, but it also works for RP2040 B2 and above
rp2040-e5 = ["rp2040-hal/rp2040-e5"]
# Memoize(cache) ROM function pointers on first use to improve performance
rom-func-cache = ["rp2040-hal/rom-func-cache"]
# Disable automatic mapping of language features (like floating point math) to ROM functions
disable-intrinsics = ["rp2040-hal/disable-intrinsics"]
# This enables ROM functions for f64 math that were not present in the earliest RP2040s
rom-v2-intrinsics = ["rp2040-hal/rom-v2-intrinsics"]
================================================
FILE: boards/boardsource-blok/README.md
================================================
# [boardsource-blok] - Board Support for the [Blok]
You should include this crate if you are writing code that you want to run on
a [Blok] - an RP2040 based controller, made by [Boardsource],
built for the keyboard community.
This crate includes the [rp2040-hal], but also configures each pin of the
RP2040 chip according to how it is connected up on the Blok.
More Information about the pin layout at [Peg].
[Blok]: https://boardsource.xyz/store/628b95b494dfa308a6581622
[boardsource-blok]: https://github.com/rp-rs/rp-hal-boards/tree/main/boards/boardsource-blok
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Boardsource]: https://boardsource.xyz/
[Peg]: https://peg.software/docs/blok
## Using
To use this crate, your `Cargo.toml` file should contain:
```toml
boardsource-blok = "0.3.0"
```
In your program, you will need to call `blok::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details.
## Examples
### General Instructions
To compile an example, clone the _rp-hal-boards_ repository and run:
```console
rp-hal-boards/boards/boardsource-blok $ cargo build --release --example <name>
```
You will get an ELF file called
`./target/thumbv6m-none-eabi/release/examples/<name>`, where the `target`
folder is located at the top of the _rp-hal-boards_ repository checkout. Normally
you would also need to specify `--target=thumbv6m-none-eabi` but when
building examples from this git repository, that is set as the default.
If you want to convert the ELF file to a UF2 and automatically copy it to the
USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run:
```console
rp-hal-boards/boards/boardsource-blok $ cargo run --release --example <name>
```
If you get an error about not being able to find `elf2uf2-rs`, try:
```console
$ cargo install elf2uf2-rs
```
then try repeating the `cargo run` command above.
### From Scratch
To start a basic project from scratch, create a project using `cargo new project-name`. Within the
project directory, run `cargo add blok`, `cargo add cortex-m-rt`, and `cargo add panic-halt`. The
first 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.
You'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.
The simplest working example, which does nothing except loop forever, is:
```ignore
#![no_std]
#![no_main]
use blok::entry;
use panic_halt as _;
#[entry]
fn see_doesnt_have_to_be_called_main() -> ! {
loop {}
}
```
It can be placed in _/src/main.rs_.
You can use `cargo run` to compile and install it.
**Note**: You won't see any activity since this program does nothing. You can use the examples provided
to add more functionality.
### [blok_rainbow](./examples/blok_rainbow.rs)
Runs a rainbow-effect color wheel on the on-board neopixel.
### [blok_reset_to_usb_boot](./examples/blok_reset_to_usb_boot.rs)
Resets the Blok after 10 seconds to usb boot mode.
### [blok_usb_keyboard_input](./examples/blok_usb_keyboard_input.rs)
Demonstrates emulating a USB Human Input Device (HID) Keyboard. The keyboard
will type "HELLO" five times.
## Contributing
Contributions are what make the open source community such an amazing place to
be learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
The steps are:
1. Fork the Project by clicking the 'Fork' button at the top of the page.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Make some changes to the code or documentation.
4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
5. Push to the Feature Branch (`git push origin feature/AmazingFeature`)
6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal-boards/pulls)
7. An admin will review the Pull Request and discuss any changes that may be required.
8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project!
## Code of Conduct
Contribution to this crate is organized under the terms of the [Rust Code of
Conduct][CoC], and the maintainer of this crate, the [rp-rs team], promises
to intervene to uphold that code of conduct.
[CoC]: CODE_OF_CONDUCT.md
[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs
## License
The contents of this repository are dual-licensed under the _MIT OR Apache
2.0_ License. That means you can choose either the MIT license or the
Apache-2.0 license when you re-use this code. See `MIT` or `APACHE2.0` for more
information on each specific license.
Any submissions to this project (e.g. as Pull Requests) must be made available
under these terms.
================================================
FILE: boards/boardsource-blok/examples/blok_rainbow.rs
================================================
//! # Rainbow Example for the Blok
//!
//! Runs a rainbow-effect colour wheel on the on-board neopixel.
//! Uses the `ws2821_pio` driver to control the NeoPixel, which in turn uses the
//! RP2040's PIO block
//!
//! See the `Cargo.toml` file for Copyright and license details.
#![no_std]
#![no_main]
use boardsource_blok::entry;
use boardsource_blok::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
pio::PIOExt,
timer::Timer,
watchdog::Watchdog,
Sio,
},
Pins, XOSC_CRYSTAL_FREQ,
};
use core::iter::once;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
#[entry]
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let sio = Sio::new(pac.SIO);
let pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
// Configure the addressable LED
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
// The onboard neopixel is attached to GPIO pin 25
pins.neopixel.into_function(),
&mut pio,
sm0,
clocks.peripheral_clock.freq(),
timer.count_down(),
);
// Infinite colour wheel loop
let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);
timer.delay_ms(25);
}
}
/// Convert a number from `0..=255` to an RGB color triplet.
///
/// The colours are a transition from red, to green, to blue and back to red.
fn wheel(mut wheel_pos: u8) -> RGB8 {
wheel_pos = 255 - wheel_pos;
if wheel_pos < 85 {
// No green in this sector - red and blue only
(255 - (wheel_pos * 3), 0, wheel_pos * 3).into()
} else if wheel_pos < 170 {
// No red in this sector - green and blue only
wheel_pos -= 85;
(0, wheel_pos * 3, 255 - (wheel_pos * 3)).into()
} else {
// No blue in this sector - red and green only
wheel_pos -= 170;
(wheel_pos * 3, 255 - (wheel_pos * 3), 0).into()
}
}
================================================
FILE: boards/boardsource-blok/examples/blok_reset_to_usb_boot.rs
================================================
//! # Reset To Usb Boot Example for the Blok
//!
//! Resets the Blok after 10 seconds to usb boot mode.
//!
//! Afterwards the microcontroller should be automatically mounted as a drive,
//! just like when booted while holding down the boot button.
//!
//! See the `Cargo.toml` file for Copyright and license details.
#![no_std]
#![no_main]
use boardsource_blok::{entry, hal};
use boardsource_blok::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
timer::Timer,
watchdog::Watchdog,
Sio,
},
Pins, XOSC_CRYSTAL_FREQ,
};
use panic_halt as _;
#[entry]
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let sio = Sio::new(pac.SIO);
let _pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let _timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
let core = pac::CorePeripherals::take().unwrap();
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
loop {
// waits 10 seconds
delay.delay_ms(10_000);
// resets to usb boot mode
hal::rom_data::reset_to_usb_boot(0, 0);
}
}
================================================
FILE: boards/boardsource-blok/examples/blok_usb_keyboard_input.rs
================================================
//! # Keyboard Input Example for the Blok
//!
//! Creates a USB HID Class Keyboard device on a Blok,
//! with the USB driver running in the main thread.
//!
//! It generates keyboard reports which all together
//! type the word "HELLO" on the computer.
//!
//! This behaviour will be repeated 5 times
//! after which the Blok will reset to usb boot mode.
//!
//! See the `Cargo.toml` file for Copyright and license details.
#![no_std]
#![no_main]
#![allow(static_mut_refs)]
use boardsource_blok::{entry, hal};
use boardsource_blok::{
hal::{
clocks::{init_clocks_and_plls, Clock},
pac,
pac::interrupt,
timer::Timer,
watchdog::Watchdog,
Sio,
},
Pins, XOSC_CRYSTAL_FREQ,
};
use panic_halt as _;
use usb_device::{
bus::UsbBusAllocator,
device::{StringDescriptors, UsbDevice, UsbDeviceBuilder, UsbVidPid},
};
use usbd_hid::{descriptor::KeyboardReport, descriptor::SerializedDescriptor, hid_class::HIDClass};
// shared with the interrupt
static mut USB_BUS: Option<UsbBusAllocator<hal::usb::UsbBus>> = None;
static mut USB_HID: Option<HIDClass<hal::usb::UsbBus>> = None;
static mut USB_DEVICE: Option<UsbDevice<hal::usb::UsbBus>> = None;
#[entry]
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let clocks = init_clocks_and_plls(
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
)
.ok()
.unwrap();
let sio = Sio::new(pac.SIO);
let _pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let _timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
let usb_bus = UsbBusAllocator::new(hal::usb::UsbBus::new(
pac.USBCTRL_REGS,
pac.USBCTRL_DPRAM,
clocks.usb_clock,
true,
&mut pac.RESETS,
));
unsafe {
USB_BUS = Some(usb_bus);
}
let bus_ref = unsafe { USB_BUS.as_ref().unwrap() };
let usb_hid = HIDClass::new(bus_ref, KeyboardReport::desc(), 10);
unsafe {
USB_HID = Some(usb_hid);
}
let usb_device = UsbDeviceBuilder::new(bus_ref, UsbVidPid(0x1209, 0x0001))
.strings(&[StringDescriptors::default().product("keyboard input")])
.unwrap()
.build();
unsafe {
USB_DEVICE = Some(usb_device);
}
// enable usb interrupt
unsafe {
pac::NVIC::unmask(hal::pac::Interrupt::USBCTRL_IRQ);
}
let core = pac::CorePeripherals::take().unwrap();
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
let mut i = 0;
loop {
// wait 5 seconds on the first loop, otherwise the first keyboard reports
// might not be processed by the computer
if i == 0 {
delay.delay_ms(5_000);
}
delay.delay_ms(100);
push_report(KeyboardReport {
modifier: 0b0000_0010, // LeftShift
reserved: 0x00,
leds: 0x00,
keycodes: [0x0b, 0x00, 0x00, 0x00, 0x00, 0x00], // H
});
delay.delay_ms(100);
push_report(KeyboardReport {
modifier: 0b0000_0010, // LeftShift
reserved: 0x00,
leds: 0x00,
keycodes: [0x08, 0x00, 0x00, 0x00, 0x00, 0x00], // E
});
delay.delay_ms(100);
push_report(KeyboardReport {
modifier: 0b0000_0010, // LeftShift
reserved: 0x00,
leds: 0x00,
keycodes: [0x0f, 0x00, 0x00, 0x00, 0x00, 0x00], // L
});
delay.delay_ms(100);
push_report(KeyboardReport {
modifier: 0x00,
reserved: 0x00,
leds: 0x00,
keycodes: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00], // no keys pressed
});
delay.delay_ms(100);
push_report(KeyboardReport {
modifier: 0b0000_0010, // LeftShift
reserved: 0x00,
leds: 0x00,
keycodes: [0x0f, 0x00, 0x00, 0x00, 0x00, 0x00], // L
});
delay.delay_ms(100);
push_report(KeyboardReport {
modifier: 0b0000_0010, // LeftShift
reserved: 0x00,
leds: 0x00,
keycodes: [0x12, 0x00, 0x00, 0x00, 0x00, 0x00], // O
});
delay.delay_ms(100);
push_report(KeyboardReport {
modifier: 0x00,
reserved: 0x00,
leds: 0x00,
keycodes: [0x2c, 0x00, 0x00, 0x00, 0x00, 0x00], // space
});
i += 1;
if i >= 5 {
hal::rom_data::reset_to_usb_boot(0, 0);
}
}
}
/// Submit a new Keyboard Report to the USB stack.
///
/// We do this with interrupts disabled, to avoid a race hazard with the USB IRQ.
fn push_report(report: KeyboardReport) {
let _ = critical_section::with(|_| unsafe {
// Now interrupts are disabled
USB_HID.as_mut().map(|hid| hid.push_input(&report))
})
.unwrap();
}
/// This function is called whenever the USB Hardware generates
/// an Interrupt Request
#[allow(non_snake_case)]
#[interrupt]
unsafe fn USBCTRL_IRQ() {
let usb_device = USB_DEVICE.as_mut().unwrap();
let usb_hid = USB_HID.as_mut().unwrap();
usb_device.poll(&mut [usb_hid]);
}
================================================
FILE: boards/boardsource-blok/src/lib.rs
================================================
#![no_std]
pub extern crate rp2040_hal as hal;
#[cfg(feature = "rt")]
extern crate cortex_m_rt;
#[cfg(feature = "rt")]
pub use hal::entry;
/// The linker will place this boot block at the start of our program image. We
/// need this to help the ROM bootloader get our code up and running.
#[cfg(feature = "boot2")]
#[link_section = ".boot2"]
#[no_mangle]
#[used]
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
pub use hal::pac;
hal::bsp_pins!(
/// GPIO 0 supports following functions:
///
/// | Function | Alias with applied function |
/// |--------------|-----------------------------|
/// | `SPI0 RX` | [crate::Gp0Spi0Rx] |
/// | `UART0 TX` | [crate::Gp0Uart0Tx] |
/// | `I2C0 SDA` | [crate::Gp0I2C0Sda] |
/// | `PWM0 A` | [crate::Gp0Pwm0A] |
/// | `PIO0` | [crate::Gp0Pio0] |
/// | `PIO1` | [crate::Gp0Pio1] |
Gpio0 {
name: gpio0,
aliases: {
/// UART Function alias for pin [crate::Pins::gpio0].
FunctionUart, PullNone: Gp0Uart0Tx,
/// SPI Function alias for pin [crate::Pins::gpio0].
FunctionSpi, PullNone: Gp0Spi0Rx,
/// I2C Function alias for pin [crate::Pins::gpio0].
FunctionI2C, PullUp: Gp0I2C0Sda,
/// PWM Function alias for pin [crate::Pins::gpio0].
FunctionPwm, PullNone: Gp0Pwm0A,
/// PIO0 Function alias for pin [crate::Pins::gpio0].
FunctionPio0, PullNone: Gp0Pio0,
/// PIO1 Function alias for pin [crate::Pins::gpio0].
FunctionPio1, PullNone: Gp0Pio1
}
},
/// GPIO 1 su
gitextract_xdh1uctv/ ├── .cargo/ │ └── config.toml ├── .github/ │ └── workflows/ │ ├── build_and_test.yml │ ├── clippy.yml │ └── rustfmt.yml ├── .gitignore ├── APACHE2.0 ├── CODE_OF_CONDUCT.md ├── Cargo.toml ├── MIT ├── README.md ├── boards/ │ ├── adafruit-feather-rp2040/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ ├── adafruit_feather_blinky.rs │ │ │ └── adafruit_feather_neopixel_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── adafruit-itsy-bitsy-rp2040/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ ├── adafruit_itsy_bitsy_blinky.rs │ │ │ └── adafruit_itsy_bitsy_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── adafruit-kb2040/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ ├── adafruit_kb2040_rainbow.rs │ │ │ └── adafruit_kb2040_usb_serial.rs │ │ └── src/ │ │ └── lib.rs │ ├── adafruit-macropad/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── adafruit-macropad_blinky.rs │ │ └── src/ │ │ └── lib.rs │ ├── adafruit-metro-rp2040/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ ├── adafruit_metro_blinky.rs │ │ │ └── adafruit_metro_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── adafruit-qt-py-rp2040/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── adafruit_qt_py_rp2040_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── adafruit-trinkey-qt2040/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── adafruit_trinkey_qt2040_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── arduino_nano_connect/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── nano_blinky.rs │ │ └── src/ │ │ └── lib.rs │ ├── boardsource-blok/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ ├── blok_rainbow.rs │ │ │ ├── blok_reset_to_usb_boot.rs │ │ │ └── blok_usb_keyboard_input.rs │ │ └── src/ │ │ └── lib.rs │ ├── framework-ledmatrix/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── build.rs │ │ ├── examples/ │ │ │ └── ledtest.rs │ │ └── src/ │ │ └── lib.rs │ ├── framework16-keyboard/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── build.rs │ │ ├── examples/ │ │ │ ├── capslock.rs │ │ │ └── white_backlight.rs │ │ └── src/ │ │ └── lib.rs │ ├── pimoroni-pico-explorer/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── pimoroni_pico_explorer_showcase.rs │ │ └── src/ │ │ └── lib.rs │ ├── pimoroni-pico-lipo-16mb/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── pimoroni_pico_lipo_16mb_blinky.rs │ │ └── src/ │ │ └── lib.rs │ ├── pimoroni-plasma-2040/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── build.rs │ │ ├── examples/ │ │ │ ├── pimoroni_plasma_2040_blinky.rs │ │ │ └── pimoroni_plasma_2040_ws2812_led.rs │ │ └── src/ │ │ └── lib.rs │ ├── pimoroni-servo2040/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── build.rs │ │ ├── examples/ │ │ │ ├── pimoroni_servo2040_pwm_servo.rs │ │ │ └── pimoroni_servo2040_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── pimoroni-tiny2040/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── build.rs │ │ ├── examples/ │ │ │ └── tiny2040_blinky.rs │ │ └── src/ │ │ └── lib.rs │ ├── pimoroni-tufty2040/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── tufty_demo.rs │ │ └── src/ │ │ ├── lib.rs │ │ └── st7789_parallel.pio │ ├── pimoroni_badger2040/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── badger_blinky.rs │ │ └── src/ │ │ └── lib.rs │ ├── rp-pico/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── build.rs │ │ ├── examples/ │ │ │ ├── pico_blinky.rs │ │ │ ├── pico_countdown_blinky.rs │ │ │ ├── pico_gpio_in_out.rs │ │ │ ├── pico_hd44780_display.rs │ │ │ ├── pico_i2c_oled_display_ssd1306.rs │ │ │ ├── pico_i2c_pio.rs │ │ │ ├── pico_interpolator.rs │ │ │ ├── pico_pio_pwm.rs │ │ │ ├── pico_pwm_blink.rs │ │ │ ├── pico_pwm_servo.rs │ │ │ ├── pico_rtic.rs │ │ │ ├── pico_rtic_monotonic.rs │ │ │ ├── pico_spi_sd_card.rs │ │ │ ├── pico_uart_irq_buffer.rs │ │ │ ├── pico_uart_irq_echo.rs │ │ │ ├── pico_usb_serial.rs │ │ │ ├── pico_usb_serial_interrupt.rs │ │ │ ├── pico_usb_twitchy_mouse.rs │ │ │ ├── pico_ws2812_led.rs │ │ │ └── pwm.pio │ │ └── src/ │ │ └── lib.rs │ ├── seeeduino-xiao-rp2040/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ ├── seeeduino_xiao_rp2040_blinky.rs │ │ │ └── seeeduino_xiao_rp2040_neopixel_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── solderparty-rp2040-stamp/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── solderparty_stamp_neopixel_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── sparkfun-micromod-rp2040/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── build.rs │ │ ├── examples/ │ │ │ ├── sparkfun_micromod_battery_voltage.rs │ │ │ └── sparkfun_micromod_blinky.rs │ │ └── src/ │ │ └── lib.rs │ ├── sparkfun-pro-micro-rp2040/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── sparkfun_pro_micro_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── sparkfun-thing-plus-rp2040/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── sparkfun_thing_plus_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── vcc-gnd-yd-rp2040/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ ├── yd_rp2040_blinky.rs │ │ │ └── yd_rp2040_neopixel_rainbow.rs │ │ └── src/ │ │ └── lib.rs │ ├── waveshare-rp2040-lcd-0-96/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── waveshare_rp2040_lcd_demo.rs │ │ └── src/ │ │ └── lib.rs │ ├── waveshare-rp2040-lcd-1-28/ │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── waveshare_rp2040_lcd_demo.rs │ │ └── src/ │ │ └── lib.rs │ └── waveshare-rp2040-zero/ │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── examples/ │ │ └── waveshare_rp2040_zero_neopixel_rainbow.rs │ └── src/ │ └── lib.rs └── memory.x
SYMBOL INDEX (241 symbols across 93 files)
FILE: boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs
function main (line 21) | fn main() -> ! {
FILE: boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs
function main (line 28) | fn main() -> ! {
function wheel (line 80) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/adafruit-feather-rp2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 66) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs
function main (line 42) | fn main() -> ! {
FILE: boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs
function main (line 25) | fn main() -> ! {
function wheel (line 79) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/adafruit-itsy-bitsy-rp2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 69) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs
function main (line 38) | fn main() -> ! {
function wheel (line 93) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/adafruit-kb2040/examples/adafruit_kb2040_usb_serial.rs
function main (line 50) | fn main() -> ! {
FILE: boards/adafruit-kb2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 66) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/adafruit-macropad/examples/adafruit-macropad_blinky.rs
function main (line 24) | fn main() -> ! {
FILE: boards/adafruit-macropad/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 76) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/adafruit-metro-rp2040/examples/adafruit_metro_blinky.rs
function main (line 42) | fn main() -> ! {
FILE: boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs
function main (line 24) | fn main() -> ! {
function wheel (line 75) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/adafruit-metro-rp2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 74) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs
function main (line 25) | fn main() -> ! {
function wheel (line 79) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/adafruit-qt-py-rp2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 68) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs
function main (line 38) | fn main() -> ! {
function wheel (line 93) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/adafruit-trinkey-qt2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 33) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/arduino_nano_connect/examples/nano_blinky.rs
function main (line 40) | fn main() -> ! {
FILE: boards/arduino_nano_connect/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 766) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/boardsource-blok/examples/blok_rainbow.rs
function main (line 31) | fn main() -> ! {
function wheel (line 83) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/boardsource-blok/examples/blok_reset_to_usb_boot.rs
function main (line 27) | fn main() -> ! {
FILE: boards/boardsource-blok/examples/blok_usb_keyboard_input.rs
function main (line 43) | fn main() -> ! {
function push_report (line 179) | fn push_report(report: KeyboardReport) {
function USBCTRL_IRQ (line 191) | unsafe fn USBCTRL_IRQ() {
FILE: boards/boardsource-blok/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 532) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/framework-ledmatrix/build.rs
function main (line 4) | fn main() {
FILE: boards/framework-ledmatrix/examples/ledtest.rs
constant MAX_BRIGHTNESS (line 38) | const MAX_BRIGHTNESS: u8 = 50;
function main (line 43) | fn main() -> ! {
FILE: boards/framework-ledmatrix/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 54) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/framework16-keyboard/build.rs
function main (line 4) | fn main() {
FILE: boards/framework16-keyboard/examples/capslock.rs
function main (line 41) | fn main() -> ! {
FILE: boards/framework16-keyboard/examples/white_backlight.rs
constant LOW (line 36) | const LOW: u16 = 0;
constant HIGH (line 39) | const HIGH: u16 = 25000;
function main (line 49) | fn main() -> ! {
FILE: boards/framework16-keyboard/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 140) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/pimoroni-pico-explorer/examples/pimoroni_pico_explorer_showcase.rs
function calc_temp (line 19) | fn calc_temp(adc_value: f32, refv: f64) -> f64 {
function main (line 25) | fn main() -> ! {
FILE: boards/pimoroni-pico-explorer/src/lib.rs
type Pins (line 118) | pub struct Pins {
constant XOSC_CRYSTAL_FREQ (line 139) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
type Button (line 140) | pub enum Button {
type Motor (line 147) | pub enum Motor {
type MotorAction (line 152) | pub enum MotorAction {
type Screen (line 158) | pub type Screen = ST7789<
type PicoExplorer (line 167) | pub struct PicoExplorer {
method new (line 189) | pub fn new(
method is_pressed (line 260) | pub fn is_pressed(&self, button: Button) -> bool {
method get_adc (line 270) | pub fn get_adc<Pin: Channel<Adc, ID = u8>>(&mut self, channel: &mut Pi...
type DummyPin (line 176) | pub struct DummyPin;
type Error (line 179) | type Error = ();
method set_high (line 180) | fn set_high(&mut self) -> Result<(), Self::Error> {
method set_low (line 183) | fn set_low(&mut self) -> Result<(), Self::Error> {
FILE: boards/pimoroni-pico-lipo-16mb/examples/pimoroni_pico_lipo_16mb_blinky.rs
function main (line 42) | fn main() -> ! {
FILE: boards/pimoroni-pico-lipo-16mb/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 53) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/pimoroni-plasma-2040/build.rs
function main (line 4) | fn main() {
FILE: boards/pimoroni-plasma-2040/examples/pimoroni_plasma_2040_blinky.rs
function main (line 25) | fn main() -> ! {
FILE: boards/pimoroni-plasma-2040/examples/pimoroni_plasma_2040_ws2812_led.rs
constant STRIP_LEN (line 39) | const STRIP_LEN: usize = 3;
function main (line 46) | fn main() -> ! {
function hsv2rgb (line 154) | pub fn hsv2rgb(hue: f32, sat: f32, val: f32) -> (f32, f32, f32) {
function hsv2rgb_u8 (line 176) | pub fn hsv2rgb_u8(h: f32, s: f32, v: f32) -> (u8, u8, u8) {
FILE: boards/pimoroni-plasma-2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 69) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
constant ADC_GAIN (line 71) | pub const ADC_GAIN: u32 = 50;
constant SHUNT_RESISTOR (line 72) | pub const SHUNT_RESISTOR: f32 = 0.015;
FILE: boards/pimoroni-servo2040/build.rs
function main (line 4) | fn main() {
FILE: boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs
constant PERIOD_US (line 26) | const PERIOD_US: u32 = 20_000;
constant TOP (line 28) | const TOP: u16 = u16::MAX;
function main (line 31) | fn main() -> ! {
function us_to_duty (line 124) | fn us_to_duty(us: u16) -> u16 {
FILE: boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs
function main (line 23) | fn main() -> ! {
function wheel (line 89) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/pimoroni-servo2040/src/lib.rs
constant NUM_SERVOS (line 18) | pub const NUM_SERVOS: u8 = 18;
constant NUM_SENSORS (line 19) | pub const NUM_SENSORS: u8 = 6;
constant NUM_LEDS (line 20) | pub const NUM_LEDS: u8 = 6;
constant SENSOR_1_ADDR (line 22) | pub const SENSOR_1_ADDR: u8 = 0b_0000;
constant SENSOR_2_ADDR (line 23) | pub const SENSOR_2_ADDR: u8 = 0b_0001;
constant SENSOR_3_ADDR (line 24) | pub const SENSOR_3_ADDR: u8 = 0b_0010;
constant SENSOR_4_ADDR (line 25) | pub const SENSOR_4_ADDR: u8 = 0b_0011;
constant SENSOR_5_ADDR (line 26) | pub const SENSOR_5_ADDR: u8 = 0b_0100;
constant SENSOR_6_ADDR (line 27) | pub const SENSOR_6_ADDR: u8 = 0b_0101;
constant VOLTAGE_SENSE_ADDR (line 28) | pub const VOLTAGE_SENSE_ADDR: u8 = 0b_0110;
constant CURRENT_SENSE_ADDR (line 29) | pub const CURRENT_SENSE_ADDR: u8 = 0b_0111;
constant VOLTAGE_GAIN (line 31) | pub const VOLTAGE_GAIN: f32 = 0.28058;
constant SHUNT_RESISTOR (line 32) | pub const SHUNT_RESISTOR: f32 = 0.003;
constant CURRENT_GAIN (line 33) | pub const CURRENT_GAIN: u8 = 69;
constant CURRENT_OFFSET (line 34) | pub const CURRENT_OFFSET: f32 = -0.02;
constant XOSC_CRYSTAL_FREQ (line 603) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/pimoroni-tiny2040/build.rs
function main (line 4) | fn main() {
FILE: boards/pimoroni-tiny2040/examples/tiny2040_blinky.rs
function main (line 21) | fn main() -> ! {
FILE: boards/pimoroni-tiny2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 378) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/pimoroni-tufty2040/examples/tufty_demo.rs
function main (line 46) | fn main() -> ! {
FILE: boards/pimoroni-tufty2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 85) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
function set_pin_bit (line 88) | fn set_pin_bit<P: OutputPin>(pin: &mut P, bit: u8, value: u8) -> Result<...
type WriteBytes (line 93) | struct WriteBytes<T>(T);
type TransmittedWord (line 99) | type TransmittedWord = u8;
method tx_treq (line 102) | fn tx_treq() -> Option<u8> {
method tx_address_count (line 107) | fn tx_address_count(&mut self) -> (u32, u32) {
method tx_increment (line 112) | fn tx_increment(&self) -> bool {
type DisplayDataLines (line 117) | pub trait DisplayDataLines {
method flush (line 118) | fn flush(&mut self) {}
method write_u8 (line 120) | fn write_u8(&mut self, value: u8) -> Result<(), DisplayError>;
method write_slice (line 122) | fn write_slice(&mut self, data: &[u8]) -> Result<(), DisplayError> {
method write_format (line 130) | fn write_format(&mut self, data: DataFormat<'_>) -> Result<(), Display...
method write_u8 (line 225) | fn write_u8(&mut self, value: u8) -> Result<(), DisplayError> {
method flush (line 285) | fn flush(&mut self) {
method write_u8 (line 291) | fn write_u8(&mut self, value: u8) -> Result<(), DisplayError> {
method write_slice (line 300) | fn write_slice(&mut self, data: &[u8]) -> Result<(), DisplayError> {
type GpioDataLines (line 175) | pub struct GpioDataLines<WR, D0, D1, D2, D3, D4, D5, D6, D7> {
function write_u8_inner (line 200) | fn write_u8_inner(&mut self, value: u8) -> Result<(), DisplayError> {
type PioTx (line 233) | type PioTx<P, SM, CH> = (Tx<(P, SM)>, Channel<CH>);
type PioDataLines (line 235) | pub struct PioDataLines<P: PIOExt, SM: StateMachineIndex, CH: ChannelInd...
function new (line 240) | pub fn new(
type ParallelDisplayInterface (line 312) | pub struct ParallelDisplayInterface<CS, DC, D> {
function new (line 319) | pub fn new(cs: CS, dc: DC, data_lines: D) -> ParallelDisplayInterface<CS...
method send_commands (line 327) | fn send_commands(&mut self, cmds: DataFormat<'_>) -> Result<(), DisplayE...
method send_data (line 337) | fn send_data(&mut self, buf: DataFormat<'_>) -> Result<(), DisplayError> {
type DummyPin (line 347) | pub struct DummyPin;
type Error (line 350) | type Error = ();
method set_high (line 352) | fn set_high(&mut self) -> Result<(), Self::Error> {
method set_low (line 356) | fn set_low(&mut self) -> Result<(), Self::Error> {
FILE: boards/pimoroni_badger2040/examples/badger_blinky.rs
function main (line 33) | fn main() -> ! {
FILE: boards/pimoroni_badger2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 96) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/rp-pico/build.rs
function main (line 4) | fn main() {
FILE: boards/rp-pico/examples/pico_blinky.rs
function main (line 42) | fn main() -> ! {
FILE: boards/rp-pico/examples/pico_countdown_blinky.rs
function main (line 37) | fn main() -> ! {
FILE: boards/rp-pico/examples/pico_gpio_in_out.rs
function main (line 41) | fn main() -> ! {
FILE: boards/rp-pico/examples/pico_hd44780_display.rs
function main (line 59) | fn main() -> ! {
FILE: boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs
function main (line 90) | fn main() -> ! {
type FmtBuf (line 189) | struct FmtBuf {
method new (line 195) | fn new() -> Self {
method reset (line 202) | fn reset(&mut self) {
method as_str (line 206) | fn as_str(&self) -> &str {
method write_str (line 212) | fn write_str(&mut self, s: &str) -> core::fmt::Result {
FILE: boards/rp-pico/examples/pico_i2c_pio.rs
function print_temperature (line 45) | fn print_temperature(serial: &mut impl FmtWrite, temp: [u8; 2]) {
function main (line 61) | fn main() -> ! {
FILE: boards/rp-pico/examples/pico_interpolator.rs
function main (line 47) | fn main() -> ! {
function multiplication_table (line 134) | fn multiplication_table(interp: &mut Interp0) -> bool {
function moving_mask (line 159) | fn moving_mask(interp: &mut Interp0) -> bool {
function cross_lanes (line 212) | fn cross_lanes(interp: &mut Interp0) -> bool {
function simple_blend1 (line 255) | fn simple_blend1(interp: &mut Interp0) -> bool {
function simple_blend2 (line 282) | fn simple_blend2(interp: &mut Interp0) -> bool {
function clamp (line 323) | fn clamp(interp: &mut Interp1) -> bool {
function texture_mapping (line 360) | fn texture_mapping(interp: &mut Interp0) -> bool {
FILE: boards/rp-pico/examples/pico_pio_pwm.rs
function pio_pwm_set_period (line 45) | fn pio_pwm_set_period<T: ValidStateMachine>(
function pio_pwm_set_level (line 78) | fn pio_pwm_set_level<T: ValidStateMachine>(tx: &mut Tx<T>, level: u32) {
function main (line 91) | fn main() -> ! {
FILE: boards/rp-pico/examples/pico_pwm_blink.rs
constant LOW (line 35) | const LOW: u16 = 0;
constant HIGH (line 38) | const HIGH: u16 = 25000;
function main (line 48) | fn main() -> ! {
FILE: boards/rp-pico/examples/pico_pwm_servo.rs
function main (line 40) | fn main() -> ! {
FILE: boards/rp-pico/examples/pico_rtic.rs
constant SCAN_TIME_US (line 16) | const SCAN_TIME_US: MicrosDurationU32 = MicrosDurationU32::secs(1);
type Shared (line 19) | struct Shared {
type Local (line 30) | struct Local {}
function init (line 33) | fn init(c: init::Context) -> (Shared, Local, init::Monotonics) {
function timer_irq (line 77) | fn timer_irq(mut c: timer_irq::Context) {
FILE: boards/rp-pico/examples/pico_rtic_monotonic.rs
type Shared (line 23) | struct Shared {
type MyMono (line 32) | type MyMono = Monotonic<Alarm0>;
type Local (line 35) | struct Local {}
function init (line 38) | fn init(c: init::Context) -> (Shared, Local, init::Monotonics) {
function blink_led (line 83) | fn blink_led(mut c: blink_led::Context) {
FILE: boards/rp-pico/examples/pico_spi_sd_card.rs
type DummyTimesource (line 106) | pub struct DummyTimesource();
method get_timestamp (line 111) | fn get_timestamp(&self) -> Timestamp {
constant BLINK_OK_LONG (line 124) | const BLINK_OK_LONG: [u8; 1] = [8u8];
constant BLINK_OK_SHORT_LONG (line 125) | const BLINK_OK_SHORT_LONG: [u8; 4] = [1u8, 0u8, 6u8, 0u8];
constant BLINK_OK_SHORT_SHORT_LONG (line 126) | const BLINK_OK_SHORT_SHORT_LONG: [u8; 6] = [1u8, 0u8, 1u8, 0u8, 6u8, 0u8];
constant BLINK_ERR_3_SHORT (line 127) | const BLINK_ERR_3_SHORT: [u8; 6] = [1u8, 0u8, 1u8, 0u8, 1u8, 0u8];
constant BLINK_ERR_4_SHORT (line 128) | const BLINK_ERR_4_SHORT: [u8; 8] = [1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0...
constant BLINK_ERR_5_SHORT (line 129) | const BLINK_ERR_5_SHORT: [u8; 10] = [1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, ...
constant BLINK_ERR_6_SHORT (line 130) | const BLINK_ERR_6_SHORT: [u8; 12] = [1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, ...
function blink_signals (line 132) | fn blink_signals(
function blink_signals_loop (line 156) | fn blink_signals_loop(
function main (line 168) | fn main() -> ! {
FILE: boards/rp-pico/examples/pico_uart_irq_buffer.rs
type UartPins (line 64) | type UartPins = (
type Uart (line 70) | type Uart = hal::uart::UartPeripheral<hal::uart::Enabled, pac::UART0, Ua...
type UartQueue (line 73) | struct UartQueue {
method read_byte (line 183) | fn read_byte(&self) -> Option<u8> {
method peek_byte (line 192) | fn peek_byte(&self) -> Option<u8> {
method write_bytes_blocking (line 201) | fn write_bytes_blocking(&self, data: &[u8]) {
function main (line 96) | fn main() -> ! {
function write_str (line 246) | fn write_str(&mut self, data: &str) -> core::fmt::Result {
function UART0_IRQ (line 253) | fn UART0_IRQ() {
FILE: boards/rp-pico/examples/pico_uart_irq_echo.rs
type UartPins (line 58) | type UartPins = (
type Uart (line 64) | type Uart = hal::uart::UartPeripheral<hal::uart::Enabled, pac::UART0, Ua...
function main (line 77) | fn main() -> ! {
function UART0_IRQ (line 165) | fn UART0_IRQ() {
FILE: boards/rp-pico/examples/pico_usb_serial.rs
function main (line 48) | fn main() -> ! {
FILE: boards/rp-pico/examples/pico_usb_serial_interrupt.rs
function main (line 63) | fn main() -> ! {
function USBCTRL_IRQ (line 166) | unsafe fn USBCTRL_IRQ() {
FILE: boards/rp-pico/examples/pico_usb_twitchy_mouse.rs
function main (line 64) | fn main() -> ! {
function push_mouse_movement (line 172) | fn push_mouse_movement(report: MouseReport) -> Result<usize, usb_device:...
function USBCTRL_IRQ (line 185) | unsafe fn USBCTRL_IRQ() {
FILE: boards/rp-pico/examples/pico_ws2812_led.rs
constant STRIP_LEN (line 76) | const STRIP_LEN: usize = 3;
function main (line 79) | fn main() -> ! {
function hsv2rgb (line 189) | pub fn hsv2rgb(hue: f32, sat: f32, val: f32) -> (f32, f32, f32) {
function hsv2rgb_u8 (line 211) | pub fn hsv2rgb_u8(h: f32, s: f32, v: f32) -> (u8, u8, u8) {
FILE: boards/rp-pico/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 820) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/seeeduino-xiao-rp2040/examples/seeeduino_xiao_rp2040_blinky.rs
constant LOW (line 38) | const LOW: u16 = 0;
constant HIGH (line 41) | const HIGH: u16 = 60000;
function main (line 51) | fn main() -> ! {
FILE: boards/seeeduino-xiao-rp2040/examples/seeeduino_xiao_rp2040_neopixel_rainbow.rs
function main (line 38) | fn main() -> ! {
function wheel (line 94) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/seeeduino-xiao-rp2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 69) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs
function main (line 28) | fn main() -> ! {
function wheel (line 80) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/solderparty-rp2040-stamp/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 53) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/sparkfun-micromod-rp2040/build.rs
function main (line 4) | fn main() {
FILE: boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_battery_voltage.rs
function panic (line 25) | fn panic() -> ! {
function main (line 50) | fn main() -> ! {
FILE: boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_blinky.rs
function main (line 42) | fn main() -> ! {
FILE: boards/sparkfun-micromod-rp2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 371) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
type BattVin (line 374) | pub type BattVin = hal::adc::AdcPin<hal::gpio::Pin<Gpio29, FunctionSioIn...
type BatteryVoltage (line 376) | pub struct BatteryVoltage {
method new (line 382) | pub fn new(pin: BattVin) -> Self {
method read (line 391) | pub fn read(&mut self, adc: &mut hal::Adc) -> u16 {
FILE: boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs
function main (line 38) | fn main() -> ! {
function wheel (line 92) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/sparkfun-pro-micro-rp2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 43) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs
function main (line 37) | fn main() -> ! {
function wheel (line 91) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/sparkfun-thing-plus-rp2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 40) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_blinky.rs
function main (line 21) | fn main() -> ! {
FILE: boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs
function main (line 28) | fn main() -> ! {
function wheel (line 80) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/vcc-gnd-yd-rp2040/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 784) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/waveshare-rp2040-lcd-0-96/examples/waveshare_rp2040_lcd_demo.rs
constant LCD_WIDTH (line 34) | const LCD_WIDTH: u32 = 160;
constant LCD_HEIGHT (line 35) | const LCD_HEIGHT: u32 = 80;
function main (line 38) | fn main() -> ! {
FILE: boards/waveshare-rp2040-lcd-0-96/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 785) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/waveshare-rp2040-lcd-1-28/examples/waveshare_rp2040_lcd_demo.rs
constant LCD_WIDTH (line 33) | const LCD_WIDTH: u32 = 240;
constant LCD_HEIGHT (line 34) | const LCD_HEIGHT: u32 = 240;
function main (line 39) | fn main() -> ! {
FILE: boards/waveshare-rp2040-lcd-1-28/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 785) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
FILE: boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs
function main (line 35) | fn main() -> ! {
function wheel (line 87) | fn wheel(mut wheel_pos: u8) -> RGB8 {
FILE: boards/waveshare-rp2040-zero/src/lib.rs
constant XOSC_CRYSTAL_FREQ (line 785) | pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
Condensed preview — 201 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (820K chars).
[
{
"path": ".cargo/config.toml",
"chars": 1418,
"preview": "#\n# Cargo Configuration for the https://github.com/rp-rs/rp-hal.git repository.\n#\n# Copyright (c) The RP-RS Developers, "
},
{
"path": ".github/workflows/build_and_test.yml",
"chars": 1612,
"preview": "on: [push, pull_request]\nname: Build and Test check\njobs:\n builds:\n name: Build checks\n runs-on: ubuntu-24.04\n "
},
{
"path": ".github/workflows/clippy.yml",
"chars": 401,
"preview": "on: [push, pull_request]\nname: Clippy check\njobs:\n clippy_check:\n runs-on: ubuntu-24.04\n env:\n RUSTFLAGS: \"-"
},
{
"path": ".github/workflows/rustfmt.yml",
"chars": 354,
"preview": "on: [push, pull_request]\nname: Code formatting check\njobs:\n fmt:\n name: Rustfmt\n runs-on: ubuntu-24.04\n env:\n "
},
{
"path": ".gitignore",
"chars": 46,
"preview": ".idea/\ntarget\nCargo.lock\n.vscode\n*.orig\n*.raw\n"
},
{
"path": "APACHE2.0",
"chars": 11315,
"preview": "Apache License\n Version 2.0, January 2004\n http://www.apache.org/licens"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 4526,
"preview": "# The Rust Code of Conduct\n\n## Conduct\n\n**Contact**: [rp-rs team][team]\n\n* We are committed to providing a friendly, saf"
},
{
"path": "Cargo.toml",
"chars": 1895,
"preview": "[workspace]\nresolver = \"2\"\nmembers = [\n \"boards/adafruit-feather-rp2040\",\n \"boards/adafruit-itsy-bitsy-rp2040\",\n "
},
{
"path": "MIT",
"chars": 1075,
"preview": "MIT License\n\nCopyright (c) 2021 rp-rs organization\n\nPermission is hereby granted, free of charge, to any person obtainin"
},
{
"path": "README.md",
"chars": 23646,
"preview": "<!-- PROJECT LOGO -->\n<br />\n<p align=\"center\">\n <a href=\"https://github.com/rp-rs/rp-hal-boards\">\n <img src=\"https:"
},
{
"path": "boards/adafruit-feather-rp2040/CHANGELOG.md",
"chars": 962,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/adafruit-feather-rp2040/Cargo.toml",
"chars": 1875,
"preview": "[package]\nname = \"adafruit-feather-rp2040\"\nversion = \"0.8.0\"\nauthors = [\"Andrea Nall <anall@andreanal.com>\", \"The rp-rs "
},
{
"path": "boards/adafruit-feather-rp2040/README.md",
"chars": 3783,
"preview": "# [adafruit-feather-rp2040] - Board Support for the [Adafruit Feather RP2040]\n\nYou should include this crate if you are "
},
{
"path": "boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs",
"chars": 1274,
"preview": "//! 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 "
},
{
"path": "boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs",
"chars": 2607,
"preview": "//! Rainbow effect color wheel using the onboard NeoPixel on an Adafruit Feather RP2040 board\n//!\n//! This flows smoothl"
},
{
"path": "boards/adafruit-feather-rp2040/src/lib.rs",
"chars": 1525,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/adafruit-itsy-bitsy-rp2040/CHANGELOG.md",
"chars": 962,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/adafruit-itsy-bitsy-rp2040/Cargo.toml",
"chars": 1906,
"preview": "[package]\nname = \"adafruit-itsy-bitsy-rp2040\"\nversion = \"0.8.0\"\nauthors = [\"Andrew Christiansen <andrewtaylorchristianse"
},
{
"path": "boards/adafruit-itsy-bitsy-rp2040/README.md",
"chars": 3782,
"preview": "# [adafruit-itsy-bitsy-rp2040] - Board Support for the [Adafruit ItsyBitsy RP2040]\n\nYou should include this crate if you"
},
{
"path": "boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs",
"chars": 2159,
"preview": "//! # GPIO 'Blinky' Example\n//!\n//! Blinks the LED on a Adafruit itsy-bitsy RP2040 board\n//!\n//! It may need to be adapt"
},
{
"path": "boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs",
"chars": 2388,
"preview": "//! Continuously changes the color of the Neopixel on a Adafruit ItsyBitsy RP2040 board\n#![no_std]\n#![no_main]\n\nuse adaf"
},
{
"path": "boards/adafruit-itsy-bitsy-rp2040/src/lib.rs",
"chars": 1612,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/adafruit-kb2040/CHANGELOG.md",
"chars": 962,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/adafruit-kb2040/Cargo.toml",
"chars": 1967,
"preview": "[package]\nname = \"adafruit-kb2040\"\nversion = \"0.8.0\"\nauthors = [\"Andrew Christiansen <andrewtaylorchristiansen@gmail.com"
},
{
"path": "boards/adafruit-kb2040/README.md",
"chars": 3545,
"preview": "# [adafruit-kb2040] - Board Support for the [Adafruit KB2040]\n\nYou should include this crate if you are writing code tha"
},
{
"path": "boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs",
"chars": 2809,
"preview": "//! # Rainbow Example for the Adafruit KB2040\n//!\n//! Runs a rainbow-effect colour wheel on the on-board LED.\n//!\n//! Us"
},
{
"path": "boards/adafruit-kb2040/examples/adafruit_kb2040_usb_serial.rs",
"chars": 4948,
"preview": "//! # Pico USB Serial Example\n//!\n//! Creates a USB Serial device on a Pico board, with the USB driver running in\n//! th"
},
{
"path": "boards/adafruit-kb2040/src/lib.rs",
"chars": 1512,
"preview": "#![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 "
},
{
"path": "boards/adafruit-macropad/CHANGELOG.md",
"chars": 883,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/adafruit-macropad/Cargo.toml",
"chars": 1758,
"preview": "[package]\nname = \"adafruit-macropad\"\nversion = \"0.8.0\"\nauthors = [\"Andrea Nall <anall@andreanal.com>\", \"The rp-rs Develo"
},
{
"path": "boards/adafruit-macropad/README.md",
"chars": 3438,
"preview": "# [adafruit-macropad] - Board Support for the [Adafruit Macropad]\n\nYou should include this crate if you are writing code"
},
{
"path": "boards/adafruit-macropad/examples/adafruit-macropad_blinky.rs",
"chars": 1451,
"preview": "//! Blinks the LED on a Adafruit MacroPad board\n//!\n//! This will blink on-board LED.\n#![no_std]\n#![no_main]\n\nuse adafru"
},
{
"path": "boards/adafruit-macropad/src/lib.rs",
"chars": 1921,
"preview": "#![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 "
},
{
"path": "boards/adafruit-metro-rp2040/CHANGELOG.md",
"chars": 309,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/adafruit-metro-rp2040/Cargo.toml",
"chars": 1869,
"preview": "[package]\nname = \"adafruit-metro-rp2040\"\nversion = \"0.1.0\"\nauthors = [\"Thad House <thadhouse1@gmail.com>\", \"The rp-rs De"
},
{
"path": "boards/adafruit-metro-rp2040/README.md",
"chars": 3708,
"preview": "# [adafruit-metro-rp2040] - Board Support for the [Adafruit Metro RP2040]\n\nYou should include this crate if you are writ"
},
{
"path": "boards/adafruit-metro-rp2040/examples/adafruit_metro_blinky.rs",
"chars": 2144,
"preview": "//! # GPIO 'Blinky' Example\n//!\n//! Blinks the LED on a Adafruit Metro RP2040 board\n//!\n//! It may need to be adapted to"
},
{
"path": "boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs",
"chars": 2268,
"preview": "//! Continuously changes the color of the Neopixel on a Adafruit Metro RP2040 board\n#![no_std]\n#![no_main]\n\nuse adafruit"
},
{
"path": "boards/adafruit-metro-rp2040/src/lib.rs",
"chars": 1748,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/adafruit-qt-py-rp2040/CHANGELOG.md",
"chars": 991,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/adafruit-qt-py-rp2040/Cargo.toml",
"chars": 1858,
"preview": "[package]\nname = \"adafruit-qt-py-rp2040\"\nversion = \"0.8.0\"\nauthors = [\"Stephen Onnen <stephen.onnen@gmail.com>\", \"The rp"
},
{
"path": "boards/adafruit-qt-py-rp2040/README.md",
"chars": 3631,
"preview": "# [adafruit-qt-py-rp2040] - Board Support for the [Adafruit QT Py RP2040]\n\nYou should include this crate if you are writ"
},
{
"path": "boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs",
"chars": 2374,
"preview": "//! Continuously changes the color of the Neopixel on a Adafruit QT Py RP2040 board\n#![no_std]\n#![no_main]\n\nuse adafruit"
},
{
"path": "boards/adafruit-qt-py-rp2040/src/lib.rs",
"chars": 1529,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/adafruit-trinkey-qt2040/CHANGELOG.md",
"chars": 788,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/adafruit-trinkey-qt2040/Cargo.toml",
"chars": 1821,
"preview": "[package]\nname = \"adafruit-trinkey-qt2040\"\nversion = \"0.7.0\"\nauthors = [\"The rp-rs Developers\"]\nedition = \"2018\"\nhomepag"
},
{
"path": "boards/adafruit-trinkey-qt2040/README.md",
"chars": 3565,
"preview": "# [adafruit-trinkey-qt2040] - Board Support for the [Adafruit Trinkey QT2040]\n\nYou should include this crate if you are "
},
{
"path": "boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs",
"chars": 2841,
"preview": "//! # Rainbow Example for the Adafruit Trinkey QT2040\n//!\n//! Runs a rainbow-effect colour wheel on the on-board LED.\n//"
},
{
"path": "boards/adafruit-trinkey-qt2040/src/lib.rs",
"chars": 757,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/arduino_nano_connect/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/arduino_nano_connect/CHANGELOG.md",
"chars": 745,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/arduino_nano_connect/Cargo.toml",
"chars": 1864,
"preview": "[package]\nname = \"arduino_nano_connect\"\nversion = \"0.7.0\"\nauthors = [\"splicedbread <dxbunrated@gmail.com>\", \"The rp-rs D"
},
{
"path": "boards/arduino_nano_connect/README.md",
"chars": 3733,
"preview": "# [arduino_nano_connect] - Board Support for the [Arduino Nano RP2040 Connect]\n\nYou should include this crate if you are"
},
{
"path": "boards/arduino_nano_connect/examples/nano_blinky.rs",
"chars": 2514,
"preview": "//! # Nano Blinky Example\n//!\n//! Blinks the LED on a Arduino Nano Connect board.\n//!\n//! This will blink an LED attache"
},
{
"path": "boards/arduino_nano_connect/src/lib.rs",
"chars": 33803,
"preview": "#![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 "
},
{
"path": "boards/boardsource-blok/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/boardsource-blok/CHANGELOG.md",
"chars": 554,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/boardsource-blok/Cargo.toml",
"chars": 1949,
"preview": "[package]\nname = \"boardsource-blok\"\nversion = \"0.3.0\"\nedition = \"2021\"\nauthors = [\"Agent59 <agent59@ripakewitz.net>\", \"T"
},
{
"path": "boards/boardsource-blok/README.md",
"chars": 5171,
"preview": "# [boardsource-blok] - Board Support for the [Blok]\n\nYou should include this crate if you are writing code that you want"
},
{
"path": "boards/boardsource-blok/examples/blok_rainbow.rs",
"chars": 2571,
"preview": "//! # Rainbow Example for the Blok\n//!\n//! Runs a rainbow-effect colour wheel on the on-board neopixel.\n//! Uses the `ws"
},
{
"path": "boards/boardsource-blok/examples/blok_reset_to_usb_boot.rs",
"chars": 1501,
"preview": "//! # Reset To Usb Boot Example for the Blok\n//!\n//! Resets the Blok after 10 seconds to usb boot mode.\n//!\n//! Afterwar"
},
{
"path": "boards/boardsource-blok/examples/blok_usb_keyboard_input.rs",
"chars": 5384,
"preview": "//! # Keyboard Input Example for the Blok\n//!\n//! Creates a USB HID Class Keyboard device on a Blok,\n//! with the USB dr"
},
{
"path": "boards/boardsource-blok/src/lib.rs",
"chars": 22938,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/framework-ledmatrix/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/framework-ledmatrix/CHANGELOG.md",
"chars": 348,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/framework-ledmatrix/Cargo.toml",
"chars": 2093,
"preview": "[package]\nname = \"framework-ledmatrix\"\nversion = \"0.1.0\"\nauthors = [\"Daniel Schaefer <dhs@frame.work>\", \"The rp-rs Devel"
},
{
"path": "boards/framework-ledmatrix/README.md",
"chars": 4944,
"preview": "# [framework-ledmatrix] - Board Support for the [Framework LED Matrix]\n\nYou should include this crate if you are writing"
},
{
"path": "boards/framework-ledmatrix/build.rs",
"chars": 162,
"preview": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n println!(\"car"
},
{
"path": "boards/framework-ledmatrix/examples/ledtest.rs",
"chars": 4367,
"preview": "//! # Framework LED Matrix Module LED Test Example\n//!\n//! Lights up every single LED one after another.\n//!\n//! See the"
},
{
"path": "boards/framework-ledmatrix/src/lib.rs",
"chars": 1659,
"preview": "#![no_std]\n\n//! A Hardware Abstraction Layer for the Framework LED Matrix\n//!\n//! This crate serves as a HAL (Hardware A"
},
{
"path": "boards/framework16-keyboard/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/framework16-keyboard/CHANGELOG.md",
"chars": 350,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/framework16-keyboard/Cargo.toml",
"chars": 1966,
"preview": "[package]\nname = \"framework16-keyboard\"\nversion = \"0.1.0\"\nauthors = [\"Daniel Schaefer <dhs@frame.work>\", \"The rp-rs Deve"
},
{
"path": "boards/framework16-keyboard/README.md",
"chars": 5067,
"preview": "# [framework16-keyboard] - Board Support for the [Framework 16 Keyboard]\n\nYou should include this crate if you are writi"
},
{
"path": "boards/framework16-keyboard/build.rs",
"chars": 162,
"preview": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n println!(\"car"
},
{
"path": "boards/framework16-keyboard/examples/capslock.rs",
"chars": 2785,
"preview": "//! # Framework 16 Keyboard Capslock Example\n//!\n//! Blink the capslock LED on Framework 16 keyboards\n//!\n//! Note: This"
},
{
"path": "boards/framework16-keyboard/examples/white_backlight.rs",
"chars": 3499,
"preview": "//! # Framework 16 Keyboard/Numpad Backlight Example\n//!\n//! Blink the white backlight on Framework 16 keyboards or nump"
},
{
"path": "boards/framework16-keyboard/src/lib.rs",
"chars": 4075,
"preview": "#![no_std]\n\n//! A Hardware Abstraction Layer for the Framework 16 Keyboards\n//!\n//! This crate serves as a HAL (Hardware"
},
{
"path": "boards/pimoroni-pico-explorer/CHANGELOG.md",
"chars": 846,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/pimoroni-pico-explorer/Cargo.toml",
"chars": 2019,
"preview": "[package]\nname = \"pimoroni-pico-explorer\"\nversion = \"0.8.0\"\nauthors = [\"Hmvp <hmvp@users.noreply.github.com>\", \"The rp-r"
},
{
"path": "boards/pimoroni-pico-explorer/README.md",
"chars": 3709,
"preview": "# [pimoroni-pico-explorer] - Board Support for the [Pimoroni Pico Explorer]\n\nYou should include this crate if you are wr"
},
{
"path": "boards/pimoroni-pico-explorer/examples/pimoroni_pico_explorer_showcase.rs",
"chars": 2871,
"preview": "#![no_std]\n#![no_main]\n\nuse arrayvec::ArrayString;\nuse core::fmt::Write;\nuse embedded_graphics::{\n mono_font::{ascii:"
},
{
"path": "boards/pimoroni-pico-explorer/src/lib.rs",
"chars": 8608,
"preview": "#![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\")"
},
{
"path": "boards/pimoroni-pico-lipo-16mb/CHANGELOG.md",
"chars": 846,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/pimoroni-pico-lipo-16mb/Cargo.toml",
"chars": 1799,
"preview": "[package]\nname = \"pimoroni-pico-lipo-16mb\"\nversion = \"0.8.0\"\nauthors = [\"Hmvp <hmvp@users.noreply.github.com>\", \"The rp-"
},
{
"path": "boards/pimoroni-pico-lipo-16mb/README.md",
"chars": 3711,
"preview": "# [pimoroni-pico-lipo-16mb] - Board Support for the [Pimoroni Pico Lipo 16MB]\n\nYou should include this crate if you are "
},
{
"path": "boards/pimoroni-pico-lipo-16mb/examples/pimoroni_pico_lipo_16mb_blinky.rs",
"chars": 2633,
"preview": "//! # Pimoroni Pico Lipo Blinky Example\n//!\n//! Blinks the LED on a Pimoroni Pico Lipo 16MB board.\n//!\n//! This will bli"
},
{
"path": "boards/pimoroni-pico-lipo-16mb/src/lib.rs",
"chars": 1375,
"preview": "#![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 "
},
{
"path": "boards/pimoroni-plasma-2040/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/pimoroni-plasma-2040/CHANGELOG.md",
"chars": 825,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/pimoroni-plasma-2040/Cargo.toml",
"chars": 1970,
"preview": "[package]\nname = \"pimoroni-plasma-2040\"\nversion = \"0.7.0\"\nauthors = [\"Jordan Williams <jordan@jwillikers.com>\", \"The rp-"
},
{
"path": "boards/pimoroni-plasma-2040/README.md",
"chars": 3906,
"preview": "# [pimoroni-plasma-2040] - Board Support for the [Pimoroni Plasma 2040]\n\nYou should include this crate if you are writin"
},
{
"path": "boards/pimoroni-plasma-2040/build.rs",
"chars": 162,
"preview": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n println!(\"car"
},
{
"path": "boards/pimoroni-plasma-2040/examples/pimoroni_plasma_2040_blinky.rs",
"chars": 1904,
"preview": "//! Blinks the 3 colour LEDs on a Pimoroni Plasma 2040 in sequence\n#![no_std]\n#![no_main]\n\nuse defmt::*;\nuse defmt_rtt a"
},
{
"path": "boards/pimoroni-plasma-2040/examples/pimoroni_plasma_2040_ws2812_led.rs",
"chars": 5687,
"preview": "//! # Pimoroni Plasma 2040 WS2812 RGB LED Example\n//!\n//! Drives 3 WS2812 LEDs connected directly to the Pimoroni Plasma"
},
{
"path": "boards/pimoroni-plasma-2040/src/lib.rs",
"chars": 2146,
"preview": "#![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 "
},
{
"path": "boards/pimoroni-servo2040/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/pimoroni-servo2040/CHANGELOG.md",
"chars": 686,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/pimoroni-servo2040/Cargo.toml",
"chars": 1958,
"preview": "[package]\nname = \"pimoroni-servo2040\"\nversion = \"0.5.0\"\nauthors = [\"Paul Daniel Faria <nashenas88@gmail.com>\", \"The rp-r"
},
{
"path": "boards/pimoroni-servo2040/README.md",
"chars": 4404,
"preview": "# [pimoroni-servo2040] - Board Support for the [Pimoroni Servo2040]\n\nYou should include this crate if you are writing co"
},
{
"path": "boards/pimoroni-servo2040/build.rs",
"chars": 162,
"preview": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n println!(\"car"
},
{
"path": "boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs",
"chars": 4146,
"preview": "//! # Pimoroni Servo2040 PWM Micro Servo Example\n//!\n//! Moves the micro servo on a Servo2040 board using the PWM periph"
},
{
"path": "boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs",
"chars": 2741,
"preview": "//! 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 "
},
{
"path": "boards/pimoroni-servo2040/src/lib.rs",
"chars": 23918,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/pimoroni-tiny2040/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/pimoroni-tiny2040/CHANGELOG.md",
"chars": 672,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/pimoroni-tiny2040/Cargo.toml",
"chars": 1881,
"preview": "[package]\nname = \"pimoroni-tiny2040\"\nversion = \"0.7.0\"\nauthors = [\"Mike Bell <mdb036@gmail.com>\", \"The rp-rs Developers\""
},
{
"path": "boards/pimoroni-tiny2040/README.md",
"chars": 3597,
"preview": "# [pimoroni-tiny2040] - Board Support for the [Pimoroni Tiny2040]\n\nYou should include this crate if you are writing code"
},
{
"path": "boards/pimoroni-tiny2040/build.rs",
"chars": 162,
"preview": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n println!(\"car"
},
{
"path": "boards/pimoroni-tiny2040/examples/tiny2040_blinky.rs",
"chars": 1675,
"preview": "//! Blinks the 3 colour LEDs on a Tiny2040 in sequence\n#![no_std]\n#![no_main]\n\nuse bsp::entry;\nuse defmt::*;\nuse defmt_r"
},
{
"path": "boards/pimoroni-tiny2040/src/lib.rs",
"chars": 15700,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/pimoroni-tufty2040/CHANGELOG.md",
"chars": 305,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/pimoroni-tufty2040/Cargo.toml",
"chars": 1973,
"preview": "[package]\nname = \"pimoroni-tufty2040\"\nversion = \"0.1.0\"\nauthors = [\"The rp-rs Developers\"]\nedition = \"2018\"\nhomepage = \""
},
{
"path": "boards/pimoroni-tufty2040/README.md",
"chars": 3648,
"preview": "# [pimoroni-tufty2040] - Board Support for the [Pimoroni Tufty2040]\n\nYou should include this crate if you are writing co"
},
{
"path": "boards/pimoroni-tufty2040/examples/tufty_demo.rs",
"chars": 4386,
"preview": "//! # Tufty2040 Demo Example\n//!\n//! Draws a circle on the LCD screen and then blinks the user LED on the Tufty 2040.\n//"
},
{
"path": "boards/pimoroni-tufty2040/src/lib.rs",
"chars": 10274,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\npub use hal::pac;\n\nuse display_interface::{DataFormat, DisplayError, Wr"
},
{
"path": "boards/pimoroni-tufty2040/src/st7789_parallel.pio",
"chars": 69,
"preview": ".program st7789_parallel\n.side_set 1\n\nout pins, 32 side 0\nnop side 1\n"
},
{
"path": "boards/pimoroni_badger2040/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/pimoroni_badger2040/CHANGELOG.md",
"chars": 745,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/pimoroni_badger2040/Cargo.toml",
"chars": 1764,
"preview": "[package]\nname = \"pimoroni_badger2040\"\nversion = \"0.6.0\"\nauthors = [\"9names\", \"The rp-rs Developers\"]\nedition = \"2018\"\nh"
},
{
"path": "boards/pimoroni_badger2040/README.md",
"chars": 3636,
"preview": "# [pimoroni_badger2040] - Board Support for the [Pimoroni Badger2040]\n\nYou should include this crate if you are writing "
},
{
"path": "boards/pimoroni_badger2040/examples/badger_blinky.rs",
"chars": 2242,
"preview": "//! # Badger2040 Blinky Example\n//!\n//! Blinks the activity LED on a badger2040 board, using an RP2040 Timer in Count-do"
},
{
"path": "boards/pimoroni_badger2040/src/lib.rs",
"chars": 2571,
"preview": "#![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/"
},
{
"path": "boards/rp-pico/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/rp-pico/CHANGELOG.md",
"chars": 1705,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/rp-pico/Cargo.toml",
"chars": 2444,
"preview": "[package]\nname = \"rp-pico\"\nversion = \"0.9.0\"\nauthors = [\"evan <evanmolder@gmail.com>\", \"The rp-rs Developers\"]\nedition ="
},
{
"path": "boards/rp-pico/README.md",
"chars": 6376,
"preview": "# [rp-pico] - Board Support for the [Raspberry Pi Pico]\n\nYou should include this crate if you are writing code that you "
},
{
"path": "boards/rp-pico/build.rs",
"chars": 162,
"preview": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n println!(\"car"
},
{
"path": "boards/rp-pico/examples/pico_blinky.rs",
"chars": 2497,
"preview": "//! # Pico Blinky Example\n//!\n//! Blinks the LED on a Pico board.\n//!\n//! This will blink an LED attached to GP25, which"
},
{
"path": "boards/rp-pico/examples/pico_countdown_blinky.rs",
"chars": 2374,
"preview": "//! # Pico Countdown Blinky Example\n//!\n//! Blinks the LED on a Pico board, using an RP2040 Timer in Count-down mode.\n//"
},
{
"path": "boards/rp-pico/examples/pico_gpio_in_out.rs",
"chars": 2148,
"preview": "//! # Pico GPIO In/Out Example\n//!\n//! Toggles the LED based on GPIO input.\n//!\n//! This will control an LED on GP25 bas"
},
{
"path": "boards/rp-pico/examples/pico_hd44780_display.rs",
"chars": 4724,
"preview": "//! # LCD Display Example\n//!\n//! In this example, the RP2040 is configured to drive a small two-line\n//! alphanumeric L"
},
{
"path": "boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs",
"chars": 6808,
"preview": "//! # Raspberry Pi Pico (monochome) 128x64 OLED Display with SSD1306 Driver Example\n//!\n//! This example assumes you got"
},
{
"path": "boards/rp-pico/examples/pico_i2c_pio.rs",
"chars": 4561,
"preview": "//! # Pico I2C PIO Example\n//!\n//! Reads the temperature from an LM75B\n//!\n//! This read over I2C the temerature from an"
},
{
"path": "boards/rp-pico/examples/pico_interpolator.rs",
"chars": 13293,
"preview": "//! # Pico Interpolator Example\n//!\n//! Example demonstrating the usage of the hardware interpolator.\n//!\n//! Runs sever"
},
{
"path": "boards/rp-pico/examples/pico_pio_pwm.rs",
"chars": 5214,
"preview": "//! # Pico PIO PWM Blink Example\n//!\n//! Fades the LED on a Pico board using the PIO peripheral with an pwm program.\n//!"
},
{
"path": "boards/rp-pico/examples/pico_pwm_blink.rs",
"chars": 3152,
"preview": "//! # Pico PWM Blink Example\n//!\n//! Fades the LED on a Pico board using the PWM peripheral.\n//!\n//! This will fade in/o"
},
{
"path": "boards/rp-pico/examples/pico_pwm_servo.rs",
"chars": 3372,
"preview": "//! # Pico PWM Micro Servo Example\n//!\n//! Moves the micro servo on a Pico board using the PWM peripheral.\n//!\n//! This "
},
{
"path": "boards/rp-pico/examples/pico_rtic.rs",
"chars": 2515,
"preview": "#![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 "
},
{
"path": "boards/rp-pico/examples/pico_rtic_monotonic.rs",
"chars": 2447,
"preview": "#![no_std]\n#![no_main]\n\nuse panic_halt as _;\n\n#[rtic::app(device = rp_pico::hal::pac, peripherals = true, dispatchers = "
},
{
"path": "boards/rp-pico/examples/pico_spi_sd_card.rs",
"chars": 11378,
"preview": "//! # Pico SD Card Example\n//!\n//! Reads and writes a file from/to the SD Card that is formatted in FAT32.\n//! This exam"
},
{
"path": "boards/rp-pico/examples/pico_uart_irq_buffer.rs",
"chars": 10446,
"preview": "//! # UART IRQ TX Buffer Example\n//!\n//! This application demonstrates how to use the UART Driver to talk to a\n//! seria"
},
{
"path": "boards/rp-pico/examples/pico_uart_irq_echo.rs",
"chars": 6458,
"preview": "//! # UART IRQ Echo Example\n//!\n//! This application demonstrates how to use the UART Driver to talk to a serial\n//! con"
},
{
"path": "boards/rp-pico/examples/pico_usb_serial.rs",
"chars": 4939,
"preview": "//! # Pico USB Serial Example\n//!\n//! Creates a USB Serial device on a Pico board, with the USB driver running in\n//! th"
},
{
"path": "boards/rp-pico/examples/pico_usb_serial_interrupt.rs",
"chars": 6483,
"preview": "//! # Pico USB Serial (with Interrupts) Example\n//!\n//! Creates a USB Serial device on a Pico board, with the USB driver"
},
{
"path": "boards/rp-pico/examples/pico_usb_twitchy_mouse.rs",
"chars": 5802,
"preview": "//! # Pico USB 'Twitchy' Mouse Example\n//!\n//! Creates a USB HID Class Pointing device (i.e. a virtual mouse) on a Pico\n"
},
{
"path": "boards/rp-pico/examples/pico_ws2812_led.rs",
"chars": 6904,
"preview": "//! # Pico WS2812 RGB LED Example\n//!\n//! Drives 3 WS2812 LEDs connected directly to the Raspberry Pi Pico.\n//! This ass"
},
{
"path": "boards/rp-pico/examples/pwm.pio",
"chars": 1034,
"preview": ";\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"
},
{
"path": "boards/rp-pico/src/lib.rs",
"chars": 34724,
"preview": "#![no_std]\n\n//! A Hardware Abstraction Layer for the Raspberry Pi Pico.\n//!\n//! This crate serves as a HAL (Hardware Abs"
},
{
"path": "boards/seeeduino-xiao-rp2040/CHANGELOG.md",
"chars": 714,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/seeeduino-xiao-rp2040/Cargo.toml",
"chars": 1894,
"preview": "[package]\nname = \"seeeduino-xiao-rp2040\"\nversion = \"0.6.0\"\nauthors = [\"Philip L. McMahon <plm@users.noreply.github.com>\""
},
{
"path": "boards/seeeduino-xiao-rp2040/README.md",
"chars": 3584,
"preview": "# [seeeduino-xiao-rp2040] - Board Support for the [Seeeduino XIAO RP2040]\n\nYou should include this crate if you are writ"
},
{
"path": "boards/seeeduino-xiao-rp2040/examples/seeeduino_xiao_rp2040_blinky.rs",
"chars": 3861,
"preview": "//! # Seeeduino XIAO RP2040 Blinky Example\n//!\n//! Blinks the LED on a Seeeduino XIAO RP2040 16MB board.\n//!\n//! This wi"
},
{
"path": "boards/seeeduino-xiao-rp2040/examples/seeeduino_xiao_rp2040_neopixel_rainbow.rs",
"chars": 3060,
"preview": "//! Rainbow effect color wheel using the onboard NeoPixel on a Seeed XIAO RP2040 board\n//!\n//! This flows smoothly throu"
},
{
"path": "boards/seeeduino-xiao-rp2040/src/lib.rs",
"chars": 1627,
"preview": "#![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 "
},
{
"path": "boards/solderparty-rp2040-stamp/CHANGELOG.md",
"chars": 810,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/solderparty-rp2040-stamp/Cargo.toml",
"chars": 1846,
"preview": "[package]\nname = \"solderparty-rp2040-stamp\"\nversion = \"0.7.0\"\nauthors = [\"The rp-rs Developers\"]\nedition = \"2018\"\nhomepa"
},
{
"path": "boards/solderparty-rp2040-stamp/README.md",
"chars": 3624,
"preview": "# [solderparty-rp2040-stamp] - Board Support for the [Solder Party RP2040 Stamp]\n\nYou should include this crate if you a"
},
{
"path": "boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs",
"chars": 2609,
"preview": "//! Rainbow effect color wheel using the onboard NeoPixel on an Solder Party Stamp RP2040 board\n//!\n//! This flows smoot"
},
{
"path": "boards/solderparty-rp2040-stamp/src/lib.rs",
"chars": 1372,
"preview": "#![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 "
},
{
"path": "boards/sparkfun-micromod-rp2040/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/sparkfun-micromod-rp2040/CHANGELOG.md",
"chars": 466,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/sparkfun-micromod-rp2040/Cargo.toml",
"chars": 2014,
"preview": "[package]\nname = \"sparkfun-micromod-rp2040\"\nversion = \"0.3.0\"\nauthors = [\"Finomnis <finomnis@gmail.com>\", \"The rp-rs Dev"
},
{
"path": "boards/sparkfun-micromod-rp2040/README.md",
"chars": 3819,
"preview": "# [sparkfun-micromod-rp2040] - Board Support for the [SparkFun MicroMod RP2040]\n\nYou should include this crate if you ar"
},
{
"path": "boards/sparkfun-micromod-rp2040/build.rs",
"chars": 162,
"preview": "//! This build script makes sure the linker flag -Tdefmt.x is added\n//! for the examples.\n\nfn main() {\n println!(\"car"
},
{
"path": "boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_battery_voltage.rs",
"chars": 2972,
"preview": "//! # SparkFun MicroMod Battery Voltage Example\n//!\n//! Continuously reads the battery voltage and prints it over defmt-"
},
{
"path": "boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_blinky.rs",
"chars": 2652,
"preview": "//! # SparkFun MicroMod Blinky Example\n//!\n//! Blinks the LED on a SparkFun MicroMod RP2040 board.\n//!\n//! This will bli"
},
{
"path": "boards/sparkfun-micromod-rp2040/src/lib.rs",
"chars": 10684,
"preview": "#![no_std]\n\n//! Board Support Package for the SparkFun MicroMod RP2040.\n//!\n//! This crate serves as a HAL (Hardware Abs"
},
{
"path": "boards/sparkfun-pro-micro-rp2040/CHANGELOG.md",
"chars": 980,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/sparkfun-pro-micro-rp2040/Cargo.toml",
"chars": 1907,
"preview": "[package]\nname = \"sparkfun-pro-micro-rp2040\"\nversion = \"0.8.0\"\nauthors = [\"Wilfried Chauveau <wilfried.chauveau@ithinuel"
},
{
"path": "boards/sparkfun-pro-micro-rp2040/README.md",
"chars": 3705,
"preview": "# [sparkfun-pro-micro-rp2040] - Board Support for the [Sparkfun Pro Micro RP2040]\n\nYou should include this crate if you "
},
{
"path": "boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs",
"chars": 2834,
"preview": "//! # Rainbow Example for the Pro Micro RP2040\n//!\n//! Runs a rainbow-effect colour wheel on the on-board LED.\n//!\n//! U"
},
{
"path": "boards/sparkfun-pro-micro-rp2040/src/lib.rs",
"chars": 1071,
"preview": "#![no_std]\n\npub use rp2040_hal as hal;\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]\npub use h"
},
{
"path": "boards/sparkfun-thing-plus-rp2040/CHANGELOG.md",
"chars": 955,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/sparkfun-thing-plus-rp2040/Cargo.toml",
"chars": 1957,
"preview": "[package]\nname = \"sparkfun-thing-plus-rp2040\"\nversion = \"0.7.0\"\nauthors = [\"Tyler Pottenger <tyler.pottenger@gmail.com>\""
},
{
"path": "boards/sparkfun-thing-plus-rp2040/README.md",
"chars": 3717,
"preview": "# [sparkfun-thing-plus-rp2040] - Board Support for the [Sparkfun Thing Plus RP2040]\n\nYou should include this crate if yo"
},
{
"path": "boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs",
"chars": 2858,
"preview": "//! # Rainbow Example for the Thing Plus RP2040\n//!\n//! Runs a rainbow-effect colour wheel on the on-board LED.\n//!\n//! "
},
{
"path": "boards/sparkfun-thing-plus-rp2040/src/lib.rs",
"chars": 1015,
"preview": "#![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"
},
{
"path": "boards/vcc-gnd-yd-rp2040/.gitignore",
"chars": 326,
"preview": "# Generated by Cargo\n# will have compiled files and executables\ndebug/\ntarget/\n\n# Remove Cargo.lock from gitignore if cr"
},
{
"path": "boards/vcc-gnd-yd-rp2040/CHANGELOG.md",
"chars": 1011,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/vcc-gnd-yd-rp2040/Cargo.toml",
"chars": 1916,
"preview": "[package]\nname = \"vcc-gnd-yd-rp2040\"\nversion = \"0.6.0\"\nauthors = [\"Nicolas <nleguen@gmail.com>\", \"The rp-rs Developers\"]"
},
{
"path": "boards/vcc-gnd-yd-rp2040/README.md",
"chars": 3799,
"preview": "# [vcc-gnd-yd-rp2040] - Board Support for the [VCC-GND Studio YD-RP2040]\n\nYou should include this crate if you are writi"
},
{
"path": "boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_blinky.rs",
"chars": 1263,
"preview": "//! 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"
},
{
"path": "boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs",
"chars": 2595,
"preview": "//! Rainbow effect color wheel using the onboard NeoPixel on a VCC-GND Studio YD-RP2040 board\n//!\n//! This flows smoothl"
},
{
"path": "boards/vcc-gnd-yd-rp2040/src/lib.rs",
"chars": 33912,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/waveshare-rp2040-lcd-0-96/CHANGELOG.md",
"chars": 674,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/waveshare-rp2040-lcd-0-96/Cargo.toml",
"chars": 2005,
"preview": "[package]\nname = \"waveshare-rp2040-lcd-0-96\"\nversion = \"0.8.0\"\nauthors = [\"René van Dorst <opensource@vdorst.com>\", \"And"
},
{
"path": "boards/waveshare-rp2040-lcd-0-96/README.md",
"chars": 3837,
"preview": "# [waveshare-rp2040-lcd-0-96] - Board Support for the [Waveshare RP2040 LCD 0.96]\n\nYou should include this crate if you "
},
{
"path": "boards/waveshare-rp2040-lcd-0-96/examples/waveshare_rp2040_lcd_demo.rs",
"chars": 4611,
"preview": "//! Example of graphics on the LCD of the Waveshare RP2040-LCD-0.96\n//!\n//! Draws a red and green line with a blue recta"
},
{
"path": "boards/waveshare-rp2040-lcd-0-96/src/lib.rs",
"chars": 33112,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/waveshare-rp2040-lcd-1-28/CHANGELOG.md",
"chars": 378,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/waveshare-rp2040-lcd-1-28/Cargo.toml",
"chars": 1984,
"preview": "[package]\nname = \"waveshare-rp2040-lcd-1-28\"\nversion = \"0.8.0\"\nauthors = [\"René van Dorst <opensource@vdorst.com>\", \"And"
},
{
"path": "boards/waveshare-rp2040-lcd-1-28/README.md",
"chars": 3838,
"preview": "# [waveshare-rp2040-lcd-1-28] - Board Support for the [Waveshare RP2040 LCD 1.28]\n\nYou should include this crate if you "
},
{
"path": "boards/waveshare-rp2040-lcd-1-28/examples/waveshare_rp2040_lcd_demo.rs",
"chars": 4612,
"preview": "//! Example of graphics on the LCD of the Waveshare RP2040-LCD-1.28\n//!\n//! Draws a red and green line with a blue recta"
},
{
"path": "boards/waveshare-rp2040-lcd-1-28/src/lib.rs",
"chars": 33112,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
},
{
"path": "boards/waveshare-rp2040-zero/CHANGELOG.md",
"chars": 782,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "boards/waveshare-rp2040-zero/Cargo.toml",
"chars": 1910,
"preview": "[package]\nname = \"waveshare-rp2040-zero\"\nversion = \"0.8.0\"\nauthors = [\"Andrea Nall <anall@andreanal.com>\", \"TilCreator <"
},
{
"path": "boards/waveshare-rp2040-zero/README.md",
"chars": 3677,
"preview": "# [waveshare-rp2040-zero] - Board Support for the [Waveshare RP2040 Zero]\n\nYou should include this crate if you are writ"
},
{
"path": "boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs",
"chars": 2945,
"preview": "//! Rainbow effect color wheel using the onboard NeoPixel on an Waveshare RP2040-Zero board\n//!\n//! This flows smoothly "
},
{
"path": "boards/waveshare-rp2040-zero/src/lib.rs",
"chars": 33112,
"preview": "#![no_std]\n\npub extern crate rp2040_hal as hal;\n\n#[cfg(feature = \"rt\")]\nextern crate cortex_m_rt;\n#[cfg(feature = \"rt\")]"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the rp-rs/rp-hal-boards GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 201 files (762.5 KB), approximately 231.5k tokens, and a symbol index with 241 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.