mcxa_pac/lpspi0/
rsr.rs

1#[doc = "Register `RSR` reader"]
2pub type R = crate::R<RsrSpec>;
3#[doc = "Start of Frame\n\nValue on reset: 0"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum Sof {
7    #[doc = "0: Subsequent data word or RX FIFO is empty (RXEMPTY=1)."]
8    NextDataword = 0,
9    #[doc = "1: First data word"]
10    FirstDataword = 1,
11}
12impl From<Sof> for bool {
13    #[inline(always)]
14    fn from(variant: Sof) -> Self {
15        variant as u8 != 0
16    }
17}
18#[doc = "Field `SOF` reader - Start of Frame"]
19pub type SofR = crate::BitReader<Sof>;
20impl SofR {
21    #[doc = "Get enumerated values variant"]
22    #[inline(always)]
23    pub const fn variant(&self) -> Sof {
24        match self.bits {
25            false => Sof::NextDataword,
26            true => Sof::FirstDataword,
27        }
28    }
29    #[doc = "Subsequent data word or RX FIFO is empty (RXEMPTY=1)."]
30    #[inline(always)]
31    pub fn is_next_dataword(&self) -> bool {
32        *self == Sof::NextDataword
33    }
34    #[doc = "First data word"]
35    #[inline(always)]
36    pub fn is_first_dataword(&self) -> bool {
37        *self == Sof::FirstDataword
38    }
39}
40#[doc = "RX FIFO Empty\n\nValue on reset: 1"]
41#[cfg_attr(feature = "defmt", derive(defmt::Format))]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum Rxempty {
44    #[doc = "0: Not empty"]
45    NotEmpty = 0,
46    #[doc = "1: Empty"]
47    Empty = 1,
48}
49impl From<Rxempty> for bool {
50    #[inline(always)]
51    fn from(variant: Rxempty) -> Self {
52        variant as u8 != 0
53    }
54}
55#[doc = "Field `RXEMPTY` reader - RX FIFO Empty"]
56pub type RxemptyR = crate::BitReader<Rxempty>;
57impl RxemptyR {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub const fn variant(&self) -> Rxempty {
61        match self.bits {
62            false => Rxempty::NotEmpty,
63            true => Rxempty::Empty,
64        }
65    }
66    #[doc = "Not empty"]
67    #[inline(always)]
68    pub fn is_not_empty(&self) -> bool {
69        *self == Rxempty::NotEmpty
70    }
71    #[doc = "Empty"]
72    #[inline(always)]
73    pub fn is_empty(&self) -> bool {
74        *self == Rxempty::Empty
75    }
76}
77impl R {
78    #[doc = "Bit 0 - Start of Frame"]
79    #[inline(always)]
80    pub fn sof(&self) -> SofR {
81        SofR::new((self.bits & 1) != 0)
82    }
83    #[doc = "Bit 1 - RX FIFO Empty"]
84    #[inline(always)]
85    pub fn rxempty(&self) -> RxemptyR {
86        RxemptyR::new(((self.bits >> 1) & 1) != 0)
87    }
88}
89#[cfg(feature = "debug")]
90impl core::fmt::Debug for R {
91    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
92        f.debug_struct("RSR")
93            .field("sof", &self.sof())
94            .field("rxempty", &self.rxempty())
95            .finish()
96    }
97}
98#[doc = "Receive Status\n\nYou can [`read`](crate::Reg::read) this register and get [`rsr::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
99pub struct RsrSpec;
100impl crate::RegisterSpec for RsrSpec {
101    type Ux = u32;
102}
103#[doc = "`read()` method returns [`rsr::R`](R) reader structure"]
104impl crate::Readable for RsrSpec {}
105#[doc = "`reset()` method sets RSR to value 0x02"]
106impl crate::Resettable for RsrSpec {
107    const RESET_VALUE: u32 = 0x02;
108}