tmc2209_uart/registers/
ifcnt.rs1use super::{Address, ReadableRegister, Register};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
11#[cfg_attr(feature = "defmt", derive(defmt::Format))]
12pub struct Ifcnt(u32);
13
14impl Ifcnt {
15 pub fn count(&self) -> u8 {
17 (self.0 & 0xFF) as u8
18 }
19
20 pub fn raw(&self) -> u32 {
22 self.0
23 }
24
25 pub fn from_raw(value: u32) -> Self {
27 Self(value)
28 }
29}
30
31impl Register for Ifcnt {
32 const ADDRESS: Address = Address::Ifcnt;
33}
34
35impl ReadableRegister for Ifcnt {}
36
37impl From<u32> for Ifcnt {
38 fn from(value: u32) -> Self {
39 Self(value)
40 }
41}
42
43impl From<Ifcnt> for u32 {
44 fn from(reg: Ifcnt) -> u32 {
45 reg.0
46 }
47}