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