This commit is contained in:
Mirabellensaft 2023-03-17 19:31:07 +01:00
parent 3fd05d1f0f
commit 7def8fb313
4 changed files with 17 additions and 7 deletions

View file

@ -2,7 +2,7 @@
In this exercise you will learn how to write a board support crate by implementing buttons and the UARTE peripheral.
The template `down-the-stack/dk_bsc/src/lib.rs` already contains the LED and Timer implementations. Add your code to the designated lines. You'll find a //todo! there.
The template `down-the-stack/dk_bsc/src/lib.rs` already contains the LED and Timer implementations. Add your code to the designated lines. You'll find a `//todo!` there.
You can test after each step by running the following command out of `down-the-stack/apps`
```
@ -12,7 +12,7 @@ This program will not call any of the functions you are implementing, so it does
`down-the-stack/dk_bsc/src/lib_solution.rs` contains the full solution code.
Note for trainer: Introduction to the exercise is a guided tour through the template, and it's architecture. Make the participants aware of the placeholders for their implementations. run the hello example on the unmodified lib.
## You will learn how to
@ -52,7 +52,7 @@ Note for trainer: Introduction to the exercise is a guided tour through the temp
## Knowledge
### Comments
The `lib.rs` has an attribute #![deny(missing_docs)]. This means, that missing doc comments for structs are returned as compiler errors, to remind you to document your work properly.
The `lib.rs` has an attribute `#![deny(missing_docs)]`. This means, that missing doc comments for structs are returned as compiler errors, to remind you to document your work properly.
```rust
/// This is a doc comment

View file

@ -13,7 +13,7 @@ The pins need to be configured as input pins with an internal pull-up. The pins
✅ Add the struct that represents the single button. It has only one field, `inner`. The type of this button is the pin configuration: `Pin<Input<PullUp>>`
✅ Add the `struct` that represents the group of buttons has four fields, one for each button. The field name contains the number that corresponds to the button numeration on the board. The of type of each field is the struct that represents the generic single button.
✅ Add the `struct` that represents the group of buttons has four fields, one for each button. The field name contains the number that corresponds to the button numeration on the board. The type of each field is the struct that represents the generic single button.
✅ Add doc comments for every struct and field!

View file

@ -0,0 +1,10 @@
# Down the Stack
In this Session you will learn more about Rust's split crate model that includes
* the Board Support Crate
* an implementation of the Hardware Abstraction Layer
* the Peripheral Access Crate
This session consists of lectures and two blocks of exercises:
* BSC Exercise: Implementing further features in a basic BSC
* PAC Exercise: Generating a PAC from an SVD file and writing into registers using the the generated PAC.

View file

@ -30,7 +30,7 @@ use hal::pac::uarte0::{
use hal::uarte;
```
### Step 3: Add `struct Uarte
### Step 3: Add `struct Uarte`
✅ Add `struct Uarte` that serves as a wrapper for the `UARTE1` instance.
The struct has one field labelled `inner`, it contains the `UARTE1` instance: `hal::Uarte<hal::pac::UARTE1>`.
@ -132,7 +132,7 @@ We can't just write to the `Uarte` instance. A simple write would write from fla
✅ Create a buffer. The type is an `array` of 16 u8, set to all 0.
✅ To copy all data into an on-stack buffer, iterate over every chunk of the string to copy it into the buffer:
✅ To copy all data into an on-stack buffer, iterate over every chunk of the string to copy it into the buffer.
<details>
<summary>Solution</summary>
@ -170,7 +170,7 @@ ls /dev/tty.usbmodem*
screen <address of mc> 115200
```
### Step 7: Run the example.
### Step 8: Run the example.
✅ In another terminal window go into the folder `down-the-stack/apps` and use the following command.