pub type R = crate::R<CRrs>;
pub type W = crate::W<CRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CKPOL {
FallingEdge = 0,
RisingEdge = 1,
}
impl From<CKPOL> for bool {
#[inline(always)]
fn from(variant: CKPOL) -> Self {
variant as u8 != 0
}
}
pub type CKPOL_R = crate::BitReader<CKPOL>;
impl CKPOL_R {
#[inline(always)]
pub const fn variant(&self) -> CKPOL {
match self.bits {
false => CKPOL::FallingEdge,
true => CKPOL::RisingEdge,
}
}
#[inline(always)]
pub fn is_falling_edge(&self) -> bool {
*self == CKPOL::FallingEdge
}
#[inline(always)]
pub fn is_rising_edge(&self) -> bool {
*self == CKPOL::RisingEdge
}
}
pub type CKPOL_W<'a, REG> = crate::BitWriter<'a, REG, CKPOL>;
impl<'a, REG> CKPOL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn falling_edge(self) -> &'a mut crate::W<REG> {
self.variant(CKPOL::FallingEdge)
}
#[inline(always)]
pub fn rising_edge(self) -> &'a mut crate::W<REG> {
self.variant(CKPOL::RisingEdge)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DEPOL {
ActiveLow = 0,
ActiveHigh = 1,
}
impl From<DEPOL> for bool {
#[inline(always)]
fn from(variant: DEPOL) -> Self {
variant as u8 != 0
}
}
pub type DEPOL_R = crate::BitReader<DEPOL>;
impl DEPOL_R {
#[inline(always)]
pub const fn variant(&self) -> DEPOL {
match self.bits {
false => DEPOL::ActiveLow,
true => DEPOL::ActiveHigh,
}
}
#[inline(always)]
pub fn is_active_low(&self) -> bool {
*self == DEPOL::ActiveLow
}
#[inline(always)]
pub fn is_active_high(&self) -> bool {
*self == DEPOL::ActiveHigh
}
}
pub type DEPOL_W<'a, REG> = crate::BitWriter<'a, REG, DEPOL>;
impl<'a, REG> DEPOL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn active_low(self) -> &'a mut crate::W<REG> {
self.variant(DEPOL::ActiveLow)
}
#[inline(always)]
pub fn active_high(self) -> &'a mut crate::W<REG> {
self.variant(DEPOL::ActiveHigh)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RDYPOL {
ActiveLow = 0,
ActiveHigh = 1,
}
impl From<RDYPOL> for bool {
#[inline(always)]
fn from(variant: RDYPOL) -> Self {
variant as u8 != 0
}
}
pub type RDYPOL_R = crate::BitReader<RDYPOL>;
impl RDYPOL_R {
#[inline(always)]
pub const fn variant(&self) -> RDYPOL {
match self.bits {
false => RDYPOL::ActiveLow,
true => RDYPOL::ActiveHigh,
}
}
#[inline(always)]
pub fn is_active_low(&self) -> bool {
*self == RDYPOL::ActiveLow
}
#[inline(always)]
pub fn is_active_high(&self) -> bool {
*self == RDYPOL::ActiveHigh
}
}
pub type RDYPOL_W<'a, REG> = crate::BitWriter<'a, REG, RDYPOL>;
impl<'a, REG> RDYPOL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn active_low(self) -> &'a mut crate::W<REG> {
self.variant(RDYPOL::ActiveLow)
}
#[inline(always)]
pub fn active_high(self) -> &'a mut crate::W<REG> {
self.variant(RDYPOL::ActiveHigh)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum EDM {
BitWidth8 = 0,
BitWidth16 = 3,
}
impl From<EDM> for u8 {
#[inline(always)]
fn from(variant: EDM) -> Self {
variant as _
}
}
impl crate::FieldSpec for EDM {
type Ux = u8;
}
impl crate::IsEnum for EDM {}
pub type EDM_R = crate::FieldReader<EDM>;
impl EDM_R {
#[inline(always)]
pub const fn variant(&self) -> Option<EDM> {
match self.bits {
0 => Some(EDM::BitWidth8),
3 => Some(EDM::BitWidth16),
_ => None,
}
}
#[inline(always)]
pub fn is_bit_width8(&self) -> bool {
*self == EDM::BitWidth8
}
#[inline(always)]
pub fn is_bit_width16(&self) -> bool {
*self == EDM::BitWidth16
}
}
pub type EDM_W<'a, REG> = crate::FieldWriter<'a, REG, 2, EDM>;
impl<'a, REG> EDM_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn bit_width8(self) -> &'a mut crate::W<REG> {
self.variant(EDM::BitWidth8)
}
#[inline(always)]
pub fn bit_width16(self) -> &'a mut crate::W<REG> {
self.variant(EDM::BitWidth16)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ENABLE {
Disabled = 0,
Enabled = 1,
}
impl From<ENABLE> for bool {
#[inline(always)]
fn from(variant: ENABLE) -> Self {
variant as u8 != 0
}
}
pub type ENABLE_R = crate::BitReader<ENABLE>;
impl ENABLE_R {
#[inline(always)]
pub const fn variant(&self) -> ENABLE {
match self.bits {
false => ENABLE::Disabled,
true => ENABLE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ENABLE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ENABLE::Enabled
}
}
pub type ENABLE_W<'a, REG> = crate::BitWriter<'a, REG, ENABLE>;
impl<'a, REG> ENABLE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ENABLE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ENABLE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DERDYCFG {
Disabled = 0,
Rdy = 1,
De = 2,
RdyDeAlt = 3,
RdyDe = 4,
RdyRemapped = 5,
DeRemapped = 6,
RdyDeBidi = 7,
}
impl From<DERDYCFG> for u8 {
#[inline(always)]
fn from(variant: DERDYCFG) -> Self {
variant as _
}
}
impl crate::FieldSpec for DERDYCFG {
type Ux = u8;
}
impl crate::IsEnum for DERDYCFG {}
pub type DERDYCFG_R = crate::FieldReader<DERDYCFG>;
impl DERDYCFG_R {
#[inline(always)]
pub const fn variant(&self) -> DERDYCFG {
match self.bits {
0 => DERDYCFG::Disabled,
1 => DERDYCFG::Rdy,
2 => DERDYCFG::De,
3 => DERDYCFG::RdyDeAlt,
4 => DERDYCFG::RdyDe,
5 => DERDYCFG::RdyRemapped,
6 => DERDYCFG::DeRemapped,
7 => DERDYCFG::RdyDeBidi,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DERDYCFG::Disabled
}
#[inline(always)]
pub fn is_rdy(&self) -> bool {
*self == DERDYCFG::Rdy
}
#[inline(always)]
pub fn is_de(&self) -> bool {
*self == DERDYCFG::De
}
#[inline(always)]
pub fn is_rdy_de_alt(&self) -> bool {
*self == DERDYCFG::RdyDeAlt
}
#[inline(always)]
pub fn is_rdy_de(&self) -> bool {
*self == DERDYCFG::RdyDe
}
#[inline(always)]
pub fn is_rdy_remapped(&self) -> bool {
*self == DERDYCFG::RdyRemapped
}
#[inline(always)]
pub fn is_de_remapped(&self) -> bool {
*self == DERDYCFG::DeRemapped
}
#[inline(always)]
pub fn is_rdy_de_bidi(&self) -> bool {
*self == DERDYCFG::RdyDeBidi
}
}
pub type DERDYCFG_W<'a, REG> = crate::FieldWriter<'a, REG, 3, DERDYCFG, crate::Safe>;
impl<'a, REG> DERDYCFG_W<'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(DERDYCFG::Disabled)
}
#[inline(always)]
pub fn rdy(self) -> &'a mut crate::W<REG> {
self.variant(DERDYCFG::Rdy)
}
#[inline(always)]
pub fn de(self) -> &'a mut crate::W<REG> {
self.variant(DERDYCFG::De)
}
#[inline(always)]
pub fn rdy_de_alt(self) -> &'a mut crate::W<REG> {
self.variant(DERDYCFG::RdyDeAlt)
}
#[inline(always)]
pub fn rdy_de(self) -> &'a mut crate::W<REG> {
self.variant(DERDYCFG::RdyDe)
}
#[inline(always)]
pub fn rdy_remapped(self) -> &'a mut crate::W<REG> {
self.variant(DERDYCFG::RdyRemapped)
}
#[inline(always)]
pub fn de_remapped(self) -> &'a mut crate::W<REG> {
self.variant(DERDYCFG::DeRemapped)
}
#[inline(always)]
pub fn rdy_de_bidi(self) -> &'a mut crate::W<REG> {
self.variant(DERDYCFG::RdyDeBidi)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMAEN {
Disabled = 0,
Enabled = 1,
}
impl From<DMAEN> for bool {
#[inline(always)]
fn from(variant: DMAEN) -> Self {
variant as u8 != 0
}
}
pub type DMAEN_R = crate::BitReader<DMAEN>;
impl DMAEN_R {
#[inline(always)]
pub const fn variant(&self) -> DMAEN {
match self.bits {
false => DMAEN::Disabled,
true => DMAEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DMAEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DMAEN::Enabled
}
}
pub type DMAEN_W<'a, REG> = crate::BitWriter<'a, REG, DMAEN>;
impl<'a, REG> DMAEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OUTEN {
ReceiveMode = 0,
TransmitMode = 1,
}
impl From<OUTEN> for bool {
#[inline(always)]
fn from(variant: OUTEN) -> Self {
variant as u8 != 0
}
}
pub type OUTEN_R = crate::BitReader<OUTEN>;
impl OUTEN_R {
#[inline(always)]
pub const fn variant(&self) -> OUTEN {
match self.bits {
false => OUTEN::ReceiveMode,
true => OUTEN::TransmitMode,
}
}
#[inline(always)]
pub fn is_receive_mode(&self) -> bool {
*self == OUTEN::ReceiveMode
}
#[inline(always)]
pub fn is_transmit_mode(&self) -> bool {
*self == OUTEN::TransmitMode
}
}
pub type OUTEN_W<'a, REG> = crate::BitWriter<'a, REG, OUTEN>;
impl<'a, REG> OUTEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn receive_mode(self) -> &'a mut crate::W<REG> {
self.variant(OUTEN::ReceiveMode)
}
#[inline(always)]
pub fn transmit_mode(self) -> &'a mut crate::W<REG> {
self.variant(OUTEN::TransmitMode)
}
}
impl R {
#[inline(always)]
pub fn ckpol(&self) -> CKPOL_R {
CKPOL_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn depol(&self) -> DEPOL_R {
DEPOL_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn rdypol(&self) -> RDYPOL_R {
RDYPOL_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn edm(&self) -> EDM_R {
EDM_R::new(((self.bits >> 10) & 3) as u8)
}
#[inline(always)]
pub fn enable(&self) -> ENABLE_R {
ENABLE_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn derdycfg(&self) -> DERDYCFG_R {
DERDYCFG_R::new(((self.bits >> 18) & 7) as u8)
}
#[inline(always)]
pub fn dmaen(&self) -> DMAEN_R {
DMAEN_R::new(((self.bits >> 30) & 1) != 0)
}
#[inline(always)]
pub fn outen(&self) -> OUTEN_R {
OUTEN_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR")
.field("ckpol", &self.ckpol())
.field("depol", &self.depol())
.field("rdypol", &self.rdypol())
.field("edm", &self.edm())
.field("enable", &self.enable())
.field("derdycfg", &self.derdycfg())
.field("dmaen", &self.dmaen())
.field("outen", &self.outen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn ckpol(&mut self) -> CKPOL_W<CRrs> {
CKPOL_W::new(self, 5)
}
#[inline(always)]
pub fn depol(&mut self) -> DEPOL_W<CRrs> {
DEPOL_W::new(self, 6)
}
#[inline(always)]
pub fn rdypol(&mut self) -> RDYPOL_W<CRrs> {
RDYPOL_W::new(self, 8)
}
#[inline(always)]
pub fn edm(&mut self) -> EDM_W<CRrs> {
EDM_W::new(self, 10)
}
#[inline(always)]
pub fn enable(&mut self) -> ENABLE_W<CRrs> {
ENABLE_W::new(self, 14)
}
#[inline(always)]
pub fn derdycfg(&mut self) -> DERDYCFG_W<CRrs> {
DERDYCFG_W::new(self, 18)
}
#[inline(always)]
pub fn dmaen(&mut self) -> DMAEN_W<CRrs> {
DMAEN_W::new(self, 30)
}
#[inline(always)]
pub fn outen(&mut self) -> OUTEN_W<CRrs> {
OUTEN_W::new(self, 31)
}
}
pub struct CRrs;
impl crate::RegisterSpec for CRrs {
type Ux = u32;
}
impl crate::Readable for CRrs {}
impl crate::Writable for CRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CRrs {
const RESET_VALUE: u32 = 0x4000_0000;
}