Commit Graph

2044 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
20e14b8edb embassy, embassy-nrf: add nightly Cargo feature to gate nightly-only features. 2022-02-12 01:16:31 +01:00
Dario Nieuwenhuis
611961b499 macros: cleanup, make work in stable. 2022-02-12 01:16:31 +01:00
Dario Nieuwenhuis
6c925b2342 blocking_mutex: refactor to work on stable. No GATs, and can be constructed in const. 2022-02-12 01:16:31 +01:00
bors[bot]
5ae4e20f86
Merge #607
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>
2022-02-11 23:11:12 +00:00
bors[bot]
621a280042
Merge #612
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>
2022-02-11 21:12:58 +00:00
Cristian Eigel
0e0e23c5be Add button_events example for stm32f3 2022-02-11 22:10:47 +01:00
Dario Nieuwenhuis
cf9c157607
Merge pull request #611 from danielzfranklin/patch-1
Document #[embassy::main(config = ...)]
2022-02-11 22:06:47 +01:00
Daniel Franklin
e15d3750ea
Document #[embassy::main(config = ...)]
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.
2022-02-11 13:00:45 -08:00
bors[bot]
37bd796fb3
Merge #610
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>
2022-02-11 19:48:55 +00:00
Dario Nieuwenhuis
63cfa7cd6a Update cargo-batch. 2022-02-11 20:31:37 +01:00
Dario Nieuwenhuis
b99ab3d5d9 stm32: Add standard crate-wide macros for pin/dma traits, switch all drivers to use them. 2022-02-10 21:38:03 +01:00
bors[bot]
cbc7f620bd
Merge #606
606: Port multiprio example to stm32f3 and stm32f4 platforms r=Dirbaio a=ceigel

Example tested on stm32f303discovery and stm32f405 feather.

Co-authored-by: Cristian Eigel <cristian.eigel@esrlabs.com>
2022-02-10 18:26:56 +00:00
Cristian Eigel
898851ceeb Port multiprio example to stm32f3 and stm32f4 platforms 2022-02-10 19:22:32 +01:00
bors[bot]
9d682aa1fa
Merge #605
605: stm32: Remove OptionalPin r=Dirbaio a=Dirbaio

The idea behind OptionalPin has a few problems:

- you need to impl the signal traits for NoPin which is a bit weird https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/src/dcmi.rs#L413-L416
- you can pass any combination of set/unset pins, which needs checking at runtime  https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/src/dcmi.rs#L130

The replacement is to do multiple `new` constructors for each combination of pins you want to take.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-10 15:15:06 +00:00
Dario Nieuwenhuis
a8bd3ab952 Add missing + 'd on unborrows. 2022-02-10 16:06:42 +01:00
Dario Nieuwenhuis
550da471be stm32: Remove OptionalPin
The idea behind OptionalPin has a few problems:

- you need to impl the signal traits for NoPin which is a bit weird https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/src/dcmi.rs#L413-L416
- you can pass any combination of set/unset pins, which needs checking at runtime  https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/src/dcmi.rs#L130

The replacement is to do multiple `new` constructors for each combination of pins you want to take.
2022-02-10 02:38:10 +01:00
bors[bot]
1d265b73b2
Merge #601
601: [part 1/n] Change macrotables to build.rs codegen r=lulf a=Dirbaio

This PR replaces the "macrotables" (the macros like `stm32_data::peripherals!`) with a `const METADATA`.

Macrotables had some problems:

- Hard to debug
- Somewhat footgunny (typo the "pattern" and then nothing matches and the macro now expands to nothing, silently!)
- Limited power
  - Can't count, so we had to add a [special macrotable for that](f50f3f0a73/embassy-stm32/src/dma/bdma.rs (L26)).
  - Can't remove duplicates, so we had to fallback to [Rust code in build.rs](f50f3f0a73/embassy-stm32/build.rs (L105-L145))
  - Can't include the results as a listto another macro, so again [build.rs](https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/build.rs#L100-L101).

They work fine for the 95% of cases, but for the remaining 5% we need Rust code in build.rs. So we might as well do everything with Rust code, so everything is consistent.

