Unit 8.1 - The Rust embedded ecosystem

Slides

Exercise 8.1.1: LSM303AGR ID

Use our newly gained knowledge to get our first application running and read out the ID of the LSM303AGR accelerometer. We can communicate with the LSM303AGR using the I2C that is present on the micro:bit board. Note that the nRF52833 supports I2C with its TWIM (Two-Wire Interface Master) peripheral.

To get started we'll setup the i2c peripheral on our development kit and read out the ID register of the LSM303AGR accelerometer. The starting point can be found in the file at exercises/8-embedded/1-embedded-ecosystem/src/main.rs in the repository.

Try to run the existing project and then fill in the functionality as instructed by the comments.

To use that project, you can use the following commands from inside that folder using the terminal:

  • cargo build: Builds the project
  • cargo run: Builds the project, flashes it to the device and listens for any logs which it will display in the terminal. (This uses the probe-rs run tool)

In both cases you can add the --release flag to turn on optimizations.

Some pointers to help you get started