3 releases (stable)

1.0.1 Dec 8, 2019
1.0.0 Nov 16, 2019
0.4.0 Nov 3, 2019

#1661 in Hardware support

MIT license

105KB
1.5K SLoC

This is a Rust library for controlling a micro:bit.

It currently supports the 5×5 LED display and the built-in buttons.

To set up a project using this library, see "Getting started" in the documentation.

Documentation

https://docs.rs/rmicrobit

Changelog

See CHANGELOG.md.

Licence

See LICENCE.txt


lib.rs:

A library for working with the micro:bit.

Features

This crate currently provides:

  • Support for the 5×5 LED display (see display)
  • A library for working with 5×5 images (see graphics)
  • Support for the hardware buttons (see buttons)

Getting started

See How to use rmicrobit.

Examples

There are a number of example programs in the examples directory. You can run an example as follows:

cargo run --example scroll_text -- -x microbit.gdb

examples/demo demonstrates all the features of this crate, using the cortex-m-rtfm framework.

Tests

There are a few tests which can be run on the host machine. Run them as follows (from a checked-out working copy of rmicrobit):

cargo test --lib --target x86_64-unknown-linux-gnu

(or substitute your development machine's native target)

Re-exports

The following dependencies are re-exported under rmicrobit::, so that crates using this library can be sure to be using consistent versions:

  • nrf51 (register-level access to the SoC peripherals)
  • nrf51_hal (higher-level access to the SoC peripherals)
  • embedded_hal (traits used by some nrf51_hal interfaces)

In particular, if you use cortex-m-rtfm, use rmicrobit::nrf51 as the device parameter to #[app].

Dependencies

~3MB
~85K SLoC