The new approach generates a `const METADATA: Metadata = Metadata { ... }` with [these structs](https://github.com/embassy-rs/embassy/blob/unmacrotablize/stm32-metapac-gen/src/assets/metadata.rs) in `stm32-metapac`. `build.rs` can then read that and generate whatever code.


Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-09 15:27:35 +00:00
bors[bot]
3d6b8bd983
Merge #604
604: Add embassy-boot r=lulf a=lulf

Continuation of https://github.com/embassy-rs/embassy/pull/588

Embassy-boot is a simple bootloader that works together with an application to provide firmware update capabilities with a minimal risk.

The bootloader consists of a platform-independent part, which implements the swap algorithm, and a platform-dependent part (currently only for nRF) that provides addition functionality such as watchdog timers softdevice support.

The bootloader is intended to be configurable for different flash sizes and architectures, and only requires that embedded-storage flash traits are implemented.

The nRF version can be configured programatically as a library, or using linker scripts to set the partition locations for DFU, ACTIVE and STATE

* DFU: Where the next firmware version should be written. This is used by the FirmwareUpdater
* ACTIVE: Where the current firmware version resides. Written by bootloader when swap magic is set
* STATE: Contains the bootloader magic and the copy progress. Can be 1-N pages long (depending on how much flash you have which will determine the copy progress index size


Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2022-02-09 15:07:25 +00:00
Ulf Lilleengen
e990021b9a Address review comments 2022-02-09 12:46:46 +01:00
Ulf Lilleengen
ed2a87a262 Add embassy-boot
Embassy-boot is a simple bootloader that works together with an
application to provide firmware update capabilities with a minimal risk.

The bootloader consists of a platform-independent part, which implements
the swap algorithm, and a platform-dependent part (currently only for
nRF) that provides addition functionality such as watchdog timers
softdevice support.
2022-02-09 10:50:29 +01:00
bors[bot]
d91bd0b9a6
Merge #602
602: Add stm32 USB OTG peripherals r=Dirbaio a=chemicstry

Fixes #557. This is similar to #580, but for synopsys IP.

I could add examples to other chips, but I have no way of testing them. The F4 example is tested and working.

Co-authored-by: chemicstry <chemicstry@gmail.com>
2022-02-09 00:29:00 +00:00
chemicstry
10981ee809 Cleanup 2022-02-09 02:10:54 +02:00
chemicstry
a766bf635d Fix function name 2022-02-09 02:04:31 +02:00
chemicstry
1f81a69347 Merge USB FS and HS peripherals. Add ULPI. 2022-02-09 02:02:23 +02:00
Dario Nieuwenhuis
8160af6af9 stm32: replace peripheral_rcc! macrotable with build.rs 2022-02-09 00:58:17 +01:00
Dario Nieuwenhuis
d1a9680422 stm32: change interrupt declarations from macrotables to build.rs. 2022-02-09 00:45:52 +01:00
Dario Nieuwenhuis
940412c034 stm32/build.rs: switch to using stm32-metapac metadata and quote. 2022-02-09 00:31:21 +01:00
Dario Nieuwenhuis
4d73d87b40 stm32-metapac: add option to generate chip metadata as a rust const. 2022-02-09 00:28:05 +01:00
bors[bot]
2cf79f6569
Merge #603
603: Add support for FMC r=Dirbaio a=matoushybl



Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2022-02-08 21:48:33 +00:00
Matous Hybl
d37d714314 stm32: Add support for FMC 2022-02-08 17:30:20 +01:00
Matous Hybl
fee1de109d Fix RCC configuration for H7. 2022-02-08 14:36:53 +01:00
chemicstry
db0d798b48 Add stm32 USB OTG peripherals 2022-02-08 01:46:32 +02:00
bors[bot]
a4b4a7bcf9
Merge #600
600: Update stm32-data r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-07 22:14:44 +00:00
Dario Nieuwenhuis
8ef5b404f1 Update stm32-data 2022-02-07 23:13:44 +01:00
bors[bot]
f50f3f0a73
Merge #599
599: Update stm32-data r=Dirbaio a=Dirbaio

Again!

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-07 19:41:15 +00:00
Dario Nieuwenhuis
aaf25bbac3 Update stm32-data 2022-02-07 20:40:35 +01:00
bors[bot]
965e3c436e
Merge #598
598: Upgrade to embedded-storage 0.3.0 r=lulf a=lulf



Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2022-02-07 12:14:01 +00:00
Ulf Lilleengen
f79624c3e6 Upgrade to embedded-storage 0.3.0 2022-02-07 12:35:58 +01:00
bors[bot]
d06b0628e0
Merge #597
597: Update stm32-data, update build scripts for new schema. r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-07 01:23:35 +00:00
Dario Nieuwenhuis
de19fe5c05 Update stm32-data, update build scripts for new schema. 2022-02-07 02:23:02 +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
bors[bot]
def3283e44
Merge #596
596: Update stm32data r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-05 02:04:03 +00:00
Dario Nieuwenhuis
fbaa7e59d5 stm32/dma: fix interrupt codegen for new stm32-data 2022-02-05 03:03:32 +01:00
Dario Nieuwenhuis
f8507b5e78 update stm32-data 2022-02-05 03:03:24 +01:00
Dario Nieuwenhuis
f8b8872fa6
Merge pull request #593 from embassy-rs/remove-traits
traits: migrate Delay to embedded-hal 1.0+async, remove Rng and Flash.
2022-02-05 01:53:01 +01: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
3b2beddc7a Forgot to expose the stop method 2022-02-04 19:14:24 +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