stm32f1_staging/stm32f103/i2c1/
oar2.rspub type R = crate::R<OAR2rs>;
pub type W = crate::W<OAR2rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ENDUAL {
Single = 0,
Dual = 1,
}
impl From<ENDUAL> for bool {
#[inline(always)]
fn from(variant: ENDUAL) -> Self {
variant as u8 != 0
}
}
pub type ENDUAL_R = crate::BitReader<ENDUAL>;
impl ENDUAL_R {
#[inline(always)]
pub const fn variant(&self) -> ENDUAL {
match self.bits {
false => ENDUAL::Single,
true => ENDUAL::Dual,
}
}
#[inline(always)]
pub fn is_single(&self) -> bool {
*self == ENDUAL::Single
}
#[inline(always)]
pub fn is_dual(&self) -> bool {
*self == ENDUAL::Dual
}
}
pub type ENDUAL_W<'a, REG> = crate::BitWriter<'a, REG, ENDUAL>;
impl<'a, REG> ENDUAL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn single(self) -> &'a mut crate::W<REG> {
self.variant(ENDUAL::Single)
}
#[inline(always)]
pub fn dual(self) -> &'a mut crate::W<REG> {
self.variant(ENDUAL::Dual)
}
}
pub type ADD2_R = crate::FieldReader;
pub type ADD2_W<'a, REG> = crate::FieldWriter<'a, REG, 7, u8, crate::Safe>;
impl R {
#[inline(always)]
pub fn endual(&self) -> ENDUAL_R {
ENDUAL_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn add2(&self) -> ADD2_R {
ADD2_R::new(((self.bits >> 1) & 0x7f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("OAR2")
.field("add2", &self.add2())
.field("endual", &self.endual())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn endual(&mut self) -> ENDUAL_W<OAR2rs> {
ENDUAL_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn add2(&mut self) -> ADD2_W<OAR2rs> {
ADD2_W::new(self, 1)
}
}
pub struct OAR2rs;
impl crate::RegisterSpec for OAR2rs {
type Ux = u32;
}
impl crate::Readable for OAR2rs {}
impl crate::Writable for OAR2rs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
impl crate::Resettable for OAR2rs {
const RESET_VALUE: u32 = 0;
}