pub type R = crate::R<MCRrs>;
pub type W = crate::W<MCRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MODE1 {
NormalPinBuffer = 0,
NormalPinChipBuffer = 1,
NormalPinNoBuffer = 2,
NormalChipNoBuffer = 3,
ShpinBuffer = 4,
ShpinChipBuffer = 5,
ShpinNoBuffer = 6,
ShchipNoBuffer = 7,
}
impl From<MODE1> for u8 {
#[inline(always)]
fn from(variant: MODE1) -> Self {
variant as _
}
}
impl crate::FieldSpec for MODE1 {
type Ux = u8;
}
impl crate::IsEnum for MODE1 {}
pub type MODE_R = crate::FieldReader<MODE1>;
impl MODE_R {
#[inline(always)]
pub const fn variant(&self) -> MODE1 {
match self.bits {
0 => MODE1::NormalPinBuffer,
1 => MODE1::NormalPinChipBuffer,
2 => MODE1::NormalPinNoBuffer,
3 => MODE1::NormalChipNoBuffer,
4 => MODE1::ShpinBuffer,
5 => MODE1::ShpinChipBuffer,
6 => MODE1::ShpinNoBuffer,
7 => MODE1::ShchipNoBuffer,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_normal_pin_buffer(&self) -> bool {
*self == MODE1::NormalPinBuffer
}
#[inline(always)]
pub fn is_normal_pin_chip_buffer(&self) -> bool {
*self == MODE1::NormalPinChipBuffer
}
#[inline(always)]
pub fn is_normal_pin_no_buffer(&self) -> bool {
*self == MODE1::NormalPinNoBuffer
}
#[inline(always)]
pub fn is_normal_chip_no_buffer(&self) -> bool {
*self == MODE1::NormalChipNoBuffer
}
#[inline(always)]
pub fn is_shpin_buffer(&self) -> bool {
*self == MODE1::ShpinBuffer
}
#[inline(always)]
pub fn is_shpin_chip_buffer(&self) -> bool {
*self == MODE1::ShpinChipBuffer
}
#[inline(always)]
pub fn is_shpin_no_buffer(&self) -> bool {
*self == MODE1::ShpinNoBuffer
}
#[inline(always)]
pub fn is_shchip_no_buffer(&self) -> bool {
*self == MODE1::ShchipNoBuffer
}
}
pub type MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, MODE1, crate::Safe>;
impl<'a, REG> MODE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn normal_pin_buffer(self) -> &'a mut crate::W<REG> {
self.variant(MODE1::NormalPinBuffer)
}
#[inline(always)]
pub fn normal_pin_chip_buffer(self) -> &'a mut crate::W<REG> {
self.variant(MODE1::NormalPinChipBuffer)
}
#[inline(always)]
pub fn normal_pin_no_buffer(self) -> &'a mut crate::W<REG> {
self.variant(MODE1::NormalPinNoBuffer)
}
#[inline(always)]
pub fn normal_chip_no_buffer(self) -> &'a mut crate::W<REG> {
self.variant(MODE1::NormalChipNoBuffer)
}
#[inline(always)]
pub fn shpin_buffer(self) -> &'a mut crate::W<REG> {
self.variant(MODE1::ShpinBuffer)
}
#[inline(always)]
pub fn shpin_chip_buffer(self) -> &'a mut crate::W<REG> {
self.variant(MODE1::ShpinChipBuffer)
}
#[inline(always)]
pub fn shpin_no_buffer(self) -> &'a mut crate::W<REG> {
self.variant(MODE1::ShpinNoBuffer)
}
#[inline(always)]
pub fn shchip_no_buffer(self) -> &'a mut crate::W<REG> {
self.variant(MODE1::ShchipNoBuffer)
}
}
impl R {
#[inline(always)]
pub fn mode(&self, n: u8) -> MODE_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
MODE_R::new(((self.bits >> (n * 16)) & 7) as u8)
}
#[inline(always)]
pub fn mode_iter(&self) -> impl Iterator<Item = MODE_R> + '_ {
(0..2).map(move |n| MODE_R::new(((self.bits >> (n * 16)) & 7) as u8))
}
#[inline(always)]
pub fn mode1(&self) -> MODE_R {
MODE_R::new((self.bits & 7) as u8)
}
#[inline(always)]
pub fn mode2(&self) -> MODE_R {
MODE_R::new(((self.bits >> 16) & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("MCR")
.field("mode1", &self.mode1())
.field("mode2", &self.mode2())
.finish()
}
}
impl W {
#[inline(always)]
pub fn mode(&mut self, n: u8) -> MODE_W<MCRrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
MODE_W::new(self, n * 16)
}
#[inline(always)]
pub fn mode1(&mut self) -> MODE_W<MCRrs> {
MODE_W::new(self, 0)
}
#[inline(always)]
pub fn mode2(&mut self) -> MODE_W<MCRrs> {
MODE_W::new(self, 16)
}
}
pub struct MCRrs;
impl crate::RegisterSpec for MCRrs {
type Ux = u32;
}
impl crate::Readable for MCRrs {}
impl crate::Writable for MCRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for MCRrs {}