Commit Graph

10 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
82803bffda Use embassy/defmt-timestamp-uptime in all examples. 2022-04-02 04:35:06 +02:00
huntc
3990f09b29 Simplifies the API by taking in the TIMER and PPI channels 2022-03-07 14:51:17 +11:00
huntc
98bdac51fe Improve nRF Saadc sampling
Starting the sampling task prior to starting the SAADC peripheral can lead to unexpected buffer behaviour with multiple channels. We now provide an init callback at the point where the SAADC has started for the first time. This callback can be used to kick off sampling via PPI.

We also need to trigger the SAADC to start sampling the next buffer when the previous one is ended so that we do not drop samples - the major benefit of double buffering.

As a bonus we provide a calibrate method as it is recommended to use before starting up the sampling.

The example has been updated to illustrate these new features.
2022-03-07 14:51:17 +11:00
Matous Hybl
0ca6060bfd Fix interrupt_take macro by specifying path to panic macro. 2021-11-23 11:00:37 +01:00
Dion Dokter
4d3341dbb9 Fixed examples 2021-10-26 14:47:33 +02:00
huntc
785030df96 Use types to strengthen the buffer dimensioning 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
fa82913bc3 We have to reduce the buffer size to cater for the number of channels to scan 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
huntc
103a3305e2 Implements continuous sampling for the nRF SAADC
Implements continuous sampling for the nRF SAADC and also renames `OneShot` to `Saadc`. The one-shot behaviour is retained with the `sample` method and a new `run_sampler` method is provided for efficiently (i.e. zero copying) sampler processing. A double buffer is used for continuously sampling, which wlll be swapped once sampling has taken place.

A sample frequency is provided and will set the internal timer of the SAADC when there is just the one channel being sampled. Otherwise, PPI will be used to hook up the TIMER peripheral to drive the sampling task.
2021-10-18 10:26:11 +11:00