diff options
Diffstat (limited to 'src/sdadc')
| -rw-r--r-- | src/sdadc/anactrl.rs | 194 | ||||
| -rw-r--r-- | src/sdadc/ctrla.rs | 250 | ||||
| -rw-r--r-- | src/sdadc/ctrlb.rs | 389 | ||||
| -rw-r--r-- | src/sdadc/ctrlc.rs | 112 | ||||
| -rw-r--r-- | src/sdadc/dbgctrl.rs | 112 | ||||
| -rw-r--r-- | src/sdadc/evctrl.rs | 342 | ||||
| -rw-r--r-- | src/sdadc/gaincorr.rs | 102 | ||||
| -rw-r--r-- | src/sdadc/inputctrl.rs | 164 | ||||
| -rw-r--r-- | src/sdadc/intenclr.rs | 204 | ||||
| -rw-r--r-- | src/sdadc/intenset.rs | 204 | ||||
| -rw-r--r-- | src/sdadc/intflag.rs | 204 | ||||
| -rw-r--r-- | src/sdadc/offsetcorr.rs | 102 | ||||
| -rw-r--r-- | src/sdadc/refctrl.rs | 259 | ||||
| -rw-r--r-- | src/sdadc/result.rs | 52 | ||||
| -rw-r--r-- | src/sdadc/seqctrl.rs | 102 | ||||
| -rw-r--r-- | src/sdadc/seqstatus.rs | 71 | ||||
| -rw-r--r-- | src/sdadc/shiftcorr.rs | 102 | ||||
| -rw-r--r-- | src/sdadc/swtrig.rs | 158 | ||||
| -rw-r--r-- | src/sdadc/syncbusy.rs | 261 | ||||
| -rw-r--r-- | src/sdadc/winctrl.rs | 102 | ||||
| -rw-r--r-- | src/sdadc/winlt.rs | 102 | ||||
| -rw-r--r-- | src/sdadc/winut.rs | 102 |
22 files changed, 3690 insertions, 0 deletions
diff --git a/src/sdadc/anactrl.rs b/src/sdadc/anactrl.rs new file mode 100644 index 0000000..22b3dac --- /dev/null +++ b/src/sdadc/anactrl.rs @@ -0,0 +1,194 @@ +#[doc = "Register `ANACTRL` reader"] +pub struct R(crate::R<ANACTRL_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<ANACTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<ANACTRL_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<ANACTRL_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `ANACTRL` writer"] +pub struct W(crate::W<ANACTRL_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<ANACTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<ANACTRL_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<ANACTRL_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `CTRSDADC` reader - SDADC Control"] +pub struct CTRSDADC_R(crate::FieldReader<u8, u8>); +impl CTRSDADC_R { + pub(crate) fn new(bits: u8) -> Self { + CTRSDADC_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CTRSDADC_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CTRSDADC` writer - SDADC Control"] +pub struct CTRSDADC_W<'a> { + w: &'a mut W, +} +impl<'a> CTRSDADC_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !0x3f) | (value as u8 & 0x3f); + self.w + } +} +#[doc = "Field `ONCHOP` reader - Chopper"] +pub struct ONCHOP_R(crate::FieldReader<bool, bool>); +impl ONCHOP_R { + pub(crate) fn new(bits: bool) -> Self { + ONCHOP_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ONCHOP_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ONCHOP` writer - Chopper"] +pub struct ONCHOP_W<'a> { + w: &'a mut W, +} +impl<'a> ONCHOP_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u8 & 0x01) << 6); + self.w + } +} +#[doc = "Field `BUFTEST` reader - BUFTEST"] +pub struct BUFTEST_R(crate::FieldReader<bool, bool>); +impl BUFTEST_R { + pub(crate) fn new(bits: bool) -> Self { + BUFTEST_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for BUFTEST_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `BUFTEST` writer - BUFTEST"] +pub struct BUFTEST_W<'a> { + w: &'a mut W, +} +impl<'a> BUFTEST_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 u8 & 0x01) << 7); + self.w + } +} +impl R { + #[doc = "Bits 0:5 - SDADC Control"] + #[inline(always)] + pub fn ctrsdadc(&self) -> CTRSDADC_R { + CTRSDADC_R::new((self.bits & 0x3f) as u8) + } + #[doc = "Bit 6 - Chopper"] + #[inline(always)] + pub fn onchop(&self) -> ONCHOP_R { + ONCHOP_R::new(((self.bits >> 6) & 0x01) != 0) + } + #[doc = "Bit 7 - BUFTEST"] + #[inline(always)] + pub fn buftest(&self) -> BUFTEST_R { + BUFTEST_R::new(((self.bits >> 7) & 0x01) != 0) + } +} +impl W { + #[doc = "Bits 0:5 - SDADC Control"] + #[inline(always)] + pub fn ctrsdadc(&mut self) -> CTRSDADC_W { + CTRSDADC_W { w: self } + } + #[doc = "Bit 6 - Chopper"] + #[inline(always)] + pub fn onchop(&mut self) -> ONCHOP_W { + ONCHOP_W { w: self } + } + #[doc = "Bit 7 - BUFTEST"] + #[inline(always)] + pub fn buftest(&mut self) -> BUFTEST_W { + BUFTEST_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 = "Analog 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 [anactrl](index.html) module"] +pub struct ANACTRL_SPEC; +impl crate::RegisterSpec for ANACTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [anactrl::R](R) reader structure"] +impl crate::Readable for ANACTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [anactrl::W](W) writer structure"] +impl crate::Writable for ANACTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets ANACTRL to value 0"] +impl crate::Resettable for ANACTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/ctrla.rs b/src/sdadc/ctrla.rs new file mode 100644 index 0000000..b9f6f14 --- /dev/null +++ b/src/sdadc/ctrla.rs @@ -0,0 +1,250 @@ +#[doc = "Register `CTRLA` reader"] +pub struct R(crate::R<CTRLA_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<CTRLA_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<CTRLA_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<CTRLA_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `CTRLA` writer"] +pub struct W(crate::W<CTRLA_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<CTRLA_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<CTRLA_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<CTRLA_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `SWRST` reader - Software Reset"] +pub struct SWRST_R(crate::FieldReader<bool, bool>); +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<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SWRST` writer - Software Reset"] +pub struct SWRST_W<'a> { + w: &'a mut W, +} +impl<'a> SWRST_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !0x01) | (value as u8 & 0x01); + self.w + } +} +#[doc = "Field `ENABLE` reader - Enable"] +pub struct ENABLE_R(crate::FieldReader<bool, bool>); +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<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ENABLE` writer - Enable"] +pub struct ENABLE_W<'a> { + w: &'a mut W, +} +impl<'a> ENABLE_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u8 & 0x01) << 1); + self.w + } +} +#[doc = "Field `RUNSTDBY` reader - Run during Standby"] +pub struct RUNSTDBY_R(crate::FieldReader<bool, bool>); +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<bool, bool>; + #[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 u8 & 0x01) << 6); + self.w + } +} +#[doc = "Field `ONDEMAND` reader - On Demand Control"] +pub struct ONDEMAND_R(crate::FieldReader<bool, bool>); +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<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ONDEMAND` writer - On Demand Control"] +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 u8 & 0x01) << 7); + self.w + } +} +impl R { + #[doc = "Bit 0 - Software Reset"] + #[inline(always)] + pub fn swrst(&self) -> SWRST_R { + SWRST_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Enable"] + #[inline(always)] + pub fn enable(&self) -> ENABLE_R { + ENABLE_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 6 - Run during Standby"] + #[inline(always)] + pub fn runstdby(&self) -> RUNSTDBY_R { + RUNSTDBY_R::new(((self.bits >> 6) & 0x01) != 0) + } + #[doc = "Bit 7 - On Demand Control"] + #[inline(always)] + pub fn ondemand(&self) -> ONDEMAND_R { + ONDEMAND_R::new(((self.bits >> 7) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Software Reset"] + #[inline(always)] + pub fn swrst(&mut self) -> SWRST_W { + SWRST_W { w: self } + } + #[doc = "Bit 1 - Enable"] + #[inline(always)] + pub fn enable(&mut self) -> ENABLE_W { + ENABLE_W { w: self } + } + #[doc = "Bit 6 - Run during Standby"] + #[inline(always)] + pub fn runstdby(&mut self) -> RUNSTDBY_W { + RUNSTDBY_W { w: self } + } + #[doc = "Bit 7 - On Demand Control"] + #[inline(always)] + pub fn ondemand(&mut self) -> ONDEMAND_W { + ONDEMAND_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Control A\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ctrla](index.html) module"] +pub struct CTRLA_SPEC; +impl crate::RegisterSpec for CTRLA_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [ctrla::R](R) reader structure"] +impl crate::Readable for CTRLA_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [ctrla::W](W) writer structure"] +impl crate::Writable for CTRLA_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets CTRLA to value 0"] +impl crate::Resettable for CTRLA_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/ctrlb.rs b/src/sdadc/ctrlb.rs new file mode 100644 index 0000000..4edfe54 --- /dev/null +++ b/src/sdadc/ctrlb.rs @@ -0,0 +1,389 @@ +#[doc = "Register `CTRLB` reader"] +pub struct R(crate::R<CTRLB_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<CTRLB_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<CTRLB_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<CTRLB_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `CTRLB` writer"] +pub struct W(crate::W<CTRLB_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<CTRLB_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<CTRLB_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<CTRLB_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Prescaler Configuration\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum PRESCALER_A { + #[doc = "0: Peripheral clock divided by 2"] + DIV2 = 0, + #[doc = "1: Peripheral clock divided by 4"] + DIV4 = 1, + #[doc = "2: Peripheral clock divided by 8"] + DIV8 = 2, + #[doc = "3: Peripheral clock divided by 16"] + DIV16 = 3, + #[doc = "4: Peripheral clock divided by 32"] + DIV32 = 4, + #[doc = "5: Peripheral clock divided by 64"] + DIV64 = 5, + #[doc = "6: Peripheral clock divided by 128"] + DIV128 = 6, + #[doc = "7: Peripheral clock divided by 256"] + DIV256 = 7, +} +impl From<PRESCALER_A> for u8 { + #[inline(always)] + fn from(variant: PRESCALER_A) -> Self { + variant as _ + } +} +#[doc = "Field `PRESCALER` reader - Prescaler Configuration"] +pub struct PRESCALER_R(crate::FieldReader<u8, PRESCALER_A>); +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) -> Option<PRESCALER_A> { + match self.bits { + 0 => Some(PRESCALER_A::DIV2), + 1 => Some(PRESCALER_A::DIV4), + 2 => Some(PRESCALER_A::DIV8), + 3 => Some(PRESCALER_A::DIV16), + 4 => Some(PRESCALER_A::DIV32), + 5 => Some(PRESCALER_A::DIV64), + 6 => Some(PRESCALER_A::DIV128), + 7 => Some(PRESCALER_A::DIV256), + _ => None, + } + } + #[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 `DIV32`"] + #[inline(always)] + pub fn is_div32(&self) -> bool { + **self == PRESCALER_A::DIV32 + } + #[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 `DIV128`"] + #[inline(always)] + pub fn is_div128(&self) -> bool { + **self == PRESCALER_A::DIV128 + } + #[doc = "Checks if the value of the field is `DIV256`"] + #[inline(always)] + pub fn is_div256(&self) -> bool { + **self == PRESCALER_A::DIV256 + } +} +impl core::ops::Deref for PRESCALER_R { + type Target = crate::FieldReader<u8, PRESCALER_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PRESCALER` writer - Prescaler Configuration"] +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 { + unsafe { self.bits(variant.into()) } + } + #[doc = "Peripheral clock divided by 2"] + #[inline(always)] + pub fn div2(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV2) + } + #[doc = "Peripheral clock divided by 4"] + #[inline(always)] + pub fn div4(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV4) + } + #[doc = "Peripheral clock divided by 8"] + #[inline(always)] + pub fn div8(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV8) + } + #[doc = "Peripheral clock divided by 16"] + #[inline(always)] + pub fn div16(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV16) + } + #[doc = "Peripheral clock divided by 32"] + #[inline(always)] + pub fn div32(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV32) + } + #[doc = "Peripheral clock divided by 64"] + #[inline(always)] + pub fn div64(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV64) + } + #[doc = "Peripheral clock divided by 128"] + #[inline(always)] + pub fn div128(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV128) + } + #[doc = "Peripheral clock divided by 256"] + #[inline(always)] + pub fn div256(self) -> &'a mut W { + self.variant(PRESCALER_A::DIV256) + } + #[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 & !0xff) | (value as u16 & 0xff); + self.w + } +} +#[doc = "Over Sampling Ratio\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum OSR_A { + #[doc = "0: Over Sampling Ratio is 64"] + OSR64 = 0, + #[doc = "1: Over Sampling Ratio is 128"] + OSR128 = 1, + #[doc = "2: Over Sampling Ratio is 256"] + OSR256 = 2, + #[doc = "3: Over Sampling Ratio is 512"] + OSR512 = 3, + #[doc = "4: Over Sampling Ratio is 1024"] + OSR1024 = 4, +} +impl From<OSR_A> for u8 { + #[inline(always)] + fn from(variant: OSR_A) -> Self { + variant as _ + } +} +#[doc = "Field `OSR` reader - Over Sampling Ratio"] +pub struct OSR_R(crate::FieldReader<u8, OSR_A>); +impl OSR_R { + pub(crate) fn new(bits: u8) -> Self { + OSR_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option<OSR_A> { + match self.bits { + 0 => Some(OSR_A::OSR64), + 1 => Some(OSR_A::OSR128), + 2 => Some(OSR_A::OSR256), + 3 => Some(OSR_A::OSR512), + 4 => Some(OSR_A::OSR1024), + _ => None, + } + } + #[doc = "Checks if the value of the field is `OSR64`"] + #[inline(always)] + pub fn is_osr64(&self) -> bool { + **self == OSR_A::OSR64 + } + #[doc = "Checks if the value of the field is `OSR128`"] + #[inline(always)] + pub fn is_osr128(&self) -> bool { + **self == OSR_A::OSR128 + } + #[doc = "Checks if the value of the field is `OSR256`"] + #[inline(always)] + pub fn is_osr256(&self) -> bool { + **self == OSR_A::OSR256 + } + #[doc = "Checks if the value of the field is `OSR512`"] + #[inline(always)] + pub fn is_osr512(&self) -> bool { + **self == OSR_A::OSR512 + } + #[doc = "Checks if the value of the field is `OSR1024`"] + #[inline(always)] + pub fn is_osr1024(&self) -> bool { + **self == OSR_A::OSR1024 + } +} +impl core::ops::Deref for OSR_R { + type Target = crate::FieldReader<u8, OSR_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OSR` writer - Over Sampling Ratio"] +pub struct OSR_W<'a> { + w: &'a mut W, +} +impl<'a> OSR_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: OSR_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "Over Sampling Ratio is 64"] + #[inline(always)] + pub fn osr64(self) -> &'a mut W { + self.variant(OSR_A::OSR64) + } + #[doc = "Over Sampling Ratio is 128"] + #[inline(always)] + pub fn osr128(self) -> &'a mut W { + self.variant(OSR_A::OSR128) + } + #[doc = "Over Sampling Ratio is 256"] + #[inline(always)] + pub fn osr256(self) -> &'a mut W { + self.variant(OSR_A::OSR256) + } + #[doc = "Over Sampling Ratio is 512"] + #[inline(always)] + pub fn osr512(self) -> &'a mut W { + self.variant(OSR_A::OSR512) + } + #[doc = "Over Sampling Ratio is 1024"] + #[inline(always)] + pub fn osr1024(self) -> &'a mut W { + self.variant(OSR_A::OSR1024) + } + #[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 << 8)) | ((value as u16 & 0x07) << 8); + self.w + } +} +#[doc = "Field `SKPCNT` reader - Skip Sample Count"] +pub struct SKPCNT_R(crate::FieldReader<u8, u8>); +impl SKPCNT_R { + pub(crate) fn new(bits: u8) -> Self { + SKPCNT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SKPCNT_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SKPCNT` writer - Skip Sample Count"] +pub struct SKPCNT_W<'a> { + w: &'a mut W, +} +impl<'a> SKPCNT_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x0f << 12)) | ((value as u16 & 0x0f) << 12); + self.w + } +} +impl R { + #[doc = "Bits 0:7 - Prescaler Configuration"] + #[inline(always)] + pub fn prescaler(&self) -> PRESCALER_R { + PRESCALER_R::new((self.bits & 0xff) as u8) + } + #[doc = "Bits 8:10 - Over Sampling Ratio"] + #[inline(always)] + pub fn osr(&self) -> OSR_R { + OSR_R::new(((self.bits >> 8) & 0x07) as u8) + } + #[doc = "Bits 12:15 - Skip Sample Count"] + #[inline(always)] + pub fn skpcnt(&self) -> SKPCNT_R { + SKPCNT_R::new(((self.bits >> 12) & 0x0f) as u8) + } +} +impl W { + #[doc = "Bits 0:7 - Prescaler Configuration"] + #[inline(always)] + pub fn prescaler(&mut self) -> PRESCALER_W { + PRESCALER_W { w: self } + } + #[doc = "Bits 8:10 - Over Sampling Ratio"] + #[inline(always)] + pub fn osr(&mut self) -> OSR_W { + OSR_W { w: self } + } + #[doc = "Bits 12:15 - Skip Sample Count"] + #[inline(always)] + pub fn skpcnt(&mut self) -> SKPCNT_W { + SKPCNT_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 = "Control B\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ctrlb](index.html) module"] +pub struct CTRLB_SPEC; +impl crate::RegisterSpec for CTRLB_SPEC { + type Ux = u16; +} +#[doc = "`read()` method returns [ctrlb::R](R) reader structure"] +impl crate::Readable for CTRLB_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [ctrlb::W](W) writer structure"] +impl crate::Writable for CTRLB_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets CTRLB to value 0x2000"] +impl crate::Resettable for CTRLB_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0x2000 + } +} diff --git a/src/sdadc/ctrlc.rs b/src/sdadc/ctrlc.rs new file mode 100644 index 0000000..34e58fe --- /dev/null +++ b/src/sdadc/ctrlc.rs @@ -0,0 +1,112 @@ +#[doc = "Register `CTRLC` reader"] +pub struct R(crate::R<CTRLC_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<CTRLC_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<CTRLC_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<CTRLC_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `CTRLC` writer"] +pub struct W(crate::W<CTRLC_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<CTRLC_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<CTRLC_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<CTRLC_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `FREERUN` reader - Free Running Mode"] +pub struct FREERUN_R(crate::FieldReader<bool, bool>); +impl FREERUN_R { + pub(crate) fn new(bits: bool) -> Self { + FREERUN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for FREERUN_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `FREERUN` writer - Free Running Mode"] +pub struct FREERUN_W<'a> { + w: &'a mut W, +} +impl<'a> FREERUN_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 - Free Running Mode"] + #[inline(always)] + pub fn freerun(&self) -> FREERUN_R { + FREERUN_R::new((self.bits & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Free Running Mode"] + #[inline(always)] + pub fn freerun(&mut self) -> FREERUN_W { + FREERUN_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 [ctrlc](index.html) module"] +pub struct CTRLC_SPEC; +impl crate::RegisterSpec for CTRLC_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [ctrlc::R](R) reader structure"] +impl crate::Readable for CTRLC_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [ctrlc::W](W) writer structure"] +impl crate::Writable for CTRLC_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets CTRLC to value 0"] +impl crate::Resettable for CTRLC_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/dbgctrl.rs b/src/sdadc/dbgctrl.rs new file mode 100644 index 0000000..8befebc --- /dev/null +++ b/src/sdadc/dbgctrl.rs @@ -0,0 +1,112 @@ +#[doc = "Register `DBGCTRL` reader"] +pub struct R(crate::R<DBGCTRL_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<DBGCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<DBGCTRL_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<DBGCTRL_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `DBGCTRL` writer"] +pub struct W(crate::W<DBGCTRL_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<DBGCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<DBGCTRL_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<DBGCTRL_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `DBGRUN` reader - Debug Run"] +pub struct DBGRUN_R(crate::FieldReader<bool, bool>); +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<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `DBGRUN` writer - Debug Run"] +pub struct DBGRUN_W<'a> { + w: &'a mut W, +} +impl<'a> DBGRUN_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !0x01) | (value as u8 & 0x01); + self.w + } +} +impl R { + #[doc = "Bit 0 - Debug Run"] + #[inline(always)] + pub fn dbgrun(&self) -> DBGRUN_R { + DBGRUN_R::new((self.bits & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Debug Run"] + #[inline(always)] + pub fn dbgrun(&mut self) -> DBGRUN_W { + DBGRUN_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Debug Control\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [dbgctrl](index.html) module"] +pub struct DBGCTRL_SPEC; +impl crate::RegisterSpec for DBGCTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [dbgctrl::R](R) reader structure"] +impl crate::Readable for DBGCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [dbgctrl::W](W) writer structure"] +impl crate::Writable for DBGCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets DBGCTRL to value 0"] +impl crate::Resettable for DBGCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/evctrl.rs b/src/sdadc/evctrl.rs new file mode 100644 index 0000000..952df08 --- /dev/null +++ b/src/sdadc/evctrl.rs @@ -0,0 +1,342 @@ +#[doc = "Register `EVCTRL` reader"] +pub struct R(crate::R<EVCTRL_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<EVCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<EVCTRL_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<EVCTRL_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `EVCTRL` writer"] +pub struct W(crate::W<EVCTRL_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<EVCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<EVCTRL_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<EVCTRL_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `FLUSHEI` reader - Flush Event Input Enable"] +pub struct FLUSHEI_R(crate::FieldReader<bool, bool>); +impl FLUSHEI_R { + pub(crate) fn new(bits: bool) -> Self { + FLUSHEI_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for FLUSHEI_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `FLUSHEI` writer - Flush Event Input Enable"] +pub struct FLUSHEI_W<'a> { + w: &'a mut W, +} +impl<'a> FLUSHEI_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 `STARTEI` reader - Start Conversion Event Input Enable"] +pub struct STARTEI_R(crate::FieldReader<bool, bool>); +impl STARTEI_R { + pub(crate) fn new(bits: bool) -> Self { + STARTEI_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for STARTEI_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `STARTEI` writer - Start Conversion Event Input Enable"] +pub struct STARTEI_W<'a> { + w: &'a mut W, +} +impl<'a> STARTEI_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u8 & 0x01) << 1); + self.w + } +} +#[doc = "Field `FLUSHINV` reader - Flush Event Invert Enable"] +pub struct FLUSHINV_R(crate::FieldReader<bool, bool>); +impl FLUSHINV_R { + pub(crate) fn new(bits: bool) -> Self { + FLUSHINV_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for FLUSHINV_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `FLUSHINV` writer - Flush Event Invert Enable"] +pub struct FLUSHINV_W<'a> { + w: &'a mut W, +} +impl<'a> FLUSHINV_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u8 & 0x01) << 2); + self.w + } +} +#[doc = "Field `STARTINV` reader - Satrt Event Invert Enable"] +pub struct STARTINV_R(crate::FieldReader<bool, bool>); +impl STARTINV_R { + pub(crate) fn new(bits: bool) -> Self { + STARTINV_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for STARTINV_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `STARTINV` writer - Satrt Event Invert Enable"] +pub struct STARTINV_W<'a> { + w: &'a mut W, +} +impl<'a> STARTINV_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 `RESRDYEO` reader - Result Ready Event Out"] +pub struct RESRDYEO_R(crate::FieldReader<bool, bool>); +impl RESRDYEO_R { + pub(crate) fn new(bits: bool) -> Self { + RESRDYEO_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for RESRDYEO_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `RESRDYEO` writer - Result Ready Event Out"] +pub struct RESRDYEO_W<'a> { + w: &'a mut W, +} +impl<'a> RESRDYEO_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 `WINMONEO` reader - Window Monitor Event Out"] +pub struct WINMONEO_R(crate::FieldReader<bool, bool>); +impl WINMONEO_R { + pub(crate) fn new(bits: bool) -> Self { + WINMONEO_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINMONEO_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINMONEO` writer - Window Monitor Event Out"] +pub struct WINMONEO_W<'a> { + w: &'a mut W, +} +impl<'a> WINMONEO_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 - Flush Event Input Enable"] + #[inline(always)] + pub fn flushei(&self) -> FLUSHEI_R { + FLUSHEI_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Start Conversion Event Input Enable"] + #[inline(always)] + pub fn startei(&self) -> STARTEI_R { + STARTEI_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Flush Event Invert Enable"] + #[inline(always)] + pub fn flushinv(&self) -> FLUSHINV_R { + FLUSHINV_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - Satrt Event Invert Enable"] + #[inline(always)] + pub fn startinv(&self) -> STARTINV_R { + STARTINV_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 4 - Result Ready Event Out"] + #[inline(always)] + pub fn resrdyeo(&self) -> RESRDYEO_R { + RESRDYEO_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - Window Monitor Event Out"] + #[inline(always)] + pub fn winmoneo(&self) -> WINMONEO_R { + WINMONEO_R::new(((self.bits >> 5) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Flush Event Input Enable"] + #[inline(always)] + pub fn flushei(&mut self) -> FLUSHEI_W { + FLUSHEI_W { w: self } + } + #[doc = "Bit 1 - Start Conversion Event Input Enable"] + #[inline(always)] + pub fn startei(&mut self) -> STARTEI_W { + STARTEI_W { w: self } + } + #[doc = "Bit 2 - Flush Event Invert Enable"] + #[inline(always)] + pub fn flushinv(&mut self) -> FLUSHINV_W { + FLUSHINV_W { w: self } + } + #[doc = "Bit 3 - Satrt Event Invert Enable"] + #[inline(always)] + pub fn startinv(&mut self) -> STARTINV_W { + STARTINV_W { w: self } + } + #[doc = "Bit 4 - Result Ready Event Out"] + #[inline(always)] + pub fn resrdyeo(&mut self) -> RESRDYEO_W { + RESRDYEO_W { w: self } + } + #[doc = "Bit 5 - Window Monitor Event Out"] + #[inline(always)] + pub fn winmoneo(&mut self) -> WINMONEO_W { + WINMONEO_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Event Control\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [evctrl](index.html) module"] +pub struct EVCTRL_SPEC; +impl crate::RegisterSpec for EVCTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [evctrl::R](R) reader structure"] +impl crate::Readable for EVCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [evctrl::W](W) writer structure"] +impl crate::Writable for EVCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets EVCTRL to value 0"] +impl crate::Resettable for EVCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/gaincorr.rs b/src/sdadc/gaincorr.rs new file mode 100644 index 0000000..11a862f --- /dev/null +++ b/src/sdadc/gaincorr.rs @@ -0,0 +1,102 @@ +#[doc = "Register `GAINCORR` reader"] +pub struct R(crate::R<GAINCORR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<GAINCORR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<GAINCORR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<GAINCORR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `GAINCORR` writer"] +pub struct W(crate::W<GAINCORR_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<GAINCORR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<GAINCORR_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<GAINCORR_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `GAINCORR` reader - Gain Correction Value"] +pub struct GAINCORR_R(crate::FieldReader<u16, u16>); +impl GAINCORR_R { + pub(crate) fn new(bits: u16) -> Self { + GAINCORR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for GAINCORR_R { + type Target = crate::FieldReader<u16, u16>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `GAINCORR` writer - Gain Correction Value"] +pub struct GAINCORR_W<'a> { + w: &'a mut W, +} +impl<'a> GAINCORR_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 & !0x3fff) | (value as u16 & 0x3fff); + self.w + } +} +impl R { + #[doc = "Bits 0:13 - Gain Correction Value"] + #[inline(always)] + pub fn gaincorr(&self) -> GAINCORR_R { + GAINCORR_R::new((self.bits & 0x3fff) as u16) + } +} +impl W { + #[doc = "Bits 0:13 - Gain Correction Value"] + #[inline(always)] + pub fn gaincorr(&mut self) -> GAINCORR_W { + GAINCORR_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 = "Gain Correction\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 [gaincorr](index.html) module"] +pub struct GAINCORR_SPEC; +impl crate::RegisterSpec for GAINCORR_SPEC { + type Ux = u16; +} +#[doc = "`read()` method returns [gaincorr::R](R) reader structure"] +impl crate::Readable for GAINCORR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [gaincorr::W](W) writer structure"] +impl crate::Writable for GAINCORR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets GAINCORR to value 0x01"] +impl crate::Resettable for GAINCORR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0x01 + } +} diff --git a/src/sdadc/inputctrl.rs b/src/sdadc/inputctrl.rs new file mode 100644 index 0000000..6173a77 --- /dev/null +++ b/src/sdadc/inputctrl.rs @@ -0,0 +1,164 @@ +#[doc = "Register `INPUTCTRL` reader"] +pub struct R(crate::R<INPUTCTRL_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<INPUTCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<INPUTCTRL_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<INPUTCTRL_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `INPUTCTRL` writer"] +pub struct W(crate::W<INPUTCTRL_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<INPUTCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<INPUTCTRL_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<INPUTCTRL_SPEC>) -> Self { + W(writer) + } +} +#[doc = "SDADC Input Selection\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum MUXSEL_A { + #[doc = "0: SDADC AIN0 Pin"] + AIN0 = 0, + #[doc = "1: SDADC AIN1 Pin"] + AIN1 = 1, + #[doc = "2: SDADC AIN2 Pin"] + AIN2 = 2, +} +impl From<MUXSEL_A> for u8 { + #[inline(always)] + fn from(variant: MUXSEL_A) -> Self { + variant as _ + } +} +#[doc = "Field `MUXSEL` reader - SDADC Input Selection"] +pub struct MUXSEL_R(crate::FieldReader<u8, MUXSEL_A>); +impl MUXSEL_R { + pub(crate) fn new(bits: u8) -> Self { + MUXSEL_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option<MUXSEL_A> { + match self.bits { + 0 => Some(MUXSEL_A::AIN0), + 1 => Some(MUXSEL_A::AIN1), + 2 => Some(MUXSEL_A::AIN2), + _ => None, + } + } + #[doc = "Checks if the value of the field is `AIN0`"] + #[inline(always)] + pub fn is_ain0(&self) -> bool { + **self == MUXSEL_A::AIN0 + } + #[doc = "Checks if the value of the field is `AIN1`"] + #[inline(always)] + pub fn is_ain1(&self) -> bool { + **self == MUXSEL_A::AIN1 + } + #[doc = "Checks if the value of the field is `AIN2`"] + #[inline(always)] + pub fn is_ain2(&self) -> bool { + **self == MUXSEL_A::AIN2 + } +} +impl core::ops::Deref for MUXSEL_R { + type Target = crate::FieldReader<u8, MUXSEL_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MUXSEL` writer - SDADC Input Selection"] +pub struct MUXSEL_W<'a> { + w: &'a mut W, +} +impl<'a> MUXSEL_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: MUXSEL_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "SDADC AIN0 Pin"] + #[inline(always)] + pub fn ain0(self) -> &'a mut W { + self.variant(MUXSEL_A::AIN0) + } + #[doc = "SDADC AIN1 Pin"] + #[inline(always)] + pub fn ain1(self) -> &'a mut W { + self.variant(MUXSEL_A::AIN1) + } + #[doc = "SDADC AIN2 Pin"] + #[inline(always)] + pub fn ain2(self) -> &'a mut W { + self.variant(MUXSEL_A::AIN2) + } + #[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 & !0x0f) | (value as u8 & 0x0f); + self.w + } +} +impl R { + #[doc = "Bits 0:3 - SDADC Input Selection"] + #[inline(always)] + pub fn muxsel(&self) -> MUXSEL_R { + MUXSEL_R::new((self.bits & 0x0f) as u8) + } +} +impl W { + #[doc = "Bits 0:3 - SDADC Input Selection"] + #[inline(always)] + pub fn muxsel(&mut self) -> MUXSEL_W { + MUXSEL_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 = "Input 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 [inputctrl](index.html) module"] +pub struct INPUTCTRL_SPEC; +impl crate::RegisterSpec for INPUTCTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [inputctrl::R](R) reader structure"] +impl crate::Readable for INPUTCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [inputctrl::W](W) writer structure"] +impl crate::Writable for INPUTCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets INPUTCTRL to value 0"] +impl crate::Resettable for INPUTCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/intenclr.rs b/src/sdadc/intenclr.rs new file mode 100644 index 0000000..382d37e --- /dev/null +++ b/src/sdadc/intenclr.rs @@ -0,0 +1,204 @@ +#[doc = "Register `INTENCLR` reader"] +pub struct R(crate::R<INTENCLR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<INTENCLR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<INTENCLR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<INTENCLR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `INTENCLR` writer"] +pub struct W(crate::W<INTENCLR_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<INTENCLR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<INTENCLR_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<INTENCLR_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `RESRDY` reader - Result Ready Interrupt Disable"] +pub struct RESRDY_R(crate::FieldReader<bool, bool>); +impl RESRDY_R { + pub(crate) fn new(bits: bool) -> Self { + RESRDY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for RESRDY_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `RESRDY` writer - Result Ready Interrupt Disable"] +pub struct RESRDY_W<'a> { + w: &'a mut W, +} +impl<'a> RESRDY_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 `OVERRUN` reader - Overrun Interrupt Disable"] +pub struct OVERRUN_R(crate::FieldReader<bool, bool>); +impl OVERRUN_R { + pub(crate) fn new(bits: bool) -> Self { + OVERRUN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for OVERRUN_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OVERRUN` writer - Overrun Interrupt Disable"] +pub struct OVERRUN_W<'a> { + w: &'a mut W, +} +impl<'a> OVERRUN_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 `WINMON` reader - Window Monitor Interrupt Disable"] +pub struct WINMON_R(crate::FieldReader<bool, bool>); +impl WINMON_R { + pub(crate) fn new(bits: bool) -> Self { + WINMON_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINMON_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINMON` writer - Window Monitor Interrupt Disable"] +pub struct WINMON_W<'a> { + w: &'a mut W, +} +impl<'a> WINMON_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u8 & 0x01) << 2); + self.w + } +} +impl R { + #[doc = "Bit 0 - Result Ready Interrupt Disable"] + #[inline(always)] + pub fn resrdy(&self) -> RESRDY_R { + RESRDY_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Overrun Interrupt Disable"] + #[inline(always)] + pub fn overrun(&self) -> OVERRUN_R { + OVERRUN_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Window Monitor Interrupt Disable"] + #[inline(always)] + pub fn winmon(&self) -> WINMON_R { + WINMON_R::new(((self.bits >> 2) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Result Ready Interrupt Disable"] + #[inline(always)] + pub fn resrdy(&mut self) -> RESRDY_W { + RESRDY_W { w: self } + } + #[doc = "Bit 1 - Overrun Interrupt Disable"] + #[inline(always)] + pub fn overrun(&mut self) -> OVERRUN_W { + OVERRUN_W { w: self } + } + #[doc = "Bit 2 - Window Monitor Interrupt Disable"] + #[inline(always)] + pub fn winmon(&mut self) -> WINMON_W { + WINMON_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/sdadc/intenset.rs b/src/sdadc/intenset.rs new file mode 100644 index 0000000..89e77ef --- /dev/null +++ b/src/sdadc/intenset.rs @@ -0,0 +1,204 @@ +#[doc = "Register `INTENSET` reader"] +pub struct R(crate::R<INTENSET_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<INTENSET_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<INTENSET_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<INTENSET_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `INTENSET` writer"] +pub struct W(crate::W<INTENSET_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<INTENSET_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<INTENSET_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<INTENSET_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `RESRDY` reader - Result Ready Interrupt Enable"] +pub struct RESRDY_R(crate::FieldReader<bool, bool>); +impl RESRDY_R { + pub(crate) fn new(bits: bool) -> Self { + RESRDY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for RESRDY_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `RESRDY` writer - Result Ready Interrupt Enable"] +pub struct RESRDY_W<'a> { + w: &'a mut W, +} +impl<'a> RESRDY_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 `OVERRUN` reader - Overrun Interrupt Enable"] +pub struct OVERRUN_R(crate::FieldReader<bool, bool>); +impl OVERRUN_R { + pub(crate) fn new(bits: bool) -> Self { + OVERRUN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for OVERRUN_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OVERRUN` writer - Overrun Interrupt Enable"] +pub struct OVERRUN_W<'a> { + w: &'a mut W, +} +impl<'a> OVERRUN_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 `WINMON` reader - Window Monitor Interrupt Enable"] +pub struct WINMON_R(crate::FieldReader<bool, bool>); +impl WINMON_R { + pub(crate) fn new(bits: bool) -> Self { + WINMON_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINMON_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINMON` writer - Window Monitor Interrupt Enable"] +pub struct WINMON_W<'a> { + w: &'a mut W, +} +impl<'a> WINMON_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u8 & 0x01) << 2); + self.w + } +} +impl R { + #[doc = "Bit 0 - Result Ready Interrupt Enable"] + #[inline(always)] + pub fn resrdy(&self) -> RESRDY_R { + RESRDY_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Overrun Interrupt Enable"] + #[inline(always)] + pub fn overrun(&self) -> OVERRUN_R { + OVERRUN_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Window Monitor Interrupt Enable"] + #[inline(always)] + pub fn winmon(&self) -> WINMON_R { + WINMON_R::new(((self.bits >> 2) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Result Ready Interrupt Enable"] + #[inline(always)] + pub fn resrdy(&mut self) -> RESRDY_W { + RESRDY_W { w: self } + } + #[doc = "Bit 1 - Overrun Interrupt Enable"] + #[inline(always)] + pub fn overrun(&mut self) -> OVERRUN_W { + OVERRUN_W { w: self } + } + #[doc = "Bit 2 - Window Monitor Interrupt Enable"] + #[inline(always)] + pub fn winmon(&mut self) -> WINMON_W { + WINMON_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/sdadc/intflag.rs b/src/sdadc/intflag.rs new file mode 100644 index 0000000..153b81f --- /dev/null +++ b/src/sdadc/intflag.rs @@ -0,0 +1,204 @@ +#[doc = "Register `INTFLAG` reader"] +pub struct R(crate::R<INTFLAG_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<INTFLAG_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<INTFLAG_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<INTFLAG_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `INTFLAG` writer"] +pub struct W(crate::W<INTFLAG_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<INTFLAG_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<INTFLAG_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<INTFLAG_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `RESRDY` reader - Result Ready Interrupt Flag"] +pub struct RESRDY_R(crate::FieldReader<bool, bool>); +impl RESRDY_R { + pub(crate) fn new(bits: bool) -> Self { + RESRDY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for RESRDY_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `RESRDY` writer - Result Ready Interrupt Flag"] +pub struct RESRDY_W<'a> { + w: &'a mut W, +} +impl<'a> RESRDY_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 `OVERRUN` reader - Overrun Interrupt Flag"] +pub struct OVERRUN_R(crate::FieldReader<bool, bool>); +impl OVERRUN_R { + pub(crate) fn new(bits: bool) -> Self { + OVERRUN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for OVERRUN_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OVERRUN` writer - Overrun Interrupt Flag"] +pub struct OVERRUN_W<'a> { + w: &'a mut W, +} +impl<'a> OVERRUN_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 `WINMON` reader - Window Monitor Interrupt Flag"] +pub struct WINMON_R(crate::FieldReader<bool, bool>); +impl WINMON_R { + pub(crate) fn new(bits: bool) -> Self { + WINMON_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINMON_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINMON` writer - Window Monitor Interrupt Flag"] +pub struct WINMON_W<'a> { + w: &'a mut W, +} +impl<'a> WINMON_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u8 & 0x01) << 2); + self.w + } +} +impl R { + #[doc = "Bit 0 - Result Ready Interrupt Flag"] + #[inline(always)] + pub fn resrdy(&self) -> RESRDY_R { + RESRDY_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Overrun Interrupt Flag"] + #[inline(always)] + pub fn overrun(&self) -> OVERRUN_R { + OVERRUN_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Window Monitor Interrupt Flag"] + #[inline(always)] + pub fn winmon(&self) -> WINMON_R { + WINMON_R::new(((self.bits >> 2) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Result Ready Interrupt Flag"] + #[inline(always)] + pub fn resrdy(&mut self) -> RESRDY_W { + RESRDY_W { w: self } + } + #[doc = "Bit 1 - Overrun Interrupt Flag"] + #[inline(always)] + pub fn overrun(&mut self) -> OVERRUN_W { + OVERRUN_W { w: self } + } + #[doc = "Bit 2 - Window Monitor Interrupt Flag"] + #[inline(always)] + pub fn winmon(&mut self) -> WINMON_W { + WINMON_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/sdadc/offsetcorr.rs b/src/sdadc/offsetcorr.rs new file mode 100644 index 0000000..6355784 --- /dev/null +++ b/src/sdadc/offsetcorr.rs @@ -0,0 +1,102 @@ +#[doc = "Register `OFFSETCORR` reader"] +pub struct R(crate::R<OFFSETCORR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<OFFSETCORR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<OFFSETCORR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<OFFSETCORR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `OFFSETCORR` writer"] +pub struct W(crate::W<OFFSETCORR_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<OFFSETCORR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<OFFSETCORR_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<OFFSETCORR_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `OFFSETCORR` reader - Offset Correction Value"] +pub struct OFFSETCORR_R(crate::FieldReader<u32, u32>); +impl OFFSETCORR_R { + pub(crate) fn new(bits: u32) -> Self { + OFFSETCORR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for OFFSETCORR_R { + type Target = crate::FieldReader<u32, u32>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OFFSETCORR` writer - Offset Correction Value"] +pub struct OFFSETCORR_W<'a> { + w: &'a mut W, +} +impl<'a> OFFSETCORR_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u32) -> &'a mut W { + self.w.bits = (self.w.bits & !0x00ff_ffff) | (value as u32 & 0x00ff_ffff); + self.w + } +} +impl R { + #[doc = "Bits 0:23 - Offset Correction Value"] + #[inline(always)] + pub fn offsetcorr(&self) -> OFFSETCORR_R { + OFFSETCORR_R::new((self.bits & 0x00ff_ffff) as u32) + } +} +impl W { + #[doc = "Bits 0:23 - Offset Correction Value"] + #[inline(always)] + pub fn offsetcorr(&mut self) -> OFFSETCORR_W { + OFFSETCORR_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 = "Offset Correction\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 [offsetcorr](index.html) module"] +pub struct OFFSETCORR_SPEC; +impl crate::RegisterSpec for OFFSETCORR_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [offsetcorr::R](R) reader structure"] +impl crate::Readable for OFFSETCORR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [offsetcorr::W](W) writer structure"] +impl crate::Writable for OFFSETCORR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets OFFSETCORR to value 0"] +impl crate::Resettable for OFFSETCORR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/refctrl.rs b/src/sdadc/refctrl.rs new file mode 100644 index 0000000..b2bacad --- /dev/null +++ b/src/sdadc/refctrl.rs @@ -0,0 +1,259 @@ +#[doc = "Register `REFCTRL` reader"] +pub struct R(crate::R<REFCTRL_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<REFCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<REFCTRL_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<REFCTRL_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `REFCTRL` writer"] +pub struct W(crate::W<REFCTRL_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<REFCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<REFCTRL_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<REFCTRL_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Reference Selection\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum REFSEL_A { + #[doc = "0: Internal Bandgap Reference"] + INTREF = 0, + #[doc = "1: External Reference"] + AREFB = 1, + #[doc = "2: Internal DAC Output"] + DAC = 2, + #[doc = "3: VDDANA"] + INTVCC = 3, +} +impl From<REFSEL_A> for u8 { + #[inline(always)] + fn from(variant: REFSEL_A) -> Self { + variant as _ + } +} +#[doc = "Field `REFSEL` reader - Reference Selection"] +pub struct REFSEL_R(crate::FieldReader<u8, REFSEL_A>); +impl REFSEL_R { + pub(crate) fn new(bits: u8) -> Self { + REFSEL_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> REFSEL_A { + match self.bits { + 0 => REFSEL_A::INTREF, + 1 => REFSEL_A::AREFB, + 2 => REFSEL_A::DAC, + 3 => REFSEL_A::INTVCC, + _ => unreachable!(), + } + } + #[doc = "Checks if the value of the field is `INTREF`"] + #[inline(always)] + pub fn is_intref(&self) -> bool { + **self == REFSEL_A::INTREF + } + #[doc = "Checks if the value of the field is `AREFB`"] + #[inline(always)] + pub fn is_arefb(&self) -> bool { + **self == REFSEL_A::AREFB + } + #[doc = "Checks if the value of the field is `DAC`"] + #[inline(always)] + pub fn is_dac(&self) -> bool { + **self == REFSEL_A::DAC + } + #[doc = "Checks if the value of the field is `INTVCC`"] + #[inline(always)] + pub fn is_intvcc(&self) -> bool { + **self == REFSEL_A::INTVCC + } +} +impl core::ops::Deref for REFSEL_R { + type Target = crate::FieldReader<u8, REFSEL_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `REFSEL` writer - Reference Selection"] +pub struct REFSEL_W<'a> { + w: &'a mut W, +} +impl<'a> REFSEL_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: REFSEL_A) -> &'a mut W { + self.bits(variant.into()) + } + #[doc = "Internal Bandgap Reference"] + #[inline(always)] + pub fn intref(self) -> &'a mut W { + self.variant(REFSEL_A::INTREF) + } + #[doc = "External Reference"] + #[inline(always)] + pub fn arefb(self) -> &'a mut W { + self.variant(REFSEL_A::AREFB) + } + #[doc = "Internal DAC Output"] + #[inline(always)] + pub fn dac(self) -> &'a mut W { + self.variant(REFSEL_A::DAC) + } + #[doc = "VDDANA"] + #[inline(always)] + pub fn intvcc(self) -> &'a mut W { + self.variant(REFSEL_A::INTVCC) + } + #[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 + } +} +#[doc = "Field `REFRANGE` reader - Reference Range"] +pub struct REFRANGE_R(crate::FieldReader<u8, u8>); +impl REFRANGE_R { + pub(crate) fn new(bits: u8) -> Self { + REFRANGE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for REFRANGE_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `REFRANGE` writer - Reference Range"] +pub struct REFRANGE_W<'a> { + w: &'a mut W, +} +impl<'a> REFRANGE_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x03 << 4)) | ((value as u8 & 0x03) << 4); + self.w + } +} +#[doc = "Field `ONREFBUF` reader - Reference Buffer"] +pub struct ONREFBUF_R(crate::FieldReader<bool, bool>); +impl ONREFBUF_R { + pub(crate) fn new(bits: bool) -> Self { + ONREFBUF_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ONREFBUF_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ONREFBUF` writer - Reference Buffer"] +pub struct ONREFBUF_W<'a> { + w: &'a mut W, +} +impl<'a> ONREFBUF_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 u8 & 0x01) << 7); + self.w + } +} +impl R { + #[doc = "Bits 0:1 - Reference Selection"] + #[inline(always)] + pub fn refsel(&self) -> REFSEL_R { + REFSEL_R::new((self.bits & 0x03) as u8) + } + #[doc = "Bits 4:5 - Reference Range"] + #[inline(always)] + pub fn refrange(&self) -> REFRANGE_R { + REFRANGE_R::new(((self.bits >> 4) & 0x03) as u8) + } + #[doc = "Bit 7 - Reference Buffer"] + #[inline(always)] + pub fn onrefbuf(&self) -> ONREFBUF_R { + ONREFBUF_R::new(((self.bits >> 7) & 0x01) != 0) + } +} +impl W { + #[doc = "Bits 0:1 - Reference Selection"] + #[inline(always)] + pub fn refsel(&mut self) -> REFSEL_W { + REFSEL_W { w: self } + } + #[doc = "Bits 4:5 - Reference Range"] + #[inline(always)] + pub fn refrange(&mut self) -> REFRANGE_W { + REFRANGE_W { w: self } + } + #[doc = "Bit 7 - Reference Buffer"] + #[inline(always)] + pub fn onrefbuf(&mut self) -> ONREFBUF_W { + ONREFBUF_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 = "Reference 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 [refctrl](index.html) module"] +pub struct REFCTRL_SPEC; +impl crate::RegisterSpec for REFCTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [refctrl::R](R) reader structure"] +impl crate::Readable for REFCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [refctrl::W](W) writer structure"] +impl crate::Writable for REFCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets REFCTRL to value 0"] +impl crate::Resettable for REFCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/result.rs b/src/sdadc/result.rs new file mode 100644 index 0000000..adcac8e --- /dev/null +++ b/src/sdadc/result.rs @@ -0,0 +1,52 @@ +#[doc = "Register `RESULT` reader"] +pub struct R(crate::R<RESULT_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<RESULT_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<RESULT_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<RESULT_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Field `RESULT` reader - Result Value"] +pub struct RESULT_R(crate::FieldReader<u32, u32>); +impl RESULT_R { + pub(crate) fn new(bits: u32) -> Self { + RESULT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for RESULT_R { + type Target = crate::FieldReader<u32, u32>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bits 0:23 - Result Value"] + #[inline(always)] + pub fn result(&self) -> RESULT_R { + RESULT_R::new((self.bits & 0x00ff_ffff) as u32) + } +} +#[doc = "Result\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 [result](index.html) module"] +pub struct RESULT_SPEC; +impl crate::RegisterSpec for RESULT_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [result::R](R) reader structure"] +impl crate::Readable for RESULT_SPEC { + type Reader = R; +} +#[doc = "`reset()` method sets RESULT to value 0"] +impl crate::Resettable for RESULT_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/seqctrl.rs b/src/sdadc/seqctrl.rs new file mode 100644 index 0000000..0f169fe --- /dev/null +++ b/src/sdadc/seqctrl.rs @@ -0,0 +1,102 @@ +#[doc = "Register `SEQCTRL` reader"] +pub struct R(crate::R<SEQCTRL_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<SEQCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<SEQCTRL_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<SEQCTRL_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `SEQCTRL` writer"] +pub struct W(crate::W<SEQCTRL_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<SEQCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<SEQCTRL_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<SEQCTRL_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `SEQEN` reader - Enable Positive Input in the Sequence"] +pub struct SEQEN_R(crate::FieldReader<u8, u8>); +impl SEQEN_R { + pub(crate) fn new(bits: u8) -> Self { + SEQEN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SEQEN_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SEQEN` writer - Enable Positive Input in the Sequence"] +pub struct SEQEN_W<'a> { + w: &'a mut W, +} +impl<'a> SEQEN_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !0x07) | (value as u8 & 0x07); + self.w + } +} +impl R { + #[doc = "Bits 0:2 - Enable Positive Input in the Sequence"] + #[inline(always)] + pub fn seqen(&self) -> SEQEN_R { + SEQEN_R::new((self.bits & 0x07) as u8) + } +} +impl W { + #[doc = "Bits 0:2 - Enable Positive Input in the Sequence"] + #[inline(always)] + pub fn seqen(&mut self) -> SEQEN_W { + SEQEN_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 = "Sequence 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 [seqctrl](index.html) module"] +pub struct SEQCTRL_SPEC; +impl crate::RegisterSpec for SEQCTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [seqctrl::R](R) reader structure"] +impl crate::Readable for SEQCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [seqctrl::W](W) writer structure"] +impl crate::Writable for SEQCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets SEQCTRL to value 0"] +impl crate::Resettable for SEQCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/seqstatus.rs b/src/sdadc/seqstatus.rs new file mode 100644 index 0000000..cac0d7f --- /dev/null +++ b/src/sdadc/seqstatus.rs @@ -0,0 +1,71 @@ +#[doc = "Register `SEQSTATUS` reader"] +pub struct R(crate::R<SEQSTATUS_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<SEQSTATUS_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<SEQSTATUS_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<SEQSTATUS_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Field `SEQSTATE` reader - Sequence State"] +pub struct SEQSTATE_R(crate::FieldReader<u8, u8>); +impl SEQSTATE_R { + pub(crate) fn new(bits: u8) -> Self { + SEQSTATE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SEQSTATE_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SEQBUSY` reader - Sequence Busy"] +pub struct SEQBUSY_R(crate::FieldReader<bool, bool>); +impl SEQBUSY_R { + pub(crate) fn new(bits: bool) -> Self { + SEQBUSY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SEQBUSY_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bits 0:3 - Sequence State"] + #[inline(always)] + pub fn seqstate(&self) -> SEQSTATE_R { + SEQSTATE_R::new((self.bits & 0x0f) as u8) + } + #[doc = "Bit 7 - Sequence Busy"] + #[inline(always)] + pub fn seqbusy(&self) -> SEQBUSY_R { + SEQBUSY_R::new(((self.bits >> 7) & 0x01) != 0) + } +} +#[doc = "Sequence 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 [seqstatus](index.html) module"] +pub struct SEQSTATUS_SPEC; +impl crate::RegisterSpec for SEQSTATUS_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [seqstatus::R](R) reader structure"] +impl crate::Readable for SEQSTATUS_SPEC { + type Reader = R; +} +#[doc = "`reset()` method sets SEQSTATUS to value 0"] +impl crate::Resettable for SEQSTATUS_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/shiftcorr.rs b/src/sdadc/shiftcorr.rs new file mode 100644 index 0000000..0553845 --- /dev/null +++ b/src/sdadc/shiftcorr.rs @@ -0,0 +1,102 @@ +#[doc = "Register `SHIFTCORR` reader"] +pub struct R(crate::R<SHIFTCORR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<SHIFTCORR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<SHIFTCORR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<SHIFTCORR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `SHIFTCORR` writer"] +pub struct W(crate::W<SHIFTCORR_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<SHIFTCORR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<SHIFTCORR_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<SHIFTCORR_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `SHIFTCORR` reader - Shift Correction Value"] +pub struct SHIFTCORR_R(crate::FieldReader<u8, u8>); +impl SHIFTCORR_R { + pub(crate) fn new(bits: u8) -> Self { + SHIFTCORR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SHIFTCORR_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SHIFTCORR` writer - Shift Correction Value"] +pub struct SHIFTCORR_W<'a> { + w: &'a mut W, +} +impl<'a> SHIFTCORR_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !0x0f) | (value as u8 & 0x0f); + self.w + } +} +impl R { + #[doc = "Bits 0:3 - Shift Correction Value"] + #[inline(always)] + pub fn shiftcorr(&self) -> SHIFTCORR_R { + SHIFTCORR_R::new((self.bits & 0x0f) as u8) + } +} +impl W { + #[doc = "Bits 0:3 - Shift Correction Value"] + #[inline(always)] + pub fn shiftcorr(&mut self) -> SHIFTCORR_W { + SHIFTCORR_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 = "Shift Correction\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 [shiftcorr](index.html) module"] +pub struct SHIFTCORR_SPEC; +impl crate::RegisterSpec for SHIFTCORR_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [shiftcorr::R](R) reader structure"] +impl crate::Readable for SHIFTCORR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [shiftcorr::W](W) writer structure"] +impl crate::Writable for SHIFTCORR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets SHIFTCORR to value 0"] +impl crate::Resettable for SHIFTCORR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/swtrig.rs b/src/sdadc/swtrig.rs new file mode 100644 index 0000000..9397b1c --- /dev/null +++ b/src/sdadc/swtrig.rs @@ -0,0 +1,158 @@ +#[doc = "Register `SWTRIG` reader"] +pub struct R(crate::R<SWTRIG_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<SWTRIG_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<SWTRIG_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<SWTRIG_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `SWTRIG` writer"] +pub struct W(crate::W<SWTRIG_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<SWTRIG_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<SWTRIG_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<SWTRIG_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `FLUSH` reader - SDADC Flush"] +pub struct FLUSH_R(crate::FieldReader<bool, bool>); +impl FLUSH_R { + pub(crate) fn new(bits: bool) -> Self { + FLUSH_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for FLUSH_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `FLUSH` writer - SDADC Flush"] +pub struct FLUSH_W<'a> { + w: &'a mut W, +} +impl<'a> FLUSH_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 `START` reader - Start SDADC Conversion"] +pub struct START_R(crate::FieldReader<bool, bool>); +impl START_R { + pub(crate) fn new(bits: bool) -> Self { + START_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for START_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `START` writer - Start SDADC Conversion"] +pub struct START_W<'a> { + w: &'a mut W, +} +impl<'a> START_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 - SDADC Flush"] + #[inline(always)] + pub fn flush(&self) -> FLUSH_R { + FLUSH_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Start SDADC Conversion"] + #[inline(always)] + pub fn start(&self) -> START_R { + START_R::new(((self.bits >> 1) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - SDADC Flush"] + #[inline(always)] + pub fn flush(&mut self) -> FLUSH_W { + FLUSH_W { w: self } + } + #[doc = "Bit 1 - Start SDADC Conversion"] + #[inline(always)] + pub fn start(&mut self) -> START_W { + START_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 = "Software Trigger\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 [swtrig](index.html) module"] +pub struct SWTRIG_SPEC; +impl crate::RegisterSpec for SWTRIG_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [swtrig::R](R) reader structure"] +impl crate::Readable for SWTRIG_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [swtrig::W](W) writer structure"] +impl crate::Writable for SWTRIG_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets SWTRIG to value 0"] +impl crate::Resettable for SWTRIG_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/syncbusy.rs b/src/sdadc/syncbusy.rs new file mode 100644 index 0000000..c743aa3 --- /dev/null +++ b/src/sdadc/syncbusy.rs @@ -0,0 +1,261 @@ +#[doc = "Register `SYNCBUSY` reader"] +pub struct R(crate::R<SYNCBUSY_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<SYNCBUSY_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<SYNCBUSY_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<SYNCBUSY_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Field `SWRST` reader - SWRST Synchronization Busy"] +pub struct SWRST_R(crate::FieldReader<bool, bool>); +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<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ENABLE` reader - ENABLE Synchronization Busy"] +pub struct ENABLE_R(crate::FieldReader<bool, bool>); +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<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `CTRLC` reader - CTRLC Synchronization Busy"] +pub struct CTRLC_R(crate::FieldReader<bool, bool>); +impl CTRLC_R { + pub(crate) fn new(bits: bool) -> Self { + CTRLC_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for CTRLC_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `INPUTCTRL` reader - INPUTCTRL Synchronization Busy"] +pub struct INPUTCTRL_R(crate::FieldReader<bool, bool>); +impl INPUTCTRL_R { + pub(crate) fn new(bits: bool) -> Self { + INPUTCTRL_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for INPUTCTRL_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINCTRL` reader - WINCTRL Synchronization Busy"] +pub struct WINCTRL_R(crate::FieldReader<bool, bool>); +impl WINCTRL_R { + pub(crate) fn new(bits: bool) -> Self { + WINCTRL_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINCTRL_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINLT` reader - WINLT Synchronization Busy"] +pub struct WINLT_R(crate::FieldReader<bool, bool>); +impl WINLT_R { + pub(crate) fn new(bits: bool) -> Self { + WINLT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINLT_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINUT` reader - WINUT Synchronization Busy"] +pub struct WINUT_R(crate::FieldReader<bool, bool>); +impl WINUT_R { + pub(crate) fn new(bits: bool) -> Self { + WINUT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINUT_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OFFSETCORR` reader - OFFSETCTRL Synchronization Busy"] +pub struct OFFSETCORR_R(crate::FieldReader<bool, bool>); +impl OFFSETCORR_R { + pub(crate) fn new(bits: bool) -> Self { + OFFSETCORR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for OFFSETCORR_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `GAINCORR` reader - GAINCORR Synchronization Busy"] +pub struct GAINCORR_R(crate::FieldReader<bool, bool>); +impl GAINCORR_R { + pub(crate) fn new(bits: bool) -> Self { + GAINCORR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for GAINCORR_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SHIFTCORR` reader - SHIFTCORR Synchronization Busy"] +pub struct SHIFTCORR_R(crate::FieldReader<bool, bool>); +impl SHIFTCORR_R { + pub(crate) fn new(bits: bool) -> Self { + SHIFTCORR_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SHIFTCORR_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SWTRIG` reader - SWTRG Synchronization Busy"] +pub struct SWTRIG_R(crate::FieldReader<bool, bool>); +impl SWTRIG_R { + pub(crate) fn new(bits: bool) -> Self { + SWTRIG_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SWTRIG_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ANACTRL` reader - ANACTRL Synchronization Busy"] +pub struct ANACTRL_R(crate::FieldReader<bool, bool>); +impl ANACTRL_R { + pub(crate) fn new(bits: bool) -> Self { + ANACTRL_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ANACTRL_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bit 0 - SWRST Synchronization Busy"] + #[inline(always)] + pub fn swrst(&self) -> SWRST_R { + SWRST_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - ENABLE Synchronization Busy"] + #[inline(always)] + pub fn enable(&self) -> ENABLE_R { + ENABLE_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - CTRLC Synchronization Busy"] + #[inline(always)] + pub fn ctrlc(&self) -> CTRLC_R { + CTRLC_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - INPUTCTRL Synchronization Busy"] + #[inline(always)] + pub fn inputctrl(&self) -> INPUTCTRL_R { + INPUTCTRL_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 4 - WINCTRL Synchronization Busy"] + #[inline(always)] + pub fn winctrl(&self) -> WINCTRL_R { + WINCTRL_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - WINLT Synchronization Busy"] + #[inline(always)] + pub fn winlt(&self) -> WINLT_R { + WINLT_R::new(((self.bits >> 5) & 0x01) != 0) + } + #[doc = "Bit 6 - WINUT Synchronization Busy"] + #[inline(always)] + pub fn winut(&self) -> WINUT_R { + WINUT_R::new(((self.bits >> 6) & 0x01) != 0) + } + #[doc = "Bit 7 - OFFSETCTRL Synchronization Busy"] + #[inline(always)] + pub fn offsetcorr(&self) -> OFFSETCORR_R { + OFFSETCORR_R::new(((self.bits >> 7) & 0x01) != 0) + } + #[doc = "Bit 8 - GAINCORR Synchronization Busy"] + #[inline(always)] + pub fn gaincorr(&self) -> GAINCORR_R { + GAINCORR_R::new(((self.bits >> 8) & 0x01) != 0) + } + #[doc = "Bit 9 - SHIFTCORR Synchronization Busy"] + #[inline(always)] + pub fn shiftcorr(&self) -> SHIFTCORR_R { + SHIFTCORR_R::new(((self.bits >> 9) & 0x01) != 0) + } + #[doc = "Bit 10 - SWTRG Synchronization Busy"] + #[inline(always)] + pub fn swtrig(&self) -> SWTRIG_R { + SWTRIG_R::new(((self.bits >> 10) & 0x01) != 0) + } + #[doc = "Bit 11 - ANACTRL Synchronization Busy"] + #[inline(always)] + pub fn anactrl(&self) -> ANACTRL_R { + ANACTRL_R::new(((self.bits >> 11) & 0x01) != 0) + } +} +#[doc = "Synchronization Busy\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [syncbusy](index.html) module"] +pub struct SYNCBUSY_SPEC; +impl crate::RegisterSpec for SYNCBUSY_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [syncbusy::R](R) reader structure"] +impl crate::Readable for SYNCBUSY_SPEC { + type Reader = R; +} +#[doc = "`reset()` method sets SYNCBUSY to value 0"] +impl crate::Resettable for SYNCBUSY_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/winctrl.rs b/src/sdadc/winctrl.rs new file mode 100644 index 0000000..64a0b2f --- /dev/null +++ b/src/sdadc/winctrl.rs @@ -0,0 +1,102 @@ +#[doc = "Register `WINCTRL` reader"] +pub struct R(crate::R<WINCTRL_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<WINCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<WINCTRL_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<WINCTRL_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `WINCTRL` writer"] +pub struct W(crate::W<WINCTRL_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<WINCTRL_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<WINCTRL_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<WINCTRL_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `WINMODE` reader - Window Monitor Mode"] +pub struct WINMODE_R(crate::FieldReader<u8, u8>); +impl WINMODE_R { + pub(crate) fn new(bits: u8) -> Self { + WINMODE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINMODE_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINMODE` writer - Window Monitor Mode"] +pub struct WINMODE_W<'a> { + w: &'a mut W, +} +impl<'a> WINMODE_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !0x07) | (value as u8 & 0x07); + self.w + } +} +impl R { + #[doc = "Bits 0:2 - Window Monitor Mode"] + #[inline(always)] + pub fn winmode(&self) -> WINMODE_R { + WINMODE_R::new((self.bits & 0x07) as u8) + } +} +impl W { + #[doc = "Bits 0:2 - Window Monitor Mode"] + #[inline(always)] + pub fn winmode(&mut self) -> WINMODE_W { + WINMODE_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 = "Window Monitor 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 [winctrl](index.html) module"] +pub struct WINCTRL_SPEC; +impl crate::RegisterSpec for WINCTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [winctrl::R](R) reader structure"] +impl crate::Readable for WINCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [winctrl::W](W) writer structure"] +impl crate::Writable for WINCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets WINCTRL to value 0"] +impl crate::Resettable for WINCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/winlt.rs b/src/sdadc/winlt.rs new file mode 100644 index 0000000..c5aacc0 --- /dev/null +++ b/src/sdadc/winlt.rs @@ -0,0 +1,102 @@ +#[doc = "Register `WINLT` reader"] +pub struct R(crate::R<WINLT_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<WINLT_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<WINLT_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<WINLT_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `WINLT` writer"] +pub struct W(crate::W<WINLT_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<WINLT_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<WINLT_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<WINLT_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `WINLT` reader - Window Lower Threshold"] +pub struct WINLT_R(crate::FieldReader<u32, u32>); +impl WINLT_R { + pub(crate) fn new(bits: u32) -> Self { + WINLT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINLT_R { + type Target = crate::FieldReader<u32, u32>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINLT` writer - Window Lower Threshold"] +pub struct WINLT_W<'a> { + w: &'a mut W, +} +impl<'a> WINLT_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u32) -> &'a mut W { + self.w.bits = (self.w.bits & !0x00ff_ffff) | (value as u32 & 0x00ff_ffff); + self.w + } +} +impl R { + #[doc = "Bits 0:23 - Window Lower Threshold"] + #[inline(always)] + pub fn winlt(&self) -> WINLT_R { + WINLT_R::new((self.bits & 0x00ff_ffff) as u32) + } +} +impl W { + #[doc = "Bits 0:23 - Window Lower Threshold"] + #[inline(always)] + pub fn winlt(&mut self) -> WINLT_W { + WINLT_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 = "Window Monitor Lower Threshold\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 [winlt](index.html) module"] +pub struct WINLT_SPEC; +impl crate::RegisterSpec for WINLT_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [winlt::R](R) reader structure"] +impl crate::Readable for WINLT_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [winlt::W](W) writer structure"] +impl crate::Writable for WINLT_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets WINLT to value 0"] +impl crate::Resettable for WINLT_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/sdadc/winut.rs b/src/sdadc/winut.rs new file mode 100644 index 0000000..f1b6b3d --- /dev/null +++ b/src/sdadc/winut.rs @@ -0,0 +1,102 @@ +#[doc = "Register `WINUT` reader"] +pub struct R(crate::R<WINUT_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<WINUT_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<WINUT_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<WINUT_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `WINUT` writer"] +pub struct W(crate::W<WINUT_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<WINUT_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<WINUT_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<WINUT_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `WINUT` reader - Window Upper Threshold"] +pub struct WINUT_R(crate::FieldReader<u32, u32>); +impl WINUT_R { + pub(crate) fn new(bits: u32) -> Self { + WINUT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINUT_R { + type Target = crate::FieldReader<u32, u32>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINUT` writer - Window Upper Threshold"] +pub struct WINUT_W<'a> { + w: &'a mut W, +} +impl<'a> WINUT_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u32) -> &'a mut W { + self.w.bits = (self.w.bits & !0x00ff_ffff) | (value as u32 & 0x00ff_ffff); + self.w + } +} +impl R { + #[doc = "Bits 0:23 - Window Upper Threshold"] + #[inline(always)] + pub fn winut(&self) -> WINUT_R { + WINUT_R::new((self.bits & 0x00ff_ffff) as u32) + } +} +impl W { + #[doc = "Bits 0:23 - Window Upper Threshold"] + #[inline(always)] + pub fn winut(&mut self) -> WINUT_W { + WINUT_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 = "Window Monitor Upper Threshold\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 [winut](index.html) module"] +pub struct WINUT_SPEC; +impl crate::RegisterSpec for WINUT_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [winut::R](R) reader structure"] +impl crate::Readable for WINUT_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [winut::W](W) writer structure"] +impl crate::Writable for WINUT_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets WINUT to value 0"] +impl crate::Resettable for WINUT_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} |
