diff options
| author | Ulf Lilleengen <[email protected]> | 2021-12-10 12:27:44 +0100 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2021-12-10 12:27:44 +0100 |
| commit | e93f2679b1edbedd83e09fbc3b7a07dbf1ef80a4 (patch) | |
| tree | aff850c0df6739881abe25171509694f9e0ac962 /docs | |
| parent | b48fcd9229b40800cc96ff3157d8b36057dc2047 (diff) | |
More content
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/modules/ROOT/pages/basic_application.adoc | 15 | ||||
| -rw-r--r-- | docs/modules/ROOT/pages/stm32.adoc | 23 |
2 files changed, 35 insertions, 3 deletions
diff --git a/docs/modules/ROOT/pages/basic_application.adoc b/docs/modules/ROOT/pages/basic_application.adoc index d56cb5e1d..53aaa3d7d 100644 --- a/docs/modules/ROOT/pages/basic_application.adoc +++ b/docs/modules/ROOT/pages/basic_application.adoc | |||
| @@ -3,8 +3,6 @@ | |||
| 3 | So you've got one of the xref:examples.adoc[examples] running, but what now? Let's go through a simple Embassy application for the nRF52 DK to understand it better. | 3 | So you've got one of the xref:examples.adoc[examples] running, but what now? Let's go through a simple Embassy application for the nRF52 DK to understand it better. |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | == The Cargo.toml | ||
| 7 | |||
| 8 | == The main | 6 | == The main |
| 9 | 7 | ||
| 10 | === Rust Nightly | 8 | === Rust Nightly |
| @@ -73,3 +71,16 @@ What happens when the `blinker` task have been spawned and main returns? Well, t | |||
| 73 | . Runs the executor spawning the main task | 71 | . Runs the executor spawning the main task |
| 74 | 72 | ||
| 75 | There is also a way to run the executor without using the macro, in which case you have to create the `Executor` instance yourself. | 73 | There is also a way to run the executor without using the macro, in which case you have to create the `Executor` instance yourself. |
| 74 | |||
| 75 | == The Cargo.toml | ||
| 76 | |||
| 77 | The project definition needs to contain the embassy dependencies: | ||
| 78 | |||
| 79 | [source,toml] | ||
| 80 | ---- | ||
| 81 | include::example$examples/nrf/Cargo.toml[lines="9..11"] | ||
| 82 | ---- | ||
| 83 | |||
| 84 | Depending on your microcontroller, you may need to replace `embassy-nrf` with something else (`embassy-stm32` for STM32. Remember to update feature flags as well). | ||
| 85 | |||
| 86 | In this particular case, the nrf52840 chip is selected, and the RTC1 peripheral is used as the time driver. | ||
diff --git a/docs/modules/ROOT/pages/stm32.adoc b/docs/modules/ROOT/pages/stm32.adoc index 328f69e2a..3d1fbfc8f 100644 --- a/docs/modules/ROOT/pages/stm32.adoc +++ b/docs/modules/ROOT/pages/stm32.adoc | |||
| @@ -1,3 +1,24 @@ | |||
| 1 | = Embassy STM32 HAL | 1 | = Embassy STM32 HAL |
| 2 | 2 | ||
| 3 | TODO | 3 | The link:https://github.com/embassy-rs/embassy/tree/master/embassy-stm32[Embassy STM32 HAL] is based on the `stm32-metapac` project. |
| 4 | |||
| 5 | == The infinite variant problem | ||
| 6 | |||
| 7 | STM32 microcontrollers comes in many families and flavors, and supporting all of them is a big undertaking. Embassy has taken advantage of the fact | ||
| 8 | that the STM32 peripheral versions are shared across chip families. Instead of re-implementing the SPI | ||
| 9 | peripheral for every STM32 chip family, embassy have a single SPI implementation that depends on | ||
| 10 | code-generated register types that are identical for STM32 families with the same version of a given peripheral. | ||
| 11 | |||
| 12 | === The metapac | ||
| 13 | |||
| 14 | The `stm32-metapac` module uses pre-generated chip and register definitions for STM32 chip families to generate register types. This is done at compile time based on Cargo feataure flags. | ||
| 15 | |||
| 16 | The chip and register definitions are located in a separate module, `stm32-data`, which is modified whenever a bug is found in the definitions, or when adding support for new chip families. | ||
| 17 | |||
| 18 | === The HAL | ||
| 19 | |||
| 20 | The `embassy-stm32` module contains the HAL implementation for all STM32 families. The implementation uses automatically derived feature flags to support the correct version of a given peripheral for a given chip family. | ||
| 21 | |||
| 22 | == Timer driver | ||
| 23 | |||
| 24 | The STM32 timer driver operates at 32768 Hz by default. | ||
