Dion Dokter
ddcee446c1
Added anomaly workaround from the HAL to improve the UARTE
2021-10-12 13:35:08 +02:00
Dion Dokter
2c2c284482
Undoing unnecessary changes
2021-10-12 11:55:38 +02:00
Dion Dokter
20674f7126
Initial support for nrf9160
2021-10-11 10:39:38 +02:00
Dario Nieuwenhuis
ead987245d
embassy: Refactor module structure to remove kitchen-sink util
.
2021-09-11 02:35:35 +02:00
f_punk
34c66fa78d
removed type aliases
...
NotAwaitable as default generic param
added awaitable_timer example
2021-09-02 12:02:31 +02:00
f_punk
a0c40562ea
added typestate to nrf-Timer
...
useful for hooking up the PPI to an Event without needing interrupt
tested with buffered_uart example on nRF52840-DK
2021-09-01 16:16:56 +02:00
Dario Nieuwenhuis
7bfb763e09
Rename embassy-extras to embassy-hal-common
2021-07-29 13:44:51 +02:00
Liam Murphy
1b7ad7080e
Add Send/Sync
bounds to PeripheralState
2021-07-24 12:53:57 +10:00
Liam Murphy
e7addf094b
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.
2021-06-29 10:33:41 +10:00
Liam Murphy
02781ed744
Add an nRF Timer driver
...
Resolves #189
2021-06-26 17:58:36 +10:00
Dario Nieuwenhuis
e7dc5c0939
fmt: make all macros macro_rules
so scoping is consistent.
2021-06-07 00:16:39 +02:00
Dario Nieuwenhuis
39c420733f
nrf/uarte: deconfigure pins on drop
2021-05-26 20:11:23 +02:00
Rukai
149ddf2f29
Fix warnings
2021-05-17 19:48:58 +10:00
Dario Nieuwenhuis
a5ad79927e
nrf: add Unborrow<Target = Self>
bound to all instance traits
2021-05-17 01:01:31 +02:00
Dario Nieuwenhuis
bd9589d0ce
nrf: add support for nrf52805, nrf52811, nrf52820
2021-05-17 00:57:20 +02:00
Ulf Lilleengen
0a3c236510
Improve comment
2021-05-10 23:06:25 +02:00
Ulf Lilleengen
e9eb3ce6c1
Disable PPI trigger during normal read
2021-05-10 23:06:25 +02:00
Ulf Lilleengen
687dda106f
Read rx amount outside of poll_fn
2021-05-10 23:06:25 +02:00
Ulf Lilleengen
5afe01617a
Use rxdrdy as trigger for timer
2021-05-10 23:06:25 +02:00
Ulf Lilleengen
dda338cedb
Add implementation of ReadUntilIdle for nRF UART
...
Add type UarteWithIdle that implements Read, Write and ReadUntilIdle
traits. The type uses a timer + 2 PPI channels internally, triggered on
RTXSTARTED event.
2021-05-10 23:06:25 +02:00
Dario Nieuwenhuis
97ca54fa66
Rename PeripheralBorrow to Unborrow
2021-04-14 19:59:52 +02:00
Dario Nieuwenhuis
59ccc45f28
Remove pin from Uart
2021-04-14 17:04:40 +02:00
Dario Nieuwenhuis
b9e709403d
nrf: better macro naming.
2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
aa0341056e
nrf/uarte: deal with hwfc correctly
2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
3eccddc44d
nrf/uarte: use rxstarted/txstarted events to track whether a wait for stop is necessary on drop.
2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
7a41541ab2
nrf/uarte: use Peripheral, wait for stop on drop.
2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
a0511e6caa
nrf/uart: make rts/cts optional.
2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
df42c38492
nrf/uarte: update to new api
2021-03-29 00:58:58 +02:00
Thales Fragoso
15c3e78408
Move nRF's util into a separate crate
2021-03-07 20:15:40 -03:00
Timo Kröger
28b2365ef3
Update nrf-hal
to v0.12.1
...
Use the `psel_bits()` method to reduce #[cfg] clutter
2021-03-05 09:25:46 +01:00
xoviat
9626aee7db
Move traits to separate crate.
2021-03-02 00:32:23 +01:00
Dario Nieuwenhuis
45355f184a
move most interrupt methods to InterruptExt extension trait. Fixes #35
2021-03-01 00:44:38 +01:00
Dario Nieuwenhuis
da91779117
interrupt: Split set_handler context.
...
Since introducing the ctx pointer, the handler is now two words, so setting it can
race with the interrupt firing. On race it's possible for the new handler to be
alled with the old ctx pointer or viceversa.
Rather than documenting this, it's better to split the function in two to make it
obvious to the user that it's not atomic. The user can use a critical section, or
disable/enable the interrupt to avoid races if this is a concern.
2021-02-26 02:04:48 +01:00
Dario Nieuwenhuis
11be9170ec
Cleanup interrupt package naming. Fixes #40
...
The `interrupt` package previously tried to be drop-in compatible with the
`interrupt` package from PACs. THis meant that there was both a PAC-style enum
value `UARTE0` and an embassy-style owned `UARTE0Interrupt` type. This made
things VERY confusing.
This drops compatibility with the PAC, improving the names for embassy interrupts.
2021-02-26 01:55:27 +01:00
Dario Nieuwenhuis
9bb4c97dc2
Merge pull request #14 from timokroeger/uarte-power-optimization
...
UARTE power optimization and improvements
2021-01-05 22:10:52 +01:00
Timo Kröger
0631623b51
uarte: Low power wait for RX drop
2021-01-04 22:55:40 +01:00
Timo Kröger
93780fa31d
uarte: Wait for the peripheral to be disabled
...
Prevents a panic in the case of:
1. Abort a receive future
2. Free Uarte::free()
3. Uarte::new()
-> panicked at 'assertion failed: uarte.enable.read().enable().is_disabled()'
2021-01-04 22:55:40 +01:00
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
9e88718fbd
Add "context" pointer to owned interrupt handlers.
2021-01-04 22:25:39 +01:00
Dario Nieuwenhuis
0ab88ea279
Add Uart trait, implement it for nrf.
2021-01-02 19:59:37 +01:00
Dario Nieuwenhuis
3c7e7220b3
Don't use embedded_dma in nrf uarte.
2021-01-02 19:14:54 +01:00
Timo Kröger
6695bf0f21
Low power UART driver
2020-12-30 19:24:12 +01:00
Dario Nieuwenhuis
267ec334ac
Rename Uarte -> BufferedUarte
2020-12-28 23:57:50 +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
0a3590566d
Fix ambiguous assert
2020-11-01 17:56:29 +01:00
Dario Nieuwenhuis
5e8608c7a5
Make defmt optional with new anyfmt
crate
2020-11-01 17:17:24 +01:00
Dario Nieuwenhuis
0643095695
Fix build with all nrf chip models
2020-10-31 23:03:09 +01:00
Dario Nieuwenhuis
9a57deef9b
First commit
2020-09-22 18:03:43 +02:00