pub type R = crate::R<I2SCTRLrs>;
pub type W = crate::W<I2SCTRLrs>;
pub type EnR = crate::BitReader;
pub type EnW<'a, REG> = crate::BitWriter<'a, REG>;
pub type MonoR = crate::BitReader;
pub type MonoW<'a, REG> = crate::BitWriter<'a, REG>;
pub type JustifyR = crate::BitReader;
pub type JustifyW<'a, REG> = crate::BitWriter<'a, REG>;
pub type DmasplitR = crate::BitReader;
pub type DmasplitW<'a, REG> = crate::BitWriter<'a, REG>;
pub type DelayR = crate::BitReader;
pub type DelayW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum FORMAT {
W32d32 = 0,
W32d24m = 1,
W32d24 = 2,
W32d16 = 3,
W32d8 = 4,
W16d16 = 5,
W16d8 = 6,
W8d8 = 7,
}
impl From<FORMAT> for u8 {
#[inline(always)]
fn from(variant: FORMAT) -> Self {
variant as _
}
}
impl crate::FieldSpec for FORMAT {
type Ux = u8;
}
impl crate::IsEnum for FORMAT {}
pub type FormatR = crate::FieldReader<FORMAT>;
impl FormatR {
#[inline(always)]
pub const fn variant(&self) -> FORMAT {
match self.bits {
0 => FORMAT::W32d32,
1 => FORMAT::W32d24m,
2 => FORMAT::W32d24,
3 => FORMAT::W32d16,
4 => FORMAT::W32d8,
5 => FORMAT::W16d16,
6 => FORMAT::W16d8,
7 => FORMAT::W8d8,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_w32d32(&self) -> bool {
*self == FORMAT::W32d32
}
#[inline(always)]
pub fn is_w32d24m(&self) -> bool {
*self == FORMAT::W32d24m
}
#[inline(always)]
pub fn is_w32d24(&self) -> bool {
*self == FORMAT::W32d24
}
#[inline(always)]
pub fn is_w32d16(&self) -> bool {
*self == FORMAT::W32d16
}
#[inline(always)]
pub fn is_w32d8(&self) -> bool {
*self == FORMAT::W32d8
}
#[inline(always)]
pub fn is_w16d16(&self) -> bool {
*self == FORMAT::W16d16
}
#[inline(always)]
pub fn is_w16d8(&self) -> bool {
*self == FORMAT::W16d8
}
#[inline(always)]
pub fn is_w8d8(&self) -> bool {
*self == FORMAT::W8d8
}
}
pub type FormatW<'a, REG> = crate::FieldWriter<'a, REG, 3, FORMAT, crate::Safe>;
impl<'a, REG> FormatW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn w32d32(self) -> &'a mut crate::W<REG> {
self.variant(FORMAT::W32d32)
}
#[inline(always)]
pub fn w32d24m(self) -> &'a mut crate::W<REG> {
self.variant(FORMAT::W32d24m)
}
#[inline(always)]
pub fn w32d24(self) -> &'a mut crate::W<REG> {
self.variant(FORMAT::W32d24)
}
#[inline(always)]
pub fn w32d16(self) -> &'a mut crate::W<REG> {
self.variant(FORMAT::W32d16)
}
#[inline(always)]
pub fn w32d8(self) -> &'a mut crate::W<REG> {
self.variant(FORMAT::W32d8)
}
#[inline(always)]
pub fn w16d16(self) -> &'a mut crate::W<REG> {
self.variant(FORMAT::W16d16)
}
#[inline(always)]
pub fn w16d8(self) -> &'a mut crate::W<REG> {
self.variant(FORMAT::W16d8)
}
#[inline(always)]
pub fn w8d8(self) -> &'a mut crate::W<REG> {
self.variant(FORMAT::W8d8)
}
}
impl R {
#[inline(always)]
pub fn en(&self) -> EnR {
EnR::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn mono(&self) -> MonoR {
MonoR::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn justify(&self) -> JustifyR {
JustifyR::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn dmasplit(&self) -> DmasplitR {
DmasplitR::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn delay(&self) -> DelayR {
DelayR::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn format(&self) -> FormatR {
FormatR::new(((self.bits >> 8) & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("I2SCTRL")
.field("en", &self.en())
.field("mono", &self.mono())
.field("justify", &self.justify())
.field("dmasplit", &self.dmasplit())
.field("delay", &self.delay())
.field("format", &self.format())
.finish()
}
}
impl W {
#[inline(always)]
pub fn en(&mut self) -> EnW<'_, I2SCTRLrs> {
EnW::new(self, 0)
}
#[inline(always)]
pub fn mono(&mut self) -> MonoW<'_, I2SCTRLrs> {
MonoW::new(self, 1)
}
#[inline(always)]
pub fn justify(&mut self) -> JustifyW<'_, I2SCTRLrs> {
JustifyW::new(self, 2)
}
#[inline(always)]
pub fn dmasplit(&mut self) -> DmasplitW<'_, I2SCTRLrs> {
DmasplitW::new(self, 3)
}
#[inline(always)]
pub fn delay(&mut self) -> DelayW<'_, I2SCTRLrs> {
DelayW::new(self, 4)
}
#[inline(always)]
pub fn format(&mut self) -> FormatW<'_, I2SCTRLrs> {
FormatW::new(self, 8)
}
}
pub struct I2SCTRLrs;
impl crate::RegisterSpec for I2SCTRLrs {
type Ux = u32;
}
impl crate::Readable for I2SCTRLrs {}
impl crate::Writable for I2SCTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for I2SCTRLrs {}