pub type R = crate::R<CFGR1rs>;
pub type W = crate::W<CFGR1rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SITP {
SpirisingEdge = 0,
SpifallingEdge = 1,
Manchester = 2,
ManchesterInverted = 3,
}
impl From<SITP> for u8 {
#[inline(always)]
fn from(variant: SITP) -> Self {
variant as _
}
}
impl crate::FieldSpec for SITP {
type Ux = u8;
}
impl crate::IsEnum for SITP {}
pub type SITP_R = crate::FieldReader<SITP>;
impl SITP_R {
#[inline(always)]
pub const fn variant(&self) -> SITP {
match self.bits {
0 => SITP::SpirisingEdge,
1 => SITP::SpifallingEdge,
2 => SITP::Manchester,
3 => SITP::ManchesterInverted,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_spirising_edge(&self) -> bool {
*self == SITP::SpirisingEdge
}
#[inline(always)]
pub fn is_spifalling_edge(&self) -> bool {
*self == SITP::SpifallingEdge
}
#[inline(always)]
pub fn is_manchester(&self) -> bool {
*self == SITP::Manchester
}
#[inline(always)]
pub fn is_manchester_inverted(&self) -> bool {
*self == SITP::ManchesterInverted
}
}
pub type SITP_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SITP, crate::Safe>;
impl<'a, REG> SITP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn spirising_edge(self) -> &'a mut crate::W<REG> {
self.variant(SITP::SpirisingEdge)
}
#[inline(always)]
pub fn spifalling_edge(self) -> &'a mut crate::W<REG> {
self.variant(SITP::SpifallingEdge)
}
#[inline(always)]
pub fn manchester(self) -> &'a mut crate::W<REG> {
self.variant(SITP::Manchester)
}
#[inline(always)]
pub fn manchester_inverted(self) -> &'a mut crate::W<REG> {
self.variant(SITP::ManchesterInverted)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SPICKSEL {
Ckin = 0,
Ckout = 1,
CkoutsecondFalling = 2,
CkoutsecondRising = 3,
}
impl From<SPICKSEL> for u8 {
#[inline(always)]
fn from(variant: SPICKSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for SPICKSEL {
type Ux = u8;
}
impl crate::IsEnum for SPICKSEL {}
pub type SPICKSEL_R = crate::FieldReader<SPICKSEL>;
impl SPICKSEL_R {
#[inline(always)]
pub const fn variant(&self) -> SPICKSEL {
match self.bits {
0 => SPICKSEL::Ckin,
1 => SPICKSEL::Ckout,
2 => SPICKSEL::CkoutsecondFalling,
3 => SPICKSEL::CkoutsecondRising,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_ckin(&self) -> bool {
*self == SPICKSEL::Ckin
}
#[inline(always)]
pub fn is_ckout(&self) -> bool {
*self == SPICKSEL::Ckout
}
#[inline(always)]
pub fn is_ckoutsecond_falling(&self) -> bool {
*self == SPICKSEL::CkoutsecondFalling
}
#[inline(always)]
pub fn is_ckoutsecond_rising(&self) -> bool {
*self == SPICKSEL::CkoutsecondRising
}
}
pub type SPICKSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SPICKSEL, crate::Safe>;
impl<'a, REG> SPICKSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn ckin(self) -> &'a mut crate::W<REG> {
self.variant(SPICKSEL::Ckin)
}
#[inline(always)]
pub fn ckout(self) -> &'a mut crate::W<REG> {
self.variant(SPICKSEL::Ckout)
}
#[inline(always)]
pub fn ckoutsecond_falling(self) -> &'a mut crate::W<REG> {
self.variant(SPICKSEL::CkoutsecondFalling)
}
#[inline(always)]
pub fn ckoutsecond_rising(self) -> &'a mut crate::W<REG> {
self.variant(SPICKSEL::CkoutsecondRising)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SCDEN {
Disabled = 0,
Enabled = 1,
}
impl From<SCDEN> for bool {
#[inline(always)]
fn from(variant: SCDEN) -> Self {
variant as u8 != 0
}
}
pub type SCDEN_R = crate::BitReader<SCDEN>;
impl SCDEN_R {
#[inline(always)]
pub const fn variant(&self) -> SCDEN {
match self.bits {
false => SCDEN::Disabled,
true => SCDEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == SCDEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == SCDEN::Enabled
}
}
pub type SCDEN_W<'a, REG> = crate::BitWriter<'a, REG, SCDEN>;
impl<'a, REG> SCDEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(SCDEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(SCDEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CKABEN {
Disabled = 0,
Enabled = 1,
}
impl From<CKABEN> for bool {
#[inline(always)]
fn from(variant: CKABEN) -> Self {
variant as u8 != 0
}
}
pub type CKABEN_R = crate::BitReader<CKABEN>;
impl CKABEN_R {
#[inline(always)]
pub const fn variant(&self) -> CKABEN {
match self.bits {
false => CKABEN::Disabled,
true => CKABEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == CKABEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == CKABEN::Enabled
}
}
pub type CKABEN_W<'a, REG> = crate::BitWriter<'a, REG, CKABEN>;
impl<'a, REG> CKABEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(CKABEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(CKABEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CHEN {
Disabled = 0,
Enabled = 1,
}
impl From<CHEN> for bool {
#[inline(always)]
fn from(variant: CHEN) -> Self {
variant as u8 != 0
}
}
pub type CHEN_R = crate::BitReader<CHEN>;
impl CHEN_R {
#[inline(always)]
pub const fn variant(&self) -> CHEN {
match self.bits {
false => CHEN::Disabled,
true => CHEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == CHEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == CHEN::Enabled
}
}
pub type CHEN_W<'a, REG> = crate::BitWriter<'a, REG, CHEN>;
impl<'a, REG> CHEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(CHEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(CHEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CHINSEL {
SameChannel = 0,
FollowingChannel = 1,
}
impl From<CHINSEL> for bool {
#[inline(always)]
fn from(variant: CHINSEL) -> Self {
variant as u8 != 0
}
}
pub type CHINSEL_R = crate::BitReader<CHINSEL>;
impl CHINSEL_R {
#[inline(always)]
pub const fn variant(&self) -> CHINSEL {
match self.bits {
false => CHINSEL::SameChannel,
true => CHINSEL::FollowingChannel,
}
}
#[inline(always)]
pub fn is_same_channel(&self) -> bool {
*self == CHINSEL::SameChannel
}
#[inline(always)]
pub fn is_following_channel(&self) -> bool {
*self == CHINSEL::FollowingChannel
}
}
pub type CHINSEL_W<'a, REG> = crate::BitWriter<'a, REG, CHINSEL>;
impl<'a, REG> CHINSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn same_channel(self) -> &'a mut crate::W<REG> {
self.variant(CHINSEL::SameChannel)
}
#[inline(always)]
pub fn following_channel(self) -> &'a mut crate::W<REG> {
self.variant(CHINSEL::FollowingChannel)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DATMPX {
External = 0,
Adc = 1,
Internal = 2,
}
impl From<DATMPX> for u8 {
#[inline(always)]
fn from(variant: DATMPX) -> Self {
variant as _
}
}
impl crate::FieldSpec for DATMPX {
type Ux = u8;
}
impl crate::IsEnum for DATMPX {}
pub type DATMPX_R = crate::FieldReader<DATMPX>;
impl DATMPX_R {
#[inline(always)]
pub const fn variant(&self) -> Option<DATMPX> {
match self.bits {
0 => Some(DATMPX::External),
1 => Some(DATMPX::Adc),
2 => Some(DATMPX::Internal),
_ => None,
}
}
#[inline(always)]
pub fn is_external(&self) -> bool {
*self == DATMPX::External
}
#[inline(always)]
pub fn is_adc(&self) -> bool {
*self == DATMPX::Adc
}
#[inline(always)]
pub fn is_internal(&self) -> bool {
*self == DATMPX::Internal
}
}
pub type DATMPX_W<'a, REG> = crate::FieldWriter<'a, REG, 2, DATMPX>;
impl<'a, REG> DATMPX_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn external(self) -> &'a mut crate::W<REG> {
self.variant(DATMPX::External)
}
#[inline(always)]
pub fn adc(self) -> &'a mut crate::W<REG> {
self.variant(DATMPX::Adc)
}
#[inline(always)]
pub fn internal(self) -> &'a mut crate::W<REG> {
self.variant(DATMPX::Internal)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DATPACK {
Standard = 0,
Interleaved = 1,
Dual = 2,
}
impl From<DATPACK> for u8 {
#[inline(always)]
fn from(variant: DATPACK) -> Self {
variant as _
}
}
impl crate::FieldSpec for DATPACK {
type Ux = u8;
}
impl crate::IsEnum for DATPACK {}
pub type DATPACK_R = crate::FieldReader<DATPACK>;
impl DATPACK_R {
#[inline(always)]
pub const fn variant(&self) -> Option<DATPACK> {
match self.bits {
0 => Some(DATPACK::Standard),
1 => Some(DATPACK::Interleaved),
2 => Some(DATPACK::Dual),
_ => None,
}
}
#[inline(always)]
pub fn is_standard(&self) -> bool {
*self == DATPACK::Standard
}
#[inline(always)]
pub fn is_interleaved(&self) -> bool {
*self == DATPACK::Interleaved
}
#[inline(always)]
pub fn is_dual(&self) -> bool {
*self == DATPACK::Dual
}
}
pub type DATPACK_W<'a, REG> = crate::FieldWriter<'a, REG, 2, DATPACK>;
impl<'a, REG> DATPACK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn standard(self) -> &'a mut crate::W<REG> {
self.variant(DATPACK::Standard)
}
#[inline(always)]
pub fn interleaved(self) -> &'a mut crate::W<REG> {
self.variant(DATPACK::Interleaved)
}
#[inline(always)]
pub fn dual(self) -> &'a mut crate::W<REG> {
self.variant(DATPACK::Dual)
}
}
pub type CKOUTDIV_R = crate::FieldReader;
pub type CKOUTDIV_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CKOUTSRC {
Sysclk = 0,
Audclk = 1,
}
impl From<CKOUTSRC> for bool {
#[inline(always)]
fn from(variant: CKOUTSRC) -> Self {
variant as u8 != 0
}
}
pub type CKOUTSRC_R = crate::BitReader<CKOUTSRC>;
impl CKOUTSRC_R {
#[inline(always)]
pub const fn variant(&self) -> CKOUTSRC {
match self.bits {
false => CKOUTSRC::Sysclk,
true => CKOUTSRC::Audclk,
}
}
#[inline(always)]
pub fn is_sysclk(&self) -> bool {
*self == CKOUTSRC::Sysclk
}
#[inline(always)]
pub fn is_audclk(&self) -> bool {
*self == CKOUTSRC::Audclk
}
}
pub type CKOUTSRC_W<'a, REG> = crate::BitWriter<'a, REG, CKOUTSRC>;
impl<'a, REG> CKOUTSRC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn sysclk(self) -> &'a mut crate::W<REG> {
self.variant(CKOUTSRC::Sysclk)
}
#[inline(always)]
pub fn audclk(self) -> &'a mut crate::W<REG> {
self.variant(CKOUTSRC::Audclk)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DFSDMEN {
Disabled = 0,
Enabled = 1,
}
impl From<DFSDMEN> for bool {
#[inline(always)]
fn from(variant: DFSDMEN) -> Self {
variant as u8 != 0
}
}
pub type DFSDMEN_R = crate::BitReader<DFSDMEN>;
impl DFSDMEN_R {
#[inline(always)]
pub const fn variant(&self) -> DFSDMEN {
match self.bits {
false => DFSDMEN::Disabled,
true => DFSDMEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DFSDMEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DFSDMEN::Enabled
}
}
pub type DFSDMEN_W<'a, REG> = crate::BitWriter<'a, REG, DFSDMEN>;
impl<'a, REG> DFSDMEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DFSDMEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DFSDMEN::Enabled)
}
}
impl R {
#[inline(always)]
pub fn sitp(&self) -> SITP_R {
SITP_R::new((self.bits & 3) as u8)
}
#[inline(always)]
pub fn spicksel(&self) -> SPICKSEL_R {
SPICKSEL_R::new(((self.bits >> 2) & 3) as u8)
}
#[inline(always)]
pub fn scden(&self) -> SCDEN_R {
SCDEN_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn ckaben(&self) -> CKABEN_R {
CKABEN_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn chen(&self) -> CHEN_R {
CHEN_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn chinsel(&self) -> CHINSEL_R {
CHINSEL_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn datmpx(&self) -> DATMPX_R {
DATMPX_R::new(((self.bits >> 12) & 3) as u8)
}
#[inline(always)]
pub fn datpack(&self) -> DATPACK_R {
DATPACK_R::new(((self.bits >> 14) & 3) as u8)
}
#[inline(always)]
pub fn ckoutdiv(&self) -> CKOUTDIV_R {
CKOUTDIV_R::new(((self.bits >> 16) & 0xff) as u8)
}
#[inline(always)]
pub fn ckoutsrc(&self) -> CKOUTSRC_R {
CKOUTSRC_R::new(((self.bits >> 30) & 1) != 0)
}
#[inline(always)]
pub fn dfsdmen(&self) -> DFSDMEN_R {
DFSDMEN_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("CFGR1")
.field("dfsdmen", &self.dfsdmen())
.field("ckoutsrc", &self.ckoutsrc())
.field("ckoutdiv", &self.ckoutdiv())
.field("datpack", &self.datpack())
.field("datmpx", &self.datmpx())
.field("chinsel", &self.chinsel())
.field("chen", &self.chen())
.field("ckaben", &self.ckaben())
.field("scden", &self.scden())
.field("spicksel", &self.spicksel())
.field("sitp", &self.sitp())
.finish()
}
}
impl W {
#[inline(always)]
pub fn sitp(&mut self) -> SITP_W<CFGR1rs> {
SITP_W::new(self, 0)
}
#[inline(always)]
pub fn spicksel(&mut self) -> SPICKSEL_W<CFGR1rs> {
SPICKSEL_W::new(self, 2)
}
#[inline(always)]
pub fn scden(&mut self) -> SCDEN_W<CFGR1rs> {
SCDEN_W::new(self, 5)
}
#[inline(always)]
pub fn ckaben(&mut self) -> CKABEN_W<CFGR1rs> {
CKABEN_W::new(self, 6)
}
#[inline(always)]
pub fn chen(&mut self) -> CHEN_W<CFGR1rs> {
CHEN_W::new(self, 7)
}
#[inline(always)]
pub fn chinsel(&mut self) -> CHINSEL_W<CFGR1rs> {
CHINSEL_W::new(self, 8)
}
#[inline(always)]
pub fn datmpx(&mut self) -> DATMPX_W<CFGR1rs> {
DATMPX_W::new(self, 12)
}
#[inline(always)]
pub fn datpack(&mut self) -> DATPACK_W<CFGR1rs> {
DATPACK_W::new(self, 14)
}
#[inline(always)]
pub fn ckoutdiv(&mut self) -> CKOUTDIV_W<CFGR1rs> {
CKOUTDIV_W::new(self, 16)
}
#[inline(always)]
pub fn ckoutsrc(&mut self) -> CKOUTSRC_W<CFGR1rs> {
CKOUTSRC_W::new(self, 30)
}
#[inline(always)]
pub fn dfsdmen(&mut self) -> DFSDMEN_W<CFGR1rs> {
DFSDMEN_W::new(self, 31)
}
}
pub struct CFGR1rs;
impl crate::RegisterSpec for CFGR1rs {
type Ux = u32;
}
impl crate::Readable for CFGR1rs {}
impl crate::Writable for CFGR1rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CFGR1rs {}