Dario Nieuwenhuis
de016e8456
Remove trait_alias, allow(incomplete_features).
...
trait_alias seems unused. no idea why it's there.
2021-09-03 17:00:58 +02:00
Dario Nieuwenhuis
d0c8749399
Merge pull request #382 from fnafnio/typestate_nrf_timer
...
Typestate nrf timer
2021-09-02 13:39:55 +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
Dario Nieuwenhuis
a81b963561
nrf/saadc: don't use wake_on_interrupt.
2021-09-01 23:54:26 +02:00
f_punk
1cef7134d4
moved CC::wait to awaitable typestate
2021-09-01 16:20:32 +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
7c0990ad1e
time: allow storing state inside the driver struct.
2021-08-25 21:06:27 +02:00
Richard Dodd
ed1ed5225f
Expose EASY_DMA_SIZE.
2021-08-22 00:23:03 +01:00
Dario Nieuwenhuis
3457bb9f05
nrf: make gpiote and time-driver optional via cargo features.
2021-08-20 15:42:42 +02:00
Dario Nieuwenhuis
17659e2e44
nrf/wdt: add handle steal
2021-08-20 14:23:24 +02:00
Dario Nieuwenhuis
066abfe4c6
nrf/time: allow configuring the rtc irq prio
2021-08-18 22:13:02 +02:00
Dario Nieuwenhuis
2540a960e5
nrf: add WDT driver
2021-08-07 14:26:28 +02:00
Dario Nieuwenhuis
05e50e1f4a
time_driver: use regular fn ptr -> raw ptr casts
2021-08-05 19:19:47 +02:00
Dario Nieuwenhuis
0ea6a2d890
time: replace dyn clock/alarm with a global Driver trait
2021-08-05 19:14:09 +02:00
Dario Nieuwenhuis
07d4b196f7
Update nightly, remove removed features.
2021-08-04 19:48:14 +02:00
Dario Nieuwenhuis
3f28bb6c77
common: Initialize PeripheralMutex state with closure to ensure it's done in-place.
2021-08-02 20:13:41 +02:00
Dario Nieuwenhuis
af87031d62
hal-common: remove Pin in PeripheralMutex
2021-08-02 19:55:04 +02:00
Dario Nieuwenhuis
7bfb763e09
Rename embassy-extras to embassy-hal-common
2021-07-29 13:44:51 +02:00
Dario Nieuwenhuis
c8a48d726a
Merge pull request #277 from Liamolucko/fix-peripheral-ub
...
extras: Fix UB in `Peripheral`
2021-07-29 13:08:30 +02:00
Liam Murphy
d5ba35424d
Replace PeripheralStateUnchecked
with register_interrupt_unchecked
2021-07-29 15:11:26 +10:00
Liam Murphy
079526559f
Remove critical sections from PeripheralMutex
interrupt handler by checking the interrupt's priority on startup.
...
Since `PeripheralMutex` is the only way to safely maintain state across interrupts, and it no longer allows setting the interrupt's priority, the priority changing isn't a concern.
This also prevents other causes of UB due to the interrupt being exposed during `with`, and allowing enabling the interrupt and setting its context to a bogus pointer.
2021-07-27 17:28:52 +10:00
Liam Murphy
1b7ad7080e
Add Send/Sync
bounds to PeripheralState
2021-07-24 12:53:57 +10:00
Bob McWhirter
58edefff6e
Formatting.
2021-07-23 13:22:39 -04:00
Bob McWhirter
d5ed5c3ef3
Split up the nRF impls for SPI traits.
2021-07-23 13:22:39 -04:00
Dario Nieuwenhuis
f916fe5476
all hals: reexport PAC if unstable-pac
feature is set.
2021-07-14 22:19:04 +02:00
Liam Murphy
744e2cbb8a
extras: Fix UB in Peripheral
...
`Peripheral` assumed that interrupts can't be preempted,
when they can be preempted by higher priority interrupts.
So I put the interrupt handler inside a critical section,
and also added checks for whether the state had been dropped
before the critical section was entered.
I also added a `'static` bound to `PeripheralState`,
since `Pin` only guarantees that the memory it directly references
will not be invalidated.
It doesn't guarantee that memory its pointee references also won't be invalidated.
There were already some implementations of `PeripheralState`
that weren't `'static`, though,
so I added an unsafe `PeripheralStateUnchecked` trait
and forwarded the `unsafe` to the constructors of the implementors.
2021-07-05 17:42:43 +10:00
Dario Nieuwenhuis
7ebd4e3aa9
nrf/gpio: fix unused warning on chips without ports
2021-07-05 02:44:16 +02:00
Dario Nieuwenhuis
e55c89f890
Merge pull request #262 from Liamolucko/nrf-rng
...
Add an nRF RNG driver
2021-07-01 01:55:55 +02:00
Liam Murphy
99339e940e
fix: check if new_ptr == end
, not the old pointer
2021-06-30 16:04:34 +10:00
Liam Murphy
53b95588df
Use atomics to share state instead of a RefCell
2021-06-30 15:55:52 +10:00
Liam Murphy
89fdad3a6b
Don't wake the future for every byte in fill_bytes
2021-06-30 12:34:57 +10:00
Liam Murphy
ae0219de6f
Move initialisation inside of future
2021-06-30 09:45:49 +10:00
Liam Murphy
8a4ab29819
Add an nRF RNG driver
...
Resolves #187
Like the stm32 driver, this has both a non-blocking and blocking API, and implements `rand_core::RngCore` for the blocking API.
2021-06-29 17:26:16 +10:00
Liam Murphy
c0ef40d6e9
Correctly unset bits
2021-06-29 15:12:42 +10:00
Liam Murphy
e6d0dba5ca
Write bits directly to intenset/clr + shorts
2021-06-29 14:37:37 +10:00
Liam Murphy
87ca902e44
Handle differences between PACs
2021-06-29 13:04:05 +10:00
Liam Murphy
0c0597f775
Don't include extended timer support on chips without it
2021-06-29 12:07:10 +10:00
Liam Murphy
94e13ef053
Fix Cc::event_compare
2021-06-29 11:39:50 +10:00
Liam Murphy
e5a5031f20
Get rid of the TODO about variant names, stop the timer before setting BITMODE and set a default frequency.
2021-06-29 11:29:32 +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
Jacob Rosenthal
e9bd8428e3
embassy-nrf: twim derive defmt
2021-06-07 19:09:03 -07:00
Dario Nieuwenhuis
d1eeef5864
nrf/buffered_uarte: Fix crash when calling set_baudrate as the very first thing.
2021-06-08 00:32:14 +02:00
Dario Nieuwenhuis
3be49d3e79
fmt: Add dunmy use to avoid "unused variable" errors when no log is enabled.
2021-06-07 03:21:37 +02:00
Dario Nieuwenhuis
ef1ebefec0
fmt: use absolute paths
2021-06-07 03:15:05 +02:00
Dario Nieuwenhuis
e7dc5c0939
fmt: make all macros macro_rules
so scoping is consistent.
2021-06-07 00:16:39 +02:00
Folkert
749633ddf2
fix errors
2021-06-05 12:02:17 +02:00
Folkert
0c0bf6e4db
extract the polled-on function
2021-06-05 11:59:58 +02:00
Folkert
28c0023c9a
add distinct read and write functions
2021-06-05 11:48:00 +02:00
Folkert
d0dd0f007a
changes after review
2021-06-05 11:37:11 +02:00