stm32f1_staging/stm32f100/dac/
sr.rs1pub type R = crate::R<SRrs>;
3pub type W = crate::W<SRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum DMAUDR1 {
11 NoUnderrun = 0,
13 Underrun = 1,
15}
16impl From<DMAUDR1> for bool {
17 #[inline(always)]
18 fn from(variant: DMAUDR1) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type DMAUDR1_R = crate::BitReader<DMAUDR1>;
24impl DMAUDR1_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> DMAUDR1 {
28 match self.bits {
29 false => DMAUDR1::NoUnderrun,
30 true => DMAUDR1::Underrun,
31 }
32 }
33 #[inline(always)]
35 pub fn is_no_underrun(&self) -> bool {
36 *self == DMAUDR1::NoUnderrun
37 }
38 #[inline(always)]
40 pub fn is_underrun(&self) -> bool {
41 *self == DMAUDR1::Underrun
42 }
43}
44pub type DMAUDR1_W<'a, REG> = crate::BitWriter<'a, REG, DMAUDR1>;
46impl<'a, REG> DMAUDR1_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn no_underrun(self) -> &'a mut crate::W<REG> {
53 self.variant(DMAUDR1::NoUnderrun)
54 }
55 #[inline(always)]
57 pub fn underrun(self) -> &'a mut crate::W<REG> {
58 self.variant(DMAUDR1::Underrun)
59 }
60}
61pub use DMAUDR1_R as DMAUDR2_R;
63pub use DMAUDR1_W as DMAUDR2_W;
65impl R {
66 #[inline(always)]
68 pub fn dmaudr1(&self) -> DMAUDR1_R {
69 DMAUDR1_R::new(((self.bits >> 13) & 1) != 0)
70 }
71 #[inline(always)]
73 pub fn dmaudr2(&self) -> DMAUDR2_R {
74 DMAUDR2_R::new(((self.bits >> 29) & 1) != 0)
75 }
76}
77impl core::fmt::Debug for R {
78 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
79 f.debug_struct("SR")
80 .field("dmaudr1", &self.dmaudr1())
81 .field("dmaudr2", &self.dmaudr2())
82 .finish()
83 }
84}
85impl W {
86 #[inline(always)]
88 pub fn dmaudr1(&mut self) -> DMAUDR1_W<SRrs> {
89 DMAUDR1_W::new(self, 13)
90 }
91 #[inline(always)]
93 pub fn dmaudr2(&mut self) -> DMAUDR2_W<SRrs> {
94 DMAUDR2_W::new(self, 29)
95 }
96}
97pub struct SRrs;
103impl crate::RegisterSpec for SRrs {
104 type Ux = u32;
105}
106impl crate::Readable for SRrs {}
108impl crate::Writable for SRrs {
110 type Safety = crate::Unsafe;
111}
112impl crate::Resettable for SRrs {}