Giter Site home page Giter Site logo

aorura's Introduction

AORURA

AORURA library, LED manager CLI, and emulator.

Protocol

AORURA exposes serial 19200n8 connection. Every command is exactly two bytes:

  • XX turns off LED
  • A< enables signature aurora LED state
  • color byte + ! causes LED to light up with given color
  • color byte + * causes LED to flash with given color at .5s interval

AORURA will respond with Y or N byte, depending on whether command was successfully applied or not, respectively.

SS is a special case command that causes AORURA to respond with command representing its current LED state.

AORURA's initial LED state is flashing blue (B*).

Valid color bytes:

  • B: blue
  • G: green
  • O: orange
  • P: purple
  • R: red
  • Y: yellow

Library

aorura is a Rust crate that implements AORURA protocol. Usage example:

use aorura::*;
use failure::*;

fn main() -> Fallible<()> {
  let mut led = Led::open("/dev/ttyUSB0")?;

  led.set(State::Flash(Color::Red))?; // cause LED to flash with red color
  led.set(State::Off)?; // turn off LED

  assert_eq!(led.get()?, State::Off);
  assert_eq!(State::try_from(b"B*")?, State::Flash(Color::Blue));

  Ok(())
}

CLI

aorura-cli is LED manager CLI built on top of aorura.

Usage: aorura-cli <path> [--set STATE]
       aorura-cli --help

Gets, and optionally, sets AORURA LED state.

Options:
  --set STATE  set LED to given state

States: aurora, flash:COLOR, off, static:COLOR
Colors: blue, green, orange, purple, red, yellow

Usage example:

path=/dev/ttyUSB0
original_state=$(aorura-cli $path)

# Enable flashing yellow LED:
aorura-cli $path --set flash:yellow

# Do something time-consuming:
sleep 10

# Revert back to original LED state:
aorura-cli $path --set $original_state

Emulator

aorura-emu is a PTY-based AORURA emulator. It can be used with CLI in lieu of compatible hardware. For example, this emulator is used to make status LED visible on HoloPortOS VM.

Usage: aorura-emu <path>
       aorura-emu --help

Emulates AORURA LED device over a PTY symlinked to given path.

Compatible hardware

  • AORURA-3 (HoloPort and HoloPort+)

    AORURA-3 photo

  • AORURA-UART-1 (HoloPort Nano)

    AORURA-UART-1 photo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.