diff --git a/Cargo.toml b/Cargo.toml index 7721fe8..721b9ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,15 +2,15 @@ resolver = "2" members = [ "rp2040-hal", - "boards/feather_rp2040", - "boards/qt_py_rp2040", - "boards/itsy_bitsy_rp2040", - "boards/kb2040", - "boards/pico", - "boards/pico_explorer", - "boards/pico_lipo_16mb", - "boards/adafruit_macropad", - "boards/pro_micro_rp2040", + "boards/adafruit-feather-rp2040", + "boards/adafruit-itsy-bitsy-rp2040", + "boards/adafruit-kb2040", + "boards/adafruit-macropad", + "boards/adafruit-qt-py-rp2040", + "boards/pimoroni-pico-explorer", + "boards/pimoroni-pico-lipo-16mb", + "boards/rp-pico", + "boards/sparkfun-pro-micro-rp2040", ] [patch.'https://github.com/rp-rs/rp-hal.git'] diff --git a/README.md b/README.md index d1f79dc..5cd7674 100644 --- a/README.md +++ b/README.md @@ -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/ [pico]: https://github.com/rp-rs/rp-hal/tree/main/boards/pico -### [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 - -### [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 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. [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 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 RP2040 chip according to how it is connected up on the Pico Explorer. -[Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pico-explorer-base -[pico_explorer]: https://github.com/rp-rs/rp-hal/tree/main/boards/pico_explorer +[Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pimoroni-pico-explorer-base +[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 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. [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 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. [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 - -### [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 +[sparkfun-pro-micro-rp2040]: https://github.com/rp-rs/rp-hal/tree/main/boards/sparkfun_pro_micro_rp2040 ## Programming diff --git a/boards/adafruit-feather-rp2040/CHANGELOG.md b/boards/adafruit-feather-rp2040/CHANGELOG.md new file mode 100644 index 0000000..25f2848 --- /dev/null +++ b/boards/adafruit-feather-rp2040/CHANGELOG.md @@ -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 diff --git a/boards/feather_rp2040/Cargo.toml b/boards/adafruit-feather-rp2040/Cargo.toml similarity index 83% rename from boards/feather_rp2040/Cargo.toml rename to boards/adafruit-feather-rp2040/Cargo.toml index 5c2dcf2..0f3b6a3 100644 --- a/boards/feather_rp2040/Cargo.toml +++ b/boards/adafruit-feather-rp2040/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "feather_rp2040" +name = "adafruit-feather-rp2040" version = "0.1.0" authors = ["Andrea Nall "] 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" 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 diff --git a/boards/feather_rp2040/README.md b/boards/adafruit-feather-rp2040/README.md similarity index 83% rename from boards/feather_rp2040/README.md rename to boards/adafruit-feather-rp2040/README.md index 8dd6bdf..9aabfce 100644 --- a/boards/feather_rp2040/README.md +++ b/boards/adafruit-feather-rp2040/README.md @@ -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 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. [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 [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: ```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 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: ```console -rp-hal/boards/feather_rp2040 $ cargo build --release --example +rp-hal/boards/adafruit-feather-rp2040 $ cargo build --release --example ``` 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: ```console -rp-hal/boards/feather_rp2040 $ cargo run --release --example +rp-hal/boards/adafruit-feather-rp2040 $ cargo run --release --example ``` 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. ``` -### [feather_blinky](./examples/feather_blinky.rs) +### [adafruit_feather_blinky](./examples/adafruit_feather_blinky.rs) 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. diff --git a/boards/feather_rp2040/examples/feather_blinky.rs b/boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs similarity index 97% rename from boards/feather_rp2040/examples/feather_blinky.rs rename to boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs index 1bd1516..d41d650 100644 --- a/boards/feather_rp2040/examples/feather_blinky.rs +++ b/boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs @@ -4,10 +4,7 @@ #![no_std] #![no_main] -use cortex_m_rt::entry; -use embedded_hal::digital::v2::OutputPin; -use embedded_time::rate::*; -use feather_rp2040::{ +use adafruit_feather_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, @@ -16,6 +13,9 @@ use feather_rp2040::{ }, Pins, XOSC_CRYSTAL_FREQ, }; +use cortex_m_rt::entry; +use embedded_hal::digital::v2::OutputPin; +use embedded_time::rate::*; use panic_halt as _; #[entry] diff --git a/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs similarity index 98% rename from boards/feather_rp2040/examples/feather_neopixel_rainbow.rs rename to boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs index 0d0bc45..019ebbf 100644 --- a/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs +++ b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs @@ -6,11 +6,7 @@ #![no_std] #![no_main] -use core::iter::once; -use cortex_m_rt::entry; -use embedded_hal::timer::CountDown; -use embedded_time::duration::Extensions; -use feather_rp2040::{ +use adafruit_feather_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, @@ -21,6 +17,10 @@ use feather_rp2040::{ }, 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 smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; diff --git a/boards/feather_rp2040/src/lib.rs b/boards/adafruit-feather-rp2040/src/lib.rs similarity index 100% rename from boards/feather_rp2040/src/lib.rs rename to boards/adafruit-feather-rp2040/src/lib.rs diff --git a/boards/adafruit-itsy-bitsy-rp2040/CHANGELOG.md b/boards/adafruit-itsy-bitsy-rp2040/CHANGELOG.md new file mode 100644 index 0000000..b54a3e8 --- /dev/null +++ b/boards/adafruit-itsy-bitsy-rp2040/CHANGELOG.md @@ -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 diff --git a/boards/itsy_bitsy_rp2040/Cargo.toml b/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml similarity index 83% rename from boards/itsy_bitsy_rp2040/Cargo.toml rename to boards/adafruit-itsy-bitsy-rp2040/Cargo.toml index 4b308df..2304182 100644 --- a/boards/itsy_bitsy_rp2040/Cargo.toml +++ b/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "itsy_bitsy_rp2040" +name = "adafruit-itsy-bitsy-rp2040" version = "0.1.0" authors = ["Andrew Christiansen "] 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" 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 diff --git a/boards/itsy_bitsy_rp2040/README.md b/boards/adafruit-itsy-bitsy-rp2040/README.md similarity index 82% rename from boards/itsy_bitsy_rp2040/README.md rename to boards/adafruit-itsy-bitsy-rp2040/README.md index f640609..5d16b42 100644 --- a/boards/itsy_bitsy_rp2040/README.md +++ b/boards/adafruit-itsy-bitsy-rp2040/README.md @@ -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 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. [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 [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: ```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 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: ```console -rp-hal/boards/itsy_bitsy_rp2040 $ cargo build --release --example +rp-hal/boards/adafruit-itsy-bitsy-rp2040 $ cargo build --release --example ``` 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: ```console -rp-hal/boards/itsy_bitsy_rp2040 $ cargo run --release --example +rp-hal/boards/adafruit-itsy-bitsy-rp2040 $ cargo run --release --example ``` 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. ``` -### [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. diff --git a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs similarity index 98% rename from boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs rename to boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs index 9f0ff70..5350994 100644 --- a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs +++ b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs @@ -20,7 +20,7 @@ use panic_halt as _; use embedded_hal::digital::v2::OutputPin; use embedded_time::fixed_point::FixedPoint; -use itsy_bitsy_rp2040::{ +use adafruit_itsy_bitsy_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, diff --git a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs similarity index 98% rename from boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs rename to boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs index 59d8cec..f9f71ae 100644 --- a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs +++ b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs @@ -11,7 +11,7 @@ use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; -use itsy_bitsy_rp2040::{ +use adafruit_itsy_bitsy_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, diff --git a/boards/itsy_bitsy_rp2040/src/lib.rs b/boards/adafruit-itsy-bitsy-rp2040/src/lib.rs similarity index 100% rename from boards/itsy_bitsy_rp2040/src/lib.rs rename to boards/adafruit-itsy-bitsy-rp2040/src/lib.rs diff --git a/boards/adafruit-kb2040/CHANGELOG.md b/boards/adafruit-kb2040/CHANGELOG.md new file mode 100644 index 0000000..24cd4ec --- /dev/null +++ b/boards/adafruit-kb2040/CHANGELOG.md @@ -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 diff --git a/boards/kb2040/Cargo.toml b/boards/adafruit-kb2040/Cargo.toml similarity index 77% rename from boards/kb2040/Cargo.toml rename to boards/adafruit-kb2040/Cargo.toml index 5a3794c..dcb29f4 100644 --- a/boards/kb2040/Cargo.toml +++ b/boards/adafruit-kb2040/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "kb2040" +name = "adafruit-kb2040" version = "0.1.0" authors = ["Andrew Christiansen "] edition = "2018" -homepage = "https://github.com/rp-rs/rp-hal/boards/kb2040" -description = "Board Support Package for the Adafruit KB2040" +homepage = "https://github.com/rp-rs/rp-hal/tree/main/boards/adafruit-kb2040" +description = "Board Support Package for the Adafruit adafruit-kb2040" 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 diff --git a/boards/kb2040/README.md b/boards/adafruit-kb2040/README.md similarity index 87% rename from boards/kb2040/README.md rename to boards/adafruit-kb2040/README.md index 266af8a..808cb42 100644 --- a/boards/kb2040/README.md +++ b/boards/adafruit-kb2040/README.md @@ -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 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. [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 [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: ```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 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: ```console -rp-hal/boards/kb2040 $ cargo build --release --example +rp-hal/boards/adafruit-kb2040 $ cargo build --release --example ``` 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: ```console -rp-hal/boards/kb2040$ cargo run --release --example +rp-hal/boards/adafruit-kb2040$ cargo run --release --example ``` 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. ``` -### [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. diff --git a/boards/kb2040/examples/kb2040_rainbow.rs b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs similarity index 97% rename from boards/kb2040/examples/kb2040_rainbow.rs rename to boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs index f62e1c5..d64dc39 100644 --- a/boards/kb2040/examples/kb2040_rainbow.rs +++ b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs @@ -14,7 +14,7 @@ use embedded_hal::timer::CountDown; use embedded_time::duration::Extensions; use panic_halt as _; -use kb2040::{ +use adafruit_kb2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, @@ -62,7 +62,7 @@ fn main() -> ! { let sio = Sio::new(pac.SIO); - let pins = kb2040::Pins::new( + let pins = adafruit_kb2040::Pins::new( pac.IO_BANK0, pac.PADS_BANK0, sio.gpio_bank0, diff --git a/boards/kb2040/src/lib.rs b/boards/adafruit-kb2040/src/lib.rs similarity index 100% rename from boards/kb2040/src/lib.rs rename to boards/adafruit-kb2040/src/lib.rs diff --git a/boards/adafruit-macropad/CHANGELOG.md b/boards/adafruit-macropad/CHANGELOG.md new file mode 100644 index 0000000..7e7d0a9 --- /dev/null +++ b/boards/adafruit-macropad/CHANGELOG.md @@ -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 diff --git a/boards/adafruit_macropad/Cargo.toml b/boards/adafruit-macropad/Cargo.toml similarity index 78% rename from boards/adafruit_macropad/Cargo.toml rename to boards/adafruit-macropad/Cargo.toml index 6ceb84f..b8f850c 100644 --- a/boards/adafruit_macropad/Cargo.toml +++ b/boards/adafruit-macropad/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "adafruit_macropad" +name = "adafruit-macropad" version = "0.1.0" authors = ["Andrea Nall "] 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" 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 diff --git a/boards/adafruit_macropad/README.md b/boards/adafruit-macropad/README.md similarity index 87% rename from boards/adafruit_macropad/README.md rename to boards/adafruit-macropad/README.md index b5875dd..f4912da 100644 --- a/boards/adafruit_macropad/README.md +++ b/boards/adafruit-macropad/README.md @@ -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 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 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 [rp2040-hal]: https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal [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: ```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 @@ -30,7 +30,7 @@ devices. See the [examples](./examples) folder for more details. To compile an example, clone the _rp-hal_ repository and run: ```console -rp-hal/boards/adafruit_macropad $ cargo build --release --example +rp-hal/boards/adafruit-macropad $ cargo build --release --example ``` 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: ```console -rp-hal/boards/adafruit_macropad $ cargo run --release --example +rp-hal/boards/adafruit-macropad $ cargo run --release --example ``` 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. ``` -### [feather_blinky](./examples/feather_blinky.rs) - -Flashes the Feather's on-board LED on and off. - ## Contributing Contributions are what make the open source community such an amazing place to diff --git a/boards/adafruit_macropad/src/lib.rs b/boards/adafruit-macropad/src/lib.rs similarity index 100% rename from boards/adafruit_macropad/src/lib.rs rename to boards/adafruit-macropad/src/lib.rs diff --git a/boards/adafruit-qt-py-rp2040/CHANGELOG.md b/boards/adafruit-qt-py-rp2040/CHANGELOG.md new file mode 100644 index 0000000..799f4a7 --- /dev/null +++ b/boards/adafruit-qt-py-rp2040/CHANGELOG.md @@ -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 diff --git a/boards/qt_py_rp2040/Cargo.toml b/boards/adafruit-qt-py-rp2040/Cargo.toml similarity index 83% rename from boards/qt_py_rp2040/Cargo.toml rename to boards/adafruit-qt-py-rp2040/Cargo.toml index d4aee7c..9acaef9 100644 --- a/boards/qt_py_rp2040/Cargo.toml +++ b/boards/adafruit-qt-py-rp2040/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "qt_py_rp2040" +name = "adafruit-qt-py-rp2040" version = "0.1.0" authors = ["Stephen Onnen "] 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" 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 diff --git a/boards/qt_py_rp2040/README.md b/boards/adafruit-qt-py-rp2040/README.md similarity index 84% rename from boards/qt_py_rp2040/README.md rename to boards/adafruit-qt-py-rp2040/README.md index 32f5489..c3250d4 100644 --- a/boards/qt_py_rp2040/README.md +++ b/boards/adafruit-qt-py-rp2040/README.md @@ -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 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. [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 [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: ```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 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: ```console -rp-hal/boards/qt_py_rp2040 $ cargo build --release --example +rp-hal/boards/adafruit-qt-py-rp2040 $ cargo build --release --example ``` 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: ```console -rp-hal/boards/qt_py_rp2040 $ cargo run --release --example +rp-hal/boards/adafruit-qt-py-rp2040 $ cargo run --release --example ``` 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. ``` -### [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. diff --git a/boards/qt_py_rp2040/examples/qt_py_rainbow.rs b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs similarity index 98% rename from boards/qt_py_rp2040/examples/qt_py_rainbow.rs rename to boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs index f6d881f..e445d7e 100644 --- a/boards/qt_py_rp2040/examples/qt_py_rainbow.rs +++ b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs @@ -11,7 +11,7 @@ use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; -use qt_py_rp2040::{ +use adafruit_qt_py_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, diff --git a/boards/qt_py_rp2040/src/lib.rs b/boards/adafruit-qt-py-rp2040/src/lib.rs similarity index 100% rename from boards/qt_py_rp2040/src/lib.rs rename to boards/adafruit-qt-py-rp2040/src/lib.rs diff --git a/boards/pico/examples/pico_i2c_controller_peripheral/controller.rs b/boards/pico/examples/pico_i2c_controller_peripheral/controller.rs deleted file mode 100644 index 5c2ad2e..0000000 --- a/boards/pico/examples/pico_i2c_controller_peripheral/controller.rs +++ /dev/null @@ -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(i2c: &mut I2C) -> Result<(), rp2040_hal::i2c::Error> -where - Block: Deref, -{ - 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(()) -} diff --git a/boards/pico/examples/pico_i2c_controller_peripheral/main.rs b/boards/pico/examples/pico_i2c_controller_peripheral/main.rs deleted file mode 100644 index 9ae2471..0000000 --- a/boards/pico/examples/pico_i2c_controller_peripheral/main.rs +++ /dev/null @@ -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, - Pin, - ), - >, -) { - controller::run_demo(&mut i2c).await.expect("Demo failed") -} - -#[embassy::task] -async fn prph_demo( - mut i2c: I2CPeripheralEventIterator< - pac::I2C1, - ( - Pin, - Pin, - ), - >, -) { - 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 = Forever::new(); - let executor = EXECUTOR.put(Executor::new()); - - executor.run(|spawner| { - spawner.spawn(ctrl_demo(i2c0)).unwrap(); - spawner.spawn(prph_demo(i2c1)).unwrap(); - }); -} diff --git a/boards/pico/examples/pico_i2c_controller_peripheral/peripheral.rs b/boards/pico/examples/pico_i2c_controller_peripheral/peripheral.rs deleted file mode 100644 index eb2cc43..0000000 --- a/boards/pico/examples/pico_i2c_controller_peripheral/peripheral.rs +++ /dev/null @@ -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( - i2c: &mut I2CPeripheralEventIterator, -) -> Result<(), rp2040_hal::i2c::Error> -where - Block: Deref, -{ - 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(()) -} diff --git a/boards/pimoroni-pico-explorer/CHANGELOG.md b/boards/pimoroni-pico-explorer/CHANGELOG.md new file mode 100644 index 0000000..e2e2069 --- /dev/null +++ b/boards/pimoroni-pico-explorer/CHANGELOG.md @@ -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 diff --git a/boards/pico_explorer/Cargo.toml b/boards/pimoroni-pico-explorer/Cargo.toml similarity index 84% rename from boards/pico_explorer/Cargo.toml rename to boards/pimoroni-pico-explorer/Cargo.toml index 58d1575..b53f79f 100644 --- a/boards/pico_explorer/Cargo.toml +++ b/boards/pimoroni-pico-explorer/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "pico_explorer" +name = "pimoroni-pico-explorer" version = "0.1.0" authors = ["Hmvp "] 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" 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 diff --git a/boards/pico_explorer/README.md b/boards/pimoroni-pico-explorer/README.md similarity index 83% rename from boards/pico_explorer/README.md rename to boards/pimoroni-pico-explorer/README.md index 25e99e1..7e96a36 100644 --- a/boards/pico_explorer/README.md +++ b/boards/pimoroni-pico-explorer/README.md @@ -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 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 RP2040 chip according to how it is connected up on the Pico Explorer. -[Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pico-explorer-base -[pico_explorer]: https://github.com/rp-rs/rp-hal/tree/main/boards/pico_explorer +[Pimoroni Pico Explorer]: https://shop.pimoroni.com/products/pimoroni-pico-explorer-base +[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 [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: ```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 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: ```console -rp-hal/boards/pico_explorer $ cargo build --release --example +rp-hal/boards/pimoroni-pico-explorer $ cargo build --release --example ``` 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: ```console -rp-hal/boards/pico_explorer $ cargo run --release --example +rp-hal/boards/pimoroni-pico-explorer $ cargo run --release --example ``` 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. ``` -### [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. diff --git a/boards/pico_explorer/examples/pico_explorer_showcase.rs b/boards/pimoroni-pico-explorer/examples/pimoroni_pico_explorer_showcase.rs similarity index 97% rename from boards/pico_explorer/examples/pico_explorer_showcase.rs rename to boards/pimoroni-pico-explorer/examples/pimoroni_pico_explorer_showcase.rs index 21dd0ce..72b2009 100644 --- a/boards/pico_explorer/examples/pico_explorer_showcase.rs +++ b/boards/pimoroni-pico-explorer/examples/pimoroni_pico_explorer_showcase.rs @@ -14,7 +14,7 @@ use embedded_hal::digital::v2::OutputPin; use embedded_time::rate::*; use hal::{adc::Adc, clocks::*, watchdog::Watchdog, Sio}; 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 fn calc_temp(adc_value: f32, refv: f64) -> f64 { diff --git a/boards/pico_explorer/src/lib.rs b/boards/pimoroni-pico-explorer/src/lib.rs similarity index 100% rename from boards/pico_explorer/src/lib.rs rename to boards/pimoroni-pico-explorer/src/lib.rs diff --git a/boards/pimoroni-pico-lipo-16mb/CHANGELOG.md b/boards/pimoroni-pico-lipo-16mb/CHANGELOG.md new file mode 100644 index 0000000..8ccb686 --- /dev/null +++ b/boards/pimoroni-pico-lipo-16mb/CHANGELOG.md @@ -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 diff --git a/boards/pico_lipo_16mb/Cargo.toml b/boards/pimoroni-pico-lipo-16mb/Cargo.toml similarity index 73% rename from boards/pico_lipo_16mb/Cargo.toml rename to boards/pimoroni-pico-lipo-16mb/Cargo.toml index e834c9a..d248a52 100644 --- a/boards/pico_lipo_16mb/Cargo.toml +++ b/boards/pimoroni-pico-lipo-16mb/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "pico_lipo_16_mb" +name = "pimoroni-pico-lipo-16mb" version = "0.1.0" authors = ["Hmvp "] edition = "2018" -homepage = "https://github.com/rp-rs/rp-hal/boards/pico_lipo_16_mb" -description = "Board Support Package for the 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 16MB" 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 diff --git a/boards/pico_lipo_16mb/README.md b/boards/pimoroni-pico-lipo-16mb/README.md similarity index 84% rename from boards/pico_lipo_16mb/README.md rename to boards/pimoroni-pico-lipo-16mb/README.md index c1a3317..0c8055d 100644 --- a/boards/pico_lipo_16mb/README.md +++ b/boards/pimoroni-pico-lipo-16mb/README.md @@ -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 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. [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 To use this crate, your `Cargo.toml` file should contain: ```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 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: ```console -rp-hal/boards/pico_lipo_16mb $ cargo build --release --example +rp-hal/boards/pimoroni-pico-lipo-16mb $ cargo build --release --example ``` 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: ```console -rp-hal/boards/pico_lipo_16mb $ cargo run --release --example +rp-hal/boards/pimoroni-pico-lipo-16mb $ cargo run --release --example ``` 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. ``` -### [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. diff --git a/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs b/boards/pimoroni-pico-lipo-16mb/examples/pimoroni_pico_lipo_16mb_blinky.rs similarity index 91% rename from boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs rename to boards/pimoroni-pico-lipo-16mb/examples/pimoroni_pico_lipo_16mb_blinky.rs index f5e7a8c..9674e9d 100644 --- a/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs +++ b/boards/pimoroni-pico-lipo-16mb/examples/pimoroni_pico_lipo_16mb_blinky.rs @@ -24,15 +24,15 @@ use embedded_time::rate::*; use panic_halt as _; // 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 // 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 // higher-level drivers. -use pico_lipo_16_mb::hal; +use pimoroni_pico_lipo_16mb::hal; /// Entry point to our bare-metal application. /// @@ -54,7 +54,7 @@ fn main() -> ! { // // The default is to generate a 125 MHz system clock 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.CLOCKS, pac.PLL_SYS, @@ -73,7 +73,7 @@ fn main() -> ! { let sio = hal::Sio::new(pac.SIO); // 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.PADS_BANK0, sio.gpio_bank0, diff --git a/boards/pico_lipo_16mb/src/lib.rs b/boards/pimoroni-pico-lipo-16mb/src/lib.rs similarity index 100% rename from boards/pico_lipo_16mb/src/lib.rs rename to boards/pimoroni-pico-lipo-16mb/src/lib.rs diff --git a/boards/pico/.gitignore b/boards/rp-pico/.gitignore similarity index 100% rename from boards/pico/.gitignore rename to boards/rp-pico/.gitignore diff --git a/boards/rp-pico/CHANGELOG.md b/boards/rp-pico/CHANGELOG.md new file mode 100644 index 0000000..a7f1cf8 --- /dev/null +++ b/boards/rp-pico/CHANGELOG.md @@ -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 diff --git a/boards/pico/Cargo.toml b/boards/rp-pico/Cargo.toml similarity index 58% rename from boards/pico/Cargo.toml rename to boards/rp-pico/Cargo.toml index 066db5f..e12670f 100644 --- a/boards/pico/Cargo.toml +++ b/boards/rp-pico/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "pico" -version = "0.1.0" +name = "rp-pico" +version = "0.2.0" authors = ["evan "] 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" 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 @@ -20,19 +21,6 @@ usbd-serial = "0.1.1" usbd-hid = "0.5.1" 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] panic-halt= "0.2.0" embedded-hal ="0.2.5" @@ -44,8 +32,3 @@ i2c-pio = { git = "https://github.com/ithinuel/i2c-pio-rs", rev = "df06e4ac94a5b default = ["boot2", "rt"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] -embassy-traits = ["futures", "embassy", "embassy_traits"] - -[[example]] -name = "pico_i2c_controller_peripheral" -required-features = ["embassy-traits"] diff --git a/boards/pico/README.md b/boards/rp-pico/README.md similarity index 92% rename from boards/pico/README.md rename to boards/rp-pico/README.md index 5470fb4..1ce6229 100644 --- a/boards/pico/README.md +++ b/boards/rp-pico/README.md @@ -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 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. [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 [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: ```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 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: ```console -rp-hal/boards/pico $ cargo build --release --example +rp-hal/boards/rp-pico $ cargo build --release --example ``` 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: ```console -rp-hal/boards/pico $ cargo run --release --example +rp-hal/boards/rp-pico $ cargo run --release --example ``` If you get an error about not being able to find `elf2uf2-rs`, try: diff --git a/boards/pico/examples/pico_blinky.rs b/boards/rp-pico/examples/pico_blinky.rs similarity index 94% rename from boards/pico/examples/pico_blinky.rs rename to boards/rp-pico/examples/pico_blinky.rs index f6bf340..87c2b34 100644 --- a/boards/pico/examples/pico_blinky.rs +++ b/boards/rp-pico/examples/pico_blinky.rs @@ -24,15 +24,15 @@ use embedded_time::rate::*; use panic_halt as _; // 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 // register access -use pico::hal::pac; +use rp_pico::hal::pac; // A shorter alias for the Hardware Abstraction Layer, which provides // higher-level drivers. -use pico::hal; +use rp_pico::hal; /// Entry point to our bare-metal application. /// @@ -54,7 +54,7 @@ fn main() -> ! { // // The default is to generate a 125 MHz system clock let clocks = hal::clocks::init_clocks_and_plls( - pico::XOSC_CRYSTAL_FREQ, + rp_pico::XOSC_CRYSTAL_FREQ, pac.XOSC, pac.CLOCKS, pac.PLL_SYS, @@ -73,7 +73,7 @@ fn main() -> ! { let sio = hal::Sio::new(pac.SIO); // 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.PADS_BANK0, sio.gpio_bank0, diff --git a/boards/pico/examples/pico_countdown_blinky.rs b/boards/rp-pico/examples/pico_countdown_blinky.rs similarity index 95% rename from boards/pico/examples/pico_countdown_blinky.rs rename to boards/rp-pico/examples/pico_countdown_blinky.rs index 50bb1ce..15a79dd 100644 --- a/boards/pico/examples/pico_countdown_blinky.rs +++ b/boards/rp-pico/examples/pico_countdown_blinky.rs @@ -27,11 +27,11 @@ use panic_halt as _; // A shorter alias for the Peripheral Access Crate, which provides low-level // register access -use pico::hal::pac; +use rp_pico::hal::pac; // A shorter alias for the Hardware Abstraction Layer, which provides // higher-level drivers. -use pico::hal; +use rp_pico::hal; #[entry] fn main() -> ! { @@ -45,7 +45,7 @@ fn main() -> ! { // // The default is to generate a 125 MHz system clock let _clocks = hal::clocks::init_clocks_and_plls( - pico::XOSC_CRYSTAL_FREQ, + rp_pico::XOSC_CRYSTAL_FREQ, pac.XOSC, pac.CLOCKS, pac.PLL_SYS, @@ -64,7 +64,7 @@ fn main() -> ! { let sio = hal::Sio::new(pac.SIO); // 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.PADS_BANK0, sio.gpio_bank0, diff --git a/boards/pico/examples/pico_gpio_in_out.rs b/boards/rp-pico/examples/pico_gpio_in_out.rs similarity index 96% rename from boards/pico/examples/pico_gpio_in_out.rs rename to boards/rp-pico/examples/pico_gpio_in_out.rs index dfe15d3..fce0686 100644 --- a/boards/pico/examples/pico_gpio_in_out.rs +++ b/boards/rp-pico/examples/pico_gpio_in_out.rs @@ -24,11 +24,11 @@ use panic_halt as _; // A shorter alias for the Peripheral Access Crate, which provides low-level // register access -use pico::hal::pac; +use rp_pico::hal::pac; // A shorter alias for the Hardware Abstraction Layer, which provides // higher-level drivers. -use pico::hal; +use rp_pico::hal; /// Entry point to our bare-metal application. /// @@ -49,7 +49,7 @@ fn main() -> ! { let sio = hal::Sio::new(pac.SIO); // 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.PADS_BANK0, sio.gpio_bank0, diff --git a/boards/pico/examples/pico_i2c_pio.rs b/boards/rp-pico/examples/pico_i2c_pio.rs similarity index 96% rename from boards/pico/examples/pico_i2c_pio.rs rename to boards/rp-pico/examples/pico_i2c_pio.rs index 8eccbb4..6d350ee 100644 --- a/boards/pico/examples/pico_i2c_pio.rs +++ b/boards/rp-pico/examples/pico_i2c_pio.rs @@ -28,15 +28,15 @@ use embedded_time::rate::*; use panic_halt as _; // 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 // register access -use pico::hal::pac; +use rp_pico::hal::pac; // A shorter alias for the Hardware Abstraction Layer, which provides // higher-level drivers. -use pico::hal; +use rp_pico::hal; /// Prints the temperature received from the sensor 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 let clocks = hal::clocks::init_clocks_and_plls( - pico::XOSC_CRYSTAL_FREQ, + rp_pico::XOSC_CRYSTAL_FREQ, pac.XOSC, pac.CLOCKS, pac.PLL_SYS, @@ -81,7 +81,7 @@ fn main() -> ! { let sio = hal::Sio::new(pac.SIO); // 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.PADS_BANK0, sio.gpio_bank0, diff --git a/boards/pico/examples/pico_pwm_blink.rs b/boards/rp-pico/examples/pico_pwm_blink.rs similarity index 95% rename from boards/pico/examples/pico_pwm_blink.rs rename to boards/rp-pico/examples/pico_pwm_blink.rs index 2632a8e..5a0a986 100644 --- a/boards/pico/examples/pico_pwm_blink.rs +++ b/boards/rp-pico/examples/pico_pwm_blink.rs @@ -24,15 +24,15 @@ use embedded_time::rate::*; use panic_halt as _; // 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 // register access -use pico::hal::pac; +use rp_pico::hal::pac; // A shorter alias for the Hardware Abstraction Layer, which provides // higher-level drivers. -use pico::hal; +use rp_pico::hal; // The minimum PWM value (i.e. LED brightness) we want const LOW: u16 = 0; @@ -60,7 +60,7 @@ fn main() -> ! { // // The default is to generate a 125 MHz system clock let clocks = hal::clocks::init_clocks_and_plls( - pico::XOSC_CRYSTAL_FREQ, + rp_pico::XOSC_CRYSTAL_FREQ, pac.XOSC, pac.CLOCKS, pac.PLL_SYS, @@ -75,7 +75,7 @@ fn main() -> ! { let sio = hal::Sio::new(pac.SIO); // 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.PADS_BANK0, sio.gpio_bank0, diff --git a/boards/pico/examples/pico_rtic.rs b/boards/rp-pico/examples/pico_rtic.rs similarity index 94% rename from boards/pico/examples/pico_rtic.rs rename to boards/rp-pico/examples/pico_rtic.rs index 0cf61f2..83f172d 100644 --- a/boards/pico/examples/pico_rtic.rs +++ b/boards/rp-pico/examples/pico_rtic.rs @@ -3,12 +3,12 @@ use panic_halt as _; -#[rtic::app(device = pico::hal::pac, peripherals = true)] +#[rtic::app(device = rp_pico::hal::pac, peripherals = true)] mod app { use embedded_hal::digital::v2::OutputPin; use embedded_time::duration::Extensions; - use pico::{ + use rp_pico::{ hal::{self, clocks::init_clocks_and_plls, watchdog::Watchdog, Sio}, XOSC_CRYSTAL_FREQ, }; @@ -42,7 +42,7 @@ mod app { .unwrap(); let sio = Sio::new(c.device.SIO); - let pins = pico::Pins::new( + let pins = rp_pico::Pins::new( c.device.IO_BANK0, c.device.PADS_BANK0, sio.gpio_bank0, diff --git a/boards/pico/examples/pico_usb_serial.rs b/boards/rp-pico/examples/pico_usb_serial.rs similarity index 98% rename from boards/pico/examples/pico_usb_serial.rs rename to boards/rp-pico/examples/pico_usb_serial.rs index 5f745c6..b28dba2 100644 --- a/boards/pico/examples/pico_usb_serial.rs +++ b/boards/rp-pico/examples/pico_usb_serial.rs @@ -21,11 +21,11 @@ use panic_halt as _; // A shorter alias for the Peripheral Access Crate, which provides low-level // register access -use pico::hal::pac; +use rp_pico::hal::pac; // A shorter alias for the Hardware Abstraction Layer, which provides // higher-level drivers. -use pico::hal; +use rp_pico::hal; // USB Device support use usb_device::{class_prelude::*, prelude::*}; @@ -52,7 +52,7 @@ fn main() -> ! { // // The default is to generate a 125 MHz system clock let clocks = hal::clocks::init_clocks_and_plls( - pico::XOSC_CRYSTAL_FREQ, + rp_pico::XOSC_CRYSTAL_FREQ, pac.XOSC, pac.CLOCKS, pac.PLL_SYS, diff --git a/boards/pico/examples/pico_usb_serial_interrupt.rs b/boards/rp-pico/examples/pico_usb_serial_interrupt.rs similarity index 97% rename from boards/pico/examples/pico_usb_serial_interrupt.rs rename to boards/rp-pico/examples/pico_usb_serial_interrupt.rs index 016a660..d7e38e5 100644 --- a/boards/pico/examples/pico_usb_serial_interrupt.rs +++ b/boards/rp-pico/examples/pico_usb_serial_interrupt.rs @@ -16,7 +16,7 @@ use cortex_m_rt::entry; // The macro for marking our interrupt functions -use pico::hal::pac::interrupt; +use rp_pico::hal::pac::interrupt; // GPIO traits use embedded_hal::digital::v2::OutputPin; @@ -29,15 +29,15 @@ use embedded_time::rate::*; use panic_halt as _; // 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 // register access -use pico::hal::pac; +use rp_pico::hal::pac; // A shorter alias for the Hardware Abstraction Layer, which provides // higher-level drivers. -use pico::hal; +use rp_pico::hal; // USB Device support use usb_device::{class_prelude::*, prelude::*}; @@ -74,7 +74,7 @@ fn main() -> ! { // // The default is to generate a 125 MHz system clock let clocks = hal::clocks::init_clocks_and_plls( - pico::XOSC_CRYSTAL_FREQ, + rp_pico::XOSC_CRYSTAL_FREQ, pac.XOSC, pac.CLOCKS, pac.PLL_SYS, @@ -137,7 +137,7 @@ fn main() -> ! { let sio = hal::Sio::new(pac.SIO); // 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.PADS_BANK0, sio.gpio_bank0, diff --git a/boards/pico/examples/pico_usb_twitchy_mouse.rs b/boards/rp-pico/examples/pico_usb_twitchy_mouse.rs similarity index 97% rename from boards/pico/examples/pico_usb_twitchy_mouse.rs rename to boards/rp-pico/examples/pico_usb_twitchy_mouse.rs index cb2a659..09818b9 100644 --- a/boards/pico/examples/pico_usb_twitchy_mouse.rs +++ b/boards/rp-pico/examples/pico_usb_twitchy_mouse.rs @@ -18,7 +18,7 @@ use cortex_m_rt::entry; // 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 // be linked) @@ -26,15 +26,15 @@ use panic_halt as _; // Pull in any important traits 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 // register access -use pico::hal::pac; +use rp_pico::hal::pac; // A shorter alias for the Hardware Abstraction Layer, which provides // higher-level drivers. -use pico::hal; +use rp_pico::hal; // USB Device support use usb_device::{class_prelude::*, prelude::*}; @@ -72,7 +72,7 @@ fn main() -> ! { // // The default is to generate a 125 MHz system clock let clocks = hal::clocks::init_clocks_and_plls( - pico::XOSC_CRYSTAL_FREQ, + rp_pico::XOSC_CRYSTAL_FREQ, pac.XOSC, pac.CLOCKS, pac.PLL_SYS, diff --git a/boards/pico/src/lib.rs b/boards/rp-pico/src/lib.rs similarity index 100% rename from boards/pico/src/lib.rs rename to boards/rp-pico/src/lib.rs diff --git a/boards/sparkfun-pro-micro-rp2040/CHANGELOG.md b/boards/sparkfun-pro-micro-rp2040/CHANGELOG.md new file mode 100644 index 0000000..04fbbeb --- /dev/null +++ b/boards/sparkfun-pro-micro-rp2040/CHANGELOG.md @@ -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 diff --git a/boards/pro_micro_rp2040/Cargo.toml b/boards/sparkfun-pro-micro-rp2040/Cargo.toml similarity index 83% rename from boards/pro_micro_rp2040/Cargo.toml rename to boards/sparkfun-pro-micro-rp2040/Cargo.toml index 053cc38..fbfb776 100644 --- a/boards/pro_micro_rp2040/Cargo.toml +++ b/boards/sparkfun-pro-micro-rp2040/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "pro_micro_rp2040" +name = "sparkfun-pro-micro-rp2040" version = "0.1.0" authors = ["Wilfried Chauveau "] 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" 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 diff --git a/boards/pro_micro_rp2040/README.md b/boards/sparkfun-pro-micro-rp2040/README.md similarity index 83% rename from boards/pro_micro_rp2040/README.md rename to boards/sparkfun-pro-micro-rp2040/README.md index 60abd8c..a1d57d6 100644 --- a/boards/pro_micro_rp2040/README.md +++ b/boards/sparkfun-pro-micro-rp2040/README.md @@ -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 -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 RP2040 chip according to how it is connected up on the Pro Micro RP2040. [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 [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: ```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 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: ```console -rp-hal/boards/pro_micro_rp2040 $ cargo build --release --example +rp-hal/boards/sparkfun-pro-micro-rp2040 $ cargo build --release --example ``` 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: ```console -rp-hal/boards/pro_micro_rp2040 $ cargo run --release --example +rp-hal/boards/sparkfun-pro-micro-rp2040 $ cargo run --release --example ``` 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. ``` -### [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. diff --git a/boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs similarity index 97% rename from boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs rename to boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs index 55f1c37..a7df773 100644 --- a/boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs +++ b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs @@ -14,7 +14,8 @@ use embedded_hal::timer::CountDown; use embedded_time::duration::Extensions; use panic_halt as _; -use pro_micro_rp2040::{ +use smart_leds::{brightness, SmartLedsWrite, RGB8}; +use sparkfun_pro_micro_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, @@ -25,7 +26,6 @@ use pro_micro_rp2040::{ }, XOSC_CRYSTAL_FREQ, }; -use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; /// Entry point to our bare-metal application. @@ -56,7 +56,7 @@ fn main() -> ! { 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.PADS_BANK0, sio.gpio_bank0, diff --git a/boards/pro_micro_rp2040/src/lib.rs b/boards/sparkfun-pro-micro-rp2040/src/lib.rs similarity index 100% rename from boards/pro_micro_rp2040/src/lib.rs rename to boards/sparkfun-pro-micro-rp2040/src/lib.rs diff --git a/rp2040-hal/src/adc.rs b/rp2040-hal/src/adc.rs index 54804c2..cb9fbae 100644 --- a/rp2040-hal/src/adc.rs +++ b/rp2040-hal/src/adc.rs @@ -35,7 +35,7 @@ //! ``` //! //! 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 pac::{ADC, RESETS};