efm32gg895_pac/lesense/
st7_tconfa.rs

1#[doc = "Register `ST7_TCONFA` reader"]
2pub struct R(crate::R<ST7_TCONFA_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ST7_TCONFA_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ST7_TCONFA_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ST7_TCONFA_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ST7_TCONFA` writer"]
17pub struct W(crate::W<ST7_TCONFA_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ST7_TCONFA_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<ST7_TCONFA_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ST7_TCONFA_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `COMP` reader - Sensor compare value"]
38pub type COMP_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `COMP` writer - Sensor compare value"]
40pub type COMP_W<'a> = crate::FieldWriter<'a, u32, ST7_TCONFA_SPEC, u8, u8, 4, 0>;
41#[doc = "Field `MASK` reader - Sensor mask"]
42pub type MASK_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `MASK` writer - Sensor mask"]
44pub type MASK_W<'a> = crate::FieldWriter<'a, u32, ST7_TCONFA_SPEC, u8, u8, 4, 4>;
45#[doc = "Field `NEXTSTATE` reader - Next state index"]
46pub type NEXTSTATE_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `NEXTSTATE` writer - Next state index"]
48pub type NEXTSTATE_W<'a> = crate::FieldWriter<'a, u32, ST7_TCONFA_SPEC, u8, u8, 4, 8>;
49#[doc = "Field `PRSACT` reader - Configure transition action"]
50pub type PRSACT_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `PRSACT` writer - Configure transition action"]
52pub type PRSACT_W<'a> = crate::FieldWriter<'a, u32, ST7_TCONFA_SPEC, u8, u8, 3, 12>;
53#[doc = "Field `SETIF` reader - Set interrupt flag enable"]
54pub type SETIF_R = crate::BitReader<bool>;
55#[doc = "Field `SETIF` writer - Set interrupt flag enable"]
56pub type SETIF_W<'a> = crate::BitWriter<'a, u32, ST7_TCONFA_SPEC, bool, 16>;
57#[doc = "Field `CHAIN` reader - Enable state descriptor chaining"]
58pub type CHAIN_R = crate::BitReader<bool>;
59#[doc = "Field `CHAIN` writer - Enable state descriptor chaining"]
60pub type CHAIN_W<'a> = crate::BitWriter<'a, u32, ST7_TCONFA_SPEC, bool, 18>;
61impl R {
62    #[doc = "Bits 0:3 - Sensor compare value"]
63    #[inline(always)]
64    pub fn comp(&self) -> COMP_R {
65        COMP_R::new((self.bits & 0x0f) as u8)
66    }
67    #[doc = "Bits 4:7 - Sensor mask"]
68    #[inline(always)]
69    pub fn mask(&self) -> MASK_R {
70        MASK_R::new(((self.bits >> 4) & 0x0f) as u8)
71    }
72    #[doc = "Bits 8:11 - Next state index"]
73    #[inline(always)]
74    pub fn nextstate(&self) -> NEXTSTATE_R {
75        NEXTSTATE_R::new(((self.bits >> 8) & 0x0f) as u8)
76    }
77    #[doc = "Bits 12:14 - Configure transition action"]
78    #[inline(always)]
79    pub fn prsact(&self) -> PRSACT_R {
80        PRSACT_R::new(((self.bits >> 12) & 7) as u8)
81    }
82    #[doc = "Bit 16 - Set interrupt flag enable"]
83    #[inline(always)]
84    pub fn setif(&self) -> SETIF_R {
85        SETIF_R::new(((self.bits >> 16) & 1) != 0)
86    }
87    #[doc = "Bit 18 - Enable state descriptor chaining"]
88    #[inline(always)]
89    pub fn chain(&self) -> CHAIN_R {
90        CHAIN_R::new(((self.bits >> 18) & 1) != 0)
91    }
92}
93impl W {
94    #[doc = "Bits 0:3 - Sensor compare value"]
95    #[inline(always)]
96    pub fn comp(&mut self) -> COMP_W {
97        COMP_W::new(self)
98    }
99    #[doc = "Bits 4:7 - Sensor mask"]
100    #[inline(always)]
101    pub fn mask(&mut self) -> MASK_W {
102        MASK_W::new(self)
103    }
104    #[doc = "Bits 8:11 - Next state index"]
105    #[inline(always)]
106    pub fn nextstate(&mut self) -> NEXTSTATE_W {
107        NEXTSTATE_W::new(self)
108    }
109    #[doc = "Bits 12:14 - Configure transition action"]
110    #[inline(always)]
111    pub fn prsact(&mut self) -> PRSACT_W {
112        PRSACT_W::new(self)
113    }
114    #[doc = "Bit 16 - Set interrupt flag enable"]
115    #[inline(always)]
116    pub fn setif(&mut self) -> SETIF_W {
117        SETIF_W::new(self)
118    }
119    #[doc = "Bit 18 - Enable state descriptor chaining"]
120    #[inline(always)]
121    pub fn chain(&mut self) -> CHAIN_W {
122        CHAIN_W::new(self)
123    }
124    #[doc = "Writes raw bits to the register."]
125    #[inline(always)]
126    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
127        self.0.bits(bits);
128        self
129    }
130}
131#[doc = "State transition configuration A\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [st7_tconfa](index.html) module"]
132pub struct ST7_TCONFA_SPEC;
133impl crate::RegisterSpec for ST7_TCONFA_SPEC {
134    type Ux = u32;
135}
136#[doc = "`read()` method returns [st7_tconfa::R](R) reader structure"]
137impl crate::Readable for ST7_TCONFA_SPEC {
138    type Reader = R;
139}
140#[doc = "`write(|w| ..)` method takes [st7_tconfa::W](W) writer structure"]
141impl crate::Writable for ST7_TCONFA_SPEC {
142    type Writer = W;
143}
144#[doc = "`reset()` method sets ST7_TCONFA to value 0"]
145impl crate::Resettable for ST7_TCONFA_SPEC {
146    #[inline(always)]
147    fn reset_value() -> Self::Ux {
148        0
149    }
150}