d1_pac/smhc/
smhc_csdc.rs

1#[doc = "Register `smhc_csdc` reader"]
2pub type R = crate::R<SMHC_CSDC_SPEC>;
3#[doc = "Register `smhc_csdc` writer"]
4pub type W = crate::W<SMHC_CSDC_SPEC>;
5#[doc = "Field `crc_det_para` reader - "]
6pub type CRC_DET_PARA_R = crate::FieldReader<CRC_DET_PARA_A>;
7#[doc = "\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum CRC_DET_PARA_A {
11    #[doc = "6: `110`"]
12    HS400 = 6,
13    #[doc = "3: `11`"]
14    OTHER = 3,
15}
16impl From<CRC_DET_PARA_A> for u8 {
17    #[inline(always)]
18    fn from(variant: CRC_DET_PARA_A) -> Self {
19        variant as _
20    }
21}
22impl crate::FieldSpec for CRC_DET_PARA_A {
23    type Ux = u8;
24}
25impl CRC_DET_PARA_R {
26    #[doc = "Get enumerated values variant"]
27    #[inline(always)]
28    pub const fn variant(&self) -> Option<CRC_DET_PARA_A> {
29        match self.bits {
30            6 => Some(CRC_DET_PARA_A::HS400),
31            3 => Some(CRC_DET_PARA_A::OTHER),
32            _ => None,
33        }
34    }
35    #[doc = "`110`"]
36    #[inline(always)]
37    pub fn is_hs400(&self) -> bool {
38        *self == CRC_DET_PARA_A::HS400
39    }
40    #[doc = "`11`"]
41    #[inline(always)]
42    pub fn is_other(&self) -> bool {
43        *self == CRC_DET_PARA_A::OTHER
44    }
45}
46#[doc = "Field `crc_det_para` writer - "]
47pub type CRC_DET_PARA_W<'a, REG> = crate::FieldWriter<'a, REG, 4, CRC_DET_PARA_A>;
48impl<'a, REG> CRC_DET_PARA_W<'a, REG>
49where
50    REG: crate::Writable + crate::RegisterSpec,
51    REG::Ux: From<u8>,
52{
53    #[doc = "`110`"]
54    #[inline(always)]
55    pub fn hs400(self) -> &'a mut crate::W<REG> {
56        self.variant(CRC_DET_PARA_A::HS400)
57    }
58    #[doc = "`11`"]
59    #[inline(always)]
60    pub fn other(self) -> &'a mut crate::W<REG> {
61        self.variant(CRC_DET_PARA_A::OTHER)
62    }
63}
64impl R {
65    #[doc = "Bits 0:3"]
66    #[inline(always)]
67    pub fn crc_det_para(&self) -> CRC_DET_PARA_R {
68        CRC_DET_PARA_R::new((self.bits & 0x0f) as u8)
69    }
70}
71impl W {
72    #[doc = "Bits 0:3"]
73    #[inline(always)]
74    #[must_use]
75    pub fn crc_det_para(&mut self) -> CRC_DET_PARA_W<SMHC_CSDC_SPEC> {
76        CRC_DET_PARA_W::new(self, 0)
77    }
78    #[doc = r" Writes raw bits to the register."]
79    #[doc = r""]
80    #[doc = r" # Safety"]
81    #[doc = r""]
82    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
83    #[inline(always)]
84    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
85        self.bits = bits;
86        self
87    }
88}
89#[doc = "CRC Status Detect Control Registers\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`smhc_csdc::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`smhc_csdc::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
90pub struct SMHC_CSDC_SPEC;
91impl crate::RegisterSpec for SMHC_CSDC_SPEC {
92    type Ux = u32;
93}
94#[doc = "`read()` method returns [`smhc_csdc::R`](R) reader structure"]
95impl crate::Readable for SMHC_CSDC_SPEC {}
96#[doc = "`write(|w| ..)` method takes [`smhc_csdc::W`](W) writer structure"]
97impl crate::Writable for SMHC_CSDC_SPEC {
98    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
99    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
100}
101#[doc = "`reset()` method sets smhc_csdc to value 0"]
102impl crate::Resettable for SMHC_CSDC_SPEC {
103    const RESET_VALUE: Self::Ux = 0;
104}