on-off-sequence-output
A platform-agnostic library that provides output of a sequence of on/off states e.g. on an LED.
Installation
Add this to your Cargo.toml
:
[]
= "0.1"
Usage
This is a library crate and should work with any led that implements 'embedded_hal' trait 'OutputPin' on any cortex-m MCU.
The source could look like ...
use *;
// This is up to the implementation details of the embedded_hal you are using.
let led_pin: OutputPin = hal_function_which_returns_output_pin;
const UPDATE_SCALE: u16 = 500;
let mut led = new;
let output_states = 0b10011101;
let number_of_output_states = 8;
led.set
loop
led.set.unwrap;
loop
// some morse code output is possible as well
ledout.set_morse.unwrap;
loop
The examples
folder contains a working example named show-led-output
.
The cargo tooling (.cargo, memory.x, openocd.cfg ..) is prepared for an STM NUCLEO F401RE evaluation board.
If you have that board avaliable run
alternatively you can use use cargo-flash tool.
cargo flash --chip stm32f401re --example show-rust-is-good --target thumbv7em-none-eabihf
Since this is a library, there is no toolchain configured for build in .cargo/config
.
Testing
Testing is done via unit tests on host only. Run
... to exclude examples because they do not compile on host
License
This project is licensed under
- MIT License (
LICENSE.md
or online)