akafugu_twidisplay

Crates.ioakafugu_twidisplay
lib.rsakafugu_twidisplay
version0.1.0
sourcesrc
created_at2021-11-01 12:53:04.779655
updated_at2021-11-01 12:53:04.779655
descriptionPlatform-agnostic Rust driver for the NXP PCF8563 real-time clock.
homepagehttps://github.com/nebelgrau77/pcf8563-rs
repositoryhttps://github.com/nebelgrau77/pcf8563-rs
max_upload_size
id475220
size36,749
Michal Lasak (nebelgrau77)

documentation

https://docs.rs/pcf8563

README

Rust Akafugu TWIDisplay driver

Maintenance Intention

A platform agnostic Rust driver for the Akafugu TWIDisplay based on the embedded-hal traits.

This driver allows you to:

  • Display single digits or characters, also at a selected position
  • Display text, although some characters may not be available (see display documentation)
  • Clear the display
  • Show the current I2C address
  • Change the I2C address (experimental function)
  • Display time in HH.MM format
  • Display temperature or humidity, with settable lower/upper threshold

TO DO:

  • 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 device

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.

Usage

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();
    }

  }

}

Support

For questions, issues, feature requests, and other changes, please file an issue in the github project.

License

Licensed under either of

Contributing

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.

Commit count: 46

cargo fmt