adafruit_seesaw/modules/
mod.rs

1#[cfg(feature = "module_adc")]
2pub mod adc;
3#[cfg(feature = "module_encoder")]
4pub mod encoder;
5#[cfg(feature = "module_gpio")]
6pub mod gpio;
7#[cfg(feature = "module_keypad")]
8pub mod keypad;
9#[cfg(feature = "module_neopixel")]
10pub mod neopixel;
11pub mod status;
12#[cfg(feature = "module_timer")]
13pub mod timer;
14#[cfg(feature = "module_touch")]
15pub mod touch;
16
17pub type Reg = [u8; 2];
18
19#[derive(Debug, Clone, Copy, PartialEq, Eq)]
20#[cfg_attr(feature = "defmt", derive(defmt::Format))]
21pub enum HardwareId {
22    /// seesaw HW ID code for SAMD09
23    SAMD09 = 0x55,
24    /// seesaw HW ID code for ATtiny806
25    ATTINY806 = 0x84,
26    /// seesaw HW ID code for ATtiny807
27    ATTINY807 = 0x85,
28    /// seesaw HW ID code for ATtiny816
29    ATTINY816 = 0x86,
30    /// seesaw HW ID code for ATtiny817
31    ATTINY817 = 0x87,
32    /// seesaw HW ID code for ATtiny1616
33    ATTINY1616 = 0x88,
34    /// seesaw HW ID code for ATtiny1617
35    ATTINY1617 = 0x89,
36}
37
38impl From<HardwareId> for u8 {
39    fn from(value: HardwareId) -> Self {
40        value as u8
41    }
42}
43
44#[derive(Debug, Clone, Copy, PartialEq, Eq)]
45#[cfg_attr(feature = "defmt", derive(defmt::Format))]
46pub(crate) enum Modules {
47    Status = 0x00,
48    Gpio = 0x01,
49    Sercom0 = 0x02,
50    Timer = 0x08,
51    Adc = 0x09,
52    /// `Dac` has a value in the C++ Seesaw library but is not used
53    Dac = 0x0A,
54    /// `Interrupt` has a value in the C++ Seesaw library but is not used
55    Interrupt = 0x0B,
56    /// `Dap` has a value in the C++ Seesaw library but is not used
57    Dap = 0x0C,
58    Eeprom = 0x0D,
59    Neopixel = 0x0E,
60    Touch = 0x0F,
61    Keypad = 0x10,
62    Encoder = 0x11,
63    Spectrum = 0x12,
64}
65
66impl Modules {
67    pub const fn into_u8(self) -> u8 {
68        self as u8
69    }
70}