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/tc0/count16/cc.rs | 103 +++++ src/tc0/count16/ccbuf.rs | 103 +++++ src/tc0/count16/count.rs | 102 +++++ src/tc0/count16/ctrla.rs | 1035 +++++++++++++++++++++++++++++++++++++++++++ src/tc0/count16/ctrlbclr.rs | 341 ++++++++++++++ src/tc0/count16/ctrlbset.rs | 341 ++++++++++++++ src/tc0/count16/dbgctrl.rs | 112 +++++ src/tc0/count16/drvctrl.rs | 158 +++++++ src/tc0/count16/evctrl.rs | 459 +++++++++++++++++++ src/tc0/count16/intenclr.rs | 250 +++++++++++ src/tc0/count16/intenset.rs | 250 +++++++++++ src/tc0/count16/intflag.rs | 250 +++++++++++ src/tc0/count16/status.rs | 296 +++++++++++++ src/tc0/count16/syncbusy.rs | 185 ++++++++ src/tc0/count16/wave.rs | 177 ++++++++ 15 files changed, 4162 insertions(+) create mode 100644 src/tc0/count16/cc.rs create mode 100644 src/tc0/count16/ccbuf.rs create mode 100644 src/tc0/count16/count.rs create mode 100644 src/tc0/count16/ctrla.rs create mode 100644 src/tc0/count16/ctrlbclr.rs create mode 100644 src/tc0/count16/ctrlbset.rs create mode 100644 src/tc0/count16/dbgctrl.rs create mode 100644 src/tc0/count16/drvctrl.rs create mode 100644 src/tc0/count16/evctrl.rs create mode 100644 src/tc0/count16/intenclr.rs create mode 100644 src/tc0/count16/intenset.rs create mode 100644 src/tc0/count16/intflag.rs create mode 100644 src/tc0/count16/status.rs create mode 100644 src/tc0/count16/syncbusy.rs create mode 100644 src/tc0/count16/wave.rs (limited to 'src/tc0/count16') diff --git a/src/tc0/count16/cc.rs b/src/tc0/count16/cc.rs new file mode 100644 index 0000000..be228a0 --- /dev/null +++ b/src/tc0/count16/cc.rs @@ -0,0 +1,103 @@ +#[doc = "Register `CC[%s]` 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 `CC[%s]` 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 `CC` reader - Counter/Compare Value"] +pub struct CC_R(crate::FieldReader); +impl CC_R { + pub(crate) fn new(bits: u16) -> Self { + CC_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CC_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CC` writer - Counter/Compare Value"] +pub struct CC_W<'a> { + w: &'a mut W, +} +impl<'a> CC_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 R { + #[doc = "Bits 0:15 - Counter/Compare Value"] + #[inline(always)] + pub fn cc(&self) -> CC_R { + CC_R::new((self.bits & 0xffff) as u16) + } +} +impl W { + #[doc = "Bits 0:15 - Counter/Compare Value"] + #[inline(always)] + pub fn cc(&mut self) -> CC_W { + CC_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 = "COUNT16 Compare and Capture\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 [cc](index.html) module"] +pub struct CC_SPEC; +impl crate::RegisterSpec for CC_SPEC { + type Ux = u16; +} +#[doc = "`read()` method returns [cc::R](R) reader structure"] +impl crate::Readable for CC_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [cc::W](W) writer structure"] +impl crate::Writable for CC_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets CC[%s] +to value 0"] +impl crate::Resettable for CC_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/tc0/count16/ccbuf.rs b/src/tc0/count16/ccbuf.rs new file mode 100644 index 0000000..69c7ec3 --- /dev/null +++ b/src/tc0/count16/ccbuf.rs @@ -0,0 +1,103 @@ +#[doc = "Register `CCBUF[%s]` 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 `CCBUF[%s]` 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 `CCBUF` reader - Counter/Compare Buffer Value"] +pub struct CCBUF_R(crate::FieldReader); +impl CCBUF_R { + pub(crate) fn new(bits: u16) -> Self { + CCBUF_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CCBUF_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CCBUF` writer - Counter/Compare Buffer Value"] +pub struct CCBUF_W<'a> { + w: &'a mut W, +} +impl<'a> CCBUF_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 R { + #[doc = "Bits 0:15 - Counter/Compare Buffer Value"] + #[inline(always)] + pub fn ccbuf(&self) -> CCBUF_R { + CCBUF_R::new((self.bits & 0xffff) as u16) + } +} +impl W { + #[doc = "Bits 0:15 - Counter/Compare Buffer Value"] + #[inline(always)] + pub fn ccbuf(&mut self) -> CCBUF_W { + CCBUF_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 = "COUNT16 Compare and Capture Buffer\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 [ccbuf](index.html) module"] +pub struct CCBUF_SPEC; +impl crate::RegisterSpec for CCBUF_SPEC { + type Ux = u16; +} +#[doc = "`read()` method returns [ccbuf::R](R) reader structure"] +impl crate::Readable for CCBUF_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [ccbuf::W](W) writer structure"] +impl crate::Writable for CCBUF_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets CCBUF[%s] +to value 0"] +impl crate::Resettable for CCBUF_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/tc0/count16/count.rs b/src/tc0/count16/count.rs new file mode 100644 index 0000000..9a55967 --- /dev/null +++ b/src/tc0/count16/count.rs @@ -0,0 +1,102 @@ +#[doc = "Register `COUNT` 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 `COUNT` 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 `COUNT` reader - Counter Value"] +pub struct COUNT_R(crate::FieldReader); +impl COUNT_R { + pub(crate) fn new(bits: u16) -> Self { + COUNT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COUNT_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COUNT` writer - Counter Value"] +pub struct COUNT_W<'a> { + w: &'a mut W, +} +impl<'a> COUNT_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 R { + #[doc = "Bits 0:15 - Counter Value"] + #[inline(always)] + pub fn count(&self) -> COUNT_R { + COUNT_R::new((self.bits & 0xffff) as u16) + } +} +impl W { + #[doc = "Bits 0:15 - Counter Value"] + #[inline(always)] + pub fn count(&mut self) -> COUNT_W { + COUNT_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 = "COUNT16 Count\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 [count](index.html) module"] +pub struct COUNT_SPEC; +impl crate::RegisterSpec for COUNT_SPEC { + type Ux = u16; +} +#[doc = "`read()` method returns [count::R](R) reader structure"] +impl crate::Readable for COUNT_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [count::W](W) writer structure"] +impl crate::Writable for COUNT_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets COUNT to value 0"] +impl crate::Resettable for COUNT_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/tc0/count16/ctrla.rs b/src/tc0/count16/ctrla.rs new file mode 100644 index 0000000..77217dd --- /dev/null +++ b/src/tc0/count16/ctrla.rs @@ -0,0 +1,1035 @@ +#[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 u32 & 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 u32 & 0x01) << 1); + self.w + } +} +#[doc = "Timer Counter Mode\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum MODE_A { + #[doc = "0: Counter in 16-bit mode"] + COUNT16 = 0, + #[doc = "1: Counter in 8-bit mode"] + COUNT8 = 1, + #[doc = "2: Counter in 32-bit mode"] + COUNT32 = 2, +} +impl From for u8 { + #[inline(always)] + fn from(variant: MODE_A) -> Self { + variant as _ + } +} +#[doc = "Field `MODE` reader - Timer Counter Mode"] +pub struct MODE_R(crate::FieldReader); +impl MODE_R { + pub(crate) fn new(bits: u8) -> Self { + MODE_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(MODE_A::COUNT16), + 1 => Some(MODE_A::COUNT8), + 2 => Some(MODE_A::COUNT32), + _ => None, + } + } + #[doc = "Checks if the value of the field is `COUNT16`"] + #[inline(always)] + pub fn is_count16(&self) -> bool { + **self == MODE_A::COUNT16 + } + #[doc = "Checks if the value of the field is `COUNT8`"] + #[inline(always)] + pub fn is_count8(&self) -> bool { + **self == MODE_A::COUNT8 + } + #[doc = "Checks if the value of the field is `COUNT32`"] + #[inline(always)] + pub fn is_count32(&self) -> bool { + **self == MODE_A::COUNT32 + } +} +impl core::ops::Deref for MODE_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MODE` writer - Timer Counter Mode"] +pub struct MODE_W<'a> { + w: &'a mut W, +} +impl<'a> MODE_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: MODE_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "Counter in 16-bit mode"] + #[inline(always)] + pub fn count16(self) -> &'a mut W { + self.variant(MODE_A::COUNT16) + } + #[doc = "Counter in 8-bit mode"] + #[inline(always)] + pub fn count8(self) -> &'a mut W { + self.variant(MODE_A::COUNT8) + } + #[doc = "Counter in 32-bit mode"] + #[inline(always)] + pub fn count32(self) -> &'a mut W { + self.variant(MODE_A::COUNT32) + } + #[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 = "Prescaler and Counter Synchronization\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum PRESCSYNC_A { + #[doc = "0: Reload or reset the counter on next generic clock"] + GCLK = 0, + #[doc = "1: Reload or reset the counter on next prescaler clock"] + PRESC = 1, + #[doc = "2: Reload or reset the counter on next generic clock and reset the prescaler counter"] + RESYNC = 2, +} +impl From for u8 { + #[inline(always)] + fn from(variant: PRESCSYNC_A) -> Self { + variant as _ + } +} +#[doc = "Field `PRESCSYNC` reader - Prescaler and Counter Synchronization"] +pub struct PRESCSYNC_R(crate::FieldReader); +impl PRESCSYNC_R { + pub(crate) fn new(bits: u8) -> Self { + PRESCSYNC_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(PRESCSYNC_A::GCLK), + 1 => Some(PRESCSYNC_A::PRESC), + 2 => Some(PRESCSYNC_A::RESYNC), + _ => None, + } + } + #[doc = "Checks if the value of the field is `GCLK`"] + #[inline(always)] + pub fn is_gclk(&self) -> bool { + **self == PRESCSYNC_A::GCLK + } + #[doc = "Checks if the value of the field is `PRESC`"] + #[inline(always)] + pub fn is_presc(&self) -> bool { + **self == PRESCSYNC_A::PRESC + } + #[doc = "Checks if the value of the field is `RESYNC`"] + #[inline(always)] + pub fn is_resync(&self) -> bool { + **self == PRESCSYNC_A::RESYNC + } +} +impl core::ops::Deref for PRESCSYNC_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PRESCSYNC` writer - Prescaler and Counter Synchronization"] +pub struct PRESCSYNC_W<'a> { + w: &'a mut W, +} +impl<'a> PRESCSYNC_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: PRESCSYNC_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "Reload or reset the counter on next generic clock"] + #[inline(always)] + pub fn gclk(self) -> &'a mut W { + self.variant(PRESCSYNC_A::GCLK) + } + #[doc = "Reload or reset the counter on next prescaler clock"] + #[inline(always)] + pub fn presc(self) -> &'a mut W { + self.variant(PRESCSYNC_A::PRESC) + } + #[doc = "Reload or reset the counter on next generic clock and reset the prescaler counter"] + #[inline(always)] + pub fn resync(self) -> &'a mut W { + self.variant(PRESCSYNC_A::RESYNC) + } + #[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 << 4)) | ((value as u32 & 0x03) << 4); + self.w + } +} +#[doc = "Field `RUNSTDBY` reader - Run during 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 during 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 u32 & 0x01) << 6); + self.w + } +} +#[doc = "Field `ONDEMAND` reader - Clock On Demand"] +pub struct ONDEMAND_R(crate::FieldReader); +impl ONDEMAND_R { + pub(crate) fn new(bits: bool) -> Self { + ONDEMAND_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ONDEMAND_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ONDEMAND` writer - Clock On Demand"] +pub struct ONDEMAND_W<'a> { + w: &'a mut W, +} +impl<'a> ONDEMAND_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 << 7)) | ((value as u32 & 0x01) << 7); + self.w + } +} +#[doc = "Prescaler\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum PRESCALER_A { + #[doc = "0: Prescaler: GCLK_TC"] + DIV1 = 0, + #[doc = "1: Prescaler: GCLK_TC/2"] + DIV2 = 1, + #[doc = "2: Prescaler: GCLK_TC/4"] + DIV4 = 2, + #[doc = "3: Prescaler: GCLK_TC/8"] + DIV8 = 3, + #[doc = "4: Prescaler: GCLK_TC/16"] + DIV16 = 4, + #[doc = "5: Prescaler: GCLK_TC/64"] + DIV64 = 5, + #[doc = "6: Prescaler: GCLK_TC/256"] + DIV256 = 6, + #[doc = "7: Prescaler: GCLK_TC/1024"] + DIV1024 = 7, +} +impl From for u8 { + #[inline(always)] + fn from(variant: PRESCALER_A) -> Self { + variant as _ + } +} +#[doc = "Field `PRESCALER` reader - Prescaler"] +pub struct PRESCALER_R(crate::FieldReader); +impl PRESCALER_R { + pub(crate) fn new(bits: u8) -> Self { + PRESCALER_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> PRESCALER_A { + match self.bits { + 0 => PRESCALER_A::DIV1, + 1 => PRESCALER_A::DIV2, + 2 => PRESCALER_A::DIV4, + 3 => PRESCALER_A::DIV8, + 4 => PRESCALER_A::DIV16, + 5 => PRESCALER_A::DIV64, + 6 => PRESCALER_A::DIV256, + 7 => PRESCALER_A::DIV1024, + _ => unreachable!(), + } + } + #[doc = "Checks if the value of the field is `DIV1`"] + #[inline(always)] + pub fn is_div1(&self) -> bool { + **self == PRESCALER_A::DIV1 + } + #[doc = "Checks if the value of the field is `DIV2`"] + #[inline(always)] + pub fn is_div2(&self) -> bool { + **self == PRESCALER_A::DIV2 + } + #[doc = "Checks if the value of the field is `DIV4`"] + #[inline(always)] + pub fn is_div4(&self) -> bool { + **self == PRESCALER_A::DIV4 + } + #[doc = "Checks if the value of the field is `DIV8`"] + #[inline(always)] + pub fn is_div8(&self) -> bool { + **self == PRESCALER_A::DIV8 + } + #[doc = "Checks if the value of the field is `DIV16`"] + #[inline(always)] + pub fn is_div16(&self) -> bool { + **self == PRESCALER_A::DIV16 + } + #[doc = "Checks if the value of the field is `DIV64`"] + #[inline(always)] + pub fn is_div64(&self) -> bool { + **self == PRESCALER_A::DIV64 + } + #[doc = "Checks if the value of the field is `DIV256`"] + #[inline(always)] + pub fn is_div256(&self) -> bool { + **self == PRESCALER_A::DIV256 + } + #[doc = "Checks if the value of the field is `DIV1024`"] + #[inline(always)] + pub fn is_div1024(&self) -> bool { + **self == PRESCALER_A::DIV1024 + } +} +impl core::ops::Deref for PRESCALER_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PRESCALER` writer - Prescaler"] +pub struct PRESCALER_W<'a> { + w: &'a mut W, +} +impl<'a> PRESCALER_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: PRESCALER_A) -> &'a mut W { + self.bits(variant.into()) + } + #[doc = "Prescaler: GCLK_TC"] + #[inline(always)] + pub fn div1(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV1) + } + #[doc = "Prescaler: GCLK_TC/2"] + #[inline(always)] + pub fn div2(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV2) + } + #[doc = "Prescaler: GCLK_TC/4"] + #[inline(always)] + pub fn div4(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV4) + } + #[doc = "Prescaler: GCLK_TC/8"] + #[inline(always)] + pub fn div8(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV8) + } + #[doc = "Prescaler: GCLK_TC/16"] + #[inline(always)] + pub fn div16(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV16) + } + #[doc = "Prescaler: GCLK_TC/64"] + #[inline(always)] + pub fn div64(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV64) + } + #[doc = "Prescaler: GCLK_TC/256"] + #[inline(always)] + pub fn div256(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV256) + } + #[doc = "Prescaler: GCLK_TC/1024"] + #[inline(always)] + pub fn div1024(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV1024) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x07 << 8)) | ((value as u32 & 0x07) << 8); + self.w + } +} +#[doc = "Field `ALOCK` reader - Auto Lock"] +pub struct ALOCK_R(crate::FieldReader); +impl ALOCK_R { + pub(crate) fn new(bits: bool) -> Self { + ALOCK_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ALOCK_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ALOCK` writer - Auto Lock"] +pub struct ALOCK_W<'a> { + w: &'a mut W, +} +impl<'a> ALOCK_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 << 11)) | ((value as u32 & 0x01) << 11); + self.w + } +} +#[doc = "Field `CAPTEN0` reader - Capture Channel 0 Enable"] +pub struct CAPTEN0_R(crate::FieldReader); +impl CAPTEN0_R { + pub(crate) fn new(bits: bool) -> Self { + CAPTEN0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CAPTEN0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CAPTEN0` writer - Capture Channel 0 Enable"] +pub struct CAPTEN0_W<'a> { + w: &'a mut W, +} +impl<'a> CAPTEN0_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 `CAPTEN1` reader - Capture Channel 1 Enable"] +pub struct CAPTEN1_R(crate::FieldReader); +impl CAPTEN1_R { + pub(crate) fn new(bits: bool) -> Self { + CAPTEN1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CAPTEN1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CAPTEN1` writer - Capture Channel 1 Enable"] +pub struct CAPTEN1_W<'a> { + w: &'a mut W, +} +impl<'a> CAPTEN1_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 `COPEN0` reader - Capture On Pin 0 Enable"] +pub struct COPEN0_R(crate::FieldReader); +impl COPEN0_R { + pub(crate) fn new(bits: bool) -> Self { + COPEN0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COPEN0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COPEN0` writer - Capture On Pin 0 Enable"] +pub struct COPEN0_W<'a> { + w: &'a mut W, +} +impl<'a> COPEN0_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 << 20)) | ((value as u32 & 0x01) << 20); + self.w + } +} +#[doc = "Field `COPEN1` reader - Capture On Pin 1 Enable"] +pub struct COPEN1_R(crate::FieldReader); +impl COPEN1_R { + pub(crate) fn new(bits: bool) -> Self { + COPEN1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COPEN1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COPEN1` writer - Capture On Pin 1 Enable"] +pub struct COPEN1_W<'a> { + w: &'a mut W, +} +impl<'a> COPEN1_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 << 21)) | ((value as u32 & 0x01) << 21); + self.w + } +} +#[doc = "Capture Mode Channel 0\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum CAPTMODE0_A { + #[doc = "0: Default capture"] + DEFAULT = 0, + #[doc = "1: Minimum capture"] + CAPTMIN = 1, + #[doc = "2: Maximum capture"] + CAPTMAX = 2, +} +impl From for u8 { + #[inline(always)] + fn from(variant: CAPTMODE0_A) -> Self { + variant as _ + } +} +#[doc = "Field `CAPTMODE0` reader - Capture Mode Channel 0"] +pub struct CAPTMODE0_R(crate::FieldReader); +impl CAPTMODE0_R { + pub(crate) fn new(bits: u8) -> Self { + CAPTMODE0_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(CAPTMODE0_A::DEFAULT), + 1 => Some(CAPTMODE0_A::CAPTMIN), + 2 => Some(CAPTMODE0_A::CAPTMAX), + _ => None, + } + } + #[doc = "Checks if the value of the field is `DEFAULT`"] + #[inline(always)] + pub fn is_default(&self) -> bool { + **self == CAPTMODE0_A::DEFAULT + } + #[doc = "Checks if the value of the field is `CAPTMIN`"] + #[inline(always)] + pub fn is_captmin(&self) -> bool { + **self == CAPTMODE0_A::CAPTMIN + } + #[doc = "Checks if the value of the field is `CAPTMAX`"] + #[inline(always)] + pub fn is_captmax(&self) -> bool { + **self == CAPTMODE0_A::CAPTMAX + } +} +impl core::ops::Deref for CAPTMODE0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CAPTMODE0` writer - Capture Mode Channel 0"] +pub struct CAPTMODE0_W<'a> { + w: &'a mut W, +} +impl<'a> CAPTMODE0_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: CAPTMODE0_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "Default capture"] + #[inline(always)] + pub fn default(self) -> &'a mut W { + self.variant(CAPTMODE0_A::DEFAULT) + } + #[doc = "Minimum capture"] + #[inline(always)] + pub fn captmin(self) -> &'a mut W { + self.variant(CAPTMODE0_A::CAPTMIN) + } + #[doc = "Maximum capture"] + #[inline(always)] + pub fn captmax(self) -> &'a mut W { + self.variant(CAPTMODE0_A::CAPTMAX) + } + #[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 << 24)) | ((value as u32 & 0x03) << 24); + self.w + } +} +#[doc = "Capture mode Channel 1\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum CAPTMODE1_A { + #[doc = "0: Default capture"] + DEFAULT = 0, + #[doc = "1: Minimum capture"] + CAPTMIN = 1, + #[doc = "2: Maximum capture"] + CAPTMAX = 2, +} +impl From for u8 { + #[inline(always)] + fn from(variant: CAPTMODE1_A) -> Self { + variant as _ + } +} +#[doc = "Field `CAPTMODE1` reader - Capture mode Channel 1"] +pub struct CAPTMODE1_R(crate::FieldReader); +impl CAPTMODE1_R { + pub(crate) fn new(bits: u8) -> Self { + CAPTMODE1_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(CAPTMODE1_A::DEFAULT), + 1 => Some(CAPTMODE1_A::CAPTMIN), + 2 => Some(CAPTMODE1_A::CAPTMAX), + _ => None, + } + } + #[doc = "Checks if the value of the field is `DEFAULT`"] + #[inline(always)] + pub fn is_default(&self) -> bool { + **self == CAPTMODE1_A::DEFAULT + } + #[doc = "Checks if the value of the field is `CAPTMIN`"] + #[inline(always)] + pub fn is_captmin(&self) -> bool { + **self == CAPTMODE1_A::CAPTMIN + } + #[doc = "Checks if the value of the field is `CAPTMAX`"] + #[inline(always)] + pub fn is_captmax(&self) -> bool { + **self == CAPTMODE1_A::CAPTMAX + } +} +impl core::ops::Deref for CAPTMODE1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CAPTMODE1` writer - Capture mode Channel 1"] +pub struct CAPTMODE1_W<'a> { + w: &'a mut W, +} +impl<'a> CAPTMODE1_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: CAPTMODE1_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "Default capture"] + #[inline(always)] + pub fn default(self) -> &'a mut W { + self.variant(CAPTMODE1_A::DEFAULT) + } + #[doc = "Minimum capture"] + #[inline(always)] + pub fn captmin(self) -> &'a mut W { + self.variant(CAPTMODE1_A::CAPTMIN) + } + #[doc = "Maximum capture"] + #[inline(always)] + pub fn captmax(self) -> &'a mut W { + self.variant(CAPTMODE1_A::CAPTMAX) + } + #[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 << 27)) | ((value as u32 & 0x03) << 27); + 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 = "Bits 2:3 - Timer Counter Mode"] + #[inline(always)] + pub fn mode(&self) -> MODE_R { + MODE_R::new(((self.bits >> 2) & 0x03) as u8) + } + #[doc = "Bits 4:5 - Prescaler and Counter Synchronization"] + #[inline(always)] + pub fn prescsync(&self) -> PRESCSYNC_R { + PRESCSYNC_R::new(((self.bits >> 4) & 0x03) as u8) + } + #[doc = "Bit 6 - Run during Standby"] + #[inline(always)] + pub fn runstdby(&self) -> RUNSTDBY_R { + RUNSTDBY_R::new(((self.bits >> 6) & 0x01) != 0) + } + #[doc = "Bit 7 - Clock On Demand"] + #[inline(always)] + pub fn ondemand(&self) -> ONDEMAND_R { + ONDEMAND_R::new(((self.bits >> 7) & 0x01) != 0) + } + #[doc = "Bits 8:10 - Prescaler"] + #[inline(always)] + pub fn prescaler(&self) -> PRESCALER_R { + PRESCALER_R::new(((self.bits >> 8) & 0x07) as u8) + } + #[doc = "Bit 11 - Auto Lock"] + #[inline(always)] + pub fn alock(&self) -> ALOCK_R { + ALOCK_R::new(((self.bits >> 11) & 0x01) != 0) + } + #[doc = "Bit 16 - Capture Channel 0 Enable"] + #[inline(always)] + pub fn capten0(&self) -> CAPTEN0_R { + CAPTEN0_R::new(((self.bits >> 16) & 0x01) != 0) + } + #[doc = "Bit 17 - Capture Channel 1 Enable"] + #[inline(always)] + pub fn capten1(&self) -> CAPTEN1_R { + CAPTEN1_R::new(((self.bits >> 17) & 0x01) != 0) + } + #[doc = "Bit 20 - Capture On Pin 0 Enable"] + #[inline(always)] + pub fn copen0(&self) -> COPEN0_R { + COPEN0_R::new(((self.bits >> 20) & 0x01) != 0) + } + #[doc = "Bit 21 - Capture On Pin 1 Enable"] + #[inline(always)] + pub fn copen1(&self) -> COPEN1_R { + COPEN1_R::new(((self.bits >> 21) & 0x01) != 0) + } + #[doc = "Bits 24:25 - Capture Mode Channel 0"] + #[inline(always)] + pub fn captmode0(&self) -> CAPTMODE0_R { + CAPTMODE0_R::new(((self.bits >> 24) & 0x03) as u8) + } + #[doc = "Bits 27:28 - Capture mode Channel 1"] + #[inline(always)] + pub fn captmode1(&self) -> CAPTMODE1_R { + CAPTMODE1_R::new(((self.bits >> 27) & 0x03) as u8) + } +} +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 = "Bits 2:3 - Timer Counter Mode"] + #[inline(always)] + pub fn mode(&mut self) -> MODE_W { + MODE_W { w: self } + } + #[doc = "Bits 4:5 - Prescaler and Counter Synchronization"] + #[inline(always)] + pub fn prescsync(&mut self) -> PRESCSYNC_W { + PRESCSYNC_W { w: self } + } + #[doc = "Bit 6 - Run during Standby"] + #[inline(always)] + pub fn runstdby(&mut self) -> RUNSTDBY_W { + RUNSTDBY_W { w: self } + } + #[doc = "Bit 7 - Clock On Demand"] + #[inline(always)] + pub fn ondemand(&mut self) -> ONDEMAND_W { + ONDEMAND_W { w: self } + } + #[doc = "Bits 8:10 - Prescaler"] + #[inline(always)] + pub fn prescaler(&mut self) -> PRESCALER_W { + PRESCALER_W { w: self } + } + #[doc = "Bit 11 - Auto Lock"] + #[inline(always)] + pub fn alock(&mut self) -> ALOCK_W { + ALOCK_W { w: self } + } + #[doc = "Bit 16 - Capture Channel 0 Enable"] + #[inline(always)] + pub fn capten0(&mut self) -> CAPTEN0_W { + CAPTEN0_W { w: self } + } + #[doc = "Bit 17 - Capture Channel 1 Enable"] + #[inline(always)] + pub fn capten1(&mut self) -> CAPTEN1_W { + CAPTEN1_W { w: self } + } + #[doc = "Bit 20 - Capture On Pin 0 Enable"] + #[inline(always)] + pub fn copen0(&mut self) -> COPEN0_W { + COPEN0_W { w: self } + } + #[doc = "Bit 21 - Capture On Pin 1 Enable"] + #[inline(always)] + pub fn copen1(&mut self) -> COPEN1_W { + COPEN1_W { w: self } + } + #[doc = "Bits 24:25 - Capture Mode Channel 0"] + #[inline(always)] + pub fn captmode0(&mut self) -> CAPTMODE0_W { + CAPTMODE0_W { w: self } + } + #[doc = "Bits 27:28 - Capture mode Channel 1"] + #[inline(always)] + pub fn captmode1(&mut self) -> CAPTMODE1_W { + CAPTMODE1_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 = "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 = u32; +} +#[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/tc0/count16/ctrlbclr.rs b/src/tc0/count16/ctrlbclr.rs new file mode 100644 index 0000000..1fc6653 --- /dev/null +++ b/src/tc0/count16/ctrlbclr.rs @@ -0,0 +1,341 @@ +#[doc = "Register `CTRLBCLR` 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 `CTRLBCLR` 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 `DIR` reader - Counter Direction"] +pub struct DIR_R(crate::FieldReader); +impl DIR_R { + pub(crate) fn new(bits: bool) -> Self { + DIR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for DIR_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `DIR` writer - Counter Direction"] +pub struct DIR_W<'a> { + w: &'a mut W, +} +impl<'a> DIR_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 `LUPD` reader - Lock Update"] +pub struct LUPD_R(crate::FieldReader); +impl LUPD_R { + pub(crate) fn new(bits: bool) -> Self { + LUPD_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for LUPD_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `LUPD` writer - Lock Update"] +pub struct LUPD_W<'a> { + w: &'a mut W, +} +impl<'a> LUPD_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 `ONESHOT` reader - One-Shot on Counter"] +pub struct ONESHOT_R(crate::FieldReader); +impl ONESHOT_R { + pub(crate) fn new(bits: bool) -> Self { + ONESHOT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ONESHOT_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ONESHOT` writer - One-Shot on Counter"] +pub struct ONESHOT_W<'a> { + w: &'a mut W, +} +impl<'a> ONESHOT_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 = "Command\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum CMD_A { + #[doc = "0: No action"] + NONE = 0, + #[doc = "1: Force a start, restart or retrigger"] + RETRIGGER = 1, + #[doc = "2: Force a stop"] + STOP = 2, + #[doc = "3: Force update of double-buffered register"] + UPDATE = 3, + #[doc = "4: Force a read synchronization of COUNT"] + READSYNC = 4, + #[doc = "5: One-shot DMA trigger"] + DMAOS = 5, +} +impl From for u8 { + #[inline(always)] + fn from(variant: CMD_A) -> Self { + variant as _ + } +} +#[doc = "Field `CMD` reader - Command"] +pub struct CMD_R(crate::FieldReader); +impl CMD_R { + pub(crate) fn new(bits: u8) -> Self { + CMD_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(CMD_A::NONE), + 1 => Some(CMD_A::RETRIGGER), + 2 => Some(CMD_A::STOP), + 3 => Some(CMD_A::UPDATE), + 4 => Some(CMD_A::READSYNC), + 5 => Some(CMD_A::DMAOS), + _ => None, + } + } + #[doc = "Checks if the value of the field is `NONE`"] + #[inline(always)] + pub fn is_none(&self) -> bool { + **self == CMD_A::NONE + } + #[doc = "Checks if the value of the field is `RETRIGGER`"] + #[inline(always)] + pub fn is_retrigger(&self) -> bool { + **self == CMD_A::RETRIGGER + } + #[doc = "Checks if the value of the field is `STOP`"] + #[inline(always)] + pub fn is_stop(&self) -> bool { + **self == CMD_A::STOP + } + #[doc = "Checks if the value of the field is `UPDATE`"] + #[inline(always)] + pub fn is_update(&self) -> bool { + **self == CMD_A::UPDATE + } + #[doc = "Checks if the value of the field is `READSYNC`"] + #[inline(always)] + pub fn is_readsync(&self) -> bool { + **self == CMD_A::READSYNC + } + #[doc = "Checks if the value of the field is `DMAOS`"] + #[inline(always)] + pub fn is_dmaos(&self) -> bool { + **self == CMD_A::DMAOS + } +} +impl core::ops::Deref for CMD_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CMD` writer - Command"] +pub struct CMD_W<'a> { + w: &'a mut W, +} +impl<'a> CMD_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: CMD_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "No action"] + #[inline(always)] + pub fn none(self) -> &'a mut W { + self.variant(CMD_A::NONE) + } + #[doc = "Force a start, restart or retrigger"] + #[inline(always)] + pub fn retrigger(self) -> &'a mut W { + self.variant(CMD_A::RETRIGGER) + } + #[doc = "Force a stop"] + #[inline(always)] + pub fn stop(self) -> &'a mut W { + self.variant(CMD_A::STOP) + } + #[doc = "Force update of double-buffered register"] + #[inline(always)] + pub fn update(self) -> &'a mut W { + self.variant(CMD_A::UPDATE) + } + #[doc = "Force a read synchronization of COUNT"] + #[inline(always)] + pub fn readsync(self) -> &'a mut W { + self.variant(CMD_A::READSYNC) + } + #[doc = "One-shot DMA trigger"] + #[inline(always)] + pub fn dmaos(self) -> &'a mut W { + self.variant(CMD_A::DMAOS) + } + #[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 u8 & 0x07) << 5); + self.w + } +} +impl R { + #[doc = "Bit 0 - Counter Direction"] + #[inline(always)] + pub fn dir(&self) -> DIR_R { + DIR_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Lock Update"] + #[inline(always)] + pub fn lupd(&self) -> LUPD_R { + LUPD_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - One-Shot on Counter"] + #[inline(always)] + pub fn oneshot(&self) -> ONESHOT_R { + ONESHOT_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bits 5:7 - Command"] + #[inline(always)] + pub fn cmd(&self) -> CMD_R { + CMD_R::new(((self.bits >> 5) & 0x07) as u8) + } +} +impl W { + #[doc = "Bit 0 - Counter Direction"] + #[inline(always)] + pub fn dir(&mut self) -> DIR_W { + DIR_W { w: self } + } + #[doc = "Bit 1 - Lock Update"] + #[inline(always)] + pub fn lupd(&mut self) -> LUPD_W { + LUPD_W { w: self } + } + #[doc = "Bit 2 - One-Shot on Counter"] + #[inline(always)] + pub fn oneshot(&mut self) -> ONESHOT_W { + ONESHOT_W { w: self } + } + #[doc = "Bits 5:7 - Command"] + #[inline(always)] + pub fn cmd(&mut self) -> CMD_W { + CMD_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 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 [ctrlbclr](index.html) module"] +pub struct CTRLBCLR_SPEC; +impl crate::RegisterSpec for CTRLBCLR_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [ctrlbclr::R](R) reader structure"] +impl crate::Readable for CTRLBCLR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [ctrlbclr::W](W) writer structure"] +impl crate::Writable for CTRLBCLR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets CTRLBCLR to value 0"] +impl crate::Resettable for CTRLBCLR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/tc0/count16/ctrlbset.rs b/src/tc0/count16/ctrlbset.rs new file mode 100644 index 0000000..c659bab --- /dev/null +++ b/src/tc0/count16/ctrlbset.rs @@ -0,0 +1,341 @@ +#[doc = "Register `CTRLBSET` 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 `CTRLBSET` 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 `DIR` reader - Counter Direction"] +pub struct DIR_R(crate::FieldReader); +impl DIR_R { + pub(crate) fn new(bits: bool) -> Self { + DIR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for DIR_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `DIR` writer - Counter Direction"] +pub struct DIR_W<'a> { + w: &'a mut W, +} +impl<'a> DIR_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 `LUPD` reader - Lock Update"] +pub struct LUPD_R(crate::FieldReader); +impl LUPD_R { + pub(crate) fn new(bits: bool) -> Self { + LUPD_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for LUPD_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `LUPD` writer - Lock Update"] +pub struct LUPD_W<'a> { + w: &'a mut W, +} +impl<'a> LUPD_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 `ONESHOT` reader - One-Shot on Counter"] +pub struct ONESHOT_R(crate::FieldReader); +impl ONESHOT_R { + pub(crate) fn new(bits: bool) -> Self { + ONESHOT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ONESHOT_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ONESHOT` writer - One-Shot on Counter"] +pub struct ONESHOT_W<'a> { + w: &'a mut W, +} +impl<'a> ONESHOT_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 = "Command\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum CMD_A { + #[doc = "0: No action"] + NONE = 0, + #[doc = "1: Force a start, restart or retrigger"] + RETRIGGER = 1, + #[doc = "2: Force a stop"] + STOP = 2, + #[doc = "3: Force update of double-buffered register"] + UPDATE = 3, + #[doc = "4: Force a read synchronization of COUNT"] + READSYNC = 4, + #[doc = "5: One-shot DMA trigger"] + DMAOS = 5, +} +impl From for u8 { + #[inline(always)] + fn from(variant: CMD_A) -> Self { + variant as _ + } +} +#[doc = "Field `CMD` reader - Command"] +pub struct CMD_R(crate::FieldReader); +impl CMD_R { + pub(crate) fn new(bits: u8) -> Self { + CMD_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(CMD_A::NONE), + 1 => Some(CMD_A::RETRIGGER), + 2 => Some(CMD_A::STOP), + 3 => Some(CMD_A::UPDATE), + 4 => Some(CMD_A::READSYNC), + 5 => Some(CMD_A::DMAOS), + _ => None, + } + } + #[doc = "Checks if the value of the field is `NONE`"] + #[inline(always)] + pub fn is_none(&self) -> bool { + **self == CMD_A::NONE + } + #[doc = "Checks if the value of the field is `RETRIGGER`"] + #[inline(always)] + pub fn is_retrigger(&self) -> bool { + **self == CMD_A::RETRIGGER + } + #[doc = "Checks if the value of the field is `STOP`"] + #[inline(always)] + pub fn is_stop(&self) -> bool { + **self == CMD_A::STOP + } + #[doc = "Checks if the value of the field is `UPDATE`"] + #[inline(always)] + pub fn is_update(&self) -> bool { + **self == CMD_A::UPDATE + } + #[doc = "Checks if the value of the field is `READSYNC`"] + #[inline(always)] + pub fn is_readsync(&self) -> bool { + **self == CMD_A::READSYNC + } + #[doc = "Checks if the value of the field is `DMAOS`"] + #[inline(always)] + pub fn is_dmaos(&self) -> bool { + **self == CMD_A::DMAOS + } +} +impl core::ops::Deref for CMD_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CMD` writer - Command"] +pub struct CMD_W<'a> { + w: &'a mut W, +} +impl<'a> CMD_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: CMD_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "No action"] + #[inline(always)] + pub fn none(self) -> &'a mut W { + self.variant(CMD_A::NONE) + } + #[doc = "Force a start, restart or retrigger"] + #[inline(always)] + pub fn retrigger(self) -> &'a mut W { + self.variant(CMD_A::RETRIGGER) + } + #[doc = "Force a stop"] + #[inline(always)] + pub fn stop(self) -> &'a mut W { + self.variant(CMD_A::STOP) + } + #[doc = "Force update of double-buffered register"] + #[inline(always)] + pub fn update(self) -> &'a mut W { + self.variant(CMD_A::UPDATE) + } + #[doc = "Force a read synchronization of COUNT"] + #[inline(always)] + pub fn readsync(self) -> &'a mut W { + self.variant(CMD_A::READSYNC) + } + #[doc = "One-shot DMA trigger"] + #[inline(always)] + pub fn dmaos(self) -> &'a mut W { + self.variant(CMD_A::DMAOS) + } + #[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 u8 & 0x07) << 5); + self.w + } +} +impl R { + #[doc = "Bit 0 - Counter Direction"] + #[inline(always)] + pub fn dir(&self) -> DIR_R { + DIR_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Lock Update"] + #[inline(always)] + pub fn lupd(&self) -> LUPD_R { + LUPD_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - One-Shot on Counter"] + #[inline(always)] + pub fn oneshot(&self) -> ONESHOT_R { + ONESHOT_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bits 5:7 - Command"] + #[inline(always)] + pub fn cmd(&self) -> CMD_R { + CMD_R::new(((self.bits >> 5) & 0x07) as u8) + } +} +impl W { + #[doc = "Bit 0 - Counter Direction"] + #[inline(always)] + pub fn dir(&mut self) -> DIR_W { + DIR_W { w: self } + } + #[doc = "Bit 1 - Lock Update"] + #[inline(always)] + pub fn lupd(&mut self) -> LUPD_W { + LUPD_W { w: self } + } + #[doc = "Bit 2 - One-Shot on Counter"] + #[inline(always)] + pub fn oneshot(&mut self) -> ONESHOT_W { + ONESHOT_W { w: self } + } + #[doc = "Bits 5:7 - Command"] + #[inline(always)] + pub fn cmd(&mut self) -> CMD_W { + CMD_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 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 [ctrlbset](index.html) module"] +pub struct CTRLBSET_SPEC; +impl crate::RegisterSpec for CTRLBSET_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [ctrlbset::R](R) reader structure"] +impl crate::Readable for CTRLBSET_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [ctrlbset::W](W) writer structure"] +impl crate::Writable for CTRLBSET_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets CTRLBSET to value 0"] +impl crate::Resettable for CTRLBSET_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/tc0/count16/dbgctrl.rs b/src/tc0/count16/dbgctrl.rs new file mode 100644 index 0000000..950156c --- /dev/null +++ b/src/tc0/count16/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 - Run During Debug"] +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 - Run During Debug"] +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 - Run During Debug"] + #[inline(always)] + pub fn dbgrun(&self) -> DBGRUN_R { + DBGRUN_R::new((self.bits & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Run During Debug"] + #[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/tc0/count16/drvctrl.rs b/src/tc0/count16/drvctrl.rs new file mode 100644 index 0000000..48e765a --- /dev/null +++ b/src/tc0/count16/drvctrl.rs @@ -0,0 +1,158 @@ +#[doc = "Register `DRVCTRL` 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 `DRVCTRL` 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 `INVEN0` reader - Output Waveform Invert Enable 0"] +pub struct INVEN0_R(crate::FieldReader); +impl INVEN0_R { + pub(crate) fn new(bits: bool) -> Self { + INVEN0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for INVEN0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `INVEN0` writer - Output Waveform Invert Enable 0"] +pub struct INVEN0_W<'a> { + w: &'a mut W, +} +impl<'a> INVEN0_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 `INVEN1` reader - Output Waveform Invert Enable 1"] +pub struct INVEN1_R(crate::FieldReader); +impl INVEN1_R { + pub(crate) fn new(bits: bool) -> Self { + INVEN1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for INVEN1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `INVEN1` writer - Output Waveform Invert Enable 1"] +pub struct INVEN1_W<'a> { + w: &'a mut W, +} +impl<'a> INVEN1_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 - Output Waveform Invert Enable 0"] + #[inline(always)] + pub fn inven0(&self) -> INVEN0_R { + INVEN0_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Output Waveform Invert Enable 1"] + #[inline(always)] + pub fn inven1(&self) -> INVEN1_R { + INVEN1_R::new(((self.bits >> 1) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Output Waveform Invert Enable 0"] + #[inline(always)] + pub fn inven0(&mut self) -> INVEN0_W { + INVEN0_W { w: self } + } + #[doc = "Bit 1 - Output Waveform Invert Enable 1"] + #[inline(always)] + pub fn inven1(&mut self) -> INVEN1_W { + INVEN1_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 C\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 [drvctrl](index.html) module"] +pub struct DRVCTRL_SPEC; +impl crate::RegisterSpec for DRVCTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [drvctrl::R](R) reader structure"] +impl crate::Readable for DRVCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [drvctrl::W](W) writer structure"] +impl crate::Writable for DRVCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets DRVCTRL to value 0"] +impl crate::Resettable for DRVCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/tc0/count16/evctrl.rs b/src/tc0/count16/evctrl.rs new file mode 100644 index 0000000..8d7bcaf --- /dev/null +++ b/src/tc0/count16/evctrl.rs @@ -0,0 +1,459 @@ +#[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 = "Event Action\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum EVACT_A { + #[doc = "0: Event action disabled"] + OFF = 0, + #[doc = "1: Start, restart or retrigger TC on event"] + RETRIGGER = 1, + #[doc = "2: Count on event"] + COUNT = 2, + #[doc = "3: Start TC on event"] + START = 3, + #[doc = "4: Time stamp capture"] + STAMP = 4, + #[doc = "5: Period catured in CC0, pulse width in CC1"] + PPW = 5, + #[doc = "6: Period catured in CC1, pulse width in CC0"] + PWP = 6, + #[doc = "7: Pulse width capture"] + PW = 7, +} +impl From for u8 { + #[inline(always)] + fn from(variant: EVACT_A) -> Self { + variant as _ + } +} +#[doc = "Field `EVACT` reader - Event Action"] +pub struct EVACT_R(crate::FieldReader); +impl EVACT_R { + pub(crate) fn new(bits: u8) -> Self { + EVACT_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> EVACT_A { + match self.bits { + 0 => EVACT_A::OFF, + 1 => EVACT_A::RETRIGGER, + 2 => EVACT_A::COUNT, + 3 => EVACT_A::START, + 4 => EVACT_A::STAMP, + 5 => EVACT_A::PPW, + 6 => EVACT_A::PWP, + 7 => EVACT_A::PW, + _ => unreachable!(), + } + } + #[doc = "Checks if the value of the field is `OFF`"] + #[inline(always)] + pub fn is_off(&self) -> bool { + **self == EVACT_A::OFF + } + #[doc = "Checks if the value of the field is `RETRIGGER`"] + #[inline(always)] + pub fn is_retrigger(&self) -> bool { + **self == EVACT_A::RETRIGGER + } + #[doc = "Checks if the value of the field is `COUNT`"] + #[inline(always)] + pub fn is_count(&self) -> bool { + **self == EVACT_A::COUNT + } + #[doc = "Checks if the value of the field is `START`"] + #[inline(always)] + pub fn is_start(&self) -> bool { + **self == EVACT_A::START + } + #[doc = "Checks if the value of the field is `STAMP`"] + #[inline(always)] + pub fn is_stamp(&self) -> bool { + **self == EVACT_A::STAMP + } + #[doc = "Checks if the value of the field is `PPW`"] + #[inline(always)] + pub fn is_ppw(&self) -> bool { + **self == EVACT_A::PPW + } + #[doc = "Checks if the value of the field is `PWP`"] + #[inline(always)] + pub fn is_pwp(&self) -> bool { + **self == EVACT_A::PWP + } + #[doc = "Checks if the value of the field is `PW`"] + #[inline(always)] + pub fn is_pw(&self) -> bool { + **self == EVACT_A::PW + } +} +impl core::ops::Deref for EVACT_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `EVACT` writer - Event Action"] +pub struct EVACT_W<'a> { + w: &'a mut W, +} +impl<'a> EVACT_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: EVACT_A) -> &'a mut W { + self.bits(variant.into()) + } + #[doc = "Event action disabled"] + #[inline(always)] + pub fn off(self) -> &'a mut W { + self.variant(EVACT_A::OFF) + } + #[doc = "Start, restart or retrigger TC on event"] + #[inline(always)] + pub fn retrigger(self) -> &'a mut W { + self.variant(EVACT_A::RETRIGGER) + } + #[doc = "Count on event"] + #[inline(always)] + pub fn count(self) -> &'a mut W { + self.variant(EVACT_A::COUNT) + } + #[doc = "Start TC on event"] + #[inline(always)] + pub fn start(self) -> &'a mut W { + self.variant(EVACT_A::START) + } + #[doc = "Time stamp capture"] + #[inline(always)] + pub fn stamp(self) -> &'a mut W { + self.variant(EVACT_A::STAMP) + } + #[doc = "Period catured in CC0, pulse width in CC1"] + #[inline(always)] + pub fn ppw(self) -> &'a mut W { + self.variant(EVACT_A::PPW) + } + #[doc = "Period catured in CC1, pulse width in CC0"] + #[inline(always)] + pub fn pwp(self) -> &'a mut W { + self.variant(EVACT_A::PWP) + } + #[doc = "Pulse width capture"] + #[inline(always)] + pub fn pw(self) -> &'a mut W { + self.variant(EVACT_A::PW) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !0x07) | (value as u16 & 0x07); + self.w + } +} +#[doc = "Field `TCINV` reader - TC Event Input Polarity"] +pub struct TCINV_R(crate::FieldReader); +impl TCINV_R { + pub(crate) fn new(bits: bool) -> Self { + TCINV_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for TCINV_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `TCINV` writer - TC Event Input Polarity"] +pub struct TCINV_W<'a> { + w: &'a mut W, +} +impl<'a> TCINV_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 << 4)) | ((value as u16 & 0x01) << 4); + self.w + } +} +#[doc = "Field `TCEI` reader - TC Event Enable"] +pub struct TCEI_R(crate::FieldReader); +impl TCEI_R { + pub(crate) fn new(bits: bool) -> Self { + TCEI_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for TCEI_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `TCEI` writer - TC Event Enable"] +pub struct TCEI_W<'a> { + w: &'a mut W, +} +impl<'a> TCEI_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 u16 & 0x01) << 5); + self.w + } +} +#[doc = "Field `OVFEO` reader - Event Output Enable"] +pub struct OVFEO_R(crate::FieldReader); +impl OVFEO_R { + pub(crate) fn new(bits: bool) -> Self { + OVFEO_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for OVFEO_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OVFEO` writer - Event Output Enable"] +pub struct OVFEO_W<'a> { + w: &'a mut W, +} +impl<'a> OVFEO_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 u16 & 0x01) << 8); + self.w + } +} +#[doc = "Field `MCEO0` reader - MC Event Output Enable 0"] +pub struct MCEO0_R(crate::FieldReader); +impl MCEO0_R { + pub(crate) fn new(bits: bool) -> Self { + MCEO0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for MCEO0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MCEO0` writer - MC Event Output Enable 0"] +pub struct MCEO0_W<'a> { + w: &'a mut W, +} +impl<'a> MCEO0_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 u16 & 0x01) << 12); + self.w + } +} +#[doc = "Field `MCEO1` reader - MC Event Output Enable 1"] +pub struct MCEO1_R(crate::FieldReader); +impl MCEO1_R { + pub(crate) fn new(bits: bool) -> Self { + MCEO1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for MCEO1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MCEO1` writer - MC Event Output Enable 1"] +pub struct MCEO1_W<'a> { + w: &'a mut W, +} +impl<'a> MCEO1_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 u16 & 0x01) << 13); + self.w + } +} +impl R { + #[doc = "Bits 0:2 - Event Action"] + #[inline(always)] + pub fn evact(&self) -> EVACT_R { + EVACT_R::new((self.bits & 0x07) as u8) + } + #[doc = "Bit 4 - TC Event Input Polarity"] + #[inline(always)] + pub fn tcinv(&self) -> TCINV_R { + TCINV_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - TC Event Enable"] + #[inline(always)] + pub fn tcei(&self) -> TCEI_R { + TCEI_R::new(((self.bits >> 5) & 0x01) != 0) + } + #[doc = "Bit 8 - Event Output Enable"] + #[inline(always)] + pub fn ovfeo(&self) -> OVFEO_R { + OVFEO_R::new(((self.bits >> 8) & 0x01) != 0) + } + #[doc = "Bit 12 - MC Event Output Enable 0"] + #[inline(always)] + pub fn mceo0(&self) -> MCEO0_R { + MCEO0_R::new(((self.bits >> 12) & 0x01) != 0) + } + #[doc = "Bit 13 - MC Event Output Enable 1"] + #[inline(always)] + pub fn mceo1(&self) -> MCEO1_R { + MCEO1_R::new(((self.bits >> 13) & 0x01) != 0) + } +} +impl W { + #[doc = "Bits 0:2 - Event Action"] + #[inline(always)] + pub fn evact(&mut self) -> EVACT_W { + EVACT_W { w: self } + } + #[doc = "Bit 4 - TC Event Input Polarity"] + #[inline(always)] + pub fn tcinv(&mut self) -> TCINV_W { + TCINV_W { w: self } + } + #[doc = "Bit 5 - TC Event Enable"] + #[inline(always)] + pub fn tcei(&mut self) -> TCEI_W { + TCEI_W { w: self } + } + #[doc = "Bit 8 - Event Output Enable"] + #[inline(always)] + pub fn ovfeo(&mut self) -> OVFEO_W { + OVFEO_W { w: self } + } + #[doc = "Bit 12 - MC Event Output Enable 0"] + #[inline(always)] + pub fn mceo0(&mut self) -> MCEO0_W { + MCEO0_W { w: self } + } + #[doc = "Bit 13 - MC Event Output Enable 1"] + #[inline(always)] + pub fn mceo1(&mut self) -> MCEO1_W { + MCEO1_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 = "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 = u16; +} +#[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/tc0/count16/intenclr.rs b/src/tc0/count16/intenclr.rs new file mode 100644 index 0000000..1747f73 --- /dev/null +++ b/src/tc0/count16/intenclr.rs @@ -0,0 +1,250 @@ +#[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 `OVF` reader - OVF Interrupt Disable"] +pub struct OVF_R(crate::FieldReader); +impl OVF_R { + pub(crate) fn new(bits: bool) -> Self { + OVF_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for OVF_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OVF` writer - OVF Interrupt Disable"] +pub struct OVF_W<'a> { + w: &'a mut W, +} +impl<'a> OVF_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 `ERR` reader - ERR Interrupt Disable"] +pub struct ERR_R(crate::FieldReader); +impl ERR_R { + pub(crate) fn new(bits: bool) -> Self { + ERR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ERR_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ERR` writer - ERR Interrupt Disable"] +pub struct ERR_W<'a> { + w: &'a mut W, +} +impl<'a> ERR_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 `MC0` reader - MC Interrupt Disable 0"] +pub struct MC0_R(crate::FieldReader); +impl MC0_R { + pub(crate) fn new(bits: bool) -> Self { + MC0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for MC0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MC0` writer - MC Interrupt Disable 0"] +pub struct MC0_W<'a> { + w: &'a mut W, +} +impl<'a> MC0_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 << 4)) | ((value as u8 & 0x01) << 4); + self.w + } +} +#[doc = "Field `MC1` reader - MC Interrupt Disable 1"] +pub struct MC1_R(crate::FieldReader); +impl MC1_R { + pub(crate) fn new(bits: bool) -> Self { + MC1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for MC1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MC1` writer - MC Interrupt Disable 1"] +pub struct MC1_W<'a> { + w: &'a mut W, +} +impl<'a> MC1_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 + } +} +impl R { + #[doc = "Bit 0 - OVF Interrupt Disable"] + #[inline(always)] + pub fn ovf(&self) -> OVF_R { + OVF_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - ERR Interrupt Disable"] + #[inline(always)] + pub fn err(&self) -> ERR_R { + ERR_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 4 - MC Interrupt Disable 0"] + #[inline(always)] + pub fn mc0(&self) -> MC0_R { + MC0_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - MC Interrupt Disable 1"] + #[inline(always)] + pub fn mc1(&self) -> MC1_R { + MC1_R::new(((self.bits >> 5) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - OVF Interrupt Disable"] + #[inline(always)] + pub fn ovf(&mut self) -> OVF_W { + OVF_W { w: self } + } + #[doc = "Bit 1 - ERR Interrupt Disable"] + #[inline(always)] + pub fn err(&mut self) -> ERR_W { + ERR_W { w: self } + } + #[doc = "Bit 4 - MC Interrupt Disable 0"] + #[inline(always)] + pub fn mc0(&mut self) -> MC0_W { + MC0_W { w: self } + } + #[doc = "Bit 5 - MC Interrupt Disable 1"] + #[inline(always)] + pub fn mc1(&mut self) -> MC1_W { + MC1_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/tc0/count16/intenset.rs b/src/tc0/count16/intenset.rs new file mode 100644 index 0000000..8a5ab3b --- /dev/null +++ b/src/tc0/count16/intenset.rs @@ -0,0 +1,250 @@ +#[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 `OVF` reader - OVF Interrupt Enable"] +pub struct OVF_R(crate::FieldReader); +impl OVF_R { + pub(crate) fn new(bits: bool) -> Self { + OVF_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for OVF_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OVF` writer - OVF Interrupt Enable"] +pub struct OVF_W<'a> { + w: &'a mut W, +} +impl<'a> OVF_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 `ERR` reader - ERR Interrupt Enable"] +pub struct ERR_R(crate::FieldReader); +impl ERR_R { + pub(crate) fn new(bits: bool) -> Self { + ERR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ERR_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ERR` writer - ERR Interrupt Enable"] +pub struct ERR_W<'a> { + w: &'a mut W, +} +impl<'a> ERR_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 `MC0` reader - MC Interrupt Enable 0"] +pub struct MC0_R(crate::FieldReader); +impl MC0_R { + pub(crate) fn new(bits: bool) -> Self { + MC0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for MC0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MC0` writer - MC Interrupt Enable 0"] +pub struct MC0_W<'a> { + w: &'a mut W, +} +impl<'a> MC0_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 << 4)) | ((value as u8 & 0x01) << 4); + self.w + } +} +#[doc = "Field `MC1` reader - MC Interrupt Enable 1"] +pub struct MC1_R(crate::FieldReader); +impl MC1_R { + pub(crate) fn new(bits: bool) -> Self { + MC1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for MC1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MC1` writer - MC Interrupt Enable 1"] +pub struct MC1_W<'a> { + w: &'a mut W, +} +impl<'a> MC1_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 + } +} +impl R { + #[doc = "Bit 0 - OVF Interrupt Enable"] + #[inline(always)] + pub fn ovf(&self) -> OVF_R { + OVF_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - ERR Interrupt Enable"] + #[inline(always)] + pub fn err(&self) -> ERR_R { + ERR_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 4 - MC Interrupt Enable 0"] + #[inline(always)] + pub fn mc0(&self) -> MC0_R { + MC0_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - MC Interrupt Enable 1"] + #[inline(always)] + pub fn mc1(&self) -> MC1_R { + MC1_R::new(((self.bits >> 5) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - OVF Interrupt Enable"] + #[inline(always)] + pub fn ovf(&mut self) -> OVF_W { + OVF_W { w: self } + } + #[doc = "Bit 1 - ERR Interrupt Enable"] + #[inline(always)] + pub fn err(&mut self) -> ERR_W { + ERR_W { w: self } + } + #[doc = "Bit 4 - MC Interrupt Enable 0"] + #[inline(always)] + pub fn mc0(&mut self) -> MC0_W { + MC0_W { w: self } + } + #[doc = "Bit 5 - MC Interrupt Enable 1"] + #[inline(always)] + pub fn mc1(&mut self) -> MC1_W { + MC1_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/tc0/count16/intflag.rs b/src/tc0/count16/intflag.rs new file mode 100644 index 0000000..b84e75f --- /dev/null +++ b/src/tc0/count16/intflag.rs @@ -0,0 +1,250 @@ +#[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 `OVF` reader - OVF Interrupt Flag"] +pub struct OVF_R(crate::FieldReader); +impl OVF_R { + pub(crate) fn new(bits: bool) -> Self { + OVF_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for OVF_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OVF` writer - OVF Interrupt Flag"] +pub struct OVF_W<'a> { + w: &'a mut W, +} +impl<'a> OVF_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 `ERR` reader - ERR Interrupt Flag"] +pub struct ERR_R(crate::FieldReader); +impl ERR_R { + pub(crate) fn new(bits: bool) -> Self { + ERR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ERR_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ERR` writer - ERR Interrupt Flag"] +pub struct ERR_W<'a> { + w: &'a mut W, +} +impl<'a> ERR_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 `MC0` reader - MC Interrupt Flag 0"] +pub struct MC0_R(crate::FieldReader); +impl MC0_R { + pub(crate) fn new(bits: bool) -> Self { + MC0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for MC0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MC0` writer - MC Interrupt Flag 0"] +pub struct MC0_W<'a> { + w: &'a mut W, +} +impl<'a> MC0_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 << 4)) | ((value as u8 & 0x01) << 4); + self.w + } +} +#[doc = "Field `MC1` reader - MC Interrupt Flag 1"] +pub struct MC1_R(crate::FieldReader); +impl MC1_R { + pub(crate) fn new(bits: bool) -> Self { + MC1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for MC1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MC1` writer - MC Interrupt Flag 1"] +pub struct MC1_W<'a> { + w: &'a mut W, +} +impl<'a> MC1_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 + } +} +impl R { + #[doc = "Bit 0 - OVF Interrupt Flag"] + #[inline(always)] + pub fn ovf(&self) -> OVF_R { + OVF_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - ERR Interrupt Flag"] + #[inline(always)] + pub fn err(&self) -> ERR_R { + ERR_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 4 - MC Interrupt Flag 0"] + #[inline(always)] + pub fn mc0(&self) -> MC0_R { + MC0_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - MC Interrupt Flag 1"] + #[inline(always)] + pub fn mc1(&self) -> MC1_R { + MC1_R::new(((self.bits >> 5) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - OVF Interrupt Flag"] + #[inline(always)] + pub fn ovf(&mut self) -> OVF_W { + OVF_W { w: self } + } + #[doc = "Bit 1 - ERR Interrupt Flag"] + #[inline(always)] + pub fn err(&mut self) -> ERR_W { + ERR_W { w: self } + } + #[doc = "Bit 4 - MC Interrupt Flag 0"] + #[inline(always)] + pub fn mc0(&mut self) -> MC0_W { + MC0_W { w: self } + } + #[doc = "Bit 5 - MC Interrupt Flag 1"] + #[inline(always)] + pub fn mc1(&mut self) -> MC1_W { + MC1_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/tc0/count16/status.rs b/src/tc0/count16/status.rs new file mode 100644 index 0000000..1ff433b --- /dev/null +++ b/src/tc0/count16/status.rs @@ -0,0 +1,296 @@ +#[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 = "Register `STATUS` 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 `STOP` reader - Stop Status Flag"] +pub struct STOP_R(crate::FieldReader); +impl STOP_R { + pub(crate) fn new(bits: bool) -> Self { + STOP_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for STOP_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `STOP` writer - Stop Status Flag"] +pub struct STOP_W<'a> { + w: &'a mut W, +} +impl<'a> STOP_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 `SLAVE` reader - Slave Status Flag"] +pub struct SLAVE_R(crate::FieldReader); +impl SLAVE_R { + pub(crate) fn new(bits: bool) -> Self { + SLAVE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SLAVE_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SLAVE` writer - Slave Status Flag"] +pub struct SLAVE_W<'a> { + w: &'a mut W, +} +impl<'a> SLAVE_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 `PERBUFV` reader - Synchronization Busy Status"] +pub struct PERBUFV_R(crate::FieldReader); +impl PERBUFV_R { + pub(crate) fn new(bits: bool) -> Self { + PERBUFV_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for PERBUFV_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PERBUFV` writer - Synchronization Busy Status"] +pub struct PERBUFV_W<'a> { + w: &'a mut W, +} +impl<'a> PERBUFV_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 `CCBUFV0` reader - Compare channel buffer 0 valid"] +pub struct CCBUFV0_R(crate::FieldReader); +impl CCBUFV0_R { + pub(crate) fn new(bits: bool) -> Self { + CCBUFV0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CCBUFV0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CCBUFV0` writer - Compare channel buffer 0 valid"] +pub struct CCBUFV0_W<'a> { + w: &'a mut W, +} +impl<'a> CCBUFV0_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 << 4)) | ((value as u8 & 0x01) << 4); + self.w + } +} +#[doc = "Field `CCBUFV1` reader - Compare channel buffer 1 valid"] +pub struct CCBUFV1_R(crate::FieldReader); +impl CCBUFV1_R { + pub(crate) fn new(bits: bool) -> Self { + CCBUFV1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CCBUFV1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CCBUFV1` writer - Compare channel buffer 1 valid"] +pub struct CCBUFV1_W<'a> { + w: &'a mut W, +} +impl<'a> CCBUFV1_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 + } +} +impl R { + #[doc = "Bit 0 - Stop Status Flag"] + #[inline(always)] + pub fn stop(&self) -> STOP_R { + STOP_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Slave Status Flag"] + #[inline(always)] + pub fn slave(&self) -> SLAVE_R { + SLAVE_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 3 - Synchronization Busy Status"] + #[inline(always)] + pub fn perbufv(&self) -> PERBUFV_R { + PERBUFV_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 4 - Compare channel buffer 0 valid"] + #[inline(always)] + pub fn ccbufv0(&self) -> CCBUFV0_R { + CCBUFV0_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - Compare channel buffer 1 valid"] + #[inline(always)] + pub fn ccbufv1(&self) -> CCBUFV1_R { + CCBUFV1_R::new(((self.bits >> 5) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Stop Status Flag"] + #[inline(always)] + pub fn stop(&mut self) -> STOP_W { + STOP_W { w: self } + } + #[doc = "Bit 1 - Slave Status Flag"] + #[inline(always)] + pub fn slave(&mut self) -> SLAVE_W { + SLAVE_W { w: self } + } + #[doc = "Bit 3 - Synchronization Busy Status"] + #[inline(always)] + pub fn perbufv(&mut self) -> PERBUFV_W { + PERBUFV_W { w: self } + } + #[doc = "Bit 4 - Compare channel buffer 0 valid"] + #[inline(always)] + pub fn ccbufv0(&mut self) -> CCBUFV0_W { + CCBUFV0_W { w: self } + } + #[doc = "Bit 5 - Compare channel buffer 1 valid"] + #[inline(always)] + pub fn ccbufv1(&mut self) -> CCBUFV1_W { + CCBUFV1_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 = "Status\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 [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 = "`write(|w| ..)` method takes [status::W](W) writer structure"] +impl crate::Writable for STATUS_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets STATUS to value 0x01"] +impl crate::Resettable for STATUS_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0x01 + } +} diff --git a/src/tc0/count16/syncbusy.rs b/src/tc0/count16/syncbusy.rs new file mode 100644 index 0000000..38932f9 --- /dev/null +++ b/src/tc0/count16/syncbusy.rs @@ -0,0 +1,185 @@ +#[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 - swrst"] +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 `CTRLB` reader - CTRLB"] +pub struct CTRLB_R(crate::FieldReader); +impl CTRLB_R { + pub(crate) fn new(bits: bool) -> Self { + CTRLB_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CTRLB_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `STATUS` reader - STATUS"] +pub struct STATUS_R(crate::FieldReader); +impl STATUS_R { + pub(crate) fn new(bits: bool) -> Self { + STATUS_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for STATUS_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COUNT` reader - Counter"] +pub struct COUNT_R(crate::FieldReader); +impl COUNT_R { + pub(crate) fn new(bits: bool) -> Self { + COUNT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COUNT_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PER` reader - Period"] +pub struct PER_R(crate::FieldReader); +impl PER_R { + pub(crate) fn new(bits: bool) -> Self { + PER_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for PER_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CC0` reader - Compare Channel 0"] +pub struct CC0_R(crate::FieldReader); +impl CC0_R { + pub(crate) fn new(bits: bool) -> Self { + CC0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CC0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CC1` reader - Compare Channel 1"] +pub struct CC1_R(crate::FieldReader); +impl CC1_R { + pub(crate) fn new(bits: bool) -> Self { + CC1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CC1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bit 0 - swrst"] + #[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 - CTRLB"] + #[inline(always)] + pub fn ctrlb(&self) -> CTRLB_R { + CTRLB_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - STATUS"] + #[inline(always)] + pub fn status(&self) -> STATUS_R { + STATUS_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 4 - Counter"] + #[inline(always)] + pub fn count(&self) -> COUNT_R { + COUNT_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - Period"] + #[inline(always)] + pub fn per(&self) -> PER_R { + PER_R::new(((self.bits >> 5) & 0x01) != 0) + } + #[doc = "Bit 6 - Compare Channel 0"] + #[inline(always)] + pub fn cc0(&self) -> CC0_R { + CC0_R::new(((self.bits >> 6) & 0x01) != 0) + } + #[doc = "Bit 7 - Compare Channel 1"] + #[inline(always)] + pub fn cc1(&self) -> CC1_R { + CC1_R::new(((self.bits >> 7) & 0x01) != 0) + } +} +#[doc = "Synchronization 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 [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 + } +} diff --git a/src/tc0/count16/wave.rs b/src/tc0/count16/wave.rs new file mode 100644 index 0000000..d87b2d2 --- /dev/null +++ b/src/tc0/count16/wave.rs @@ -0,0 +1,177 @@ +#[doc = "Register `WAVE` 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 `WAVE` 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 = "Waveform Generation Mode\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum WAVEGEN_A { + #[doc = "0: Normal frequency"] + NFRQ = 0, + #[doc = "1: Match frequency"] + MFRQ = 1, + #[doc = "2: Normal PWM"] + NPWM = 2, + #[doc = "3: Match PWM"] + MPWM = 3, +} +impl From for u8 { + #[inline(always)] + fn from(variant: WAVEGEN_A) -> Self { + variant as _ + } +} +#[doc = "Field `WAVEGEN` reader - Waveform Generation Mode"] +pub struct WAVEGEN_R(crate::FieldReader); +impl WAVEGEN_R { + pub(crate) fn new(bits: u8) -> Self { + WAVEGEN_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> WAVEGEN_A { + match self.bits { + 0 => WAVEGEN_A::NFRQ, + 1 => WAVEGEN_A::MFRQ, + 2 => WAVEGEN_A::NPWM, + 3 => WAVEGEN_A::MPWM, + _ => unreachable!(), + } + } + #[doc = "Checks if the value of the field is `NFRQ`"] + #[inline(always)] + pub fn is_nfrq(&self) -> bool { + **self == WAVEGEN_A::NFRQ + } + #[doc = "Checks if the value of the field is `MFRQ`"] + #[inline(always)] + pub fn is_mfrq(&self) -> bool { + **self == WAVEGEN_A::MFRQ + } + #[doc = "Checks if the value of the field is `NPWM`"] + #[inline(always)] + pub fn is_npwm(&self) -> bool { + **self == WAVEGEN_A::NPWM + } + #[doc = "Checks if the value of the field is `MPWM`"] + #[inline(always)] + pub fn is_mpwm(&self) -> bool { + **self == WAVEGEN_A::MPWM + } +} +impl core::ops::Deref for WAVEGEN_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WAVEGEN` writer - Waveform Generation Mode"] +pub struct WAVEGEN_W<'a> { + w: &'a mut W, +} +impl<'a> WAVEGEN_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: WAVEGEN_A) -> &'a mut W { + self.bits(variant.into()) + } + #[doc = "Normal frequency"] + #[inline(always)] + pub fn nfrq(self) -> &'a mut W { + self.variant(WAVEGEN_A::NFRQ) + } + #[doc = "Match frequency"] + #[inline(always)] + pub fn mfrq(self) -> &'a mut W { + self.variant(WAVEGEN_A::MFRQ) + } + #[doc = "Normal PWM"] + #[inline(always)] + pub fn npwm(self) -> &'a mut W { + self.variant(WAVEGEN_A::NPWM) + } + #[doc = "Match PWM"] + #[inline(always)] + pub fn mpwm(self) -> &'a mut W { + self.variant(WAVEGEN_A::MPWM) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !0x03) | (value as u8 & 0x03); + self.w + } +} +impl R { + #[doc = "Bits 0:1 - Waveform Generation Mode"] + #[inline(always)] + pub fn wavegen(&self) -> WAVEGEN_R { + WAVEGEN_R::new((self.bits & 0x03) as u8) + } +} +impl W { + #[doc = "Bits 0:1 - Waveform Generation Mode"] + #[inline(always)] + pub fn wavegen(&mut self) -> WAVEGEN_W { + WAVEGEN_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 = "Waveform Generation 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 [wave](index.html) module"] +pub struct WAVE_SPEC; +impl crate::RegisterSpec for WAVE_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [wave::R](R) reader structure"] +impl crate::Readable for WAVE_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [wave::W](W) writer structure"] +impl crate::Writable for WAVE_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets WAVE to value 0"] +impl crate::Resettable for WAVE_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} -- cgit v1.2.3-70-g09d2