From 0666a6ba1dbd66cf8b93c113e362ccbcd99152a0 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Sat, 6 Nov 2021 11:50:33 +0100 Subject: Initial commit --- src/dac/ctrla.rs | 204 +++++++++++++++++++++++++++ src/dac/ctrlb.rs | 394 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/dac/data.rs | 62 +++++++++ src/dac/databuf.rs | 62 +++++++++ src/dac/dbgctrl.rs | 112 +++++++++++++++ src/dac/evctrl.rs | 204 +++++++++++++++++++++++++++ src/dac/intenclr.rs | 158 +++++++++++++++++++++ src/dac/intenset.rs | 158 +++++++++++++++++++++ src/dac/intflag.rs | 158 +++++++++++++++++++++ src/dac/status.rs | 52 +++++++ src/dac/syncbusy.rs | 109 +++++++++++++++ 11 files changed, 1673 insertions(+) create mode 100644 src/dac/ctrla.rs create mode 100644 src/dac/ctrlb.rs create mode 100644 src/dac/data.rs create mode 100644 src/dac/databuf.rs create mode 100644 src/dac/dbgctrl.rs create mode 100644 src/dac/evctrl.rs create mode 100644 src/dac/intenclr.rs create mode 100644 src/dac/intenset.rs create mode 100644 src/dac/intflag.rs create mode 100644 src/dac/status.rs create mode 100644 src/dac/syncbusy.rs (limited to 'src/dac') diff --git a/src/dac/ctrla.rs b/src/dac/ctrla.rs new file mode 100644 index 0000000..cc1f32e --- /dev/null +++ b/src/dac/ctrla.rs @@ -0,0 +1,204 @@ +#[doc = "Register `CTRLA` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `CTRLA` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[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> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `SWRST` reader - Software Reset"] +pub struct SWRST_R(crate::FieldReader); +impl SWRST_R { + pub(crate) fn new(bits: bool) -> Self { + SWRST_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SWRST_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SWRST` writer - Software Reset"] +pub struct SWRST_W<'a> { + w: &'a mut W, +} +impl<'a> SWRST_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) | (value as u8 & 0x01); + self.w + } +} +#[doc = "Field `ENABLE` reader - Enable"] +pub struct ENABLE_R(crate::FieldReader); +impl ENABLE_R { + pub(crate) fn new(bits: bool) -> Self { + ENABLE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ENABLE_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ENABLE` writer - Enable"] +pub struct ENABLE_W<'a> { + w: &'a mut W, +} +impl<'a> ENABLE_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 << 1)) | ((value as u8 & 0x01) << 1); + self.w + } +} +#[doc = "Field `RUNSTDBY` reader - Run in Standby"] +pub struct RUNSTDBY_R(crate::FieldReader); +impl RUNSTDBY_R { + pub(crate) fn new(bits: bool) -> Self { + RUNSTDBY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for RUNSTDBY_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `RUNSTDBY` writer - Run in Standby"] +pub struct RUNSTDBY_W<'a> { + w: &'a mut W, +} +impl<'a> RUNSTDBY_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 << 6)) | ((value as u8 & 0x01) << 6); + self.w + } +} +impl R { + #[doc = "Bit 0 - Software Reset"] + #[inline(always)] + pub fn swrst(&self) -> SWRST_R { + SWRST_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Enable"] + #[inline(always)] + pub fn enable(&self) -> ENABLE_R { + ENABLE_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 6 - Run in Standby"] + #[inline(always)] + pub fn runstdby(&self) -> RUNSTDBY_R { + RUNSTDBY_R::new(((self.bits >> 6) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Software Reset"] + #[inline(always)] + pub fn swrst(&mut self) -> SWRST_W { + SWRST_W { w: self } + } + #[doc = "Bit 1 - Enable"] + #[inline(always)] + pub fn enable(&mut self) -> ENABLE_W { + ENABLE_W { w: self } + } + #[doc = "Bit 6 - Run in Standby"] + #[inline(always)] + pub fn runstdby(&mut self) -> RUNSTDBY_W { + RUNSTDBY_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Control A\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 [ctrla](index.html) module"] +pub struct CTRLA_SPEC; +impl crate::RegisterSpec for CTRLA_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [ctrla::R](R) reader structure"] +impl crate::Readable for CTRLA_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [ctrla::W](W) writer structure"] +impl crate::Writable for CTRLA_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets CTRLA to value 0"] +impl crate::Resettable for CTRLA_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/dac/ctrlb.rs b/src/dac/ctrlb.rs new file mode 100644 index 0000000..dfc4af6 --- /dev/null +++ b/src/dac/ctrlb.rs @@ -0,0 +1,394 @@ +#[doc = "Register `CTRLB` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `CTRLB` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[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> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `EOEN` reader - External Output Enable"] +pub struct EOEN_R(crate::FieldReader); +impl EOEN_R { + pub(crate) fn new(bits: bool) -> Self { + EOEN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for EOEN_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `EOEN` writer - External Output Enable"] +pub struct EOEN_W<'a> { + w: &'a mut W, +} +impl<'a> EOEN_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) | (value as u8 & 0x01); + self.w + } +} +#[doc = "Field `IOEN` reader - Internal Output Enable"] +pub struct IOEN_R(crate::FieldReader); +impl IOEN_R { + pub(crate) fn new(bits: bool) -> Self { + IOEN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for IOEN_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `IOEN` writer - Internal Output Enable"] +pub struct IOEN_W<'a> { + w: &'a mut W, +} +impl<'a> IOEN_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 << 1)) | ((value as u8 & 0x01) << 1); + self.w + } +} +#[doc = "Field `LEFTADJ` reader - Left Adjusted Data"] +pub struct LEFTADJ_R(crate::FieldReader); +impl LEFTADJ_R { + pub(crate) fn new(bits: bool) -> Self { + LEFTADJ_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for LEFTADJ_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `LEFTADJ` writer - Left Adjusted Data"] +pub struct LEFTADJ_W<'a> { + w: &'a mut W, +} +impl<'a> LEFTADJ_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 << 2)) | ((value as u8 & 0x01) << 2); + self.w + } +} +#[doc = "Field `VPD` reader - Voltage Pump Disable"] +pub struct VPD_R(crate::FieldReader); +impl VPD_R { + pub(crate) fn new(bits: bool) -> Self { + VPD_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for VPD_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `VPD` writer - Voltage Pump Disable"] +pub struct VPD_W<'a> { + w: &'a mut W, +} +impl<'a> VPD_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 << 3)) | ((value as u8 & 0x01) << 3); + self.w + } +} +#[doc = "Field `DITHER` reader - Dither Enable"] +pub struct DITHER_R(crate::FieldReader); +impl DITHER_R { + pub(crate) fn new(bits: bool) -> Self { + DITHER_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for DITHER_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `DITHER` writer - Dither Enable"] +pub struct DITHER_W<'a> { + w: &'a mut W, +} +impl<'a> DITHER_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 << 5)) | ((value as u8 & 0x01) << 5); + self.w + } +} +#[doc = "Reference Selection\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum REFSEL_A { + #[doc = "0: Internal 1.0V reference"] + INT1V = 0, + #[doc = "1: AVCC"] + AVCC = 1, + #[doc = "2: External reference"] + VREFP = 2, +} +impl From for u8 { + #[inline(always)] + fn from(variant: REFSEL_A) -> Self { + variant as _ + } +} +#[doc = "Field `REFSEL` reader - Reference Selection"] +pub struct REFSEL_R(crate::FieldReader); +impl REFSEL_R { + pub(crate) fn new(bits: u8) -> Self { + REFSEL_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(REFSEL_A::INT1V), + 1 => Some(REFSEL_A::AVCC), + 2 => Some(REFSEL_A::VREFP), + _ => None, + } + } + #[doc = "Checks if the value of the field is `INT1V`"] + #[inline(always)] + pub fn is_int1v(&self) -> bool { + **self == REFSEL_A::INT1V + } + #[doc = "Checks if the value of the field is `AVCC`"] + #[inline(always)] + pub fn is_avcc(&self) -> bool { + **self == REFSEL_A::AVCC + } + #[doc = "Checks if the value of the field is `VREFP`"] + #[inline(always)] + pub fn is_vrefp(&self) -> bool { + **self == REFSEL_A::VREFP + } +} +impl core::ops::Deref for REFSEL_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `REFSEL` writer - Reference Selection"] +pub struct REFSEL_W<'a> { + w: &'a mut W, +} +impl<'a> REFSEL_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: REFSEL_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "Internal 1.0V reference"] + #[inline(always)] + pub fn int1v(self) -> &'a mut W { + self.variant(REFSEL_A::INT1V) + } + #[doc = "AVCC"] + #[inline(always)] + pub fn avcc(self) -> &'a mut W { + self.variant(REFSEL_A::AVCC) + } + #[doc = "External reference"] + #[inline(always)] + pub fn vrefp(self) -> &'a mut W { + self.variant(REFSEL_A::VREFP) + } + #[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 << 6)) | ((value as u8 & 0x03) << 6); + self.w + } +} +impl R { + #[doc = "Bit 0 - External Output Enable"] + #[inline(always)] + pub fn eoen(&self) -> EOEN_R { + EOEN_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Internal Output Enable"] + #[inline(always)] + pub fn ioen(&self) -> IOEN_R { + IOEN_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Left Adjusted Data"] + #[inline(always)] + pub fn leftadj(&self) -> LEFTADJ_R { + LEFTADJ_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - Voltage Pump Disable"] + #[inline(always)] + pub fn vpd(&self) -> VPD_R { + VPD_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 5 - Dither Enable"] + #[inline(always)] + pub fn dither(&self) -> DITHER_R { + DITHER_R::new(((self.bits >> 5) & 0x01) != 0) + } + #[doc = "Bits 6:7 - Reference Selection"] + #[inline(always)] + pub fn refsel(&self) -> REFSEL_R { + REFSEL_R::new(((self.bits >> 6) & 0x03) as u8) + } +} +impl W { + #[doc = "Bit 0 - External Output Enable"] + #[inline(always)] + pub fn eoen(&mut self) -> EOEN_W { + EOEN_W { w: self } + } + #[doc = "Bit 1 - Internal Output Enable"] + #[inline(always)] + pub fn ioen(&mut self) -> IOEN_W { + IOEN_W { w: self } + } + #[doc = "Bit 2 - Left Adjusted Data"] + #[inline(always)] + pub fn leftadj(&mut self) -> LEFTADJ_W { + LEFTADJ_W { w: self } + } + #[doc = "Bit 3 - Voltage Pump Disable"] + #[inline(always)] + pub fn vpd(&mut self) -> VPD_W { + VPD_W { w: self } + } + #[doc = "Bit 5 - Dither Enable"] + #[inline(always)] + pub fn dither(&mut self) -> DITHER_W { + DITHER_W { w: self } + } + #[doc = "Bits 6:7 - Reference Selection"] + #[inline(always)] + pub fn refsel(&mut self) -> REFSEL_W { + REFSEL_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Control B\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 [ctrlb](index.html) module"] +pub struct CTRLB_SPEC; +impl crate::RegisterSpec for CTRLB_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [ctrlb::R](R) reader structure"] +impl crate::Readable for CTRLB_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [ctrlb::W](W) writer structure"] +impl crate::Writable for CTRLB_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets CTRLB to value 0"] +impl crate::Resettable for CTRLB_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/dac/data.rs b/src/dac/data.rs new file mode 100644 index 0000000..00261e9 --- /dev/null +++ b/src/dac/data.rs @@ -0,0 +1,62 @@ +#[doc = "Register `DATA` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[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> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `DATA` writer - Data value to be converted"] +pub struct DATA_W<'a> { + w: &'a mut W, +} +impl<'a> DATA_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u16) -> &'a mut W { + self.w.bits = (self.w.bits & !0xffff) | (value as u16 & 0xffff); + self.w + } +} +impl W { + #[doc = "Bits 0:15 - Data value to be converted"] + #[inline(always)] + pub fn data(&mut self) -> DATA_W { + DATA_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u16) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Data\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [data](index.html) module"] +pub struct DATA_SPEC; +impl crate::RegisterSpec for DATA_SPEC { + type Ux = u16; +} +#[doc = "`write(|w| ..)` method takes [data::W](W) writer structure"] +impl crate::Writable for DATA_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets DATA to value 0"] +impl crate::Resettable for DATA_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/dac/databuf.rs b/src/dac/databuf.rs new file mode 100644 index 0000000..1dc02d7 --- /dev/null +++ b/src/dac/databuf.rs @@ -0,0 +1,62 @@ +#[doc = "Register `DATABUF` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[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> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `DATABUF` writer - Data Buffer"] +pub struct DATABUF_W<'a> { + w: &'a mut W, +} +impl<'a> DATABUF_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u16) -> &'a mut W { + self.w.bits = (self.w.bits & !0xffff) | (value as u16 & 0xffff); + self.w + } +} +impl W { + #[doc = "Bits 0:15 - Data Buffer"] + #[inline(always)] + pub fn databuf(&mut self) -> DATABUF_W { + DATABUF_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u16) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Data Buffer\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [databuf](index.html) module"] +pub struct DATABUF_SPEC; +impl crate::RegisterSpec for DATABUF_SPEC { + type Ux = u16; +} +#[doc = "`write(|w| ..)` method takes [databuf::W](W) writer structure"] +impl crate::Writable for DATABUF_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets DATABUF to value 0"] +impl crate::Resettable for DATABUF_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/dac/dbgctrl.rs b/src/dac/dbgctrl.rs new file mode 100644 index 0000000..8befebc --- /dev/null +++ b/src/dac/dbgctrl.rs @@ -0,0 +1,112 @@ +#[doc = "Register `DBGCTRL` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `DBGCTRL` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[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> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `DBGRUN` reader - Debug Run"] +pub struct DBGRUN_R(crate::FieldReader); +impl DBGRUN_R { + pub(crate) fn new(bits: bool) -> Self { + DBGRUN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for DBGRUN_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `DBGRUN` writer - Debug Run"] +pub struct DBGRUN_W<'a> { + w: &'a mut W, +} +impl<'a> DBGRUN_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) | (value as u8 & 0x01); + self.w + } +} +impl R { + #[doc = "Bit 0 - Debug Run"] + #[inline(always)] + pub fn dbgrun(&self) -> DBGRUN_R { + DBGRUN_R::new((self.bits & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Debug Run"] + #[inline(always)] + pub fn dbgrun(&mut self) -> DBGRUN_W { + DBGRUN_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Debug Control\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 [dbgctrl](index.html) module"] +pub struct DBGCTRL_SPEC; +impl crate::RegisterSpec for DBGCTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [dbgctrl::R](R) reader structure"] +impl crate::Readable for DBGCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [dbgctrl::W](W) writer structure"] +impl crate::Writable for DBGCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets DBGCTRL to value 0"] +impl crate::Resettable for DBGCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/dac/evctrl.rs b/src/dac/evctrl.rs new file mode 100644 index 0000000..e1a8028 --- /dev/null +++ b/src/dac/evctrl.rs @@ -0,0 +1,204 @@ +#[doc = "Register `EVCTRL` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `EVCTRL` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[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> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `STARTEI` reader - Start Conversion Event Input"] +pub struct STARTEI_R(crate::FieldReader); +impl STARTEI_R { + pub(crate) fn new(bits: bool) -> Self { + STARTEI_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for STARTEI_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `STARTEI` writer - Start Conversion Event Input"] +pub struct STARTEI_W<'a> { + w: &'a mut W, +} +impl<'a> STARTEI_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) | (value as u8 & 0x01); + self.w + } +} +#[doc = "Field `EMPTYEO` reader - Data Buffer Empty Event Output"] +pub struct EMPTYEO_R(crate::FieldReader); +impl EMPTYEO_R { + pub(crate) fn new(bits: bool) -> Self { + EMPTYEO_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for EMPTYEO_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `EMPTYEO` writer - Data Buffer Empty Event Output"] +pub struct EMPTYEO_W<'a> { + w: &'a mut W, +} +impl<'a> EMPTYEO_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 << 1)) | ((value as u8 & 0x01) << 1); + self.w + } +} +#[doc = "Field `INVEI` reader - Invert Event Input"] +pub struct INVEI_R(crate::FieldReader); +impl INVEI_R { + pub(crate) fn new(bits: bool) -> Self { + INVEI_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for INVEI_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `INVEI` writer - Invert Event Input"] +pub struct INVEI_W<'a> { + w: &'a mut W, +} +impl<'a> INVEI_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 << 2)) | ((value as u8 & 0x01) << 2); + self.w + } +} +impl R { + #[doc = "Bit 0 - Start Conversion Event Input"] + #[inline(always)] + pub fn startei(&self) -> STARTEI_R { + STARTEI_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Data Buffer Empty Event Output"] + #[inline(always)] + pub fn emptyeo(&self) -> EMPTYEO_R { + EMPTYEO_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Invert Event Input"] + #[inline(always)] + pub fn invei(&self) -> INVEI_R { + INVEI_R::new(((self.bits >> 2) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Start Conversion Event Input"] + #[inline(always)] + pub fn startei(&mut self) -> STARTEI_W { + STARTEI_W { w: self } + } + #[doc = "Bit 1 - Data Buffer Empty Event Output"] + #[inline(always)] + pub fn emptyeo(&mut self) -> EMPTYEO_W { + EMPTYEO_W { w: self } + } + #[doc = "Bit 2 - Invert Event Input"] + #[inline(always)] + pub fn invei(&mut self) -> INVEI_W { + INVEI_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Event Control\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 [evctrl](index.html) module"] +pub struct EVCTRL_SPEC; +impl crate::RegisterSpec for EVCTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [evctrl::R](R) reader structure"] +impl crate::Readable for EVCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [evctrl::W](W) writer structure"] +impl crate::Writable for EVCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets EVCTRL to value 0"] +impl crate::Resettable for EVCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/dac/intenclr.rs b/src/dac/intenclr.rs new file mode 100644 index 0000000..5e0edf5 --- /dev/null +++ b/src/dac/intenclr.rs @@ -0,0 +1,158 @@ +#[doc = "Register `INTENCLR` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `INTENCLR` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[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> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `UNDERRUN` reader - Underrun Interrupt Enable"] +pub struct UNDERRUN_R(crate::FieldReader); +impl UNDERRUN_R { + pub(crate) fn new(bits: bool) -> Self { + UNDERRUN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for UNDERRUN_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `UNDERRUN` writer - Underrun Interrupt Enable"] +pub struct UNDERRUN_W<'a> { + w: &'a mut W, +} +impl<'a> UNDERRUN_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) | (value as u8 & 0x01); + self.w + } +} +#[doc = "Field `EMPTY` reader - Data Buffer Empty Interrupt Enable"] +pub struct EMPTY_R(crate::FieldReader); +impl EMPTY_R { + pub(crate) fn new(bits: bool) -> Self { + EMPTY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for EMPTY_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `EMPTY` writer - Data Buffer Empty Interrupt Enable"] +pub struct EMPTY_W<'a> { + w: &'a mut W, +} +impl<'a> EMPTY_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 << 1)) | ((value as u8 & 0x01) << 1); + self.w + } +} +impl R { + #[doc = "Bit 0 - Underrun Interrupt Enable"] + #[inline(always)] + pub fn underrun(&self) -> UNDERRUN_R { + UNDERRUN_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Data Buffer Empty Interrupt Enable"] + #[inline(always)] + pub fn empty(&self) -> EMPTY_R { + EMPTY_R::new(((self.bits >> 1) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Underrun Interrupt Enable"] + #[inline(always)] + pub fn underrun(&mut self) -> UNDERRUN_W { + UNDERRUN_W { w: self } + } + #[doc = "Bit 1 - Data Buffer Empty Interrupt Enable"] + #[inline(always)] + pub fn empty(&mut self) -> EMPTY_W { + EMPTY_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Interrupt Enable Clear\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 [intenclr](index.html) module"] +pub struct INTENCLR_SPEC; +impl crate::RegisterSpec for INTENCLR_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [intenclr::R](R) reader structure"] +impl crate::Readable for INTENCLR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [intenclr::W](W) writer structure"] +impl crate::Writable for INTENCLR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets INTENCLR to value 0"] +impl crate::Resettable for INTENCLR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/dac/intenset.rs b/src/dac/intenset.rs new file mode 100644 index 0000000..1de46d6 --- /dev/null +++ b/src/dac/intenset.rs @@ -0,0 +1,158 @@ +#[doc = "Register `INTENSET` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `INTENSET` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[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> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `UNDERRUN` reader - Underrun Interrupt Enable"] +pub struct UNDERRUN_R(crate::FieldReader); +impl UNDERRUN_R { + pub(crate) fn new(bits: bool) -> Self { + UNDERRUN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for UNDERRUN_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `UNDERRUN` writer - Underrun Interrupt Enable"] +pub struct UNDERRUN_W<'a> { + w: &'a mut W, +} +impl<'a> UNDERRUN_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) | (value as u8 & 0x01); + self.w + } +} +#[doc = "Field `EMPTY` reader - Data Buffer Empty Interrupt Enable"] +pub struct EMPTY_R(crate::FieldReader); +impl EMPTY_R { + pub(crate) fn new(bits: bool) -> Self { + EMPTY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for EMPTY_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `EMPTY` writer - Data Buffer Empty Interrupt Enable"] +pub struct EMPTY_W<'a> { + w: &'a mut W, +} +impl<'a> EMPTY_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 << 1)) | ((value as u8 & 0x01) << 1); + self.w + } +} +impl R { + #[doc = "Bit 0 - Underrun Interrupt Enable"] + #[inline(always)] + pub fn underrun(&self) -> UNDERRUN_R { + UNDERRUN_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Data Buffer Empty Interrupt Enable"] + #[inline(always)] + pub fn empty(&self) -> EMPTY_R { + EMPTY_R::new(((self.bits >> 1) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Underrun Interrupt Enable"] + #[inline(always)] + pub fn underrun(&mut self) -> UNDERRUN_W { + UNDERRUN_W { w: self } + } + #[doc = "Bit 1 - Data Buffer Empty Interrupt Enable"] + #[inline(always)] + pub fn empty(&mut self) -> EMPTY_W { + EMPTY_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Interrupt Enable Set\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 [intenset](index.html) module"] +pub struct INTENSET_SPEC; +impl crate::RegisterSpec for INTENSET_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [intenset::R](R) reader structure"] +impl crate::Readable for INTENSET_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [intenset::W](W) writer structure"] +impl crate::Writable for INTENSET_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets INTENSET to value 0"] +impl crate::Resettable for INTENSET_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/dac/intflag.rs b/src/dac/intflag.rs new file mode 100644 index 0000000..0d1a256 --- /dev/null +++ b/src/dac/intflag.rs @@ -0,0 +1,158 @@ +#[doc = "Register `INTFLAG` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `INTFLAG` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[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> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `UNDERRUN` reader - Underrun"] +pub struct UNDERRUN_R(crate::FieldReader); +impl UNDERRUN_R { + pub(crate) fn new(bits: bool) -> Self { + UNDERRUN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for UNDERRUN_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `UNDERRUN` writer - Underrun"] +pub struct UNDERRUN_W<'a> { + w: &'a mut W, +} +impl<'a> UNDERRUN_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) | (value as u8 & 0x01); + self.w + } +} +#[doc = "Field `EMPTY` reader - Data Buffer Empty"] +pub struct EMPTY_R(crate::FieldReader); +impl EMPTY_R { + pub(crate) fn new(bits: bool) -> Self { + EMPTY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for EMPTY_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `EMPTY` writer - Data Buffer Empty"] +pub struct EMPTY_W<'a> { + w: &'a mut W, +} +impl<'a> EMPTY_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 << 1)) | ((value as u8 & 0x01) << 1); + self.w + } +} +impl R { + #[doc = "Bit 0 - Underrun"] + #[inline(always)] + pub fn underrun(&self) -> UNDERRUN_R { + UNDERRUN_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Data Buffer Empty"] + #[inline(always)] + pub fn empty(&self) -> EMPTY_R { + EMPTY_R::new(((self.bits >> 1) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Underrun"] + #[inline(always)] + pub fn underrun(&mut self) -> UNDERRUN_W { + UNDERRUN_W { w: self } + } + #[doc = "Bit 1 - Data Buffer Empty"] + #[inline(always)] + pub fn empty(&mut self) -> EMPTY_W { + EMPTY_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Interrupt Flag Status and Clear\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 [intflag](index.html) module"] +pub struct INTFLAG_SPEC; +impl crate::RegisterSpec for INTFLAG_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [intflag::R](R) reader structure"] +impl crate::Readable for INTFLAG_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [intflag::W](W) writer structure"] +impl crate::Writable for INTFLAG_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets INTFLAG to value 0"] +impl crate::Resettable for INTFLAG_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/dac/status.rs b/src/dac/status.rs new file mode 100644 index 0000000..ec13f04 --- /dev/null +++ b/src/dac/status.rs @@ -0,0 +1,52 @@ +#[doc = "Register `STATUS` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Field `READY` reader - Ready"] +pub struct READY_R(crate::FieldReader); +impl READY_R { + pub(crate) fn new(bits: bool) -> Self { + READY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for READY_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bit 0 - Ready"] + #[inline(always)] + pub fn ready(&self) -> READY_R { + READY_R::new((self.bits & 0x01) != 0) + } +} +#[doc = "Status\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [status](index.html) module"] +pub struct STATUS_SPEC; +impl crate::RegisterSpec for STATUS_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [status::R](R) reader structure"] +impl crate::Readable for STATUS_SPEC { + type Reader = R; +} +#[doc = "`reset()` method sets STATUS to value 0"] +impl crate::Resettable for STATUS_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/dac/syncbusy.rs b/src/dac/syncbusy.rs new file mode 100644 index 0000000..739f726 --- /dev/null +++ b/src/dac/syncbusy.rs @@ -0,0 +1,109 @@ +#[doc = "Register `SYNCBUSY` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Field `SWRST` reader - Software Reset"] +pub struct SWRST_R(crate::FieldReader); +impl SWRST_R { + pub(crate) fn new(bits: bool) -> Self { + SWRST_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SWRST_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ENABLE` reader - Enable"] +pub struct ENABLE_R(crate::FieldReader); +impl ENABLE_R { + pub(crate) fn new(bits: bool) -> Self { + ENABLE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ENABLE_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `DATA` reader - Data"] +pub struct DATA_R(crate::FieldReader); +impl DATA_R { + pub(crate) fn new(bits: bool) -> Self { + DATA_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for DATA_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `DATABUF` reader - Data Buffer"] +pub struct DATABUF_R(crate::FieldReader); +impl DATABUF_R { + pub(crate) fn new(bits: bool) -> Self { + DATABUF_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for DATABUF_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bit 0 - Software Reset"] + #[inline(always)] + pub fn swrst(&self) -> SWRST_R { + SWRST_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Enable"] + #[inline(always)] + pub fn enable(&self) -> ENABLE_R { + ENABLE_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Data"] + #[inline(always)] + pub fn data(&self) -> DATA_R { + DATA_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - Data Buffer"] + #[inline(always)] + pub fn databuf(&self) -> DATABUF_R { + DATABUF_R::new(((self.bits >> 3) & 0x01) != 0) + } +} +#[doc = "Synchronization Busy\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [syncbusy](index.html) module"] +pub struct SYNCBUSY_SPEC; +impl crate::RegisterSpec for SYNCBUSY_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [syncbusy::R](R) reader structure"] +impl crate::Readable for SYNCBUSY_SPEC { + type Reader = R; +} +#[doc = "`reset()` method sets SYNCBUSY to value 0"] +impl crate::Resettable for SYNCBUSY_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} -- cgit v1.2.3-70-g09d2