Commit graph

363 commits

Author SHA1 Message Date
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
huntc
34e9e85819 We can kick start the internal timer outside of the main loop 2021-10-18 10:26:11 +11:00
huntc
16b6c78332 Removed debugging logs 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
Dario Nieuwenhuis
a2e7c24e00 Clippy fixes 2021-10-18 01:05:29 +02:00
Dario Nieuwenhuis
66d70cd146 nrf/uarte: do not use WFE on drop.
- It disturbs other stuff that uses WFE/SEV in the system. I ran into
  issues with this.
- It needs the irq handler to check for RXTO/TXSTOPPED errors, which makes
  it slower.
2021-10-16 03:14:47 +02:00
bors[bot]
05bc4d198e
Merge #423
423: nRF9160 support r=Dirbaio a=diondokter

- Created a chip file with all the peripherals, interrupts and peripheral implementations.
- All peripherals now use an alias for the NS (non-secure) version of the nRF9160 version.
- Implementations of peripherals that don't exist are ignored.
- Most PPI functionality has been stubbed out because the nRF91 has the newer DPPI which is not compatible with the current API. (The channels are also set to not configurable, so they are kinda useless now, but in principle the stubs should never be called)


Co-authored-by: Dion Dokter <dion@tweedegolf.com>
2021-10-13 21:11:41 +00:00
Dario Nieuwenhuis
c675fb1036 nrf/saadc: make InputChannel private. 2021-10-13 22:13:30 +02:00
Dario Nieuwenhuis
d8c3365d6a nrf/saadc: make Input trait sealed. 2021-10-13 22:13:26 +02:00
Dario Nieuwenhuis
0d709fa5c8 nrf/saadc: require unborrow for Input.
This allows using borrowed pins in ChannelConfig.
2021-10-13 22:06:09 +02:00
Dion Dokter
c1c704bfc8 - Removed the enable assert from UARTE.
- Added nRF9160 to CI.
2021-10-13 15:00:08 +02:00
Dion Dokter
ddcee446c1 Added anomaly workaround from the HAL to improve the UARTE 2021-10-12 13:35:08 +02:00
Dion Dokter
2c2c284482 Undoing unnecessary changes 2021-10-12 11:55:38 +02:00
Dion Dokter
995cd01cbc ran fmt 2021-10-11 15:31:25 +02:00
Dion Dokter
4643727fea Made all PPI channels not configurable (even though they are) so they can't use unimplemented features 2021-10-11 15:12:40 +02:00
Dion Dokter
a8407c8aba Merge remote-tracking branch 'upstream/master' 2021-10-11 10:59:34 +02:00
Dion Dokter
20674f7126 Initial support for nrf9160 2021-10-11 10:39:38 +02:00
Dario Nieuwenhuis
14c3260d88 nrf/saadc: move chip-specific mappings to chips/ 2021-10-11 01:36:31 +02:00
Dario Nieuwenhuis
cf13dd7df8 nrf/ppi: nrf52805 only has 10 configurable channels. 2021-10-11 01:20:51 +02:00
Dario Nieuwenhuis
6e7abba9ff nrf: rename Cargo feature references from "51" to "nrf51".
Note: the feature doesn't actually exist, references are there just in case
nrf51xx is supported in the future.
2021-10-11 01:09:57 +02:00
Dario Nieuwenhuis
668364da9c nrf/saadc: nrf52805 only has 2 channels 2021-10-11 00:55:31 +02:00
Dario Nieuwenhuis
0b26ab7bbc nrf/saadc: nrf52820 doesn't have it. 2021-10-11 00:55:17 +02:00
huntc
8c9e50b378 Conflates the negative and positive types as they are the same, and renames pin to input as they can be more than pins 2021-10-11 09:38:35 +11:00
huntc
b043778f75 Removed the NotConnected as it isn't used. 2021-10-11 09:08:58 +11:00
huntc
25d6a2cd13 No use case understood for NotConnected, so hiding it for now 2021-10-11 08:56:53 +11:00
huntc
617a976e96 No need for unwrap 2021-10-11 08:54:24 +11:00
huntc
5f5470a320 Need to borrow the pins for the lifetime of the config, and subsequently the one shot. 2021-10-11 08:52:45 +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
Ulf Lilleengen
99a94f1d50 Update version of critical-section 2021-09-13 17:05:17 +02:00
Ulf Lilleengen
e24528051b Add WASM support for executor
* Adds an executor for WASM runtimes based on wasm_bindgen.
* Add time driver based on JS time handling.
* Add example that can run in browser locally.
* Update to critical-section version that supports 'std' flag
2021-09-13 16:42:39 +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
a81b963561 nrf/saadc: don't use wake_on_interrupt. 2021-09-01 23:54:26 +02:00
f_punk
1cef7134d4 moved CC::wait to awaitable typestate 2021-09-01 16:20:32 +02:00
f_punk
a0c40562ea added typestate to nrf-Timer
useful for hooking up the PPI to an Event without needing interrupt
tested with buffered_uart example on nRF52840-DK
2021-09-01 16:16:56 +02:00
Dario Nieuwenhuis
7c0990ad1e time: allow storing state inside the driver struct. 2021-08-25 21:06:27 +02:00
Richard Dodd
ed1ed5225f Expose EASY_DMA_SIZE. 2021-08-22 00:23:03 +01: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
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