Merge pull request #245 from rp-rs/clean-up-bsp

Clean up BSPs
This commit is contained in:
Jonathan 'theJPster' Pallant 2021-12-24 11:32:12 +00:00 committed by GitHub
commit 882d91cd27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 441 additions and 490 deletions

View file

@ -2,15 +2,15 @@
resolver = "2" resolver = "2"
members = [ members = [
"rp2040-hal", "rp2040-hal",
"boards/feather_rp2040", "boards/adafruit-feather-rp2040",
"boards/qt_py_rp2040", "boards/adafruit-itsy-bitsy-rp2040",
"boards/itsy_bitsy_rp2040", "boards/adafruit-kb2040",
"boards/kb2040", "boards/adafruit-macropad",
"boards/pico", "boards/adafruit-qt-py-rp2040",
"boards/pico_explorer", "boards/pimoroni-pico-explorer",
"boards/pico_lipo_16mb", "boards/pimoroni-pico-lipo-16mb",
"boards/adafruit_macropad", "boards/rp-pico",
"boards/pro_micro_rp2040", "boards/sparkfun-pro-micro-rp2040",
] ]
[patch.'https://github.com/rp-rs/rp-hal.git'] [patch.'https://github.com/rp-rs/rp-hal.git']

102
README.md
View file

