635: Add documentation about the different embassy abstraction layers r=Dirbaio a=lulf
The guide demonstrates the functionality offered by each
layer in Embassy, using code examples.
Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
628: Improve logic for processing button events r=Dirbaio a=ceigel
Allow blinking to be interrupted by button presses in this sample.
Co-authored-by: Cristian Eigel <cristian.eigel@esrlabs.com>
618: time: optimize math by reducing fractions at compile time. r=Dirbaio a=Dirbaio
For example, `as_micros`, `from_micros` now are noops if tick rate is 1MHz.
See: https://godbolt.org/z/fE1bf3ecP
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
608: stm32f4: add adc + example r=Dirbaio a=ain101
Example tested on stm32f407vg Discovery Board.
minimal adc: no vref, dma, complex sequence
Co-authored-by: Frederik <frederik@frederik.at>
617: Add feature defmt-timestamp-uptime r=Dirbaio a=danielzfranklin
Add the feature defmt-timestamp-uptime. Enabling it adds a timestamp of the number of seconds since startup next to defmt log messages using `Instant::now`.
Co-authored-by: Daniel Franklin <daniel@danielzfranklin.org>
613: Rust stable support r=Dirbaio a=Dirbaio
This PR adds (limited) stable Rust support!
The drawbacks are:
- No `#[embassy::task]`, `#[embassy::main]`. (requires `type_alias_impl_trait`). You have to manually allocate the tasks somewhere they'll live forever. See [example](https://github.com/embassy-rs/embassy/blob/master/examples/nrf/src/bin/raw_spawn.rs)
- No async trait impls (requires GATs). Note that the full API surface of HALs is still available through inherent methods: #552#581
- Some stuff is not constructible in const (requires `const_fn_trait_bound`), although there's an (ugly) workaround for the generic `Mutex`.
So it's not that bad in the end, it's fully usable for shipping production-ready firmwares. We'll still recommend nightly as the default, until GATs and `type_alias_impl_trait` are stable.
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
607: stm32: Add standard crate-wide macros for pin/dma traits r=Dirbaio a=Dirbaio
All drivers will declare the traits using these macros.
This has a few implications:
- ALL drivers will have an Instance trait, even for drivers that usually have only one instance (for example crc, eth)
- It's no longer possible to have a fn configure() in pin traits, drivers will have to do that some other way
In the future, build.rs will generate all the impls instead of macrotables.
Pin/Dma traits are no longer explicitly sealed, since gpio::Pin and dma::Channel are already sealed, which has the same effect. This means the `af_num()` and `request()` funcs are now public, but IMO that's okay, they're unlikely to change.
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
612: Add button_events example for stm32f3 r=Dirbaio a=ceigel
This is a more elaborate example of using buttons and leds.
Tested on STM32F3DISCOVERY
Co-authored-by: Cristian Eigel <cristian.eigel@esrlabs.com>
Add an example documenting the config param based on help I got in the matrix chat.
Because the example is very short and incompatible with the other example code I just included it inline.
610: Update cargo-batch. r=Dirbaio a=Dirbaio
Cargo-batch now prints target+features when buildng a crate fails, which is very handy when one of the 30 `embassy-stm32`s fails in CI.
Before:
```
error: could not compile embassy-stm32 due to 2 previous errors
```
After:
```
error: could not compile `embassy-stm32` due to 2 previous errors
target: Target(CompileTarget { name: "thumbv7em-none-eabi" })
features: ["_time-driver", "defmt", "exti", "stm32f410tb", "time-driver-any"]
```
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>