Commit Graph

363 Commits

Author SHA1 Message Date
Ulf Lilleengen
f79624c3e6 Upgrade to embedded-storage 0.3.0 2022-02-07 12:35:58 +01:00
bors[bot]
a1d6077446
Merge #591
591: PWM WS2812B example and flexible sequence config r=Dirbaio a=huntc

I've permitted the PWM sequences to be mutated on stopping the PWM by associating them with a new  `SingleSequencer` structure. This is so that we can perform effects on the LEDs (and other use-cases, I'm sure!). The example has been updated to illustrate the use of this by flashing a WS2812B LED.

There's also a `Sequencer` structure for more sophisticated PWM interactions, along with a `pwm_double_sequence`  example to illustrate.

These changes should make it possible to attain all of the nRF PWM functionality available.

Co-authored-by: huntc <huntchr@gmail.com>
2022-02-05 02:20:13 +00:00
huntc
df5ba727f2 Further API simplification for the single seq scenario 2022-02-05 08:05:23 +11:00
huntc
81d31e43eb Removed unrequired clone 2022-02-04 19:18:10 +11:00
huntc
965a5f2c3f Introduced the SingleSequencer and a more complex Sequencer 2022-02-04 19:11:15 +11:00
huntc
9e36ede363 Small correction to times 2022-02-04 16:48:26 +11:00
huntc
e9e4d058d1 Revert the use of forever 2022-02-04 16:39:14 +11:00
huntc
81f98c32aa Update another example 2022-02-04 16:34:25 +11:00
huntc
fe5501293f Expose PWM 2022-02-04 16:26:23 +11:00
huntc
1af6b23f97 Introduces a Sequences struct 2022-02-04 13:04:55 +11:00
huntc
986295998a Some more doco 2022-01-30 16:26:09 +11:00
huntc
1c67bd4643 Revert "Own the sequence buffer"
This reverts commit 482389a691.
2022-01-30 16:21:23 +11:00
huntc
482389a691 Own the sequence buffer
This approach owns the sequence buffers which, while introducing an extra move, it eliminates the need to guard the lifetime of the sequence buffer. Given ownership, the buffer will be retained until the PWM sequence task is stopped.
2022-01-29 18:01:06 +11:00
huntc
9ac52a768b Now permits sequences to be mutated subsequently 2022-01-28 16:32:58 +11:00
huntc
12ce024574 Make the sequence a little nicer to pass around 2022-01-28 13:38:20 +11:00
huntc
47aeab152f PWM WS2812B example and per sequence config
Demonstrates how to set the colour of a WS2812B to blue using PWM, and the use of multiple sequences along with their own config. This required an API change.
2022-01-28 11:20:04 +11:00
Dario Nieuwenhuis
0719b05d63 traits: migrate Delay to embedded-hal 1.0+async, remove Rng and Flash. 2022-01-27 00:08:02 +01:00
Ulf Lilleengen
4032fc0655 Support unstable-trait feature for stm32 2022-01-26 22:39:06 +01:00
huntc
c9f29534d6 Stop PWM before assigning the new sequence
I had introduced a small bug in my last PR where I assigned the sequence before stopping the PWM. I now stop the PWM before doing that now.

Also, corrected a math comment.
2022-01-25 16:51:24 +11:00
bors[bot]
0549a9dbaa
Merge #585
585: Permit many sequences to be passed r=huntc a=huntc

Sequences are now passed in via the start method to avoid having to stop the PWM and restart it. Sequences continue to be constrained with the same lifetime of the Pwm struct itself. The pwm_sequence example has been extended to illustrate multiple sequences being passed around.

