stm32f1_staging/stm32f101/spi1/
i2scfgr.rspub 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 CHLEN {
SixteenBit = 0,
ThirtyTwoBit = 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::SixteenBit,
true => CHLEN::ThirtyTwoBit,
}
}
#[inline(always)]
pub fn is_sixteen_bit(&self) -> bool {
*self == CHLEN::SixteenBit
}
#[inline(always)]
pub fn is_thirty_two_bit(&self) -> bool {
*self == CHLEN::ThirtyTwoBit
}
}
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 sixteen_bit(self) -> &'a mut crate::W<REG> {
self.variant(CHLEN::SixteenBit)
}
#[inline(always)]
pub fn thirty_two_bit(self) -> &'a mut crate::W<REG> {
self.variant(CHLEN::ThirtyTwoBit)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DATLEN {
SixteenBit = 0,
TwentyFourBit = 1,
ThirtyTwoBit = 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::SixteenBit),
1 => Some(DATLEN::TwentyFourBit),
2 => Some(DATLEN::ThirtyTwoBit),
_ => None,
}
}
#[inline(always)]
pub fn is_sixteen_bit(&self) -> bool {
*self == DATLEN::SixteenBit
}
#[inline(always)]
pub fn is_twenty_four_bit(&self) -> bool {
*self == DATLEN::TwentyFourBit
}
#[inline(always)]
pub fn is_thirty_two_bit(&self) -> bool {
*self == DATLEN::ThirtyTwoBit
}
}
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 sixteen_bit(self) -> &'a mut crate::W<REG> {
self.variant(DATLEN::SixteenBit)
}
#[inline(always)]
pub fn twenty_four_bit(self) -> &'a mut crate::W<REG> {
self.variant(DATLEN::TwentyFourBit)
}
#[inline(always)]
pub fn thirty_two_bit(self) -> &'a mut crate::W<REG> {
self.variant(DATLEN::ThirtyTwoBit)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CKPOL {
IdleLow = 0,
IdleHigh = 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::IdleLow,
true => CKPOL::IdleHigh,
}
}
#[inline(always)]
pub fn is_idle_low(&self) -> bool {
*self == CKPOL::IdleLow
}
#[inline(always)]
pub fn is_idle_high(&self) -> bool {
*self == CKPOL::IdleHigh
}
}
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 idle_low(self) -> &'a mut crate::W<REG> {
self.variant(CKPOL::IdleLow)
}
#[inline(always)]
pub fn idle_high(self) -> &'a mut crate::W<REG> {
self.variant(CKPOL::IdleHigh)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum I2SSTD {
Philips = 0,
Msb = 1,
Lsb = 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::Msb,
2 => I2SSTD::Lsb,
3 => I2SSTD::Pcm,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_philips(&self) -> bool {
*self == I2SSTD::Philips
}
#[inline(always)]
pub fn is_msb(&self) -> bool {
*self == I2SSTD::Msb
}
#[inline(always)]
pub fn is_lsb(&self) -> bool {
*self == I2SSTD::Lsb
}
#[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 msb(self) -> &'a mut crate::W<REG> {
self.variant(I2SSTD::Msb)
}
#[inline(always)]
pub fn lsb(self) -> &'a mut crate::W<REG> {
self.variant(I2SSTD::Lsb)
}
#[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 I2SCFG {
SlaveTx = 0,
SlaveRx = 1,
MasterTx = 2,
MasterRx = 3,
}
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) -> I2SCFG {
match self.bits {
0 => I2SCFG::SlaveTx,
1 => I2SCFG::SlaveRx,
2 => I2SCFG::MasterTx,
3 => I2SCFG::MasterRx,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_slave_tx(&self) -> bool {
*self == I2SCFG::SlaveTx
}
#[inline(always)]
pub fn is_slave_rx(&self) -> bool {
*self == I2SCFG::SlaveRx
}
#[inline(always)]
pub fn is_master_tx(&self) -> bool {
*self == I2SCFG::MasterTx
}
#[inline(always)]
pub fn is_master_rx(&self) -> bool {
*self == I2SCFG::MasterRx
}
}
pub type I2SCFG_W<'a, REG> = crate::FieldWriter<'a, REG, 2, I2SCFG, crate::Safe>;
impl<'a, REG> I2SCFG_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn slave_tx(self) -> &'a mut crate::W<REG> {
self.variant(I2SCFG::SlaveTx)
}
#[inline(always)]
pub fn slave_rx(self) -> &'a mut crate::W<REG> {
self.variant(I2SCFG::SlaveRx)
}
#[inline(always)]
pub fn master_tx(self) -> &'a mut crate::W<REG> {
self.variant(I2SCFG::MasterTx)
}
#[inline(always)]
pub fn master_rx(self) -> &'a mut crate::W<REG> {
self.variant(I2SCFG::MasterRx)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum I2SE {
Disabled = 0,
Enabled = 1,
}
impl From<I2SE> for bool {
#[inline(always)]
fn from(variant: I2SE) -> Self {
variant as u8 != 0
}
}
pub type I2SE_R = crate::BitReader<I2SE>;
impl I2SE_R {
#[inline(always)]
pub const fn variant(&self) -> I2SE {
match self.bits {
false => I2SE::Disabled,
true => I2SE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == I2SE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == I2SE::Enabled
}
}
pub type I2SE_W<'a, REG> = crate::BitWriter<'a, REG, I2SE>;
impl<'a, REG> I2SE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(I2SE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(I2SE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum I2SMOD {
Spimode = 0,
I2smode = 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::Spimode,
true => I2SMOD::I2smode,
}
}
#[inline(always)]
pub fn is_spimode(&self) -> bool {
*self == I2SMOD::Spimode
}
#[inline(always)]
pub fn is_i2smode(&self) -> bool {
*self == I2SMOD::I2smode
}
}
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 spimode(self) -> &'a mut crate::W<REG> {
self.variant(I2SMOD::Spimode)
}
#[inline(always)]
pub fn i2smode(self) -> &'a mut crate::W<REG> {
self.variant(I2SMOD::I2smode)
}
}
impl R {
#[inline(always)]
pub fn chlen(&self) -> CHLEN_R {
CHLEN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn datlen(&self) -> DATLEN_R {
DATLEN_R::new(((self.bits >> 1) & 3) as u8)
}
#[inline(always)]
pub fn ckpol(&self) -> CKPOL_R {
CKPOL_R::new(((self.bits >> 3) & 1) != 0)
}
#[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 i2scfg(&self) -> I2SCFG_R {
I2SCFG_R::new(((self.bits >> 8) & 3) as u8)
}
#[inline(always)]
pub fn i2se(&self) -> I2SE_R {
I2SE_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn i2smod(&self) -> I2SMOD_R {
I2SMOD_R::new(((self.bits >> 11) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("I2SCFGR")
.field("i2smod", &self.i2smod())
.field("i2se", &self.i2se())
.field("i2scfg", &self.i2scfg())
.field("pcmsync", &self.pcmsync())
.field("i2sstd", &self.i2sstd())
.field("ckpol", &self.ckpol())
.field("datlen", &self.datlen())
.field("chlen", &self.chlen())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn chlen(&mut self) -> CHLEN_W<I2SCFGRrs> {
CHLEN_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn datlen(&mut self) -> DATLEN_W<I2SCFGRrs> {
DATLEN_W::new(self, 1)
}
#[inline(always)]
#[must_use]
pub fn ckpol(&mut self) -> CKPOL_W<I2SCFGRrs> {
CKPOL_W::new(self, 3)
}
#[inline(always)]
#[must_use]
pub fn i2sstd(&mut self) -> I2SSTD_W<I2SCFGRrs> {
I2SSTD_W::new(self, 4)
}
#[inline(always)]
#[must_use]
pub fn pcmsync(&mut self) -> PCMSYNC_W<I2SCFGRrs> {
PCMSYNC_W::new(self, 7)
}
#[inline(always)]
#[must_use]
pub fn i2scfg(&mut self) -> I2SCFG_W<I2SCFGRrs> {
I2SCFG_W::new(self, 8)
}
#[inline(always)]
#[must_use]
pub fn i2se(&mut self) -> I2SE_W<I2SCFGRrs> {
I2SE_W::new(self, 10)
}
#[inline(always)]
#[must_use]
pub fn i2smod(&mut self) -> I2SMOD_W<I2SCFGRrs> {
I2SMOD_W::new(self, 11)
}
}
pub struct I2SCFGRrs;
impl crate::RegisterSpec for I2SCFGRrs {
type Ux = u16;
}
impl crate::Readable for I2SCFGRrs {}
impl crate::Writable for I2SCFGRrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
}
impl crate::Resettable for I2SCFGRrs {
const RESET_VALUE: u16 = 0;
}