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//! ## Features
4//! The following features are available:
5//! - `blocking`: enables blocking functionality.
6//! - `async`: enables asynchronous functionality.
7//! - `impl-debug`: implements `core::fmt::Debug` for structs and enums.
8//! - `impl-defmt-format`: implements `defmt::Format` for structs and enums.
9//! - `mappings`: enables the mappings module.
10//! - `formatters`: enables the number formatting module.
11//! - `demo`: enables the demo module.
12//! - `disable-checks`: disables bound checks while writing to the display. When enabled, positions greater than available positions on the display will be written to the display regardless, causing more delay than needed. Enable this feature only if you are sure about the positions you are writing to.
13
14#![no_std]
15#![deny(unsafe_code)]
16#![deny(missing_docs)]
17#![cfg_attr(docsrs, feature(doc_cfg))]
18
19#[cfg(any(feature = "async", feature = "blocking"))]
20/// Our custom `try!` macro aka `?`, to get rid of [`core::convert::From`]/[`core::convert::Into`] used by the `?` operator.
21macro_rules! tri {
22    ($e:expr $(,)?) => {
23        match $e {
24            core::result::Result::Ok(value) => value,
25            core::result::Result::Err(err) => {
26                return core::result::Result::Err(err);
27            }
28        }
29    };
30}
31
32mod brightness;
33mod device;
34
35pub use brightness::Brightness;
36
37#[cfg(feature = "async")]
38#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
39pub use crate::device::asynch;
40
41#[cfg(feature = "blocking")]
42#[cfg_attr(docsrs, doc(cfg(feature = "blocking")))]
43pub use crate::device::blocking;
44
45#[cfg(feature = "demo")]
46#[cfg_attr(docsrs, doc(cfg(feature = "demo")))]
47pub mod demo;
48
49#[cfg(feature = "mappings")]
50#[cfg_attr(docsrs, doc(cfg(feature = "mappings")))]
51pub mod mappings;
52
53#[cfg(feature = "formatters")]
54#[cfg_attr(docsrs, doc(cfg(feature = "formatters")))]
55pub mod formatters;