Skip to content

Commit d40ce1f

Browse files
committed
Rename blinker and make it repeat.
1 parent 9fba6fc commit d40ce1f

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/main.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const APP: () = {
3434
serial: serial::Serial<pac::USART1, PA9<Alternate<AF1>>, PA10<Alternate<AF1>>>,
3535
}
3636

37-
#[init(spawn = [blinker])]
37+
#[init(spawn = [led_status_blink])]
3838
fn init(ctx: init::Context) -> init::LateResources {
3939
defmt::info!("Neotron BMC version {:?} booting", VERSION);
4040

@@ -71,7 +71,7 @@ const APP: () = {
7171

7272
let serial = serial::Serial::usart1(dp.USART1, (uart_tx, uart_rx), 115_200.bps(), &mut rcc);
7373

74-
ctx.spawn.blinker().unwrap();
74+
ctx.spawn.led_status_blink().unwrap();
7575

7676
led_power.set_high().unwrap();
7777

@@ -112,19 +112,23 @@ const APP: () = {
112112
// }
113113
// }
114114

115-
#[task(resources = [led_status], schedule = [blinker])]
116-
fn blinker(ctx: blinker::Context) {
115+
#[task(resources = [led_status], schedule = [led_status_blink])]
116+
fn led_status_blink(ctx: led_status_blink::Context) {
117117
// Use the safe local `static mut` of RTIC
118118
static mut LED_STATE: bool = false;
119119

120+
defmt::info!("blink time {}", ctx.scheduled.counts());
121+
120122
if *LED_STATE {
121123
ctx.resources.led_status.set_low().unwrap();
122124
*LED_STATE = false;
123125
} else {
124126
ctx.resources.led_status.set_high().unwrap();
125127
*LED_STATE = true;
126128
}
127-
//ctx.schedule.blinker(ctx.scheduled + PERIOD_MS.millis()).unwrap();
129+
ctx.schedule
130+
.led_status_blink(ctx.scheduled + PERIOD_MS.millis())
131+
.unwrap();
128132
}
129133

130134
// Let it use the USB interrupt as a generic software interrupt.

0 commit comments

Comments
 (0)