stm32f1_staging/stm32f101/i2c1/
oar2.rs1pub type R = crate::R<OAR2rs>;
3pub type W = crate::W<OAR2rs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum ENDUAL {
11 Single = 0,
13 Dual = 1,
15}
16impl From<ENDUAL> for bool {
17 #[inline(always)]
18 fn from(variant: ENDUAL) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type ENDUAL_R = crate::BitReader<ENDUAL>;
24impl ENDUAL_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> ENDUAL {
28 match self.bits {
29 false => ENDUAL::Single,
30 true => ENDUAL::Dual,
31 }
32 }
33 #[inline(always)]
35 pub fn is_single(&self) -> bool {
36 *self == ENDUAL::Single
37 }
38 #[inline(always)]
40 pub fn is_dual(&self) -> bool {
41 *self == ENDUAL::Dual
42 }
43}
44pub type ENDUAL_W<'a, REG> = crate::BitWriter<'a, REG, ENDUAL>;
46impl<'a, REG> ENDUAL_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn single(self) -> &'a mut crate::W<REG> {
53 self.variant(ENDUAL::Single)
54 }
55 #[inline(always)]
57 pub fn dual(self) -> &'a mut crate::W<REG> {
58 self.variant(ENDUAL::Dual)
59 }
60}
61pub type ADD2_R = crate::FieldReader;
63pub type ADD2_W<'a, REG> = crate::FieldWriter<'a, REG, 7, u8, crate::Safe>;
65impl R {
66 #[inline(always)]
68 pub fn endual(&self) -> ENDUAL_R {
69 ENDUAL_R::new((self.bits & 1) != 0)
70 }
71 #[inline(always)]
73 pub fn add2(&self) -> ADD2_R {
74 ADD2_R::new(((self.bits >> 1) & 0x7f) as u8)
75 }
76}
77impl core::fmt::Debug for R {
78 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
79 f.debug_struct("OAR2")
80 .field("add2", &self.add2())
81 .field("endual", &self.endual())
82 .finish()
83 }
84}
85impl W {
86 #[inline(always)]
88 pub fn endual(&mut self) -> ENDUAL_W<OAR2rs> {
89 ENDUAL_W::new(self, 0)
90 }
91 #[inline(always)]
93 pub fn add2(&mut self) -> ADD2_W<OAR2rs> {
94 ADD2_W::new(self, 1)
95 }
96}
97pub struct OAR2rs;
103impl crate::RegisterSpec for OAR2rs {
104 type Ux = u16;
105}
106impl crate::Readable for OAR2rs {}
108impl crate::Writable for OAR2rs {
110 type Safety = crate::Unsafe;
111}
112impl crate::Resettable for OAR2rs {}