aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/uarte.rs
diff options
context:
space:
mode:
authorLiam Murphy <[email protected]>2021-06-29 10:33:41 +1000
committerLiam Murphy <[email protected]>2021-06-29 10:33:41 +1000
commite7addf094b4d2cfed32ff3728e1d3d816430cf07 (patch)
tree26e4e610312fec75d1c43030e0746bc93340af2a /embassy-nrf/src/uarte.rs
parent02781ed744b6e76d3790844f898235088b0fd8aa (diff)
Fix `Cc::wait` never resolving and refactor some APIs
I think the interrupt was getting immediately re-triggered as soon as the handler exited, so I disabled the interrupt in the handler.
Diffstat (limited to 'embassy-nrf/src/uarte.rs')
-rw-r--r--embassy-nrf/src/uarte.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs
index d138257c7..67ec5d73f 100644
--- a/embassy-nrf/src/uarte.rs
+++ b/embassy-nrf/src/uarte.rs
@@ -318,7 +318,7 @@ impl<'d, U: Instance, T: TimerInstance> UarteWithIdle<'d, U, T> {
318 ) -> Self { 318 ) -> Self {
319 let baudrate = config.baudrate; 319 let baudrate = config.baudrate;
320 let uarte = Uarte::new(uarte, irq, rxd, txd, cts, rts, config); 320 let uarte = Uarte::new(uarte, irq, rxd, txd, cts, rts, config);
321 let timer = Timer::new_irqless(timer); 321 let mut timer = Timer::new_irqless(timer);
322 322
323 unborrow!(ppi_ch1, ppi_ch2); 323 unborrow!(ppi_ch1, ppi_ch2);
324 324
@@ -333,9 +333,9 @@ impl<'d, U: Instance, T: TimerInstance> UarteWithIdle<'d, U, T> {
333 let timeout = 0x8000_0000 / (baudrate as u32 / 40); 333 let timeout = 0x8000_0000 / (baudrate as u32 / 40);
334 334
335 timer.set_frequency(Frequency::F16MHz); 335 timer.set_frequency(Frequency::F16MHz);
336 timer.cc0().set(timeout); 336 timer.cc(0).write(timeout);
337 timer.cc0().short_compare_clear(); 337 timer.cc(0).short_compare_clear();
338 timer.cc0().short_compare_stop(); 338 timer.cc(0).short_compare_stop();
339 339
340 let mut ppi_ch1 = Ppi::new(ppi_ch1.degrade_configurable()); 340 let mut ppi_ch1 = Ppi::new(ppi_ch1.degrade_configurable());
341 ppi_ch1.set_event(Event::from_reg(&r.events_rxdrdy)); 341 ppi_ch1.set_event(Event::from_reg(&r.events_rxdrdy));
@@ -344,7 +344,7 @@ impl<'d, U: Instance, T: TimerInstance> UarteWithIdle<'d, U, T> {
344 ppi_ch1.enable(); 344 ppi_ch1.enable();
345 345
346 let mut ppi_ch2 = Ppi::new(ppi_ch2.degrade_configurable()); 346 let mut ppi_ch2 = Ppi::new(ppi_ch2.degrade_configurable());
347 ppi_ch2.set_event(timer.cc0().event_compare()); 347 ppi_ch2.set_event(timer.cc(0).event_compare());
348 ppi_ch2.set_task(Task::from_reg(&r.tasks_stoprx)); 348 ppi_ch2.set_task(Task::from_reg(&r.tasks_stoprx));
349 ppi_ch2.enable(); 349 ppi_ch2.enable();
350 350