AORURA LED library, CLI, and emulator.
AORURA communicates via a serial connection (19200n8). All commands it supports are exactly two bytes:
XX
turns the LED offA<
puts the LED into its signature shimmering "aurora" state- a color byte followed by
!
makes the LED light up with the given color - a color byte followed by
*
makes the LED flash with the given color at a half-second interval
AORURA responds to these commands with a single byte: Y
if successful, N
if not.
There's one more: SS
. AORURA responds to this command with two bytes
representing the command for its current state.
AORURA's initial state is B*
(flashing blue).
Valid color bytes:
B
: blueG
: greenO
: orangeP
: purpleR
: redY
: yellow
aorura
is a library that implements the AORURA protocol.
use aorura::*;
use failure::*;
fn main() -> Fallible<()> {
let mut led = Led::open("/dev/ttyUSB0")?;
led.set(State::Flash(Color::Red))?;
led.set(State::Off)?;
assert_eq!(led.get()?, State::Off);
assert_eq!(State::try_from(b"B*")?, State::Flash(Color::Blue));
Ok(())
}
aorura-cli
is a CLI built on top of the AORURA library.
Usage: aorura-cli <path> [--set STATE]
aorura-cli --help
Gets/sets the AORURA LED state.
Options:
--set STATE set the LED to the given state
States: aurora, flash:COLOR, off, static:COLOR
Colors: blue, green, orange, purple, red, yellow
path=/dev/ttyUSB0
original_state=$(aorura-cli $path)
aorura-cli $path --set flash:yellow
# Do something time-consuming:
sleep 10
# Revert back to the original LED state:
aorura-cli $path --set "$original_state"
aorura-emu
is a PTY-based AORURA emulator. It can be used with
the library or the CLI in lieu of the hardware.
Usage: aorura-emu <path>
aorura-emu --help
Emulates AORURA over a PTY symlinked to the given path.