Skip to main content

as5048a_async/
register.rs

1//! Register addresses for AS5048A sensor.
2
3/// Register addresses for AS5048A
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
6#[non_exhaustive]
7#[repr(u16)]
8pub enum Register {
9    /// NOP command (no operation)
10    Nop = 0x0000,
11    /// Clear error flag.
12    ClearErrorFlag = 0x0001,
13    /// Diagnostics and AGC register
14    DiagAgc = 0x3FFD,
15    /// Magnitude register (14-bit)
16    Magnitude = 0x3FFE,
17    /// Angle register (14-bit corrected position)
18    Angle = 0x3FFF,
19}
20
21impl From<Register> for u16 {
22    fn from(reg: Register) -> u16 {
23        reg as u16
24    }
25}