#[doc = "Register `CR1` reader"]
pub struct R(crate::R<CR1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CR1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CR1_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CR1_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `CR1` writer"]
pub struct W(crate::W<CR1_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<CR1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<CR1_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<CR1_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `MCKEN` reader - MCKEN"]
pub struct MCKEN_R(crate::FieldReader<bool, bool>);
impl MCKEN_R {
pub(crate) fn new(bits: bool) -> Self {
MCKEN_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MCKEN_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MCKEN` writer - MCKEN"]
pub struct MCKEN_W<'a> {
w: &'a mut W,
}
impl<'a> MCKEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 27)) | ((value as u32 & 0x01) << 27);
self.w
}
}
#[doc = "Field `OSR` reader - OSR"]
pub struct OSR_R(crate::FieldReader<bool, bool>);
impl OSR_R {
pub(crate) fn new(bits: bool) -> Self {
OSR_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for OSR_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `OSR` writer - OSR"]
pub struct OSR_W<'a> {
w: &'a mut W,
}
impl<'a> OSR_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 26)) | ((value as u32 & 0x01) << 26);
self.w
}
}
#[doc = "Field `MCKDIV` reader - Master clock divider"]
pub struct MCKDIV_R(crate::FieldReader<u8, u8>);
impl MCKDIV_R {
pub(crate) fn new(bits: u8) -> Self {
MCKDIV_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MCKDIV_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MCKDIV` writer - Master clock divider"]
pub struct MCKDIV_W<'a> {
w: &'a mut W,
}
impl<'a> MCKDIV_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x3f << 20)) | ((value as u32 & 0x3f) << 20);
self.w
}
}
#[doc = "Field `NODIV` reader - No divider"]
pub struct NODIV_R(crate::FieldReader<bool, bool>);
impl NODIV_R {
pub(crate) fn new(bits: bool) -> Self {
NODIV_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for NODIV_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `NODIV` writer - No divider"]
pub struct NODIV_W<'a> {
w: &'a mut W,
}
impl<'a> NODIV_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19);
self.w
}
}
#[doc = "Field `DMAEN` reader - DMA enable"]
pub struct DMAEN_R(crate::FieldReader<bool, bool>);
impl DMAEN_R {
pub(crate) fn new(bits: bool) -> Self {
DMAEN_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for DMAEN_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `DMAEN` writer - DMA enable"]
pub struct DMAEN_W<'a> {
w: &'a mut W,
}
impl<'a> DMAEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
self.w
}
}
#[doc = "Field `SAIEN` reader - Audio block A enable"]
pub struct SAIEN_R(crate::FieldReader<bool, bool>);
impl SAIEN_R {
pub(crate) fn new(bits: bool) -> Self {
SAIEN_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for SAIEN_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SAIEN` writer - Audio block A enable"]
pub struct SAIEN_W<'a> {
w: &'a mut W,
}
impl<'a> SAIEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
self.w
}
}
#[doc = "Field `OUTDRIV` reader - Output drive"]
pub struct OUTDRIV_R(crate::FieldReader<bool, bool>);
impl OUTDRIV_R {
pub(crate) fn new(bits: bool) -> Self {
OUTDRIV_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for OUTDRIV_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `OUTDRIV` writer - Output drive"]
pub struct OUTDRIV_W<'a> {
w: &'a mut W,
}
impl<'a> OUTDRIV_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 13)) | ((value as u32 & 0x01) << 13);
self.w
}
}
#[doc = "Field `MONO` reader - Mono mode"]
pub struct MONO_R(crate::FieldReader<bool, bool>);
impl MONO_R {
pub(crate) fn new(bits: bool) -> Self {
MONO_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MONO_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MONO` writer - Mono mode"]
pub struct MONO_W<'a> {
w: &'a mut W,
}
impl<'a> MONO_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12);
self.w
}
}
#[doc = "Field `SYNCEN` reader - Synchronization enable"]
pub struct SYNCEN_R(crate::FieldReader<u8, u8>);
impl SYNCEN_R {
pub(crate) fn new(bits: u8) -> Self {
SYNCEN_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for SYNCEN_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SYNCEN` writer - Synchronization enable"]
pub struct SYNCEN_W<'a> {
w: &'a mut W,
}
impl<'a> SYNCEN_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 10)) | ((value as u32 & 0x03) << 10);
self.w
}
}
#[doc = "Field `CKSTR` reader - Clock strobing edge"]
pub struct CKSTR_R(crate::FieldReader<bool, bool>);
impl CKSTR_R {
pub(crate) fn new(bits: bool) -> Self {
CKSTR_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for CKSTR_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CKSTR` writer - Clock strobing edge"]
pub struct CKSTR_W<'a> {
w: &'a mut W,
}
impl<'a> CKSTR_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 9)) | ((value as u32 & 0x01) << 9);
self.w
}
}
#[doc = "Field `LSBFIRST` reader - Least significant bit first"]
pub struct LSBFIRST_R(crate::FieldReader<bool, bool>);
impl LSBFIRST_R {
pub(crate) fn new(bits: bool) -> Self {
LSBFIRST_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSBFIRST_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSBFIRST` writer - Least significant bit first"]
pub struct LSBFIRST_W<'a> {
w: &'a mut W,
}
impl<'a> LSBFIRST_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 8)) | ((value as u32 & 0x01) << 8);
self.w
}
}
#[doc = "Field `DS` reader - Data size"]
pub struct DS_R(crate::FieldReader<u8, u8>);
impl DS_R {
pub(crate) fn new(bits: u8) -> Self {
DS_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for DS_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `DS` writer - Data size"]
pub struct DS_W<'a> {
w: &'a mut W,
}
impl<'a> DS_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x07 << 5)) | ((value as u32 & 0x07) << 5);
self.w
}
}
#[doc = "Field `PRTCFG` reader - Protocol configuration"]
pub struct PRTCFG_R(crate::FieldReader<u8, u8>);
impl PRTCFG_R {
pub(crate) fn new(bits: u8) -> Self {
PRTCFG_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for PRTCFG_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PRTCFG` writer - Protocol configuration"]
pub struct PRTCFG_W<'a> {
w: &'a mut W,
}
impl<'a> PRTCFG_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 2)) | ((value as u32 & 0x03) << 2);
self.w
}
}
#[doc = "Field `MODE` reader - Audio block mode"]
pub struct MODE_R(crate::FieldReader<u8, u8>);
impl MODE_R {
pub(crate) fn new(bits: u8) -> Self {
MODE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MODE_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MODE` writer - Audio block mode"]
pub struct MODE_W<'a> {
w: &'a mut W,
}
impl<'a> MODE_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
self.w
}
}
impl R {
#[doc = "Bit 27 - MCKEN"]
#[inline(always)]
pub fn mcken(&self) -> MCKEN_R {
MCKEN_R::new(((self.bits >> 27) & 0x01) != 0)
}
#[doc = "Bit 26 - OSR"]
#[inline(always)]
pub fn osr(&self) -> OSR_R {
OSR_R::new(((self.bits >> 26) & 0x01) != 0)
}
#[doc = "Bits 20:25 - Master clock divider"]
#[inline(always)]
pub fn mckdiv(&self) -> MCKDIV_R {
MCKDIV_R::new(((self.bits >> 20) & 0x3f) as u8)
}
#[doc = "Bit 19 - No divider"]
#[inline(always)]
pub fn nodiv(&self) -> NODIV_R {
NODIV_R::new(((self.bits >> 19) & 0x01) != 0)
}
#[doc = "Bit 17 - DMA enable"]
#[inline(always)]
pub fn dmaen(&self) -> DMAEN_R {
DMAEN_R::new(((self.bits >> 17) & 0x01) != 0)
}
#[doc = "Bit 16 - Audio block A enable"]
#[inline(always)]
pub fn saien(&self) -> SAIEN_R {
SAIEN_R::new(((self.bits >> 16) & 0x01) != 0)
}
#[doc = "Bit 13 - Output drive"]
#[inline(always)]
pub fn outdriv(&self) -> OUTDRIV_R {
OUTDRIV_R::new(((self.bits >> 13) & 0x01) != 0)
}
#[doc = "Bit 12 - Mono mode"]
#[inline(always)]
pub fn mono(&self) -> MONO_R {
MONO_R::new(((self.bits >> 12) & 0x01) != 0)
}
#[doc = "Bits 10:11 - Synchronization enable"]
#[inline(always)]
pub fn syncen(&self) -> SYNCEN_R {
SYNCEN_R::new(((self.bits >> 10) & 0x03) as u8)
}
#[doc = "Bit 9 - Clock strobing edge"]
#[inline(always)]
pub fn ckstr(&self) -> CKSTR_R {
CKSTR_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 8 - Least significant bit first"]
#[inline(always)]
pub fn lsbfirst(&self) -> LSBFIRST_R {
LSBFIRST_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bits 5:7 - Data size"]
#[inline(always)]
pub fn ds(&self) -> DS_R {
DS_R::new(((self.bits >> 5) & 0x07) as u8)
}
#[doc = "Bits 2:3 - Protocol configuration"]
#[inline(always)]
pub fn prtcfg(&self) -> PRTCFG_R {
PRTCFG_R::new(((self.bits >> 2) & 0x03) as u8)
}
#[doc = "Bits 0:1 - Audio block mode"]
#[inline(always)]
pub fn mode(&self) -> MODE_R {
MODE_R::new((self.bits & 0x03) as u8)
}
}
impl W {
#[doc = "Bit 27 - MCKEN"]
#[inline(always)]
pub fn mcken(&mut self) -> MCKEN_W {
MCKEN_W { w: self }
}
#[doc = "Bit 26 - OSR"]
#[inline(always)]
pub fn osr(&mut self) -> OSR_W {
OSR_W { w: self }
}
#[doc = "Bits 20:25 - Master clock divider"]
#[inline(always)]
pub fn mckdiv(&mut self) -> MCKDIV_W {
MCKDIV_W { w: self }
}
#[doc = "Bit 19 - No divider"]
#[inline(always)]
pub fn nodiv(&mut self) -> NODIV_W {
NODIV_W { w: self }
}
#[doc = "Bit 17 - DMA enable"]
#[inline(always)]
pub fn dmaen(&mut self) -> DMAEN_W {
DMAEN_W { w: self }
}
#[doc = "Bit 16 - Audio block A enable"]
#[inline(always)]
pub fn saien(&mut self) -> SAIEN_W {
SAIEN_W { w: self }
}
#[doc = "Bit 13 - Output drive"]
#[inline(always)]
pub fn outdriv(&mut self) -> OUTDRIV_W {
OUTDRIV_W { w: self }
}
#[doc = "Bit 12 - Mono mode"]
#[inline(always)]
pub fn mono(&mut self) -> MONO_W {
MONO_W { w: self }
}
#[doc = "Bits 10:11 - Synchronization enable"]
#[inline(always)]
pub fn syncen(&mut self) -> SYNCEN_W {
SYNCEN_W { w: self }
}
#[doc = "Bit 9 - Clock strobing edge"]
#[inline(always)]
pub fn ckstr(&mut self) -> CKSTR_W {
CKSTR_W { w: self }
}
#[doc = "Bit 8 - Least significant bit first"]
#[inline(always)]
pub fn lsbfirst(&mut self) -> LSBFIRST_W {
LSBFIRST_W { w: self }
}
#[doc = "Bits 5:7 - Data size"]
#[inline(always)]
pub fn ds(&mut self) -> DS_W {
DS_W { w: self }
}
#[doc = "Bits 2:3 - Protocol configuration"]
#[inline(always)]
pub fn prtcfg(&mut self) -> PRTCFG_W {
PRTCFG_W { w: self }
}
#[doc = "Bits 0:1 - Audio block mode"]
#[inline(always)]
pub fn mode(&mut self) -> MODE_W {
MODE_W { w: self }
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "AConfiguration register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr1](index.html) module"]
pub struct CR1_SPEC;
impl crate::RegisterSpec for CR1_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [cr1::R](R) reader structure"]
impl crate::Readable for CR1_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cr1::W](W) writer structure"]
impl crate::Writable for CR1_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets CR1 to value 0x40"]
impl crate::Resettable for CR1_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0x40
}
}