pub type R = crate::R<OTYPERrs>;
pub type W = crate::W<OTYPERrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OUTPUT_TYPE {
PushPull = 0,
OpenDrain = 1,
}
impl From<OUTPUT_TYPE> for bool {
#[inline(always)]
fn from(variant: OUTPUT_TYPE) -> Self {
variant as u8 != 0
}
}
pub type OT_R = crate::BitReader<OUTPUT_TYPE>;
impl OT_R {
#[inline(always)]
pub const fn variant(&self) -> OUTPUT_TYPE {
match self.bits {
false => OUTPUT_TYPE::PushPull,
true => OUTPUT_TYPE::OpenDrain,
}
}
#[inline(always)]
pub fn is_push_pull(&self) -> bool {
*self == OUTPUT_TYPE::PushPull
}
#[inline(always)]
pub fn is_open_drain(&self) -> bool {
*self == OUTPUT_TYPE::OpenDrain
}
}
pub type OT_W<'a, REG> = crate::BitWriter<'a, REG, OUTPUT_TYPE>;
impl<'a, REG> OT_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn push_pull(self) -> &'a mut crate::W<REG> {
self.variant(OUTPUT_TYPE::PushPull)
}
#[inline(always)]
pub fn open_drain(self) -> &'a mut crate::W<REG> {
self.variant(OUTPUT_TYPE::OpenDrain)
}
}
impl R {
#[inline(always)]
pub fn ot(&self, n: u8) -> OT_R {
#[allow(clippy::no_effect)]
[(); 16][n as usize];
OT_R::new(((self.bits >> n) & 1) != 0)
}
#[inline(always)]
pub fn ot_iter(&self) -> impl Iterator<Item = OT_R> + '_ {
(0..16).map(move |n| OT_R::new(((self.bits >> n) & 1) != 0))
}
#[inline(always)]
pub fn ot0(&self) -> OT_R {
OT_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn ot1(&self) -> OT_R {
OT_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn ot2(&self) -> OT_R {
OT_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn ot3(&self) -> OT_R {
OT_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn ot4(&self) -> OT_R {
OT_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn ot5(&self) -> OT_R {
OT_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn ot6(&self) -> OT_R {
OT_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn ot7(&self) -> OT_R {
OT_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn ot8(&self) -> OT_R {
OT_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn ot9(&self) -> OT_R {
OT_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn ot10(&self) -> OT_R {
OT_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn ot11(&self) -> OT_R {
OT_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn ot12(&self) -> OT_R {
OT_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn ot13(&self) -> OT_R {
OT_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn ot14(&self) -> OT_R {
OT_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn ot15(&self) -> OT_R {
OT_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("OTYPER")
.field("ot0", &self.ot0())
.field("ot1", &self.ot1())
.field("ot2", &self.ot2())
.field("ot3", &self.ot3())
.field("ot4", &self.ot4())
.field("ot5", &self.ot5())
.field("ot6", &self.ot6())
.field("ot7", &self.ot7())
.field("ot8", &self.ot8())
.field("ot9", &self.ot9())
.field("ot10", &self.ot10())
.field("ot11", &self.ot11())
.field("ot12", &self.ot12())
.field("ot13", &self.ot13())
.field("ot14", &self.ot14())
.field("ot15", &self.ot15())
.finish()
}
}
impl W {
#[inline(always)]
pub fn ot(&mut self, n: u8) -> OT_W<OTYPERrs> {
#[allow(clippy::no_effect)]
[(); 16][n as usize];
OT_W::new(self, n)
}
#[inline(always)]
pub fn ot0(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 0)
}
#[inline(always)]
pub fn ot1(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 1)
}
#[inline(always)]
pub fn ot2(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 2)
}
#[inline(always)]
pub fn ot3(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 3)
}
#[inline(always)]
pub fn ot4(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 4)
}
#[inline(always)]
pub fn ot5(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 5)
}
#[inline(always)]
pub fn ot6(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 6)
}
#[inline(always)]
pub fn ot7(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 7)
}
#[inline(always)]
pub fn ot8(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 8)
}
#[inline(always)]
pub fn ot9(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 9)
}
#[inline(always)]
pub fn ot10(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 10)
}
#[inline(always)]
pub fn ot11(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 11)
}
#[inline(always)]
pub fn ot12(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 12)
}
#[inline(always)]
pub fn ot13(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 13)
}
#[inline(always)]
pub fn ot14(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 14)
}
#[inline(always)]
pub fn ot15(&mut self) -> OT_W<OTYPERrs> {
OT_W::new(self, 15)
}
}
pub struct OTYPERrs;
impl crate::RegisterSpec for OTYPERrs {
type Ux = u32;
}
impl crate::Readable for OTYPERrs {}
impl crate::Writable for OTYPERrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for OTYPERrs {}