tm1637_embedded_hal/brightness.rs
1//! Brightness level for the `TM1637` device.
2
3/// The brightness level.
4///
5/// Represents a byte that can be sent directly to the `TM1637` to set the brightness level.
6///
7/// ## Bits:
8/// - 1-3: Brightness level (0-7)
9/// - 4: Display state (0 - off, 1 - on). Always on.
10/// - 5-7: Base address
11#[repr(u8)]
12#[derive(Clone, Copy)]
13#[cfg_attr(feature = "impl-defmt-format", derive(defmt::Format))]
14#[cfg_attr(feature = "impl-debug", derive(core::fmt::Debug))]
15pub enum Brightness {
16 /// Brightness level 0. Lowest brightness.
17 L0 = 0b10001000,
18 /// Brightness level 1.
19 L1 = 0b10001001,
20 /// Brightness level 2.
21 L2 = 0b10001010,
22 /// Brightness level 3.
23 L3 = 0b10001011,
24 /// Brightness level 4.
25 L4 = 0b10001100,
26 /// Brightness level 5.
27 L5 = 0b10001101,
28 /// Brightness level 6.
29 L6 = 0b10001110,
30 /// Brightness level 7. Highest brightness.
31 L7 = 0b10001111,
32}
33
34/// Display state.
35///
36/// Represents a byte that can be sent directly to the `TM1637` to set the display state.
37#[repr(u8)]
38#[derive(Clone, Copy)]
39#[cfg_attr(feature = "impl-defmt-format", derive(defmt::Format))]
40#[cfg_attr(feature = "impl-debug", derive(core::fmt::Debug))]
41#[cfg(any(feature = "async", feature = "blocking"))]
42pub(crate) enum DisplayState {
43 /// Display off.
44 Off = 0b10000000,
45}