lpc55s6x_pac/sdif/
cardthrctl.rs

1#[doc = "Reader of register CARDTHRCTL"]
2pub type R = crate::R<u32, super::CARDTHRCTL>;
3#[doc = "Writer for register CARDTHRCTL"]
4pub type W = crate::W<u32, super::CARDTHRCTL>;
5#[doc = "Register CARDTHRCTL `reset()`'s with value 0"]
6impl crate::ResetValue for super::CARDTHRCTL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `CARDRDTHREN`"]
14pub type CARDRDTHREN_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `CARDRDTHREN`"]
16pub struct CARDRDTHREN_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> CARDRDTHREN_W<'a> {
20    #[doc = r"Sets the field bit"]
21    #[inline(always)]
22    pub fn set_bit(self) -> &'a mut W {
23        self.bit(true)
24    }
25    #[doc = r"Clears the field bit"]
26    #[inline(always)]
27    pub fn clear_bit(self) -> &'a mut W {
28        self.bit(false)
29    }
30    #[doc = r"Writes raw bits to the field"]
31    #[inline(always)]
32    pub fn bit(self, value: bool) -> &'a mut W {
33        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
34        self.w
35    }
36}
37#[doc = "Reader of field `BSYCLRINTEN`"]
38pub type BSYCLRINTEN_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `BSYCLRINTEN`"]
40pub struct BSYCLRINTEN_W<'a> {
41    w: &'a mut W,
42}
43impl<'a> BSYCLRINTEN_W<'a> {
44    #[doc = r"Sets the field bit"]
45    #[inline(always)]
46    pub fn set_bit(self) -> &'a mut W {
47        self.bit(true)
48    }
49    #[doc = r"Clears the field bit"]
50    #[inline(always)]
51    pub fn clear_bit(self) -> &'a mut W {
52        self.bit(false)
53    }
54    #[doc = r"Writes raw bits to the field"]
55    #[inline(always)]
56    pub fn bit(self, value: bool) -> &'a mut W {
57        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
58        self.w
59    }
60}
61#[doc = "Reader of field `CARDTHRESHOLD`"]
62pub type CARDTHRESHOLD_R = crate::R<u8, u8>;
63#[doc = "Write proxy for field `CARDTHRESHOLD`"]
64pub struct CARDTHRESHOLD_W<'a> {
65    w: &'a mut W,
66}
67impl<'a> CARDTHRESHOLD_W<'a> {
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub unsafe fn bits(self, value: u8) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0xff << 16)) | (((value as u32) & 0xff) << 16);
72        self.w
73    }
74}
75impl R {
76    #[doc = "Bit 0 - Card Read Threshold Enable."]
77    #[inline(always)]
78    pub fn cardrdthren(&self) -> CARDRDTHREN_R {
79        CARDRDTHREN_R::new((self.bits & 0x01) != 0)
80    }
81    #[doc = "Bit 1 - Busy Clear Interrupt Enable."]
82    #[inline(always)]
83    pub fn bsyclrinten(&self) -> BSYCLRINTEN_R {
84        BSYCLRINTEN_R::new(((self.bits >> 1) & 0x01) != 0)
85    }
86    #[doc = "Bits 16:23 - Card Threshold size."]
87    #[inline(always)]
88    pub fn cardthreshold(&self) -> CARDTHRESHOLD_R {
89        CARDTHRESHOLD_R::new(((self.bits >> 16) & 0xff) as u8)
90    }
91}
92impl W {
93    #[doc = "Bit 0 - Card Read Threshold Enable."]
94    #[inline(always)]
95    pub fn cardrdthren(&mut self) -> CARDRDTHREN_W {
96        CARDRDTHREN_W { w: self }
97    }
98    #[doc = "Bit 1 - Busy Clear Interrupt Enable."]
99    #[inline(always)]
100    pub fn bsyclrinten(&mut self) -> BSYCLRINTEN_W {
101        BSYCLRINTEN_W { w: self }
102    }
103    #[doc = "Bits 16:23 - Card Threshold size."]
104    #[inline(always)]
105    pub fn cardthreshold(&mut self) -> CARDTHRESHOLD_W {
106        CARDTHRESHOLD_W { w: self }
107    }
108}