tm1637_embedded_hal/
lib.rs

1//! A platform agnostic driver to interface with the `TM1637` (7-segment display) using the [`embedded-hal`](embedded_hal) and [`embedded-hal-async`](embedded_hal_async) traits.
2//!
3//! ```rust
4//! use tm1637_embedded_hal::{mock::Noop, Brightness, TM1637Builder};
5//!
6//! let mut tm = TM1637Builder::new(Noop, Noop, Noop)
7//!     .brightness(Brightness::L3)
8//!     .delay_us(100)
9//!     // Blocking or async mode
10//!     .build_blocking::<6>();
11//!
12//! // Clear the display and set brightness
13//! tm.init().ok();
14//!
15//! // High-Level fluent API
16//! tm.options()
17//!     .str("HELLO. ruSt.")
18//!     .scroll()
19//!     .linear()
20//!     .finish()
21//!     .run();
22//!
23//! // Or Low-Level API
24//! let bytes = &[0b00000110, 0b01011011, 0b01001111, 0b01100110]; // `1234`
25//!
26//! tm.display_slice(0, bytes).ok();
27//! ```
28//!
29//! # Features
30//!
31//! - `ack`: Enables the driver to use the [`InputPin`](https://docs.rs/embedded-hal/latest/embedded_hal/digital/trait.InputPin.html) trait for the `DIO` pin and wait for the acknowledgment signal from the display.
32//! - `defmt`: Implements [`defmt::Format`](https://docs.rs/defmt/latest/defmt/trait.Format.html) for structs and enums.
33
34#![no_std]
35#![deny(unsafe_code, missing_docs, missing_debug_implementations)]
36#![cfg_attr(docsrs, feature(doc_cfg))]
37
38mod align;
39mod brightness;
40mod builder;
41mod conditional;
42mod device;
43mod error;
44mod exact_size;
45pub mod formatters;
46mod identity;
47pub mod mappings;
48mod maybe_flipped;
49#[doc(hidden)]
50pub mod mock;
51mod mode;
52pub mod numbers;
53pub mod options;
54pub mod str;
55pub mod tokens;
56
57pub use brightness::Brightness;
58pub use builder::TM1637Builder;
59pub(crate) use conditional::ConditionalInputPin;
60pub use device::TM1637;
61pub use error::Error;
62pub(crate) use identity::Identity;