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