diff --git a/boards/feather_rp2040/examples/feather_blinky.rs b/boards/feather_rp2040/examples/feather_blinky.rs index 6aba967..1bd1516 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::Sio, watchdog::Watchdog, + Sio, }, Pins, XOSC_CRYSTAL_FREQ, }; diff --git a/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs b/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs index 8ea51a1..0d0bc45 100644 --- a/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs +++ b/boards/feather_rp2040/examples/feather_neopixel_rainbow.rs @@ -14,14 +14,14 @@ use feather_rp2040::{ hal::{ clocks::{init_clocks_and_plls, Clock}, pac, - sio::Sio, + pio::PIOExt, timer::Timer, watchdog::Watchdog, + Sio, }, Pins, XOSC_CRYSTAL_FREQ, }; use panic_halt as _; -use rp2040_hal::pio::PIOExt; use smart_leds::{brightness, SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812; diff --git a/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs b/boards/itsy_bitsy_rp2040/examples/itsy_bitsy_rainbow.rs index 0ba776d..59d8cec 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, - sio::Sio, + pio::PIOExt, watchdog::Watchdog, + Sio, Timer, }, Pins, XOSC_CRYSTAL_FREQ, }; @@ -55,7 +55,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/kb2040/examples/kb2040_rainbow.rs b/boards/kb2040/examples/kb2040_rainbow.rs index ab3589e..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, - sio::Sio, + 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/pico/examples/pico_blinky.rs b/boards/pico/examples/pico_blinky.rs index eb2e1bd..f6bf340 100644 --- a/boards/pico/examples/pico_blinky.rs +++ b/boards/pico/examples/pico_blinky.rs @@ -48,7 +48,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 // @@ -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 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 209e9f3..50bb1ce 100644 --- a/boards/pico/examples/pico_countdown_blinky.rs +++ b/boards/pico/examples/pico_countdown_blinky.rs @@ -39,7 +39,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 // @@ -57,11 +57,11 @@ 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 - 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 fa79c88..dfe15d3 100644 --- a/boards/pico/examples/pico_gpio_in_out.rs +++ b/boards/pico/examples/pico_gpio_in_out.rs @@ -46,7 +46,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 4cfa374..9ae2471 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 d171e34..2b9f4a6 100644 --- a/boards/pico/examples/pico_i2c_pio.rs +++ b/boards/pico/examples/pico_i2c_pio.rs @@ -60,7 +60,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 // @@ -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_pwm_blink.rs b/boards/pico/examples/pico_pwm_blink.rs index 2e06aa1..2632a8e 100644 --- a/boards/pico/examples/pico_pwm_blink.rs +++ b/boards/pico/examples/pico_pwm_blink.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 // @@ -72,7 +72,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 9c4d903..ef957bb 100644 --- a/boards/pico/examples/pico_rtic.rs +++ b/boards/pico/examples/pico_rtic.rs @@ -9,7 +9,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.rs b/boards/pico/examples/pico_usb_serial.rs index c1fe02b..5f745c6 100644 --- a/boards/pico/examples/pico_usb_serial.rs +++ b/boards/pico/examples/pico_usb_serial.rs @@ -46,7 +46,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 // @@ -83,7 +83,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/pico/examples/pico_usb_serial_interrupt.rs b/boards/pico/examples/pico_usb_serial_interrupt.rs index 84739a5..016a660 100644 --- a/boards/pico/examples/pico_usb_serial_interrupt.rs +++ b/boards/pico/examples/pico_usb_serial_interrupt.rs @@ -68,7 +68,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 // @@ -134,7 +134,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_usb_twitchy_mouse.rs b/boards/pico/examples/pico_usb_twitchy_mouse.rs index ca08191..cb2a659 100644 --- a/boards/pico/examples/pico_usb_twitchy_mouse.rs +++ b/boards/pico/examples/pico_usb_twitchy_mouse.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_explorer/examples/pico_explorer_showcase.rs b/boards/pico_explorer/examples/pico_explorer_showcase.rs index 701b2f7..21dd0ce 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 1a5c976..f5e7a8c 100644 --- a/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs +++ b/boards/pico_lipo_16mb/examples/pico_lipo_16mb_blinky.rs @@ -48,7 +48,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 // @@ -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 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 899f2ec..55f1c37 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, - sio::Sio, + 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/qt_py_rp2040/examples/qt_py_rainbow.rs b/boards/qt_py_rp2040/examples/qt_py_rainbow.rs index 47cf261..f6d881f 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, - sio::Sio, + pio::PIOExt, watchdog::Watchdog, + Sio, Timer, }, Pins, XOSC_CRYSTAL_FREQ, }; @@ -55,7 +55,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/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..aed8739 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( @@ -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( @@ -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/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/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..e7ec88e 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( @@ -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/lib.rs b/rp2040-hal/src/lib.rs index 3716089..6f70dc3 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; 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