mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-25 07:18:08 +00:00
add exercise intro draft
This commit is contained in:
parent
3afc29ca72
commit
c1825d1185
1 changed files with 34 additions and 23 deletions
|
@ -1,37 +1,48 @@
|
||||||
# BSC Exercise
|
# BSC Exercise
|
||||||
|
|
||||||
In this exercise you will learn how to write a board support crate.
|
In this exercise you will learn how to write a board support crate.
|
||||||
The bsc template will already contain the led and timer implementation.
|
The template will already contain the LED and timer implementation.
|
||||||
The radio and USB/Power implementations will be deleted, because that just takes up unnecessary space and adds to confusion.
|
|
||||||
|
Note: Introduction to the exercise is a guided tour through the template and running the hello example.
|
||||||
|
|
||||||
|
|
||||||
## Learning goals
|
## Learning goals
|
||||||
* implement buttons functionality
|
* implement buttons functionality
|
||||||
* uarte implementation
|
* UARTE implementation
|
||||||
* impl blocks, associated functions, methods
|
* `impl` blocks, associated functions, methods
|
||||||
* generate docs!
|
* generate docs!
|
||||||
|
|
||||||
|
## Prerequesits
|
||||||
|
|
||||||
|
*
|
||||||
|
## Tasks
|
||||||
|
* Write a button implementation. This entails the following steps
|
||||||
|
* `struct Buttons` with 4 fields, that represents each of the four buttons
|
||||||
|
* `struct Button` that is a wrapper for the pin that a single button is connected to
|
||||||
|
* a method `is_pushed` that checks if a single button is pushed.
|
||||||
|
* initialize the pins in `fn init()`
|
||||||
|
* add the `struct Button` to the definition and instantiation of `struct Board`.
|
||||||
|
* Run `apps/buttons.rs` to test.
|
||||||
|
* Write a UARTE implementation.
|
||||||
|
|
||||||
|
## Knowledge
|
||||||
|
|
||||||
|
## Representation of Peripherals
|
||||||
|
The boards peripherals are represented as nested structs. The `struct Board` contains fields that represent single peripherals or groups of peripherals as structs, which in turn either contain a field of the single peripheral or ...
|
||||||
|
|
||||||
|
You have to add structs to represent the buttons and the UARTE peripheral to the board struct.
|
||||||
|
|
||||||
|
## Comments
|
||||||
|
|
||||||
|
|
||||||
|
## impl blocks
|
||||||
|
|
||||||
|
## visibility of structs, fields and functions: the pub keyword
|
||||||
|
|
||||||
|
|
||||||
|
## Hardware documentation for pin configuration
|
||||||
|
|
||||||
## Steps
|
|
||||||
### Write a button implementation
|
|
||||||
* add field in the board struct
|
|
||||||
* add struct for all buttons
|
|
||||||
* add struct for the single button
|
|
||||||
|
|
||||||
* Read docs, section 8.7 for info about pins and pin configuration
|
|
||||||
* add button bring up to board init
|
|
||||||
|
|
||||||
* add doc lines every where!
|
|
||||||
* add methods in impl block:
|
|
||||||
* detect button push
|
|
||||||
* debounce button function? like in knurling session, requires implementation of a second timer, just for this?
|
|
||||||
|
|
||||||
### Write Uarte implementation
|
|
||||||
* add field to the board struct
|
|
||||||
* add struct for the instance, how to figure out what the type of the inner field is
|
|
||||||
* create instance in init, add baudrate, parity etc.
|
|
||||||
* add to instantiation of board struct
|
|
||||||
* impl fmt::Write for the Uarte struct, simple write does not work because of dma
|
|
||||||
* example code with button is not a good idea for the simple button implementation.
|
|
||||||
|
|
||||||
I think this is plenty for an hour.
|
|
Loading…
Reference in a new issue