Commit Graph

110 Commits

Author SHA1 Message Date
Jacob Rosenthal
2973ff4cf0 remove unstable feature and dependency, and make pwm_sequence a near mirror of pwm example 2021-11-10 18:49:24 -07:00
Jacob Rosenthal
751617c2be fix examples for mut self set_duty 2021-11-10 12:48:15 -07:00
Dario Nieuwenhuis
2221e1fa93 Replace rustflags with build.rs extra-link-args.
Rustflags apply to ALL the crates in the graph, while we only need
them for the toplevel crate which is the only one getting linked.

Rustflags are not equal for all crates, this caused cargo to re-build the
same dependency crate multiple times uselessly. After this change, deps
are reused more, making builds faster.

Note that this only applies when sharing the target/ dir for multiple crates
in the repo which is not the default.
2021-11-07 23:52:11 +01: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
44375b427c restore example and add set_time_stretch api 2021-11-03 15:29:09 -07:00
Jacob Rosenthal
c939edb8d0 rename error enum again 2021-11-02 10:57:01 -07: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
b297e5f7bd led dimming example, dont need to keep all examples, just covering ground to test api 2021-11-01 13:51:40 -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
14dc524b84 documentation 2021-11-01 01:20:01 -07:00
Jacob Rosenthal
78e382c9aa stop->sequence_stop 2021-10-31 23:13:49 -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
ef95441442 a runtime generated sin table example 2021-10-29 17:10:37 -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
Dion Dokter
4d3341dbb9 Fixed examples 2021-10-26 14:47:33 +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
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
Dario Nieuwenhuis
e78d226acd nrf: add NVMC driver. 2021-10-22 02:14:33 +02:00
Ulf Lilleengen
e807a9eaec Specify unit in log output 2021-10-19 15:32:16 +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
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
huntc
cef6158c31 Extend SAADC one shot support
One-shot mode now permits the sampling of differential pins, and the sampling of multiple pins simultaneously.

A new ChannelConfig structure has been introduced so that multiple channels can be configured individually. Further, the `sample` method now accepts a buffer into which samples are written.

Along the way, I've reset some default configuration to align with Nordic's settings in their nrfx saadc driver. Specifically, the channel gain defaults to 6 (from 4) and the time defaults to 10us (from 20us).
2021-10-09 11:25:18 +11:00
Dario Nieuwenhuis
0e05ba688d nrf/saadc: remove Sample trait. 2021-10-07 02:10:22 +02:00
Dario Nieuwenhuis
70e5877d68 embassy/channel: switch to use MutexKind 2021-09-13 00:08:41 +02:00
Dario Nieuwenhuis
ead987245d embassy: Refactor module structure to remove kitchen-sink util. 2021-09-11 02:35:35 +02:00
Dario Nieuwenhuis
f2623e7e9b Update lots of deps 2021-09-11 01:35:23 +02:00
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
6b158ba94a nrf/saadc: add example 2021-09-01 23:55:20 +02:00
Dario Nieuwenhuis
297de612e5 Improve executor naming. Add docs. 2021-08-31 23:59:28 +02: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
fe355af4f0 nrf: update to cortex-m-rt 0.7 2021-08-19 17:11:17 +02:00
Dario Nieuwenhuis
2540a960e5 nrf: add WDT driver 2021-08-07 14:26:28 +02:00
Ben Gamari
f4950c4449 examples: Consistently use unwrap! in favor of .unwrap()
Unfortunately errors from `embedded_graphics` and `core` doesn't provide
the necessary instances currently.
2021-08-05 22:39:59 +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
a1a5acb825 rustfmt everything 2021-08-04 15:25:21 +02:00
Dario Nieuwenhuis
af87031d62 hal-common: remove Pin in PeripheralMutex 2021-08-02 19:55:04 +02:00
Ben Gamari
3420cbf744 examples: Drop build-std = ["core"]
Previously the cargo configurations of all of the example projects had
`build-std = ["core"]`, which forces compilation of `core` as a
code-size optimisation. However, this is strictly unnecessary and will
currently break for users who do not use `rustup` directly (e.g. nix
users).
2021-07-31 13:01:15 -04:00
huntc
3778f55d80 Provides a cleaner construction of the channel with the common "new" naming 2021-07-15 12:31:53 +10:00
huntc
f159beec1c Use of a NoopMutex 2021-07-15 12:31:52 +10:00
huntc
5f87c7808c Remove the cell and trait
At the expense of exposing the channel types again. We do this as we want to avoid using dyn traits given their overhead for embedded environments.
2021-07-15 12:31:52 +10:00
huntc
ae62948d6c Replace UnsafeCell
Using a new ChannelCell so that there's no leaking of the abstraction
2021-07-15 12:31:52 +10:00
huntc
816b78c0d9 Reduces the types on sender and receiver
In exchange for an UnsafeCell being passed into split
2021-07-15 12:31:52 +10:00
huntc
1b9d5e5071 Multi Producer Single Consumer channel
An MPSC inspired by Tokio and Crossbeam. The MPSC is designed to support both single and multi core processors, with only single core implemented at this time. The allocation of the channel’s buffer is inspired by the const generic parameters that Heapless provides.
2021-07-15 12:31:52 +10:00
Liam Murphy
a64dec517c Update RNG example 2021-06-30 12:55:30 +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
Dario Nieuwenhuis
dff03ecfc7 Move examples to a subdirectory 2021-06-02 01:32:19 +02:00