use bitfield_struct::bitfield;
pub enum CMD {
ModeRead,
}
impl CMD {
#[inline(always)]
pub const fn as_bytes(self) -> &'static [u8; 3] {
match self {
CMD::ModeRead => &[0x80, 0x40, 0],
}
}
}
pub const ID_ADDR: &[u8; 2] = &[0x81, 0x40];
pub const STATUS_ADDR: &[u8; 2] = &[0x81, 0x4E];
pub const CLEAR_STATUS: &[u8; 3] = &[0x81, 0x4E, 0x00];
#[bitfield(u8, order = Msb)]
pub struct Status {
#[bits(1)]
pub buffer_status: bool,
#[bits(1)]
pub large_detect: bool,
#[bits(1)]
pub proximity_valid: bool,
#[bits(1)]
pub have_key: bool,
#[bits(4)]
pub num_points: u8, }
pub const POINT_BASE: [u8; 2] = [0x81, 0x4F];