mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-01-23 09:46:33 +11:00
Merge pull request #227 from 9names/reexport_mod_structs
Re-export mod structs to avoid repeating ourselves
This commit is contained in:
commit
e64f307d47
41 changed files with 82 additions and 73 deletions
|
@ -11,8 +11,8 @@ use feather_rp2040::{
|
||||||
hal::{
|
hal::{
|
||||||
clocks::{init_clocks_and_plls, Clock},
|
clocks::{init_clocks_and_plls, Clock},
|
||||||
pac,
|
pac,
|
||||||
sio::Sio,
|
|
||||||
watchdog::Watchdog,
|
watchdog::Watchdog,
|
||||||
|
Sio,
|
||||||
},
|
},
|
||||||
Pins, XOSC_CRYSTAL_FREQ,
|
Pins, XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,14 +14,14 @@ use feather_rp2040::{
|
||||||
hal::{
|
hal::{
|
||||||
clocks::{init_clocks_and_plls, Clock},
|
clocks::{init_clocks_and_plls, Clock},
|
||||||
pac,
|
pac,
|
||||||
sio::Sio,
|
pio::PIOExt,
|
||||||
timer::Timer,
|
timer::Timer,
|
||||||
watchdog::Watchdog,
|
watchdog::Watchdog,
|
||||||
|
Sio,
|
||||||
},
|
},
|
||||||
Pins, XOSC_CRYSTAL_FREQ,
|
Pins, XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
use rp2040_hal::pio::PIOExt;
|
|
||||||
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
||||||
use ws2812_pio::Ws2812;
|
use ws2812_pio::Ws2812;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ use embedded_hal::digital::v2::OutputPin;
|
||||||
use embedded_hal::timer::CountDown;
|
use embedded_hal::timer::CountDown;
|
||||||
use embedded_time::duration::Extensions;
|
use embedded_time::duration::Extensions;
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
use rp2040_hal::pio::PIOExt;
|
|
||||||
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
||||||
use ws2812_pio::Ws2812;
|
use ws2812_pio::Ws2812;
|
||||||
|
|
||||||
|
@ -16,8 +15,9 @@ use itsy_bitsy_rp2040::{
|
||||||
hal::{
|
hal::{
|
||||||
clocks::{init_clocks_and_plls, Clock},
|
clocks::{init_clocks_and_plls, Clock},
|
||||||
pac,
|
pac,
|
||||||
sio::Sio,
|
pio::PIOExt,
|
||||||
watchdog::Watchdog,
|
watchdog::Watchdog,
|
||||||
|
Sio, Timer,
|
||||||
},
|
},
|
||||||
Pins, XOSC_CRYSTAL_FREQ,
|
Pins, XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ fn main() -> ! {
|
||||||
.set_high()
|
.set_high()
|
||||||
.unwrap();
|
.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 delay = timer.count_down();
|
||||||
|
|
||||||
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
|
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
|
||||||
|
|
|
@ -18,13 +18,13 @@ use kb2040::{
|
||||||
hal::{
|
hal::{
|
||||||
clocks::{init_clocks_and_plls, Clock},
|
clocks::{init_clocks_and_plls, Clock},
|
||||||
pac,
|
pac,
|
||||||
sio::Sio,
|
pio::PIOExt,
|
||||||
timer::Timer,
|
timer::Timer,
|
||||||
watchdog::Watchdog,
|
watchdog::Watchdog,
|
||||||
|
Sio,
|
||||||
},
|
},
|
||||||
XOSC_CRYSTAL_FREQ,
|
XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
use rp2040_hal::pio::PIOExt;
|
|
||||||
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
||||||
use ws2812_pio::Ws2812;
|
use ws2812_pio::Ws2812;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
//
|
//
|
||||||
|
@ -70,7 +70,7 @@ fn main() -> ! {
|
||||||
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer());
|
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
|
// 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
|
// Set the pins up according to their function on this particular board
|
||||||
let pins = pico::Pins::new(
|
let pins = pico::Pins::new(
|
||||||
|
|
|
@ -39,7 +39,7 @@ fn main() -> ! {
|
||||||
let mut pac = pac::Peripherals::take().unwrap();
|
let mut pac = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
//
|
//
|
||||||
|
@ -57,11 +57,11 @@ fn main() -> ! {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Configure the Timer peripheral in count-down mode
|
// 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();
|
let mut count_down = timer.count_down();
|
||||||
|
|
||||||
// The single-cycle I/O block controls our GPIO pins
|
// 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
|
// Set the pins up according to their function on this particular board
|
||||||
let pins = pico::Pins::new(
|
let pins = pico::Pins::new(
|
||||||
|
|
|
@ -46,7 +46,7 @@ fn main() -> ! {
|
||||||
// at it's default clock speed.
|
// at it's default clock speed.
|
||||||
|
|
||||||
// The single-cycle I/O block controls our GPIO pins
|
// 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
|
// Set the pins up according to their function on this particular board
|
||||||
let pins = pico::Pins::new(
|
let pins = pico::Pins::new(
|
||||||
|
|
|
@ -31,8 +31,8 @@ use hal::{
|
||||||
gpio::{bank0, FunctionI2C, Pin},
|
gpio::{bank0, FunctionI2C, Pin},
|
||||||
i2c::{peripheral::I2CPeripheralEventIterator, I2C},
|
i2c::{peripheral::I2CPeripheralEventIterator, I2C},
|
||||||
pac,
|
pac,
|
||||||
sio::Sio,
|
|
||||||
watchdog::Watchdog,
|
watchdog::Watchdog,
|
||||||
|
Sio,
|
||||||
};
|
};
|
||||||
use pico::{hal, Pins, XOSC_CRYSTAL_FREQ};
|
use pico::{hal, Pins, XOSC_CRYSTAL_FREQ};
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ fn main() -> ! {
|
||||||
let mut pac = pac::Peripherals::take().unwrap();
|
let mut pac = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
//
|
//
|
||||||
|
@ -78,7 +78,7 @@ fn main() -> ! {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// The single-cycle I/O block controls our GPIO pins
|
// 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
|
// Set the pins up according to their function on this particular board
|
||||||
let pins = pico::Pins::new(
|
let pins = pico::Pins::new(
|
||||||
|
|
|
@ -54,7 +54,7 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
//
|
//
|
||||||
|
@ -72,7 +72,7 @@ fn main() -> ! {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// The single-cycle I/O block controls our GPIO pins
|
// 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
|
// Set the pins up according to their function on this particular board
|
||||||
let pins = pico::Pins::new(
|
let pins = pico::Pins::new(
|
||||||
|
|
|
@ -9,7 +9,7 @@ mod app {
|
||||||
|
|
||||||
use embedded_hal::digital::v2::OutputPin;
|
use embedded_hal::digital::v2::OutputPin;
|
||||||
use pico::{
|
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,
|
XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ fn main() -> ! {
|
||||||
let mut pac = pac::Peripherals::take().unwrap();
|
let mut pac = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
//
|
//
|
||||||
|
@ -83,7 +83,7 @@ fn main() -> ! {
|
||||||
.device_class(2) // from: https://www.usb.org/defined-class-codes
|
.device_class(2) // from: https://www.usb.org/defined-class-codes
|
||||||
.build();
|
.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;
|
let mut said_hello = false;
|
||||||
loop {
|
loop {
|
||||||
// A welcome message at the beginning
|
// A welcome message at the beginning
|
||||||
|
|
|
@ -68,7 +68,7 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
//
|
//
|
||||||
|
@ -134,7 +134,7 @@ fn main() -> ! {
|
||||||
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer());
|
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
|
// 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
|
// Set the pins up according to their function on this particular board
|
||||||
let pins = pico::Pins::new(
|
let pins = pico::Pins::new(
|
||||||
|
|
|
@ -66,7 +66,7 @@ fn main() -> ! {
|
||||||
let mut pac = pac::Peripherals::take().unwrap();
|
let mut pac = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
//
|
//
|
||||||
|
|
|
@ -12,7 +12,7 @@ use embedded_graphics::{
|
||||||
};
|
};
|
||||||
use embedded_hal::digital::v2::OutputPin;
|
use embedded_hal::digital::v2::OutputPin;
|
||||||
use embedded_time::rate::*;
|
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 panic_halt as _;
|
||||||
use pico_explorer::{hal, pac, Button, PicoExplorer, XOSC_CRYSTAL_FREQ};
|
use pico_explorer::{hal, pac, Button, PicoExplorer, XOSC_CRYSTAL_FREQ};
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
//
|
//
|
||||||
|
@ -70,7 +70,7 @@ fn main() -> ! {
|
||||||
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer());
|
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
|
// 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
|
// Set the pins up according to their function on this particular board
|
||||||
let pins = pico_lipo_16_mb::Pins::new(
|
let pins = pico_lipo_16_mb::Pins::new(
|
||||||
|
|
|
@ -18,13 +18,13 @@ use pro_micro_rp2040::{
|
||||||
hal::{
|
hal::{
|
||||||
clocks::{init_clocks_and_plls, Clock},
|
clocks::{init_clocks_and_plls, Clock},
|
||||||
pac,
|
pac,
|
||||||
sio::Sio,
|
pio::PIOExt,
|
||||||
timer::Timer,
|
timer::Timer,
|
||||||
watchdog::Watchdog,
|
watchdog::Watchdog,
|
||||||
|
Sio,
|
||||||
},
|
},
|
||||||
XOSC_CRYSTAL_FREQ,
|
XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
use rp2040_hal::pio::PIOExt;
|
|
||||||
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
||||||
use ws2812_pio::Ws2812;
|
use ws2812_pio::Ws2812;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ use embedded_hal::digital::v2::OutputPin;
|
||||||
use embedded_hal::timer::CountDown;
|
use embedded_hal::timer::CountDown;
|
||||||
use embedded_time::duration::Extensions;
|
use embedded_time::duration::Extensions;
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
use rp2040_hal::pio::PIOExt;
|
|
||||||
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
||||||
use ws2812_pio::Ws2812;
|
use ws2812_pio::Ws2812;
|
||||||
|
|
||||||
|
@ -16,8 +15,9 @@ use qt_py_rp2040::{
|
||||||
hal::{
|
hal::{
|
||||||
clocks::{init_clocks_and_plls, Clock},
|
clocks::{init_clocks_and_plls, Clock},
|
||||||
pac,
|
pac,
|
||||||
sio::Sio,
|
pio::PIOExt,
|
||||||
watchdog::Watchdog,
|
watchdog::Watchdog,
|
||||||
|
Sio, Timer,
|
||||||
},
|
},
|
||||||
Pins, XOSC_CRYSTAL_FREQ,
|
Pins, XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ fn main() -> ! {
|
||||||
.set_high()
|
.set_high()
|
||||||
.unwrap();
|
.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 delay = timer.count_down();
|
||||||
|
|
||||||
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
|
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
|
||||||
|
|
|
@ -24,7 +24,7 @@ use rp2040_hal as hal;
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use embedded_hal::adc::OneShot;
|
use embedded_hal::adc::OneShot;
|
||||||
use embedded_time::fixed_point::FixedPoint;
|
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
|
// A shorter alias for the Peripheral Access Crate, which provides low-level
|
||||||
// register access
|
// register access
|
||||||
|
@ -54,7 +54,7 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
let clocks = hal::clocks::init_clocks_and_plls(
|
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());
|
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
|
// 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
|
// Set the pins to their default state
|
||||||
let pins = hal::gpio::Pins::new(
|
let pins = hal::gpio::Pins::new(
|
||||||
|
@ -101,7 +101,7 @@ fn main() -> ! {
|
||||||
uart.write_full_blocking(b"ADC example\r\n");
|
uart.write_full_blocking(b"ADC example\r\n");
|
||||||
|
|
||||||
// Enable ADC
|
// 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
|
// Enable the temperature sense channel
|
||||||
let mut temperature_sensor = adc.enable_temp_sensor();
|
let mut temperature_sensor = adc.enable_temp_sensor();
|
||||||
|
|
|
@ -52,7 +52,7 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
let clocks = hal::clocks::init_clocks_and_plls(
|
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());
|
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
|
// 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
|
// Set the pins to their default state
|
||||||
let pins = hal::gpio::Pins::new(
|
let pins = hal::gpio::Pins::new(
|
||||||
|
|
|
@ -50,7 +50,7 @@ fn main() -> ! {
|
||||||
let mut pac = pac::Peripherals::take().unwrap();
|
let mut pac = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
let _clocks = hal::clocks::init_clocks_and_plls(
|
let _clocks = hal::clocks::init_clocks_and_plls(
|
||||||
|
@ -66,7 +66,7 @@ fn main() -> ! {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// The single-cycle I/O block controls our GPIO pins
|
// 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
|
// Set the pins to their default state
|
||||||
let pins = hal::gpio::Pins::new(
|
let pins = hal::gpio::Pins::new(
|
||||||
|
|
|
@ -49,7 +49,7 @@ fn main() -> ! {
|
||||||
let mut pac = pac::Peripherals::take().unwrap();
|
let mut pac = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
let clocks = hal::clocks::init_clocks_and_plls(
|
let clocks = hal::clocks::init_clocks_and_plls(
|
||||||
|
@ -65,7 +65,7 @@ fn main() -> ! {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// The single-cycle I/O block controls our GPIO pins
|
// 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
|
// Set the pins to their default state
|
||||||
let pins = hal::gpio::Pins::new(
|
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
|
// 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
|
// at compile time if the pins are in the wrong mode, or if this I²C
|
||||||
// peripheral isn't available on these pins!
|
// peripheral isn't available on these pins!
|
||||||
let mut i2c = hal::i2c::I2C::i2c1(
|
let mut i2c = hal::I2C::i2c1(
|
||||||
pac.I2C1,
|
pac.I2C1,
|
||||||
sda_pin,
|
sda_pin,
|
||||||
scl_pin, // Try `not_an_scl_pin` here
|
scl_pin, // Try `not_an_scl_pin` here
|
||||||
|
|
|
@ -57,7 +57,7 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
let clocks = hal::clocks::init_clocks_and_plls(
|
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());
|
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
|
// 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
|
// Set the pins to their default state
|
||||||
let pins = hal::gpio::Pins::new(
|
let pins = hal::gpio::Pins::new(
|
||||||
|
|
|
@ -8,7 +8,7 @@ use cortex_m_rt::entry;
|
||||||
use hal::gpio::{FunctionPio0, Pin};
|
use hal::gpio::{FunctionPio0, Pin};
|
||||||
use hal::pac;
|
use hal::pac;
|
||||||
use hal::pio::PIOExt;
|
use hal::pio::PIOExt;
|
||||||
use hal::sio::Sio;
|
use hal::Sio;
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
use rp2040_hal as hal;
|
use rp2040_hal as hal;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use cortex_m_rt::entry;
|
||||||
use hal::gpio::{FunctionPio0, Pin};
|
use hal::gpio::{FunctionPio0, Pin};
|
||||||
use hal::pac;
|
use hal::pac;
|
||||||
use hal::pio::PIOExt;
|
use hal::pio::PIOExt;
|
||||||
use hal::sio::Sio;
|
use hal::Sio;
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
use rp2040_hal as hal;
|
use rp2040_hal as hal;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
//
|
//
|
||||||
|
@ -77,7 +77,7 @@ fn main() -> ! {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// The single-cycle I/O block controls our GPIO pins
|
// 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
|
// Set the pins up according to their function on this particular board
|
||||||
let pins = hal::gpio::Pins::new(
|
let pins = hal::gpio::Pins::new(
|
||||||
|
|
|
@ -54,7 +54,7 @@ fn main() -> ! {
|
||||||
let mut core = pac::CorePeripherals::take().unwrap();
|
let mut core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
let clocks = hal::clocks::init_clocks_and_plls(
|
let clocks = hal::clocks::init_clocks_and_plls(
|
||||||
|
@ -70,7 +70,7 @@ fn main() -> ! {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// The single-cycle I/O block controls our GPIO pins
|
// 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
|
// Set the pins to their default state
|
||||||
let pins = hal::gpio::Pins::new(
|
let pins = hal::gpio::Pins::new(
|
||||||
|
|
|
@ -54,7 +54,7 @@ fn main() -> ! {
|
||||||
let mut pac = pac::Peripherals::take().unwrap();
|
let mut pac = pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
let clocks = hal::clocks::init_clocks_and_plls(
|
let clocks = hal::clocks::init_clocks_and_plls(
|
||||||
|
@ -70,7 +70,7 @@ fn main() -> ! {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// The single-cycle I/O block controls our GPIO pins
|
// 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
|
// Set the pins to their default state
|
||||||
let pins = hal::gpio::Pins::new(
|
let pins = hal::gpio::Pins::new(
|
||||||
|
@ -84,7 +84,7 @@ fn main() -> ! {
|
||||||
let _spi_sclk = pins.gpio6.into_mode::<hal::gpio::FunctionSpi>();
|
let _spi_sclk = pins.gpio6.into_mode::<hal::gpio::FunctionSpi>();
|
||||||
let _spi_mosi = pins.gpio7.into_mode::<hal::gpio::FunctionSpi>();
|
let _spi_mosi = pins.gpio7.into_mode::<hal::gpio::FunctionSpi>();
|
||||||
let _spi_miso = pins.gpio4.into_mode::<hal::gpio::FunctionSpi>();
|
let _spi_miso = pins.gpio4.into_mode::<hal::gpio::FunctionSpi>();
|
||||||
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
|
// Exchange the uninitialised SPI driver for an initialised one
|
||||||
let mut spi = spi.init(
|
let mut spi = spi.init(
|
||||||
|
|
|
@ -54,7 +54,7 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
let clocks = hal::clocks::init_clocks_and_plls(
|
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());
|
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
|
// 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
|
// Set the pins to their default state
|
||||||
let pins = hal::gpio::Pins::new(
|
let pins = hal::gpio::Pins::new(
|
||||||
|
|
|
@ -55,7 +55,7 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// 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
|
// Configure the clocks
|
||||||
let clocks = hal::clocks::init_clocks_and_plls(
|
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());
|
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
|
// 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
|
// Set the pins to their default state
|
||||||
let pins = hal::gpio::Pins::new(
|
let pins = hal::gpio::Pins::new(
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
//! Capture ADC reading from a pin
|
//! Capture ADC reading from a pin
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! use embedded_hal::adc::OneShot;
|
//! 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 mut peripherals = pac::Peripherals::take().unwrap();
|
||||||
//! let sio = Sio::new(peripherals.SIO);
|
//! let sio = Sio::new(peripherals.SIO);
|
||||||
//! let pins = Pins::new(peripherals.IO_BANK0, peripherals.PADS_BANK0, sio.gpio_bank0, &mut peripherals.RESETS);
|
//! 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.
|
//! Capture ADC reading from temperature sensor. Note that this needs conversion to be a real-world temperature.
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! use embedded_hal::adc::OneShot;
|
//! 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 mut peripherals = pac::Peripherals::take().unwrap();
|
||||||
//! let sio = Sio::new(peripherals.SIO);
|
//! let sio = Sio::new(peripherals.SIO);
|
||||||
//! let pins = Pins::new(peripherals.IO_BANK0, peripherals.PADS_BANK0, sio.gpio_bank0, &mut peripherals.RESETS);
|
//! let pins = Pins::new(peripherals.IO_BANK0, peripherals.PADS_BANK0, sio.gpio_bank0, &mut peripherals.RESETS);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
//! ## Usage extended
|
//! ## Usage extended
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! use embedded_time::rate::*;
|
//! 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> {
|
//! # fn func() -> Result<(), InitError> {
|
||||||
//! let mut peripherals = pac::Peripherals::take().unwrap();
|
//! let mut peripherals = pac::Peripherals::take().unwrap();
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! // Move a pin out of the Pins struct and convert to a DynPin
|
//! // 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 mut peripherals = pac::Peripherals::take().unwrap();
|
||||||
//! # let sio = Sio::new(peripherals.SIO);
|
//! # let sio = Sio::new(peripherals.SIO);
|
||||||
//! # let pins = Pins::new(peripherals.IO_BANK0,peripherals.PADS_BANK0,sio.gpio_bank0, &mut peripherals.RESETS);
|
//! # let pins = Pins::new(peripherals.IO_BANK0,peripherals.PADS_BANK0,sio.gpio_bank0, &mut peripherals.RESETS);
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
//! API.
|
//! API.
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```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 mut peripherals = pac::Peripherals::take().unwrap();
|
||||||
//! # let sio = Sio::new(peripherals.SIO);
|
//! # let sio = Sio::new(peripherals.SIO);
|
||||||
//! # let pins = Pins::new(peripherals.IO_BANK0,peripherals.PADS_BANK0,sio.gpio_bank0, &mut peripherals.RESETS);
|
//! # let pins = Pins::new(peripherals.IO_BANK0,peripherals.PADS_BANK0,sio.gpio_bank0, &mut peripherals.RESETS);
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # use core::convert::TryInto;
|
//! # 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 mut peripherals = pac::Peripherals::take().unwrap();
|
||||||
//! # let sio = Sio::new(peripherals.SIO);
|
//! # let sio = Sio::new(peripherals.SIO);
|
||||||
//! # let pins = Pins::new(peripherals.IO_BANK0,peripherals.PADS_BANK0,sio.gpio_bank0, &mut peripherals.RESETS);
|
//! # let pins = Pins::new(peripherals.IO_BANK0,peripherals.PADS_BANK0,sio.gpio_bank0, &mut peripherals.RESETS);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//! ## Basic usage
|
//! ## Basic usage
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! use embedded_hal::digital::v2::{InputPin, OutputPin};
|
//! 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 peripherals = pac::Peripherals::take().unwrap();
|
||||||
//! let mut watchdog = Watchdog::new(peripherals.WATCHDOG);
|
//! let mut watchdog = Watchdog::new(peripherals.WATCHDOG);
|
||||||
//! const XOSC_CRYSTAL_FREQ: u32 = 12_000_000; // Typically found in BSP crates
|
//! const XOSC_CRYSTAL_FREQ: u32 = 12_000_000; // Typically found in BSP crates
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//! ## Usage
|
//! ## Usage
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! use embedded_time::rate::Extensions;
|
//! 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 mut peripherals = pac::Peripherals::take().unwrap();
|
||||||
//! let sio = Sio::new(peripherals.SIO);
|
//! let sio = Sio::new(peripherals.SIO);
|
||||||
//! let pins = Pins::new(peripherals.IO_BANK0, peripherals.PADS_BANK0, sio.gpio_bank0, &mut peripherals.RESETS);
|
//! let pins = Pins::new(peripherals.IO_BANK0, peripherals.PADS_BANK0, sio.gpio_bank0, &mut peripherals.RESETS);
|
||||||
|
|
|
@ -40,3 +40,12 @@ pub mod uart;
|
||||||
pub mod usb;
|
pub mod usb;
|
||||||
pub mod watchdog;
|
pub mod watchdog;
|
||||||
pub mod xosc;
|
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;
|
||||||
|
|
|
@ -63,7 +63,7 @@ pub struct Multicore<'p> {
|
||||||
|
|
||||||
impl<'p> Multicore<'p> {
|
impl<'p> Multicore<'p> {
|
||||||
/// Create a new |Multicore| instance.
|
/// 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 {
|
Self {
|
||||||
cores: [
|
cores: [
|
||||||
Core { inner: None },
|
Core { inner: None },
|
||||||
|
@ -82,7 +82,7 @@ impl<'p> Multicore<'p> {
|
||||||
|
|
||||||
/// A handle for controlling a logical core.
|
/// A handle for controlling a logical core.
|
||||||
pub struct Core<'p> {
|
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> {
|
impl<'p> Core<'p> {
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
//! Once you have the PWM slice struct, you can add individual pins:
|
//! Once you have the PWM slice struct, you can add individual pins:
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```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 mut pac = rp2040_pac::Peripherals::take().unwrap();
|
||||||
//! # let pwm_slices = Slices::new(pac.PWM, &mut pac.RESETS);
|
//! # let pwm_slices = Slices::new(pac.PWM, &mut pac.RESETS);
|
||||||
//! # let mut pwm = pwm_slices.pwm4.into_mode::<InputHighRunning>();
|
//! # let mut pwm = pwm_slices.pwm4.into_mode::<InputHighRunning>();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! use embedded_hal::spi::MODE_0;
|
//! use embedded_hal::spi::MODE_0;
|
||||||
//! use embedded_time::rate::*;
|
//! 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 mut peripherals = pac::Peripherals::take().unwrap();
|
||||||
//! let sio = Sio::new(peripherals.SIO);
|
//! let sio = Sio::new(peripherals.SIO);
|
||||||
|
|
|
@ -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
|
//! 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
|
//! ```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
|
//! const XOSC_CRYSTAL_FREQ: u32 = 12_000_000; // Typically found in BSP crates
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
//!
|
//!
|
||||||
//! Initialize the Usb Bus forcing the VBUS detection.
|
//! Initialize the Usb Bus forcing the VBUS detection.
|
||||||
//! ```no_run
|
//! ```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;
|
//! use usb_device::class_prelude::UsbBusAllocator;
|
||||||
//!
|
//!
|
||||||
//! const XOSC_CRYSTAL_FREQ: u32 = 12_000_000; // Typically found in BSP crates
|
//! const XOSC_CRYSTAL_FREQ: u32 = 12_000_000; // Typically found in BSP crates
|
||||||
|
|
Loading…
Add table
Reference in a new issue