stm32g4_staging/stm32g484/aes/
sr.rs

1///Register `SR` reader
2pub type R = crate::R<SRrs>;
3/**Computation complete flag
4
5Value on reset: 0*/
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum CCF {
9    ///0: Computation complete
10    Complete = 0,
11    ///1: Computation not complete
12    NotComplete = 1,
13}
14impl From<CCF> for bool {
15    #[inline(always)]
16    fn from(variant: CCF) -> Self {
17        variant as u8 != 0
18    }
19}
20///Field `CCF` reader - Computation complete flag
21pub type CCF_R = crate::BitReader<CCF>;
22impl CCF_R {
23    ///Get enumerated values variant
24    #[inline(always)]
25    pub const fn variant(&self) -> CCF {
26        match self.bits {
27            false => CCF::Complete,
28            true => CCF::NotComplete,
29        }
30    }
31    ///Computation complete
32    #[inline(always)]
33    pub fn is_complete(&self) -> bool {
34        *self == CCF::Complete
35    }
36    ///Computation not complete
37    #[inline(always)]
38    pub fn is_not_complete(&self) -> bool {
39        *self == CCF::NotComplete
40    }
41}
42/**Read error flag
43
44Value on reset: 0*/
45#[cfg_attr(feature = "defmt", derive(defmt::Format))]
46#[derive(Clone, Copy, Debug, PartialEq, Eq)]
47pub enum RDERR {
48    ///0: Read error not detected
49    NoError = 0,
50    ///1: Read error detected
51    Error = 1,
52}
53impl From<RDERR> for bool {
54    #[inline(always)]
55    fn from(variant: RDERR) -> Self {
56        variant as u8 != 0
57    }
58}
59///Field `RDERR` reader - Read error flag
60pub type RDERR_R = crate::BitReader<RDERR>;
61impl RDERR_R {
62    ///Get enumerated values variant
63    #[inline(always)]
64    pub const fn variant(&self) -> RDERR {
65        match self.bits {
66            false => RDERR::NoError,
67            true => RDERR::Error,
68        }
69    }
70    ///Read error not detected
71    #[inline(always)]
72    pub fn is_no_error(&self) -> bool {
73        *self == RDERR::NoError
74    }
75    ///Read error detected
76    #[inline(always)]
77    pub fn is_error(&self) -> bool {
78        *self == RDERR::Error
79    }
80}
81/**Write error flag
82
83Value on reset: 0*/
84#[cfg_attr(feature = "defmt", derive(defmt::Format))]
85#[derive(Clone, Copy, Debug, PartialEq, Eq)]
86pub enum WRERR {
87    ///0: Write error not detected
88    NoError = 0,
89    ///1: Write error detected
90    Error = 1,
91}
92impl From<WRERR> for bool {
93    #[inline(always)]
94    fn from(variant: WRERR) -> Self {
95        variant as u8 != 0
96    }
97}
98///Field `WRERR` reader - Write error flag
99pub type WRERR_R = crate::BitReader<WRERR>;
100impl WRERR_R {
101    ///Get enumerated values variant
102    #[inline(always)]
103    pub const fn variant(&self) -> WRERR {
104        match self.bits {
105            false => WRERR::NoError,
106            true => WRERR::Error,
107        }
108    }
109    ///Write error not detected
110    #[inline(always)]
111    pub fn is_no_error(&self) -> bool {
112        *self == WRERR::NoError
113    }
114    ///Write error detected
115    #[inline(always)]
116    pub fn is_error(&self) -> bool {
117        *self == WRERR::Error
118    }
119}
120/**BUSY
121
122Value on reset: 0*/
123#[cfg_attr(feature = "defmt", derive(defmt::Format))]
124#[derive(Clone, Copy, Debug, PartialEq, Eq)]
125pub enum BUSY {
126    ///0: Idle
127    Idle = 0,
128    ///1: Busy
129    Busy = 1,
130}
131impl From<BUSY> for bool {
132    #[inline(always)]
133    fn from(variant: BUSY) -> Self {
134        variant as u8 != 0
135    }
136}
137///Field `BUSY` reader - BUSY
138pub type BUSY_R = crate::BitReader<BUSY>;
139impl BUSY_R {
140    ///Get enumerated values variant
141    #[inline(always)]
142    pub const fn variant(&self) -> BUSY {
143        match self.bits {
144            false => BUSY::Idle,
145            true => BUSY::Busy,
146        }
147    }
148    ///Idle
149    #[inline(always)]
150    pub fn is_idle(&self) -> bool {
151        *self == BUSY::Idle
152    }
153    ///Busy
154    #[inline(always)]
155    pub fn is_busy(&self) -> bool {
156        *self == BUSY::Busy
157    }
158}
159impl R {
160    ///Bit 0 - Computation complete flag
161    #[inline(always)]
162    pub fn ccf(&self) -> CCF_R {
163        CCF_R::new((self.bits & 1) != 0)
164    }
165    ///Bit 1 - Read error flag
166    #[inline(always)]
167    pub fn rderr(&self) -> RDERR_R {
168        RDERR_R::new(((self.bits >> 1) & 1) != 0)
169    }
170    ///Bit 2 - Write error flag
171    #[inline(always)]
172    pub fn wrerr(&self) -> WRERR_R {
173        WRERR_R::new(((self.bits >> 2) & 1) != 0)
174    }
175    ///Bit 3 - BUSY
176    #[inline(always)]
177    pub fn busy(&self) -> BUSY_R {
178        BUSY_R::new(((self.bits >> 3) & 1) != 0)
179    }
180}
181impl core::fmt::Debug for R {
182    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
183        f.debug_struct("SR")
184            .field("busy", &self.busy())
185            .field("wrerr", &self.wrerr())
186            .field("rderr", &self.rderr())
187            .field("ccf", &self.ccf())
188            .finish()
189    }
190}
191/**status register
192
193You can [`read`](crate::Reg::read) this register and get [`sr::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api).
194
195See register [structure](https://stm32-rs.github.io/stm32-rs/STM32G484.html#AES:SR)*/
196pub struct SRrs;
197impl crate::RegisterSpec for SRrs {
198    type Ux = u32;
199}
200///`read()` method returns [`sr::R`](R) reader structure
201impl crate::Readable for SRrs {}
202///`reset()` method sets SR to value 0
203impl crate::Resettable for SRrs {
204    const RESET_VALUE: u32 = 0;
205}