mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-10 08:15:36 +00:00
address issues
This commit is contained in:
parent
3689d0daff
commit
a5f4ebee56
2 changed files with 7 additions and 1 deletions
|
@ -15,8 +15,8 @@ Generate your own PAC from an SVD file.
|
|||
* Install `svd2rust` and `form` via cargo.
|
||||
* Download the [nrf-svd][svd] file and place it into `down-the-stack/dk-pac`.
|
||||
* Run `svd2rust` on the file using the `cortex-m` target.
|
||||
* Format the generated file to make it readable.
|
||||
* Split the file into its modules using `form`.
|
||||
* Format the generated file to make it readable.
|
||||
* Check the documentation.
|
||||
|
||||
## Step-by-Step Solution
|
||||
|
|
|
@ -35,6 +35,12 @@ Note the difference between the struct field `UARTE0` in `Peripherals` and the m
|
|||
|
||||
* `dk_pac/src/lib.rs` defines the singleton peripherals as part of a larger `struct Peripherals`. There are two methods for this struct: `take()` and `steal()`. `take()` assures, that only one instance of this can exist. Hence, it's safe. Note that `take()` is only available with the `critical-section` feature enabled.
|
||||
|
||||
To generate documentation that includes `take()`, pass the `critical-section` feature flag when generating the docs:
|
||||
|
||||
```
|
||||
cargo doc --open --features critical-section
|
||||
```
|
||||
|
||||
* `dk_pac/src/uarte0.rs` defines a struct that contains all the registers of the `UARTE0` peripheral. The `enable` field represents the register of the same name.
|
||||
|
||||
* `dk_pac/src/uarte0/enable.rs` defines the types associated with this register that you already saw in the docs.
|
||||
|
|
Loading…
Reference in a new issue