Replace hal::timer::Timer with hal::Timer or Timer

This commit is contained in:
9names 2021-12-04 17:39:32 +11:00
parent def0ed97f7
commit 6e184a91a7
4 changed files with 8 additions and 8 deletions

View file

@ -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,
pio::PIOExt,
watchdog::Watchdog, watchdog::Watchdog,
Sio, Sio, Timer,
}, },
Pins, XOSC_CRYSTAL_FREQ, Pins, XOSC_CRYSTAL_FREQ,
}; };
@ -59,7 +59,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);

View file

@ -61,7 +61,7 @@ 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

View file

@ -89,7 +89,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

View file

@ -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,
pio::PIOExt,
watchdog::Watchdog, watchdog::Watchdog,
Sio, Sio, Timer,
}, },
Pins, XOSC_CRYSTAL_FREQ, Pins, XOSC_CRYSTAL_FREQ,
}; };
@ -59,7 +59,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);