From 55a8b4acf9b81f3e40c23e821662da7f3786e6e6 Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Sat, 4 Dec 2021 00:04:45 +1100 Subject: [PATCH 1/6] Re-export mod structs --- boards/feather_rp2040/examples/feather_blinky.rs | 2 +- boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs | 2 +- rp2040-hal/examples/adc.rs | 8 ++++---- rp2040-hal/examples/blinky.rs | 4 ++-- rp2040-hal/examples/gpio_in_out.rs | 4 ++-- rp2040-hal/examples/i2c.rs | 4 ++-- rp2040-hal/examples/lcd_display.rs | 4 ++-- rp2040-hal/examples/pwm_blink.rs | 4 ++-- rp2040-hal/examples/rom_funcs.rs | 4 ++-- rp2040-hal/examples/spi.rs | 6 +++--- rp2040-hal/examples/uart.rs | 4 ++-- rp2040-hal/examples/watchdog.rs | 2 +- rp2040-hal/src/lib.rs | 9 +++++++++ 13 files changed, 33 insertions(+), 24 deletions(-) diff --git a/boards/feather_rp2040/examples/feather_blinky.rs b/boards/feather_rp2040/examples/feather_blinky.rs index 9bfda5d..a6689f6 100644 --- a/boards/feather_rp2040/examples/feather_blinky.rs +++ b/boards/feather_rp2040/examples/feather_blinky.rs @@ -11,7 +11,7 @@ use feather_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, - sio::Sio, + Sio, watchdog::Watchdog, }, Pins, XOSC_CRYSTAL_FREQ, diff --git a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs index 250eb8e..de8e549 100644 --- a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs +++ b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs @@ -26,7 +26,7 @@ use hal::pac; // Some traits we need use embedded_hal::digital::v2::OutputPin; use embedded_time::fixed_point::FixedPoint; -use rp2040_hal::clocks::Clock; +use rp2040_hal::Clock; /// The linker will place this boot block at the start of our program image. We // need this to help the ROM bootloader get our code up and running. diff --git a/rp2040-hal/examples/adc.rs b/rp2040-hal/examples/adc.rs index 5a826f2..628ff07 100644 --- a/rp2040-hal/examples/adc.rs +++ b/rp2040-hal/examples/adc.rs @@ -24,7 +24,7 @@ use rp2040_hal as hal; use core::fmt::Write; use embedded_hal::adc::OneShot; use embedded_time::fixed_point::FixedPoint; -use rp2040_hal::clocks::Clock; +use rp2040_hal::Clock; // A shorter alias for the Peripheral Access Crate, which provides low-level // register access @@ -54,7 +54,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks let clocks = hal::clocks::init_clocks_and_plls( @@ -74,7 +74,7 @@ fn main() -> ! { let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer()); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins to their default state let pins = hal::gpio::Pins::new( @@ -101,7 +101,7 @@ fn main() -> ! { uart.write_full_blocking(b"ADC example\r\n"); // Enable ADC - let mut adc = hal::adc::Adc::new(pac.ADC, &mut pac.RESETS); + let mut adc = hal::Adc::new(pac.ADC, &mut pac.RESETS); // Enable the temperature sense channel let mut temperature_sensor = adc.enable_temp_sensor(); diff --git a/rp2040-hal/examples/blinky.rs b/rp2040-hal/examples/blinky.rs index 0344b16..7bb0b5c 100644 --- a/rp2040-hal/examples/blinky.rs +++ b/rp2040-hal/examples/blinky.rs @@ -52,7 +52,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks let clocks = hal::clocks::init_clocks_and_plls( @@ -70,7 +70,7 @@ fn main() -> ! { let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer()); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins to their default state let pins = hal::gpio::Pins::new( diff --git a/rp2040-hal/examples/gpio_in_out.rs b/rp2040-hal/examples/gpio_in_out.rs index 968aa48..7905cc8 100644 --- a/rp2040-hal/examples/gpio_in_out.rs +++ b/rp2040-hal/examples/gpio_in_out.rs @@ -50,7 +50,7 @@ fn main() -> ! { let mut pac = pac::Peripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks let _clocks = hal::clocks::init_clocks_and_plls( @@ -66,7 +66,7 @@ fn main() -> ! { .unwrap(); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins to their default state let pins = hal::gpio::Pins::new( diff --git a/rp2040-hal/examples/i2c.rs b/rp2040-hal/examples/i2c.rs index 2f3c69e..184dc63 100644 --- a/rp2040-hal/examples/i2c.rs +++ b/rp2040-hal/examples/i2c.rs @@ -49,7 +49,7 @@ fn main() -> ! { let mut pac = pac::Peripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks let clocks = hal::clocks::init_clocks_and_plls( @@ -83,7 +83,7 @@ fn main() -> ! { // Create the I²C drive, 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 // peripheral isn't available on these pins! - let mut i2c = hal::i2c::I2C::i2c1( + let mut i2c = hal::I2C::i2c1( pac.I2C1, sda_pin, scl_pin, // Try `not_an_scl_pin` here diff --git a/rp2040-hal/examples/lcd_display.rs b/rp2040-hal/examples/lcd_display.rs index 8db4182..34e67c8 100644 --- a/rp2040-hal/examples/lcd_display.rs +++ b/rp2040-hal/examples/lcd_display.rs @@ -57,7 +57,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks let clocks = hal::clocks::init_clocks_and_plls( @@ -77,7 +77,7 @@ fn main() -> ! { let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer()); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins to their default state let pins = hal::gpio::Pins::new( diff --git a/rp2040-hal/examples/pwm_blink.rs b/rp2040-hal/examples/pwm_blink.rs index 9a9864d..11f618a 100644 --- a/rp2040-hal/examples/pwm_blink.rs +++ b/rp2040-hal/examples/pwm_blink.rs @@ -59,7 +59,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks // @@ -77,7 +77,7 @@ fn main() -> ! { .unwrap(); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins up according to their function on this particular board let pins = hal::gpio::Pins::new( diff --git a/rp2040-hal/examples/rom_funcs.rs b/rp2040-hal/examples/rom_funcs.rs index c9a6ebe..eaff31d 100644 --- a/rp2040-hal/examples/rom_funcs.rs +++ b/rp2040-hal/examples/rom_funcs.rs @@ -54,7 +54,7 @@ fn main() -> ! { let mut core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks let clocks = hal::clocks::init_clocks_and_plls( @@ -70,7 +70,7 @@ fn main() -> ! { .unwrap(); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins to their default state let pins = hal::gpio::Pins::new( diff --git a/rp2040-hal/examples/spi.rs b/rp2040-hal/examples/spi.rs index 3b6b00d..6d41922 100644 --- a/rp2040-hal/examples/spi.rs +++ b/rp2040-hal/examples/spi.rs @@ -54,7 +54,7 @@ fn main() -> ! { let mut pac = pac::Peripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks let clocks = hal::clocks::init_clocks_and_plls( @@ -70,7 +70,7 @@ fn main() -> ! { .unwrap(); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins to their default state let pins = hal::gpio::Pins::new( @@ -84,7 +84,7 @@ fn main() -> ! { let _spi_sclk = pins.gpio6.into_mode::(); let _spi_mosi = pins.gpio7.into_mode::(); let _spi_miso = pins.gpio4.into_mode::(); - let spi = hal::spi::Spi::<_, _, 8>::new(pac.SPI0); + let spi = hal::Spi::<_, _, 8>::new(pac.SPI0); // Exchange the uninitialised SPI driver for an initialised one let mut spi = spi.init( diff --git a/rp2040-hal/examples/uart.rs b/rp2040-hal/examples/uart.rs index 542c661..dba1f35 100644 --- a/rp2040-hal/examples/uart.rs +++ b/rp2040-hal/examples/uart.rs @@ -54,7 +54,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks let clocks = hal::clocks::init_clocks_and_plls( @@ -72,7 +72,7 @@ fn main() -> ! { let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer()); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins to their default state let pins = hal::gpio::Pins::new( diff --git a/rp2040-hal/examples/watchdog.rs b/rp2040-hal/examples/watchdog.rs index 848e2ba..a5156f9 100644 --- a/rp2040-hal/examples/watchdog.rs +++ b/rp2040-hal/examples/watchdog.rs @@ -55,7 +55,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks let clocks = hal::clocks::init_clocks_and_plls( diff --git a/rp2040-hal/src/lib.rs b/rp2040-hal/src/lib.rs index 3716089..a20906b 100644 --- a/rp2040-hal/src/lib.rs +++ b/rp2040-hal/src/lib.rs @@ -40,3 +40,12 @@ pub mod uart; pub mod usb; pub mod watchdog; pub mod xosc; + +// Provide access to common datastructures to avoid repeating ourselves +pub use adc::Adc; +pub use clocks::Clock; +pub use i2c::I2C; +pub use sio::Sio; +pub use spi::Spi; +pub use timer::Timer; +pub use watchdog::Watchdog; \ No newline at end of file From 11aa0b87af05215dcb0e68565ddc6620e05468d9 Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Sat, 4 Dec 2021 15:38:25 +1100 Subject: [PATCH 2/6] Cargo fmt --- boards/feather_rp2040/examples/feather_blinky.rs | 2 +- rp2040-hal/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/feather_rp2040/examples/feather_blinky.rs b/boards/feather_rp2040/examples/feather_blinky.rs index a6689f6..2a30f58 100644 --- a/boards/feather_rp2040/examples/feather_blinky.rs +++ b/boards/feather_rp2040/examples/feather_blinky.rs @@ -11,8 +11,8 @@ use feather_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, - Sio, watchdog::Watchdog, + Sio, }, Pins, XOSC_CRYSTAL_FREQ, }; diff --git a/rp2040-hal/src/lib.rs b/rp2040-hal/src/lib.rs index a20906b..6f70dc3 100644 --- a/rp2040-hal/src/lib.rs +++ b/rp2040-hal/src/lib.rs @@ -48,4 +48,4 @@ pub use i2c::I2C; pub use sio::Sio; pub use spi::Spi; pub use timer::Timer; -pub use watchdog::Watchdog; \ No newline at end of file +pub use watchdog::Watchdog; From dc8ceffd09e2554d1b17477c783c84a60ac6b136 Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Sat, 4 Dec 2021 15:52:46 +1100 Subject: [PATCH 3/6] Move uses of sio::Sio to Sio --- boards/feather_rp2040/examples/feather_neopixel_rainbow.rs | 2 +- boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs | 2 +- boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs | 2 +- boards/kb2040/examples/kb2040_rainbow.rs | 2 +- boards/pico/examples/pico_blinky.rs | 2 +- boards/pico/examples/pico_countdown_blinky.rs | 2 +- boards/pico/examples/pico_gpio_in_out.rs | 2 +- boards/pico/examples/pico_i2c_controller_peripheral/main.rs | 2 +- boards/pico/examples/pico_i2c_pio.rs | 2 +- boards/pico/examples/pico_pwm_blink.rs | 2 +- boards/pico/examples/pico_rtic.rs | 2 +- boards/pico/examples/pico_usb_serial_interrupt.rs | 2 +- boards/pico_explorer/examples/pico_explorer_showcase.rs | 2 +- boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs | 2 +- boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs | 2 +- boards/qt_py_rp2040/examples/qt_py_rainbow.rs | 2 +- rp2040-hal/examples/i2c.rs | 2 +- rp2040-hal/examples/pio_blink.rs | 2 +- rp2040-hal/examples/pio_proc_blink.rs | 2 +- rp2040-hal/examples/watchdog.rs | 2 +- rp2040-hal/src/adc.rs | 4 ++-- rp2040-hal/src/clocks/mod.rs | 2 +- rp2040-hal/src/gpio/dynpin.rs | 6 +++--- rp2040-hal/src/gpio/mod.rs | 2 +- rp2040-hal/src/i2c.rs | 2 +- rp2040-hal/src/multicore.rs | 4 ++-- rp2040-hal/src/pwm/mod.rs | 2 +- rp2040-hal/src/spi.rs | 2 +- rp2040-hal/src/uart.rs | 2 +- rp2040-hal/src/usb.rs | 2 +- 30 files changed, 34 insertions(+), 34 deletions(-) diff --git a/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs b/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs index 939df16..ba50fb1 100644 --- a/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs +++ b/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs @@ -14,9 +14,9 @@ use feather_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, - sio::Sio, timer::Timer, watchdog::Watchdog, + Sio, }, Pins, XOSC_CRYSTAL_FREQ, }; diff --git a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs index de8e549..b4f5f7e 100644 --- a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs +++ b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs @@ -70,7 +70,7 @@ fn main() -> ! { let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer()); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins to their default state let pins = hal::gpio::Pins::new( diff --git a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs index 34089d2..9446354 100644 --- a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs +++ b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs @@ -16,8 +16,8 @@ use itsy_bitsy_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, - sio::Sio, watchdog::Watchdog, + Sio, }, Pins, XOSC_CRYSTAL_FREQ, }; diff --git a/boards/kb2040/examples/kb2040_rainbow.rs b/boards/kb2040/examples/kb2040_rainbow.rs index ab3589e..49f78d9 100644 --- a/boards/kb2040/examples/kb2040_rainbow.rs +++ b/boards/kb2040/examples/kb2040_rainbow.rs @@ -18,9 +18,9 @@ use kb2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, - sio::Sio, timer::Timer, watchdog::Watchdog, + Sio, }, XOSC_CRYSTAL_FREQ, }; diff --git a/boards/pico/examples/pico_blinky.rs b/boards/pico/examples/pico_blinky.rs index f4630aa..e3a065b 100644 --- a/boards/pico/examples/pico_blinky.rs +++ b/boards/pico/examples/pico_blinky.rs @@ -76,7 +76,7 @@ fn main() -> ! { let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer()); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins up according to their function on this particular board let pins = pico::Pins::new( diff --git a/boards/pico/examples/pico_countdown_blinky.rs b/boards/pico/examples/pico_countdown_blinky.rs index 0233d7d..36af2b3 100644 --- a/boards/pico/examples/pico_countdown_blinky.rs +++ b/boards/pico/examples/pico_countdown_blinky.rs @@ -65,7 +65,7 @@ fn main() -> ! { let mut count_down = timer.count_down(); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins up according to their function on this particular board let pins = pico::Pins::new( diff --git a/boards/pico/examples/pico_gpio_in_out.rs b/boards/pico/examples/pico_gpio_in_out.rs index a91fc16..9a92b45 100644 --- a/boards/pico/examples/pico_gpio_in_out.rs +++ b/boards/pico/examples/pico_gpio_in_out.rs @@ -52,7 +52,7 @@ fn main() -> ! { // at it's default clock speed. // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins up according to their function on this particular board let pins = pico::Pins::new( diff --git a/boards/pico/examples/pico_i2c_controller_peripheral/main.rs b/boards/pico/examples/pico_i2c_controller_peripheral/main.rs index 814b9e9..ae5705d 100644 --- a/boards/pico/examples/pico_i2c_controller_peripheral/main.rs +++ b/boards/pico/examples/pico_i2c_controller_peripheral/main.rs @@ -31,8 +31,8 @@ use hal::{ gpio::{bank0, FunctionI2C, Pin}, i2c::{peripheral::I2CPeripheralEventIterator, I2C}, pac, - sio::Sio, watchdog::Watchdog, + Sio, }; use pico::{hal, Pins, XOSC_CRYSTAL_FREQ}; diff --git a/boards/pico/examples/pico_i2c_pio.rs b/boards/pico/examples/pico_i2c_pio.rs index 43db613..43242f4 100644 --- a/boards/pico/examples/pico_i2c_pio.rs +++ b/boards/pico/examples/pico_i2c_pio.rs @@ -84,7 +84,7 @@ fn main() -> ! { .unwrap(); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins up according to their function on this particular board let pins = pico::Pins::new( diff --git a/boards/pico/examples/pico_pwm_blink.rs b/boards/pico/examples/pico_pwm_blink.rs index 657e1de..c8745e5 100644 --- a/boards/pico/examples/pico_pwm_blink.rs +++ b/boards/pico/examples/pico_pwm_blink.rs @@ -78,7 +78,7 @@ fn main() -> ! { .unwrap(); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins up according to their function on this particular board let pins = pico::Pins::new( diff --git a/boards/pico/examples/pico_rtic.rs b/boards/pico/examples/pico_rtic.rs index 44704c8..b594585 100644 --- a/boards/pico/examples/pico_rtic.rs +++ b/boards/pico/examples/pico_rtic.rs @@ -13,7 +13,7 @@ mod app { use embedded_hal::digital::v2::OutputPin; use pico::{ - hal::{self, clocks::init_clocks_and_plls, pac, sio::Sio, watchdog::Watchdog}, + hal::{self, clocks::init_clocks_and_plls, pac, watchdog::Watchdog, Sio}, XOSC_CRYSTAL_FREQ, }; diff --git a/boards/pico/examples/pico_usb_serial_interrupt.rs b/boards/pico/examples/pico_usb_serial_interrupt.rs index 6cbc00f..7977ec2 100644 --- a/boards/pico/examples/pico_usb_serial_interrupt.rs +++ b/boards/pico/examples/pico_usb_serial_interrupt.rs @@ -140,7 +140,7 @@ fn main() -> ! { let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer()); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins up according to their function on this particular board let pins = pico::Pins::new( diff --git a/boards/pico_explorer/examples/pico_explorer_showcase.rs b/boards/pico_explorer/examples/pico_explorer_showcase.rs index 1643752..8702b35 100644 --- a/boards/pico_explorer/examples/pico_explorer_showcase.rs +++ b/boards/pico_explorer/examples/pico_explorer_showcase.rs @@ -12,7 +12,7 @@ use embedded_graphics::{ }; use embedded_hal::digital::v2::OutputPin; use embedded_time::rate::*; -use hal::{adc::Adc, clocks::*, sio::Sio, watchdog::Watchdog}; +use hal::{adc::Adc, clocks::*, watchdog::Watchdog, Sio}; use panic_halt as _; use pico_explorer::{hal, pac, Button, PicoExplorer, XOSC_CRYSTAL_FREQ}; diff --git a/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs b/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs index f2813f6..f42dac2 100644 --- a/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs +++ b/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs @@ -76,7 +76,7 @@ fn main() -> ! { let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer()); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins up according to their function on this particular board let pins = pico_lipo_16_mb::Pins::new( diff --git a/boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs b/boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs index 0e8ab28..993fbc3 100644 --- a/boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs +++ b/boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs @@ -18,9 +18,9 @@ use pro_micro_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, - sio::Sio, timer::Timer, watchdog::Watchdog, + Sio, }, XOSC_CRYSTAL_FREQ, }; diff --git a/boards/qt_py_rp2040/examples/qt_py_rainbow.rs b/boards/qt_py_rp2040/examples/qt_py_rainbow.rs index 3edb1b2..1cdd702 100644 --- a/boards/qt_py_rp2040/examples/qt_py_rainbow.rs +++ b/boards/qt_py_rp2040/examples/qt_py_rainbow.rs @@ -16,8 +16,8 @@ use qt_py_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, - sio::Sio, watchdog::Watchdog, + Sio, }, Pins, XOSC_CRYSTAL_FREQ, }; diff --git a/rp2040-hal/examples/i2c.rs b/rp2040-hal/examples/i2c.rs index 184dc63..aed8739 100644 --- a/rp2040-hal/examples/i2c.rs +++ b/rp2040-hal/examples/i2c.rs @@ -65,7 +65,7 @@ fn main() -> ! { .unwrap(); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins to their default state let pins = hal::gpio::Pins::new( diff --git a/rp2040-hal/examples/pio_blink.rs b/rp2040-hal/examples/pio_blink.rs index 3c4778e..d0ea164 100644 --- a/rp2040-hal/examples/pio_blink.rs +++ b/rp2040-hal/examples/pio_blink.rs @@ -8,7 +8,7 @@ use cortex_m_rt::entry; use hal::gpio::{FunctionPio0, Pin}; use hal::pac; use hal::pio::PIOExt; -use hal::sio::Sio; +use hal::Sio; use panic_halt as _; use rp2040_hal as hal; diff --git a/rp2040-hal/examples/pio_proc_blink.rs b/rp2040-hal/examples/pio_proc_blink.rs index b82658a..4dff296 100644 --- a/rp2040-hal/examples/pio_proc_blink.rs +++ b/rp2040-hal/examples/pio_proc_blink.rs @@ -8,7 +8,7 @@ use cortex_m_rt::entry; use hal::gpio::{FunctionPio0, Pin}; use hal::pac; use hal::pio::PIOExt; -use hal::sio::Sio; +use hal::Sio; use panic_halt as _; use rp2040_hal as hal; diff --git a/rp2040-hal/examples/watchdog.rs b/rp2040-hal/examples/watchdog.rs index a5156f9..e7ec88e 100644 --- a/rp2040-hal/examples/watchdog.rs +++ b/rp2040-hal/examples/watchdog.rs @@ -73,7 +73,7 @@ fn main() -> ! { let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer()); // The single-cycle I/O block controls our GPIO pins - let sio = hal::sio::Sio::new(pac.SIO); + let sio = hal::Sio::new(pac.SIO); // Set the pins to their default state let pins = hal::gpio::Pins::new( diff --git a/rp2040-hal/src/adc.rs b/rp2040-hal/src/adc.rs index 5f8afb3..54804c2 100644 --- a/rp2040-hal/src/adc.rs +++ b/rp2040-hal/src/adc.rs @@ -7,7 +7,7 @@ //! Capture ADC reading from a pin //! ```no_run //! use embedded_hal::adc::OneShot; -//! use rp2040_hal::{adc::Adc, gpio::Pins, pac, sio::Sio}; +//! use rp2040_hal::{adc::Adc, gpio::Pins, pac, Sio}; //! let mut peripherals = pac::Peripherals::take().unwrap(); //! let sio = Sio::new(peripherals.SIO); //! let pins = Pins::new(peripherals.IO_BANK0, peripherals.PADS_BANK0, sio.gpio_bank0, &mut peripherals.RESETS); @@ -22,7 +22,7 @@ //! Capture ADC reading from temperature sensor. Note that this needs conversion to be a real-world temperature. //! ```no_run //! use embedded_hal::adc::OneShot; -//! use rp2040_hal::{adc::Adc, gpio::Pins, pac, sio::Sio}; +//! use rp2040_hal::{adc::Adc, gpio::Pins, pac, Sio}; //! let mut peripherals = pac::Peripherals::take().unwrap(); //! let sio = Sio::new(peripherals.SIO); //! let pins = Pins::new(peripherals.IO_BANK0, peripherals.PADS_BANK0, sio.gpio_bank0, &mut peripherals.RESETS); diff --git a/rp2040-hal/src/clocks/mod.rs b/rp2040-hal/src/clocks/mod.rs index cd502cd..b1a546c 100644 --- a/rp2040-hal/src/clocks/mod.rs +++ b/rp2040-hal/src/clocks/mod.rs @@ -15,7 +15,7 @@ //! ## Usage extended //! ```no_run //! use embedded_time::rate::*; -//! use rp2040_hal::{clocks::{Clock, ClocksManager, ClockSource, InitError}, gpio::Pins, pac, pll::{common_configs::{PLL_SYS_125MHZ, PLL_USB_48MHZ}, setup_pll_blocking}, sio::Sio, watchdog::Watchdog, xosc::setup_xosc_blocking}; +//! use rp2040_hal::{clocks::{Clock, ClocksManager, ClockSource, InitError}, gpio::Pins, pac, pll::{common_configs::{PLL_SYS_125MHZ, PLL_USB_48MHZ}, setup_pll_blocking}, Sio, watchdog::Watchdog, xosc::setup_xosc_blocking}; //! //! # fn func() -> Result<(), InitError> { //! let mut peripherals = pac::Peripherals::take().unwrap(); diff --git a/rp2040-hal/src/gpio/dynpin.rs b/rp2040-hal/src/gpio/dynpin.rs index dd4c455..7a29a62 100644 --- a/rp2040-hal/src/gpio/dynpin.rs +++ b/rp2040-hal/src/gpio/dynpin.rs @@ -18,7 +18,7 @@ //! //! ```no_run //! // Move a pin out of the Pins struct and convert to a DynPin -//! # use rp2040_hal::{pac, gpio::{DynPin, bank0::Gpio12, Pins}, sio::Sio}; +//! # use rp2040_hal::{pac, gpio::{DynPin, bank0::Gpio12, Pins}, Sio}; //! # let mut peripherals = pac::Peripherals::take().unwrap(); //! # let sio = Sio::new(peripherals.SIO); //! # let pins = Pins::new(peripherals.IO_BANK0,peripherals.PADS_BANK0,sio.gpio_bank0, &mut peripherals.RESETS); @@ -30,7 +30,7 @@ //! API. //! //! ```no_run -//! # use rp2040_hal::{pac, gpio::{DynPin, Pins}, sio::Sio}; +//! # use rp2040_hal::{pac, gpio::{DynPin, Pins}, Sio}; //! # let mut peripherals = pac::Peripherals::take().unwrap(); //! # let sio = Sio::new(peripherals.SIO); //! # let pins = Pins::new(peripherals.IO_BANK0,peripherals.PADS_BANK0,sio.gpio_bank0, &mut peripherals.RESETS); @@ -54,7 +54,7 @@ //! //! ```no_run //! # use core::convert::TryInto; -//! # use rp2040_hal::{pac, gpio::{DynPin, bank0::Gpio12, Pin, Pins, FloatingInput}, sio::Sio}; +//! # use rp2040_hal::{pac, gpio::{DynPin, bank0::Gpio12, Pin, Pins, FloatingInput}, Sio}; //! # let mut peripherals = pac::Peripherals::take().unwrap(); //! # let sio = Sio::new(peripherals.SIO); //! # let pins = Pins::new(peripherals.IO_BANK0,peripherals.PADS_BANK0,sio.gpio_bank0, &mut peripherals.RESETS); diff --git a/rp2040-hal/src/gpio/mod.rs b/rp2040-hal/src/gpio/mod.rs index 7d543ea..2e0041d 100644 --- a/rp2040-hal/src/gpio/mod.rs +++ b/rp2040-hal/src/gpio/mod.rs @@ -5,7 +5,7 @@ //! ## Basic usage //! ```no_run //! use embedded_hal::digital::v2::{InputPin, OutputPin}; -//! use rp2040_hal::{clocks::init_clocks_and_plls, gpio::Pins, watchdog::Watchdog, pac, sio::Sio}; +//! use rp2040_hal::{clocks::init_clocks_and_plls, gpio::Pins, watchdog::Watchdog, pac, Sio}; //! let mut peripherals = pac::Peripherals::take().unwrap(); //! let mut watchdog = Watchdog::new(peripherals.WATCHDOG); //! const XOSC_CRYSTAL_FREQ: u32 = 12_000_000; // Typically found in BSP crates diff --git a/rp2040-hal/src/i2c.rs b/rp2040-hal/src/i2c.rs index e0994b2..463f287 100644 --- a/rp2040-hal/src/i2c.rs +++ b/rp2040-hal/src/i2c.rs @@ -5,7 +5,7 @@ //! ## Usage //! ```no_run //! use embedded_time::rate::Extensions; -//! use rp2040_hal::{i2c::I2C, gpio::Pins, pac, sio::Sio}; +//! use rp2040_hal::{i2c::I2C, gpio::Pins, pac, Sio}; //! let mut peripherals = pac::Peripherals::take().unwrap(); //! let sio = Sio::new(peripherals.SIO); //! let pins = Pins::new(peripherals.IO_BANK0, peripherals.PADS_BANK0, sio.gpio_bank0, &mut peripherals.RESETS); diff --git a/rp2040-hal/src/multicore.rs b/rp2040-hal/src/multicore.rs index 3b59ff9..cdffc0e 100644 --- a/rp2040-hal/src/multicore.rs +++ b/rp2040-hal/src/multicore.rs @@ -63,7 +63,7 @@ pub struct Multicore<'p> { impl<'p> Multicore<'p> { /// Create a new |Multicore| instance. - pub fn new(psm: &'p mut pac::PSM, ppb: &'p mut pac::PPB, sio: &'p mut crate::sio::Sio) -> Self { + pub fn new(psm: &'p mut pac::PSM, ppb: &'p mut pac::PPB, sio: &'p mut crate::Sio) -> Self { Self { cores: [ Core { inner: None }, @@ -82,7 +82,7 @@ impl<'p> Multicore<'p> { /// A handle for controlling a logical core. pub struct Core<'p> { - inner: Option<(&'p mut pac::PSM, &'p mut pac::PPB, &'p mut crate::sio::Sio)>, + inner: Option<(&'p mut pac::PSM, &'p mut pac::PPB, &'p mut crate::Sio)>, } impl<'p> Core<'p> { diff --git a/rp2040-hal/src/pwm/mod.rs b/rp2040-hal/src/pwm/mod.rs index 6690a66..f23f8f7 100644 --- a/rp2040-hal/src/pwm/mod.rs +++ b/rp2040-hal/src/pwm/mod.rs @@ -23,7 +23,7 @@ //! Once you have the PWM slice struct, you can add individual pins: //! //! ```no_run -//! # use rp2040_hal::{prelude::*, gpio::Pins, sio::Sio, pwm::{InputHighRunning, Slices}}; +//! # use rp2040_hal::{prelude::*, gpio::Pins, Sio, pwm::{InputHighRunning, Slices}}; //! # let mut pac = rp2040_pac::Peripherals::take().unwrap(); //! # let pwm_slices = Slices::new(pac.PWM, &mut pac.RESETS); //! # let mut pwm = pwm_slices.pwm4.into_mode::(); diff --git a/rp2040-hal/src/spi.rs b/rp2040-hal/src/spi.rs index babc486..7244dd0 100644 --- a/rp2040-hal/src/spi.rs +++ b/rp2040-hal/src/spi.rs @@ -7,7 +7,7 @@ //! ```no_run //! use embedded_hal::spi::MODE_0; //! use embedded_time::rate::*; -//! use rp2040_hal::{spi::Spi, gpio::{Pins, FunctionSpi}, pac, sio::Sio}; +//! use rp2040_hal::{spi::Spi, gpio::{Pins, FunctionSpi}, pac, Sio}; //! //! let mut peripherals = pac::Peripherals::take().unwrap(); //! let sio = Sio::new(peripherals.SIO); diff --git a/rp2040-hal/src/uart.rs b/rp2040-hal/src/uart.rs index 0bd3f49..3657633 100644 --- a/rp2040-hal/src/uart.rs +++ b/rp2040-hal/src/uart.rs @@ -6,7 +6,7 @@ //! //! See [examples/uart.rs](https://github.com/rp-rs/rp-hal/tree/main/rp2040-hal/examples/uart.rs) for a more complete example //! ```no_run -//! use rp2040_hal::{clocks::init_clocks_and_plls, gpio::{Pins, FunctionUart}, pac, sio::Sio, uart::{self, UartPeripheral}, watchdog::Watchdog}; +//! use rp2040_hal::{clocks::init_clocks_and_plls, gpio::{Pins, FunctionUart}, pac, Sio, uart::{self, UartPeripheral}, watchdog::Watchdog}; //! //! const XOSC_CRYSTAL_FREQ: u32 = 12_000_000; // Typically found in BSP crates //! diff --git a/rp2040-hal/src/usb.rs b/rp2040-hal/src/usb.rs index db262f2..810825c 100644 --- a/rp2040-hal/src/usb.rs +++ b/rp2040-hal/src/usb.rs @@ -4,7 +4,7 @@ //! //! Initialize the Usb Bus forcing the VBUS detection. //! ```no_run -//! use rp2040_hal::{clocks::init_clocks_and_plls, pac, sio::Sio, usb::UsbBus, watchdog::Watchdog}; +//! use rp2040_hal::{clocks::init_clocks_and_plls, pac, Sio, usb::UsbBus, watchdog::Watchdog}; //! use usb_device::class_prelude::UsbBusAllocator; //! //! const XOSC_CRYSTAL_FREQ: u32 = 12_000_000; // Typically found in BSP crates From def0ed97f720365f6b5fe9b8962c51e446b43bd2 Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Sat, 4 Dec 2021 17:30:47 +1100 Subject: [PATCH 4/6] Replace uses of hal::watchdog::Watchdog with hal::Watchdog --- boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs | 2 +- boards/pico/examples/pico_blinky.rs | 2 +- boards/pico/examples/pico_countdown_blinky.rs | 2 +- boards/pico/examples/pico_i2c_pio.rs | 2 +- boards/pico/examples/pico_pwm_blink.rs | 2 +- boards/pico/examples/pico_usb_serial.rs | 2 +- boards/pico/examples/pico_usb_serial_interrupt.rs | 2 +- boards/pico/examples/pico_usb_twitchy_mouse.rs | 2 +- boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs index b4f5f7e..9582a70 100644 --- a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs +++ b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_blinky.rs @@ -52,7 +52,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks let clocks = hal::clocks::init_clocks_and_plls( diff --git a/boards/pico/examples/pico_blinky.rs b/boards/pico/examples/pico_blinky.rs index e3a065b..8014724 100644 --- a/boards/pico/examples/pico_blinky.rs +++ b/boards/pico/examples/pico_blinky.rs @@ -54,7 +54,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks // diff --git a/boards/pico/examples/pico_countdown_blinky.rs b/boards/pico/examples/pico_countdown_blinky.rs index 36af2b3..531d3ed 100644 --- a/boards/pico/examples/pico_countdown_blinky.rs +++ b/boards/pico/examples/pico_countdown_blinky.rs @@ -43,7 +43,7 @@ fn main() -> ! { let mut pac = pac::Peripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks // diff --git a/boards/pico/examples/pico_i2c_pio.rs b/boards/pico/examples/pico_i2c_pio.rs index 43242f4..5785ce4 100644 --- a/boards/pico/examples/pico_i2c_pio.rs +++ b/boards/pico/examples/pico_i2c_pio.rs @@ -66,7 +66,7 @@ fn main() -> ! { let mut pac = pac::Peripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks // diff --git a/boards/pico/examples/pico_pwm_blink.rs b/boards/pico/examples/pico_pwm_blink.rs index c8745e5..48ab415 100644 --- a/boards/pico/examples/pico_pwm_blink.rs +++ b/boards/pico/examples/pico_pwm_blink.rs @@ -60,7 +60,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks // diff --git a/boards/pico/examples/pico_usb_serial.rs b/boards/pico/examples/pico_usb_serial.rs index f337705..8b18e73 100644 --- a/boards/pico/examples/pico_usb_serial.rs +++ b/boards/pico/examples/pico_usb_serial.rs @@ -52,7 +52,7 @@ fn main() -> ! { let mut pac = pac::Peripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks // diff --git a/boards/pico/examples/pico_usb_serial_interrupt.rs b/boards/pico/examples/pico_usb_serial_interrupt.rs index 7977ec2..2c231b8 100644 --- a/boards/pico/examples/pico_usb_serial_interrupt.rs +++ b/boards/pico/examples/pico_usb_serial_interrupt.rs @@ -74,7 +74,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks // diff --git a/boards/pico/examples/pico_usb_twitchy_mouse.rs b/boards/pico/examples/pico_usb_twitchy_mouse.rs index a160a3a..f37eb56 100644 --- a/boards/pico/examples/pico_usb_twitchy_mouse.rs +++ b/boards/pico/examples/pico_usb_twitchy_mouse.rs @@ -72,7 +72,7 @@ fn main() -> ! { let mut pac = pac::Peripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks // diff --git a/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs b/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs index f42dac2..ac95e50 100644 --- a/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs +++ b/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs @@ -54,7 +54,7 @@ fn main() -> ! { let core = pac::CorePeripherals::take().unwrap(); // Set up the watchdog driver - needed by the clock setup code - let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG); + let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); // Configure the clocks // From 6e184a91a785e9119c0a14b90c52f351bceb1593 Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Sat, 4 Dec 2021 17:39:32 +1100 Subject: [PATCH 5/6] Replace hal::timer::Timer with hal::Timer or Timer --- boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs | 6 +++--- boards/pico/examples/pico_countdown_blinky.rs | 2 +- boards/pico/examples/pico_usb_serial.rs | 2 +- boards/qt_py_rp2040/examples/qt_py_rainbow.rs | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs index 9446354..b640e14 100644 --- a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs +++ b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs @@ -8,7 +8,6 @@ use embedded_hal::digital::v2::OutputPin; use embedded_hal::timer::CountDown; use embedded_time::duration::Extensions; use panic_halt as _; -use rp2040_hal::pio::PIOExt; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; @@ -16,8 +15,9 @@ use itsy_bitsy_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, + pio::PIOExt, watchdog::Watchdog, - Sio, + Sio, Timer, }, Pins, XOSC_CRYSTAL_FREQ, }; @@ -59,7 +59,7 @@ fn main() -> ! { .set_high() .unwrap(); - let timer = rp2040_hal::timer::Timer::new(pac.TIMER, &mut pac.RESETS); + let timer = Timer::new(pac.TIMER, &mut pac.RESETS); let mut delay = timer.count_down(); let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); diff --git a/boards/pico/examples/pico_countdown_blinky.rs b/boards/pico/examples/pico_countdown_blinky.rs index 531d3ed..13666f5 100644 --- a/boards/pico/examples/pico_countdown_blinky.rs +++ b/boards/pico/examples/pico_countdown_blinky.rs @@ -61,7 +61,7 @@ fn main() -> ! { .unwrap(); // Configure the Timer peripheral in count-down mode - let timer = hal::timer::Timer::new(pac.TIMER, &mut pac.RESETS); + let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS); let mut count_down = timer.count_down(); // The single-cycle I/O block controls our GPIO pins diff --git a/boards/pico/examples/pico_usb_serial.rs b/boards/pico/examples/pico_usb_serial.rs index 8b18e73..154f073 100644 --- a/boards/pico/examples/pico_usb_serial.rs +++ b/boards/pico/examples/pico_usb_serial.rs @@ -89,7 +89,7 @@ fn main() -> ! { .device_class(2) // from: https://www.usb.org/defined-class-codes .build(); - let timer = hal::timer::Timer::new(pac.TIMER, &mut pac.RESETS); + let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS); let mut said_hello = false; loop { // A welcome message at the beginning diff --git a/boards/qt_py_rp2040/examples/qt_py_rainbow.rs b/boards/qt_py_rp2040/examples/qt_py_rainbow.rs index 1cdd702..8045871 100644 --- a/boards/qt_py_rp2040/examples/qt_py_rainbow.rs +++ b/boards/qt_py_rp2040/examples/qt_py_rainbow.rs @@ -8,7 +8,6 @@ use embedded_hal::digital::v2::OutputPin; use embedded_hal::timer::CountDown; use embedded_time::duration::Extensions; use panic_halt as _; -use rp2040_hal::pio::PIOExt; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; @@ -16,8 +15,9 @@ use qt_py_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, + pio::PIOExt, watchdog::Watchdog, - Sio, + Sio, Timer, }, Pins, XOSC_CRYSTAL_FREQ, }; @@ -59,7 +59,7 @@ fn main() -> ! { .set_high() .unwrap(); - let timer = rp2040_hal::timer::Timer::new(pac.TIMER, &mut pac.RESETS); + let timer = Timer::new(pac.TIMER, &mut pac.RESETS); let mut delay = timer.count_down(); let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); From 978f84680528f1476ff693e9c63d2b04bf558d73 Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Sat, 4 Dec 2021 23:53:00 +1100 Subject: [PATCH 6/6] Replace rp2040_hal::pio::PIOExt with bsp::hal::pio::PIOExt in BSPs --- boards/feather_rp2040/examples/feather_neopixel_rainbow.rs | 2 +- boards/kb2040/examples/kb2040_rainbow.rs | 2 +- boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs b/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs index ba50fb1..a1e47d8 100644 --- a/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs +++ b/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs @@ -14,6 +14,7 @@ use feather_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, + pio::PIOExt, timer::Timer, watchdog::Watchdog, Sio, @@ -21,7 +22,6 @@ use feather_rp2040::{ Pins, XOSC_CRYSTAL_FREQ, }; use panic_halt as _; -use rp2040_hal::pio::PIOExt; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; #[link_section = ".boot2"] diff --git a/boards/kb2040/examples/kb2040_rainbow.rs b/boards/kb2040/examples/kb2040_rainbow.rs index 49f78d9..f62e1c5 100644 --- a/boards/kb2040/examples/kb2040_rainbow.rs +++ b/boards/kb2040/examples/kb2040_rainbow.rs @@ -18,13 +18,13 @@ use kb2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, + pio::PIOExt, timer::Timer, watchdog::Watchdog, Sio, }, XOSC_CRYSTAL_FREQ, }; -use rp2040_hal::pio::PIOExt; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; diff --git a/boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs b/boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs index 993fbc3..c76ad5e 100644 --- a/boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs +++ b/boards/pro_micro_rp2040/examples/pro_micro_rainbow.rs @@ -18,13 +18,13 @@ use pro_micro_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, + pio::PIOExt, timer::Timer, watchdog::Watchdog, Sio, }, XOSC_CRYSTAL_FREQ, }; -use rp2040_hal::pio::PIOExt; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812;