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>
595: stm32f3: fix nonexistent cfg tests r=Dirbaio a=unrelentingtech
The rcc code was taken from stm32-rs which uses 'x' features, but embassy uses features with full chip names.
Add these 'x' wildcards as cfgs and use them in rcc. They will be useful for USB #580 too.
---
I don't have any F3 boards, so this is not tested. But the original cfg clearly doesn't look right…
Co-authored-by: Greg V <greg@unrelenting.technology>
The rcc code was taken from stm32-rs which uses 'x' features, but
embassy uses features with full chip names.
Add these 'x' wildcards as cfgs and use them in rcc.
They will be useful for USB too.
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.
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.
592: Initial work on unstable-trait feature for stm32 r=lulf a=lulf
Implements async traits for exti for now.
Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
589: stm32/i2c: allow empty writes r=Dirbaio a=darkwater
The Senseair Sunrise CO2 sensor expects a wake-up packet in the form of (START, address, STOP), which looks like a `write(addr, &[])`, but this assertion prevents sending that.
I'm not sure why the assertion is there. Sending empty packets works fine in my limited testing, at least.
Co-authored-by: Sam Lakerveld <dark@dark.red>
590: Stop PWM before assigning the new sequence r=huntc a=huntc
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.
Co-authored-by: huntc <huntchr@gmail.com>
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.
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>
586: stm32: add `time-driver-any` cargo feature that automatically picks one. r=Dirbaio a=Dirbaio
Most of the time you don't care which one gets used, so this is easier! :)
It also helps for building docs for all chips, it reduces the feature changes needed.
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
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.
581: stm32: expose all functionality as inherent methods. r=Dirbaio a=Dirbaio
This is the previous step to implementing both the embedded-hal 0.2 and embedded-hal 1.0 + embedded-hal-async traits.
The equivalent in nrf was done in #552
- Removes need for `unwrap` in gpio.
- Removes need for `use embedded_hal::whatever` in all cases.
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>