Commit Graph

247 Commits

Author SHA1 Message Date
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
Dario Nieuwenhuis
42abeca493 nrf/spim: disable and deconfigure pins on drop. 2021-05-26 20:11:23 +02:00
Dario Nieuwenhuis
39c420733f nrf/uarte: deconfigure pins on drop 2021-05-26 20:11:23 +02:00
Dario Nieuwenhuis
8dfb6dff86 nrf/twim: make pullup configurable, do not enable it by default. 2021-05-26 20:11:23 +02:00
Dario Nieuwenhuis
b449f6de9d nrf/twim: deconfigure pins on drop 2021-05-26 18:23:10 +02:00
Dario Nieuwenhuis
55c3ba2a5f nrf/saadc: do not use dyn 2021-05-22 15:42:14 +02:00
Ulf Lilleengen
13524080d3 Avoid using full GAT 2021-05-22 13:23:09 +02:00
Ulf Lilleengen
f6cac6944c Makes it possible to use the ADC with different analog pins 2021-05-21 13:12:27 +02:00
Dario Nieuwenhuis
105c8504b6 Mark Unborrow as unsafe to implement 2021-05-19 23:29:33 +02:00
Dario Nieuwenhuis
e3ab02c7e3 nrf/saadc: remove Pin 2021-05-19 20:22:15 +02:00
Dario Nieuwenhuis
58723a8e76
Merge pull request #185 from embassy-rs/nrf-improvement
nrf improvements
2021-05-17 22:48:36 +02:00
Dario Nieuwenhuis
32fc17f0fd nrf/gpiote: Allow choosing IRQ priority. 2021-05-17 21:27:27 +02:00
Rukai
3e83acc1cb Fix unused field warnings 2021-05-17 20:23:04 +10:00
Rukai
149ddf2f29 Fix warnings 2021-05-17 19:48:58 +10:00
Dario Nieuwenhuis
f7858631d8 stm32: fix build, add ci 2021-05-17 03:16:58 +02:00
Dario Nieuwenhuis
a5ad79927e nrf: add Unborrow<Target = Self> bound to all instance traits 2021-05-17 01:01:31 +02:00
Dario Nieuwenhuis
8394603ea6 nrf/pwm: add enable/disable 2021-05-17 00:57:37 +02:00
Dario Nieuwenhuis
88f664b434 nrf/pwm: set initial value to Low, according to the PS 2021-05-17 00:57:37 +02:00
Dario Nieuwenhuis
f9bcf6df6b nrf: add PWM 2021-05-17 00:57:37 +02:00
Dario Nieuwenhuis
0310e4d458 Add init fn. Initializes hw and returns Peripherals. 2021-05-17 00:57:37 +02:00
Dario Nieuwenhuis
97b01f1c47 nrf/gpiote: initialize automatically 2021-05-17 00:57:20 +02:00
Dario Nieuwenhuis
92be72e0e3 Add #[interrupt] macro to register static interrupts. 2021-05-17 00:57:20 +02:00
Dario Nieuwenhuis
eb4571dc4c nrf: add blocking TWIM 2021-05-17 00:57:20 +02:00
Dario Nieuwenhuis
bd9589d0ce nrf: add support for nrf52805, nrf52811, nrf52820 2021-05-17 00:57:20 +02:00
Ulf Lilleengen
3b86e85770 Bump version of critical-section to 0.2.1 2021-05-13 18:17:50 +02:00
Dario Nieuwenhuis
e0809ab0fb Switch to use PrioritX enums. 2021-05-11 01:34:24 +02:00
Dario Nieuwenhuis
7fa0e57172 Use critical_section crate 2021-05-11 01:15:30 +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
76f737bb0e
Merge pull request #158 from derekdreery/blocking_spim
Implement the blocking hal api for SPIM.
2021-05-05 22:52:36 +02:00
Richard Dodd
212e83aa22 Make changes to Write as well as Transfer 2021-05-05 19:18:57 +01:00
Richard Dodd
9d427a1ba4 Address issues in PR
Also add some documentation.
2021-05-05 18:33:45 +01:00
Richard Dodd
9de12a0a7a Address issues in PR. 2021-05-05 18:25:14 +01:00
Richard Dodd
1ad18aa09a Implement the blocking hal api for SPIM. 2021-05-05 14:50:28 +01:00
Richard Dodd
0b3ccca69b Add a pin variant that can change between disconnected/input/output.
I'm in no way attached to the name and encourage better suggestions.
2021-05-05 14:46:51 +01:00
Ulf Lilleengen
e2ad5e1395 Add detection of edge transitions for ports 2021-04-16 07:58:24 +02:00
Dario Nieuwenhuis
97ca54fa66 Rename PeripheralBorrow to Unborrow 2021-04-14 19:59:52 +02:00
Dario Nieuwenhuis
5ee87cf25d Remove Pin from Flash trait 2021-04-14 17:04:40 +02:00
Dario Nieuwenhuis
c15411d1bd Remove Pin from SPI 2021-04-14 17:04:40 +02:00
Dario Nieuwenhuis
8b1ffb2cb7 Remove Pin from GPIO traits 2021-04-14 17:04:40 +02:00
Dario Nieuwenhuis
59ccc45f28 Remove pin from Uart 2021-04-14 17:04:40 +02:00
Dario Nieuwenhuis
402f7f1886 nrf/gpio: remove DummyPin 2021-04-10 01:48:37 +02:00
Dario Nieuwenhuis
5b74e326e5 nrf/qpsi: make config non_exhaustive 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
b9e709403d nrf: better macro naming. 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
48cf1f6ebf nrf/system: add configure 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
3a18373828 nrf/uarte: update BufferedUarte to new APi 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
00e5f30352 nrf/ppi: add AnyConfigurableChannel 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
31b817ed27 nrf/timer: add instance traits 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
b6496a85d8 nrf/ppi: implement and add example 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
26705ec328 nrf/ppi: add peris and traits 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
646be40ac5 nrf/gpiote: make number() public, change to usize 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
90f599bc2f nrf/gpiote: update output channel to new API 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
2bd9323f28 nrf/gpiote: update input channel to new API 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
a338841797 extras: add impl_unborrow macro 2021-03-29 00:58:58 +02:00
Richard Dodd
2c248dab56 nrf/spim: make mosi,miso optional 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
5646926cca nrf/rtc: update to new api 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
1c9f98e1b6 nrf/gpiote: fix irq race condition
The interrupt could fire between checking if sense=disabled and registering the waker,
in which case the future would get stuck.
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
0e8bb5dc0b util: Do not unregister waker on wake in AtomicWaker. 2021-03-29 00:58:58 +02:00
Richard Dodd
53645d9d38 nrf/saadc: initial implementation 2021-03-29 00:58:58 +02:00
Richard Dodd
a08d781442 nrf/gpio: allow borrowed pins. 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
e7e34cb8c2 nrf/gpio: add OptionalPin 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
Dario Nieuwenhuis
7b6086d19e nrf: add unborrow! macro 2021-03-29 00:58:58 +02:00
Dario Nieuwenhuis
a134fce122 nrf: nicer Peripherals api, add take() 2021-03-29 00:58:57 +02:00
Dario Nieuwenhuis
d5ff1a0ae3 nrf: rename inner peripheral to peri for consistence 2021-03-29 00:58:57 +02:00
Dario Nieuwenhuis
95218bf8d4 Rename GpioteInput -> PortInput 2021-03-29 00:58:57 +02:00
Dario Nieuwenhuis
c0876187dd extras: move peripherals from nrf to extras 2021-03-29 00:58:57 +02:00