Board support crates

Board support crates provide a further level of wrapping for a specific board for convenience.

  1. #![no_main]
  2. #![no_std]
  3. extern crate panic_halt as _;
  4. use cortex_m_rt::entry;
  5. use embedded_hal::digital::OutputPin;
  6. use microbit::Board;
  7. #[entry]
  8. fn main() -> ! {
  9.     let mut board = Board::take().unwrap();
  10.     board.display_pins.col1.set_low().unwrap();
  11.     board.display_pins.row1.set_high().unwrap();
  12.     loop {}
  13. }
  • In this case the board support crate is just providing more useful names, and a bit of initialisation.
  • The crate may also include drivers for some on-board devices outside of the microcontroller itself.
    • microbit-v2 includes a simple driver for the LED matrix.

Run the example with:

  1. cargo embed --bin board_support