stm32f1_staging/stm32f102/spi1/i2scfgr.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
///Register `I2SCFGR` reader
pub type R = crate::R<I2SCFGRrs>;
///Register `I2SCFGR` writer
pub type W = crate::W<I2SCFGRrs>;
///Field `CHLEN` reader - Channel length (number of bits per audio channel)
pub type CHLEN_R = crate::BitReader;
///Field `CHLEN` writer - Channel length (number of bits per audio channel)
pub type CHLEN_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `DATLEN` reader - Data length to be transferred
pub type DATLEN_R = crate::FieldReader;
///Field `DATLEN` writer - Data length to be transferred
pub type DATLEN_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
///Field `CKPOL` reader - Steady state clock polarity
pub type CKPOL_R = crate::BitReader;
///Field `CKPOL` writer - Steady state clock polarity
pub type CKPOL_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `I2SSTD` reader - I2S standard selection
pub type I2SSTD_R = crate::FieldReader;
///Field `I2SSTD` writer - I2S standard selection
pub type I2SSTD_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
///Field `PCMSYNC` reader - PCM frame synchronization
pub type PCMSYNC_R = crate::BitReader;
///Field `PCMSYNC` writer - PCM frame synchronization
pub type PCMSYNC_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `I2SCFG` reader - I2S configuration mode
pub type I2SCFG_R = crate::FieldReader;
///Field `I2SCFG` writer - I2S configuration mode
pub type I2SCFG_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
///Field `I2SE` reader - I2S Enable
pub type I2SE_R = crate::BitReader;
///Field `I2SE` writer - I2S Enable
pub type I2SE_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `I2SMOD` reader - I2S mode selection
pub type I2SMOD_R = crate::BitReader;
///Field `I2SMOD` writer - I2S mode selection
pub type I2SMOD_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
///Bit 0 - Channel length (number of bits per audio channel)
#[inline(always)]
pub fn chlen(&self) -> CHLEN_R {
CHLEN_R::new((self.bits & 1) != 0)
}
///Bits 1:2 - Data length to be transferred
#[inline(always)]
pub fn datlen(&self) -> DATLEN_R {
DATLEN_R::new(((self.bits >> 1) & 3) as u8)
}
///Bit 3 - Steady state clock polarity
#[inline(always)]
pub fn ckpol(&self) -> CKPOL_R {
CKPOL_R::new(((self.bits >> 3) & 1) != 0)
}
///Bits 4:5 - I2S standard selection
#[inline(always)]
pub fn i2sstd(&self) -> I2SSTD_R {
I2SSTD_R::new(((self.bits >> 4) & 3) as u8)
}
///Bit 7 - PCM frame synchronization
#[inline(always)]
pub fn pcmsync(&self) -> PCMSYNC_R {
PCMSYNC_R::new(((self.bits >> 7) & 1) != 0)
}
///Bits 8:9 - I2S configuration mode
#[inline(always)]
pub fn i2scfg(&self) -> I2SCFG_R {
I2SCFG_R::new(((self.bits >> 8) & 3) as u8)
}
///Bit 10 - I2S Enable
#[inline(always)]
pub fn i2se(&self) -> I2SE_R {
I2SE_R::new(((self.bits >> 10) & 1) != 0)
}
///Bit 11 - I2S mode selection
#[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 {
///Bit 0 - Channel length (number of bits per audio channel)
#[inline(always)]
#[must_use]
pub fn chlen(&mut self) -> CHLEN_W<I2SCFGRrs> {
CHLEN_W::new(self, 0)
}
///Bits 1:2 - Data length to be transferred
#[inline(always)]
#[must_use]
pub fn datlen(&mut self) -> DATLEN_W<I2SCFGRrs> {
DATLEN_W::new(self, 1)
}
///Bit 3 - Steady state clock polarity
#[inline(always)]
#[must_use]
pub fn ckpol(&mut self) -> CKPOL_W<I2SCFGRrs> {
CKPOL_W::new(self, 3)
}
///Bits 4:5 - I2S standard selection
#[inline(always)]
#[must_use]
pub fn i2sstd(&mut self) -> I2SSTD_W<I2SCFGRrs> {
I2SSTD_W::new(self, 4)
}
///Bit 7 - PCM frame synchronization
#[inline(always)]
#[must_use]
pub fn pcmsync(&mut self) -> PCMSYNC_W<I2SCFGRrs> {
PCMSYNC_W::new(self, 7)
}
///Bits 8:9 - I2S configuration mode
#[inline(always)]
#[must_use]
pub fn i2scfg(&mut self) -> I2SCFG_W<I2SCFGRrs> {
I2SCFG_W::new(self, 8)
}
///Bit 10 - I2S Enable
#[inline(always)]
#[must_use]
pub fn i2se(&mut self) -> I2SE_W<I2SCFGRrs> {
I2SE_W::new(self, 10)
}
///Bit 11 - I2S mode selection
#[inline(always)]
#[must_use]
pub fn i2smod(&mut self) -> I2SMOD_W<I2SCFGRrs> {
I2SMOD_W::new(self, 11)
}
}
/**I2S configuration register
You can [`read`](crate::Reg::read) this register and get [`i2scfgr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`i2scfgr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F102.html#SPI1:I2SCFGR)*/
pub struct I2SCFGRrs;
impl crate::RegisterSpec for I2SCFGRrs {
type Ux = u16;
}
///`read()` method returns [`i2scfgr::R`](R) reader structure
impl crate::Readable for I2SCFGRrs {}
///`write(|w| ..)` method takes [`i2scfgr::W`](W) writer structure
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;
}
///`reset()` method sets I2SCFGR to value 0
impl crate::Resettable for I2SCFGRrs {
const RESET_VALUE: u16 = 0;
}