huntc
4e7fa52288
Applies the Uarte patch
...
Applies the Nordic workaround found in the `Uarte` for the nRF9160 and nRF5340 to the `BufferedUarte`.
2021-12-08 12:02:30 +11:00
Dario Nieuwenhuis
6dd55265cd
nrf/gpiote: fix build for nrf9160
2021-12-02 04:01:03 +01:00
huntc
496ad4ed43
Rationale for uarte usage
2021-12-01 09:37:09 +11:00
huntc
469852c667
Removed unsafe from uarte
...
The constructors themselves are not strictly unsafe. Interactions with DMA can be generally unsafe if a future is dropped, but that's a separate issue. It is important that we use the `unsafe` keyword diligently as it can lead to confusion otherwise.
2021-12-01 09:14:24 +11:00
bors[bot]
c7d9729028
Merge #486
...
486: Pwm ppi events r=Dirbaio a=jacobrosenthal
More PWM yak shaving. I was going to do some safe pwm ppi events stuff but I just dont think it fits this api design.. ppi is just very low level, im not sure how safe it will be in general
* first we should probably have borrows of handlers for ppi with lifetime of the peripheral? hal does eb4ba6ae42/nrf-hal-common/src/pwm.rs (L714-L716)
* in general having access to tasks can put the state in some configuration the api doesnt understand anymore. for `SequencePwm` ideally id hand you back either only seq_start0 or seq_start1 because youd only use one based on if your `Times` is even or odd.. but again we only know that with this api AFTER start has been called. I dont think were ready for typestates
SO I figured why not add the pwm ppi events but make them unsafe and commit this example since I started it.
Somewhat related drop IS removing the last duty cycle from the pin correctly, but stop DOES NOT..the only thing that sets the pin back is pin.conf() as far as I can tell, so I tried to document that better and got rid of stop for the `SimplePwm` again since that doesnt need it then. However its ackward we dont have a way to unset the pwm without setting a new sequence of 0s, or dropping the peripheral
Co-authored-by: Jacob Rosenthal <jacobrosenthal@gmail.com>
2021-11-26 23:08:24 +00:00
huntc
d4179ee2e4
Some documentation corrections and expansion
2021-11-22 12:26:11 +11:00
bors[bot]
d7bbaf1a4c
Merge #494
...
494: nrf: saadc do not reexport pac enums r=Dirbaio a=jacobrosenthal
Closes #415
Co-authored-by: Jacob Rosenthal <jacobrosenthal@gmail.com>
2021-11-21 19:47:31 +00:00
Wilfried Chauveau
d5a2462cba
Update embassy-nrf with lifetime bounds on gpio implementations.
2021-11-21 10:25:43 +00:00
Jacob Rosenthal
18d94a7d01
nrf: saadc do not reexport pac enums
...
Closes #415
2021-11-20 18:07:20 -07:00
Bob McWhirter
c2da498263
Update to defmt 3.0ish.
...
Lots of gitrevs deps.
2021-11-15 11:09:08 -05:00
Jacob Rosenthal
4010a829ae
nrf: pwm clarify stop and disable pin state
2021-11-14 11:26:30 -07:00
Jacob Rosenthal
4d61f4aa0d
nrf: sequencepwm dont wait for tasks_stop afterall
2021-11-13 17:31:09 -07:00
Jacob Rosenthal
3a166db280
nrf: pwm use register reset
2021-11-13 16:42:19 -07:00
Jacob Rosenthal
7dfc0acb2f
nrf: pwm clarify stop and disable pin state
2021-11-13 16:42:17 -07:00
Jacob Rosenthal
2bcacd4f16
nrf: sequencepwm add events
2021-11-13 16:24:41 -07:00
Jacob Rosenthal
0f322c1d4e
fix set_duty ptr write
2021-11-12 08:55:20 -07:00
Jacob Rosenthal
667a93b5c8
sequence pwm remove disable fn for clarity, and disable peripheral on stop
2021-11-11 23:46:27 -07:00
Jacob Rosenthal
7bee43df5a
nrf: sequencepwm nitpicks for clarity
2021-11-11 22:50:07 -07:00
Jacob Rosenthal
937f49dead
nrf: sequencepwm rename top to max_duty for consistancy
2021-11-11 22:47:57 -07:00
Jacob Rosenthal
f15c3a04d4
sequence must be live while DMA runs
2021-11-11 20:10:34 -07:00
Jacob Rosenthal
fe83daf45f
remove const generic
2021-11-11 19:49:41 -07:00
Jacob Rosenthal
ec66fcd01a
pwm_sequence consume buffer
2021-11-11 19:14:29 -07:00
bors[bot]
4112759a8f
Merge #455
...
455: simple_playback api from nrf sdk r=Dirbaio a=jacobrosenthal
Port of the nrf_drv_pwm_simple_playback call from the nordic sdk that allows you to set up a sequence to play across leds with no interaction necessary using the 'shorts' registers to trigger looping sequences
Co-authored-by: Jacob Rosenthal <jacobrosenthal@gmail.com>
2021-11-11 16:26:36 +00:00
Jacob Rosenthal
156caa9330
more comments
2021-11-10 19:56:36 -07:00
Jacob Rosenthal
66a43c2e58
more comments
2021-11-10 19:44:57 -07:00
Jacob Rosenthal
407e5d06e0
more comments
2021-11-10 19:43:47 -07:00
Jacob Rosenthal
613e88f1d2
fix bug with config.counter_mode
2021-11-10 18:53:21 -07:00
Jacob Rosenthal
4c2d0ac211
doccomments
2021-11-10 18:52:32 -07:00
Jacob Rosenthal
c6736abf5e
dont wait seqend for sequencepwm
2021-11-10 18:52:03 -07:00
Jacob Rosenthal
c450f91bd9
doc comment cleanup
2021-11-10 17:30:59 -07:00
Jacob Rosenthal
6dcc731065
drop the debug
2021-11-10 17:25:38 -07:00
Jacob Rosenthal
5f28153b81
disconnect pwm pins on drop
2021-11-10 17:19:03 -07:00
Jacob Rosenthal
3b7af2f4ed
fix wait seqend, pwm example is slow now...
2021-11-10 13:03:44 -07:00
Jacob Rosenthal
903b8f032f
defensive dma
2021-11-10 12:34:41 -07:00
Jacob Rosenthal
4751dbddc6
move state into PwmSimple
2021-11-10 12:32:28 -07:00
Jacob Rosenthal
9548748c26
fix
2021-11-10 12:29:13 -07:00
Jacob Rosenthal
65843c033e
pwm store and deconfigure pins
2021-11-10 11:02:43 -07:00
bors[bot]
5322e293bd
Merge #461
...
461: nrf: add initial nrf5340 support r=Dirbaio a=Dirbaio
Thanks to `@diondokter's` work on DPPI this was quite easy! :)
TODO:
- [ ] Add config option to enable 128mhz
- [ ] Add config option to unlock APPROTECT automatically.
- [ ] Add a way to boot net (config option or API?)
- [ ] Support WDT (there's WDT0, WDT1. Needs some refactor)
- [ ] Support NVMC
- [ ] Support TEMP
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-11-07 22:58:27 +00:00
Jacob Rosenthal
03f2c593d6
fix slice_in_ram for arbitrary size types
2021-11-03 18:56:02 -07:00
Jacob Rosenthal
64e1426b54
clean up some todo comments around infinite play
2021-11-03 18:46:42 -07:00
Jacob Rosenthal
b726ef1886
make SequenceConfig struct is consistent with other Config structs, that are always non_exhaustive and have a Default
2021-11-03 18:37:54 -07:00
Jacob Rosenthal
d961fd1015
rename to SimplePwm and SequencePwm
2021-11-03 18:25:44 -07:00
Jacob Rosenthal
9a6c2de4ea
fix safety comments
2021-11-03 18:19:43 -07:00
Jacob Rosenthal
511c5cb892
intenset in a noop
2021-11-03 18:16:00 -07:00
Jacob Rosenthal
82695c8f65
make both news configure registers in same order
2021-11-03 18:15:42 -07:00
Jacob Rosenthal
44375b427c
restore example and add set_time_stretch api
2021-11-03 15:29:09 -07:00
Jacob Rosenthal
682274870f
set_duty does indeed loop forever
2021-11-02 11:56:01 -07:00
Jacob Rosenthal
c939edb8d0
rename error enum again
2021-11-02 10:57:01 -07:00
Ulf Lilleengen
205a223af3
Update versions of critical-section and atomic-polyfill
2021-11-02 18:52:03 +01:00
Jacob Rosenthal
4647792ad6
seperate start from pwmseq::new
2021-11-01 20:50:18 -07:00
Jacob Rosenthal
49253152cf
seperate sequence from duty cycle pwm struct
2021-11-01 20:50:14 -07:00
Jacob Rosenthal
74e7f4a227
comments
2021-11-01 13:16:24 -07:00
Jacob Rosenthal
f2cfbe4262
align pwm.set_duty with embedded hal to not be one shot
2021-11-01 13:08:55 -07:00
Jacob Rosenthal
5285179218
generalize new and change pwm example to a servo
2021-11-01 13:08:51 -07:00
Jacob Rosenthal
12b2c5d5f7
better not as a constructor?
2021-11-01 08:54:07 -07:00
Jacob Rosenthal
90be851e4b
reduce complexity of loopmode
2021-11-01 08:45:07 -07:00
Jacob Rosenthal
48673e27cd
fix max sequence length
2021-11-01 01:20:04 -07:00
Jacob Rosenthal
14dc524b84
documentation
2021-11-01 01:20:01 -07:00
Jacob Rosenthal
7b092f463e
clarify infinite
2021-11-01 00:30:42 -07:00
Jacob Rosenthal
72fa1c8482
fix additional to remove stuck light at end
2021-11-01 00:25:08 -07:00
Jacob Rosenthal
d98a1707b9
using write dont need to clear
2021-10-31 23:28:26 -07:00
Jacob Rosenthal
78e382c9aa
stop->sequence_stop
2021-10-31 23:13:49 -07:00
Jacob Rosenthal
96df2fdb43
lost comment
2021-10-30 16:23:45 -07:00
Jacob Rosenthal
763e250dfe
add ability to configure loop count from 1 to infinite
2021-10-30 16:16:10 -07:00
Jacob Rosenthal
ee8f76537b
at least stop on drop
2021-10-30 11:33:28 -07:00
Jacob Rosenthal
6d8198a46a
move psel back out of if
2021-10-30 11:33:10 -07:00
Jacob Rosenthal
1d1d8a848e
simplify api, more interesting example
2021-10-29 16:39:41 -07:00
Jacob Rosenthal
eb0bf1fd7a
simple_playback api from nrf sdk
2021-10-29 16:27:26 -07:00
Dario Nieuwenhuis
663141b4e4
nrf: add initial nrf5340 support
2021-10-28 03:36:25 +02:00
Dario Nieuwenhuis
c995a97f20
nrf91: support running in both S and NS mode.
2021-10-26 17:40:07 +02:00
Dario Nieuwenhuis
36d3eda2f9
ppi: simplify driver creation.
...
Moving `new_*` to the version-specific mod allows doing the correct
register writes right there in `new`, without needing abstractions
like `enable_all`/`disable_all`.
2021-10-26 16:52:51 +02:00
Dion Dokter
c63d747209
Fewer channel traits, more cfg to make the system work
2021-10-26 14:47:34 +02:00
Dion Dokter
6205d6da47
typo
2021-10-26 14:47:33 +02:00
Dion Dokter
a6c84cb915
- Interconnect is now PPI again
...
- Scary pointer math is now contained in the tasks and events
- ppi now sets the tasks and events immediately and the struct is now zero-sized
- StaticToOne is renamed to ZeroToOne
- Used DPPI tasks and events now panic when enabled twice
2021-10-26 14:47:31 +02:00
Dion Dokter
531dfcffb3
fmt
2021-10-26 14:47:13 +02:00
Dion Dokter
11655af034
Another redo using the feedback.
...
PPI is now split up into PPI and DPPI under the name 'interconnect'.
The tasks and events are tracked and reset in the drop function.
2021-10-26 14:47:12 +02:00
Dion Dokter
e6ec81b999
Fixed examples and added defmt format to the new error types
2021-10-26 14:46:39 +02:00
Dion Dokter
4950682a50
Some extra docs and better naming
2021-10-26 14:46:39 +02:00
Dion Dokter
65628e1f15
- Added _ppi and _dppi to distinguish between the new and the old peripheral.
...
- Removed ConfigurableChannel and added capacity numbers to the channels
- Replaced the PPI api with a new one using the DPPI terminology (publish & subscribe)
- Updated all tasks and event registers for DPPI
2021-10-26 14:46:39 +02:00
bors[bot]
7729091b39
Merge #450
...
450: nrf/nvmc: make PAGE_SIZE, FLASH_SIZE public. r=lulf a=Dirbaio
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-10-25 08:05:19 +00:00
Jacob Rosenthal
32850bba79
nrf: saadc dummy pin for vdd sampling
2021-10-24 09:41:51 -07:00
Dario Nieuwenhuis
e7ab979eb8
nrf/nvmc: make PAGE_SIZE, FLASH_SIZE public.
2021-10-24 18:23:22 +02:00
Dario Nieuwenhuis
e78d226acd
nrf: add NVMC driver.
2021-10-22 02:14:33 +02:00
Ulf Lilleengen
69953a78f1
Use async fn instead of impl Future
2021-10-19 20:48:46 +02:00
Ulf Lilleengen
c777b6aae1
Use AtomicWaker instead of Signal
2021-10-19 15:31:28 +02:00
Ulf Lilleengen
db3b315f94
Cargo fmt
2021-10-19 08:37:19 +02:00
Ulf Lilleengen
2ef4a45fa0
Add support for temperature sensor peripheral
...
* Add TEMP peripheral to all nRF52 chips
* Add async HAL for reading temperature values
* Add example application reading temperature values
2021-10-19 07:18:56 +02:00
huntc
3f31774674
Formatting
2021-10-18 12:29:31 +11:00
huntc
8dcc41c7f0
Optimises the buffer passing for nRF SAADC
...
The buffer will always have been filled and we never explicitly stop the task outside of this code. Thus, we can assume the number of bytes in the slice.
2021-10-18 12:23:13 +11:00
huntc
a94d44a689
Comments corrected
2021-10-18 11:45:23 +11:00
huntc
6dc0ed53ff
Renamed sample rate to what it actually is
2021-10-18 11:42:30 +11:00
huntc
93407ed5e2
Remove unneeded stop
2021-10-18 11:31:06 +11:00
huntc
c7e426655d
Ensure the compiler doesn't reorder things before calling the sampler
2021-10-18 11:28:43 +11:00
huntc
785030df96
Use types to strengthen the buffer dimensioning
2021-10-18 10:26:11 +11:00
huntc
0c317a64f6
As suggested, use the const param to declare the internal sample for one channel only
2021-10-18 10:26:11 +11:00
huntc
cb56f52b99
Removed the Mode enum and factored out into two functions so that we can assert channel limits
2021-10-18 10:26:11 +11:00
huntc
a020b1a404
Combine intenset calls
2021-10-18 10:26:11 +11:00
huntc
b6cacb98db
Compact expression
2021-10-18 10:26:11 +11:00
huntc
e37a10ae99
Hangover - should have set this to internal for a previous PR
2021-10-18 10:26:11 +11:00
huntc
3be274dc2a
We must allow the run handler to mutate state
...
The handler may well need to close over and mutate state
2021-10-18 10:26:11 +11:00