Commit Graph

99 Commits

Author SHA1 Message Date
Timo Kröger
9b1f7b8a17 uarte: Enable peripheral with first poll
This fixes a lockup when a future is dropped before it was polled.
2021-01-04 22:55:40 +01:00
Timo Kröger
85ec9dd16f uarte: Be on safe side with potentially racy code
The PS does not specify how many cycles it takes for a STARTXX task to
generate a XXSTARTED event. I think it is instantaneous but let’s be on
the safe side for the following sequence:
1. poll() starttx
2. drop() txstarted not yet set, but future gets dropped
3. txstarted set by hardware, peripheral enabled after it was dropped
2021-01-04 22:55:40 +01:00
Timo Kröger
a3b3305b8e uarte: Only stop TX forcefully when a transmissions is running
This comes with insignificant power consumption improvements but makes
the code of the RX and TX case symmetric.
2021-01-04 22:55:40 +01:00
Timo Kröger
a7c03e4cb6 uarte: Only stop RX forcefully when a reception is running
The STOPRX task always triggers a timeout of ~55bit times until the
RXTO event is generated. Before we disabled the receiver only after
the timeout.
With this change the receiver is stopped right after reception has ended
because the DMA buffer is full.
For forced RX aborts like `stop()` or on drop still need to wait for the
RXTO event before disabling the receiver.
2021-01-04 22:55:40 +01:00
Timo Kröger
9f28c7ab8d uarte: Do not spin when stopping a receive future
Spinning on drop() is still required when the future has not been
stopped so that DMA finishes before the buffer is released.
2021-01-04 22:55:40 +01:00
Dario Nieuwenhuis
39ca8b8ded Fix build on non-nrf52840 2021-01-03 22:30:47 +01:00
Dario Nieuwenhuis
ace4f40f80 Introduce "peripheral" abstraction to share state between main and interrupt. 2021-01-03 01:40:40 +01:00
Dario Nieuwenhuis
4ce51795f2 use hal::Pins for BufferedUarte 2021-01-02 20:31:50 +01:00
Dario Nieuwenhuis
8fa3294f35 Update readme 2021-01-02 20:13:35 +01:00
Dario Nieuwenhuis
0ab88ea279 Add Uart trait, implement it for nrf. 2021-01-02 19:59:37 +01:00
Dario Nieuwenhuis
1d53985abe Remove now-stable slice_fill feature 2021-01-02 19:56:05 +01:00
Dario Nieuwenhuis
3c7e7220b3 Don't use embedded_dma in nrf uarte. 2021-01-02 19:14:54 +01:00
Dario Nieuwenhuis
396d7650ca Add some comments to uart example. 2021-01-01 23:04:18 +01:00
Dario Nieuwenhuis
20d3dc87f9 Rename examples -> embassy-nrf-examples 2021-01-01 22:46:32 +01:00
Dario Nieuwenhuis
4783222f67 Rename WakerStore -> WakerRegistration. 2021-01-01 22:30:11 +01:00
Dario Nieuwenhuis
ffb92731cd
Merge pull request #12 from timokroeger/task-macro-warning
Fix warnings for tasks that take mutable parameters
2020-12-31 16:32:44 +01:00
Timo Kröger
c17954ccba Fix warnings for tasks that take mutable parameters
#[task]
pub async fn run(mut param: Param) {}

