stm32l4/stm32l4x1/dfsdm/flt/
awhtr.rs

1///Register `AWHTR` reader
2pub type R = crate::R<AWHTRrs>;
3///Register `AWHTR` writer
4pub type W = crate::W<AWHTRrs>;
5/**Break signal assignment to analog watchdog high threshold event
6
7Value on reset: 0*/
8#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum BKAWH0 {
11    ///0: Break i signal is not assigned to an analog watchdog high threshold event
12    NotAssigned = 0,
13    ///1: Break i signal is assigned to an analog watchdog high threshold event
14    Assigned = 1,
15}
16impl From<BKAWH0> for bool {
17    #[inline(always)]
18    fn from(variant: BKAWH0) -> Self {
19        variant as u8 != 0
20    }
21}
22///Field `BKAWH(0-3)` reader - Break signal assignment to analog watchdog high threshold event
23pub type BKAWH_R = crate::BitReader<BKAWH0>;
24impl BKAWH_R {
25    ///Get enumerated values variant
26    #[inline(always)]
27    pub const fn variant(&self) -> BKAWH0 {
28        match self.bits {
29            false => BKAWH0::NotAssigned,
30            true => BKAWH0::Assigned,
31        }
32    }
33    ///Break i signal is not assigned to an analog watchdog high threshold event
34    #[inline(always)]
35    pub fn is_not_assigned(&self) -> bool {
36        *self == BKAWH0::NotAssigned
37    }
38    ///Break i signal is assigned to an analog watchdog high threshold event
39    #[inline(always)]
40    pub fn is_assigned(&self) -> bool {
41        *self == BKAWH0::Assigned
42    }
43}
44///Field `BKAWH(0-3)` writer - Break signal assignment to analog watchdog high threshold event
45pub type BKAWH_W<'a, REG> = crate::BitWriter<'a, REG, BKAWH0>;
46impl<'a, REG> BKAWH_W<'a, REG>
47where
48    REG: crate::Writable + crate::RegisterSpec,
49{
50    ///Break i signal is not assigned to an analog watchdog high threshold event
51    #[inline(always)]
52    pub fn not_assigned(self) -> &'a mut crate::W<REG> {
53        self.variant(BKAWH0::NotAssigned)
54    }
55    ///Break i signal is assigned to an analog watchdog high threshold event
56    #[inline(always)]
57    pub fn assigned(self) -> &'a mut crate::W<REG> {
58        self.variant(BKAWH0::Assigned)
59    }
60}
61///Field `AWHT` reader - Analog watchdog high threshold
62pub type AWHT_R = crate::FieldReader<u32>;
63///Field `AWHT` writer - Analog watchdog high threshold
64pub type AWHT_W<'a, REG> = crate::FieldWriter<'a, REG, 24, u32, crate::Safe>;
65impl R {
66    ///Break signal assignment to analog watchdog high threshold event
67    ///
68    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `BKAWH0` field.</div>
69    #[inline(always)]
70    pub fn bkawh(&self, n: u8) -> BKAWH_R {
71        #[allow(clippy::no_effect)]
72        [(); 4][n as usize];
73        BKAWH_R::new(((self.bits >> n) & 1) != 0)
74    }
75    ///Iterator for array of:
76    ///Break signal assignment to analog watchdog high threshold event
77    #[inline(always)]
78    pub fn bkawh_iter(&self) -> impl Iterator<Item = BKAWH_R> + '_ {
79        (0..4).map(move |n| BKAWH_R::new(((self.bits >> n) & 1) != 0))
80    }
81    ///Bit 0 - Break signal assignment to analog watchdog high threshold event
82    #[inline(always)]
83    pub fn bkawh0(&self) -> BKAWH_R {
84        BKAWH_R::new((self.bits & 1) != 0)
85    }
86    ///Bit 1 - Break signal assignment to analog watchdog high threshold event
87    #[inline(always)]
88    pub fn bkawh1(&self) -> BKAWH_R {
89        BKAWH_R::new(((self.bits >> 1) & 1) != 0)
90    }
91    ///Bit 2 - Break signal assignment to analog watchdog high threshold event
92    #[inline(always)]
93    pub fn bkawh2(&self) -> BKAWH_R {
94        BKAWH_R::new(((self.bits >> 2) & 1) != 0)
95    }
96    ///Bit 3 - Break signal assignment to analog watchdog high threshold event
97    #[inline(always)]
98    pub fn bkawh3(&self) -> BKAWH_R {
99        BKAWH_R::new(((self.bits >> 3) & 1) != 0)
100    }
101    ///Bits 8:31 - Analog watchdog high threshold
102    #[inline(always)]
103    pub fn awht(&self) -> AWHT_R {
104        AWHT_R::new((self.bits >> 8) & 0x00ff_ffff)
105    }
106}
107impl core::fmt::Debug for R {
108    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
109        f.debug_struct("AWHTR")
110            .field("awht", &self.awht())
111            .field("bkawh0", &self.bkawh0())
112            .field("bkawh1", &self.bkawh1())
113            .field("bkawh2", &self.bkawh2())
114            .field("bkawh3", &self.bkawh3())
115            .finish()
116    }
117}
118impl W {
119    ///Break signal assignment to analog watchdog high threshold event
120    ///
121    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `BKAWH0` field.</div>
122    #[inline(always)]
123    pub fn bkawh(&mut self, n: u8) -> BKAWH_W<AWHTRrs> {
124        #[allow(clippy::no_effect)]
125        [(); 4][n as usize];
126        BKAWH_W::new(self, n)
127    }
128    ///Bit 0 - Break signal assignment to analog watchdog high threshold event
129    #[inline(always)]
130    pub fn bkawh0(&mut self) -> BKAWH_W<AWHTRrs> {
131        BKAWH_W::new(self, 0)
132    }
133    ///Bit 1 - Break signal assignment to analog watchdog high threshold event
134    #[inline(always)]
135    pub fn bkawh1(&mut self) -> BKAWH_W<AWHTRrs> {
136        BKAWH_W::new(self, 1)
137    }
138    ///Bit 2 - Break signal assignment to analog watchdog high threshold event
139    #[inline(always)]
140    pub fn bkawh2(&mut self) -> BKAWH_W<AWHTRrs> {
141        BKAWH_W::new(self, 2)
142    }
143    ///Bit 3 - Break signal assignment to analog watchdog high threshold event
144    #[inline(always)]
145    pub fn bkawh3(&mut self) -> BKAWH_W<AWHTRrs> {
146        BKAWH_W::new(self, 3)
147    }
148    ///Bits 8:31 - Analog watchdog high threshold
149    #[inline(always)]
150    pub fn awht(&mut self) -> AWHT_W<AWHTRrs> {
151        AWHT_W::new(self, 8)
152    }
153}
154/**analog watchdog high threshold register
155
156You can [`read`](crate::Reg::read) this register and get [`awhtr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`awhtr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).*/
157pub struct AWHTRrs;
158impl crate::RegisterSpec for AWHTRrs {
159    type Ux = u32;
160}
161///`read()` method returns [`awhtr::R`](R) reader structure
162impl crate::Readable for AWHTRrs {}
163///`write(|w| ..)` method takes [`awhtr::W`](W) writer structure
164impl crate::Writable for AWHTRrs {
165    type Safety = crate::Unsafe;
166}
167///`reset()` method sets AWHTR to value 0
168impl crate::Resettable for AWHTRrs {}