Commit Graph

220 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
fe355af4f0 nrf: update to cortex-m-rt 0.7 2021-08-19 17:11:17 +02:00
Dario Nieuwenhuis
d3aeb45fb3 Update cortex-m-rt to v0.7 for stm32, rp. 2021-08-19 00:56:11 +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
452f7e0c2c nrf: update PACs to 0.10 2021-08-07 12:41:12 +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
Dario Nieuwenhuis
35a76c364a embassy/time: make optional via Cargo feature 2021-07-12 03:45:48 +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
Dario Nieuwenhuis
76ae9e0e7c nrf: use released nrf52805-pac, nrf52820-pac 2021-06-15 22:25:37 +02: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
Folkert
3f74c557ed skip 'in ram' check for mutable slice in fullduplex 2021-06-05 11:34:50 +02:00
Folkert
857ac3386b nrf async twim 2021-06-04 17:31:35 +02:00
Folkert
990d83d424 match on mode 2021-06-03 11:38:25 +02:00
Dario Nieuwenhuis
3bd36dce76 nrf/qspi: wait MORE for DPM enter. 2021-05-27 00:42:29 +02:00
Dario Nieuwenhuis
de703eb605 nrf/qspi: proper lowpower drop, supporting DPM. 2021-05-26 23:26:07 +02:00