pub type R = crate::R<CTRLrs>;
pub type W = crate::W<CTRLrs>;
pub type AutotriR = crate::BitReader;
pub type AutotriW<'a, REG> = crate::BitWriter<'a, REG>;
pub type DatabitsR = crate::BitReader;
pub type DatabitsW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PARITY {
None = 0,
Even = 2,
Odd = 3,
}
impl From<PARITY> for u8 {
#[inline(always)]
fn from(variant: PARITY) -> Self {
variant as _
}
}
impl crate::FieldSpec for PARITY {
type Ux = u8;
}
impl crate::IsEnum for PARITY {}
pub type ParityR = crate::FieldReader<PARITY>;
impl ParityR {
#[inline(always)]
pub const fn variant(&self) -> Option<PARITY> {
match self.bits {
0 => Some(PARITY::None),
2 => Some(PARITY::Even),
3 => Some(PARITY::Odd),
_ => None,
}
}
#[inline(always)]
pub fn is_none(&self) -> bool {
*self == PARITY::None
}
#[inline(always)]
pub fn is_even(&self) -> bool {
*self == PARITY::Even
}
#[inline(always)]
pub fn is_odd(&self) -> bool {
*self == PARITY::Odd
}
}
pub type ParityW<'a, REG> = crate::FieldWriter<'a, REG, 2, PARITY>;
impl<'a, REG> ParityW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn none(self) -> &'a mut crate::W<REG> {
self.variant(PARITY::None)
}
#[inline(always)]
pub fn even(self) -> &'a mut crate::W<REG> {
self.variant(PARITY::Even)
}
#[inline(always)]
pub fn odd(self) -> &'a mut crate::W<REG> {
self.variant(PARITY::Odd)
}
}
pub type StopbitsR = crate::BitReader;
pub type StopbitsW<'a, REG> = crate::BitWriter<'a, REG>;
pub type InvR = crate::BitReader;
pub type InvW<'a, REG> = crate::BitWriter<'a, REG>;
pub type ErrsdmaR = crate::BitReader;
pub type ErrsdmaW<'a, REG> = crate::BitWriter<'a, REG>;
pub type LoopbkR = crate::BitReader;
pub type LoopbkW<'a, REG> = crate::BitWriter<'a, REG>;
pub type SfubrxR = crate::BitReader;
pub type SfubrxW<'a, REG> = crate::BitWriter<'a, REG>;
pub type MpmR = crate::BitReader;
pub type MpmW<'a, REG> = crate::BitWriter<'a, REG>;
pub type MpabR = crate::BitReader;
pub type MpabW<'a, REG> = crate::BitWriter<'a, REG>;
pub type Bit8dvR = crate::BitReader;
pub type Bit8dvW<'a, REG> = crate::BitWriter<'a, REG>;
pub type RxdmawuR = crate::BitReader;
pub type RxdmawuW<'a, REG> = crate::BitWriter<'a, REG>;
pub type TxdmawuR = crate::BitReader;
pub type TxdmawuW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TXDELAY {
None = 0,
Single = 1,
Double = 2,
Triple = 3,
}
impl From<TXDELAY> for u8 {
#[inline(always)]
fn from(variant: TXDELAY) -> Self {
variant as _
}
}
impl crate::FieldSpec for TXDELAY {
type Ux = u8;
}
impl crate::IsEnum for TXDELAY {}
pub type TxdelayR = crate::FieldReader<TXDELAY>;
impl TxdelayR {
#[inline(always)]
pub const fn variant(&self) -> TXDELAY {
match self.bits {
0 => TXDELAY::None,
1 => TXDELAY::Single,
2 => TXDELAY::Double,
3 => TXDELAY::Triple,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_none(&self) -> bool {
*self == TXDELAY::None
}
#[inline(always)]
pub fn is_single(&self) -> bool {
*self == TXDELAY::Single
}
#[inline(always)]
pub fn is_double(&self) -> bool {
*self == TXDELAY::Double
}
#[inline(always)]
pub fn is_triple(&self) -> bool {
*self == TXDELAY::Triple
}
}
pub type TxdelayW<'a, REG> = crate::FieldWriter<'a, REG, 2, TXDELAY, crate::Safe>;
impl<'a, REG> TxdelayW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn none(self) -> &'a mut crate::W<REG> {
self.variant(TXDELAY::None)
}
#[inline(always)]
pub fn single(self) -> &'a mut crate::W<REG> {
self.variant(TXDELAY::Single)
}
#[inline(always)]
pub fn double(self) -> &'a mut crate::W<REG> {
self.variant(TXDELAY::Double)
}
#[inline(always)]
pub fn triple(self) -> &'a mut crate::W<REG> {
self.variant(TXDELAY::Triple)
}
}
impl R {
#[inline(always)]
pub fn autotri(&self) -> AutotriR {
AutotriR::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn databits(&self) -> DatabitsR {
DatabitsR::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn parity(&self) -> ParityR {
ParityR::new(((self.bits >> 2) & 3) as u8)
}
#[inline(always)]
pub fn stopbits(&self) -> StopbitsR {
StopbitsR::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn inv(&self) -> InvR {
InvR::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn errsdma(&self) -> ErrsdmaR {
ErrsdmaR::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn loopbk(&self) -> LoopbkR {
LoopbkR::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn sfubrx(&self) -> SfubrxR {
SfubrxR::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn mpm(&self) -> MpmR {
MpmR::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn mpab(&self) -> MpabR {
MpabR::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn bit8dv(&self) -> Bit8dvR {
Bit8dvR::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn rxdmawu(&self) -> RxdmawuR {
RxdmawuR::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn txdmawu(&self) -> TxdmawuR {
TxdmawuR::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn txdelay(&self) -> TxdelayR {
TxdelayR::new(((self.bits >> 14) & 3) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CTRL")
.field("autotri", &self.autotri())
.field("databits", &self.databits())
.field("parity", &self.parity())
.field("stopbits", &self.stopbits())
.field("inv", &self.inv())
.field("errsdma", &self.errsdma())
.field("loopbk", &self.loopbk())
.field("sfubrx", &self.sfubrx())
.field("mpm", &self.mpm())
.field("mpab", &self.mpab())
.field("bit8dv", &self.bit8dv())
.field("rxdmawu", &self.rxdmawu())
.field("txdmawu", &self.txdmawu())
.field("txdelay", &self.txdelay())
.finish()
}
}
impl W {
#[inline(always)]
pub fn autotri(&mut self) -> AutotriW<'_, CTRLrs> {
AutotriW::new(self, 0)
}
#[inline(always)]
pub fn databits(&mut self) -> DatabitsW<'_, CTRLrs> {
DatabitsW::new(self, 1)
}
#[inline(always)]
pub fn parity(&mut self) -> ParityW<'_, CTRLrs> {
ParityW::new(self, 2)
}
#[inline(always)]
pub fn stopbits(&mut self) -> StopbitsW<'_, CTRLrs> {
StopbitsW::new(self, 4)
}
#[inline(always)]
pub fn inv(&mut self) -> InvW<'_, CTRLrs> {
InvW::new(self, 5)
}
#[inline(always)]
pub fn errsdma(&mut self) -> ErrsdmaW<'_, CTRLrs> {
ErrsdmaW::new(self, 6)
}
#[inline(always)]
pub fn loopbk(&mut self) -> LoopbkW<'_, CTRLrs> {
LoopbkW::new(self, 7)
}
#[inline(always)]
pub fn sfubrx(&mut self) -> SfubrxW<'_, CTRLrs> {
SfubrxW::new(self, 8)
}
#[inline(always)]
pub fn mpm(&mut self) -> MpmW<'_, CTRLrs> {
MpmW::new(self, 9)
}
#[inline(always)]
pub fn mpab(&mut self) -> MpabW<'_, CTRLrs> {
MpabW::new(self, 10)
}
#[inline(always)]
pub fn bit8dv(&mut self) -> Bit8dvW<'_, CTRLrs> {
Bit8dvW::new(self, 11)
}
#[inline(always)]
pub fn rxdmawu(&mut self) -> RxdmawuW<'_, CTRLrs> {
RxdmawuW::new(self, 12)
}
#[inline(always)]
pub fn txdmawu(&mut self) -> TxdmawuW<'_, CTRLrs> {
TxdmawuW::new(self, 13)
}
#[inline(always)]
pub fn txdelay(&mut self) -> TxdelayW<'_, CTRLrs> {
TxdelayW::new(self, 14)
}
}
pub struct CTRLrs;
impl crate::RegisterSpec for CTRLrs {
type Ux = u32;
}
impl crate::Readable for CTRLrs {}
impl crate::Writable for CTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CTRLrs {}