@ -126,18 +126,7 @@ RP2040 chip according to how it is connected up on the Pico.
[Raspberry Pi Pico]: https://www.raspberrypi.org/products/raspberry-pi-pico/ [Raspberry Pi Pico]: https://www.raspberrypi.org/products/raspberry-pi-pico/
[pico]: https://github.com/rp-rs/rp-hal/tree/main/boards/pico [pico]: https://github.com/rp-rs/rp-hal/tree/main/boards/pico
### [adafruit_macropad] - Board Support for the [Adafruit Macropad] ### [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 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/tree/main/boards/adafruit_macropad
[Adafruit Macropad]: https://www.adafruit.com/product/5128
### [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 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. an [Adafruit Feather RP2040] - a Feather form-factor RP2040 board from Adafruit.
@ -146,9 +135,51 @@ 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. 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://www.adafruit.com/product/4884
[feather_rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/feather_rp2040 [adafruit-feather-rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit_feather_rp2040
### [pico_explorer] - Board Support for the [Pimoroni Pico Explorer] ### [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/tree/main/boards/adafruit_itsy_bitsy_rp2040
### [adafruit-kb2040] - Board Support for the [Adafruit adafruit-kb2040]
You should include this crate if you are writing code that you want to run on
an [Adafruit 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 adafruit-kb2040.
[Adafruit adafruit-kb2040]: https://www.adafruit.com/product/5302
[adafruit-kb2040]: https://github.com/rp-rs/rp-hal/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/tree/main/boards/adafruit_macropad
[Adafruit Macropad]: https://www.adafruit.com/product/5128
### [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/tree/main/boards/adafruit_qt_py_rp2040
### [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 You should include this crate if you are writing code that you want to run on
a [Pimoroni Pico Explorer] - a board featuring a small LCD screen, a a [Pimoroni Pico Explorer] - a board featuring a small LCD screen, a
@ -157,10 +188,10 @@ breadboard and some breakout headers.
This crate includes the [rp2040-hal], but also configures each pin of the 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. RP2040 chip according to how it is connected up on the Pico Explorer.
[Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pico-explorer-base [Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pimoroni-pico-explorer-base
[pico_explorer]: https://github.com/rp-rs/rp-hal/tree/main/boards/pico_explorer [pimoroni-pico-explorer]: https://github.com/rp-rs/rp-hal/tree/main/boards/pimoroni_pico_explorer
### [pico_lipo_16mb] - Board Support for the [Pimoroni Pico Lipo 16MB] ### [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 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, a [Pimoroni Pico Lipo 16MB] - a board with USB-C, STEMMA QT/Qwiic connectors,
@ -173,9 +204,9 @@ 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. 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://shop.pimoroni.com/products/pimoroni-pico-lipo?variant=39335427080275
[pico_lipo_16mb]: https://github.com/rp-rs/rp-hal/tree/main/boards/pico_lipo_16mb [pimoroni-pico-lipo-16mb]: https://github.com/rp-rs/rp-hal/tree/main/boards/pimoroni_pico_lipo_16mb
### [pro_micro_rp2040] - Board Support for the [Sparkfun Pro Micro 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 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. a [Sparkfun Pro Micro RP2040] - a smaller RP2040 board with USB-C and a WS2812B addressable LED.
@ -184,38 +215,7 @@ 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. 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://www.sparkfun.com/products/18288
[pro_micro_rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/pro_micro_rp2040 [sparkfun-pro-micro-rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/sparkfun_pro_micro_rp2040
### [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
[qt_py_rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/qt_py_rp2040
### [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
[itsy_bitsy_rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/itsy_bitsy_rp2040
### [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
[kb2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/kb2040
<!-- PROGRAMMING --> <!-- PROGRAMMING -->
## Programming ## Programming

View file

@ -0,0 +1,23 @@
# 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]
### Added
- None
### Changed
- None
## [0.1.0] - 2021-12-20
- Initial release
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/adafruit-feather-rp2040-v0.1.0...HEAD
[0.1.0]: https://github.com/rp-rs/rp-hal/releases/tag/adafruit-feather-rp2040-v0.1.0

View file

@ -1,11 +1,12 @@
[package] [package]
name = "feather_rp2040" name = "adafruit-feather-rp2040"
version = "0.1.0" version = "0.1.0"
authors = ["Andrea Nall <anall@andreanal.com>"] authors = ["Andrea Nall <anall@andreanal.com>"]
edition = "2018" edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/feather_rp2040" homepage = "https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit-feather-rp2040"
description = "Board Support Package for the Adafruit Feather RP2040" description = "Board Support Package for the Adafruit Feather RP2040"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,4 +1,4 @@
# [feather_rp2040] - Board Support for the [Adafruit Feather RP2040] # [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 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. an [Adafruit Feather RP2040] - a Feather form-factor RP2040 board from Adafruit.
@ -7,7 +7,7 @@ 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 chip according to how it is connected up on the Feather.
[Adafruit Feather RP2040]: https://www.adafruit.com/product/4884 [Adafruit Feather RP2040]: https://www.adafruit.com/product/4884
[feather_rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/feather_rp2040 [adafruit-feather-rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit-feather-rp2040
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal [rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/ [Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
@ -16,10 +16,10 @@ RP2040 chip according to how it is connected up on the Feather.
To use this crate, your `Cargo.toml` file should contain: To use this crate, your `Cargo.toml` file should contain:
```toml ```toml
feather_rp2040 = { git = "https://github.com/rp-rs/rp-hal.git" } adafruit-feather-rp2040 = "0.1.0"
``` ```
In your program, you will need to call `feather_rp2040::Pins::new` to create 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 a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details. devices. See the [examples](./examples) folder for more details.
@ -30,7 +30,7 @@ devices. See the [examples](./examples) folder for more details.
To compile an example, clone the _rp-hal_ repository and run: To compile an example, clone the _rp-hal_ repository and run:
```console ```console
rp-hal/boards/feather_rp2040 $ cargo build --release --example <name> rp-hal/boards/adafruit-feather-rp2040 $ cargo build --release --example <name>
``` ```
You will get an ELF file called You will get an ELF file called
@ -44,7 +44,7 @@ USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run: bootloader mode and run:
```console ```console
rp-hal/boards/feather_rp2040 $ cargo run --release --example <name> rp-hal/boards/adafruit-feather-rp2040 $ cargo run --release --example <name>
``` ```
If you get an error about not being able to find `elf2uf2-rs`, try: If you get an error about not being able to find `elf2uf2-rs`, try:
@ -53,11 +53,11 @@ If you get an error about not being able to find `elf2uf2-rs`, try:
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above. $ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
``` ```
### [feather_blinky](./examples/feather_blinky.rs) ### [adafruit_feather_blinky](./examples/adafruit_feather_blinky.rs)
Flashes the Feather's onboard LED on and off. Flashes the Feather's onboard LED on and off.
### [feather_neopixel_rainbow](./examples/feather_neopixel_rainbow.rs) ### [adafruit_feather_neopixel_rainbow](./examples/adafruit_feather_neopixel_rainbow.rs)
Flows smoothly through various colors on the Feather's onboard NeoPixel LED. Flows smoothly through various colors on the Feather's onboard NeoPixel LED.

View file

@ -4,10 +4,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use cortex_m_rt::entry; use adafruit_feather_rp2040::{
use embedded_hal::digital::v2::OutputPin;
use embedded_time::rate::*;
use feather_rp2040::{
hal::{ hal::{
clocks::{init_clocks_and_plls, Clock}, clocks::{init_clocks_and_plls, Clock},
pac, pac,
@ -16,6 +13,9 @@ use feather_rp2040::{
}, },
Pins, XOSC_CRYSTAL_FREQ, Pins, XOSC_CRYSTAL_FREQ,
}; };
use cortex_m_rt::entry;
use embedded_hal::digital::v2::OutputPin;
use embedded_time::rate::*;
use panic_halt as _; use panic_halt as _;
#[entry] #[entry]

View file

@ -6,11 +6,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use core::iter::once; use adafruit_feather_rp2040::{
use cortex_m_rt::entry;
use embedded_hal::timer::CountDown;
use embedded_time::duration::Extensions;
use feather_rp2040::{
hal::{ hal::{
clocks::{init_clocks_and_plls, Clock}, clocks::{init_clocks_and_plls, Clock},
pac, pac,
@ -21,6 +17,10 @@ use feather_rp2040::{
}, },
Pins, XOSC_CRYSTAL_FREQ, Pins, XOSC_CRYSTAL_FREQ,
}; };
use core::iter::once;
use cortex_m_rt::entry;
use embedded_hal::timer::CountDown;
use embedded_time::duration::Extensions;
use panic_halt as _; use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8}; use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812; use ws2812_pio::Ws2812;

View file

@ -0,0 +1,23 @@
# 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]
### Added
- None
### Changed
- None
## [0.1.0] - 2021-12-20
- Initial release
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/adafruit-itsy-bitsy-rp2040-v0.1.0...HEAD
[0.1.0]: https://github.com/rp-rs/rp-hal/releases/tag/adafruit-itsy-bitsy-rp2040-v0.1.0

View file

@ -1,11 +1,12 @@
[package] [package]
name = "itsy_bitsy_rp2040" name = "adafruit-itsy-bitsy-rp2040"
version = "0.1.0" version = "0.1.0"
authors = ["Andrew Christiansen <andrewtaylorchristiansen@gmail.com>"] authors = ["Andrew Christiansen <andrewtaylorchristiansen@gmail.com>"]
edition = "2018" edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/itsy_bitsy_rp2040" homepage = "https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit_itsy_bitsy_rp2040"
description = "Board Support Package for the Adafruit ItsyBitsy RP2040" description = "Board Support Package for the Adafruit ItsyBitsy RP2040"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,4 +1,4 @@
# [itsy_bitsy_rp2040] - Board Support for the [Adafruit ItsyBitsy 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 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. an [Adafruit ItsyBitsy RP2040] - an RP2040 board in the Itsy family from Adafruit.
@ -7,7 +7,7 @@ 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. RP2040 chip according to how it is connected up on the ItsyBitsy RP2040.
[Adafruit ItsyBitsy RP2040]: https://www.adafruit.com/product/4888 [Adafruit ItsyBitsy RP2040]: https://www.adafruit.com/product/4888
[itsy_bitsy_rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/itsy_bitsy_rp2040 [adafruit-itsy-bitsy-rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit-itsy-bitsy-rp2040
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal [rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/ [Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
@ -16,10 +16,10 @@ RP2040 chip according to how it is connected up on the ItsyBitsy RP2040.
To use this crate, your `Cargo.toml` file should contain: To use this crate, your `Cargo.toml` file should contain:
```toml ```toml
itsy_bitsy_rp2040 = { git = "https://github.com/rp-rs/rp-hal.git" } adafruit-itsy-bitsy-rp2040 = "0.1.0"
``` ```
In your program, you will need to call `itsy_bitsy_rp2040::Pins::new` to create 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 a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details. devices. See the [examples](./examples) folder for more details.
@ -30,7 +30,7 @@ devices. See the [examples](./examples) folder for more details.
To compile an example, clone the _rp-hal_ repository and run: To compile an example, clone the _rp-hal_ repository and run:
```console ```console
rp-hal/boards/itsy_bitsy_rp2040 $ cargo build --release --example <name> rp-hal/boards/adafruit-itsy-bitsy-rp2040 $ cargo build --release --example <name>
``` ```
You will get an ELF file called You will get an ELF file called
@ -44,7 +44,7 @@ USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run: bootloader mode and run:
```console ```console
rp-hal/boards/itsy_bitsy_rp2040 $ cargo run --release --example <name> rp-hal/boards/adafruit-itsy-bitsy-rp2040 $ cargo run --release --example <name>
``` ```
If you get an error about not being able to find `elf2uf2-rs`, try: If you get an error about not being able to find `elf2uf2-rs`, try:
@ -53,7 +53,11 @@ If you get an error about not being able to find `elf2uf2-rs`, try:
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above. $ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
``` ```
### [itsy_bitsy_rainbow](./examples/itsy_bitsy_rainbow.rs) ### [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. Continuously changes the color of the ItsyBitsy's onboard Neopixel.

View file

@ -20,7 +20,7 @@ use panic_halt as _;
use embedded_hal::digital::v2::OutputPin; use embedded_hal::digital::v2::OutputPin;
use embedded_time::fixed_point::FixedPoint; use embedded_time::fixed_point::FixedPoint;
use itsy_bitsy_rp2040::{ use adafruit_itsy_bitsy_rp2040::{
hal::{ hal::{
clocks::{init_clocks_and_plls, Clock}, clocks::{init_clocks_and_plls, Clock},
pac, pac,

View file

@ -11,7 +11,7 @@ use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8}; use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812; use ws2812_pio::Ws2812;
use itsy_bitsy_rp2040::{ use adafruit_itsy_bitsy_rp2040::{
hal::{ hal::{
clocks::{init_clocks_and_plls, Clock}, clocks::{init_clocks_and_plls, Clock},
pac, pac,

View file

@ -0,0 +1,23 @@
# 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]
### Added
- None
### Changed
- None
## [0.1.0] - 2021-12-20
- Initial release
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/adafruit-kb2040-v0.1.0...HEAD
[0.1.0]: https://github.com/rp-rs/rp-hal/releases/tag/adafruit-kb2040-v0.1.0

View file

@ -1,11 +1,12 @@
[package] [package]
name = "kb2040" name = "adafruit-kb2040"
version = "0.1.0" version = "0.1.0"
authors = ["Andrew Christiansen <andrewtaylorchristiansen@gmail.com>"] authors = ["Andrew Christiansen <andrewtaylorchristiansen@gmail.com>"]
edition = "2018" edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/kb2040" homepage = "https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit-kb2040"
description = "Board Support Package for the Adafruit KB2040" description = "Board Support Package for the Adafruit adafruit-kb2040"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,4 +1,4 @@
# [kb2040] - Board Support for the [Adafruit KB2040] # [adafruit-kb2040] - Board Support for the [Adafruit KB2040]
You should include this crate if you are writing code that you want to run on 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. a [Adafruit KB2040] - an Arduino Pro Micro-shaped board for keyboards.
@ -7,7 +7,7 @@ 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. RP2040 chip according to how it is connected up on the KB2040.
[Adafruit KB2040]: https://www.adafruit.com/product/5302 [Adafruit KB2040]: https://www.adafruit.com/product/5302
[kb2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/kb2040 [adafruit-kb2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit-kb2040
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal [rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/ [Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
@ -16,10 +16,10 @@ RP2040 chip according to how it is connected up on the KB2040.
To use this crate, your `Cargo.toml` file should contain: To use this crate, your `Cargo.toml` file should contain:
```toml ```toml
kb2040 = { git = "https://github.com/rp-rs/rp-hal.git" } adafruit-kb2040 = "0.1.0"
``` ```
In your program, you will need to call `kb2040::Pins::new` to create 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 a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details. devices. See the [examples](./examples) folder for more details.
@ -30,7 +30,7 @@ devices. See the [examples](./examples) folder for more details.
To compile an example, clone the _rp-hal_ repository and run: To compile an example, clone the _rp-hal_ repository and run:
```console ```console
rp-hal/boards/kb2040 $ cargo build --release --example <name> rp-hal/boards/adafruit-kb2040 $ cargo build --release --example <name>
``` ```
You will get an ELF file called You will get an ELF file called
@ -44,7 +44,7 @@ USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run: bootloader mode and run:
```console ```console
rp-hal/boards/kb2040$ cargo run --release --example <name> rp-hal/boards/adafruit-kb2040$ cargo run --release --example <name>
``` ```
If you get an error about not being able to find `elf2uf2-rs`, try: If you get an error about not being able to find `elf2uf2-rs`, try:
@ -53,7 +53,7 @@ If you get an error about not being able to find `elf2uf2-rs`, try:
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above. $ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
``` ```
### [Rainbow](./examples/kb2040_rainbow.rs) ### [Rainbow](./examples/adafruit_kb2040_rainbow.rs)
This example will display a colour-wheel rainbow effect on the on-board LED. This example will display a colour-wheel rainbow effect on the on-board LED.

View file

@ -14,7 +14,7 @@ use embedded_hal::timer::CountDown;
use embedded_time::duration::Extensions; use embedded_time::duration::Extensions;
use panic_halt as _; use panic_halt as _;
use kb2040::{ use adafruit_kb2040::{
hal::{ hal::{
clocks::{init_clocks_and_plls, Clock}, clocks::{init_clocks_and_plls, Clock},
pac, pac,
@ -62,7 +62,7 @@ fn main() -> ! {
let sio = Sio::new(pac.SIO); let sio = Sio::new(pac.SIO);
let pins = kb2040::Pins::new( let pins = adafruit_kb2040::Pins::new(
pac.IO_BANK0, pac.IO_BANK0,
pac.PADS_BANK0, pac.PADS_BANK0,
sio.gpio_bank0, sio.gpio_bank0,

View file

@ -0,0 +1,23 @@
# 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]
### Added
- None
### Changed
- None
## [0.1.0] - 2021-12-20
- Initial release
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/adafruit-macropad-v0.1.0...HEAD
[0.1.0]: https://github.com/rp-rs/rp-hal/releases/tag/adafruit-macropad-v0.1.0

View file

@ -1,11 +1,12 @@
[package] [package]
name = "adafruit_macropad" name = "adafruit-macropad"
version = "0.1.0" version = "0.1.0"
authors = ["Andrea Nall <anall@andreanal.com>"] authors = ["Andrea Nall <anall@andreanal.com>"]
edition = "2018" edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/adafruit_macropad" homepage = "https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit_macropad"
description = "Board Support Package for the Adafruit Macropad" description = "Board Support Package for the Adafruit Macropad"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,4 +1,4 @@
# [adafruit_macropad] - Board Support for the [Adafruit Macropad] # [adafruit-macropad] - Board Support for the [Adafruit Macropad]
You should include this crate if you are writing code that you want to run on 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. an [Adafruit Macropad] - a 3x4 keyboard and OLED combo board from Adafruit.
@ -6,7 +6,7 @@ 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 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 chip according to how it is connected up on the Feather.
[adafruit_macropad]: https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit_macropad [adafruit-macropad]: https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit-macropad
[Adafruit Macropad]: https://www.adafruit.com/product/5128 [Adafruit Macropad]: https://www.adafruit.com/product/5128
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal [rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/ [Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
@ -16,7 +16,7 @@ RP2040 chip according to how it is connected up on the Feather.
To use this crate, your `Cargo.toml` file should contain: To use this crate, your `Cargo.toml` file should contain:
```toml ```toml
adafruit_macropad = { git = "https://github.com/rp-rs/rp-hal.git" } adafruit-macropad = "0.1.0"
``` ```
In your program, you will need to call `adafruit_macropad::Pins::new` to create In your program, you will need to call `adafruit_macropad::Pins::new` to create
@ -30,7 +30,7 @@ devices. See the [examples](./examples) folder for more details.
To compile an example, clone the _rp-hal_ repository and run: To compile an example, clone the _rp-hal_ repository and run:
```console ```console
rp-hal/boards/adafruit_macropad $ cargo build --release --example <name> rp-hal/boards/adafruit-macropad $ cargo build --release --example <name>
``` ```
You will get an ELF file called You will get an ELF file called
@ -44,7 +44,7 @@ USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run: bootloader mode and run:
```console ```console
rp-hal/boards/adafruit_macropad $ cargo run --release --example <name> rp-hal/boards/adafruit-macropad $ cargo run --release --example <name>
``` ```
If you get an error about not being able to find `elf2uf2-rs`, try: If you get an error about not being able to find `elf2uf2-rs`, try:
@ -53,10 +53,6 @@ If you get an error about not being able to find `elf2uf2-rs`, try:
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above. $ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
``` ```
### [feather_blinky](./examples/feather_blinky.rs)
Flashes the Feather's on-board LED on and off.
## Contributing ## Contributing
Contributions are what make the open source community such an amazing place to Contributions are what make the open source community such an amazing place to

View file

@ -0,0 +1,23 @@
# 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]
### Added
- None
### Changed
- None
## [0.1.0] - 2021-12-20
- Initial release
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/adafruit-qt-py-rp2040-v0.1.0...HEAD
[0.1.0]: https://github.com/rp-rs/rp-hal/releases/tag/adafruit-qt-py-rp2040-v0.1.0

View file

@ -1,11 +1,12 @@
[package] [package]
name = "qt_py_rp2040" name = "adafruit-qt-py-rp2040"
version = "0.1.0" version = "0.1.0"
authors = ["Stephen Onnen <stephen.onnen@gmail.com>"] authors = ["Stephen Onnen <stephen.onnen@gmail.com>"]
edition = "2018" edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/qt_py_rp2040" homepage = "https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit-qt-py-rp2040"
description = "Board Support Package for the Adafruit QT Py RP2040" description = "Board Support Package for the Adafruit QT Py RP2040"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,4 +1,4 @@
# [qt_py_rp2040] - Board Support for the [Adafruit QT Py 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 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. an [Adafruit QT Py RP2040] - an extremely small form-factor RP2040 board from Adafruit.
@ -7,7 +7,7 @@ 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. 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://www.adafruit.com/product/4900
[qt_py_rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/qt_py_rp2040 [adafruit-qt-py-rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit-qt-py-rp2040
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal [rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/ [Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
@ -16,10 +16,10 @@ RP2040 chip according to how it is connected up on the QT Py.
To use this crate, your `Cargo.toml` file should contain: To use this crate, your `Cargo.toml` file should contain:
```toml ```toml
qt_py_rp2040 = { git = "https://github.com/rp-rs/rp-hal.git" } adafruit-qt-py-rp2040 = { git = "https://github.com/rp-rs/rp-hal.git" }
``` ```
In your program, you will need to call `qt_py_rp2040::Pins::new` to create 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 a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details. devices. See the [examples](./examples) folder for more details.
@ -30,7 +30,7 @@ devices. See the [examples](./examples) folder for more details.
To compile an example, clone the _rp-hal_ repository and run: To compile an example, clone the _rp-hal_ repository and run:
```console ```console
rp-hal/boards/qt_py_rp2040 $ cargo build --release --example <name> rp-hal/boards/adafruit-qt-py-rp2040 $ cargo build --release --example <name>
``` ```
You will get an ELF file called You will get an ELF file called
@ -44,7 +44,7 @@ USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run: bootloader mode and run:
```console ```console
rp-hal/boards/qt_py_rp2040 $ cargo run --release --example <name> rp-hal/boards/adafruit-qt-py-rp2040 $ cargo run --release --example <name>
``` ```
If you get an error about not being able to find `elf2uf2-rs`, try: If you get an error about not being able to find `elf2uf2-rs`, try:
@ -53,7 +53,7 @@ If you get an error about not being able to find `elf2uf2-rs`, try:
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above. $ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
``` ```
### [qt_py_rainbow](./examples/qt_py_rainbow.rs) ### [adafruit_qt_py_rp2040_rainbow](./examples/adafruit_qt_py_rp2040_rainbow.rs)
Continuously changes the color of the QT Py's onboard Neopixel. Continuously changes the color of the QT Py's onboard Neopixel.

View file

@ -11,7 +11,7 @@ use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8}; use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812; use ws2812_pio::Ws2812;
use qt_py_rp2040::{ use adafruit_qt_py_rp2040::{
hal::{ hal::{
clocks::{init_clocks_and_plls, Clock}, clocks::{init_clocks_and_plls, Clock},
pac, pac,

View file

@ -1,47 +0,0 @@
//! I2C Controller demo
//!
//! This module implements a demonstration of an I2C controller sending read & write requests to a
//! peripheral.
//! This demo takes advandage of rust's async.await support to run read & write operation while
//! serving those request from an independant context.
use super::ADDRESS;
use core::ops::Deref;
use rp2040_hal::i2c::I2C;
use rp2040_hal::pac::i2c0::RegisterBlock as I2CBlock;
use embassy_traits::i2c::I2c;
/// Controller demo
pub async fn run_demo<Block, Pins>(i2c: &mut I2C<Block, Pins>) -> Result<(), rp2040_hal::i2c::Error>
where
Block: Deref<Target = I2CBlock>,
{
let mut tx_filler = 0;
let mut tx = [0u8; 24];
let mut rx = [0u8; 24];
i2c.read(ADDRESS, &mut rx).await?;
rx.iter()
.cloned()
.zip(0x80..)
.for_each(|(a, b)| assert_eq!(a, b));
tx.iter_mut().for_each(|b| {
*b = tx_filler;
tx_filler += 1;
});
i2c.write_read(ADDRESS, &tx, &mut rx).await?;
rx.iter()
.cloned()
.zip(0x80 + 24..) // follows the inital read
.for_each(|(a, b)| assert_eq!(a, b));
tx.iter_mut().for_each(|b| {
*b = tx_filler;
tx_filler += 1;
});
i2c.write(ADDRESS, &tx).await?;
Ok(())
}

View file

@ -1,119 +0,0 @@
//! I2C controller and I2C peripheral async demo.
//!
//! This example demonstrates use of both I2C peripherals (I2C0 and I2C1) at the same time on a single Pico using [Embassy](https://github.com/embassy-rs/embassy), an async executor.
//!
//! Each peripheral is passed to an async task, which allows them to operate independently of each other:
//! - The controller task (ctrl_demo) uses I2C0. It calls the demo controller code in `controller.rs`
//! - The peripheral task (prph_demo) uses I2C1. It calls the demo peripheral code in `peripheral.rs`
//!
//! ### Wiring notes:
//!
//! I2C0 uses pin `GP0` for `SDA`, and `GP1` for `SCL`.
//!
//! I2C1 uses `GP2` for `SDA`, and `GP3` for `SCL`.
//!
//! For this demo to function you must connect the `SDA` signals (`GP0` and `GP2`) to each other using wires.
//! You must also connect the `SCL` signals (`GP1` and `GP3`) to each other.
//!
//! A pull up resistor (to 3.3V, which is available on pin `36`) is required on SCL & SDA lines in order to reach the expected 1MHz. Although it
//! depends on the hardware context (wire length, impedance & capacitance), a typical value of 2KOhm
//! should generally work fine.
//!
//! If you do not connect the resistor and instead use the internal pull-ups on the I2C pins, you may need to lower the I2C frequency to avoid transmission errors.
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
use embassy::{executor::Executor, util::Forever};
use embedded_time::rate::Extensions;
use hal::{
clocks::{init_clocks_and_plls, Clock},
gpio::{bank0, FunctionI2C, Pin},
i2c::{peripheral::I2CPeripheralEventIterator, I2C},
pac,
watchdog::Watchdog,
Sio,
};
use pico::{hal, Pins, XOSC_CRYSTAL_FREQ};
use panic_halt as _;
mod controller;
mod peripheral;
const ADDRESS: u16 = 0x55;
#[embassy::task]
async fn ctrl_demo(
mut i2c: I2C<
pac::I2C0,
(
Pin<bank0::Gpio0, FunctionI2C>,
Pin<bank0::Gpio1, FunctionI2C>,
),
>,
) {
controller::run_demo(&mut i2c).await.expect("Demo failed")
}
#[embassy::task]
async fn prph_demo(
mut i2c: I2CPeripheralEventIterator<
pac::I2C1,
(
Pin<bank0::Gpio2, FunctionI2C>,
Pin<bank0::Gpio3, FunctionI2C>,
),
>,
) {
peripheral::run_demo(&mut i2c).await.expect("Demo failed")
}
#[cortex_m_rt::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 pins = Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
Sio::new(pac.SIO).gpio_bank0,
&mut pac.RESETS,
);
let i2c0 = I2C::new_controller(
pac.I2C0,
pins.gpio0.into_mode(),
pins.gpio1.into_mode(),
1_000.kHz(),
&mut pac.RESETS,
clocks.system_clock.freq(),
);
let i2c1 = I2C::new_peripheral_event_iterator(
pac.I2C1,
pins.gpio2.into_mode(),
pins.gpio3.into_mode(),
&mut pac.RESETS,
ADDRESS,
);
static EXECUTOR: Forever<Executor> = Forever::new();
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {
spawner.spawn(ctrl_demo(i2c0)).unwrap();
spawner.spawn(prph_demo(i2c1)).unwrap();
});
}

View file

@ -1,95 +0,0 @@
//! I2C Peripheral demo
//!
//! This module implements a state machine serving the I2C requests from the controller in this
//! demo. In a real-life application the state machine may not need to be validated as thoroughly
//! demonstrated here.
use core::ops::Deref;
use rp2040_hal::i2c::peripheral::I2CEvent;
use rp2040_hal::i2c::peripheral::I2CPeripheralEventIterator;
use rp2040_hal::pac::i2c0::RegisterBlock as I2CBlock;
pub async fn run_demo<Block, Pins>(
i2c: &mut I2CPeripheralEventIterator<Block, Pins>,
) -> Result<(), rp2040_hal::i2c::Error>
where
Block: Deref<Target = I2CBlock>,
{
let mut expected_value = 0..;
let mut output = 128;
#[derive(Debug, PartialEq)]
enum Stage {
Idle0,
FirstRead,
Idle1,
FirstWrite,
SecondRead,
Idle2,
SecondWrite,
Done,
}
let mut stage = Stage::Idle0;
while stage != Stage::Done {
let ev = futures::future::poll_fn(|cx| {
cx.waker().wake_by_ref();
i2c.next()
.map(core::task::Poll::Ready)
.unwrap_or(core::task::Poll::Pending)
})
.await;
match ev {
I2CEvent::Start => {
stage = match stage {
Stage::Idle0 => Stage::FirstRead,
Stage::Idle1 => Stage::FirstWrite,
Stage::Idle2 => Stage::SecondWrite,
_ => panic!("Unexpected {:?} while in {:?}", ev, stage),
}
}
I2CEvent::TransferRead => {
if stage != Stage::FirstRead && stage != Stage::SecondRead {
panic!("Unexpected {:?} while in {:?}", ev, stage);
}
i2c.write(&[output, output + 1, output + 2, output + 3]);
output += 4;
}
I2CEvent::TransferWrite => {
if stage != Stage::FirstWrite && stage != Stage::SecondWrite {
panic!("Unexpected {:?} while in {:?}", ev, stage);
}
let mut buf = [0; 16];
loop {
let read = i2c.read(&mut buf);
if read == 0 {
break;
}
buf.iter()
.take(read)
.cloned()
.zip(&mut expected_value)
.for_each(|(a, b)| assert_eq!(a, b));
}
}
I2CEvent::Stop => {
stage = match stage {
Stage::FirstRead => Stage::Idle1,
Stage::SecondRead => Stage::Idle2,
Stage::SecondWrite => Stage::Done,
_ => panic!("Unexpected {:?} while in {:?}", ev, stage),
}
}
I2CEvent::Restart => {
stage = match stage {
Stage::FirstWrite => Stage::SecondRead,
_ => panic!("Unexpected {:?} while in {:?}", ev, stage),
}
}
}
}
Ok(())
}

View file

@ -0,0 +1,23 @@
# 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]
### Added
- None
### Changed
- None
## [0.1.0] - 2021-12-20
- Initial release
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/pimoroni-pico-explorer-v0.1.0...HEAD
[0.1.0]: https://github.com/rp-rs/rp-hal/releases/tag/pimoroni-pico-explorer-v0.1.0

View file

@ -1,11 +1,12 @@
[package] [package]
name = "pico_explorer" name = "pimoroni-pico-explorer"
version = "0.1.0" version = "0.1.0"
authors = ["Hmvp <hmvp@users.noreply.github.com>"] authors = ["Hmvp <hmvp@users.noreply.github.com>"]
edition = "2018" edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/pico_explorer" homepage = "https://github.com/rp-rs/rp-hal/tree/main/boards/pimoroni-pico-explorer"
description = "Board Support Package for the Pico Explorer" description = "Board Support Package for the Pico Explorer"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,4 +1,4 @@
# [pico_explorer] - Board Support for the [Pimoroni Pico Explorer] # [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 You should include this crate if you are writing code that you want to run on
a [Pimoroni Pico Explorer] - a board featuring a small LCD screen, a a [Pimoroni Pico Explorer] - a board featuring a small LCD screen, a
@ -7,8 +7,8 @@ breadboard and some breakout headers.
This crate includes the [rp2040-hal], but also configures each pin of the 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. RP2040 chip according to how it is connected up on the Pico Explorer.
[Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pico-explorer-base [Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pimoroni-pico-explorer-base
[pico_explorer]: https://github.com/rp-rs/rp-hal/tree/main/boards/pico_explorer [pimoroni-pico-explorer]: https://github.com/rp-rs/rp-hal/tree/main/boards/pimoroni-pico-explorer
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal [rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/ [Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
@ -17,10 +17,10 @@ RP2040 chip according to how it is connected up on the Pico Explorer.
To use this crate, your `Cargo.toml` file should contain: To use this crate, your `Cargo.toml` file should contain:
```toml ```toml
pico_explorer = { git = "https://github.com/rp-rs/rp-hal.git" } pimoroni-pico-explorer = "0.1.0"
``` ```
In your program, you will need to call `pico_explorer::Pins::new` to create In your program, you will need to call `pimoroni_pico_explorer::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details. devices. See the [examples](./examples) folder for more details.
@ -31,7 +31,7 @@ devices. See the [examples](./examples) folder for more details.
To compile an example, clone the _rp-hal_ repository and run: To compile an example, clone the _rp-hal_ repository and run:
```console ```console
rp-hal/boards/pico_explorer $ cargo build --release --example <name> rp-hal/boards/pimoroni-pico-explorer $ cargo build --release --example <name>
``` ```
You will get an ELF file called You will get an ELF file called
@ -45,7 +45,7 @@ USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run: bootloader mode and run:
```console ```console
rp-hal/boards/pico_explorer $ cargo run --release --example <name> rp-hal/boards/pimoroni-pico-explorer $ cargo run --release --example <name>
``` ```
If you get an error about not being able to find `elf2uf2-rs`, try: If you get an error about not being able to find `elf2uf2-rs`, try:
@ -54,7 +54,7 @@ If you get an error about not being able to find `elf2uf2-rs`, try:
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above. $ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
``` ```
### [pico_explorer_showcase](./examples/pico_explorer_showcase.rs) ### [pimoroni_pico_explorer_showcase](./examples/pimoroni_pico_explorer_showcase.rs)
Displays the current temperature on the Pico Explorer's on-board LCD screen. Displays the current temperature on the Pico Explorer's on-board LCD screen.

View file

@ -14,7 +14,7 @@ use embedded_hal::digital::v2::OutputPin;
use embedded_time::rate::*; use embedded_time::rate::*;
use hal::{adc::Adc, clocks::*, watchdog::Watchdog, Sio}; use hal::{adc::Adc, clocks::*, watchdog::Watchdog, Sio};
use panic_halt as _; use panic_halt as _;
use pico_explorer::{hal, pac, Button, PicoExplorer, XOSC_CRYSTAL_FREQ}; use pimoroni_pico_explorer::{hal, pac, Button, PicoExplorer, XOSC_CRYSTAL_FREQ};
// See 4.9.5 from RP2040 datasheet // See 4.9.5 from RP2040 datasheet
fn calc_temp(adc_value: f32, refv: f64) -> f64 { fn calc_temp(adc_value: f32, refv: f64) -> f64 {

View file

@ -0,0 +1,23 @@
# 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]
### Added
- None
### Changed
- None
## [0.1.0] - 2021-12-20
- Initial release
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/pimoroni-pico-lipo-16mb-v0.1.0...HEAD
[0.1.0]: https://github.com/rp-rs/rp-hal/releases/tag/pimoroni-pico-lipo-16mb-v0.1.0

View file

@ -1,11 +1,12 @@
[package] [package]
name = "pico_lipo_16_mb" name = "pimoroni-pico-lipo-16mb"
version = "0.1.0" version = "0.1.0"
authors = ["Hmvp <hmvp@users.noreply.github.com>"] authors = ["Hmvp <hmvp@users.noreply.github.com>"]
edition = "2018" edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/pico_lipo_16_mb" homepage = "https://github.com/rp-rs/rp-hal/tree/main/boards/pimoroni-pico-lipo-16mb"
description = "Board Support Package for the Pico LiPo 16 Mb" description = "Board Support Package for the Pico LiPo 16MB"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,4 +1,4 @@
# [pico_lipo_16mb] - Board Support for the [Pimoroni Pico Lipo 16MB] # [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 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, a [Pimoroni Pico Lipo 16MB] - a board with USB-C, STEMMA QT/Qwiic connectors,
@ -11,17 +11,17 @@ 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. 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://shop.pimoroni.com/products/pimoroni-pico-lipo?variant=39335427080275
[pico_lipo_16mb]: https://github.com/rp-rs/rp-hal/tree/main/boards/pico_lipo_16mb [pimoroni-pico-lipo-16mb]: https://github.com/rp-rs/rp-hal/tree/main/boards/pimoroni-pico-lipo-16mb
## Using ## Using
To use this crate, your `Cargo.toml` file should contain: To use this crate, your `Cargo.toml` file should contain:
```toml ```toml
pico_lipo_16mb = { git = "https://github.com/rp-rs/rp-hal.git" } pimoroni-pico-lipo-16mb = { git = "https://github.com/rp-rs/rp-hal.git" }
``` ```
In your program, you will need to call `pico_lipo_16mb::Pins::new` to create In your program, you will need to call `pimoroni_pico_lipo_16mb::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details. devices. See the [examples](./examples) folder for more details.
@ -32,7 +32,7 @@ devices. See the [examples](./examples) folder for more details.
To compile an example, clone the _rp-hal_ repository and run: To compile an example, clone the _rp-hal_ repository and run:
```console ```console
rp-hal/boards/pico_lipo_16mb $ cargo build --release --example <name> rp-hal/boards/pimoroni-pico-lipo-16mb $ cargo build --release --example <name>
``` ```
You will get an ELF file called You will get an ELF file called
@ -46,7 +46,7 @@ USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run: bootloader mode and run:
```console ```console
rp-hal/boards/pico_lipo_16mb $ cargo run --release --example <name> rp-hal/boards/pimoroni-pico-lipo-16mb $ cargo run --release --example <name>
``` ```
If you get an error about not being able to find `elf2uf2-rs`, try: If you get an error about not being able to find `elf2uf2-rs`, try:
@ -55,7 +55,7 @@ If you get an error about not being able to find `elf2uf2-rs`, try:
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above. $ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
``` ```
### [pico_lipo_16mb_blinky](./examples/pico_lipo_16mb_blinky.rs) ### [pimoroni_pico_lipo_16mb_blinky](./examples/pimoroni_pico_lipo_16mb_blinky.rs)
Flashes the Pico Lipo's on-board LED on and off. Flashes the Pico Lipo's on-board LED on and off.

View file

@ -24,15 +24,15 @@ use embedded_time::rate::*;
use panic_halt as _; use panic_halt as _;
// Pull in any important traits // Pull in any important traits
use pico_lipo_16_mb::hal::prelude::*; use pimoroni_pico_lipo_16mb::hal::prelude::*;
// A shorter alias for the Peripheral Access Crate, which provides low-level // A shorter alias for the Peripheral Access Crate, which provides low-level
// register access // register access
use pico_lipo_16_mb::hal::pac; use pimoroni_pico_lipo_16mb::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides // A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers. // higher-level drivers.
use pico_lipo_16_mb::hal; use pimoroni_pico_lipo_16mb::hal;
/// Entry point to our bare-metal application. /// Entry point to our bare-metal application.
/// ///
@ -54,7 +54,7 @@ fn main() -> ! {
// //
// The default is to generate a 125 MHz system clock // The default is to generate a 125 MHz system clock
let clocks = hal::clocks::init_clocks_and_plls( let clocks = hal::clocks::init_clocks_and_plls(
pico_lipo_16_mb::XOSC_CRYSTAL_FREQ, pimoroni_pico_lipo_16mb::XOSC_CRYSTAL_FREQ,
pac.XOSC, pac.XOSC,
pac.CLOCKS, pac.CLOCKS,
pac.PLL_SYS, pac.PLL_SYS,
@ -73,7 +73,7 @@ fn main() -> ! {
let sio = hal::Sio::new(pac.SIO); let sio = hal::Sio::new(pac.SIO);
// Set the pins up according to their function on this particular board // Set the pins up according to their function on this particular board
let pins = pico_lipo_16_mb::Pins::new( let pins = pimoroni_pico_lipo_16mb::Pins::new(
pac.IO_BANK0, pac.IO_BANK0,
pac.PADS_BANK0, pac.PADS_BANK0,
sio.gpio_bank0, sio.gpio_bank0,

View file

@ -0,0 +1,36 @@
# 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]
### Added
- None
### Changed
- None
## [0.2.0] - 2021-12-23
### Added
- Lots of things!
### Changed
- Basically re-written.
## [0.1.3] - 2021-02-03
- Last release outside the [rp-rs] organisation by [@jannic].
[@jannic]: https://github.com/jannic
[rp-rs]: https://github.com/rp-rs
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/rp-pico-v0.1.0...HEAD
[0.2.0]: https://github.com/rp-rs/rp-hal/releases/tag/rp-pico-v0.2.0
[0.1.3]: https://github.com/jannic/rp-microcontroller-rs/tree/rp-pico-0.1.3

View file

@ -1,11 +1,12 @@
[package] [package]
name = "pico" name = "rp-pico"
version = "0.1.0" version = "0.2.0"
authors = ["evan <evanmolder@gmail.com>"] authors = ["evan <evanmolder@gmail.com>"]
edition = "2018" edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/pico" homepage = "https://github.com/rp-rs/rp-hal/tree/main/boards/pico"
description = "Board Support Package for the Raspberry Pi Pico" description = "Board Support Package for the Raspberry Pi Pico"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -20,19 +21,6 @@ usbd-serial = "0.1.1"
usbd-hid = "0.5.1" usbd-hid = "0.5.1"
futures = { version = "0.3", default-features = false, optional = true } futures = { version = "0.3", default-features = false, optional = true }
[dependencies.embassy]
git = "https://github.com/embassy-rs/embassy"
rev = "6d6e6f55b8a9ecd38b5a6d3bb11f74b2654afdeb"
optional = true
# namespaced features will let use use "dep:embassy-traits" in the features rather than using this
# trick of renaming the crate.
[dependencies.embassy_traits]
git = "https://github.com/embassy-rs/embassy"
rev = "6d6e6f55b8a9ecd38b5a6d3bb11f74b2654afdeb"
package = "embassy-traits"
optional = true
[dev-dependencies] [dev-dependencies]
panic-halt= "0.2.0" panic-halt= "0.2.0"
embedded-hal ="0.2.5" embedded-hal ="0.2.5"
@ -44,8 +32,3 @@ i2c-pio = { git = "https://github.com/ithinuel/i2c-pio-rs", rev = "df06e4ac94a5b
default = ["boot2", "rt"] default = ["boot2", "rt"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]
embassy-traits = ["futures", "embassy", "embassy_traits"]
[[example]]
name = "pico_i2c_controller_peripheral"
required-features = ["embassy-traits"]

View file

@ -1,4 +1,4 @@
# [pico] - Board Support for the [Raspberry Pi Pico] # [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 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. a [Raspberry Pi Pico] - the original launch PCB for the RP2040 chip.
@ -7,7 +7,7 @@ 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. RP2040 chip according to how it is connected up on the Pico.
[Raspberry Pi Pico]: https://www.raspberrypi.org/products/raspberry-pi-pico/ [Raspberry Pi Pico]: https://www.raspberrypi.org/products/raspberry-pi-pico/
[pico]: https://github.com/rp-rs/rp-hal/tree/main/boards/pico [rp-pico]: https://github.com/rp-rs/rp-hal/tree/main/boards/rp-pico
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal [rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/ [Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
@ -16,10 +16,10 @@ RP2040 chip according to how it is connected up on the Pico.
To use this crate, your `Cargo.toml` file should contain: To use this crate, your `Cargo.toml` file should contain:
```toml ```toml
pico = { git = "https://github.com/rp-rs/rp-hal.git" } rp-pico = "0.2.0"
``` ```
In your program, you will need to call `pico::Pins::new` to create In your program, you will need to call `rp_pico::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details. devices. See the [examples](./examples) folder for more details.
@ -30,7 +30,7 @@ devices. See the [examples](./examples) folder for more details.
To compile an example, clone the _rp-hal_ repository and run: To compile an example, clone the _rp-hal_ repository and run:
```console ```console
rp-hal/boards/pico $ cargo build --release --example <name> rp-hal/boards/rp-pico $ cargo build --release --example <name>
``` ```
You will get an ELF file called You will get an ELF file called
@ -44,7 +44,7 @@ USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run: bootloader mode and run:
```console ```console
rp-hal/boards/pico $ cargo run --release --example <name> rp-hal/boards/rp-pico $ cargo run --release --example <name>
``` ```
If you get an error about not being able to find `elf2uf2-rs`, try: If you get an error about not being able to find `elf2uf2-rs`, try:

View file

@ -24,15 +24,15 @@ use embedded_time::rate::*;
use panic_halt as _; use panic_halt as _;
// Pull in any important traits // Pull in any important traits
use pico::hal::prelude::*; use rp_pico::hal::prelude::*;
// A shorter alias for the Peripheral Access Crate, which provides low-level // A shorter alias for the Peripheral Access Crate, which provides low-level
// register access // register access
use pico::hal::pac; use rp_pico::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides // A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers. // higher-level drivers.
use pico::hal; use rp_pico::hal;
/// Entry point to our bare-metal application. /// Entry point to our bare-metal application.
/// ///
@ -54,7 +54,7 @@ fn main() -> ! {
// //
// The default is to generate a 125 MHz system clock // The default is to generate a 125 MHz system clock
let clocks = hal::clocks::init_clocks_and_plls( let clocks = hal::clocks::init_clocks_and_plls(
pico::XOSC_CRYSTAL_FREQ, rp_pico::XOSC_CRYSTAL_FREQ,
pac.XOSC, pac.XOSC,
pac.CLOCKS, pac.CLOCKS,
pac.PLL_SYS, pac.PLL_SYS,
@ -73,7 +73,7 @@ fn main() -> ! {
let sio = hal::Sio::new(pac.SIO); let sio = hal::Sio::new(pac.SIO);
// Set the pins up according to their function on this particular board // Set the pins up according to their function on this particular board
let pins = pico::Pins::new( let pins = rp_pico::Pins::new(
pac.IO_BANK0, pac.IO_BANK0,
pac.PADS_BANK0, pac.PADS_BANK0,
sio.gpio_bank0, sio.gpio_bank0,

View file

@ -27,11 +27,11 @@ use panic_halt as _;
// A shorter alias for the Peripheral Access Crate, which provides low-level // A shorter alias for the Peripheral Access Crate, which provides low-level
// register access // register access
use pico::hal::pac; use rp_pico::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides // A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers. // higher-level drivers.
use pico::hal; use rp_pico::hal;
#[entry] #[entry]
fn main() -> ! { fn main() -> ! {
@ -45,7 +45,7 @@ fn main() -> ! {
// //
// The default is to generate a 125 MHz system clock // The default is to generate a 125 MHz system clock
let _clocks = hal::clocks::init_clocks_and_plls( let _clocks = hal::clocks::init_clocks_and_plls(
pico::XOSC_CRYSTAL_FREQ, rp_pico::XOSC_CRYSTAL_FREQ,
pac.XOSC, pac.XOSC,
pac.CLOCKS, pac.CLOCKS,
pac.PLL_SYS, pac.PLL_SYS,
@ -64,7 +64,7 @@ fn main() -> ! {
let sio = hal::Sio::new(pac.SIO); let sio = hal::Sio::new(pac.SIO);
// Set the pins up according to their function on this particular board // Set the pins up according to their function on this particular board
let pins = pico::Pins::new( let pins = rp_pico::Pins::new(
pac.IO_BANK0, pac.IO_BANK0,
pac.PADS_BANK0, pac.PADS_BANK0,
sio.gpio_bank0, sio.gpio_bank0,

View file

@ -24,11 +24,11 @@ use panic_halt as _;
// A shorter alias for the Peripheral Access Crate, which provides low-level // A shorter alias for the Peripheral Access Crate, which provides low-level
// register access // register access
use pico::hal::pac; use rp_pico::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides // A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers. // higher-level drivers.
use pico::hal; use rp_pico::hal;
/// Entry point to our bare-metal application. /// Entry point to our bare-metal application.
/// ///
@ -49,7 +49,7 @@ fn main() -> ! {
let sio = hal::Sio::new(pac.SIO); let sio = hal::Sio::new(pac.SIO);
// Set the pins up according to their function on this particular board // Set the pins up according to their function on this particular board
let pins = pico::Pins::new( let pins = rp_pico::Pins::new(
pac.IO_BANK0, pac.IO_BANK0,
pac.PADS_BANK0, pac.PADS_BANK0,
sio.gpio_bank0, sio.gpio_bank0,

View file

@ -28,15 +28,15 @@ use embedded_time::rate::*;
use panic_halt as _; use panic_halt as _;
// Pull in any important traits // Pull in any important traits
use pico::hal::prelude::*; use rp_pico::hal::prelude::*;
// A shorter alias for the Peripheral Access Crate, which provides low-level // A shorter alias for the Peripheral Access Crate, which provides low-level
// register access // register access
use pico::hal::pac; use rp_pico::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides // A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers. // higher-level drivers.
use pico::hal; use rp_pico::hal;
/// Prints the temperature received from the sensor /// Prints the temperature received from the sensor
fn print_temperature(serial: &mut impl FmtWrite, temp: [u8; 2]) { fn print_temperature(serial: &mut impl FmtWrite, temp: [u8; 2]) {
@ -66,7 +66,7 @@ fn main() -> ! {
// //
// The default is to generate a 125 MHz system clock // The default is to generate a 125 MHz system clock
let clocks = hal::clocks::init_clocks_and_plls( let clocks = hal::clocks::init_clocks_and_plls(
pico::XOSC_CRYSTAL_FREQ, rp_pico::XOSC_CRYSTAL_FREQ,
pac.XOSC, pac.XOSC,
pac.CLOCKS, pac.CLOCKS,
pac.PLL_SYS, pac.PLL_SYS,
@ -81,7 +81,7 @@ fn main() -> ! {
let sio = hal::Sio::new(pac.SIO); let sio = hal::Sio::new(pac.SIO);
// Set the pins up according to their function on this particular board // Set the pins up according to their function on this particular board
let pins = pico::Pins::new( let pins = rp_pico::Pins::new(
pac.IO_BANK0, pac.IO_BANK0,
pac.PADS_BANK0, pac.PADS_BANK0,
sio.gpio_bank0, sio.gpio_bank0,

View file

@ -24,15 +24,15 @@ use embedded_time::rate::*;
use panic_halt as _; use panic_halt as _;
// Pull in any important traits // Pull in any important traits
use pico::hal::prelude::*; use rp_pico::hal::prelude::*;
// A shorter alias for the Peripheral Access Crate, which provides low-level // A shorter alias for the Peripheral Access Crate, which provides low-level
// register access // register access
use pico::hal::pac; use rp_pico::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides // A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers. // higher-level drivers.
use pico::hal; use rp_pico::hal;
// The minimum PWM value (i.e. LED brightness) we want // The minimum PWM value (i.e. LED brightness) we want
const LOW: u16 = 0; const LOW: u16 = 0;
@ -60,7 +60,7 @@ fn main() -> ! {
// //
// The default is to generate a 125 MHz system clock // The default is to generate a 125 MHz system clock
let clocks = hal::clocks::init_clocks_and_plls( let clocks = hal::clocks::init_clocks_and_plls(
pico::XOSC_CRYSTAL_FREQ, rp_pico::XOSC_CRYSTAL_FREQ,
pac.XOSC, pac.XOSC,
pac.CLOCKS, pac.CLOCKS,
pac.PLL_SYS, pac.PLL_SYS,
@ -75,7 +75,7 @@ fn main() -> ! {
let sio = hal::Sio::new(pac.SIO); let sio = hal::Sio::new(pac.SIO);
// Set the pins up according to their function on this particular board // Set the pins up according to their function on this particular board
let pins = pico::Pins::new( let pins = rp_pico::Pins::new(
pac.IO_BANK0, pac.IO_BANK0,
pac.PADS_BANK0, pac.PADS_BANK0,
sio.gpio_bank0, sio.gpio_bank0,

View file

@ -3,12 +3,12 @@
use panic_halt as _; use panic_halt as _;
#[rtic::app(device = pico::hal::pac, peripherals = true)] #[rtic::app(device = rp_pico::hal::pac, peripherals = true)]
mod app { mod app {
use embedded_hal::digital::v2::OutputPin; use embedded_hal::digital::v2::OutputPin;
use embedded_time::duration::Extensions; use embedded_time::duration::Extensions;
use pico::{ use rp_pico::{
hal::{self, clocks::init_clocks_and_plls, watchdog::Watchdog, Sio}, hal::{self, clocks::init_clocks_and_plls, watchdog::Watchdog, Sio},
XOSC_CRYSTAL_FREQ, XOSC_CRYSTAL_FREQ,
}; };
@ -42,7 +42,7 @@ mod app {
.unwrap(); .unwrap();
let sio = Sio::new(c.device.SIO); let sio = Sio::new(c.device.SIO);
let pins = pico::Pins::new( let pins = rp_pico::Pins::new(
c.device.IO_BANK0, c.device.IO_BANK0,
c.device.PADS_BANK0, c.device.PADS_BANK0,
sio.gpio_bank0, sio.gpio_bank0,

View file

@ -21,11 +21,11 @@ use panic_halt as _;
// A shorter alias for the Peripheral Access Crate, which provides low-level // A shorter alias for the Peripheral Access Crate, which provides low-level
// register access // register access
use pico::hal::pac; use rp_pico::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides // A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers. // higher-level drivers.
use pico::hal; use rp_pico::hal;
// USB Device support // USB Device support
use usb_device::{class_prelude::*, prelude::*}; use usb_device::{class_prelude::*, prelude::*};
@ -52,7 +52,7 @@ fn main() -> ! {
// //
// The default is to generate a 125 MHz system clock // The default is to generate a 125 MHz system clock
let clocks = hal::clocks::init_clocks_and_plls( let clocks = hal::clocks::init_clocks_and_plls(
pico::XOSC_CRYSTAL_FREQ, rp_pico::XOSC_CRYSTAL_FREQ,
pac.XOSC, pac.XOSC,
pac.CLOCKS, pac.CLOCKS,
pac.PLL_SYS, pac.PLL_SYS,

View file

@ -16,7 +16,7 @@
use cortex_m_rt::entry; use cortex_m_rt::entry;
// The macro for marking our interrupt functions // The macro for marking our interrupt functions
use pico::hal::pac::interrupt; use rp_pico::hal::pac::interrupt;
// GPIO traits // GPIO traits
use embedded_hal::digital::v2::OutputPin; use embedded_hal::digital::v2::OutputPin;
@ -29,15 +29,15 @@ use embedded_time::rate::*;
use panic_halt as _; use panic_halt as _;
// Pull in any important traits // Pull in any important traits
use pico::hal::prelude::*; use rp_pico::hal::prelude::*;
// A shorter alias for the Peripheral Access Crate, which provides low-level // A shorter alias for the Peripheral Access Crate, which provides low-level
// register access // register access
use pico::hal::pac; use rp_pico::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides // A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers. // higher-level drivers.
use pico::hal; use rp_pico::hal;
// USB Device support // USB Device support
use usb_device::{class_prelude::*, prelude::*}; use usb_device::{class_prelude::*, prelude::*};
@ -74,7 +74,7 @@ fn main() -> ! {
// //
// The default is to generate a 125 MHz system clock // The default is to generate a 125 MHz system clock
let clocks = hal::clocks::init_clocks_and_plls( let clocks = hal::clocks::init_clocks_and_plls(
pico::XOSC_CRYSTAL_FREQ, rp_pico::XOSC_CRYSTAL_FREQ,
pac.XOSC, pac.XOSC,
pac.CLOCKS, pac.CLOCKS,
pac.PLL_SYS, pac.PLL_SYS,
@ -137,7 +137,7 @@ fn main() -> ! {
let sio = hal::Sio::new(pac.SIO); let sio = hal::Sio::new(pac.SIO);
// Set the pins up according to their function on this particular board // Set the pins up according to their function on this particular board
let pins = pico::Pins::new( let pins = rp_pico::Pins::new(
pac.IO_BANK0, pac.IO_BANK0,
pac.PADS_BANK0, pac.PADS_BANK0,
sio.gpio_bank0, sio.gpio_bank0,

View file

@ -18,7 +18,7 @@
use cortex_m_rt::entry; use cortex_m_rt::entry;
// The macro for marking our interrupt functions // The macro for marking our interrupt functions
use pico::hal::pac::interrupt; use rp_pico::hal::pac::interrupt;
// Ensure we halt the program on panic (if we don't mention this crate it won't // Ensure we halt the program on panic (if we don't mention this crate it won't
// be linked) // be linked)
@ -26,15 +26,15 @@ use panic_halt as _;
// Pull in any important traits // Pull in any important traits
use embedded_time::fixed_point::FixedPoint; use embedded_time::fixed_point::FixedPoint;
use pico::hal::prelude::*; use rp_pico::hal::prelude::*;
// A shorter alias for the Peripheral Access Crate, which provides low-level // A shorter alias for the Peripheral Access Crate, which provides low-level
// register access // register access
use pico::hal::pac; use rp_pico::hal::pac;
// A shorter alias for the Hardware Abstraction Layer, which provides // A shorter alias for the Hardware Abstraction Layer, which provides
// higher-level drivers. // higher-level drivers.
use pico::hal; use rp_pico::hal;
// USB Device support // USB Device support
use usb_device::{class_prelude::*, prelude::*}; use usb_device::{class_prelude::*, prelude::*};
@ -72,7 +72,7 @@ fn main() -> ! {
// //
// The default is to generate a 125 MHz system clock // The default is to generate a 125 MHz system clock
let clocks = hal::clocks::init_clocks_and_plls( let clocks = hal::clocks::init_clocks_and_plls(
pico::XOSC_CRYSTAL_FREQ, rp_pico::XOSC_CRYSTAL_FREQ,
pac.XOSC, pac.XOSC,
pac.CLOCKS, pac.CLOCKS,
pac.PLL_SYS, pac.PLL_SYS,

View file

@ -0,0 +1,23 @@
# 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]
### Added
- None
### Changed
- None
## [0.1.0] - 2021-12-20
- Initial release
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/sparkfun-pro-micro-rp2040-v0.1.0...HEAD
[0.1.0]: https://github.com/rp-rs/rp-hal/releases/tag/sparkfun-pro-micro-rp2040-v0.1.0

View file

@ -1,11 +1,12 @@
[package] [package]
name = "pro_micro_rp2040" name = "sparkfun-pro-micro-rp2040"
version = "0.1.0" version = "0.1.0"
authors = ["Wilfried Chauveau <wilfried.chauveau@ithinuel.me>"] authors = ["Wilfried Chauveau <wilfried.chauveau@ithinuel.me>"]
edition = "2018" edition = "2018"
homepage = "https://github.com/rp-rs/rp-hal/boards/pro_micro_rp2040" homepage = "https://github.com/rp-rs/rp-hal/tree/main/boards/sparkfun-pro-micro-rp2040"
description = "Board Support Package for the Sparkfun Pro Micro RP2040" description = "Board Support Package for the Sparkfun Pro Micro RP2040"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rp-rs/rp-hal.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,13 +1,14 @@
# [pro_micro_rp2040] - Board Support for the [Sparkfun Pro Micro 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 You should include this crate if you are writing code that you want to run on
a [Sparkfun Pro Micro RP2040] - a smaller [RP2040][Raspberry Silicon RP2040] board with USB-C and a WS2812B addressable LED. a [Sparkfun Pro Micro RP2040] - a smaller [RP2040][Raspberry Silicon RP2040]
board with USB-C and a WS2812B addressable LED.
This crate includes the [rp2040-hal], but also configures each pin of the 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. 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://www.sparkfun.com/products/18288
[pro_micro_rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/pro_micro_rp2040 [sparkfun-pro-micro-rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/sparkfun-pro-micro-rp2040
[rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal [rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal
[Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/ [Raspberry Silicon RP2040]: https://www.raspberrypi.org/products/rp2040/
@ -16,10 +17,10 @@ RP2040 chip according to how it is connected up on the Pro Micro RP2040.
To use this crate, your `Cargo.toml` file should contain: To use this crate, your `Cargo.toml` file should contain:
```toml ```toml
pro_micro_rp2040 = { git = "https://github.com/rp-rs/rp-hal.git" } sparkfun-pro-micro-rp2040 = "0.1.0"
``` ```
In your program, you will need to call `pro_micro_rp2040::Pins::new` to create In your program, you will need to call `sparkfun_pro_micro_rp2040::Pins::new` to create
a new `Pins` structure. This will set up all the GPIOs for any on-board a new `Pins` structure. This will set up all the GPIOs for any on-board
devices. See the [examples](./examples) folder for more details. devices. See the [examples](./examples) folder for more details.
@ -30,7 +31,7 @@ devices. See the [examples](./examples) folder for more details.
To compile an example, clone the _rp-hal_ repository and run: To compile an example, clone the _rp-hal_ repository and run:
```console ```console
rp-hal/boards/pro_micro_rp2040 $ cargo build --release --example <name> rp-hal/boards/sparkfun-pro-micro-rp2040 $ cargo build --release --example <name>
``` ```
You will get an ELF file called You will get an ELF file called
@ -44,7 +45,7 @@ USB drive exported by the RP2040 bootloader, simply boot your board into
bootloader mode and run: bootloader mode and run:
```console ```console
rp-hal/boards/pro_micro_rp2040 $ cargo run --release --example <name> rp-hal/boards/sparkfun-pro-micro-rp2040 $ cargo run --release --example <name>
``` ```
If you get an error about not being able to find `elf2uf2-rs`, try: If you get an error about not being able to find `elf2uf2-rs`, try:
@ -53,7 +54,7 @@ If you get an error about not being able to find `elf2uf2-rs`, try:
$ cargo install elf2uf2-rs, then repeating the `cargo run` command above. $ cargo install elf2uf2-rs, then repeating the `cargo run` command above.
``` ```
### [Rainbow](./examples/pro_micro_rainbow.rs) ### [Rainbow](./examples/sparkfun_pro_micro_rainbow.rs)
This example will display a colour-wheel rainbow effect on the on-board LED. This example will display a colour-wheel rainbow effect on the on-board LED.

View file

@ -14,7 +14,8 @@ use embedded_hal::timer::CountDown;
use embedded_time::duration::Extensions; use embedded_time::duration::Extensions;
use panic_halt as _; use panic_halt as _;
use pro_micro_rp2040::{ use smart_leds::{brightness, SmartLedsWrite, RGB8};
use sparkfun_pro_micro_rp2040::{
hal::{ hal::{
clocks::{init_clocks_and_plls, Clock}, clocks::{init_clocks_and_plls, Clock},
pac, pac,
@ -25,7 +26,6 @@ use pro_micro_rp2040::{
}, },
XOSC_CRYSTAL_FREQ, XOSC_CRYSTAL_FREQ,
}; };
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812; use ws2812_pio::Ws2812;
/// Entry point to our bare-metal application. /// Entry point to our bare-metal application.
@ -56,7 +56,7 @@ fn main() -> ! {
let sio = Sio::new(pac.SIO); let sio = Sio::new(pac.SIO);
let pins = pro_micro_rp2040::Pins::new( let pins = sparkfun_pro_micro_rp2040::Pins::new(
pac.IO_BANK0, pac.IO_BANK0,
pac.PADS_BANK0, pac.PADS_BANK0,
sio.gpio_bank0, sio.gpio_bank0,

View file

@ -35,7 +35,7 @@
//! ``` //! ```
//! //!
//! See [examples/adc.rs](https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal/examples/adc.rs) and //! See [examples/adc.rs](https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal/examples/adc.rs) and
//! [pico_explorer_showcase.rs](https://github.com/rp-rs/rp-hal/tree/main/boards/pico_explorer/examples/pico_explorer_showcase.rs) for more complete examples //! [pimoroni_pico_explorer_showcase.rs](https://github.com/rp-rs/rp-hal/tree/main/boards/pimoroni_pico_explorer/examples/pimoroni_pico_explorer_showcase.rs) for more complete examples
use hal::adc::{Channel, OneShot}; use hal::adc::{Channel, OneShot};
use pac::{ADC, RESETS}; use pac::{ADC, RESETS};