pub type R = crate::R<MODELrs>;
pub type W = crate::W<MODELrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MODE0 {
Disabled = 0,
Input = 1,
Inputpull = 2,
Inputpullfilter = 3,
Pushpull = 4,
Pushpullalt = 5,
Wiredor = 6,
Wiredorpulldown = 7,
Wiredand = 8,
Wiredandfilter = 9,
Wiredandpullup = 10,
Wiredandpullupfilter = 11,
Wiredandalt = 12,
Wiredandaltfilter = 13,
Wiredandaltpullup = 14,
Wiredandaltpullupfilter = 15,
}
impl From<MODE0> for u8 {
#[inline(always)]
fn from(variant: MODE0) -> Self {
variant as _
}
}
impl crate::FieldSpec for MODE0 {
type Ux = u8;
}
impl crate::IsEnum for MODE0 {}
pub type Mode0R = crate::FieldReader<MODE0>;
impl Mode0R {
#[inline(always)]
pub const fn variant(&self) -> MODE0 {
match self.bits {
0 => MODE0::Disabled,
1 => MODE0::Input,
2 => MODE0::Inputpull,
3 => MODE0::Inputpullfilter,
4 => MODE0::Pushpull,
5 => MODE0::Pushpullalt,
6 => MODE0::Wiredor,
7 => MODE0::Wiredorpulldown,
8 => MODE0::Wiredand,
9 => MODE0::Wiredandfilter,
10 => MODE0::Wiredandpullup,
11 => MODE0::Wiredandpullupfilter,
12 => MODE0::Wiredandalt,
13 => MODE0::Wiredandaltfilter,
14 => MODE0::Wiredandaltpullup,
15 => MODE0::Wiredandaltpullupfilter,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == MODE0::Disabled
}
#[inline(always)]
pub fn is_input(&self) -> bool {
*self == MODE0::Input
}
#[inline(always)]
pub fn is_inputpull(&self) -> bool {
*self == MODE0::Inputpull
}
#[inline(always)]
pub fn is_inputpullfilter(&self) -> bool {
*self == MODE0::Inputpullfilter
}
#[inline(always)]
pub fn is_pushpull(&self) -> bool {
*self == MODE0::Pushpull
}
#[inline(always)]
pub fn is_pushpullalt(&self) -> bool {
*self == MODE0::Pushpullalt
}
#[inline(always)]
pub fn is_wiredor(&self) -> bool {
*self == MODE0::Wiredor
}
#[inline(always)]
pub fn is_wiredorpulldown(&self) -> bool {
*self == MODE0::Wiredorpulldown
}
#[inline(always)]
pub fn is_wiredand(&self) -> bool {
*self == MODE0::Wiredand
}
#[inline(always)]
pub fn is_wiredandfilter(&self) -> bool {
*self == MODE0::Wiredandfilter
}
#[inline(always)]
pub fn is_wiredandpullup(&self) -> bool {
*self == MODE0::Wiredandpullup
}
#[inline(always)]
pub fn is_wiredandpullupfilter(&self) -> bool {
*self == MODE0::Wiredandpullupfilter
}
#[inline(always)]
pub fn is_wiredandalt(&self) -> bool {
*self == MODE0::Wiredandalt
}
#[inline(always)]
pub fn is_wiredandaltfilter(&self) -> bool {
*self == MODE0::Wiredandaltfilter
}
#[inline(always)]
pub fn is_wiredandaltpullup(&self) -> bool {
*self == MODE0::Wiredandaltpullup
}
#[inline(always)]
pub fn is_wiredandaltpullupfilter(&self) -> bool {
*self == MODE0::Wiredandaltpullupfilter
}
}
pub type Mode0W<'a, REG> = crate::FieldWriter<'a, REG, 4, MODE0, crate::Safe>;
impl<'a, REG> Mode0W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Disabled)
}
#[inline(always)]
pub fn input(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Input)
}
#[inline(always)]
pub fn inputpull(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Inputpull)
}
#[inline(always)]
pub fn inputpullfilter(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Inputpullfilter)
}
#[inline(always)]
pub fn pushpull(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Pushpull)
}
#[inline(always)]
pub fn pushpullalt(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Pushpullalt)
}
#[inline(always)]
pub fn wiredor(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Wiredor)
}
#[inline(always)]
pub fn wiredorpulldown(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Wiredorpulldown)
}
#[inline(always)]
pub fn wiredand(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Wiredand)
}
#[inline(always)]
pub fn wiredandfilter(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Wiredandfilter)
}
#[inline(always)]
pub fn wiredandpullup(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Wiredandpullup)
}
#[inline(always)]
pub fn wiredandpullupfilter(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Wiredandpullupfilter)
}
#[inline(always)]
pub fn wiredandalt(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Wiredandalt)
}
#[inline(always)]
pub fn wiredandaltfilter(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Wiredandaltfilter)
}
#[inline(always)]
pub fn wiredandaltpullup(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Wiredandaltpullup)
}
#[inline(always)]
pub fn wiredandaltpullupfilter(self) -> &'a mut crate::W<REG> {
self.variant(MODE0::Wiredandaltpullupfilter)
}
}
pub use Mode0R as Mode1R;
pub use Mode0R as Mode2R;
pub use Mode0R as Mode3R;
pub use Mode0R as Mode4R;
pub use Mode0R as Mode5R;
pub use Mode0R as Mode6R;
pub use Mode0R as Mode7R;
pub use Mode0W as Mode1W;
pub use Mode0W as Mode2W;
pub use Mode0W as Mode3W;
pub use Mode0W as Mode4W;
pub use Mode0W as Mode5W;
pub use Mode0W as Mode6W;
pub use Mode0W as Mode7W;
pub use MODE0 as MODE1;
pub use MODE0 as MODE2;
pub use MODE0 as MODE3;
pub use MODE0 as MODE4;
pub use MODE0 as MODE5;
pub use MODE0 as MODE6;
pub use MODE0 as MODE7;
impl R {
#[inline(always)]
pub fn mode0(&self) -> Mode0R {
Mode0R::new((self.bits & 0x0f) as u8)
}
#[inline(always)]
pub fn mode1(&self) -> Mode1R {
Mode1R::new(((self.bits >> 4) & 0x0f) as u8)
}
#[inline(always)]
pub fn mode2(&self) -> Mode2R {
Mode2R::new(((self.bits >> 8) & 0x0f) as u8)
}
#[inline(always)]
pub fn mode3(&self) -> Mode3R {
Mode3R::new(((self.bits >> 12) & 0x0f) as u8)
}
#[inline(always)]
pub fn mode4(&self) -> Mode4R {
Mode4R::new(((self.bits >> 16) & 0x0f) as u8)
}
#[inline(always)]
pub fn mode5(&self) -> Mode5R {
Mode5R::new(((self.bits >> 20) & 0x0f) as u8)
}
#[inline(always)]
pub fn mode6(&self) -> Mode6R {
Mode6R::new(((self.bits >> 24) & 0x0f) as u8)
}
#[inline(always)]
pub fn mode7(&self) -> Mode7R {
Mode7R::new(((self.bits >> 28) & 0x0f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("MODEL")
.field("mode0", &self.mode0())
.field("mode1", &self.mode1())
.field("mode2", &self.mode2())
.field("mode3", &self.mode3())
.field("mode4", &self.mode4())
.field("mode5", &self.mode5())
.field("mode6", &self.mode6())
.field("mode7", &self.mode7())
.finish()
}
}
impl W {
#[inline(always)]
pub fn mode0(&mut self) -> Mode0W<'_, MODELrs> {
Mode0W::new(self, 0)
}
#[inline(always)]
pub fn mode1(&mut self) -> Mode1W<'_, MODELrs> {
Mode1W::new(self, 4)
}
#[inline(always)]
pub fn mode2(&mut self) -> Mode2W<'_, MODELrs> {
Mode2W::new(self, 8)
}
#[inline(always)]
pub fn mode3(&mut self) -> Mode3W<'_, MODELrs> {
Mode3W::new(self, 12)
}
#[inline(always)]
pub fn mode4(&mut self) -> Mode4W<'_, MODELrs> {
Mode4W::new(self, 16)
}
#[inline(always)]
pub fn mode5(&mut self) -> Mode5W<'_, MODELrs> {
Mode5W::new(self, 20)
}
#[inline(always)]
pub fn mode6(&mut self) -> Mode6W<'_, MODELrs> {
Mode6W::new(self, 24)
}
#[inline(always)]
pub fn mode7(&mut self) -> Mode7W<'_, MODELrs> {
Mode7W::new(self, 28)
}
}
pub struct MODELrs;
impl crate::RegisterSpec for MODELrs {
type Ux = u32;
}
impl crate::Readable for MODELrs {}
impl crate::Writable for MODELrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for MODELrs {}