pub type R = crate::R<I2SCFGRrs>;
pub type W = crate::W<I2SCFGRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum I2SMOD {
Spi = 0,
I2s = 1,
}
impl From<I2SMOD> for bool {
#[inline(always)]
fn from(variant: I2SMOD) -> Self {
variant as u8 != 0
}
}
pub type I2SMOD_R = crate::BitReader<I2SMOD>;
impl I2SMOD_R {
#[inline(always)]
pub const fn variant(&self) -> I2SMOD {
match self.bits {
false => I2SMOD::Spi,
true => I2SMOD::I2s,
}
}
#[inline(always)]
pub fn is_spi(&self) -> bool {
*self == I2SMOD::Spi
}
#[inline(always)]
pub fn is_i2s(&self) -> bool {
*self == I2SMOD::I2s
}
}
pub type I2SMOD_W<'a, REG> = crate::BitWriter<'a, REG, I2SMOD>;
impl<'a, REG> I2SMOD_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn spi(self) -> &'a mut crate::W<REG> {
self.variant(I2SMOD::Spi)
}
#[inline(always)]
pub fn i2s(self) -> &'a mut crate::W<REG> {
self.variant(I2SMOD::I2s)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum I2SCFG {
SlaveTransmit = 0,
SlaveReceive = 1,
MasterTransmit = 2,
MasterReceive = 3,
SlaveFullDuplex = 4,
MasterFullDuplex = 5,
}
impl From<I2SCFG> for u8 {
#[inline(always)]
fn from(variant: I2SCFG) -> Self {
variant as _
}
}
impl crate::FieldSpec for I2SCFG {
type Ux = u8;
}
impl crate::IsEnum for I2SCFG {}
pub type I2SCFG_R = crate::FieldReader<I2SCFG>;
impl I2SCFG_R {
#[inline(always)]
pub const fn variant(&self) -> Option<I2SCFG> {
match self.bits {
0 => Some(I2SCFG::SlaveTransmit),
1 => Some(I2SCFG::SlaveReceive),
2 => Some(I2SCFG::MasterTransmit),
3 => Some(I2SCFG::MasterReceive),
4 => Some(I2SCFG::SlaveFullDuplex),
5 => Some(I2SCFG::MasterFullDuplex),
_ => None,
}
}
#[inline(always)]
pub fn is_slave_transmit(&self) -> bool {
*self == I2SCFG::SlaveTransmit
}
#[inline(always)]
pub fn is_slave_receive(&self) -> bool {
*self == I2SCFG::SlaveReceive
}
#[inline(always)]
pub fn is_master_transmit(&self) -> bool {
*self == I2SCFG::MasterTransmit
}
#[inline(always)]
pub fn is_master_receive(&self) -> bool {
*self == I2SCFG::MasterReceive
}
#[inline(always)]
pub fn is_slave_full_duplex(&self) -> bool {
*self == I2SCFG::SlaveFullDuplex
}
#[inline(always)]
pub fn is_master_full_duplex(&self) -> bool {
*self == I2SCFG::MasterFullDuplex
}
}
pub type I2SCFG_W<'a, REG> = crate::FieldWriter<'a, REG, 3, I2SCFG>;
impl<'a, REG> I2SCFG_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn slave_transmit(self) -> &'a mut crate::W<REG> {
self.variant(I2SCFG::SlaveTransmit)
}
#[inline(always)]
pub fn slave_receive(self) -> &'a mut crate::W<REG> {
self.variant(I2SCFG::SlaveReceive)
}
#[inline(always)]
pub fn master_transmit(self) -> &'a mut crate::W<REG> {
self.variant(I2SCFG::MasterTransmit)
}
#[inline(always)]
pub fn master_receive(self) -> &'a mut crate::W<REG> {
self.variant(I2SCFG::MasterReceive)
}
#[inline(always)]
pub fn slave_full_duplex(self) -> &'a mut crate::W<REG> {
self.variant(I2SCFG::SlaveFullDuplex)
}
#[inline(always)]
pub fn master_full_duplex(self) -> &'a mut crate::W<REG> {
self.variant(I2SCFG::MasterFullDuplex)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum I2SSTD {
Philips = 0,
LeftAligned = 1,
RightAligned = 2,
Pcm = 3,
}
impl From<I2SSTD> for u8 {
#[inline(always)]
fn from(variant: I2SSTD) -> Self {
variant as _
}
}
impl crate::FieldSpec for I2SSTD {
type Ux = u8;
}
impl crate::IsEnum for I2SSTD {}
pub type I2SSTD_R = crate::FieldReader<I2SSTD>;
impl I2SSTD_R {
#[inline(always)]
pub const fn variant(&self) -> I2SSTD {
match self.bits {
0 => I2SSTD::Philips,
1 => I2SSTD::LeftAligned,
2 => I2SSTD::RightAligned,
3 => I2SSTD::Pcm,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_philips(&self) -> bool {
*self == I2SSTD::Philips
}
#[inline(always)]
pub fn is_left_aligned(&self) -> bool {
*self == I2SSTD::LeftAligned
}
#[inline(always)]
pub fn is_right_aligned(&self) -> bool {
*self == I2SSTD::RightAligned
}
#[inline(always)]
pub fn is_pcm(&self) -> bool {
*self == I2SSTD::Pcm
}
}
pub type I2SSTD_W<'a, REG> = crate::FieldWriter<'a, REG, 2, I2SSTD, crate::Safe>;
impl<'a, REG> I2SSTD_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn philips(self) -> &'a mut crate::W<REG> {
self.variant(I2SSTD::Philips)
}
#[inline(always)]
pub fn left_aligned(self) -> &'a mut crate::W<REG> {
self.variant(I2SSTD::LeftAligned)
}
#[inline(always)]
pub fn right_aligned(self) -> &'a mut crate::W<REG> {
self.variant(I2SSTD::RightAligned)
}
#[inline(always)]
pub fn pcm(self) -> &'a mut crate::W<REG> {
self.variant(I2SSTD::Pcm)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PCMSYNC {
Short = 0,
Long = 1,
}
impl From<PCMSYNC> for bool {
#[inline(always)]
fn from(variant: PCMSYNC) -> Self {
variant as u8 != 0
}
}
pub type PCMSYNC_R = crate::BitReader<PCMSYNC>;
impl PCMSYNC_R {
#[inline(always)]
pub const fn variant(&self) -> PCMSYNC {
match self.bits {
false => PCMSYNC::Short,
true => PCMSYNC::Long,
}
}
#[inline(always)]
pub fn is_short(&self) -> bool {
*self == PCMSYNC::Short
}
#[inline(always)]
pub fn is_long(&self) -> bool {
*self == PCMSYNC::Long
}
}
pub type PCMSYNC_W<'a, REG> = crate::BitWriter<'a, REG, PCMSYNC>;
impl<'a, REG> PCMSYNC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn short(self) -> &'a mut crate::W<REG> {
self.variant(PCMSYNC::Short)
}
#[inline(always)]
pub fn long(self) -> &'a mut crate::W<REG> {
self.variant(PCMSYNC::Long)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DATLEN {
Bits16 = 0,
Bits24 = 1,
Bits32 = 2,
}
impl From<DATLEN> for u8 {
#[inline(always)]
fn from(variant: DATLEN) -> Self {
variant as _
}
}
impl crate::FieldSpec for DATLEN {
type Ux = u8;
}
impl crate::IsEnum for DATLEN {}
pub type DATLEN_R = crate::FieldReader<DATLEN>;
impl DATLEN_R {
#[inline(always)]
pub const fn variant(&self) -> Option<DATLEN> {
match self.bits {
0 => Some(DATLEN::Bits16),
1 => Some(DATLEN::Bits24),
2 => Some(DATLEN::Bits32),
_ => None,
}
}
#[inline(always)]
pub fn is_bits16(&self) -> bool {
*self == DATLEN::Bits16
}
#[inline(always)]
pub fn is_bits24(&self) -> bool {
*self == DATLEN::Bits24
}
#[inline(always)]
pub fn is_bits32(&self) -> bool {
*self == DATLEN::Bits32
}
}
pub type DATLEN_W<'a, REG> = crate::FieldWriter<'a, REG, 2, DATLEN>;
impl<'a, REG> DATLEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn bits16(self) -> &'a mut crate::W<REG> {
self.variant(DATLEN::Bits16)
}
#[inline(always)]
pub fn bits24(self) -> &'a mut crate::W<REG> {
self.variant(DATLEN::Bits24)
}
#[inline(always)]
pub fn bits32(self) -> &'a mut crate::W<REG> {
self.variant(DATLEN::Bits32)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CHLEN {
Bits16 = 0,
Bits32 = 1,
}
impl From<CHLEN> for bool {
#[inline(always)]
fn from(variant: CHLEN) -> Self {
variant as u8 != 0
}
}
pub type CHLEN_R = crate::BitReader<CHLEN>;
impl CHLEN_R {
#[inline(always)]
pub const fn variant(&self) -> CHLEN {
match self.bits {
false => CHLEN::Bits16,
true => CHLEN::Bits32,
}
}
#[inline(always)]
pub fn is_bits16(&self) -> bool {
*self == CHLEN::Bits16
}
#[inline(always)]
pub fn is_bits32(&self) -> bool {
*self == CHLEN::Bits32
}
}
pub type CHLEN_W<'a, REG> = crate::BitWriter<'a, REG, CHLEN>;
impl<'a, REG> CHLEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn bits16(self) -> &'a mut crate::W<REG> {
self.variant(CHLEN::Bits16)
}
#[inline(always)]
pub fn bits32(self) -> &'a mut crate::W<REG> {
self.variant(CHLEN::Bits32)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CKPOL {
SampleOnRising = 0,
SampleOnFalling = 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::SampleOnRising,
true => CKPOL::SampleOnFalling,
}
}
#[inline(always)]
pub fn is_sample_on_rising(&self) -> bool {
*self == CKPOL::SampleOnRising
}
#[inline(always)]
pub fn is_sample_on_falling(&self) -> bool {
*self == CKPOL::SampleOnFalling
}
}
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 sample_on_rising(self) -> &'a mut crate::W<REG> {
self.variant(CKPOL::SampleOnRising)
}
#[inline(always)]
pub fn sample_on_falling(self) -> &'a mut crate::W<REG> {
self.variant(CKPOL::SampleOnFalling)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FIXCH {
NotFixed = 0,
Fixed = 1,
}
impl From<FIXCH> for bool {
#[inline(always)]
fn from(variant: FIXCH) -> Self {
variant as u8 != 0
}
}
pub type FIXCH_R = crate::BitReader<FIXCH>;
impl FIXCH_R {
#[inline(always)]
pub const fn variant(&self) -> FIXCH {
match self.bits {
false => FIXCH::NotFixed,
true => FIXCH::Fixed,
}
}
#[inline(always)]
pub fn is_not_fixed(&self) -> bool {
*self == FIXCH::NotFixed
}
#[inline(always)]
pub fn is_fixed(&self) -> bool {
*self == FIXCH::Fixed
}
}
pub type FIXCH_W<'a, REG> = crate::BitWriter<'a, REG, FIXCH>;
impl<'a, REG> FIXCH_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_fixed(self) -> &'a mut crate::W<REG> {
self.variant(FIXCH::NotFixed)
}
#[inline(always)]
pub fn fixed(self) -> &'a mut crate::W<REG> {
self.variant(FIXCH::Fixed)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum WSINV {
Disabled = 0,
Enabled = 1,
}
impl From<WSINV> for bool {
#[inline(always)]
fn from(variant: WSINV) -> Self {
variant as u8 != 0
}
}
pub type WSINV_R = crate::BitReader<WSINV>;
impl WSINV_R {
#[inline(always)]
pub const fn variant(&self) -> WSINV {
match self.bits {
false => WSINV::Disabled,
true => WSINV::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == WSINV::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == WSINV::Enabled
}
}
pub type WSINV_W<'a, REG> = crate::BitWriter<'a, REG, WSINV>;
impl<'a, REG> WSINV_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(WSINV::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(WSINV::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DATFMT {
RightAligned = 0,
LeftAligned = 1,
}
impl From<DATFMT> for bool {
#[inline(always)]
fn from(variant: DATFMT) -> Self {
variant as u8 != 0
}
}
pub type DATFMT_R = crate::BitReader<DATFMT>;
impl DATFMT_R {
#[inline(always)]
pub const fn variant(&self) -> DATFMT {
match self.bits {
false => DATFMT::RightAligned,
true => DATFMT::LeftAligned,
}
}
#[inline(always)]
pub fn is_right_aligned(&self) -> bool {
*self == DATFMT::RightAligned
}
#[inline(always)]
pub fn is_left_aligned(&self) -> bool {
*self == DATFMT::LeftAligned
}
}
pub type DATFMT_W<'a, REG> = crate::BitWriter<'a, REG, DATFMT>;
impl<'a, REG> DATFMT_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn right_aligned(self) -> &'a mut crate::W<REG> {
self.variant(DATFMT::RightAligned)
}
#[inline(always)]
pub fn left_aligned(self) -> &'a mut crate::W<REG> {
self.variant(DATFMT::LeftAligned)
}
}
pub type I2SDIV_R = crate::FieldReader;
pub type I2SDIV_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ODD {
Even = 0,
Odd = 1,
}
impl From<ODD> for bool {
#[inline(always)]
fn from(variant: ODD) -> Self {
variant as u8 != 0
}
}
pub type ODD_R = crate::BitReader<ODD>;
impl ODD_R {
#[inline(always)]
pub const fn variant(&self) -> ODD {
match self.bits {
false => ODD::Even,
true => ODD::Odd,
}
}
#[inline(always)]
pub fn is_even(&self) -> bool {
*self == ODD::Even
}
#[inline(always)]
pub fn is_odd(&self) -> bool {
*self == ODD::Odd
}
}
pub type ODD_W<'a, REG> = crate::BitWriter<'a, REG, ODD>;
impl<'a, REG> ODD_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn even(self) -> &'a mut crate::W<REG> {
self.variant(ODD::Even)
}
#[inline(always)]
pub fn odd(self) -> &'a mut crate::W<REG> {
self.variant(ODD::Odd)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MCKOE {
Disabled = 0,
Enabled = 1,
}
impl From<MCKOE> for bool {
#[inline(always)]
fn from(variant: MCKOE) -> Self {
variant as u8 != 0
}
}
pub type MCKOE_R = crate::BitReader<MCKOE>;
impl MCKOE_R {
#[inline(always)]
pub const fn variant(&self) -> MCKOE {
match self.bits {
false => MCKOE::Disabled,
true => MCKOE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == MCKOE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == MCKOE::Enabled
}
}
pub type MCKOE_W<'a, REG> = crate::BitWriter<'a, REG, MCKOE>;
impl<'a, REG> MCKOE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(MCKOE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(MCKOE::Enabled)
}
}
impl R {
#[inline(always)]
pub fn i2smod(&self) -> I2SMOD_R {
I2SMOD_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn i2scfg(&self) -> I2SCFG_R {
I2SCFG_R::new(((self.bits >> 1) & 7) as u8)
}
#[inline(always)]
pub fn i2sstd(&self) -> I2SSTD_R {
I2SSTD_R::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn pcmsync(&self) -> PCMSYNC_R {
PCMSYNC_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn datlen(&self) -> DATLEN_R {
DATLEN_R::new(((self.bits >> 8) & 3) as u8)
}
#[inline(always)]
pub fn chlen(&self) -> CHLEN_R {
CHLEN_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn ckpol(&self) -> CKPOL_R {
CKPOL_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn fixch(&self) -> FIXCH_R {
FIXCH_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn wsinv(&self) -> WSINV_R {
WSINV_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn datfmt(&self) -> DATFMT_R {
DATFMT_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn i2sdiv(&self) -> I2SDIV_R {
I2SDIV_R::new(((self.bits >> 16) & 0xff) as u8)
}
#[inline(always)]
pub fn odd(&self) -> ODD_R {
ODD_R::new(((self.bits >> 24) & 1) != 0)
}
#[inline(always)]
pub fn mckoe(&self) -> MCKOE_R {
MCKOE_R::new(((self.bits >> 25) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("I2SCFGR")
.field("mckoe", &self.mckoe())
.field("odd", &self.odd())
.field("i2sdiv", &self.i2sdiv())
.field("datfmt", &self.datfmt())
.field("wsinv", &self.wsinv())
.field("fixch", &self.fixch())
.field("ckpol", &self.ckpol())
.field("chlen", &self.chlen())
.field("datlen", &self.datlen())
.field("pcmsync", &self.pcmsync())
.field("i2sstd", &self.i2sstd())
.field("i2scfg", &self.i2scfg())
.field("i2smod", &self.i2smod())
.finish()
}
}
impl W {
#[inline(always)]
pub fn i2smod(&mut self) -> I2SMOD_W<I2SCFGRrs> {
I2SMOD_W::new(self, 0)
}
#[inline(always)]
pub fn i2scfg(&mut self) -> I2SCFG_W<I2SCFGRrs> {
I2SCFG_W::new(self, 1)
}
#[inline(always)]
pub fn i2sstd(&mut self) -> I2SSTD_W<I2SCFGRrs> {
I2SSTD_W::new(self, 4)
}
#[inline(always)]
pub fn pcmsync(&mut self) -> PCMSYNC_W<I2SCFGRrs> {
PCMSYNC_W::new(self, 7)
}
#[inline(always)]
pub fn datlen(&mut self) -> DATLEN_W<I2SCFGRrs> {
DATLEN_W::new(self, 8)
}
#[inline(always)]
pub fn chlen(&mut self) -> CHLEN_W<I2SCFGRrs> {
CHLEN_W::new(self, 10)
}
#[inline(always)]
pub fn ckpol(&mut self) -> CKPOL_W<I2SCFGRrs> {
CKPOL_W::new(self, 11)
}
#[inline(always)]
pub fn fixch(&mut self) -> FIXCH_W<I2SCFGRrs> {
FIXCH_W::new(self, 12)
}
#[inline(always)]
pub fn wsinv(&mut self) -> WSINV_W<I2SCFGRrs> {
WSINV_W::new(self, 13)
}
#[inline(always)]
pub fn datfmt(&mut self) -> DATFMT_W<I2SCFGRrs> {
DATFMT_W::new(self, 14)
}
#[inline(always)]
pub fn i2sdiv(&mut self) -> I2SDIV_W<I2SCFGRrs> {
I2SDIV_W::new(self, 16)
}
#[inline(always)]
pub fn odd(&mut self) -> ODD_W<I2SCFGRrs> {
ODD_W::new(self, 24)
}
#[inline(always)]
pub fn mckoe(&mut self) -> MCKOE_W<I2SCFGRrs> {
MCKOE_W::new(self, 25)
}
}
pub struct I2SCFGRrs;
impl crate::RegisterSpec for I2SCFGRrs {
type Ux = u32;
}
impl crate::Readable for I2SCFGRrs {}
impl crate::Writable for I2SCFGRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for I2SCFGRrs {}