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
Dario Nieuwenhuis
f5e251fc81
Update clap
2021-10-18 01:19:01 +02:00
Ulf Lilleengen
5ae276fe50
Update to newer revision of async lorawan stack
2021-10-11 13:51:00 +02:00
Dario Nieuwenhuis
902f566b9a
Merge pull request #417 from huntc/extend-saadc
...
Extend SAADC one shot support
2021-10-11 00:45:49 +02:00
Dario Nieuwenhuis
1c4c813255
Merge pull request #410 from lulf/embassy-lora
...
Add embassy-lora crate
2021-10-10 21:23:02 +02: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
16a47a0ad9
Add embassy-lora crate
...
This crate contains async radio drivers for various lora drivers that
work with embassy timers. The code is imported from Drogue Device (
https://github.com/drogue-iot/drogue-device )
The radio drivers integrate with the async LoRaWAN MAC layer in the
lorawan-device crate.
Also added is an example for the STM32WL55 and for STM32L0 (requires
the LoRa Discovery board) for LoRaWAN. Future work is to make the
underlying radio drivers using fully async SPI when communicating
with the peripheral.
2021-09-30 10:32:24 +02:00
Mariusz Ryndzionek
bce909ec1e
Initial STM32F1 family support with two examples for STM32F103C8 (Blue Pill)
2021-09-28 18:31:04 +02:00
Ulf Lilleengen
c79485c286
Support for STM32L1
...
* Add RCC
* Fix more issues with dash in chip names
* Update stm32-data version
* Add blinky and spi example
2021-09-21 14:50:23 +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
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
eff8ae9c4d
Merge pull request #381 from lulf/stm32wl55-subghz
...
Add HAL for SubGhz peripheral for STM32 WL series
2021-09-06 00:58:42 +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
Ulf Lilleengen
5f04d6e6c5
Fix embassy::main macros for std target
2021-09-02 14:45:54 +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
Ulf Lilleengen
7ad6280e65
Add HAL for SubGhz peripheral for STM32 WL series
...
Based on the HAL from stm32wl, the peripheral driver has been
modified to fit into embassy, using the embassy APIs, providing
operation of the radio peripheral.
The initial version does not offer any async APIs, but the example
shows how the radio IRQ can be used to perform async TX of the radio.
2021-09-02 10:39:56 +02:00
Dario Nieuwenhuis
db3cb02032
Merge pull request #383 from embassy-rs/saadc-fixes
...
nrf: Saadc fixes
2021-09-01 23:59:56 +02:00
Dario Nieuwenhuis
6b158ba94a
nrf/saadc: add example
2021-09-01 23:55:20 +02:00
Dario Nieuwenhuis
bc68657c23
Merge pull request #379 from bobmcwhirter/random_range
...
Random range
2021-09-01 22:53:10 +02:00
Bob McWhirter
aaa4a477d5
Formatting.
2021-09-01 09:47:46 -04:00
Bob McWhirter
37ceae908b
Rename Random impl to Rng.
...
Create Random struct providing next_x(range) for all T:Rng.
2021-09-01 09:39:33 -04:00
Dario Nieuwenhuis
297de612e5
Improve executor naming. Add docs.
2021-08-31 23:59:28 +02:00
Bob McWhirter
fd7a76c59e
Formatting. Always formatting.
2021-08-30 09:57:31 -04:00
Bob McWhirter
7fa3b27cac
Move random utils to another trait.
2021-08-30 09:55:29 -04:00
Bob McWhirter
78f7d1b786
Add example using ranged RNG.
2021-08-27 16:10:50 -04:00
Dario Nieuwenhuis
c4b9c8ac87
std: fold into embassy core, add non-hacky time driver.
2021-08-25 21:06:27 +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
0be6e4a384
Merge pull request #333 from bgamari/stm32g0
...
Add support for STM32G0
2021-08-20 01:35:02 +02:00
Ben Gamari
ee841499ee
Add STM32G0 examples
2021-08-20 01:28:50 +02:00
Dario Nieuwenhuis
8e5f1f4b5e
Merge pull request #367 from embassy-rs/metapac-cleanup
...
stm32-metapac cleanups
2021-08-20 00:05:08 +02:00
Dario Nieuwenhuis
2c992f7010
stm32: move dbgmcu stuff to toplevel config setting, defaulting to true.
2021-08-19 23:50:19 +02:00
Dario Nieuwenhuis
9f51f9a170
stm32/wl: add stub APB3 to get it to build.
...
Completely untested.
2021-08-19 22:51:41 +02:00
Dario Nieuwenhuis
ec51880e28
stm32/exti: unify all versions into single impl
2021-08-19 22:17:17 +02:00
Dario Nieuwenhuis
daab542fc4
wl55: update to cortex-m-rt 0.7
2021-08-19 17:11:38 +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
Timo Kröger
dacf75d911
bxcan: Fix the flaky CAN example
2021-08-18 21:58:50 +02:00
Timo Kröger
191a589820
bxcan: namechange "bxcan_v1" -> "can_bxcan"
2021-08-18 21:58:50 +02:00
Timo Kröger
7c405250a7
CAN support with bxcan crate
2021-08-18 21:58:50 +02:00
Bob McWhirter
5fab514f02
Remove metapac from the Cargo.toml for h7.
2021-08-18 11:44:09 -04:00
Ulf Lilleengen
919cdfe8c4
Add STM32WL55 examples to CI ( #361 )
...
* Add STM32WL55 examples to CI and fix warnings
2021-08-18 09:35:08 +02:00
Ulf Lilleengen
4df63f5379
Add per-core EXTI support
...
* Generate a core index put into the PAC for the peripherals to use as
index into registers.
* Add EXTI v2 which uses CORE_INDEX to index exti registers
2021-08-17 16:22:47 +02:00
Ulf Lilleengen
61409e2fb6
Add example for STM32WL55
2021-08-17 16:22:47 +02:00
Bob McWhirter
a93ed2bed6
Add H7 exti button example using correct EXTI reg block offsets.
2021-08-16 15:15:07 -04:00
Ulf Lilleengen
cbff0398bb
Add IRQ-driven buffered USART implementation for STM32 v2 usart ( #356 )
...
* Add IRQ-driven buffered USART implementation for STM32 v2 usart
* Implementation based on nRF UARTE, but simplified to not use DMA to
avoid complex interaction between DMA and USART.
* Implementation of AsyncBufRead and AsyncWrite traits
* Some unit tests to ring buffer
* Update polyfill version
* Update sub module to get usart IRQ fix
2021-08-16 17:16:49 +02:00
Dario Nieuwenhuis
2540a960e5
nrf: add WDT driver
2021-08-07 14:26:28 +02:00
Ben Gamari
e44acd0d56
stm32f4: Use unwrap! where possible
2021-08-05 22:39:59 +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
b1d631d639
stm32/time: add Cargo features to choose tim2/tim3
2021-08-05 19:14:09 +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
cfa1f61154
Merge pull request #344 from bobmcwhirter/remove_builders
...
Remove builders from Config(s) and examples.
2021-08-04 21:32:39 +02:00
Bob McWhirter
9726f77ce1
Grep fails me.
2021-08-04 15:28:08 -04:00
Bob McWhirter
97e4b89f82
Fmt giving me headaches.
2021-08-04 14:32:22 -04:00
Bob McWhirter
08e7e5a3fa
Um.
2021-08-04 14:22:47 -04:00
Bob McWhirter
dc126b9ab6
Unused import.
2021-08-04 14:14:36 -04:00
Bob McWhirter
6fd8f6b79a
Remove more extra vars.
2021-08-04 13:55:34 -04:00
Dario Nieuwenhuis
07d4b196f7
Update nightly, remove removed features.
2021-08-04 19:48:14 +02:00
Bob McWhirter
f91bfef799
Formatting again.
2021-08-04 13:42:06 -04:00
Bob McWhirter
f4971fbb79
Further work sharing config for example and removing duplicated code.
2021-08-04 13:39:02 -04:00
Bob McWhirter
4fe9114695
Remove unused import.
2021-08-04 11:40:47 -04:00
Bob McWhirter
0787c8f8f5
Formatting.
2021-08-04 11:35:18 -04:00
Bob McWhirter
03f15d3a60
Remove builders from Config(s) and examples.
2021-08-04 11:32:39 -04:00
Dario Nieuwenhuis
a1a5acb825
rustfmt everything
2021-08-04 15:25:21 +02:00
Dario Nieuwenhuis
5d31dd328f
Merge pull request #341 from lulf/usart-dma-read
...
Add uart::Read DMA-based implementation
2021-08-04 11:02:15 +02:00
Ulf Lilleengen
0d02342b2d
Rename bread -> read_blocking
2021-08-04 08:34:30 +02:00
Bob McWhirter
3e6aceaaa7
Run cargo-fmt on the h7 examples.
2021-08-03 14:31:41 -04:00
Bob McWhirter
88c11a653c
Formatting fixes.
2021-08-03 14:12:11 -04:00
Bob McWhirter
d7409d63e8
Enhance Rcc configuration to be more fluentish.
...
Clean up H7 examples to remove all vegan HALs and PACs.
2021-08-03 13:57:18 -04:00
Ulf Lilleengen
6ff0614cb6
Add uart::Read DMA-based implementation
...
* Rename existing read() to bread() (blocking)
2021-08-03 15:31:24 +02:00
Dario Nieuwenhuis
63ac7ac799
Mark new
s as unsafe due to not being leak-safe.
2021-08-02 19:55:04 +02:00
Dario Nieuwenhuis
af87031d62
hal-common: remove Pin in PeripheralMutex
2021-08-02 19:55:04 +02:00
Bob McWhirter
63b32b39e1
Use an em bikeshed instead of an underscore bikeshed.
2021-08-02 13:29:06 -04:00
Bob McWhirter
5f9447abb4
Put the implicit memory.x behind a memory_x
feature on embassy-stm32.
2021-08-02 13:21:30 -04:00
Bob McWhirter
f6c5f039c8
Emit a default memory.x alongside device.x from metapac.
2021-08-02 11:23:55 -04: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
Dario Nieuwenhuis
3835278567
Merge pull request #321 from thalesfragoso/f4-pll
...
F4 PLL
2021-07-31 11:08:46 +02:00
Thales Fragoso
5cfb9adad8
f4-pll: Add max values per chip
2021-07-29 18:43:15 -03:00
Thales Fragoso
e7714983b3
f4-rcc: Add option to enable debug_wfe and add hello example
2021-07-29 18:43:15 -03:00
Timo Kröger
895781d0d1
stm32l4: Fix examples crate name
2021-07-29 18:14:01 +02:00
Timo Kröger
cad43587e6
stm32l0: Use embassy::main
for examples
2021-07-29 17:37:32 +02:00
Timo Kröger
4ccac69929
stm32l4: Cleanup examples
...
* Use `cortex_m_rt::entry` for sync examples
* Use `Dbgmcu::enable_all()` everywhere
2021-07-29 15:54:11 +02:00
Timo Kröger
2a4890165d
stm32f0: Enable debug access in low power modes
2021-07-29 15:35:23 +02:00
Dario Nieuwenhuis
7bfb763e09
Rename embassy-extras to embassy-hal-common
2021-07-29 13:44:51 +02:00
Timo Kröger
dd1ec8ebec
Use embassy::main
macro for stm32f4 examples
2021-07-27 15:03:18 +02:00
Dario Nieuwenhuis
5b0ae5c25b
stm32/examples: cleanup L4
2021-07-24 13:57:11 +02:00
Timo Kröger
06fb2a7a80
Enable SYSCFG clock in exti::init()
2021-07-24 11:13:49 +02:00
Bob McWhirter
67283c0cbd
Reset back the memory.x also.
2021-07-23 13:22:39 -04:00
Bob McWhirter
a63847944f
Reset the examples to the original F4 flavor.
2021-07-23 13:22:39 -04:00
Bob McWhirter
b07325b476
Enable DMA for SPIv1 on F4's etc.
2021-07-23 13:22:39 -04:00
Bob McWhirter
a1dac21bdf
Make SPIv3 work with DMA.
...
Add both DMA and non-DMA example to H7.
2021-07-23 13:22:39 -04:00
Bob McWhirter
34dfe28d3a
FFS warnings about unused Result<>.
2021-07-23 13:22:39 -04:00
Bob McWhirter
053e330375
Fix warnings about un-used variables.
2021-07-23 13:22:39 -04:00
Bob McWhirter
e269971597
Fix extraneous mut
warnings in L4 example.
2021-07-23 13:22:39 -04:00
Bob McWhirter
638235e72d
Fix up the L0 example for SPI.
2021-07-23 13:22:39 -04:00
Bob McWhirter
bee7f60f08
Improve the SPIv2 DMA example to verify it actually works.
2021-07-23 13:22:39 -04:00
Bob McWhirter
0d2051243e
SPIv2 + DMA.
2021-07-23 13:22:39 -04:00
Timo Kröger
57eecd4292
Use Dbgmcu::enable_all()
in stm32f4 examples
2021-07-23 17:54:14 +02:00
Timo Kröger
5ac91933ff
stm32: No need to enable GPIO clocks manually
2021-07-23 17:54:13 +02:00
Bob McWhirter
13873df30b
Auto-enable all GPIOs during init().
2021-07-23 11:32:19 -04:00
Bob McWhirter
d68f2617e6
Add a Dbgmcu
struct capable of enabling all relevant DBGMCU.cr fields.
...
Includes the addition of a `dbgmcu!(...)` macro table which currently takes
the form of
(cr, $fn_name:ident)
where `$fn_name` is something like `set_dbgsleep_d1` etc.
The method is unsafe, since it's performing unsafe PAC operations.
Two examples modified to demonstrate its usage.
2021-07-22 14:18:48 -04:00
Dario Nieuwenhuis
3655ceff27
Merge pull request #308 from timokroeger/stmf4-example-cleanup
...
Cleanup stm32f4 examples
2021-07-21 23:21:28 +02:00
Timo Kröger
5e998d1a6c
Cleanup stm32f4 examples
...
* Remove dependency on stm32f4 pac crate
* Remove unused `ZeroClock`
2021-07-21 23:12:36 +02:00
Dario Nieuwenhuis
25b870d811
Merge pull request #302 from embassy-rs/rp-spi-fixes
...
Rp spi fixes
2021-07-20 10:11:58 +02:00
Dario Nieuwenhuis
451e342961
rp/examples: add spi_display example
2021-07-20 10:06:57 +02:00
Dario Nieuwenhuis
b04dc7e783
Merge pull request #226 from huntc/mpsc
...
Multi Producer Single Consumer channel
2021-07-20 08:01:42 +02:00
Dario Nieuwenhuis
1799938187
rp/examples: add spi example
2021-07-19 23:54:18 +02:00
Dario Nieuwenhuis
d7176da37c
stm32/examples: update DMA channel names
2021-07-17 08:04:33 +02:00
Bob McWhirter
0119ea809d
Get DMA on H7 working, add usart_dma example for H7.
2021-07-16 14:41:20 -04:00
Dario Nieuwenhuis
63a0e188ea
stm32/dma: fix h7 impls
2021-07-16 14:41:20 -04:00
Dario Nieuwenhuis
3d1391ef2d
stm32/dma: impl all variants
2021-07-16 14:41:20 -04:00
Thales Fragoso
697f93ad42
stm32: Add F0 example
2021-07-15 13:50:39 -03: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
Dario Nieuwenhuis
71c8d7aa7d
stm32l4/examples: remove old-pac uses.
2021-07-15 00:37:00 +02:00
Bob McWhirter
21e94972dc
Fix more warnings and examples.
2021-07-14 14:55:20 -04:00
Bob McWhirter
3fd9023fce
Fix the h7 example.
2021-07-14 14:45:54 -04:00
Bob McWhirter
a88f0028ef
First shot at async dma usart for stm32.
2021-07-14 14:14:14 -04:00
Bob McWhirter
f01ddd5f5c
Mix dmamux into bdma_v1.
2021-07-13 10:09:35 -04:00
Bob McWhirter
043f0ea508
Checkpoint DMAMUX channel setup.
2021-07-13 10:08:43 -04:00
Dario Nieuwenhuis
7547c8d8d6
rp/timer: add
2021-07-12 03:45:57 +02:00
Dario Nieuwenhuis
ecc151d4e2
stm32/adc: simplify delay handling
2021-07-05 03:18:23 +02:00
Dario Nieuwenhuis
3ce32d6624
Merge pull request #273 from rukai/fix_warnings_again
...
fix stm32 warnings
2021-07-05 02:00:51 +02:00
Rukai
25d4b2ea26
fix stm32 warnings
2021-07-05 01:54:29 +02:00
Rukai
56d0c5ffe1
Fix warnings in std and rp
2021-07-04 12:46:04 +10:00
Bob McWhirter
0920c0cb1d
Make UART pins Rx/Tx/etc in addition to USART.
2021-07-01 11:30:54 -04:00
Bob McWhirter
54ada5bae1
Stub in the DMA bits that aren't yet there.
2021-07-01 11:30:54 -04:00
Bob McWhirter
f83559c6ab
Add L4+ example for USART.
2021-07-01 11:30:54 -04:00
Dario Nieuwenhuis
e55c89f890
Merge pull request #262 from Liamolucko/nrf-rng
...
Add an nRF RNG driver
2021-07-01 01:55:55 +02:00
Liam Murphy
a64dec517c
Update RNG example
2021-06-30 12:55:30 +10:00
Bob McWhirter
d5fb558005
Fix non-DMA USART example.
2021-06-29 13:08:18 -04:00
Bob McWhirter
24f18819c8
Adjust example for RCC and DMA.
2021-06-29 11:01:57 -04: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
cdb0c72849
Merge pull request #255 from thalesfragoso/od-pin
...
stm32: Allow for open drain configuration for output pin
2021-06-27 19:29:18 +02:00
Thales Fragoso
0eaadfc125
stm32: Update gpio examples
2021-06-25 18:16:43 -03:00
Dario Nieuwenhuis
c7c897bb72
rp/gpio: add infallible inherent methods
2021-06-25 06:24:14 +02:00
Dario Nieuwenhuis
5a6384d199
rp: clock setup
2021-06-25 03:38:21 +02:00