From cd3860380df41ecc6c3a2f534a7e55ed76c9b8da Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 10:15:35 +0200 Subject: [PATCH 01/37] Update rp2040-hal to v0.10.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 763da7d..19bf7f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,7 @@ panic-probe = "0.3.1" pio = "0.2.1" pio-proc = "0.2.2" rp2040-boot2 = "0.3.0" -rp2040-hal = "0.9.0" +rp2040-hal = "0.10.0" st7789 = "0.6.1" st7735-lcd = "0.8.1" smart-leds = "0.3.0" From 16e463710654d94f84c40fab84ec91d98b60fa3e Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 12:43:43 +0200 Subject: [PATCH 02/37] embedded-hal 1.0, remove "unproven" feature flag --- Cargo.toml | 2 +- boards/adafruit-kb2040/Cargo.toml | 2 +- boards/arduino_nano_connect/Cargo.toml | 2 +- boards/pimoroni-pico-explorer/Cargo.toml | 2 +- boards/sparkfun-pro-micro-rp2040/Cargo.toml | 2 +- boards/sparkfun-thing-plus-rp2040/Cargo.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 19bf7f2..3789b3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ defmt-rtt = "0.4.0" display-interface = "0.4.1" display-interface-spi = "0.4.1" embedded-graphics = "0.7.1" -embedded-hal ="0.2.7" +embedded-hal ="1.0.0" embedded-sdmmc = "0.5.0" fugit = "0.3.7" hd44780-driver = "0.4.0" diff --git a/boards/adafruit-kb2040/Cargo.toml b/boards/adafruit-kb2040/Cargo.toml index cefd1f4..3951f08 100644 --- a/boards/adafruit-kb2040/Cargo.toml +++ b/boards/adafruit-kb2040/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/rp-rs/rp-hal-boards.git" [dependencies] cortex-m-rt = { workspace = true, optional = true } -embedded-hal = { workspace = true, features = ["unproven"] } +embedded-hal = { workspace = true } rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true diff --git a/boards/arduino_nano_connect/Cargo.toml b/boards/arduino_nano_connect/Cargo.toml index 066fdbd..ae46f97 100644 --- a/boards/arduino_nano_connect/Cargo.toml +++ b/boards/arduino_nano_connect/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/rp-rs/rp-hal-boards.git" [dependencies] cortex-m-rt = { workspace = true, optional = true } -embedded-hal = { workspace = true, features = ["unproven"] } +embedded-hal = { workspace = true } rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true diff --git a/boards/pimoroni-pico-explorer/Cargo.toml b/boards/pimoroni-pico-explorer/Cargo.toml index 808241c..30b3349 100644 --- a/boards/pimoroni-pico-explorer/Cargo.toml +++ b/boards/pimoroni-pico-explorer/Cargo.toml @@ -14,7 +14,7 @@ repository = "https://github.com/rp-rs/rp-hal-boards.git" cortex-m-rt = { workspace = true, optional = true } display-interface-spi.workspace = true embedded-graphics.workspace = true -embedded-hal = { workspace = true, features = ["unproven"] } +embedded-hal = { workspace = true } fugit.workspace = true rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true diff --git a/boards/sparkfun-pro-micro-rp2040/Cargo.toml b/boards/sparkfun-pro-micro-rp2040/Cargo.toml index 274d23b..55144d9 100644 --- a/boards/sparkfun-pro-micro-rp2040/Cargo.toml +++ b/boards/sparkfun-pro-micro-rp2040/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/rp-rs/rp-hal-boards.git" [dependencies] cortex-m-rt = { workspace = true, optional = true } -embedded-hal = { workspace = true, features = ["unproven"] } +embedded-hal = { workspace = true } rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true diff --git a/boards/sparkfun-thing-plus-rp2040/Cargo.toml b/boards/sparkfun-thing-plus-rp2040/Cargo.toml index e103d02..b63f8bb 100644 --- a/boards/sparkfun-thing-plus-rp2040/Cargo.toml +++ b/boards/sparkfun-thing-plus-rp2040/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/rp-rs/rp-hal-boards.git" [dependencies] cortex-m-rt = { workspace = true, optional = true } -embedded-hal = { workspace = true, features = ["unproven"] } +embedded-hal = { workspace = true } rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true From 2a666a31827f4936ff62d9c4e8c9b6ccde8884b1 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 13:03:00 +0200 Subject: [PATCH 03/37] Fix compilation for boards --- Cargo.toml | 1 + boards/pimoroni-pico-explorer/Cargo.toml | 1 + boards/pimoroni-pico-explorer/src/lib.rs | 2 +- boards/pimoroni-tufty2040/Cargo.toml | 1 + boards/pimoroni-tufty2040/src/lib.rs | 4 ++-- boards/sparkfun-micromod-rp2040/Cargo.toml | 1 + boards/sparkfun-micromod-rp2040/src/lib.rs | 2 +- 7 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3789b3f..1e5bc51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,7 @@ display-interface-spi = "0.4.1" embedded-graphics = "0.7.1" embedded-hal ="1.0.0" embedded-sdmmc = "0.5.0" +embedded_hal_0_2 = { package = "embedded-hal", version = "0.2.5", features = ["unproven", ] } fugit = "0.3.7" hd44780-driver = "0.4.0" heapless = "0.7.16" diff --git a/boards/pimoroni-pico-explorer/Cargo.toml b/boards/pimoroni-pico-explorer/Cargo.toml index 30b3349..feaa932 100644 --- a/boards/pimoroni-pico-explorer/Cargo.toml +++ b/boards/pimoroni-pico-explorer/Cargo.toml @@ -15,6 +15,7 @@ cortex-m-rt = { workspace = true, optional = true } display-interface-spi.workspace = true embedded-graphics.workspace = true embedded-hal = { workspace = true } +embedded_hal_0_2.workspace = true fugit.workspace = true rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true diff --git a/boards/pimoroni-pico-explorer/src/lib.rs b/boards/pimoroni-pico-explorer/src/lib.rs index c93e53a..893c938 100644 --- a/boards/pimoroni-pico-explorer/src/lib.rs +++ b/boards/pimoroni-pico-explorer/src/lib.rs @@ -24,7 +24,7 @@ use embedded_graphics::{ draw_target::DrawTarget, pixelcolor::{Rgb565, RgbColor}, }; -use embedded_hal::{ +use embedded_hal_0_2::{ adc::{Channel, OneShot}, blocking::delay::DelayUs, digital::v2::{InputPin, OutputPin}, diff --git a/boards/pimoroni-tufty2040/Cargo.toml b/boards/pimoroni-tufty2040/Cargo.toml index fe0e644..2f41df1 100644 --- a/boards/pimoroni-tufty2040/Cargo.toml +++ b/boards/pimoroni-tufty2040/Cargo.toml @@ -14,6 +14,7 @@ repository = "https://github.com/rp-rs/rp-hal-boards.git" cortex-m.workspace = true cortex-m-rt = { workspace = true, optional = true } embedded-hal.workspace = true +embedded_hal_0_2.workspace = true fugit.workspace = true rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true diff --git a/boards/pimoroni-tufty2040/src/lib.rs b/boards/pimoroni-tufty2040/src/lib.rs index e8938a0..f4a27b6 100644 --- a/boards/pimoroni-tufty2040/src/lib.rs +++ b/boards/pimoroni-tufty2040/src/lib.rs @@ -5,7 +5,7 @@ pub extern crate rp2040_hal as hal; pub use hal::pac; use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand}; -use embedded_hal::digital::v2::OutputPin; +use embedded_hal_0_2::digital::v2::OutputPin; use fugit::HertzU32; use hal::dma::{single_buffer, Channel, ChannelIndex, WriteTarget}; use hal::gpio::PinId; @@ -253,7 +253,7 @@ impl PioDataLines let program = pio_file!("./src/st7789_parallel.pio"); let program = pio.install(&program.program).unwrap(); - let (mut sm, _rx, tx) = PIOBuilder::from_program(program) + let (mut sm, _rx, tx) = PIOBuilder::from_installed_program(program) .out_pins(d0, 8) .side_set_pin_base(wr) .buffers(Buffers::OnlyTx) diff --git a/boards/sparkfun-micromod-rp2040/Cargo.toml b/boards/sparkfun-micromod-rp2040/Cargo.toml index 71bcb24..e02e3fd 100644 --- a/boards/sparkfun-micromod-rp2040/Cargo.toml +++ b/boards/sparkfun-micromod-rp2040/Cargo.toml @@ -16,6 +16,7 @@ rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true cortex-m-rt = { workspace = true, optional = true } embedded-hal.workspace = true +embedded_hal_0_2 = { workspace = true } nb.workspace = true [dev-dependencies] diff --git a/boards/sparkfun-micromod-rp2040/src/lib.rs b/boards/sparkfun-micromod-rp2040/src/lib.rs index 6ab985b..6939161 100644 --- a/boards/sparkfun-micromod-rp2040/src/lib.rs +++ b/boards/sparkfun-micromod-rp2040/src/lib.rs @@ -390,7 +390,7 @@ impl BatteryVoltage { /// /// The current voltage in millivolts pub fn read(&mut self, adc: &mut hal::Adc) -> u16 { - use embedded_hal::adc::OneShot; + use embedded_hal_0_2::adc::OneShot; let raw_value: u32 = loop { match adc.read(&mut self.pin) { From 2436cb7ef098245ea02d78e7acb31c1e45740282 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 13:44:06 +0200 Subject: [PATCH 04/37] Compile adafruit-macropad examples --- boards/adafruit-macropad/examples/adafruit-macropad_blinky.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/adafruit-macropad/examples/adafruit-macropad_blinky.rs b/boards/adafruit-macropad/examples/adafruit-macropad_blinky.rs index 8ef0267..b32b4c6 100644 --- a/boards/adafruit-macropad/examples/adafruit-macropad_blinky.rs +++ b/boards/adafruit-macropad/examples/adafruit-macropad_blinky.rs @@ -13,7 +13,7 @@ use adafruit_macropad::{ }, Pins, XOSC_CRYSTAL_FREQ, }; -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; use panic_halt as _; /// Entry point to our bare-metal application. From 884ec233837cd00e682703a58ee057fe3b9c356c Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 13:45:48 +0200 Subject: [PATCH 05/37] Compile arduino_nano_connect examples --- boards/arduino_nano_connect/examples/nano_blinky.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/arduino_nano_connect/examples/nano_blinky.rs b/boards/arduino_nano_connect/examples/nano_blinky.rs index 7cdb881..aef2634 100644 --- a/boards/arduino_nano_connect/examples/nano_blinky.rs +++ b/boards/arduino_nano_connect/examples/nano_blinky.rs @@ -10,7 +10,7 @@ #![no_std] #![no_main] -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) From 8cb0b51ea7b3f677172beec39370df3195587abd Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 13:54:41 +0200 Subject: [PATCH 06/37] Compile adafruit-qt-py-rp2040 examples --- Cargo.toml | 2 +- boards/adafruit-qt-py-rp2040/Cargo.toml | 1 + .../examples/adafruit_qt_py_rp2040_rainbow.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1e5bc51..37737d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,4 +60,4 @@ ssd1306 = "0.7.1" usb-device = "0.2.9" usbd-hid = "0.5.2" usbd-serial = "0.1.1" -ws2812-pio = "0.7.0" +ws2812-pio = { version = "0.7.0", git = "https://github.com/moosingin3space/ws2812-pio-rs/", rev = "c153eca" } diff --git a/boards/adafruit-qt-py-rp2040/Cargo.toml b/boards/adafruit-qt-py-rp2040/Cargo.toml index 6478cf2..0879a77 100644 --- a/boards/adafruit-qt-py-rp2040/Cargo.toml +++ b/boards/adafruit-qt-py-rp2040/Cargo.toml @@ -18,6 +18,7 @@ rp2040-hal.workspace = true [dev-dependencies] panic-halt.workspace = true embedded-hal.workspace = true +embedded_hal_0_2.workspace = true smart-leds.workspace = true nb.workspace = true ws2812-pio.workspace = true diff --git a/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs index a1d4af1..9fd938b 100644 --- a/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs +++ b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs @@ -4,7 +4,7 @@ use adafruit_qt_py_rp2040::entry; use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; From 8ffa3307e4e22d49ada917d2ad66624ea7e2bfa9 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 13:57:34 +0200 Subject: [PATCH 07/37] Compile adafruit-feather-rp2040 examples --- boards/adafruit-feather-rp2040/Cargo.toml | 1 + .../adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs | 2 +- .../examples/adafruit_feather_neopixel_rainbow.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/boards/adafruit-feather-rp2040/Cargo.toml b/boards/adafruit-feather-rp2040/Cargo.toml index 0f8ae78..219a24c 100644 --- a/boards/adafruit-feather-rp2040/Cargo.toml +++ b/boards/adafruit-feather-rp2040/Cargo.toml @@ -19,6 +19,7 @@ rp2040-hal.workspace = true cortex-m.workspace = true panic-halt.workspace = true embedded-hal.workspace = true +embedded_hal_0_2.workspace = true fugit.workspace = true nb.workspace = true smart-leds.workspace = true diff --git a/boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs b/boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs index 74eb5b3..eed531c 100644 --- a/boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs +++ b/boards/adafruit-feather-rp2040/examples/adafruit_feather_blinky.rs @@ -14,7 +14,7 @@ use adafruit_feather_rp2040::{ }, Pins, XOSC_CRYSTAL_FREQ, }; -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; use panic_halt as _; #[entry] diff --git a/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs index 16b1de3..c3a5119 100644 --- a/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs +++ b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs @@ -19,7 +19,7 @@ use adafruit_feather_rp2040::{ Pins, XOSC_CRYSTAL_FREQ, }; use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; From 6e0cd223c29d1b256d14f1dbe700895c288e0253 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 13:59:10 +0200 Subject: [PATCH 08/37] Compile adafruit-trinkey-qt2040 examples --- boards/adafruit-trinkey-qt2040/Cargo.toml | 1 + .../examples/adafruit_trinkey_qt2040_rainbow.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/adafruit-trinkey-qt2040/Cargo.toml b/boards/adafruit-trinkey-qt2040/Cargo.toml index e314218..2cb93e0 100644 --- a/boards/adafruit-trinkey-qt2040/Cargo.toml +++ b/boards/adafruit-trinkey-qt2040/Cargo.toml @@ -18,6 +18,7 @@ rp2040-hal.workspace = true [dev-dependencies] panic-halt.workspace = true embedded-hal.workspace = true +embedded_hal_0_2.workspace = true smart-leds.workspace = true nb.workspace = true ws2812-pio.workspace = true diff --git a/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs b/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs index 3315afa..d5f940f 100644 --- a/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs +++ b/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs @@ -10,7 +10,7 @@ use adafruit_trinkey_qt2040::entry; use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; From d9df59cf84b449e2c267a2ade8961212baf28a78 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:00:37 +0200 Subject: [PATCH 09/37] Compile pimoroni_badger2040 examples --- boards/pimoroni_badger2040/Cargo.toml | 1 + boards/pimoroni_badger2040/examples/badger_blinky.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/boards/pimoroni_badger2040/Cargo.toml b/boards/pimoroni_badger2040/Cargo.toml index 4d383af..a699c76 100644 --- a/boards/pimoroni_badger2040/Cargo.toml +++ b/boards/pimoroni_badger2040/Cargo.toml @@ -18,6 +18,7 @@ rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true [dev-dependencies] +embedded_hal_0_2.workspace = true panic-halt.workspace = true nb.workspace = true diff --git a/boards/pimoroni_badger2040/examples/badger_blinky.rs b/boards/pimoroni_badger2040/examples/badger_blinky.rs index e57f1b0..7deb36a 100644 --- a/boards/pimoroni_badger2040/examples/badger_blinky.rs +++ b/boards/pimoroni_badger2040/examples/badger_blinky.rs @@ -11,7 +11,7 @@ use pimoroni_badger2040::entry; // GPIO traits -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) @@ -27,7 +27,7 @@ use pimoroni_badger2040::hal::Timer; use pimoroni_badger2040::hal; // A few traits required for using the CountDown timer -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; #[entry] From 0254251f5798467a6acc873fc46ab2f718eef011 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:01:41 +0200 Subject: [PATCH 10/37] Compile solderparty-rp2040-stamp examples --- boards/solderparty-rp2040-stamp/Cargo.toml | 1 + .../examples/solderparty_stamp_neopixel_rainbow.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/solderparty-rp2040-stamp/Cargo.toml b/boards/solderparty-rp2040-stamp/Cargo.toml index 68779e9..4740c77 100644 --- a/boards/solderparty-rp2040-stamp/Cargo.toml +++ b/boards/solderparty-rp2040-stamp/Cargo.toml @@ -16,6 +16,7 @@ rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true [dev-dependencies] +embedded_hal_0_2.workspace = true embedded-hal.workspace = true fugit.workspace = true nb.workspace = true diff --git a/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs b/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs index 42f0162..9d5d7dc 100644 --- a/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs +++ b/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs @@ -7,7 +7,7 @@ #![no_main] use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; From 9f43f0752bc7903c15d39f71e991f0df7474aae3 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:03:19 +0200 Subject: [PATCH 11/37] Compile sparkfun-pro-micro-rp2040 examples --- boards/sparkfun-pro-micro-rp2040/Cargo.toml | 1 + .../examples/sparkfun_pro_micro_rainbow.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/sparkfun-pro-micro-rp2040/Cargo.toml b/boards/sparkfun-pro-micro-rp2040/Cargo.toml index 55144d9..7b0f6e2 100644 --- a/boards/sparkfun-pro-micro-rp2040/Cargo.toml +++ b/boards/sparkfun-pro-micro-rp2040/Cargo.toml @@ -17,6 +17,7 @@ rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true [dev-dependencies] +embedded_hal_0_2.workspace = true fugit.workspace = true nb.workspace = true panic-halt.workspace = true diff --git a/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs index d498163..e7272a7 100644 --- a/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs +++ b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs @@ -9,7 +9,7 @@ #![no_main] use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; use sparkfun_pro_micro_rp2040::entry; From 28c0797fbd0fda5a6afe40ceab9ef904eb162318 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:04:24 +0200 Subject: [PATCH 12/37] Compile pimoroni-pico-lipo-16mb examples --- .../examples/pimoroni_pico_lipo_16mb_blinky.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/pimoroni-pico-lipo-16mb/examples/pimoroni_pico_lipo_16mb_blinky.rs b/boards/pimoroni-pico-lipo-16mb/examples/pimoroni_pico_lipo_16mb_blinky.rs index 6bf9bbc..f479ace 100644 --- a/boards/pimoroni-pico-lipo-16mb/examples/pimoroni_pico_lipo_16mb_blinky.rs +++ b/boards/pimoroni-pico-lipo-16mb/examples/pimoroni_pico_lipo_16mb_blinky.rs @@ -14,7 +14,7 @@ use pimoroni_pico_lipo_16mb::entry; // GPIO traits -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) From f699521beb16f4bc95eb9ed84f7ec8fa70c5c62c Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:08:51 +0200 Subject: [PATCH 13/37] Compile sparkfun-thing-plus-rp2040 examples --- boards/sparkfun-thing-plus-rp2040/Cargo.toml | 1 + .../examples/sparkfun_thing_plus_rainbow.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/sparkfun-thing-plus-rp2040/Cargo.toml b/boards/sparkfun-thing-plus-rp2040/Cargo.toml index b63f8bb..e76667e 100644 --- a/boards/sparkfun-thing-plus-rp2040/Cargo.toml +++ b/boards/sparkfun-thing-plus-rp2040/Cargo.toml @@ -17,6 +17,7 @@ rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true [dev-dependencies] +embedded_hal_0_2.workspace = true panic-halt.workspace = true smart-leds.workspace = true nb.workspace = true diff --git a/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs b/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs index ea8d0cc..9d20956 100644 --- a/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs +++ b/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs @@ -9,7 +9,7 @@ #![no_main] use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; From d3596b2f0373e1ee8edfa9f22af974fe81e9cbcd Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:10:18 +0200 Subject: [PATCH 14/37] Compile waveshare-rp2040-zero examples --- boards/waveshare-rp2040-zero/Cargo.toml | 1 + .../examples/waveshare_rp2040_zero_neopixel_rainbow.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/waveshare-rp2040-zero/Cargo.toml b/boards/waveshare-rp2040-zero/Cargo.toml index 64698fe..f44d7e7 100644 --- a/boards/waveshare-rp2040-zero/Cargo.toml +++ b/boards/waveshare-rp2040-zero/Cargo.toml @@ -17,6 +17,7 @@ rp2040-hal.workspace = true [dev-dependencies] cortex-m.workspace = true +embedded_hal_0_2.workspace = true panic-halt.workspace = true embedded-hal.workspace = true fugit.workspace = true diff --git a/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs b/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs index f8fd12d..0b6c77a 100644 --- a/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs +++ b/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs @@ -7,7 +7,7 @@ #![no_main] use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; From f56411f3859424a04ad8c2f1785f5b71face528d Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:11:50 +0200 Subject: [PATCH 15/37] Compile adafruit-itsy-bitsy-rp2040 examples --- boards/adafruit-itsy-bitsy-rp2040/Cargo.toml | 1 + .../examples/adafruit_itsy_bitsy_blinky.rs | 2 +- .../examples/adafruit_itsy_bitsy_rainbow.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml b/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml index 3c2e366..cba10bc 100644 --- a/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml +++ b/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml @@ -19,6 +19,7 @@ rp2040-hal.workspace = true cortex-m.workspace = true panic-halt.workspace = true embedded-hal.workspace = true +embedded_hal_0_2.workspace = true smart-leds.workspace = true nb.workspace = true ws2812-pio.workspace = true diff --git a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs index 6acf699..42d0d70 100644 --- a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs +++ b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_blinky.rs @@ -17,7 +17,7 @@ use adafruit_itsy_bitsy_rp2040::entry; use panic_halt as _; // Some traits we need -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; use adafruit_itsy_bitsy_rp2040::{ hal::{ diff --git a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs index 927da9a..8c17a9a 100644 --- a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs +++ b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs @@ -4,7 +4,7 @@ use adafruit_itsy_bitsy_rp2040::entry; use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; From a22c35e922998ff80165d4ee3467b5d944ae5daf Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:14:58 +0200 Subject: [PATCH 16/37] Compile sparkfun-micromod-rp2040 examples --- .../examples/sparkfun_micromod_battery_voltage.rs | 5 +++-- .../examples/sparkfun_micromod_blinky.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_battery_voltage.rs b/boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_battery_voltage.rs index 02ebeed..85ffc01 100644 --- a/boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_battery_voltage.rs +++ b/boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_battery_voltage.rs @@ -88,8 +88,9 @@ fn main() -> ! { ); let mut adc = hal::Adc::new(pac.ADC, &mut pac.RESETS); - let mut battery_voltage = - bsp::BatteryVoltage::new(hal::adc::AdcPin::new(pins.batt_vin.into_floating_input())); + let mut battery_voltage = bsp::BatteryVoltage::new( + hal::adc::AdcPin::new(pins.batt_vin.into_floating_input()).unwrap(), + ); // Print temperature once per second loop { diff --git a/boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_blinky.rs b/boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_blinky.rs index 153bb56..352ed0a 100644 --- a/boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_blinky.rs +++ b/boards/sparkfun-micromod-rp2040/examples/sparkfun_micromod_blinky.rs @@ -14,7 +14,7 @@ use sparkfun_micromod_rp2040::entry; // GPIO traits -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) From 0fdc39545c61ebee3fd962ba9e5058d437e56570 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:15:52 +0200 Subject: [PATCH 17/37] Compile pimoroni-pico-explorer examples --- .../examples/pimoroni_pico_explorer_showcase.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/pimoroni-pico-explorer/examples/pimoroni_pico_explorer_showcase.rs b/boards/pimoroni-pico-explorer/examples/pimoroni_pico_explorer_showcase.rs index a65185c..86e9422 100644 --- a/boards/pimoroni-pico-explorer/examples/pimoroni_pico_explorer_showcase.rs +++ b/boards/pimoroni-pico-explorer/examples/pimoroni_pico_explorer_showcase.rs @@ -9,7 +9,7 @@ use embedded_graphics::{ prelude::*, text::{Alignment, Text}, }; -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; use hal::{adc::Adc, clocks::*, watchdog::Watchdog, Sio}; use panic_halt as _; use pimoroni_pico_explorer::entry; From b08dad69ef42b703962b0c6104ca027f8642ff44 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:17:14 +0200 Subject: [PATCH 18/37] Compile adafruit-metro-rp2040 examples --- boards/adafruit-metro-rp2040/Cargo.toml | 1 + boards/adafruit-metro-rp2040/examples/adafruit_metro_blinky.rs | 2 +- boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/boards/adafruit-metro-rp2040/Cargo.toml b/boards/adafruit-metro-rp2040/Cargo.toml index 3e8312f..3e284db 100644 --- a/boards/adafruit-metro-rp2040/Cargo.toml +++ b/boards/adafruit-metro-rp2040/Cargo.toml @@ -19,6 +19,7 @@ rp2040-hal.workspace = true cortex-m.workspace = true panic-halt.workspace = true embedded-hal.workspace = true +embedded_hal_0_2.workspace = true smart-leds.workspace = true nb.workspace = true ws2812-pio.workspace = true diff --git a/boards/adafruit-metro-rp2040/examples/adafruit_metro_blinky.rs b/boards/adafruit-metro-rp2040/examples/adafruit_metro_blinky.rs index 12fb485..f4b7e07 100644 --- a/boards/adafruit-metro-rp2040/examples/adafruit_metro_blinky.rs +++ b/boards/adafruit-metro-rp2040/examples/adafruit_metro_blinky.rs @@ -17,7 +17,7 @@ use adafruit_metro_rp2040::entry; use panic_halt as _; // Some traits we need -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; use adafruit_metro_rp2040::{ hal::{ diff --git a/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs b/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs index 0208c1a..b051648 100644 --- a/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs +++ b/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs @@ -4,7 +4,7 @@ use adafruit_metro_rp2040::entry; use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; From 7c045646405173d2c0380f0612ac164d7799eb95 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:18:03 +0200 Subject: [PATCH 19/37] Compile pimoroni-tiny2040 examples --- boards/pimoroni-tiny2040/examples/tiny2040_blinky.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/pimoroni-tiny2040/examples/tiny2040_blinky.rs b/boards/pimoroni-tiny2040/examples/tiny2040_blinky.rs index 57e3ef1..0ba5360 100644 --- a/boards/pimoroni-tiny2040/examples/tiny2040_blinky.rs +++ b/boards/pimoroni-tiny2040/examples/tiny2040_blinky.rs @@ -5,7 +5,7 @@ use bsp::entry; use defmt::*; use defmt_rtt as _; -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; use panic_halt as _; use pimoroni_tiny2040 as bsp; From d4a4c44e469e6dd68276c87a8eacc39e94340033 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:19:34 +0200 Subject: [PATCH 20/37] Compile vcc-gnd-yd-rp2040 examples --- boards/vcc-gnd-yd-rp2040/Cargo.toml | 1 + boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_blinky.rs | 2 +- boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/boards/vcc-gnd-yd-rp2040/Cargo.toml b/boards/vcc-gnd-yd-rp2040/Cargo.toml index e195fb5..4985c4c 100644 --- a/boards/vcc-gnd-yd-rp2040/Cargo.toml +++ b/boards/vcc-gnd-yd-rp2040/Cargo.toml @@ -20,6 +20,7 @@ usb-device.workspace = true [dev-dependencies] cortex-m.workspace = true embedded-hal.workspace = true +embedded_hal_0_2.workspace = true nb.workspace = true panic-halt.workspace = true pio.workspace = true diff --git a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_blinky.rs b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_blinky.rs index e658832..4354b80 100644 --- a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_blinky.rs +++ b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_blinky.rs @@ -4,7 +4,7 @@ #![no_std] #![no_main] -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; use panic_halt as _; use vcc_gnd_yd_rp2040::entry; use vcc_gnd_yd_rp2040::{ diff --git a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs index 2c6a703..6cde379 100644 --- a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs +++ b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs @@ -7,7 +7,7 @@ #![no_main] use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; From c4be486053939b84aaed4af32b80b122e1ef9b9b Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:35:08 +0200 Subject: [PATCH 21/37] Compile adafruit-kb2040 examples --- Cargo.toml | 4 ++-- boards/adafruit-kb2040/Cargo.toml | 1 + .../adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs | 2 +- .../examples/adafruit_kb2040_usb_serial.rs | 8 +++++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 37737d8..ebf1692 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ st7789 = "0.6.1" st7735-lcd = "0.8.1" smart-leds = "0.3.0" ssd1306 = "0.7.1" -usb-device = "0.2.9" +usb-device = "0.3" usbd-hid = "0.5.2" -usbd-serial = "0.1.1" +usbd-serial = "0.2.1" ws2812-pio = { version = "0.7.0", git = "https://github.com/moosingin3space/ws2812-pio-rs/", rev = "c153eca" } diff --git a/boards/adafruit-kb2040/Cargo.toml b/boards/adafruit-kb2040/Cargo.toml index 3951f08..50a89c4 100644 --- a/boards/adafruit-kb2040/Cargo.toml +++ b/boards/adafruit-kb2040/Cargo.toml @@ -18,6 +18,7 @@ rp2040-hal.workspace = true [dev-dependencies] embedded-hal.workspace = true +embedded_hal_0_2.workspace = true heapless.workspace = true fugit.workspace = true nb.workspace = true diff --git a/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs index c9f6294..cb18c8a 100644 --- a/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs +++ b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs @@ -10,7 +10,7 @@ use adafruit_kb2040::entry; use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; diff --git a/boards/adafruit-kb2040/examples/adafruit_kb2040_usb_serial.rs b/boards/adafruit-kb2040/examples/adafruit_kb2040_usb_serial.rs index 548da14..d5b4907 100644 --- a/boards/adafruit-kb2040/examples/adafruit_kb2040_usb_serial.rs +++ b/boards/adafruit-kb2040/examples/adafruit_kb2040_usb_serial.rs @@ -96,9 +96,11 @@ fn main() -> ! { // Create a USB device with a fake VID and PID let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd)) - .manufacturer("Fake company") - .product("Serial port") - .serial_number("TEST") + .strings(&[StringDescriptors::default() + .manufacturer("Fake company") + .product("Serial port") + .serial_number("TEST")]) + .unwrap() .device_class(2) // from: https://www.usb.org/defined-class-codes .build(); From 1e0b5de7a86185c2ae4a2705d4cd6d6d5b54d706 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:36:35 +0200 Subject: [PATCH 22/37] Compile pimoroni-tufty2040 examples --- boards/pimoroni-tufty2040/Cargo.toml | 1 + boards/pimoroni-tufty2040/examples/tufty_demo.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/boards/pimoroni-tufty2040/Cargo.toml b/boards/pimoroni-tufty2040/Cargo.toml index 2f41df1..826bd8a 100644 --- a/boards/pimoroni-tufty2040/Cargo.toml +++ b/boards/pimoroni-tufty2040/Cargo.toml @@ -25,6 +25,7 @@ pio.workspace = true pio-proc.workspace = true [dev-dependencies] +embedded_hal_0_2.workspace = true panic-halt.workspace = true nb.workspace = true diff --git a/boards/pimoroni-tufty2040/examples/tufty_demo.rs b/boards/pimoroni-tufty2040/examples/tufty_demo.rs index 1f13975..c44d98e 100644 --- a/boards/pimoroni-tufty2040/examples/tufty_demo.rs +++ b/boards/pimoroni-tufty2040/examples/tufty_demo.rs @@ -13,7 +13,7 @@ use pimoroni_tufty2040 as tufty; use tufty::entry; // GPIO traits -use embedded_hal::digital::v2::{OutputPin, PinState}; +use embedded_hal::digital::{OutputPin, PinState}; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) @@ -40,7 +40,7 @@ use embedded_graphics::geometry::Point; use embedded_graphics::pixelcolor::{Rgb565, RgbColor}; use embedded_graphics::primitives::{Circle, Primitive, PrimitiveStyleBuilder}; use embedded_graphics::Drawable; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use st7789::ST7789; From fc5153f87ab8f6fefb2ab9fdad225d8da56e3db4 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:39:26 +0200 Subject: [PATCH 23/37] Compile pimoroni-servo2040 examples --- boards/pimoroni-servo2040/Cargo.toml | 1 + .../examples/pimoroni_servo2040_pwm_servo.rs | 12 ++++++------ .../examples/pimoroni_servo2040_rainbow.rs | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/boards/pimoroni-servo2040/Cargo.toml b/boards/pimoroni-servo2040/Cargo.toml index 28bb6ef..35d81d8 100644 --- a/boards/pimoroni-servo2040/Cargo.toml +++ b/boards/pimoroni-servo2040/Cargo.toml @@ -19,6 +19,7 @@ rp2040-hal.workspace = true defmt.workspace = true defmt-rtt.workspace = true embedded-hal.workspace = true +embedded_hal_0_2.workspace = true fugit.workspace = true nb.workspace = true panic-halt.workspace = true diff --git a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs index e302d84..aef1ce8 100644 --- a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs +++ b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs @@ -7,8 +7,8 @@ #![no_main] // GPIO traits -use embedded_hal::timer::CountDown; -use embedded_hal::PwmPin; +use embedded_hal::pwm::SetDutyCycle; +use embedded_hal_0_2::timer::CountDown; // Traits for converting integers to amounts of time use fugit::ExtU64; @@ -105,22 +105,22 @@ fn main() -> ! { // different manufacturers respond differently. loop { // move to 0° - channel_a.set_duty(us_to_duty(MID_PULSE)); + let _ = channel_a.set_duty_cycle(us_to_duty(MID_PULSE)); count_down.start(movement_delay); let _ = nb::block!(count_down.wait()); // 0° to 90° - channel_a.set_duty(us_to_duty(MAX_PULSE)); + let _ = channel_a.set_duty_cycle(us_to_duty(MAX_PULSE)); count_down.start(movement_delay); let _ = nb::block!(count_down.wait()); // 90° to 0° - channel_a.set_duty(us_to_duty(MID_PULSE)); + let _ = channel_a.set_duty_cycle(us_to_duty(MID_PULSE)); count_down.start(movement_delay); let _ = nb::block!(count_down.wait()); // 0° to -90° - channel_a.set_duty(us_to_duty(MIN_PULSE)); + let _ = channel_a.set_duty_cycle(us_to_duty(MIN_PULSE)); count_down.start(movement_delay); let _ = nb::block!(count_down.wait()); } diff --git a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs index 1a44ce9..6c2e2dd 100644 --- a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs +++ b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs @@ -11,7 +11,7 @@ use bsp::hal::{ }; use defmt::*; use defmt_rtt as _; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; use pimoroni_servo2040 as bsp; From 9fd64a35538ff8a6e507196f001bec5694a1717b Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 14:47:58 +0200 Subject: [PATCH 24/37] Compile pimoroni-plasma-2040 examples --- .../examples/pimoroni_plasma_2040_blinky.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/pimoroni-plasma-2040/examples/pimoroni_plasma_2040_blinky.rs b/boards/pimoroni-plasma-2040/examples/pimoroni_plasma_2040_blinky.rs index 7340f72..44e60d0 100644 --- a/boards/pimoroni-plasma-2040/examples/pimoroni_plasma_2040_blinky.rs +++ b/boards/pimoroni-plasma-2040/examples/pimoroni_plasma_2040_blinky.rs @@ -4,7 +4,7 @@ use defmt::*; use defmt_rtt as _; -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; use panic_halt as _; use pimoroni_plasma_2040 as bsp; From aea04f99872f9a70962d078bed4945a74cd14cd1 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 17:09:23 +0200 Subject: [PATCH 25/37] Compile rp-pico examples --- Cargo.toml | 4 +- boards/rp-pico/Cargo.toml | 1 + boards/rp-pico/examples/pico_blinky.rs | 2 +- .../rp-pico/examples/pico_countdown_blinky.rs | 2 +- boards/rp-pico/examples/pico_gpio_in_out.rs | 4 +- .../rp-pico/examples/pico_hd44780_display.rs | 2 +- .../examples/pico_i2c_oled_display_ssd1306.rs | 6 +-- boards/rp-pico/examples/pico_i2c_pio.rs | 4 +- boards/rp-pico/examples/pico_interpolator.rs | 2 +- boards/rp-pico/examples/pico_pio_pwm.rs | 2 +- boards/rp-pico/examples/pico_pwm_blink.rs | 6 +-- boards/rp-pico/examples/pico_pwm_servo.rs | 10 ++-- boards/rp-pico/examples/pico_rtic.rs | 2 +- .../rp-pico/examples/pico_rtic_monotonic.rs | 2 +- boards/rp-pico/examples/pico_spi_sd_card.rs | 49 +++---------------- .../rp-pico/examples/pico_uart_irq_buffer.rs | 3 +- boards/rp-pico/examples/pico_uart_irq_echo.rs | 6 +-- boards/rp-pico/examples/pico_usb_serial.rs | 8 +-- .../examples/pico_usb_serial_interrupt.rs | 10 ++-- .../examples/pico_usb_twitchy_mouse.rs | 8 +-- 20 files changed, 53 insertions(+), 80 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ebf1692..3cc37f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ embedded_hal_0_2 = { package = "embedded-hal", version = "0.2.5", features = ["u fugit = "0.3.7" hd44780-driver = "0.4.0" heapless = "0.7.16" -i2c-pio = "0.7.0" +i2c-pio = { version = "0.8.0", git = "https://github.com/jannic/i2c-pio-rs/", rev = "969d427" } nb = "1.1" panic-halt= "0.2.0" panic-probe = "0.3.1" @@ -58,6 +58,6 @@ st7735-lcd = "0.8.1" smart-leds = "0.3.0" ssd1306 = "0.7.1" usb-device = "0.3" -usbd-hid = "0.5.2" +usbd-hid = "0.7.0" usbd-serial = "0.2.1" ws2812-pio = { version = "0.7.0", git = "https://github.com/moosingin3space/ws2812-pio-rs/", rev = "c153eca" } diff --git a/boards/rp-pico/Cargo.toml b/boards/rp-pico/Cargo.toml index b195243..c120954 100644 --- a/boards/rp-pico/Cargo.toml +++ b/boards/rp-pico/Cargo.toml @@ -24,6 +24,7 @@ critical-section.workspace = true embedded-graphics.workspace = true embedded-hal.workspace = true embedded-sdmmc.workspace = true +embedded_hal_0_2.workspace = true hd44780-driver.workspace = true heapless.workspace = true i2c-pio.workspace = true diff --git a/boards/rp-pico/examples/pico_blinky.rs b/boards/rp-pico/examples/pico_blinky.rs index 1bb43a4..ef074cd 100644 --- a/boards/rp-pico/examples/pico_blinky.rs +++ b/boards/rp-pico/examples/pico_blinky.rs @@ -14,7 +14,7 @@ use rp_pico::entry; // GPIO traits -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) diff --git a/boards/rp-pico/examples/pico_countdown_blinky.rs b/boards/rp-pico/examples/pico_countdown_blinky.rs index cb4262e..cef6495 100644 --- a/boards/rp-pico/examples/pico_countdown_blinky.rs +++ b/boards/rp-pico/examples/pico_countdown_blinky.rs @@ -16,7 +16,7 @@ use rp_pico::entry; use cortex_m::prelude::*; // GPIO traits -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; // Traits for converting integers to amounts of time use fugit::ExtU32; diff --git a/boards/rp-pico/examples/pico_gpio_in_out.rs b/boards/rp-pico/examples/pico_gpio_in_out.rs index 45ecc99..c0d19d1 100644 --- a/boards/rp-pico/examples/pico_gpio_in_out.rs +++ b/boards/rp-pico/examples/pico_gpio_in_out.rs @@ -16,7 +16,7 @@ use rp_pico::entry; // GPIO traits -use embedded_hal::digital::v2::{InputPin, OutputPin}; +use embedded_hal::digital::{InputPin, OutputPin}; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) @@ -60,7 +60,7 @@ fn main() -> ! { let mut led_pin = pins.led.into_push_pull_output(); // Our button input - let button_pin = pins.gpio15.into_pull_up_input(); + let mut button_pin = pins.gpio15.into_pull_up_input(); // Run forever, setting the LED according to the button loop { diff --git a/boards/rp-pico/examples/pico_hd44780_display.rs b/boards/rp-pico/examples/pico_hd44780_display.rs index c7e6715..c5f5a93 100644 --- a/boards/rp-pico/examples/pico_hd44780_display.rs +++ b/boards/rp-pico/examples/pico_hd44780_display.rs @@ -46,7 +46,7 @@ use panic_halt as _; use rp_pico::hal::prelude::*; // GPIO traits -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; // For LCD display use hd44780_driver::HD44780; diff --git a/boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs b/boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs index 31dafb8..c452195 100644 --- a/boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs +++ b/boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs @@ -51,7 +51,7 @@ use rp_pico::entry; use fugit::{ExtU32, RateExtU32}; // CountDown timer for the counter on the display: -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) @@ -121,8 +121,8 @@ fn main() -> ! { ); // Configure two pins as being I²C, not GPIO - let sda_pin = pins.gpio16.into_function::(); - let scl_pin = pins.gpio17.into_function::(); + let sda_pin: hal::gpio::Pin<_, hal::gpio::FunctionI2C, _> = pins.gpio16.reconfigure(); + let scl_pin: hal::gpio::Pin<_, hal::gpio::FunctionI2C, _> = pins.gpio17.reconfigure(); // Create the I²C driver, using the two pre-configured pins. This will fail // at compile time if the pins are in the wrong mode, or if this I²C diff --git a/boards/rp-pico/examples/pico_i2c_pio.rs b/boards/rp-pico/examples/pico_i2c_pio.rs index 8569207..3bcf3a2 100644 --- a/boards/rp-pico/examples/pico_i2c_pio.rs +++ b/boards/rp-pico/examples/pico_i2c_pio.rs @@ -18,7 +18,7 @@ use core::fmt::Write as FmtWrite; use rp_pico::entry; // I2C HAL traits & Types. -use embedded_hal::blocking::i2c::{Operation, Read, Transactional, Write}; +use embedded_hal::i2c::{I2c, Operation}; // Time handling traits use fugit::RateExtU32; @@ -147,7 +147,7 @@ fn main() -> ! { Operation::Read(&mut temp), ]; i2c_pio - .exec(0x48u8, &mut operations) + .transaction(0x48u8, &mut operations) .expect("Failed to run all operations"); print_temperature(&mut uart, temp); diff --git a/boards/rp-pico/examples/pico_interpolator.rs b/boards/rp-pico/examples/pico_interpolator.rs index 1d8545d..f479c1a 100644 --- a/boards/rp-pico/examples/pico_interpolator.rs +++ b/boards/rp-pico/examples/pico_interpolator.rs @@ -17,7 +17,7 @@ use rp_pico::entry; // GPIO traits -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) diff --git a/boards/rp-pico/examples/pico_pio_pwm.rs b/boards/rp-pico/examples/pico_pio_pwm.rs index 2990bb5..0535924 100644 --- a/boards/rp-pico/examples/pico_pio_pwm.rs +++ b/boards/rp-pico/examples/pico_pio_pwm.rs @@ -139,7 +139,7 @@ fn main() -> ! { // Build the pio program and set pin both for set and side set! // We are running with the default divider which is 1 (max speed) - let (mut sm, _, mut tx) = PIOBuilder::from_program(installed) + let (mut sm, _, mut tx) = PIOBuilder::from_installed_program(installed) .set_pins(led_pin_id, 1) .side_set_pin_base(led_pin_id) .build(sm0); diff --git a/boards/rp-pico/examples/pico_pwm_blink.rs b/boards/rp-pico/examples/pico_pwm_blink.rs index b6c90fb..fded618 100644 --- a/boards/rp-pico/examples/pico_pwm_blink.rs +++ b/boards/rp-pico/examples/pico_pwm_blink.rs @@ -14,7 +14,7 @@ use rp_pico::entry; // GPIO traits -use embedded_hal::PwmPin; +use embedded_hal::pwm::SetDutyCycle; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) @@ -100,13 +100,13 @@ fn main() -> ! { // Ramp brightness up for i in (LOW..=HIGH).skip(100) { delay.delay_us(8); - channel.set_duty(i); + let _ = channel.set_duty_cycle(i); } // Ramp brightness down for i in (LOW..=HIGH).rev().skip(100) { delay.delay_us(8); - channel.set_duty(i); + let _ = channel.set_duty_cycle(i); } delay.delay_ms(500); diff --git a/boards/rp-pico/examples/pico_pwm_servo.rs b/boards/rp-pico/examples/pico_pwm_servo.rs index 098eb89..f01b29e 100644 --- a/boards/rp-pico/examples/pico_pwm_servo.rs +++ b/boards/rp-pico/examples/pico_pwm_servo.rs @@ -12,7 +12,7 @@ use cortex_m::prelude::*; // GPIO traits -use embedded_hal::PwmPin; +use embedded_hal::pwm::SetDutyCycle; // Traits for converting integers to amounts of time use fugit::ExtU32; @@ -92,22 +92,22 @@ fn main() -> ! { // different manufacturers respond differently. loop { // move to 0° - channel.set_duty(2500); + let _ = channel.set_duty_cycle(2500); count_down.start(400.millis()); let _ = nb::block!(count_down.wait()); // 0° to 90° - channel.set_duty(3930); + let _ = channel.set_duty_cycle(3930); count_down.start(400.millis()); let _ = nb::block!(count_down.wait()); // 90° to 180° - channel.set_duty(7860); + let _ = channel.set_duty_cycle(7860); count_down.start(400.millis()); let _ = nb::block!(count_down.wait()); // 180° to 90° - channel.set_duty(3930); + let _ = channel.set_duty_cycle(3930); count_down.start(400.millis()); let _ = nb::block!(count_down.wait()); } diff --git a/boards/rp-pico/examples/pico_rtic.rs b/boards/rp-pico/examples/pico_rtic.rs index 432429b..b27c531 100644 --- a/boards/rp-pico/examples/pico_rtic.rs +++ b/boards/rp-pico/examples/pico_rtic.rs @@ -6,7 +6,7 @@ use panic_halt as _; #[rtic::app(device = rp_pico::hal::pac, peripherals = true)] mod app { - use embedded_hal::digital::v2::OutputPin; + use embedded_hal::digital::OutputPin; use fugit::MicrosDurationU32; use rp_pico::{ hal::{self, clocks::init_clocks_and_plls, timer::Alarm, watchdog::Watchdog, Sio}, diff --git a/boards/rp-pico/examples/pico_rtic_monotonic.rs b/boards/rp-pico/examples/pico_rtic_monotonic.rs index 6ca64c7..e128688 100644 --- a/boards/rp-pico/examples/pico_rtic_monotonic.rs +++ b/boards/rp-pico/examples/pico_rtic_monotonic.rs @@ -6,7 +6,7 @@ use panic_halt as _; #[rtic::app(device = rp_pico::hal::pac, peripherals = true, dispatchers = [I2C0_IRQ])] mod app { - use embedded_hal::digital::v2::OutputPin; + use embedded_hal::digital::OutputPin; use fugit::ExtU64; use rp_pico::{ hal::{ diff --git a/boards/rp-pico/examples/pico_spi_sd_card.rs b/boards/rp-pico/examples/pico_spi_sd_card.rs index e38b0f2..d68cb65 100644 --- a/boards/rp-pico/examples/pico_spi_sd_card.rs +++ b/boards/rp-pico/examples/pico_spi_sd_card.rs @@ -59,8 +59,6 @@ #![no_std] #![no_main] -use core::cell::RefCell; - // The macro for our start-up function use rp_pico::entry; @@ -100,8 +98,8 @@ use embedded_sdmmc::{SdCard, TimeSource, Timestamp, VolumeIdx, VolumeManager}; // Get the file open mode enum: use embedded_sdmmc::filesystem::Mode; -use embedded_hal::blocking::delay::DelayMs; -use embedded_hal::blocking::delay::DelayUs; +use embedded_hal::delay::DelayNs; +use rp2040_hal::Timer; /// A dummy timesource, which is mostly important for creating files. #[derive(Default)] @@ -132,8 +130,8 @@ const BLINK_ERR_5_SHORT: [u8; 10] = [1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8 const BLINK_ERR_6_SHORT: [u8; 12] = [1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0u8, 1u8, 0u8]; fn blink_signals( - pin: &mut dyn embedded_hal::digital::v2::OutputPin, - delay: &mut dyn DelayMs, + pin: &mut dyn embedded_hal::digital::OutputPin, + delay: &mut dyn DelayNs, sig: &[u8], ) { for bit in sig { @@ -156,8 +154,8 @@ fn blink_signals( } fn blink_signals_loop( - pin: &mut dyn embedded_hal::digital::v2::OutputPin, - delay: &mut dyn DelayMs, + pin: &mut dyn embedded_hal::digital::OutputPin, + delay: &mut dyn DelayNs, sig: &[u8], ) -> ! { loop { @@ -172,7 +170,7 @@ fn main() -> ! { // Grab our singleton objects let mut pac = pac::Peripherals::take().unwrap(); - let core = pac::CorePeripherals::take().unwrap(); + let _core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); @@ -223,12 +221,7 @@ fn main() -> ! { embedded_hal::spi::MODE_0, ); - // We need a delay implementation that can be passed to SdCard and still be used - // for the blink signals. - let mut delay = &SharedDelay::new(cortex_m::delay::Delay::new( - core.SYST, - clocks.system_clock.freq().to_Hz(), - )); + let mut delay = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); info!("Initialize SPI SD/MMC data structures..."); let sdcard = SdCard::new(spi, spi_cs, delay); @@ -346,29 +339,3 @@ fn main() -> ! { delay.delay_ms(1000); } } - -// Can be removed once we have https://github.com/rp-rs/rp-hal/pull/614, -// ie. when we move to rp2040-hal 0.9 -struct SharedDelay { - inner: RefCell, -} - -impl SharedDelay { - fn new(delay: cortex_m::delay::Delay) -> Self { - Self { - inner: delay.into(), - } - } -} - -impl DelayMs for &SharedDelay { - fn delay_ms(&mut self, ms: u32) { - self.inner.borrow_mut().delay_ms(ms); - } -} - -impl DelayUs for &SharedDelay { - fn delay_us(&mut self, us: u8) { - self.inner.borrow_mut().delay_us(us as u32); - } -} diff --git a/boards/rp-pico/examples/pico_uart_irq_buffer.rs b/boards/rp-pico/examples/pico_uart_irq_buffer.rs index 14a1f5f..e5d674f 100644 --- a/boards/rp-pico/examples/pico_uart_irq_buffer.rs +++ b/boards/rp-pico/examples/pico_uart_irq_buffer.rs @@ -19,7 +19,8 @@ // These are the traits we need from Embedded HAL to treat our hardware // objects as generic embedded devices. -use embedded_hal::{digital::v2::OutputPin, serial::Write as UartWrite}; +use embedded_hal::digital::OutputPin; +use embedded_hal_0_2::serial::Write as UartWrite; // The writeln! trait. use core::fmt::Write; diff --git a/boards/rp-pico/examples/pico_uart_irq_echo.rs b/boards/rp-pico/examples/pico_uart_irq_echo.rs index 3b1c34e..a52650b 100644 --- a/boards/rp-pico/examples/pico_uart_irq_echo.rs +++ b/boards/rp-pico/examples/pico_uart_irq_echo.rs @@ -17,10 +17,8 @@ // These are the traits we need from Embedded HAL to treat our hardware // objects as generic embedded devices. -use embedded_hal::{ - digital::v2::OutputPin, - serial::{Read, Write}, -}; +use embedded_hal::digital::OutputPin; +use embedded_hal_0_2::serial::{Read, Write}; // We also need this for the 'Delay' object to work. use rp2040_hal::Clock; diff --git a/boards/rp-pico/examples/pico_usb_serial.rs b/boards/rp-pico/examples/pico_usb_serial.rs index 29ccb22..30724d5 100644 --- a/boards/rp-pico/examples/pico_usb_serial.rs +++ b/boards/rp-pico/examples/pico_usb_serial.rs @@ -94,9 +94,11 @@ fn main() -> ! { // Create a USB device with a fake VID and PID let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd)) - .manufacturer("Fake company") - .product("Serial port") - .serial_number("TEST") + .strings(&[StringDescriptors::default() + .manufacturer("Fake company") + .product("Serial port") + .serial_number("TEST")]) + .unwrap() .device_class(2) // from: https://www.usb.org/defined-class-codes .build(); diff --git a/boards/rp-pico/examples/pico_usb_serial_interrupt.rs b/boards/rp-pico/examples/pico_usb_serial_interrupt.rs index 676d576..6f896aa 100644 --- a/boards/rp-pico/examples/pico_usb_serial_interrupt.rs +++ b/boards/rp-pico/examples/pico_usb_serial_interrupt.rs @@ -19,7 +19,7 @@ use rp_pico::entry; use rp_pico::hal::pac::interrupt; // GPIO traits -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::digital::OutputPin; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) @@ -108,9 +108,11 @@ fn main() -> ! { // Create a USB device with a fake VID and PID let usb_dev = UsbDeviceBuilder::new(bus_ref, UsbVidPid(0x16c0, 0x27dd)) - .manufacturer("Fake company") - .product("Serial port") - .serial_number("TEST") + .strings(&[StringDescriptors::default() + .manufacturer("Fake company") + .product("Serial port") + .serial_number("TEST")]) + .unwrap() .device_class(2) // from: https://www.usb.org/defined-class-codes .build(); unsafe { diff --git a/boards/rp-pico/examples/pico_usb_twitchy_mouse.rs b/boards/rp-pico/examples/pico_usb_twitchy_mouse.rs index 5779b09..8224f5f 100644 --- a/boards/rp-pico/examples/pico_usb_twitchy_mouse.rs +++ b/boards/rp-pico/examples/pico_usb_twitchy_mouse.rs @@ -120,9 +120,11 @@ fn main() -> ! { // Create a USB device with a fake VID and PID let usb_dev = UsbDeviceBuilder::new(bus_ref, UsbVidPid(0x16c0, 0x27da)) - .manufacturer("Fake company") - .product("Twitchy Mousey") - .serial_number("TEST") + .strings(&[StringDescriptors::default() + .manufacturer("Fake company") + .product("Twitchy Mousey") + .serial_number("TEST")]) + .unwrap() .device_class(0) .build(); unsafe { From 188175cacd0c139ff07fcf610f411ecf49243241 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 17:12:55 +0200 Subject: [PATCH 26/37] Compile boardsource-blok examples --- boards/boardsource-blok/Cargo.toml | 1 + boards/boardsource-blok/examples/blok_rainbow.rs | 2 +- boards/boardsource-blok/examples/blok_usb_keyboard_input.rs | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/boards/boardsource-blok/Cargo.toml b/boards/boardsource-blok/Cargo.toml index c069363..289aebf 100644 --- a/boards/boardsource-blok/Cargo.toml +++ b/boards/boardsource-blok/Cargo.toml @@ -20,6 +20,7 @@ fugit.workspace = true [dev-dependencies] panic-halt.workspace = true embedded-hal.workspace = true +embedded_hal_0_2.workspace = true nb.workspace = true smart-leds.workspace = true ws2812-pio.workspace = true diff --git a/boards/boardsource-blok/examples/blok_rainbow.rs b/boards/boardsource-blok/examples/blok_rainbow.rs index 6f0b98d..17dcaa3 100644 --- a/boards/boardsource-blok/examples/blok_rainbow.rs +++ b/boards/boardsource-blok/examples/blok_rainbow.rs @@ -22,7 +22,7 @@ use boardsource_blok::{ Pins, XOSC_CRYSTAL_FREQ, }; use core::iter::once; -use embedded_hal::timer::CountDown; +use embedded_hal_0_2::timer::CountDown; use fugit::ExtU32; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; diff --git a/boards/boardsource-blok/examples/blok_usb_keyboard_input.rs b/boards/boardsource-blok/examples/blok_usb_keyboard_input.rs index 724dcd4..8bc6096 100644 --- a/boards/boardsource-blok/examples/blok_usb_keyboard_input.rs +++ b/boards/boardsource-blok/examples/blok_usb_keyboard_input.rs @@ -28,7 +28,8 @@ use boardsource_blok::{ }; use panic_halt as _; use usb_device::{ - bus::UsbBusAllocator, device::UsbDevice, device::UsbDeviceBuilder, device::UsbVidPid, + bus::UsbBusAllocator, + device::{StringDescriptors, UsbDevice, UsbDeviceBuilder, UsbVidPid}, }; use usbd_hid::{descriptor::KeyboardReport, descriptor::SerializedDescriptor, hid_class::HIDClass}; @@ -84,7 +85,8 @@ fn main() -> ! { } let usb_device = UsbDeviceBuilder::new(bus_ref, UsbVidPid(0x1209, 0x0001)) - .product("keyboard input") + .strings(&[StringDescriptors::default().product("keyboard input")]) + .unwrap() .build(); unsafe { USB_DEVICE = Some(usb_device); From d3a94e7117405f95ed690fa09f98abb2a767a812 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 17:15:17 +0200 Subject: [PATCH 27/37] Compile seeeduino-xiao-rp2040 examples --- .../examples/seeeduino_xiao_rp2040_blinky.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/boards/seeeduino-xiao-rp2040/examples/seeeduino_xiao_rp2040_blinky.rs b/boards/seeeduino-xiao-rp2040/examples/seeeduino_xiao_rp2040_blinky.rs index 337a53c..94969b4 100644 --- a/boards/seeeduino-xiao-rp2040/examples/seeeduino_xiao_rp2040_blinky.rs +++ b/boards/seeeduino-xiao-rp2040/examples/seeeduino_xiao_rp2040_blinky.rs @@ -14,8 +14,8 @@ use seeeduino_xiao_rp2040::entry; // GPIO traits -use embedded_hal::digital::v2::OutputPin; -use embedded_hal::PwmPin; +use embedded_hal::digital::OutputPin; +use embedded_hal::pwm::SetDutyCycle; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) @@ -97,7 +97,7 @@ fn main() -> ! { // Output channel B on PWM0 to the red LED pin, initially off let channel = &mut pwm.channel_b; channel.output_to(pins.led_red); - channel.set_duty(u16::MAX); + let _ = channel.set_duty_cycle(u16::MAX); // Set the blue LED to be an output, initially off let mut led_blue_pin = pins.led_blue.into_push_pull_output_in_state(PinState::High); @@ -119,13 +119,13 @@ fn main() -> ! { // Ramp red LED brightness up for i in (LOW..=HIGH).skip(30) { delay.delay_us(100); - channel.set_duty(u16::MAX - i); + let _ = channel.set_duty_cycle(u16::MAX - i); } // Ramp red LED brightness down for i in (LOW..=HIGH).rev().skip(30) { delay.delay_us(100); - channel.set_duty(u16::MAX - i); + let _ = channel.set_duty_cycle(u16::MAX - i); } } } From b2fcb0184fa30eb2f580b76bb6bbf212c0a49950 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 17:51:02 +0200 Subject: [PATCH 28/37] Update deps --- Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3cc37f5..f804f14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ embedded_hal_0_2 = { package = "embedded-hal", version = "0.2.5", features = ["u fugit = "0.3.7" hd44780-driver = "0.4.0" heapless = "0.7.16" -i2c-pio = { version = "0.8.0", git = "https://github.com/jannic/i2c-pio-rs/", rev = "969d427" } +i2c-pio = "0.8.0" nb = "1.1" panic-halt= "0.2.0" panic-probe = "0.3.1" @@ -60,4 +60,5 @@ ssd1306 = "0.7.1" usb-device = "0.3" usbd-hid = "0.7.0" usbd-serial = "0.2.1" +# https://github.com/rp-rs/ws2812-pio-rs/pull/31 ws2812-pio = { version = "0.7.0", git = "https://github.com/moosingin3space/ws2812-pio-rs/", rev = "c153eca" } From 4eadec3e73adc7bb1124ade1a75366260802ae99 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 18:38:15 +0200 Subject: [PATCH 29/37] Update ws2812-pio dep --- Cargo.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f804f14..70bc991 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,5 +60,4 @@ ssd1306 = "0.7.1" usb-device = "0.3" usbd-hid = "0.7.0" usbd-serial = "0.2.1" -# https://github.com/rp-rs/ws2812-pio-rs/pull/31 -ws2812-pio = { version = "0.7.0", git = "https://github.com/moosingin3space/ws2812-pio-rs/", rev = "c153eca" } +ws2812-pio = { version = "0.7.0", git = "https://github.com/rp-rs/ws2812-pio-rs/", rev = "a648210" } From ff919808a45d130fbc59c10517b593a5e3a6356d Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 19:22:46 +0200 Subject: [PATCH 30/37] Use DelayNs instead of CountDown --- boards/adafruit-feather-rp2040/Cargo.toml | 1 - .../adafruit_feather_neopixel_rainbow.rs | 8 +++---- boards/adafruit-itsy-bitsy-rp2040/Cargo.toml | 1 - .../examples/adafruit_itsy_bitsy_rainbow.rs | 8 +++---- boards/adafruit-kb2040/Cargo.toml | 1 - .../examples/adafruit_kb2040_rainbow.rs | 8 +++---- boards/adafruit-metro-rp2040/Cargo.toml | 1 - .../examples/adafruit_metro_rainbow.rs | 8 +++---- boards/adafruit-qt-py-rp2040/Cargo.toml | 1 - .../examples/adafruit_qt_py_rp2040_rainbow.rs | 8 +++---- boards/adafruit-trinkey-qt2040/Cargo.toml | 1 - .../adafruit_trinkey_qt2040_rainbow.rs | 8 +++---- boards/boardsource-blok/Cargo.toml | 1 - .../boardsource-blok/examples/blok_rainbow.rs | 8 +++---- boards/pimoroni-servo2040/Cargo.toml | 1 - .../examples/pimoroni_servo2040_pwm_servo.rs | 22 ++++++------------- .../examples/pimoroni_servo2040_rainbow.rs | 8 +++---- boards/pimoroni-tufty2040/Cargo.toml | 1 - .../pimoroni-tufty2040/examples/tufty_demo.rs | 15 +++++-------- boards/pimoroni_badger2040/Cargo.toml | 1 - .../examples/badger_blinky.rs | 16 +++++--------- .../examples/pico_i2c_oled_display_ssd1306.rs | 12 +++++----- boards/solderparty-rp2040-stamp/Cargo.toml | 1 - .../solderparty_stamp_neopixel_rainbow.rs | 8 +++---- boards/sparkfun-pro-micro-rp2040/Cargo.toml | 1 - .../examples/sparkfun_pro_micro_rainbow.rs | 8 +++---- boards/sparkfun-thing-plus-rp2040/Cargo.toml | 1 - .../examples/sparkfun_thing_plus_rainbow.rs | 8 +++---- boards/vcc-gnd-yd-rp2040/Cargo.toml | 1 - .../examples/yd_rp2040_neopixel_rainbow.rs | 8 +++---- boards/waveshare-rp2040-zero/Cargo.toml | 1 - .../waveshare_rp2040_zero_neopixel_rainbow.rs | 8 +++---- 32 files changed, 62 insertions(+), 122 deletions(-) diff --git a/boards/adafruit-feather-rp2040/Cargo.toml b/boards/adafruit-feather-rp2040/Cargo.toml index 219a24c..0f8ae78 100644 --- a/boards/adafruit-feather-rp2040/Cargo.toml +++ b/boards/adafruit-feather-rp2040/Cargo.toml @@ -19,7 +19,6 @@ rp2040-hal.workspace = true cortex-m.workspace = true panic-halt.workspace = true embedded-hal.workspace = true -embedded_hal_0_2.workspace = true fugit.workspace = true nb.workspace = true smart-leds.workspace = true diff --git a/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs index c3a5119..54b2422 100644 --- a/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs +++ b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs @@ -19,8 +19,7 @@ use adafruit_feather_rp2040::{ Pins, XOSC_CRYSTAL_FREQ, }; use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; @@ -52,7 +51,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -71,8 +70,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml b/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml index cba10bc..3c2e366 100644 --- a/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml +++ b/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml @@ -19,7 +19,6 @@ rp2040-hal.workspace = true cortex-m.workspace = true panic-halt.workspace = true embedded-hal.workspace = true -embedded_hal_0_2.workspace = true smart-leds.workspace = true nb.workspace = true ws2812-pio.workspace = true diff --git a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs index 8c17a9a..a677640 100644 --- a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs +++ b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs @@ -4,8 +4,7 @@ use adafruit_itsy_bitsy_rp2040::entry; use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; @@ -54,7 +53,7 @@ fn main() -> ! { .into_push_pull_output_in_state(PinState::High); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); let mut ws = Ws2812::new( @@ -70,8 +69,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/adafruit-kb2040/Cargo.toml b/boards/adafruit-kb2040/Cargo.toml index 50a89c4..3951f08 100644 --- a/boards/adafruit-kb2040/Cargo.toml +++ b/boards/adafruit-kb2040/Cargo.toml @@ -18,7 +18,6 @@ rp2040-hal.workspace = true [dev-dependencies] embedded-hal.workspace = true -embedded_hal_0_2.workspace = true heapless.workspace = true fugit.workspace = true nb.workspace = true diff --git a/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs index cb18c8a..98c3e63 100644 --- a/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs +++ b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs @@ -10,8 +10,7 @@ use adafruit_kb2040::entry; use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use adafruit_kb2040::{ @@ -64,7 +63,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -84,8 +83,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/adafruit-metro-rp2040/Cargo.toml b/boards/adafruit-metro-rp2040/Cargo.toml index 3e284db..3e8312f 100644 --- a/boards/adafruit-metro-rp2040/Cargo.toml +++ b/boards/adafruit-metro-rp2040/Cargo.toml @@ -19,7 +19,6 @@ rp2040-hal.workspace = true cortex-m.workspace = true panic-halt.workspace = true embedded-hal.workspace = true -embedded_hal_0_2.workspace = true smart-leds.workspace = true nb.workspace = true ws2812-pio.workspace = true diff --git a/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs b/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs index b051648..532dfc3 100644 --- a/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs +++ b/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs @@ -4,8 +4,7 @@ use adafruit_metro_rp2040::entry; use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; @@ -50,7 +49,7 @@ fn main() -> ! { let led = pins.neopixel_data.into_function(); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); let mut ws = Ws2812::new( @@ -66,8 +65,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/adafruit-qt-py-rp2040/Cargo.toml b/boards/adafruit-qt-py-rp2040/Cargo.toml index 0879a77..6478cf2 100644 --- a/boards/adafruit-qt-py-rp2040/Cargo.toml +++ b/boards/adafruit-qt-py-rp2040/Cargo.toml @@ -18,7 +18,6 @@ rp2040-hal.workspace = true [dev-dependencies] panic-halt.workspace = true embedded-hal.workspace = true -embedded_hal_0_2.workspace = true smart-leds.workspace = true nb.workspace = true ws2812-pio.workspace = true diff --git a/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs index 9fd938b..c36f88f 100644 --- a/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs +++ b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs @@ -4,8 +4,7 @@ use adafruit_qt_py_rp2040::entry; use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; @@ -54,7 +53,7 @@ fn main() -> ! { .into_push_pull_output_in_state(PinState::High); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); let mut ws = Ws2812::new( @@ -70,8 +69,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25u32.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/adafruit-trinkey-qt2040/Cargo.toml b/boards/adafruit-trinkey-qt2040/Cargo.toml index 2cb93e0..e314218 100644 --- a/boards/adafruit-trinkey-qt2040/Cargo.toml +++ b/boards/adafruit-trinkey-qt2040/Cargo.toml @@ -18,7 +18,6 @@ rp2040-hal.workspace = true [dev-dependencies] panic-halt.workspace = true embedded-hal.workspace = true -embedded_hal_0_2.workspace = true smart-leds.workspace = true nb.workspace = true ws2812-pio.workspace = true diff --git a/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs b/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs index d5f940f..8480aa9 100644 --- a/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs +++ b/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs @@ -10,8 +10,7 @@ use adafruit_trinkey_qt2040::entry; use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use adafruit_trinkey_qt2040::{ @@ -64,7 +63,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -84,8 +83,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/boardsource-blok/Cargo.toml b/boards/boardsource-blok/Cargo.toml index 289aebf..c069363 100644 --- a/boards/boardsource-blok/Cargo.toml +++ b/boards/boardsource-blok/Cargo.toml @@ -20,7 +20,6 @@ fugit.workspace = true [dev-dependencies] panic-halt.workspace = true embedded-hal.workspace = true -embedded_hal_0_2.workspace = true nb.workspace = true smart-leds.workspace = true ws2812-pio.workspace = true diff --git a/boards/boardsource-blok/examples/blok_rainbow.rs b/boards/boardsource-blok/examples/blok_rainbow.rs index 17dcaa3..04a27fa 100644 --- a/boards/boardsource-blok/examples/blok_rainbow.rs +++ b/boards/boardsource-blok/examples/blok_rainbow.rs @@ -22,8 +22,7 @@ use boardsource_blok::{ Pins, XOSC_CRYSTAL_FREQ, }; use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; @@ -55,7 +54,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -74,8 +73,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/pimoroni-servo2040/Cargo.toml b/boards/pimoroni-servo2040/Cargo.toml index 35d81d8..28bb6ef 100644 --- a/boards/pimoroni-servo2040/Cargo.toml +++ b/boards/pimoroni-servo2040/Cargo.toml @@ -19,7 +19,6 @@ rp2040-hal.workspace = true defmt.workspace = true defmt-rtt.workspace = true embedded-hal.workspace = true -embedded_hal_0_2.workspace = true fugit.workspace = true nb.workspace = true panic-halt.workspace = true diff --git a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs index aef1ce8..18ed1c4 100644 --- a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs +++ b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_pwm_servo.rs @@ -7,11 +7,8 @@ #![no_main] // GPIO traits +use embedded_hal::delay::DelayNs; use embedded_hal::pwm::SetDutyCycle; -use embedded_hal_0_2::timer::CountDown; - -// Traits for converting integers to amounts of time -use fugit::ExtU64; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) @@ -50,8 +47,7 @@ fn main() -> ! { .unwrap(); // Configure the Timer peripheral in count-down mode - let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut count_down = timer.count_down(); + let mut timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); let pins = pimoroni_servo2040::Pins::new( pac.IO_BANK0, @@ -98,7 +94,7 @@ fn main() -> ! { // Output channel A on PWM0 to the GPIO0/servo1 pin let mut channel_a = pwm.channel_a; let _channel_a_pin = channel_a.output_to(pins.servo1); - let movement_delay = 400.millis(); + let movement_delay_ms = 400; // Infinite loop, moving micro servo from one position to another. // You may need to adjust the pulse width since several servos from @@ -106,23 +102,19 @@ fn main() -> ! { loop { // move to 0° let _ = channel_a.set_duty_cycle(us_to_duty(MID_PULSE)); - count_down.start(movement_delay); - let _ = nb::block!(count_down.wait()); + timer.delay_ms(movement_delay_ms); // 0° to 90° let _ = channel_a.set_duty_cycle(us_to_duty(MAX_PULSE)); - count_down.start(movement_delay); - let _ = nb::block!(count_down.wait()); + timer.delay_ms(movement_delay_ms); // 90° to 0° let _ = channel_a.set_duty_cycle(us_to_duty(MID_PULSE)); - count_down.start(movement_delay); - let _ = nb::block!(count_down.wait()); + timer.delay_ms(movement_delay_ms); // 0° to -90° let _ = channel_a.set_duty_cycle(us_to_duty(MIN_PULSE)); - count_down.start(movement_delay); - let _ = nb::block!(count_down.wait()); + timer.delay_ms(movement_delay_ms); } } diff --git a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs index 6c2e2dd..de79619 100644 --- a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs +++ b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs @@ -11,8 +11,7 @@ use bsp::hal::{ }; use defmt::*; use defmt_rtt as _; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use pimoroni_servo2040 as bsp; use rp2040_hal::pio::PIOExt; @@ -48,7 +47,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -80,8 +79,7 @@ fn main() -> ! { .unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/pimoroni-tufty2040/Cargo.toml b/boards/pimoroni-tufty2040/Cargo.toml index 826bd8a..2f41df1 100644 --- a/boards/pimoroni-tufty2040/Cargo.toml +++ b/boards/pimoroni-tufty2040/Cargo.toml @@ -25,7 +25,6 @@ pio.workspace = true pio-proc.workspace = true [dev-dependencies] -embedded_hal_0_2.workspace = true panic-halt.workspace = true nb.workspace = true diff --git a/boards/pimoroni-tufty2040/examples/tufty_demo.rs b/boards/pimoroni-tufty2040/examples/tufty_demo.rs index c44d98e..1cfdfb3 100644 --- a/boards/pimoroni-tufty2040/examples/tufty_demo.rs +++ b/boards/pimoroni-tufty2040/examples/tufty_demo.rs @@ -34,14 +34,12 @@ use hal::Timer; use tufty::DummyPin; -// A few traits required for using the CountDown timer use embedded_graphics::draw_target::DrawTarget; use embedded_graphics::geometry::Point; use embedded_graphics::pixelcolor::{Rgb565, RgbColor}; use embedded_graphics::primitives::{Circle, Primitive, PrimitiveStyleBuilder}; use embedded_graphics::Drawable; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use st7789::ST7789; #[entry] @@ -79,9 +77,8 @@ fn main() -> ! { &mut pac.RESETS, ); - // Configure the timer peripheral to be a CountDown timer for our blinky delay - let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay_timer = timer.count_down(); + // Configure the timer peripheral for our blinky delay + let mut timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); let mut delay = cortex_m::delay::Delay::new(cp.SYST, clocks.system_clock.get_freq().to_Hz()); @@ -141,12 +138,10 @@ fn main() -> ! { loop { // LED on, and wait for 500ms led_pin.set_high().unwrap(); - delay_timer.start(500.millis()); - let _ = nb::block!(delay_timer.wait()); + timer.delay_ms(500); // LED off, and wait for 500ms led_pin.set_low().unwrap(); - delay_timer.start(500.millis()); - let _ = nb::block!(delay_timer.wait()); + timer.delay_ms(500); } } diff --git a/boards/pimoroni_badger2040/Cargo.toml b/boards/pimoroni_badger2040/Cargo.toml index a699c76..4d383af 100644 --- a/boards/pimoroni_badger2040/Cargo.toml +++ b/boards/pimoroni_badger2040/Cargo.toml @@ -18,7 +18,6 @@ rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true [dev-dependencies] -embedded_hal_0_2.workspace = true panic-halt.workspace = true nb.workspace = true diff --git a/boards/pimoroni_badger2040/examples/badger_blinky.rs b/boards/pimoroni_badger2040/examples/badger_blinky.rs index 7deb36a..197e9e0 100644 --- a/boards/pimoroni_badger2040/examples/badger_blinky.rs +++ b/boards/pimoroni_badger2040/examples/badger_blinky.rs @@ -26,9 +26,8 @@ use pimoroni_badger2040::hal::Timer; // higher-level drivers. use pimoroni_badger2040::hal; -// A few traits required for using the CountDown timer -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +// A few traits required for using the delay with timer +use embedded_hal::delay::DelayNs; #[entry] fn main() -> ! { @@ -64,9 +63,8 @@ fn main() -> ! { &mut pac.RESETS, ); - // Configure the timer peripheral to be a CountDown timer for our blinky delay - let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + // Configure the timer peripheral for our blinky delay + let mut timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); // Set the LED to be an output let mut led_pin = pins.led.into_push_pull_output(); @@ -75,12 +73,10 @@ fn main() -> ! { loop { // LED on, and wait for 500ms led_pin.set_high().unwrap(); - delay.start(500.millis()); - let _ = nb::block!(delay.wait()); + timer.delay_ms(500); // LED off, and wait for 500ms led_pin.set_low().unwrap(); - delay.start(500.millis()); - let _ = nb::block!(delay.wait()); + timer.delay_ms(500); } } diff --git a/boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs b/boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs index c452195..cfa9d0e 100644 --- a/boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs +++ b/boards/rp-pico/examples/pico_i2c_oled_display_ssd1306.rs @@ -48,10 +48,10 @@ use core::fmt::Write; use rp_pico::entry; // Time handling traits: -use fugit::{ExtU32, RateExtU32}; +use fugit::RateExtU32; -// CountDown timer for the counter on the display: -use embedded_hal_0_2::timer::CountDown; +// Timer for the delay on the display: +use embedded_hal::delay::DelayNs; // Ensure we halt the program on panic (if we don't mention this crate it won't // be linked) @@ -150,8 +150,7 @@ fn main() -> ! { .text_color(BinaryColor::On) .build(); - let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); let mut count = 0; @@ -181,8 +180,7 @@ fn main() -> ! { display.flush().unwrap(); // Wait a bit: - delay.start(500.millis()); - let _ = nb::block!(delay.wait()); + timer.delay_ms(500); } } diff --git a/boards/solderparty-rp2040-stamp/Cargo.toml b/boards/solderparty-rp2040-stamp/Cargo.toml index 4740c77..68779e9 100644 --- a/boards/solderparty-rp2040-stamp/Cargo.toml +++ b/boards/solderparty-rp2040-stamp/Cargo.toml @@ -16,7 +16,6 @@ rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true [dev-dependencies] -embedded_hal_0_2.workspace = true embedded-hal.workspace = true fugit.workspace = true nb.workspace = true diff --git a/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs b/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs index 9d5d7dc..6dd0085 100644 --- a/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs +++ b/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs @@ -7,8 +7,7 @@ #![no_main] use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use solderparty_rp2040_stamp::entry; @@ -52,7 +51,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -71,8 +70,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25u32.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/sparkfun-pro-micro-rp2040/Cargo.toml b/boards/sparkfun-pro-micro-rp2040/Cargo.toml index 7b0f6e2..55144d9 100644 --- a/boards/sparkfun-pro-micro-rp2040/Cargo.toml +++ b/boards/sparkfun-pro-micro-rp2040/Cargo.toml @@ -17,7 +17,6 @@ rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true [dev-dependencies] -embedded_hal_0_2.workspace = true fugit.workspace = true nb.workspace = true panic-halt.workspace = true diff --git a/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs index e7272a7..61fcce5 100644 --- a/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs +++ b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs @@ -9,8 +9,7 @@ #![no_main] use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use sparkfun_pro_micro_rp2040::entry; @@ -64,7 +63,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -83,8 +82,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/sparkfun-thing-plus-rp2040/Cargo.toml b/boards/sparkfun-thing-plus-rp2040/Cargo.toml index e76667e..b63f8bb 100644 --- a/boards/sparkfun-thing-plus-rp2040/Cargo.toml +++ b/boards/sparkfun-thing-plus-rp2040/Cargo.toml @@ -17,7 +17,6 @@ rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true [dev-dependencies] -embedded_hal_0_2.workspace = true panic-halt.workspace = true smart-leds.workspace = true nb.workspace = true diff --git a/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs b/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs index 9d20956..db4db42 100644 --- a/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs +++ b/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs @@ -9,8 +9,7 @@ #![no_main] use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; @@ -63,7 +62,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -82,8 +81,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/vcc-gnd-yd-rp2040/Cargo.toml b/boards/vcc-gnd-yd-rp2040/Cargo.toml index 4985c4c..e195fb5 100644 --- a/boards/vcc-gnd-yd-rp2040/Cargo.toml +++ b/boards/vcc-gnd-yd-rp2040/Cargo.toml @@ -20,7 +20,6 @@ usb-device.workspace = true [dev-dependencies] cortex-m.workspace = true embedded-hal.workspace = true -embedded_hal_0_2.workspace = true nb.workspace = true panic-halt.workspace = true pio.workspace = true diff --git a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs index 6cde379..87fcea4 100644 --- a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs +++ b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs @@ -7,8 +7,7 @@ #![no_main] use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use vcc_gnd_yd_rp2040::entry; @@ -52,7 +51,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -71,8 +70,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } diff --git a/boards/waveshare-rp2040-zero/Cargo.toml b/boards/waveshare-rp2040-zero/Cargo.toml index f44d7e7..64698fe 100644 --- a/boards/waveshare-rp2040-zero/Cargo.toml +++ b/boards/waveshare-rp2040-zero/Cargo.toml @@ -17,7 +17,6 @@ rp2040-hal.workspace = true [dev-dependencies] cortex-m.workspace = true -embedded_hal_0_2.workspace = true panic-halt.workspace = true embedded-hal.workspace = true fugit.workspace = true diff --git a/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs b/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs index 0b6c77a..2b666be 100644 --- a/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs +++ b/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs @@ -7,8 +7,7 @@ #![no_main] use core::iter::once; -use embedded_hal_0_2::timer::CountDown; -use fugit::ExtU32; +use embedded_hal::delay::DelayNs; use panic_halt as _; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use waveshare_rp2040_zero::entry; @@ -52,7 +51,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.count_down(); + let mut delay = timer.clone(); // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -71,8 +70,7 @@ fn main() -> ! { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.start(25.millis()); - let _ = nb::block!(delay.wait()); + delay.delay_ms(25); } } From 31c808b246b6cb96857daf7881a2a50244a69539 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 20:37:50 +0200 Subject: [PATCH 31/37] Make clippy happy --- .../examples/adafruit_feather_neopixel_rainbow.rs | 2 +- .../examples/adafruit_itsy_bitsy_rainbow.rs | 2 +- boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs | 2 +- boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs | 2 +- .../examples/adafruit_qt_py_rp2040_rainbow.rs | 2 +- .../examples/adafruit_trinkey_qt2040_rainbow.rs | 2 +- boards/boardsource-blok/examples/blok_rainbow.rs | 2 +- .../pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs | 2 +- .../examples/solderparty_stamp_neopixel_rainbow.rs | 2 +- .../examples/sparkfun_pro_micro_rainbow.rs | 2 +- .../examples/sparkfun_thing_plus_rainbow.rs | 2 +- boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs | 2 +- .../examples/waveshare_rp2040_zero_neopixel_rainbow.rs | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs index 54b2422..1965655 100644 --- a/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs +++ b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs @@ -51,7 +51,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); diff --git a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs index a677640..0400367 100644 --- a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs +++ b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs @@ -53,7 +53,7 @@ fn main() -> ! { .into_push_pull_output_in_state(PinState::High); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); let mut ws = Ws2812::new( diff --git a/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs index 98c3e63..2ac33f8 100644 --- a/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs +++ b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs @@ -63,7 +63,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); diff --git a/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs b/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs index 532dfc3..d228667 100644 --- a/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs +++ b/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs @@ -49,7 +49,7 @@ fn main() -> ! { let led = pins.neopixel_data.into_function(); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); let mut ws = Ws2812::new( diff --git a/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs index c36f88f..f246ce4 100644 --- a/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs +++ b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs @@ -53,7 +53,7 @@ fn main() -> ! { .into_push_pull_output_in_state(PinState::High); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); let mut ws = Ws2812::new( diff --git a/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs b/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs index 8480aa9..185a4d5 100644 --- a/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs +++ b/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs @@ -63,7 +63,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); diff --git a/boards/boardsource-blok/examples/blok_rainbow.rs b/boards/boardsource-blok/examples/blok_rainbow.rs index 04a27fa..4dd157b 100644 --- a/boards/boardsource-blok/examples/blok_rainbow.rs +++ b/boards/boardsource-blok/examples/blok_rainbow.rs @@ -54,7 +54,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); diff --git a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs index de79619..24d6fdf 100644 --- a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs +++ b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs @@ -47,7 +47,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); diff --git a/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs b/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs index 6dd0085..66bb717 100644 --- a/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs +++ b/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs @@ -51,7 +51,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); diff --git a/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs index 61fcce5..11c2545 100644 --- a/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs +++ b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs @@ -63,7 +63,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); diff --git a/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs b/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs index db4db42..91776e9 100644 --- a/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs +++ b/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs @@ -62,7 +62,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); diff --git a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs index 87fcea4..edf2ddd 100644 --- a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs +++ b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs @@ -51,7 +51,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); diff --git a/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs b/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs index 2b666be..b3acc29 100644 --- a/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs +++ b/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs @@ -51,7 +51,7 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer.clone(); + let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); From 8ce38979c0c08a3001f94ec69fc6082fcde422bf Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sat, 16 Mar 2024 23:37:23 +0200 Subject: [PATCH 32/37] Use embedded_hal_nb::serial instead of embedded_hal_0_2::serial --- Cargo.toml | 3 ++- boards/rp-pico/Cargo.toml | 2 +- boards/rp-pico/examples/pico_uart_irq_buffer.rs | 2 +- boards/rp-pico/examples/pico_uart_irq_echo.rs | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 70bc991..3d53ca0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,8 @@ defmt-rtt = "0.4.0" display-interface = "0.4.1" display-interface-spi = "0.4.1" embedded-graphics = "0.7.1" -embedded-hal ="1.0.0" +embedded-hal = "1.0.0" +embedded-hal-nb = "1.0.0" embedded-sdmmc = "0.5.0" embedded_hal_0_2 = { package = "embedded-hal", version = "0.2.5", features = ["unproven", ] } fugit = "0.3.7" diff --git a/boards/rp-pico/Cargo.toml b/boards/rp-pico/Cargo.toml index c120954..83b3f57 100644 --- a/boards/rp-pico/Cargo.toml +++ b/boards/rp-pico/Cargo.toml @@ -23,8 +23,8 @@ cortex-m-rtic.workspace = true critical-section.workspace = true embedded-graphics.workspace = true embedded-hal.workspace = true +embedded-hal-nb.workspace = true embedded-sdmmc.workspace = true -embedded_hal_0_2.workspace = true hd44780-driver.workspace = true heapless.workspace = true i2c-pio.workspace = true diff --git a/boards/rp-pico/examples/pico_uart_irq_buffer.rs b/boards/rp-pico/examples/pico_uart_irq_buffer.rs index e5d674f..4359b26 100644 --- a/boards/rp-pico/examples/pico_uart_irq_buffer.rs +++ b/boards/rp-pico/examples/pico_uart_irq_buffer.rs @@ -20,7 +20,7 @@ // These are the traits we need from Embedded HAL to treat our hardware // objects as generic embedded devices. use embedded_hal::digital::OutputPin; -use embedded_hal_0_2::serial::Write as UartWrite; +use embedded_hal_nb::serial::Write as UartWrite; // The writeln! trait. use core::fmt::Write; diff --git a/boards/rp-pico/examples/pico_uart_irq_echo.rs b/boards/rp-pico/examples/pico_uart_irq_echo.rs index a52650b..70921f5 100644 --- a/boards/rp-pico/examples/pico_uart_irq_echo.rs +++ b/boards/rp-pico/examples/pico_uart_irq_echo.rs @@ -18,7 +18,7 @@ // These are the traits we need from Embedded HAL to treat our hardware // objects as generic embedded devices. use embedded_hal::digital::OutputPin; -use embedded_hal_0_2::serial::{Read, Write}; +use embedded_hal_nb::serial::{Read, Write}; // We also need this for the 'Delay' object to work. use rp2040_hal::Clock; From 0a681ab713b211aa79e4af40a7599efe60a67283 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sun, 17 Mar 2024 10:18:17 +0200 Subject: [PATCH 33/37] Bump ws2812-pio to 0.8.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3d53ca0..62f014e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,4 +61,4 @@ ssd1306 = "0.7.1" usb-device = "0.3" usbd-hid = "0.7.0" usbd-serial = "0.2.1" -ws2812-pio = { version = "0.7.0", git = "https://github.com/rp-rs/ws2812-pio-rs/", rev = "a648210" } +ws2812-pio = "0.8.0" From 5a06d242c4c0864d6522516b72aeafb3ce504f59 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sun, 17 Mar 2024 11:40:31 +0200 Subject: [PATCH 34/37] Use timer variable name --- .../examples/adafruit_feather_neopixel_rainbow.rs | 4 ++-- .../examples/adafruit_itsy_bitsy_rainbow.rs | 4 ++-- boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs | 4 ++-- .../adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs | 4 ++-- .../examples/adafruit_qt_py_rp2040_rainbow.rs | 4 ++-- .../examples/adafruit_trinkey_qt2040_rainbow.rs | 4 ++-- boards/boardsource-blok/examples/blok_rainbow.rs | 4 ++-- .../pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs | 4 ++-- .../examples/solderparty_stamp_neopixel_rainbow.rs | 4 ++-- .../examples/sparkfun_pro_micro_rainbow.rs | 4 ++-- .../examples/sparkfun_thing_plus_rainbow.rs | 4 ++-- .../vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs | 4 ++-- .../examples/waveshare_rp2040_zero_neopixel_rainbow.rs | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs index 1965655..5139d78 100644 --- a/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs +++ b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs @@ -51,7 +51,6 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -66,11 +65,12 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs index 0400367..2e8d17c 100644 --- a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs +++ b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs @@ -53,7 +53,6 @@ fn main() -> ! { .into_push_pull_output_in_state(PinState::High); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); let mut ws = Ws2812::new( @@ -65,11 +64,12 @@ fn main() -> ! { ); let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs index 2ac33f8..b96ae46 100644 --- a/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs +++ b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs @@ -63,7 +63,6 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -79,11 +78,12 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs b/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs index d228667..3e874af 100644 --- a/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs +++ b/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs @@ -49,7 +49,6 @@ fn main() -> ! { let led = pins.neopixel_data.into_function(); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); let mut ws = Ws2812::new( @@ -61,11 +60,12 @@ fn main() -> ! { ); let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs index f246ce4..3953474 100644 --- a/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs +++ b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs @@ -53,7 +53,6 @@ fn main() -> ! { .into_push_pull_output_in_state(PinState::High); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); let mut ws = Ws2812::new( @@ -65,11 +64,12 @@ fn main() -> ! { ); let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs b/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs index 185a4d5..54c1403 100644 --- a/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs +++ b/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs @@ -63,7 +63,6 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -79,11 +78,12 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/boardsource-blok/examples/blok_rainbow.rs b/boards/boardsource-blok/examples/blok_rainbow.rs index 4dd157b..fb6dc35 100644 --- a/boards/boardsource-blok/examples/blok_rainbow.rs +++ b/boards/boardsource-blok/examples/blok_rainbow.rs @@ -54,7 +54,6 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -69,11 +68,12 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs index 24d6fdf..9e34048 100644 --- a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs +++ b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs @@ -47,7 +47,6 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -63,6 +62,7 @@ fn main() -> ! { // Infinite color wheel loop let mut n: u8 = 128; + let mut timer = timer; let offset = (256u16 / bsp::NUM_LEDS as u16) as u8; loop { ws.write(brightness( @@ -79,7 +79,7 @@ fn main() -> ! { .unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs b/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs index 66bb717..7da52b6 100644 --- a/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs +++ b/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs @@ -51,7 +51,6 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -66,11 +65,12 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs index 11c2545..75cbb57 100644 --- a/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs +++ b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs @@ -63,7 +63,6 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -78,11 +77,12 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs b/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs index 91776e9..5a5f18c 100644 --- a/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs +++ b/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs @@ -62,7 +62,6 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -77,11 +76,12 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs index edf2ddd..6254d86 100644 --- a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs +++ b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs @@ -51,7 +51,6 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -66,11 +65,12 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } diff --git a/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs b/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs index b3acc29..a90294c 100644 --- a/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs +++ b/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs @@ -51,7 +51,6 @@ fn main() -> ! { ); let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks); - let mut delay = timer; // Configure the addressable LED let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); @@ -66,11 +65,12 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; + let mut timer = timer; loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); - delay.delay_ms(25); + timer.delay_ms(25); } } From 52a6989850ededda368b8c98e33e1f008dd3b634 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sun, 17 Mar 2024 20:14:02 +0200 Subject: [PATCH 35/37] Add note about timer rebind --- .../examples/adafruit_feather_neopixel_rainbow.rs | 2 +- .../examples/adafruit_itsy_bitsy_rainbow.rs | 2 +- boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs | 2 +- boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs | 2 +- .../examples/adafruit_qt_py_rp2040_rainbow.rs | 2 +- .../examples/adafruit_trinkey_qt2040_rainbow.rs | 2 +- boards/boardsource-blok/examples/blok_rainbow.rs | 2 +- .../pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs | 2 +- .../examples/solderparty_stamp_neopixel_rainbow.rs | 2 +- .../examples/sparkfun_pro_micro_rainbow.rs | 2 +- .../examples/sparkfun_thing_plus_rainbow.rs | 2 +- boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs | 2 +- .../examples/waveshare_rp2040_zero_neopixel_rainbow.rs | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs index 5139d78..036c433 100644 --- a/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs +++ b/boards/adafruit-feather-rp2040/examples/adafruit_feather_neopixel_rainbow.rs @@ -65,7 +65,7 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs index 2e8d17c..9a3b5bf 100644 --- a/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs +++ b/boards/adafruit-itsy-bitsy-rp2040/examples/adafruit_itsy_bitsy_rainbow.rs @@ -64,7 +64,7 @@ fn main() -> ! { ); let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs index b96ae46..5164338 100644 --- a/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs +++ b/boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs @@ -78,7 +78,7 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs b/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs index 3e874af..1ad9cdd 100644 --- a/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs +++ b/boards/adafruit-metro-rp2040/examples/adafruit_metro_rainbow.rs @@ -60,7 +60,7 @@ fn main() -> ! { ); let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs index 3953474..cb8eeca 100644 --- a/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs +++ b/boards/adafruit-qt-py-rp2040/examples/adafruit_qt_py_rp2040_rainbow.rs @@ -64,7 +64,7 @@ fn main() -> ! { ); let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs b/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs index 54c1403..1977af5 100644 --- a/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs +++ b/boards/adafruit-trinkey-qt2040/examples/adafruit_trinkey_qt2040_rainbow.rs @@ -78,7 +78,7 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/boardsource-blok/examples/blok_rainbow.rs b/boards/boardsource-blok/examples/blok_rainbow.rs index fb6dc35..7a9b833 100644 --- a/boards/boardsource-blok/examples/blok_rainbow.rs +++ b/boards/boardsource-blok/examples/blok_rainbow.rs @@ -68,7 +68,7 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs index 9e34048..740c8df 100644 --- a/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs +++ b/boards/pimoroni-servo2040/examples/pimoroni_servo2040_rainbow.rs @@ -62,7 +62,7 @@ fn main() -> ! { // Infinite color wheel loop let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer let offset = (256u16 / bsp::NUM_LEDS as u16) as u8; loop { ws.write(brightness( diff --git a/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs b/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs index 7da52b6..0174e7d 100644 --- a/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs +++ b/boards/solderparty-rp2040-stamp/examples/solderparty_stamp_neopixel_rainbow.rs @@ -65,7 +65,7 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs index 75cbb57..927a0a2 100644 --- a/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs +++ b/boards/sparkfun-pro-micro-rp2040/examples/sparkfun_pro_micro_rainbow.rs @@ -77,7 +77,7 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs b/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs index 5a5f18c..2c7414a 100644 --- a/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs +++ b/boards/sparkfun-thing-plus-rp2040/examples/sparkfun_thing_plus_rainbow.rs @@ -76,7 +76,7 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs index 6254d86..b626544 100644 --- a/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs +++ b/boards/vcc-gnd-yd-rp2040/examples/yd_rp2040_neopixel_rainbow.rs @@ -65,7 +65,7 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); diff --git a/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs b/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs index a90294c..5958b80 100644 --- a/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs +++ b/boards/waveshare-rp2040-zero/examples/waveshare_rp2040_zero_neopixel_rainbow.rs @@ -65,7 +65,7 @@ fn main() -> ! { // Infinite colour wheel loop let mut n: u8 = 128; - let mut timer = timer; + let mut timer = timer; // rebind to force a copy of the timer loop { ws.write(brightness(once(wheel(n)), 32)).unwrap(); n = n.wrapping_add(1); From b1dc5acb281902be21819c6a38bf14dc1b24c20a Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Mon, 18 Mar 2024 19:55:36 +0200 Subject: [PATCH 36/37] Update rust toolchain used in udeps job --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index bfb8746..23c6b2a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-06-27 + toolchain: nightly-2024-01-30 target: thumbv6m-none-eabi - name: Install cargo-udeps uses: baptiste0928/cargo-install@v2 From c836045b1508f7a6d499dc6f0b0c701087fd4ba3 Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Mon, 18 Mar 2024 20:11:35 +0200 Subject: [PATCH 37/37] Adjust dependencies for pimoroni-tufty2040 --- boards/pimoroni-tufty2040/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/pimoroni-tufty2040/Cargo.toml b/boards/pimoroni-tufty2040/Cargo.toml index 2f41df1..503d2eb 100644 --- a/boards/pimoroni-tufty2040/Cargo.toml +++ b/boards/pimoroni-tufty2040/Cargo.toml @@ -18,15 +18,15 @@ embedded_hal_0_2.workspace = true fugit.workspace = true rp2040-boot2 = { workspace = true, optional = true } rp2040-hal.workspace = true -st7789.workspace = true display-interface.workspace = true -embedded-graphics.workspace = true pio.workspace = true pio-proc.workspace = true [dev-dependencies] -panic-halt.workspace = true +embedded-graphics.workspace = true nb.workspace = true +panic-halt.workspace = true +st7789.workspace = true [features] # This is the set of features we enable by default