Crates.io | akafugu_twidisplay |
lib.rs | akafugu_twidisplay |
version | 0.1.0 |
source | src |
created_at | 2021-11-01 12:53:04.779655 |
updated_at | 2021-11-01 12:53:04.779655 |
description | Platform-agnostic Rust driver for the NXP PCF8563 real-time clock. |
homepage | https://github.com/nebelgrau77/pcf8563-rs |
repository | https://github.com/nebelgrau77/pcf8563-rs |
max_upload_size | |
id | 475220 |
size | 36,749 |
A platform agnostic Rust driver for the Akafugu TWIDisplay
based on the embedded-hal
traits.
This driver allows you to:
test with other MCUs / Raspberry Pi
add a good example
read firmware version and number of digits (diagnostic functions)
display dots at selected positions
The TWI 7-segment Display is an easy to use 4-digit 7-segment display that is controlled using the TWI (I2C compatible) protocol. It is based on an ATMega4313 MCU, acting as a peripheral I2C device.
To use this driver, import this crate and an embedded_hal
implementation,
then instantiate the device.
Please find additional examples using hardware in this repository: examples
#![no_main]
#![no_std]
use akafugu_twidisplay::*:
#[entry]
fn main() -> ! {
// initialize all the necessary peripherals
// create an instance of I2C bus
let mut akafugu = TWIDisplay::new(i2c, DEFAULT_ADDRESS);
akafugu.clear_display().unwrap();
akafugu.set_brightness(127).unwrap();
loop {
let (hours, minutes, seconds) = some_rtc_reading();
// display time in HH.MM format, dot is on when number of seconds is even
if seconds % 2 == 0 {
akafugu.display_time(hours, minutes, true).unwrap();
} else {
akafugu.display_time(hours, minutes, false).unwrap();
}
}
}
For questions, issues, feature requests, and other changes, please file an issue in the github project.
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.