mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-02-02 14:36:34 +11:00
Adds reset for timer, otherwise it would not run. (#136)
This commit is contained in:
parent
2b6de3a3c9
commit
90470b6ff3
4 changed files with 7 additions and 5 deletions
|
@ -61,7 +61,7 @@ fn main() -> ! {
|
|||
.unwrap();
|
||||
|
||||
// Configure the Timer peripheral in count-down mode
|
||||
let timer = hal::timer::Timer::new(pac.TIMER);
|
||||
let timer = hal::timer::Timer::new(pac.TIMER, &mut pac.RESETS);
|
||||
let mut count_down = timer.count_down();
|
||||
|
||||
// The single-cycle I/O block controls our GPIO pins
|
||||
|
|
|
@ -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);
|
||||
let timer = hal::timer::Timer::new(pac.TIMER, &mut pac.RESETS);
|
||||
let mut said_hello = false;
|
||||
loop {
|
||||
// A welcome message at the beginning
|
||||
|
|
|
@ -71,7 +71,7 @@ fn main() -> ! {
|
|||
|
||||
let _led: Pin<_, FunctionPio0> = pins.led.into_mode();
|
||||
|
||||
let timer = Timer::new(pac.TIMER);
|
||||
let timer = Timer::new(pac.TIMER, &mut pac.RESETS);
|
||||
let mut delay = timer.count_down();
|
||||
|
||||
// Configure the addressable LED
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
use embedded_time::duration::Microseconds;
|
||||
|
||||
use crate::pac::TIMER;
|
||||
use crate::pac::{RESETS, TIMER};
|
||||
use crate::resets::SubsystemReset;
|
||||
|
||||
/// Timer peripheral
|
||||
pub struct Timer {
|
||||
|
@ -12,7 +13,8 @@ pub struct Timer {
|
|||
|
||||
impl Timer {
|
||||
/// Create a new [`Timer`]
|
||||
pub fn new(timer: TIMER) -> Self {
|
||||
pub fn new(timer: TIMER, resets: &mut RESETS) -> Self {
|
||||
timer.reset_bring_up(resets);
|
||||
Self { timer }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue