Skip to content

Commit

Permalink
Merge pull request #60 from martinsp/rp2040-hal-update
Browse files Browse the repository at this point in the history
Bump rp2040-hal to 0.10.0 and embedded-hal to 1.0
  • Loading branch information
jannic authored Mar 19, 2024
2 parents 6eb85ab + c836045 commit 3fdd613
Show file tree
Hide file tree
Showing 62 changed files with 172 additions and 234 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 9 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,26 @@ 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-hal-nb = "1.0.0"
embedded-sdmmc = "0.5.0"
embedded_hal_0_2 = { package = "embedded-hal", version = "0.2.5", features = ["unproven", ] }
fugit = "0.3.7"
hd44780-driver = "0.4.0"
heapless = "0.7.16"
i2c-pio = "0.7.0"
i2c-pio = "0.8.0"
nb = "1.1"
panic-halt= "0.2.0"
panic-probe = "0.3.1"
pio = "0.2.1"
pio-proc = "0.2.2"
rp2040-boot2 = "0.3.0"
rp2040-hal = "0.9.0"
rp2040-hal = "0.10.0"
st7789 = "0.6.1"
st7735-lcd = "0.8.1"
smart-leds = "0.3.0"
ssd1306 = "0.7.1"
usb-device = "0.2.9"
usbd-hid = "0.5.2"
usbd-serial = "0.1.1"
ws2812-pio = "0.7.0"
usb-device = "0.3"
usbd-hid = "0.7.0"
usbd-serial = "0.2.1"
ws2812-pio = "0.8.0"
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use adafruit_feather_rp2040::{
Pins, XOSC_CRYSTAL_FREQ,
};
use core::iter::once;
use embedded_hal::timer::CountDown;
use fugit::ExtU32;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
Expand Down Expand Up @@ -52,7 +51,6 @@ fn main() -> ! {
);

let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
let mut delay = timer.count_down();

// Configure the addressable LED
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
Expand All @@ -67,12 +65,12 @@ fn main() -> ! {

// Infinite colour wheel loop
let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);

delay.start(25.millis());
let _ = nb::block!(delay.wait());
timer.delay_ms(25);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

use adafruit_itsy_bitsy_rp2040::entry;
use core::iter::once;
use embedded_hal::timer::CountDown;
use fugit::ExtU32;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
Expand Down Expand Up @@ -54,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.count_down();

let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
Expand All @@ -66,12 +64,12 @@ fn main() -> ! {
);

let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);

delay.start(25.millis());
let _ = nb::block!(delay.wait());
timer.delay_ms(25);
}
}

Expand Down
2 changes: 1 addition & 1 deletion boards/adafruit-kb2040/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 3 additions & 5 deletions boards/adafruit-kb2040/examples/adafruit_kb2040_rainbow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

use adafruit_kb2040::entry;
use core::iter::once;
use embedded_hal::timer::CountDown;
use fugit::ExtU32;
use embedded_hal::delay::DelayNs;
use panic_halt as _;

use adafruit_kb2040::{
Expand Down Expand Up @@ -64,7 +63,6 @@ fn main() -> ! {
);

let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
let mut delay = timer.count_down();

// Configure the addressable LED
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
Expand All @@ -80,12 +78,12 @@ fn main() -> ! {
// Infinite colour wheel loop

let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);

delay.start(25.millis());
let _ = nb::block!(delay.wait());
timer.delay_ms(25);
}
}

Expand Down
8 changes: 5 additions & 3 deletions boards/adafruit-kb2040/examples/adafruit_kb2040_usb_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

use adafruit_metro_rp2040::entry;
use core::iter::once;
use embedded_hal::timer::CountDown;
use fugit::ExtU32;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
Expand Down Expand Up @@ -50,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.count_down();

let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
Expand All @@ -62,12 +60,12 @@ fn main() -> ! {
);

let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);

delay.start(25.millis());
let _ = nb::block!(delay.wait());
timer.delay_ms(25);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

use adafruit_qt_py_rp2040::entry;
use core::iter::once;
use embedded_hal::timer::CountDown;
use fugit::ExtU32;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
Expand Down Expand Up @@ -54,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.count_down();

let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
Expand All @@ -66,12 +64,12 @@ fn main() -> ! {
);

let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);

delay.start(25u32.millis());
let _ = nb::block!(delay.wait());
timer.delay_ms(25);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

use adafruit_trinkey_qt2040::entry;
use core::iter::once;
use embedded_hal::timer::CountDown;
use fugit::ExtU32;
use embedded_hal::delay::DelayNs;
use panic_halt as _;

use adafruit_trinkey_qt2040::{
Expand Down Expand Up @@ -64,7 +63,6 @@ fn main() -> ! {
);

let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
let mut delay = timer.count_down();

// Configure the addressable LED
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
Expand All @@ -80,12 +78,12 @@ fn main() -> ! {
// Infinite colour wheel loop

let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);

delay.start(25.millis());
let _ = nb::block!(delay.wait());
timer.delay_ms(25);
}
}

Expand Down
2 changes: 1 addition & 1 deletion boards/arduino_nano_connect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion boards/arduino_nano_connect/examples/nano_blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions boards/boardsource-blok/examples/blok_rainbow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ use boardsource_blok::{
Pins, XOSC_CRYSTAL_FREQ,
};
use core::iter::once;
use embedded_hal::timer::CountDown;
use fugit::ExtU32;
use embedded_hal::delay::DelayNs;
use panic_halt as _;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
Expand Down Expand Up @@ -55,7 +54,6 @@ fn main() -> ! {
);

let timer = Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
let mut delay = timer.count_down();

// Configure the addressable LED
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
Expand All @@ -70,12 +68,12 @@ fn main() -> ! {

// Infinite colour wheel loop
let mut n: u8 = 128;
let mut timer = timer; // rebind to force a copy of the timer
loop {
ws.write(brightness(once(wheel(n)), 32)).unwrap();
n = n.wrapping_add(1);

delay.start(25.millis());
let _ = nb::block!(delay.wait());
timer.delay_ms(25);
}
}

Expand Down
6 changes: 4 additions & 2 deletions boards/boardsource-blok/examples/blok_usb_keyboard_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion boards/pimoroni-pico-explorer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ 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 }
embedded_hal_0_2.workspace = true
fugit.workspace = true
rp2040-boot2 = { workspace = true, optional = true }
rp2040-hal.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion boards/pimoroni-pico-explorer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
Loading

0 comments on commit 3fdd613

Please sign in to comment.