Crate tm1637_embedded_hal

Source
Expand description

A platform agnostic driver to interface with the TM1637 (7-segment display) using the embedded-hal and embedded-hal-async traits.

use tm1637_embedded_hal::{mock::Noop, Brightness, TM1637Builder};

let mut tm = TM1637Builder::new(Noop, Noop, Noop)
    .brightness(Brightness::L3)
    .delay_us(100)
    // Blocking or async mode
    .build_blocking::<6>();

// Clear the display and set brightness
tm.init().ok();

// High-Level fluent API
tm.options()
    .str("HELLO. ruSt.")
    .scroll()
    .linear()
    .finish()
    .run();

// Or Low-Level API
let bytes = &[0b00000110, 0b01011011, 0b01001111, 0b01100110]; // `1234`

tm.display_slice(0, bytes).ok();

§Features

  • ack: Enables the driver to use the InputPin trait for the DIO pin and wait for the acknowledgment signal from the display.
  • defmt: Implements defmt::Format for structs and enums.

Modules§

formatters
Format numbers into byte arrays.
mappings
Mappings for 7-segment display characters.
numbers
Format signed and unsigned integers into byte arrays.
options
High-level API for display operations.
str
str parsing utilities.
tokens
Tokens for the different modes of operation and display orientation.

Structs§

TM1637
TM1637 7-segment display driver.
TM1637Builder
TM1637 7-segment display builder.

Enums§

Brightness
The brightness level.
Error
An Error type for the TM1637 driver.