mb2_wukong_expansion/lib.rs
1#![doc(html_root_url = "https://docs.rs/mb2-wukong-expansion/0.1.2")]
2/*!
3
4This Rust crate provides support for the [Elecfreaks Wukong
5Expansion
6Board](https://shop.elecfreaks.com/products/elecfreaks-micro-bit-wukong-expansion-board-adapter)
7(Wukong; see also their
8[wiki](https://www.elecfreaks.com/learn-en/microbitExtensionModule/wukong.html))
9for the [BBC micro:bit
10v2](https://microbit.org/new-microbit/) (MB2).
11
12This crate is currently built atop `nrf52833-hal` and is
13probably best used with that.
14
15The Wukong provides a rechargeable battery that can power
16itself and the MB2, and provides expansion pins for 5V and
17for the MB2 edge connector.
18
19The Wukong also provides five mostly-disjoint features
20visible from the MB2. Each is supported by a separate Cargo
21feature listed here. (All features are on by default, but
22you can turn off the ones you don't want to save a little
23space.) The names were mostly taken from the Wukong
24documentation.
25
26* "*Ambient*" LEDs (`ambient`): Four WS2812 RGB "Smart LEDs" sit at the
27 four corners of the Wukong. This crate will drive these LEDs as if
28 they were directly addressable.
29
30* "*Buzzer*" (`buzzer`): A speaker sits on the bottom of the
31 board. This crate will play a square wave at a given
32 frequency on this speaker.
33
34* *Mood Lights* (`mood_lights`): There are blue LEDs under
35 the board that are cooperatively controlled by the Wukong
36 and the MB2. (These are referred to as "Breath" in the
37 Wukong documentation, but they can be put in steady-on
38 mode as well.) This crate can run these.
39
40* *Motor* (`motor`): The Wukong has two DC motor controllers
41 with pins on the board. This crate can set the speed of
42 these motors.
43
44* *Servo* (`servo`): The Wukong has eight servo controllers
45 with pins on the board. This crate can set the angle of
46 these servos.
47*/
48
49#![no_std]
50
51#[cfg(feature = "ambient")]
52pub mod ambient;
53#[cfg(feature = "bus")]
54pub mod bus;
55#[cfg(feature = "buzzer")]
56pub mod buzzer;
57
58#[cfg(feature = "ambient")]
59pub use ambient::{WuKongAmbient, RGB8};
60#[cfg(feature = "buzzer")]
61pub use buzzer::WuKongBuzzer;
62
63#[cfg(feature = "bus")]
64pub use bus::WuKongBus;
65#[cfg(feature = "mood_lights")]
66pub use bus::MoodLights;
67#[cfg(feature = "motor")]
68pub use bus::Motor;
69#[cfg(feature = "servo")]
70pub use bus::{Servo, ServoAngle, ServoConfig};