Co-authored-by: huntc <huntchr@gmail.com>
2022-01-24 21:42:01 +00:00
huntc
48afef28a0 Strengthen the borrow
The start method is now safe. Because it has the potential of borrowing the sequence and mutating itself, the sequence must outlive the Pwm struct.
2022-01-24 17:22:35 +11:00
Dario Nieuwenhuis
79f60adbfb stm32: add time-driver-any cargo feature that automatically picks one available timer. 2022-01-24 00:24:53 +01:00
huntc
7598b8a40f Permit many sequences to be passed
Sequences are now passed in via the start method to avoid having to stop the PWM and restart it. Sequences continue to be constrained with the same lifetime of the Pwm object itself. The pwm_sequence example has been extended to illustrate multiple sequences being passed around.
2022-01-23 16:29:52 +11:00
Dario Nieuwenhuis
889d757ab8 stm32/spi: expose all functionality as inherent methods. 2022-01-19 17:59:55 +01:00
Dario Nieuwenhuis
97ab859f00 stm32/i2c: expose all functionality as inherent methods. 2022-01-19 17:59:55 +01:00
Dario Nieuwenhuis
c949519714 stm32/usart: expose all functionality as inherent methods. 2022-01-19 17:59:55 +01:00
Dario Nieuwenhuis
98f24bf819 examples/stm32l0: cleanup 2022-01-19 17:59:55 +01:00
Dario Nieuwenhuis
b526addf7b stm32/exti: expose all functionality as inherent methods. 2022-01-19 17:59:55 +01:00
Dario Nieuwenhuis
58fc64722c stm32/gpio: expose all functionality as inherent methods. 2022-01-19 17:59:55 +01:00
Greg V
9fb2b5fa86 examples/stm32l1: remove memory.x, use the crate-provided one 2022-01-14 22:59:57 +03:00
Dario Nieuwenhuis
7997687f3b nrf: impl embedded-hal 1.0 and embedded-hal-async traits. 2022-01-13 23:56:39 +01:00
Dario Nieuwenhuis
6eec3d8acc nrf/rng: expose all functionality as inherent methods. 2022-01-13 23:56:39 +01:00
Dario Nieuwenhuis
df00c83984 nrf/qspi: expose all functionality as inherent methods. 2022-01-13 23:56:39 +01:00
Dario Nieuwenhuis
3e503e7335 nrf/uarte: expose all functionality as inherent methods. 2022-01-13 23:56:39 +01:00
Dario Nieuwenhuis
c432d036c7 nrf/gpiote: expose all functionality as inherent methods. 2022-01-13 23:56:39 +01:00
Dario Nieuwenhuis
ecb4f8fb00 nrf/twim: expose all functionality as inherent methods. 2022-01-13 23:56:39 +01:00
Dario Nieuwenhuis
a287fef687 nrf/spim: expose all functionality as inherent methods. 2022-01-13 23:56:39 +01:00
Matous Hybl
e056bedd55 Port the PWM example to H7, add low-level API example implementing 32-bit PWM. 2022-01-13 16:53:55 +01:00
Ulf Lilleengen
2bc105803a Make exti an optional feature
* Add embassy-stm32 build with exti
* Add exti to examples
2022-01-12 14:28:10 +01:00
huntc
d5d8897c84 Remove unsafe from new on RND
Unsafe is not required here given that all futures are required to live longer than their global peripheral instances. There are other occurrences of unsafe being used on new that should be removed. I started to do that but then went down a bit of a rabbit hole.
2022-01-06 09:59:28 +11:00
Dario Nieuwenhuis
2eb0cc5df7 stm32/rcc: remove Rcc struct, RccExt trait.
All the RCC configuration is executed in init().
2022-01-05 00:00:44 +01:00
Dario Nieuwenhuis
89b009b11d stm32h7/rcc: remove unneeded DMA enable settings.
These are automatically enabled by dma::init().
2022-01-04 13:31:30 +01:00
Dario Nieuwenhuis
cdc66e110f stm32/rcc: remove builders on Config.
This makes API consistent with other Config structs in Embassy, where
the convention is to not use builders.
2022-01-04 13:31:30 +01:00
bors[bot]
f744b74e90
Merge #539
539: nrf: async usb r=Dirbaio a=jacobrosenthal

Frankensteined together from this old pr https://github.com/embassy-rs/embassy/pull/115 and nrf-usdb

~Doesnt currently work..~

Co-authored-by: Jacob Rosenthal <jacobrosenthal@gmail.com>
2022-01-04 07:41:54 +00:00
bors[bot]
cdfd128185
Merge #545
545: Add adapter for implementing async traits for blocking types r=lulf a=lulf

This allows writing drivers relying on async traits, while still
functioning with implementations that already implement the embedded-hal
traits.

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-01-03 14:17:21 +00:00
bors[bot]
c0e94a7042
Merge #563
563: Initial ADC support for on STM32F1xx  r=Dirbaio a=sjoerdsimons

Add an ADC implementation for F1 based chips. Primarily tested using ADC1, proper functionality for ADC2 probably needs some extra work as it's mainly a slave and can't e.g. measure vrefint by itself.

Needs https://github.com/embassy-rs/stm32-data/pull/115

Co-authored-by: Sjoerd Simons <sjoerd@collabora.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-01-01 11:45:23 +00:00
Sjoerd Simons
dafc4c54e9 examples: stm32f1: Add an example of using the ADC 2021-12-30 10:53:39 +01:00
Sjoerd Simons
f0f08f298b examples: stm32f1: Optimize for size on development builds
Even the basic examples seemingly need to be build optimized for size to
allow flashing to a bluepill
2021-12-30 10:53:01 +01:00
Robert Walker
1028b5c671 Review changes 2021-12-29 08:17:51 +01:00
Robert Walker
4271226fc0 Added and tested the usart dma example for stm32f767zi using a
Nucleo-f767zi board.
2021-12-28 08:33:34 +01:00