embedded-trainings-2020/embedded-workshop-book/src/bsc-exercise.md

37 lines
1.3 KiB
Markdown
Raw Normal View History

2023-02-14 17:46:54 +00:00
# BSC Exercise
In this exercise you will learn how to write a board support crate.
2023-02-14 18:04:36 +00:00
The bsc 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.
2023-02-14 17:46:54 +00:00
## Learning goals
* implement buttons functionality
2023-02-14 18:04:36 +00:00
* uarte implementation
2023-02-14 17:46:54 +00:00
* impl blocks, associated functions, methods
* generate docs!
## Steps
2023-02-14 18:04:36 +00:00
### Write a button implementation
2023-02-14 17:46:54 +00:00
* 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
2023-02-14 18:04:36 +00:00
* debounce button function? like in knurling session, requires implementation of a second timer, just for this?
2023-02-14 17:46:54 +00:00
2023-02-14 18:04:36 +00:00
### 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.
2023-02-14 17:46:54 +00:00
2023-02-14 18:04:36 +00:00
I think this is plenty for an hour.