pub type R = crate::R<CFG1rs>;
pub type W = crate::W<CFG1rs>;
pub type DSIZE_R = crate::FieldReader;
pub type DSIZE_W<'a, REG> = crate::FieldWriter<'a, REG, 5, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum FTHLV {
OneFrame = 0,
TwoFrames = 1,
ThreeFrames = 2,
FourFrames = 3,
FiveFrames = 4,
SixFrames = 5,
SevenFrames = 6,
EightFrames = 7,
NineFrames = 8,
TenFrames = 9,
ElevenFrames = 10,
TwelveFrames = 11,
ThirteenFrames = 12,
FourteenFrames = 13,
FifteenFrames = 14,
SixteenFrames = 15,
}
impl From<FTHLV> for u8 {
#[inline(always)]
fn from(variant: FTHLV) -> Self {
variant as _
}
}
impl crate::FieldSpec for FTHLV {
type Ux = u8;
}
impl crate::IsEnum for FTHLV {}
pub type FTHLV_R = crate::FieldReader<FTHLV>;
impl FTHLV_R {
#[inline(always)]
pub const fn variant(&self) -> FTHLV {
match self.bits {
0 => FTHLV::OneFrame,
1 => FTHLV::TwoFrames,
2 => FTHLV::ThreeFrames,
3 => FTHLV::FourFrames,
4 => FTHLV::FiveFrames,
5 => FTHLV::SixFrames,
6 => FTHLV::SevenFrames,
7 => FTHLV::EightFrames,
8 => FTHLV::NineFrames,
9 => FTHLV::TenFrames,
10 => FTHLV::ElevenFrames,
11 => FTHLV::TwelveFrames,
12 => FTHLV::ThirteenFrames,
13 => FTHLV::FourteenFrames,
14 => FTHLV::FifteenFrames,
15 => FTHLV::SixteenFrames,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_one_frame(&self) -> bool {
*self == FTHLV::OneFrame
}
#[inline(always)]
pub fn is_two_frames(&self) -> bool {
*self == FTHLV::TwoFrames
}
#[inline(always)]
pub fn is_three_frames(&self) -> bool {
*self == FTHLV::ThreeFrames
}
#[inline(always)]
pub fn is_four_frames(&self) -> bool {
*self == FTHLV::FourFrames
}
#[inline(always)]
pub fn is_five_frames(&self) -> bool {
*self == FTHLV::FiveFrames
}
#[inline(always)]
pub fn is_six_frames(&self) -> bool {
*self == FTHLV::SixFrames
}
#[inline(always)]
pub fn is_seven_frames(&self) -> bool {
*self == FTHLV::SevenFrames
}
#[inline(always)]
pub fn is_eight_frames(&self) -> bool {
*self == FTHLV::EightFrames
}
#[inline(always)]
pub fn is_nine_frames(&self) -> bool {
*self == FTHLV::NineFrames
}
#[inline(always)]
pub fn is_ten_frames(&self) -> bool {
*self == FTHLV::TenFrames
}
#[inline(always)]
pub fn is_eleven_frames(&self) -> bool {
*self == FTHLV::ElevenFrames
}
#[inline(always)]
pub fn is_twelve_frames(&self) -> bool {
*self == FTHLV::TwelveFrames
}
#[inline(always)]
pub fn is_thirteen_frames(&self) -> bool {
*self == FTHLV::ThirteenFrames
}
#[inline(always)]
pub fn is_fourteen_frames(&self) -> bool {
*self == FTHLV::FourteenFrames
}
#[inline(always)]
pub fn is_fifteen_frames(&self) -> bool {
*self == FTHLV::FifteenFrames
}
#[inline(always)]
pub fn is_sixteen_frames(&self) -> bool {
*self == FTHLV::SixteenFrames
}
}
pub type FTHLV_W<'a, REG> = crate::FieldWriter<'a, REG, 4, FTHLV, crate::Safe>;
impl<'a, REG> FTHLV_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn one_frame(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::OneFrame)
}
#[inline(always)]
pub fn two_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::TwoFrames)
}
#[inline(always)]
pub fn three_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::ThreeFrames)
}
#[inline(always)]
pub fn four_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::FourFrames)
}
#[inline(always)]
pub fn five_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::FiveFrames)
}
#[inline(always)]
pub fn six_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::SixFrames)
}
#[inline(always)]
pub fn seven_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::SevenFrames)
}
#[inline(always)]
pub fn eight_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::EightFrames)
}
#[inline(always)]
pub fn nine_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::NineFrames)
}
#[inline(always)]
pub fn ten_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::TenFrames)
}
#[inline(always)]
pub fn eleven_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::ElevenFrames)
}
#[inline(always)]
pub fn twelve_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::TwelveFrames)
}
#[inline(always)]
pub fn thirteen_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::ThirteenFrames)
}
#[inline(always)]
pub fn fourteen_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::FourteenFrames)
}
#[inline(always)]
pub fn fifteen_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::FifteenFrames)
}
#[inline(always)]
pub fn sixteen_frames(self) -> &'a mut crate::W<REG> {
self.variant(FTHLV::SixteenFrames)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum UDRCFG {
Constant = 0,
RepeatReceived = 1,
RepeatTransmitted = 2,
}
impl From<UDRCFG> for u8 {
#[inline(always)]
fn from(variant: UDRCFG) -> Self {
variant as _
}
}
impl crate::FieldSpec for UDRCFG {
type Ux = u8;
}
impl crate::IsEnum for UDRCFG {}
pub type UDRCFG_R = crate::FieldReader<UDRCFG>;
impl UDRCFG_R {
#[inline(always)]
pub const fn variant(&self) -> Option<UDRCFG> {
match self.bits {
0 => Some(UDRCFG::Constant),
1 => Some(UDRCFG::RepeatReceived),
2 => Some(UDRCFG::RepeatTransmitted),
_ => None,
}
}
#[inline(always)]
pub fn is_constant(&self) -> bool {
*self == UDRCFG::Constant
}
#[inline(always)]
pub fn is_repeat_received(&self) -> bool {
*self == UDRCFG::RepeatReceived
}
#[inline(always)]
pub fn is_repeat_transmitted(&self) -> bool {
*self == UDRCFG::RepeatTransmitted
}
}
pub type UDRCFG_W<'a, REG> = crate::FieldWriter<'a, REG, 2, UDRCFG>;
impl<'a, REG> UDRCFG_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn constant(self) -> &'a mut crate::W<REG> {
self.variant(UDRCFG::Constant)
}
#[inline(always)]
pub fn repeat_received(self) -> &'a mut crate::W<REG> {
self.variant(UDRCFG::RepeatReceived)
}
#[inline(always)]
pub fn repeat_transmitted(self) -> &'a mut crate::W<REG> {
self.variant(UDRCFG::RepeatTransmitted)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum UDRDET {
StartOfFrame = 0,
EndOfFrame = 1,
StartOfSlaveSelect = 2,
}
impl From<UDRDET> for u8 {
#[inline(always)]
fn from(variant: UDRDET) -> Self {
variant as _
}
}
impl crate::FieldSpec for UDRDET {
type Ux = u8;
}
impl crate::IsEnum for UDRDET {}
pub type UDRDET_R = crate::FieldReader<UDRDET>;
impl UDRDET_R {
#[inline(always)]
pub const fn variant(&self) -> Option<UDRDET> {
match self.bits {
0 => Some(UDRDET::StartOfFrame),
1 => Some(UDRDET::EndOfFrame),
2 => Some(UDRDET::StartOfSlaveSelect),
_ => None,
}
}
#[inline(always)]
pub fn is_start_of_frame(&self) -> bool {
*self == UDRDET::StartOfFrame
}
#[inline(always)]
pub fn is_end_of_frame(&self) -> bool {
*self == UDRDET::EndOfFrame
}
#[inline(always)]
pub fn is_start_of_slave_select(&self) -> bool {
*self == UDRDET::StartOfSlaveSelect
}
}
pub type UDRDET_W<'a, REG> = crate::FieldWriter<'a, REG, 2, UDRDET>;
impl<'a, REG> UDRDET_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn start_of_frame(self) -> &'a mut crate::W<REG> {
self.variant(UDRDET::StartOfFrame)
}
#[inline(always)]
pub fn end_of_frame(self) -> &'a mut crate::W<REG> {
self.variant(UDRDET::EndOfFrame)
}
#[inline(always)]
pub fn start_of_slave_select(self) -> &'a mut crate::W<REG> {
self.variant(UDRDET::StartOfSlaveSelect)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXDMAEN {
Disabled = 0,
Enabled = 1,
}
impl From<RXDMAEN> for bool {
#[inline(always)]
fn from(variant: RXDMAEN) -> Self {
variant as u8 != 0
}
}
pub type RXDMAEN_R = crate::BitReader<RXDMAEN>;
impl RXDMAEN_R {
#[inline(always)]
pub const fn variant(&self) -> RXDMAEN {
match self.bits {
false => RXDMAEN::Disabled,
true => RXDMAEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == RXDMAEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == RXDMAEN::Enabled
}
}
pub type RXDMAEN_W<'a, REG> = crate::BitWriter<'a, REG, RXDMAEN>;
impl<'a, REG> RXDMAEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(RXDMAEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(RXDMAEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TXDMAEN {
Disabled = 0,
Enabled = 1,
}
impl From<TXDMAEN> for bool {
#[inline(always)]
fn from(variant: TXDMAEN) -> Self {
variant as u8 != 0
}
}
pub type TXDMAEN_R = crate::BitReader<TXDMAEN>;
impl TXDMAEN_R {
#[inline(always)]
pub const fn variant(&self) -> TXDMAEN {
match self.bits {
false => TXDMAEN::Disabled,
true => TXDMAEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == TXDMAEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == TXDMAEN::Enabled
}
}
pub type TXDMAEN_W<'a, REG> = crate::BitWriter<'a, REG, TXDMAEN>;
impl<'a, REG> TXDMAEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(TXDMAEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(TXDMAEN::Enabled)
}
}
pub type CRCSIZE_R = crate::FieldReader;
pub type CRCSIZE_W<'a, REG> = crate::FieldWriter<'a, REG, 5, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CRCEN {
Disabled = 0,
Enabled = 1,
}
impl From<CRCEN> for bool {
#[inline(always)]
fn from(variant: CRCEN) -> Self {
variant as u8 != 0
}
}
pub type CRCEN_R = crate::BitReader<CRCEN>;
impl CRCEN_R {
#[inline(always)]
pub const fn variant(&self) -> CRCEN {
match self.bits {
false => CRCEN::Disabled,
true => CRCEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == CRCEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == CRCEN::Enabled
}
}
pub type CRCEN_W<'a, REG> = crate::BitWriter<'a, REG, CRCEN>;
impl<'a, REG> CRCEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(CRCEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(CRCEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MBR {
Div2 = 0,
Div4 = 1,
Div8 = 2,
Div16 = 3,
Div32 = 4,
Div64 = 5,
Div128 = 6,
Div256 = 7,
}
impl From<MBR> for u8 {
#[inline(always)]
fn from(variant: MBR) -> Self {
variant as _
}
}
impl crate::FieldSpec for MBR {
type Ux = u8;
}
impl crate::IsEnum for MBR {}
pub type MBR_R = crate::FieldReader<MBR>;
impl MBR_R {
#[inline(always)]
pub const fn variant(&self) -> MBR {
match self.bits {
0 => MBR::Div2,
1 => MBR::Div4,
2 => MBR::Div8,
3 => MBR::Div16,
4 => MBR::Div32,
5 => MBR::Div64,
6 => MBR::Div128,
7 => MBR::Div256,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == MBR::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == MBR::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == MBR::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == MBR::Div16
}
#[inline(always)]
pub fn is_div32(&self) -> bool {
*self == MBR::Div32
}
#[inline(always)]
pub fn is_div64(&self) -> bool {
*self == MBR::Div64
}
#[inline(always)]
pub fn is_div128(&self) -> bool {
*self == MBR::Div128
}
#[inline(always)]
pub fn is_div256(&self) -> bool {
*self == MBR::Div256
}
}
pub type MBR_W<'a, REG> = crate::FieldWriter<'a, REG, 3, MBR, crate::Safe>;
impl<'a, REG> MBR_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(MBR::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(MBR::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(MBR::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(MBR::Div16)
}
#[inline(always)]
pub fn div32(self) -> &'a mut crate::W<REG> {
self.variant(MBR::Div32)
}
#[inline(always)]
pub fn div64(self) -> &'a mut crate::W<REG> {
self.variant(MBR::Div64)
}
#[inline(always)]
pub fn div128(self) -> &'a mut crate::W<REG> {
self.variant(MBR::Div128)
}
#[inline(always)]
pub fn div256(self) -> &'a mut crate::W<REG> {
self.variant(MBR::Div256)
}
}
impl R {
#[inline(always)]
pub fn dsize(&self) -> DSIZE_R {
DSIZE_R::new((self.bits & 0x1f) as u8)
}
#[inline(always)]
pub fn fthlv(&self) -> FTHLV_R {
FTHLV_R::new(((self.bits >> 5) & 0x0f) as u8)
}
#[inline(always)]
pub fn udrcfg(&self) -> UDRCFG_R {
UDRCFG_R::new(((self.bits >> 9) & 3) as u8)
}
#[inline(always)]
pub fn udrdet(&self) -> UDRDET_R {
UDRDET_R::new(((self.bits >> 11) & 3) as u8)
}
#[inline(always)]
pub fn rxdmaen(&self) -> RXDMAEN_R {
RXDMAEN_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn txdmaen(&self) -> TXDMAEN_R {
TXDMAEN_R::new(((self.bits >> 15) & 1) != 0)
}
#[inline(always)]
pub fn crcsize(&self) -> CRCSIZE_R {
CRCSIZE_R::new(((self.bits >> 16) & 0x1f) as u8)
}
#[inline(always)]
pub fn crcen(&self) -> CRCEN_R {
CRCEN_R::new(((self.bits >> 22) & 1) != 0)
}
#[inline(always)]
pub fn mbr(&self) -> MBR_R {
MBR_R::new(((self.bits >> 28) & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CFG1")
.field("mbr", &self.mbr())
.field("crcen", &self.crcen())
.field("crcsize", &self.crcsize())
.field("txdmaen", &self.txdmaen())
.field("rxdmaen", &self.rxdmaen())
.field("udrdet", &self.udrdet())
.field("udrcfg", &self.udrcfg())
.field("fthlv", &self.fthlv())
.field("dsize", &self.dsize())
.finish()
}
}
impl W {
#[inline(always)]
pub fn dsize(&mut self) -> DSIZE_W<CFG1rs> {
DSIZE_W::new(self, 0)
}
#[inline(always)]
pub fn fthlv(&mut self) -> FTHLV_W<CFG1rs> {
FTHLV_W::new(self, 5)
}
#[inline(always)]
pub fn udrcfg(&mut self) -> UDRCFG_W<CFG1rs> {
UDRCFG_W::new(self, 9)
}
#[inline(always)]
pub fn udrdet(&mut self) -> UDRDET_W<CFG1rs> {
UDRDET_W::new(self, 11)
}
#[inline(always)]
pub fn rxdmaen(&mut self) -> RXDMAEN_W<CFG1rs> {
RXDMAEN_W::new(self, 14)
}
#[inline(always)]
pub fn txdmaen(&mut self) -> TXDMAEN_W<CFG1rs> {
TXDMAEN_W::new(self, 15)
}
#[inline(always)]
pub fn crcsize(&mut self) -> CRCSIZE_W<CFG1rs> {
CRCSIZE_W::new(self, 16)
}
#[inline(always)]
pub fn crcen(&mut self) -> CRCEN_W<CFG1rs> {
CRCEN_W::new(self, 22)
}
#[inline(always)]
pub fn mbr(&mut self) -> MBR_W<CFG1rs> {
MBR_W::new(self, 28)
}
}
pub struct CFG1rs;
impl crate::RegisterSpec for CFG1rs {
type Ux = u32;
}
impl crate::Readable for CFG1rs {}
impl crate::Writable for CFG1rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CFG1rs {
const RESET_VALUE: u32 = 0x0007_0007;
}