efm32pg12_pac/lesense/
st0_tconfa.rs

1#[doc = "Reader of register ST0_TCONFA"]
2pub type R = crate::R<u32, super::ST0_TCONFA>;
3#[doc = "Writer for register ST0_TCONFA"]
4pub type W = crate::W<u32, super::ST0_TCONFA>;
5#[doc = "Register ST0_TCONFA `reset()`'s with value 0"]
6impl crate::ResetValue for super::ST0_TCONFA {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `COMP`"]
14pub type COMP_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `COMP`"]
16pub struct COMP_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> COMP_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
24        self.w
25    }
26}
27#[doc = "Reader of field `MASK`"]
28pub type MASK_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `MASK`"]
30pub struct MASK_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> MASK_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x0f << 4)) | (((value as u32) & 0x0f) << 4);
38        self.w
39    }
40}
41#[doc = "Reader of field `NEXTSTATE`"]
42pub type NEXTSTATE_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `NEXTSTATE`"]
44pub struct NEXTSTATE_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> NEXTSTATE_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x1f << 8)) | (((value as u32) & 0x1f) << 8);
52        self.w
53    }
54}
55#[doc = "Reader of field `CHAIN`"]
56pub type CHAIN_R = crate::R<bool, bool>;
57#[doc = "Write proxy for field `CHAIN`"]
58pub struct CHAIN_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> CHAIN_W<'a> {
62    #[doc = r"Sets the field bit"]
63    #[inline(always)]
64    pub fn set_bit(self) -> &'a mut W {
65        self.bit(true)
66    }
67    #[doc = r"Clears the field bit"]
68    #[inline(always)]
69    pub fn clear_bit(self) -> &'a mut W {
70        self.bit(false)
71    }
72    #[doc = r"Writes raw bits to the field"]
73    #[inline(always)]
74    pub fn bit(self, value: bool) -> &'a mut W {
75        self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
76        self.w
77    }
78}
79#[doc = "Reader of field `SETIF`"]
80pub type SETIF_R = crate::R<bool, bool>;
81#[doc = "Write proxy for field `SETIF`"]
82pub struct SETIF_W<'a> {
83    w: &'a mut W,
84}
85impl<'a> SETIF_W<'a> {
86    #[doc = r"Sets the field bit"]
87    #[inline(always)]
88    pub fn set_bit(self) -> &'a mut W {
89        self.bit(true)
90    }
91    #[doc = r"Clears the field bit"]
92    #[inline(always)]
93    pub fn clear_bit(self) -> &'a mut W {
94        self.bit(false)
95    }
96    #[doc = r"Writes raw bits to the field"]
97    #[inline(always)]
98    pub fn bit(self, value: bool) -> &'a mut W {
99        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
100        self.w
101    }
102}
103#[doc = "Reader of field `PRSACT`"]
104pub type PRSACT_R = crate::R<u8, u8>;
105#[doc = "Write proxy for field `PRSACT`"]
106pub struct PRSACT_W<'a> {
107    w: &'a mut W,
108}
109impl<'a> PRSACT_W<'a> {
110    #[doc = r"Writes raw bits to the field"]
111    #[inline(always)]
112    pub unsafe fn bits(self, value: u8) -> &'a mut W {
113        self.w.bits = (self.w.bits & !(0x07 << 16)) | (((value as u32) & 0x07) << 16);
114        self.w
115    }
116}
117impl R {
118    #[doc = "Bits 0:3 - Sensor Compare Value"]
119    #[inline(always)]
120    pub fn comp(&self) -> COMP_R {
121        COMP_R::new((self.bits & 0x0f) as u8)
122    }
123    #[doc = "Bits 4:7 - Sensor Mask"]
124    #[inline(always)]
125    pub fn mask(&self) -> MASK_R {
126        MASK_R::new(((self.bits >> 4) & 0x0f) as u8)
127    }
128    #[doc = "Bits 8:12 - Next State Index"]
129    #[inline(always)]
130    pub fn nextstate(&self) -> NEXTSTATE_R {
131        NEXTSTATE_R::new(((self.bits >> 8) & 0x1f) as u8)
132    }
133    #[doc = "Bit 14 - Enable State Descriptor Chaining"]
134    #[inline(always)]
135    pub fn chain(&self) -> CHAIN_R {
136        CHAIN_R::new(((self.bits >> 14) & 0x01) != 0)
137    }
138    #[doc = "Bit 15 - Set Interrupt Flag Enable"]
139    #[inline(always)]
140    pub fn setif(&self) -> SETIF_R {
141        SETIF_R::new(((self.bits >> 15) & 0x01) != 0)
142    }
143    #[doc = "Bits 16:18 - Configure Transition Action"]
144    #[inline(always)]
145    pub fn prsact(&self) -> PRSACT_R {
146        PRSACT_R::new(((self.bits >> 16) & 0x07) as u8)
147    }
148}
149impl W {
150    #[doc = "Bits 0:3 - Sensor Compare Value"]
151    #[inline(always)]
152    pub fn comp(&mut self) -> COMP_W {
153        COMP_W { w: self }
154    }
155    #[doc = "Bits 4:7 - Sensor Mask"]
156    #[inline(always)]
157    pub fn mask(&mut self) -> MASK_W {
158        MASK_W { w: self }
159    }
160    #[doc = "Bits 8:12 - Next State Index"]
161    #[inline(always)]
162    pub fn nextstate(&mut self) -> NEXTSTATE_W {
163        NEXTSTATE_W { w: self }
164    }
165    #[doc = "Bit 14 - Enable State Descriptor Chaining"]
166    #[inline(always)]
167    pub fn chain(&mut self) -> CHAIN_W {
168        CHAIN_W { w: self }
169    }
170    #[doc = "Bit 15 - Set Interrupt Flag Enable"]
171    #[inline(always)]
172    pub fn setif(&mut self) -> SETIF_W {
173        SETIF_W { w: self }
174    }
175    #[doc = "Bits 16:18 - Configure Transition Action"]
176    #[inline(always)]
177    pub fn prsact(&mut self) -> PRSACT_W {
178        PRSACT_W { w: self }
179    }
180}