pub type R = crate::R<OAR1rs>;
pub type W = crate::W<OAR1rs>;
pub type OA1_R = crate::FieldReader<u16>;
pub type OA1_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OA1MODE {
Bit7 = 0,
Bit10 = 1,
}
impl From<OA1MODE> for bool {
#[inline(always)]
fn from(variant: OA1MODE) -> Self {
variant as u8 != 0
}
}
pub type OA1MODE_R = crate::BitReader<OA1MODE>;
impl OA1MODE_R {
#[inline(always)]
pub const fn variant(&self) -> OA1MODE {
match self.bits {
false => OA1MODE::Bit7,
true => OA1MODE::Bit10,
}
}
#[inline(always)]
pub fn is_bit7(&self) -> bool {
*self == OA1MODE::Bit7
}
#[inline(always)]
pub fn is_bit10(&self) -> bool {
*self == OA1MODE::Bit10
}
}
pub type OA1MODE_W<'a, REG> = crate::BitWriter<'a, REG, OA1MODE>;
impl<'a, REG> OA1MODE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn bit7(self) -> &'a mut crate::W<REG> {
self.variant(OA1MODE::Bit7)
}
#[inline(always)]
pub fn bit10(self) -> &'a mut crate::W<REG> {
self.variant(OA1MODE::Bit10)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OA1EN {
Disabled = 0,
Enabled = 1,
}
impl From<OA1EN> for bool {
#[inline(always)]
fn from(variant: OA1EN) -> Self {
variant as u8 != 0
}
}
pub type OA1EN_R = crate::BitReader<OA1EN>;
impl OA1EN_R {
#[inline(always)]
pub const fn variant(&self) -> OA1EN {
match self.bits {
false => OA1EN::Disabled,
true => OA1EN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == OA1EN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == OA1EN::Enabled
}
}
pub type OA1EN_W<'a, REG> = crate::BitWriter<'a, REG, OA1EN>;
impl<'a, REG> OA1EN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(OA1EN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(OA1EN::Enabled)
}
}
impl R {
#[inline(always)]
pub fn oa1(&self) -> OA1_R {
OA1_R::new((self.bits & 0x03ff) as u16)
}
#[inline(always)]
pub fn oa1mode(&self) -> OA1MODE_R {
OA1MODE_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn oa1en(&self) -> OA1EN_R {
OA1EN_R::new(((self.bits >> 15) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("OAR1")
.field("oa1mode", &self.oa1mode())
.field("oa1en", &self.oa1en())
.field("oa1", &self.oa1())
.finish()
}
}
impl W {
#[inline(always)]
pub fn oa1(&mut self) -> OA1_W<OAR1rs> {
OA1_W::new(self, 0)
}
#[inline(always)]
pub fn oa1mode(&mut self) -> OA1MODE_W<OAR1rs> {
OA1MODE_W::new(self, 10)
}
#[inline(always)]
pub fn oa1en(&mut self) -> OA1EN_W<OAR1rs> {
OA1EN_W::new(self, 15)
}
}
pub struct OAR1rs;
impl crate::RegisterSpec for OAR1rs {
type Ux = u32;
}
impl crate::Readable for OAR1rs {}
impl crate::Writable for OAR1rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for OAR1rs {}