warning: variable does not need to be mutable
2020-12-31 15:38:10 +01:00
Dario Nieuwenhuis
cd56d2621a
Merge pull request #3 from timokroeger/low-power-uarte
(low power) UARTE implementation
2020-12-30 19:57:36 +01:00
Timo Kröger
6695bf0f21 Low power UART driver 2020-12-30 19:24:12 +01:00
Timo Kröger
c97d5262f5 Blocking wait method for signals 2020-12-30 19:24:12 +01:00
Dario Nieuwenhuis
6bc1a712ff Fix Forever 2020-12-30 04:17:45 +01:00
Dario Nieuwenhuis
a02d0a378e Fix race in enqueuing expired tasks. 2020-12-30 04:12:48 +01:00
Dario Nieuwenhuis
bb6f25d010 Remove use of deprecated compare_and_swap. 2020-12-30 01:07:22 +01:00
Dario Nieuwenhuis
015b6bbce4 Ensure timers always yield at least once.
This prevents a task that's constantly running late from monopolizing the CPU.
Add executor_fairness_test example showcasing it.
2020-12-30 00:57:35 +01:00
Dario Nieuwenhuis
2bf9b14ef0
Merge pull request #7 from akiles/irq
Owned IRQs
2020-12-29 15:32:23 +01:00
Dario Nieuwenhuis
7dc81faa4e Declare irqs for each nrf chip 2020-12-29 15:20:42 +01:00
Dario Nieuwenhuis
af5454fbfe Update drivers to owned irqs. 2020-12-29 01:53:17 +01:00
Dario Nieuwenhuis
4b8d8ba87e Update RTC for owned irqs 2020-12-29 01:05:28 +01:00
Dario Nieuwenhuis
0750234fbe WIP owned irqs 2020-12-29 00:05:52 +01:00
Dario Nieuwenhuis
b01a88a839 Do not run timer queue if no alarm is set. 2020-12-29 00:04:58 +01:00
Dario Nieuwenhuis
267ec334ac Rename Uarte -> BufferedUarte 2020-12-28 23:57:50 +01:00
Dario Nieuwenhuis
4a7344cb6f Add embassy-std crate with glue to run embassy on std. 2020-12-28 03:41:40 +01:00
Dario Nieuwenhuis
32c67381df Add missing ?Sized bound in read_line 2020-12-27 23:34:05 +01:00
Dario Nieuwenhuis
692d8bb813 More efficient timer queue, integrated into Executor directly. 2020-12-26 23:44:53 +01:00
Dario Nieuwenhuis
8b7a42a4f9 Split waker to separate file. 2020-12-26 17:22:36 +01:00
Dario Nieuwenhuis
3df66c44e3 Split executor into multiple files, remove old timers implementation. 2020-12-26 16:42:44 +01:00
Dario Nieuwenhuis
db8b4ca565 Better SpawnToken error messages 2020-12-26 15:15:50 +01:00
Dario Nieuwenhuis
80c504cd95 Add std impl for rand 2020-12-14 00:36:29 +01:00
Dario Nieuwenhuis
1aae27270e Better fmt macros. 2020-12-13 21:17:58 +01:00
Dario Nieuwenhuis
3be7ace878 add time::Ticker 2020-12-13 19:54:18 +01:00
Dario Nieuwenhuis
ca2ff632ba Fix possibly ambiguous macro 2020-12-01 20:00:55 +01:00
Dario Nieuwenhuis
02af635e7b Fix CI 2020-12-01 17:52:06 +01:00
Dario Nieuwenhuis
6f76c0ebcc Add support for log+defmt again, but better. 2020-12-01 17:46:56 +01:00
Dario Nieuwenhuis
78135a81d9 Remove anyfmt 2020-11-27 18:42:59 +01:00
Dario Nieuwenhuis
49d5121094 Fix unsoundness in Forever 2020-11-16 01:04:56 +01:00
Dario Nieuwenhuis
2e062f5627 gpiote: change port api to directly return futures. 2020-11-09 01:04:34 +01:00
Dario Nieuwenhuis
61b1d4e188 Fix build for nrfs with 32 gpios 2020-11-08 19:05:34 +01:00
Dario Nieuwenhuis
e539cd32ca Fix logging with anyfmt/log 2020-11-08 19:00:23 +01:00
Dario Nieuwenhuis
36517fd1c5 Add gpiote port example. 2020-11-08 19:00:08 +01:00
Dario Nieuwenhuis
fc0fe842ee Add support for GPIOTE Port event. 2020-11-08 18:59:31 +01:00