Skip to main content

mcxa_pac/lpi2c0/
sasr.rs

1#[doc = "Register `SASR` reader"]
2pub type R = crate::R<SasrSpec>;
3#[doc = "Field `RADDR` reader - Received Address"]
4pub type RaddrR = crate::FieldReader<u16>;
5#[doc = "Address Not Valid\n\nValue on reset: 1"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Anv {
9    #[doc = "0: Valid"]
10    Valid = 0,
11    #[doc = "1: Not valid"]
12    NotValid = 1,
13}
14impl From<Anv> for bool {
15    #[inline(always)]
16    fn from(variant: Anv) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `ANV` reader - Address Not Valid"]
21pub type AnvR = crate::BitReader<Anv>;
22impl AnvR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Anv {
26        match self.bits {
27            false => Anv::Valid,
28            true => Anv::NotValid,
29        }
30    }
31    #[doc = "Valid"]
32    #[inline(always)]
33    pub fn is_valid(&self) -> bool {
34        *self == Anv::Valid
35    }
36    #[doc = "Not valid"]
37    #[inline(always)]
38    pub fn is_not_valid(&self) -> bool {
39        *self == Anv::NotValid
40    }
41}
42impl R {
43    #[doc = "Bits 0:10 - Received Address"]
44    #[inline(always)]
45    pub fn raddr(&self) -> RaddrR {
46        RaddrR::new((self.bits & 0x07ff) as u16)
47    }
48    #[doc = "Bit 14 - Address Not Valid"]
49    #[inline(always)]
50    pub fn anv(&self) -> AnvR {
51        AnvR::new(((self.bits >> 14) & 1) != 0)
52    }
53}
54#[cfg(feature = "debug")]
55impl core::fmt::Debug for R {
56    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
57        f.debug_struct("SASR")
58            .field("raddr", &self.raddr())
59            .field("anv", &self.anv())
60            .finish()
61    }
62}
63#[doc = "Target Address Status\n\nYou can [`read`](crate::Reg::read) this register and get [`sasr::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
64pub struct SasrSpec;
65impl crate::RegisterSpec for SasrSpec {
66    type Ux = u32;
67}
68#[doc = "`read()` method returns [`sasr::R`](R) reader structure"]
69impl crate::Readable for SasrSpec {}
70#[doc = "`reset()` method sets SASR to value 0x4000"]
71impl crate::Resettable for SasrSpec {
72    const RESET_VALUE: u32 = 0x4000;
73}