From 0666a6ba1dbd66cf8b93c113e362ccbcd99152a0 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Sat, 6 Nov 2021 11:50:33 +0100 Subject: Initial commit --- src/ac/compctrl.rs | 976 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/ac/ctrla.rs | 158 +++++++++ src/ac/ctrlb.rs | 153 +++++++++ src/ac/dbgctrl.rs | 112 ++++++ src/ac/evctrl.rs | 710 ++++++++++++++++++++++++++++++++++++++ src/ac/intenclr.rs | 342 +++++++++++++++++++ src/ac/intenset.rs | 342 +++++++++++++++++++ src/ac/intflag.rs | 342 +++++++++++++++++++ src/ac/scaler.rs | 103 ++++++ src/ac/statusa.rs | 231 +++++++++++++ src/ac/statusb.rs | 109 ++++++ src/ac/syncbusy.rs | 166 +++++++++ src/ac/winctrl.rs | 380 +++++++++++++++++++++ 13 files changed, 4124 insertions(+) create mode 100644 src/ac/compctrl.rs create mode 100644 src/ac/ctrla.rs create mode 100644 src/ac/ctrlb.rs create mode 100644 src/ac/dbgctrl.rs create mode 100644 src/ac/evctrl.rs create mode 100644 src/ac/intenclr.rs create mode 100644 src/ac/intenset.rs create mode 100644 src/ac/intflag.rs create mode 100644 src/ac/scaler.rs create mode 100644 src/ac/statusa.rs create mode 100644 src/ac/statusb.rs create mode 100644 src/ac/syncbusy.rs create mode 100644 src/ac/winctrl.rs (limited to 'src/ac') diff --git a/src/ac/compctrl.rs b/src/ac/compctrl.rs new file mode 100644 index 0000000..f841b44 --- /dev/null +++ b/src/ac/compctrl.rs @@ -0,0 +1,976 @@ +#[doc = "Register `COMPCTRL[%s]` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `COMPCTRL[%s]` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `ENABLE` reader - Enable"] +pub struct ENABLE_R(crate::FieldReader); +impl ENABLE_R { + pub(crate) fn new(bits: bool) -> Self { + ENABLE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ENABLE_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ENABLE` writer - Enable"] +pub struct ENABLE_W<'a> { + w: &'a mut W, +} +impl<'a> ENABLE_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1); + self.w + } +} +#[doc = "Field `SINGLE` reader - Single-Shot Mode"] +pub struct SINGLE_R(crate::FieldReader); +impl SINGLE_R { + pub(crate) fn new(bits: bool) -> Self { + SINGLE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SINGLE_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SINGLE` writer - Single-Shot Mode"] +pub struct SINGLE_W<'a> { + w: &'a mut W, +} +impl<'a> SINGLE_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 u32 & 0x01) << 2); + self.w + } +} +#[doc = "Interrupt Selection\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum INTSEL_A { + #[doc = "0: Interrupt on comparator output toggle"] + TOGGLE = 0, + #[doc = "1: Interrupt on comparator output rising"] + RISING = 1, + #[doc = "2: Interrupt on comparator output falling"] + FALLING = 2, + #[doc = "3: Interrupt on end of comparison (single-shot mode only)"] + EOC = 3, +} +impl From for u8 { + #[inline(always)] + fn from(variant: INTSEL_A) -> Self { + variant as _ + } +} +#[doc = "Field `INTSEL` reader - Interrupt Selection"] +pub struct INTSEL_R(crate::FieldReader); +impl INTSEL_R { + pub(crate) fn new(bits: u8) -> Self { + INTSEL_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> INTSEL_A { + match self.bits { + 0 => INTSEL_A::TOGGLE, + 1 => INTSEL_A::RISING, + 2 => INTSEL_A::FALLING, + 3 => INTSEL_A::EOC, + _ => unreachable!(), + } + } + #[doc = "Checks if the value of the field is `TOGGLE`"] + #[inline(always)] + pub fn is_toggle(&self) -> bool { + **self == INTSEL_A::TOGGLE + } + #[doc = "Checks if the value of the field is `RISING`"] + #[inline(always)] + pub fn is_rising(&self) -> bool { + **self == INTSEL_A::RISING + } + #[doc = "Checks if the value of the field is `FALLING`"] + #[inline(always)] + pub fn is_falling(&self) -> bool { + **self == INTSEL_A::FALLING + } + #[doc = "Checks if the value of the field is `EOC`"] + #[inline(always)] + pub fn is_eoc(&self) -> bool { + **self == INTSEL_A::EOC + } +} +impl core::ops::Deref for INTSEL_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `INTSEL` writer - Interrupt Selection"] +pub struct INTSEL_W<'a> { + w: &'a mut W, +} +impl<'a> INTSEL_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: INTSEL_A) -> &'a mut W { + self.bits(variant.into()) + } + #[doc = "Interrupt on comparator output toggle"] + #[inline(always)] + pub fn toggle(self) -> &'a mut W { + self.variant(INTSEL_A::TOGGLE) + } + #[doc = "Interrupt on comparator output rising"] + #[inline(always)] + pub fn rising(self) -> &'a mut W { + self.variant(INTSEL_A::RISING) + } + #[doc = "Interrupt on comparator output falling"] + #[inline(always)] + pub fn falling(self) -> &'a mut W { + self.variant(INTSEL_A::FALLING) + } + #[doc = "Interrupt on end of comparison (single-shot mode only)"] + #[inline(always)] + pub fn eoc(self) -> &'a mut W { + self.variant(INTSEL_A::EOC) + } + #[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 << 3)) | ((value as u32 & 0x03) << 3); + self.w + } +} +#[doc = "Field `RUNSTDBY` reader - Run in Standby"] +pub struct RUNSTDBY_R(crate::FieldReader); +impl RUNSTDBY_R { + pub(crate) fn new(bits: bool) -> Self { + RUNSTDBY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for RUNSTDBY_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `RUNSTDBY` writer - Run in Standby"] +pub struct RUNSTDBY_W<'a> { + w: &'a mut W, +} +impl<'a> RUNSTDBY_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6); + self.w + } +} +#[doc = "Negative Input Mux Selection\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum MUXNEG_A { + #[doc = "0: I/O pin 0"] + PIN0 = 0, + #[doc = "1: I/O pin 1"] + PIN1 = 1, + #[doc = "2: I/O pin 2"] + PIN2 = 2, + #[doc = "3: I/O pin 3"] + PIN3 = 3, + #[doc = "4: Ground"] + GND = 4, + #[doc = "5: VDD scaler"] + VSCALE = 5, + #[doc = "6: Internal bandgap voltage"] + BANDGAP = 6, + #[doc = "7: DAC output"] + DAC = 7, +} +impl From for u8 { + #[inline(always)] + fn from(variant: MUXNEG_A) -> Self { + variant as _ + } +} +#[doc = "Field `MUXNEG` reader - Negative Input Mux Selection"] +pub struct MUXNEG_R(crate::FieldReader); +impl MUXNEG_R { + pub(crate) fn new(bits: u8) -> Self { + MUXNEG_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> MUXNEG_A { + match self.bits { + 0 => MUXNEG_A::PIN0, + 1 => MUXNEG_A::PIN1, + 2 => MUXNEG_A::PIN2, + 3 => MUXNEG_A::PIN3, + 4 => MUXNEG_A::GND, + 5 => MUXNEG_A::VSCALE, + 6 => MUXNEG_A::BANDGAP, + 7 => MUXNEG_A::DAC, + _ => unreachable!(), + } + } + #[doc = "Checks if the value of the field is `PIN0`"] + #[inline(always)] + pub fn is_pin0(&self) -> bool { + **self == MUXNEG_A::PIN0 + } + #[doc = "Checks if the value of the field is `PIN1`"] + #[inline(always)] + pub fn is_pin1(&self) -> bool { + **self == MUXNEG_A::PIN1 + } + #[doc = "Checks if the value of the field is `PIN2`"] + #[inline(always)] + pub fn is_pin2(&self) -> bool { + **self == MUXNEG_A::PIN2 + } + #[doc = "Checks if the value of the field is `PIN3`"] + #[inline(always)] + pub fn is_pin3(&self) -> bool { + **self == MUXNEG_A::PIN3 + } + #[doc = "Checks if the value of the field is `GND`"] + #[inline(always)] + pub fn is_gnd(&self) -> bool { + **self == MUXNEG_A::GND + } + #[doc = "Checks if the value of the field is `VSCALE`"] + #[inline(always)] + pub fn is_vscale(&self) -> bool { + **self == MUXNEG_A::VSCALE + } + #[doc = "Checks if the value of the field is `BANDGAP`"] + #[inline(always)] + pub fn is_bandgap(&self) -> bool { + **self == MUXNEG_A::BANDGAP + } + #[doc = "Checks if the value of the field is `DAC`"] + #[inline(always)] + pub fn is_dac(&self) -> bool { + **self == MUXNEG_A::DAC + } +} +impl core::ops::Deref for MUXNEG_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MUXNEG` writer - Negative Input Mux Selection"] +pub struct MUXNEG_W<'a> { + w: &'a mut W, +} +impl<'a> MUXNEG_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: MUXNEG_A) -> &'a mut W { + self.bits(variant.into()) + } + #[doc = "I/O pin 0"] + #[inline(always)] + pub fn pin0(self) -> &'a mut W { + self.variant(MUXNEG_A::PIN0) + } + #[doc = "I/O pin 1"] + #[inline(always)] + pub fn pin1(self) -> &'a mut W { + self.variant(MUXNEG_A::PIN1) + } + #[doc = "I/O pin 2"] + #[inline(always)] + pub fn pin2(self) -> &'a mut W { + self.variant(MUXNEG_A::PIN2) + } + #[doc = "I/O pin 3"] + #[inline(always)] + pub fn pin3(self) -> &'a mut W { + self.variant(MUXNEG_A::PIN3) + } + #[doc = "Ground"] + #[inline(always)] + pub fn gnd(self) -> &'a mut W { + self.variant(MUXNEG_A::GND) + } + #[doc = "VDD scaler"] + #[inline(always)] + pub fn vscale(self) -> &'a mut W { + self.variant(MUXNEG_A::VSCALE) + } + #[doc = "Internal bandgap voltage"] + #[inline(always)] + pub fn bandgap(self) -> &'a mut W { + self.variant(MUXNEG_A::BANDGAP) + } + #[doc = "DAC output"] + #[inline(always)] + pub fn dac(self) -> &'a mut W { + self.variant(MUXNEG_A::DAC) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x07 << 8)) | ((value as u32 & 0x07) << 8); + self.w + } +} +#[doc = "Positive Input Mux Selection\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum MUXPOS_A { + #[doc = "0: I/O pin 0"] + PIN0 = 0, + #[doc = "1: I/O pin 1"] + PIN1 = 1, + #[doc = "2: I/O pin 2"] + PIN2 = 2, + #[doc = "3: I/O pin 3"] + PIN3 = 3, + #[doc = "4: VDD Scaler"] + VSCALE = 4, +} +impl From for u8 { + #[inline(always)] + fn from(variant: MUXPOS_A) -> Self { + variant as _ + } +} +#[doc = "Field `MUXPOS` reader - Positive Input Mux Selection"] +pub struct MUXPOS_R(crate::FieldReader); +impl MUXPOS_R { + pub(crate) fn new(bits: u8) -> Self { + MUXPOS_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(MUXPOS_A::PIN0), + 1 => Some(MUXPOS_A::PIN1), + 2 => Some(MUXPOS_A::PIN2), + 3 => Some(MUXPOS_A::PIN3), + 4 => Some(MUXPOS_A::VSCALE), + _ => None, + } + } + #[doc = "Checks if the value of the field is `PIN0`"] + #[inline(always)] + pub fn is_pin0(&self) -> bool { + **self == MUXPOS_A::PIN0 + } + #[doc = "Checks if the value of the field is `PIN1`"] + #[inline(always)] + pub fn is_pin1(&self) -> bool { + **self == MUXPOS_A::PIN1 + } + #[doc = "Checks if the value of the field is `PIN2`"] + #[inline(always)] + pub fn is_pin2(&self) -> bool { + **self == MUXPOS_A::PIN2 + } + #[doc = "Checks if the value of the field is `PIN3`"] + #[inline(always)] + pub fn is_pin3(&self) -> bool { + **self == MUXPOS_A::PIN3 + } + #[doc = "Checks if the value of the field is `VSCALE`"] + #[inline(always)] + pub fn is_vscale(&self) -> bool { + **self == MUXPOS_A::VSCALE + } +} +impl core::ops::Deref for MUXPOS_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `MUXPOS` writer - Positive Input Mux Selection"] +pub struct MUXPOS_W<'a> { + w: &'a mut W, +} +impl<'a> MUXPOS_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: MUXPOS_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "I/O pin 0"] + #[inline(always)] + pub fn pin0(self) -> &'a mut W { + self.variant(MUXPOS_A::PIN0) + } + #[doc = "I/O pin 1"] + #[inline(always)] + pub fn pin1(self) -> &'a mut W { + self.variant(MUXPOS_A::PIN1) + } + #[doc = "I/O pin 2"] + #[inline(always)] + pub fn pin2(self) -> &'a mut W { + self.variant(MUXPOS_A::PIN2) + } + #[doc = "I/O pin 3"] + #[inline(always)] + pub fn pin3(self) -> &'a mut W { + self.variant(MUXPOS_A::PIN3) + } + #[doc = "VDD Scaler"] + #[inline(always)] + pub fn vscale(self) -> &'a mut W { + self.variant(MUXPOS_A::VSCALE) + } + #[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 << 12)) | ((value as u32 & 0x07) << 12); + self.w + } +} +#[doc = "Field `SWAP` reader - Swap Inputs and Invert"] +pub struct SWAP_R(crate::FieldReader); +impl SWAP_R { + pub(crate) fn new(bits: bool) -> Self { + SWAP_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SWAP_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SWAP` writer - Swap Inputs and Invert"] +pub struct SWAP_W<'a> { + w: &'a mut W, +} +impl<'a> SWAP_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 << 15)) | ((value as u32 & 0x01) << 15); + self.w + } +} +#[doc = "Speed Selection\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum SPEED_A { + #[doc = "0: Low speed"] + LOW = 0, + #[doc = "3: High speed"] + HIGH = 3, +} +impl From for u8 { + #[inline(always)] + fn from(variant: SPEED_A) -> Self { + variant as _ + } +} +#[doc = "Field `SPEED` reader - Speed Selection"] +pub struct SPEED_R(crate::FieldReader); +impl SPEED_R { + pub(crate) fn new(bits: u8) -> Self { + SPEED_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(SPEED_A::LOW), + 3 => Some(SPEED_A::HIGH), + _ => None, + } + } + #[doc = "Checks if the value of the field is `LOW`"] + #[inline(always)] + pub fn is_low(&self) -> bool { + **self == SPEED_A::LOW + } + #[doc = "Checks if the value of the field is `HIGH`"] + #[inline(always)] + pub fn is_high(&self) -> bool { + **self == SPEED_A::HIGH + } +} +impl core::ops::Deref for SPEED_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SPEED` writer - Speed Selection"] +pub struct SPEED_W<'a> { + w: &'a mut W, +} +impl<'a> SPEED_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: SPEED_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "Low speed"] + #[inline(always)] + pub fn low(self) -> &'a mut W { + self.variant(SPEED_A::LOW) + } + #[doc = "High speed"] + #[inline(always)] + pub fn high(self) -> &'a mut W { + self.variant(SPEED_A::HIGH) + } + #[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 << 16)) | ((value as u32 & 0x03) << 16); + self.w + } +} +#[doc = "Field `HYSTEN` reader - Hysteresis Enable"] +pub struct HYSTEN_R(crate::FieldReader); +impl HYSTEN_R { + pub(crate) fn new(bits: bool) -> Self { + HYSTEN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for HYSTEN_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `HYSTEN` writer - Hysteresis Enable"] +pub struct HYSTEN_W<'a> { + w: &'a mut W, +} +impl<'a> HYSTEN_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19); + self.w + } +} +#[doc = "Filter Length\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum FLEN_A { + #[doc = "0: No filtering"] + OFF = 0, + #[doc = "1: 3-bit majority function (2 of 3)"] + MAJ3 = 1, + #[doc = "2: 5-bit majority function (3 of 5)"] + MAJ5 = 2, +} +impl From for u8 { + #[inline(always)] + fn from(variant: FLEN_A) -> Self { + variant as _ + } +} +#[doc = "Field `FLEN` reader - Filter Length"] +pub struct FLEN_R(crate::FieldReader); +impl FLEN_R { + pub(crate) fn new(bits: u8) -> Self { + FLEN_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(FLEN_A::OFF), + 1 => Some(FLEN_A::MAJ3), + 2 => Some(FLEN_A::MAJ5), + _ => None, + } + } + #[doc = "Checks if the value of the field is `OFF`"] + #[inline(always)] + pub fn is_off(&self) -> bool { + **self == FLEN_A::OFF + } + #[doc = "Checks if the value of the field is `MAJ3`"] + #[inline(always)] + pub fn is_maj3(&self) -> bool { + **self == FLEN_A::MAJ3 + } + #[doc = "Checks if the value of the field is `MAJ5`"] + #[inline(always)] + pub fn is_maj5(&self) -> bool { + **self == FLEN_A::MAJ5 + } +} +impl core::ops::Deref for FLEN_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `FLEN` writer - Filter Length"] +pub struct FLEN_W<'a> { + w: &'a mut W, +} +impl<'a> FLEN_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: FLEN_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "No filtering"] + #[inline(always)] + pub fn off(self) -> &'a mut W { + self.variant(FLEN_A::OFF) + } + #[doc = "3-bit majority function (2 of 3)"] + #[inline(always)] + pub fn maj3(self) -> &'a mut W { + self.variant(FLEN_A::MAJ3) + } + #[doc = "5-bit majority function (3 of 5)"] + #[inline(always)] + pub fn maj5(self) -> &'a mut W { + self.variant(FLEN_A::MAJ5) + } + #[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 << 24)) | ((value as u32 & 0x07) << 24); + self.w + } +} +#[doc = "Output\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum OUT_A { + #[doc = "0: The output of COMPn is not routed to the COMPn I/O port"] + OFF = 0, + #[doc = "1: The asynchronous output of COMPn is routed to the COMPn I/O port"] + ASYNC = 1, + #[doc = "2: The synchronous output (including filtering) of COMPn is routed to the COMPn I/O port"] + SYNC = 2, +} +impl From for u8 { + #[inline(always)] + fn from(variant: OUT_A) -> Self { + variant as _ + } +} +#[doc = "Field `OUT` reader - Output"] +pub struct OUT_R(crate::FieldReader); +impl OUT_R { + pub(crate) fn new(bits: u8) -> Self { + OUT_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(OUT_A::OFF), + 1 => Some(OUT_A::ASYNC), + 2 => Some(OUT_A::SYNC), + _ => None, + } + } + #[doc = "Checks if the value of the field is `OFF`"] + #[inline(always)] + pub fn is_off(&self) -> bool { + **self == OUT_A::OFF + } + #[doc = "Checks if the value of the field is `ASYNC`"] + #[inline(always)] + pub fn is_async(&self) -> bool { + **self == OUT_A::ASYNC + } + #[doc = "Checks if the value of the field is `SYNC`"] + #[inline(always)] + pub fn is_sync(&self) -> bool { + **self == OUT_A::SYNC + } +} +impl core::ops::Deref for OUT_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `OUT` writer - Output"] +pub struct OUT_W<'a> { + w: &'a mut W, +} +impl<'a> OUT_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: OUT_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "The output of COMPn is not routed to the COMPn I/O port"] + #[inline(always)] + pub fn off(self) -> &'a mut W { + self.variant(OUT_A::OFF) + } + #[doc = "The asynchronous output of COMPn is routed to the COMPn I/O port"] + #[inline(always)] + pub fn async_(self) -> &'a mut W { + self.variant(OUT_A::ASYNC) + } + #[doc = "The synchronous output (including filtering) of COMPn is routed to the COMPn I/O port"] + #[inline(always)] + pub fn sync(self) -> &'a mut W { + self.variant(OUT_A::SYNC) + } + #[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 << 28)) | ((value as u32 & 0x03) << 28); + self.w + } +} +impl R { + #[doc = "Bit 1 - Enable"] + #[inline(always)] + pub fn enable(&self) -> ENABLE_R { + ENABLE_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Single-Shot Mode"] + #[inline(always)] + pub fn single(&self) -> SINGLE_R { + SINGLE_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bits 3:4 - Interrupt Selection"] + #[inline(always)] + pub fn intsel(&self) -> INTSEL_R { + INTSEL_R::new(((self.bits >> 3) & 0x03) as u8) + } + #[doc = "Bit 6 - Run in Standby"] + #[inline(always)] + pub fn runstdby(&self) -> RUNSTDBY_R { + RUNSTDBY_R::new(((self.bits >> 6) & 0x01) != 0) + } + #[doc = "Bits 8:10 - Negative Input Mux Selection"] + #[inline(always)] + pub fn muxneg(&self) -> MUXNEG_R { + MUXNEG_R::new(((self.bits >> 8) & 0x07) as u8) + } + #[doc = "Bits 12:14 - Positive Input Mux Selection"] + #[inline(always)] + pub fn muxpos(&self) -> MUXPOS_R { + MUXPOS_R::new(((self.bits >> 12) & 0x07) as u8) + } + #[doc = "Bit 15 - Swap Inputs and Invert"] + #[inline(always)] + pub fn swap(&self) -> SWAP_R { + SWAP_R::new(((self.bits >> 15) & 0x01) != 0) + } + #[doc = "Bits 16:17 - Speed Selection"] + #[inline(always)] + pub fn speed(&self) -> SPEED_R { + SPEED_R::new(((self.bits >> 16) & 0x03) as u8) + } + #[doc = "Bit 19 - Hysteresis Enable"] + #[inline(always)] + pub fn hysten(&self) -> HYSTEN_R { + HYSTEN_R::new(((self.bits >> 19) & 0x01) != 0) + } + #[doc = "Bits 24:26 - Filter Length"] + #[inline(always)] + pub fn flen(&self) -> FLEN_R { + FLEN_R::new(((self.bits >> 24) & 0x07) as u8) + } + #[doc = "Bits 28:29 - Output"] + #[inline(always)] + pub fn out(&self) -> OUT_R { + OUT_R::new(((self.bits >> 28) & 0x03) as u8) + } +} +impl W { + #[doc = "Bit 1 - Enable"] + #[inline(always)] + pub fn enable(&mut self) -> ENABLE_W { + ENABLE_W { w: self } + } + #[doc = "Bit 2 - Single-Shot Mode"] + #[inline(always)] + pub fn single(&mut self) -> SINGLE_W { + SINGLE_W { w: self } + } + #[doc = "Bits 3:4 - Interrupt Selection"] + #[inline(always)] + pub fn intsel(&mut self) -> INTSEL_W { + INTSEL_W { w: self } + } + #[doc = "Bit 6 - Run in Standby"] + #[inline(always)] + pub fn runstdby(&mut self) -> RUNSTDBY_W { + RUNSTDBY_W { w: self } + } + #[doc = "Bits 8:10 - Negative Input Mux Selection"] + #[inline(always)] + pub fn muxneg(&mut self) -> MUXNEG_W { + MUXNEG_W { w: self } + } + #[doc = "Bits 12:14 - Positive Input Mux Selection"] + #[inline(always)] + pub fn muxpos(&mut self) -> MUXPOS_W { + MUXPOS_W { w: self } + } + #[doc = "Bit 15 - Swap Inputs and Invert"] + #[inline(always)] + pub fn swap(&mut self) -> SWAP_W { + SWAP_W { w: self } + } + #[doc = "Bits 16:17 - Speed Selection"] + #[inline(always)] + pub fn speed(&mut self) -> SPEED_W { + SPEED_W { w: self } + } + #[doc = "Bit 19 - Hysteresis Enable"] + #[inline(always)] + pub fn hysten(&mut self) -> HYSTEN_W { + HYSTEN_W { w: self } + } + #[doc = "Bits 24:26 - Filter Length"] + #[inline(always)] + pub fn flen(&mut self) -> FLEN_W { + FLEN_W { w: self } + } + #[doc = "Bits 28:29 - Output"] + #[inline(always)] + pub fn out(&mut self) -> OUT_W { + OUT_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 = "Comparator Control n\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 [compctrl](index.html) module"] +pub struct COMPCTRL_SPEC; +impl crate::RegisterSpec for COMPCTRL_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [compctrl::R](R) reader structure"] +impl crate::Readable for COMPCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [compctrl::W](W) writer structure"] +impl crate::Writable for COMPCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets COMPCTRL[%s] +to value 0"] +impl crate::Resettable for COMPCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/ac/ctrla.rs b/src/ac/ctrla.rs new file mode 100644 index 0000000..270f8d9 --- /dev/null +++ b/src/ac/ctrla.rs @@ -0,0 +1,158 @@ +#[doc = "Register `CTRLA` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `CTRLA` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `SWRST` reader - Software Reset"] +pub struct SWRST_R(crate::FieldReader); +impl SWRST_R { + pub(crate) fn new(bits: bool) -> Self { + SWRST_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SWRST_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SWRST` writer - Software Reset"] +pub struct SWRST_W<'a> { + w: &'a mut W, +} +impl<'a> SWRST_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !0x01) | (value as u8 & 0x01); + self.w + } +} +#[doc = "Field `ENABLE` reader - Enable"] +pub struct ENABLE_R(crate::FieldReader); +impl ENABLE_R { + pub(crate) fn new(bits: bool) -> Self { + ENABLE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ENABLE_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ENABLE` writer - Enable"] +pub struct ENABLE_W<'a> { + w: &'a mut W, +} +impl<'a> ENABLE_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u8 & 0x01) << 1); + self.w + } +} +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) + } +} +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 = "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/ac/ctrlb.rs b/src/ac/ctrlb.rs new file mode 100644 index 0000000..fa9d604 --- /dev/null +++ b/src/ac/ctrlb.rs @@ -0,0 +1,153 @@ +#[doc = "Register `CTRLB` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `START0` writer - Comparator 0 Start Comparison"] +pub struct START0_W<'a> { + w: &'a mut W, +} +impl<'a> START0_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 `START1` writer - Comparator 1 Start Comparison"] +pub struct START1_W<'a> { + w: &'a mut W, +} +impl<'a> START1_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 `START2` writer - Comparator 2 Start Comparison"] +pub struct START2_W<'a> { + w: &'a mut W, +} +impl<'a> START2_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 `START3` writer - Comparator 3 Start Comparison"] +pub struct START3_W<'a> { + w: &'a mut W, +} +impl<'a> START3_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 + } +} +impl W { + #[doc = "Bit 0 - Comparator 0 Start Comparison"] + #[inline(always)] + pub fn start0(&mut self) -> START0_W { + START0_W { w: self } + } + #[doc = "Bit 1 - Comparator 1 Start Comparison"] + #[inline(always)] + pub fn start1(&mut self) -> START1_W { + START1_W { w: self } + } + #[doc = "Bit 2 - Comparator 2 Start Comparison"] + #[inline(always)] + pub fn start2(&mut self) -> START2_W { + START2_W { w: self } + } + #[doc = "Bit 3 - Comparator 3 Start Comparison"] + #[inline(always)] + pub fn start3(&mut self) -> START3_W { + START3_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Control B\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ctrlb](index.html) module"] +pub struct CTRLB_SPEC; +impl crate::RegisterSpec for CTRLB_SPEC { + type Ux = u8; +} +#[doc = "`write(|w| ..)` method takes [ctrlb::W](W) writer structure"] +impl crate::Writable for CTRLB_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets CTRLB to value 0"] +impl crate::Resettable for CTRLB_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/ac/dbgctrl.rs b/src/ac/dbgctrl.rs new file mode 100644 index 0000000..8befebc --- /dev/null +++ b/src/ac/dbgctrl.rs @@ -0,0 +1,112 @@ +#[doc = "Register `DBGCTRL` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `DBGCTRL` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `DBGRUN` reader - Debug Run"] +pub struct DBGRUN_R(crate::FieldReader); +impl DBGRUN_R { + pub(crate) fn new(bits: bool) -> Self { + DBGRUN_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for DBGRUN_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `DBGRUN` writer - Debug Run"] +pub struct DBGRUN_W<'a> { + w: &'a mut W, +} +impl<'a> DBGRUN_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !0x01) | (value as u8 & 0x01); + self.w + } +} +impl R { + #[doc = "Bit 0 - Debug Run"] + #[inline(always)] + pub fn dbgrun(&self) -> DBGRUN_R { + DBGRUN_R::new((self.bits & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Debug Run"] + #[inline(always)] + pub fn dbgrun(&mut self) -> DBGRUN_W { + DBGRUN_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Debug Control\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [dbgctrl](index.html) module"] +pub struct DBGCTRL_SPEC; +impl crate::RegisterSpec for DBGCTRL_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [dbgctrl::R](R) reader structure"] +impl crate::Readable for DBGCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [dbgctrl::W](W) writer structure"] +impl crate::Writable for DBGCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets DBGCTRL to value 0"] +impl crate::Resettable for DBGCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/ac/evctrl.rs b/src/ac/evctrl.rs new file mode 100644 index 0000000..a00870c --- /dev/null +++ b/src/ac/evctrl.rs @@ -0,0 +1,710 @@ +#[doc = "Register `EVCTRL` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `EVCTRL` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `COMPEO0` reader - Comparator 0 Event Output Enable"] +pub struct COMPEO0_R(crate::FieldReader); +impl COMPEO0_R { + pub(crate) fn new(bits: bool) -> Self { + COMPEO0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPEO0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPEO0` writer - Comparator 0 Event Output Enable"] +pub struct COMPEO0_W<'a> { + w: &'a mut W, +} +impl<'a> COMPEO0_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 u16 & 0x01); + self.w + } +} +#[doc = "Field `COMPEO1` reader - Comparator 1 Event Output Enable"] +pub struct COMPEO1_R(crate::FieldReader); +impl COMPEO1_R { + pub(crate) fn new(bits: bool) -> Self { + COMPEO1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPEO1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPEO1` writer - Comparator 1 Event Output Enable"] +pub struct COMPEO1_W<'a> { + w: &'a mut W, +} +impl<'a> COMPEO1_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 u16 & 0x01) << 1); + self.w + } +} +#[doc = "Field `COMPEO2` reader - Comparator 2 Event Output Enable"] +pub struct COMPEO2_R(crate::FieldReader); +impl COMPEO2_R { + pub(crate) fn new(bits: bool) -> Self { + COMPEO2_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPEO2_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPEO2` writer - Comparator 2 Event Output Enable"] +pub struct COMPEO2_W<'a> { + w: &'a mut W, +} +impl<'a> COMPEO2_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 u16 & 0x01) << 2); + self.w + } +} +#[doc = "Field `COMPEO3` reader - Comparator 3 Event Output Enable"] +pub struct COMPEO3_R(crate::FieldReader); +impl COMPEO3_R { + pub(crate) fn new(bits: bool) -> Self { + COMPEO3_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPEO3_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPEO3` writer - Comparator 3 Event Output Enable"] +pub struct COMPEO3_W<'a> { + w: &'a mut W, +} +impl<'a> COMPEO3_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 u16 & 0x01) << 3); + self.w + } +} +#[doc = "Field `WINEO0` reader - Window 0 Event Output Enable"] +pub struct WINEO0_R(crate::FieldReader); +impl WINEO0_R { + pub(crate) fn new(bits: bool) -> Self { + WINEO0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINEO0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINEO0` writer - Window 0 Event Output Enable"] +pub struct WINEO0_W<'a> { + w: &'a mut W, +} +impl<'a> WINEO0_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u16 & 0x01) << 4); + self.w + } +} +#[doc = "Field `WINEO1` reader - Window 1 Event Output Enable"] +pub struct WINEO1_R(crate::FieldReader); +impl WINEO1_R { + pub(crate) fn new(bits: bool) -> Self { + WINEO1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WINEO1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINEO1` writer - Window 1 Event Output Enable"] +pub struct WINEO1_W<'a> { + w: &'a mut W, +} +impl<'a> WINEO1_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u16 & 0x01) << 5); + self.w + } +} +#[doc = "Field `COMPEI0` reader - Comparator 0 Event Input Enable"] +pub struct COMPEI0_R(crate::FieldReader); +impl COMPEI0_R { + pub(crate) fn new(bits: bool) -> Self { + COMPEI0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPEI0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPEI0` writer - Comparator 0 Event Input Enable"] +pub struct COMPEI0_W<'a> { + w: &'a mut W, +} +impl<'a> COMPEI0_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 8)) | ((value as u16 & 0x01) << 8); + self.w + } +} +#[doc = "Field `COMPEI1` reader - Comparator 1 Event Input Enable"] +pub struct COMPEI1_R(crate::FieldReader); +impl COMPEI1_R { + pub(crate) fn new(bits: bool) -> Self { + COMPEI1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPEI1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPEI1` writer - Comparator 1 Event Input Enable"] +pub struct COMPEI1_W<'a> { + w: &'a mut W, +} +impl<'a> COMPEI1_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 9)) | ((value as u16 & 0x01) << 9); + self.w + } +} +#[doc = "Field `COMPEI2` reader - Comparator 2 Event Input Enable"] +pub struct COMPEI2_R(crate::FieldReader); +impl COMPEI2_R { + pub(crate) fn new(bits: bool) -> Self { + COMPEI2_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPEI2_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPEI2` writer - Comparator 2 Event Input Enable"] +pub struct COMPEI2_W<'a> { + w: &'a mut W, +} +impl<'a> COMPEI2_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 << 10)) | ((value as u16 & 0x01) << 10); + self.w + } +} +#[doc = "Field `COMPEI3` reader - Comparator 3 Event Input Enable"] +pub struct COMPEI3_R(crate::FieldReader); +impl COMPEI3_R { + pub(crate) fn new(bits: bool) -> Self { + COMPEI3_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPEI3_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPEI3` writer - Comparator 3 Event Input Enable"] +pub struct COMPEI3_W<'a> { + w: &'a mut W, +} +impl<'a> COMPEI3_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 11)) | ((value as u16 & 0x01) << 11); + self.w + } +} +#[doc = "Field `INVEI0` reader - Comparator 0 Input Event Invert Enable"] +pub struct INVEI0_R(crate::FieldReader); +impl INVEI0_R { + pub(crate) fn new(bits: bool) -> Self { + INVEI0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for INVEI0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `INVEI0` writer - Comparator 0 Input Event Invert Enable"] +pub struct INVEI0_W<'a> { + w: &'a mut W, +} +impl<'a> INVEI0_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 12)) | ((value as u16 & 0x01) << 12); + self.w + } +} +#[doc = "Field `INVEI1` reader - Comparator 1 Input Event Invert Enable"] +pub struct INVEI1_R(crate::FieldReader); +impl INVEI1_R { + pub(crate) fn new(bits: bool) -> Self { + INVEI1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for INVEI1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `INVEI1` writer - Comparator 1 Input Event Invert Enable"] +pub struct INVEI1_W<'a> { + w: &'a mut W, +} +impl<'a> INVEI1_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 13)) | ((value as u16 & 0x01) << 13); + self.w + } +} +#[doc = "Field `INVEI2` reader - Comparator 2 Input Event Invert Enable"] +pub struct INVEI2_R(crate::FieldReader); +impl INVEI2_R { + pub(crate) fn new(bits: bool) -> Self { + INVEI2_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for INVEI2_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `INVEI2` writer - Comparator 2 Input Event Invert Enable"] +pub struct INVEI2_W<'a> { + w: &'a mut W, +} +impl<'a> INVEI2_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 << 14)) | ((value as u16 & 0x01) << 14); + self.w + } +} +#[doc = "Field `INVEI3` reader - Comparator 3 Input Event Invert Enable"] +pub struct INVEI3_R(crate::FieldReader); +impl INVEI3_R { + pub(crate) fn new(bits: bool) -> Self { + INVEI3_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for INVEI3_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `INVEI3` writer - Comparator 3 Input Event Invert Enable"] +pub struct INVEI3_W<'a> { + w: &'a mut W, +} +impl<'a> INVEI3_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 << 15)) | ((value as u16 & 0x01) << 15); + self.w + } +} +impl R { + #[doc = "Bit 0 - Comparator 0 Event Output Enable"] + #[inline(always)] + pub fn compeo0(&self) -> COMPEO0_R { + COMPEO0_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Comparator 1 Event Output Enable"] + #[inline(always)] + pub fn compeo1(&self) -> COMPEO1_R { + COMPEO1_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Comparator 2 Event Output Enable"] + #[inline(always)] + pub fn compeo2(&self) -> COMPEO2_R { + COMPEO2_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - Comparator 3 Event Output Enable"] + #[inline(always)] + pub fn compeo3(&self) -> COMPEO3_R { + COMPEO3_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 4 - Window 0 Event Output Enable"] + #[inline(always)] + pub fn wineo0(&self) -> WINEO0_R { + WINEO0_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - Window 1 Event Output Enable"] + #[inline(always)] + pub fn wineo1(&self) -> WINEO1_R { + WINEO1_R::new(((self.bits >> 5) & 0x01) != 0) + } + #[doc = "Bit 8 - Comparator 0 Event Input Enable"] + #[inline(always)] + pub fn compei0(&self) -> COMPEI0_R { + COMPEI0_R::new(((self.bits >> 8) & 0x01) != 0) + } + #[doc = "Bit 9 - Comparator 1 Event Input Enable"] + #[inline(always)] + pub fn compei1(&self) -> COMPEI1_R { + COMPEI1_R::new(((self.bits >> 9) & 0x01) != 0) + } + #[doc = "Bit 10 - Comparator 2 Event Input Enable"] + #[inline(always)] + pub fn compei2(&self) -> COMPEI2_R { + COMPEI2_R::new(((self.bits >> 10) & 0x01) != 0) + } + #[doc = "Bit 11 - Comparator 3 Event Input Enable"] + #[inline(always)] + pub fn compei3(&self) -> COMPEI3_R { + COMPEI3_R::new(((self.bits >> 11) & 0x01) != 0) + } + #[doc = "Bit 12 - Comparator 0 Input Event Invert Enable"] + #[inline(always)] + pub fn invei0(&self) -> INVEI0_R { + INVEI0_R::new(((self.bits >> 12) & 0x01) != 0) + } + #[doc = "Bit 13 - Comparator 1 Input Event Invert Enable"] + #[inline(always)] + pub fn invei1(&self) -> INVEI1_R { + INVEI1_R::new(((self.bits >> 13) & 0x01) != 0) + } + #[doc = "Bit 14 - Comparator 2 Input Event Invert Enable"] + #[inline(always)] + pub fn invei2(&self) -> INVEI2_R { + INVEI2_R::new(((self.bits >> 14) & 0x01) != 0) + } + #[doc = "Bit 15 - Comparator 3 Input Event Invert Enable"] + #[inline(always)] + pub fn invei3(&self) -> INVEI3_R { + INVEI3_R::new(((self.bits >> 15) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Comparator 0 Event Output Enable"] + #[inline(always)] + pub fn compeo0(&mut self) -> COMPEO0_W { + COMPEO0_W { w: self } + } + #[doc = "Bit 1 - Comparator 1 Event Output Enable"] + #[inline(always)] + pub fn compeo1(&mut self) -> COMPEO1_W { + COMPEO1_W { w: self } + } + #[doc = "Bit 2 - Comparator 2 Event Output Enable"] + #[inline(always)] + pub fn compeo2(&mut self) -> COMPEO2_W { + COMPEO2_W { w: self } + } + #[doc = "Bit 3 - Comparator 3 Event Output Enable"] + #[inline(always)] + pub fn compeo3(&mut self) -> COMPEO3_W { + COMPEO3_W { w: self } + } + #[doc = "Bit 4 - Window 0 Event Output Enable"] + #[inline(always)] + pub fn wineo0(&mut self) -> WINEO0_W { + WINEO0_W { w: self } + } + #[doc = "Bit 5 - Window 1 Event Output Enable"] + #[inline(always)] + pub fn wineo1(&mut self) -> WINEO1_W { + WINEO1_W { w: self } + } + #[doc = "Bit 8 - Comparator 0 Event Input Enable"] + #[inline(always)] + pub fn compei0(&mut self) -> COMPEI0_W { + COMPEI0_W { w: self } + } + #[doc = "Bit 9 - Comparator 1 Event Input Enable"] + #[inline(always)] + pub fn compei1(&mut self) -> COMPEI1_W { + COMPEI1_W { w: self } + } + #[doc = "Bit 10 - Comparator 2 Event Input Enable"] + #[inline(always)] + pub fn compei2(&mut self) -> COMPEI2_W { + COMPEI2_W { w: self } + } + #[doc = "Bit 11 - Comparator 3 Event Input Enable"] + #[inline(always)] + pub fn compei3(&mut self) -> COMPEI3_W { + COMPEI3_W { w: self } + } + #[doc = "Bit 12 - Comparator 0 Input Event Invert Enable"] + #[inline(always)] + pub fn invei0(&mut self) -> INVEI0_W { + INVEI0_W { w: self } + } + #[doc = "Bit 13 - Comparator 1 Input Event Invert Enable"] + #[inline(always)] + pub fn invei1(&mut self) -> INVEI1_W { + INVEI1_W { w: self } + } + #[doc = "Bit 14 - Comparator 2 Input Event Invert Enable"] + #[inline(always)] + pub fn invei2(&mut self) -> INVEI2_W { + INVEI2_W { w: self } + } + #[doc = "Bit 15 - Comparator 3 Input Event Invert Enable"] + #[inline(always)] + pub fn invei3(&mut self) -> INVEI3_W { + INVEI3_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u16) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Event Control\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [evctrl](index.html) module"] +pub struct EVCTRL_SPEC; +impl crate::RegisterSpec for EVCTRL_SPEC { + type Ux = u16; +} +#[doc = "`read()` method returns [evctrl::R](R) reader structure"] +impl crate::Readable for EVCTRL_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [evctrl::W](W) writer structure"] +impl crate::Writable for EVCTRL_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets EVCTRL to value 0"] +impl crate::Resettable for EVCTRL_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/ac/intenclr.rs b/src/ac/intenclr.rs new file mode 100644 index 0000000..e63f37c --- /dev/null +++ b/src/ac/intenclr.rs @@ -0,0 +1,342 @@ +#[doc = "Register `INTENCLR` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `INTENCLR` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `COMP0` reader - Comparator 0 Interrupt Enable"] +pub struct COMP0_R(crate::FieldReader); +impl COMP0_R { + pub(crate) fn new(bits: bool) -> Self { + COMP0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP0` writer - Comparator 0 Interrupt Enable"] +pub struct COMP0_W<'a> { + w: &'a mut W, +} +impl<'a> COMP0_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 `COMP1` reader - Comparator 1 Interrupt Enable"] +pub struct COMP1_R(crate::FieldReader); +impl COMP1_R { + pub(crate) fn new(bits: bool) -> Self { + COMP1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP1` writer - Comparator 1 Interrupt Enable"] +pub struct COMP1_W<'a> { + w: &'a mut W, +} +impl<'a> COMP1_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 `COMP2` reader - Comparator 2 Interrupt Enable"] +pub struct COMP2_R(crate::FieldReader); +impl COMP2_R { + pub(crate) fn new(bits: bool) -> Self { + COMP2_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP2_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP2` writer - Comparator 2 Interrupt Enable"] +pub struct COMP2_W<'a> { + w: &'a mut W, +} +impl<'a> COMP2_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 `COMP3` reader - Comparator 3 Interrupt Enable"] +pub struct COMP3_R(crate::FieldReader); +impl COMP3_R { + pub(crate) fn new(bits: bool) -> Self { + COMP3_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP3_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP3` writer - Comparator 3 Interrupt Enable"] +pub struct COMP3_W<'a> { + w: &'a mut W, +} +impl<'a> COMP3_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 `WIN0` reader - Window 0 Interrupt Enable"] +pub struct WIN0_R(crate::FieldReader); +impl WIN0_R { + pub(crate) fn new(bits: bool) -> Self { + WIN0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WIN0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WIN0` writer - Window 0 Interrupt Enable"] +pub struct WIN0_W<'a> { + w: &'a mut W, +} +impl<'a> WIN0_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 `WIN1` reader - Window 1 Interrupt Enable"] +pub struct WIN1_R(crate::FieldReader); +impl WIN1_R { + pub(crate) fn new(bits: bool) -> Self { + WIN1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WIN1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WIN1` writer - Window 1 Interrupt Enable"] +pub struct WIN1_W<'a> { + w: &'a mut W, +} +impl<'a> WIN1_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 - Comparator 0 Interrupt Enable"] + #[inline(always)] + pub fn comp0(&self) -> COMP0_R { + COMP0_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Comparator 1 Interrupt Enable"] + #[inline(always)] + pub fn comp1(&self) -> COMP1_R { + COMP1_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Comparator 2 Interrupt Enable"] + #[inline(always)] + pub fn comp2(&self) -> COMP2_R { + COMP2_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - Comparator 3 Interrupt Enable"] + #[inline(always)] + pub fn comp3(&self) -> COMP3_R { + COMP3_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 4 - Window 0 Interrupt Enable"] + #[inline(always)] + pub fn win0(&self) -> WIN0_R { + WIN0_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - Window 1 Interrupt Enable"] + #[inline(always)] + pub fn win1(&self) -> WIN1_R { + WIN1_R::new(((self.bits >> 5) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Comparator 0 Interrupt Enable"] + #[inline(always)] + pub fn comp0(&mut self) -> COMP0_W { + COMP0_W { w: self } + } + #[doc = "Bit 1 - Comparator 1 Interrupt Enable"] + #[inline(always)] + pub fn comp1(&mut self) -> COMP1_W { + COMP1_W { w: self } + } + #[doc = "Bit 2 - Comparator 2 Interrupt Enable"] + #[inline(always)] + pub fn comp2(&mut self) -> COMP2_W { + COMP2_W { w: self } + } + #[doc = "Bit 3 - Comparator 3 Interrupt Enable"] + #[inline(always)] + pub fn comp3(&mut self) -> COMP3_W { + COMP3_W { w: self } + } + #[doc = "Bit 4 - Window 0 Interrupt Enable"] + #[inline(always)] + pub fn win0(&mut self) -> WIN0_W { + WIN0_W { w: self } + } + #[doc = "Bit 5 - Window 1 Interrupt Enable"] + #[inline(always)] + pub fn win1(&mut self) -> WIN1_W { + WIN1_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/ac/intenset.rs b/src/ac/intenset.rs new file mode 100644 index 0000000..05ad287 --- /dev/null +++ b/src/ac/intenset.rs @@ -0,0 +1,342 @@ +#[doc = "Register `INTENSET` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `INTENSET` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `COMP0` reader - Comparator 0 Interrupt Enable"] +pub struct COMP0_R(crate::FieldReader); +impl COMP0_R { + pub(crate) fn new(bits: bool) -> Self { + COMP0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP0` writer - Comparator 0 Interrupt Enable"] +pub struct COMP0_W<'a> { + w: &'a mut W, +} +impl<'a> COMP0_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 `COMP1` reader - Comparator 1 Interrupt Enable"] +pub struct COMP1_R(crate::FieldReader); +impl COMP1_R { + pub(crate) fn new(bits: bool) -> Self { + COMP1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP1` writer - Comparator 1 Interrupt Enable"] +pub struct COMP1_W<'a> { + w: &'a mut W, +} +impl<'a> COMP1_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 `COMP2` reader - Comparator 2 Interrupt Enable"] +pub struct COMP2_R(crate::FieldReader); +impl COMP2_R { + pub(crate) fn new(bits: bool) -> Self { + COMP2_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP2_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP2` writer - Comparator 2 Interrupt Enable"] +pub struct COMP2_W<'a> { + w: &'a mut W, +} +impl<'a> COMP2_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 `COMP3` reader - Comparator 3 Interrupt Enable"] +pub struct COMP3_R(crate::FieldReader); +impl COMP3_R { + pub(crate) fn new(bits: bool) -> Self { + COMP3_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP3_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP3` writer - Comparator 3 Interrupt Enable"] +pub struct COMP3_W<'a> { + w: &'a mut W, +} +impl<'a> COMP3_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 `WIN0` reader - Window 0 Interrupt Enable"] +pub struct WIN0_R(crate::FieldReader); +impl WIN0_R { + pub(crate) fn new(bits: bool) -> Self { + WIN0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WIN0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WIN0` writer - Window 0 Interrupt Enable"] +pub struct WIN0_W<'a> { + w: &'a mut W, +} +impl<'a> WIN0_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 `WIN1` reader - Window 1 Interrupt Enable"] +pub struct WIN1_R(crate::FieldReader); +impl WIN1_R { + pub(crate) fn new(bits: bool) -> Self { + WIN1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WIN1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WIN1` writer - Window 1 Interrupt Enable"] +pub struct WIN1_W<'a> { + w: &'a mut W, +} +impl<'a> WIN1_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 - Comparator 0 Interrupt Enable"] + #[inline(always)] + pub fn comp0(&self) -> COMP0_R { + COMP0_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Comparator 1 Interrupt Enable"] + #[inline(always)] + pub fn comp1(&self) -> COMP1_R { + COMP1_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Comparator 2 Interrupt Enable"] + #[inline(always)] + pub fn comp2(&self) -> COMP2_R { + COMP2_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - Comparator 3 Interrupt Enable"] + #[inline(always)] + pub fn comp3(&self) -> COMP3_R { + COMP3_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 4 - Window 0 Interrupt Enable"] + #[inline(always)] + pub fn win0(&self) -> WIN0_R { + WIN0_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - Window 1 Interrupt Enable"] + #[inline(always)] + pub fn win1(&self) -> WIN1_R { + WIN1_R::new(((self.bits >> 5) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Comparator 0 Interrupt Enable"] + #[inline(always)] + pub fn comp0(&mut self) -> COMP0_W { + COMP0_W { w: self } + } + #[doc = "Bit 1 - Comparator 1 Interrupt Enable"] + #[inline(always)] + pub fn comp1(&mut self) -> COMP1_W { + COMP1_W { w: self } + } + #[doc = "Bit 2 - Comparator 2 Interrupt Enable"] + #[inline(always)] + pub fn comp2(&mut self) -> COMP2_W { + COMP2_W { w: self } + } + #[doc = "Bit 3 - Comparator 3 Interrupt Enable"] + #[inline(always)] + pub fn comp3(&mut self) -> COMP3_W { + COMP3_W { w: self } + } + #[doc = "Bit 4 - Window 0 Interrupt Enable"] + #[inline(always)] + pub fn win0(&mut self) -> WIN0_W { + WIN0_W { w: self } + } + #[doc = "Bit 5 - Window 1 Interrupt Enable"] + #[inline(always)] + pub fn win1(&mut self) -> WIN1_W { + WIN1_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/ac/intflag.rs b/src/ac/intflag.rs new file mode 100644 index 0000000..e004980 --- /dev/null +++ b/src/ac/intflag.rs @@ -0,0 +1,342 @@ +#[doc = "Register `INTFLAG` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `INTFLAG` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `COMP0` reader - Comparator 0"] +pub struct COMP0_R(crate::FieldReader); +impl COMP0_R { + pub(crate) fn new(bits: bool) -> Self { + COMP0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP0` writer - Comparator 0"] +pub struct COMP0_W<'a> { + w: &'a mut W, +} +impl<'a> COMP0_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 `COMP1` reader - Comparator 1"] +pub struct COMP1_R(crate::FieldReader); +impl COMP1_R { + pub(crate) fn new(bits: bool) -> Self { + COMP1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP1` writer - Comparator 1"] +pub struct COMP1_W<'a> { + w: &'a mut W, +} +impl<'a> COMP1_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 `COMP2` reader - Comparator 2"] +pub struct COMP2_R(crate::FieldReader); +impl COMP2_R { + pub(crate) fn new(bits: bool) -> Self { + COMP2_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP2_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP2` writer - Comparator 2"] +pub struct COMP2_W<'a> { + w: &'a mut W, +} +impl<'a> COMP2_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 `COMP3` reader - Comparator 3"] +pub struct COMP3_R(crate::FieldReader); +impl COMP3_R { + pub(crate) fn new(bits: bool) -> Self { + COMP3_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMP3_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMP3` writer - Comparator 3"] +pub struct COMP3_W<'a> { + w: &'a mut W, +} +impl<'a> COMP3_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 `WIN0` reader - Window 0"] +pub struct WIN0_R(crate::FieldReader); +impl WIN0_R { + pub(crate) fn new(bits: bool) -> Self { + WIN0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WIN0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WIN0` writer - Window 0"] +pub struct WIN0_W<'a> { + w: &'a mut W, +} +impl<'a> WIN0_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 `WIN1` reader - Window 1"] +pub struct WIN1_R(crate::FieldReader); +impl WIN1_R { + pub(crate) fn new(bits: bool) -> Self { + WIN1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WIN1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WIN1` writer - Window 1"] +pub struct WIN1_W<'a> { + w: &'a mut W, +} +impl<'a> WIN1_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 - Comparator 0"] + #[inline(always)] + pub fn comp0(&self) -> COMP0_R { + COMP0_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Comparator 1"] + #[inline(always)] + pub fn comp1(&self) -> COMP1_R { + COMP1_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Comparator 2"] + #[inline(always)] + pub fn comp2(&self) -> COMP2_R { + COMP2_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - Comparator 3"] + #[inline(always)] + pub fn comp3(&self) -> COMP3_R { + COMP3_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 4 - Window 0"] + #[inline(always)] + pub fn win0(&self) -> WIN0_R { + WIN0_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - Window 1"] + #[inline(always)] + pub fn win1(&self) -> WIN1_R { + WIN1_R::new(((self.bits >> 5) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Comparator 0"] + #[inline(always)] + pub fn comp0(&mut self) -> COMP0_W { + COMP0_W { w: self } + } + #[doc = "Bit 1 - Comparator 1"] + #[inline(always)] + pub fn comp1(&mut self) -> COMP1_W { + COMP1_W { w: self } + } + #[doc = "Bit 2 - Comparator 2"] + #[inline(always)] + pub fn comp2(&mut self) -> COMP2_W { + COMP2_W { w: self } + } + #[doc = "Bit 3 - Comparator 3"] + #[inline(always)] + pub fn comp3(&mut self) -> COMP3_W { + COMP3_W { w: self } + } + #[doc = "Bit 4 - Window 0"] + #[inline(always)] + pub fn win0(&mut self) -> WIN0_W { + WIN0_W { w: self } + } + #[doc = "Bit 5 - Window 1"] + #[inline(always)] + pub fn win1(&mut self) -> WIN1_W { + WIN1_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/ac/scaler.rs b/src/ac/scaler.rs new file mode 100644 index 0000000..866a772 --- /dev/null +++ b/src/ac/scaler.rs @@ -0,0 +1,103 @@ +#[doc = "Register `SCALER[%s]` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `SCALER[%s]` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `VALUE` reader - Scaler Value"] +pub struct VALUE_R(crate::FieldReader); +impl VALUE_R { + pub(crate) fn new(bits: u8) -> Self { + VALUE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for VALUE_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `VALUE` writer - Scaler Value"] +pub struct VALUE_W<'a> { + w: &'a mut W, +} +impl<'a> VALUE_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 + } +} +impl R { + #[doc = "Bits 0:5 - Scaler Value"] + #[inline(always)] + pub fn value(&self) -> VALUE_R { + VALUE_R::new((self.bits & 0x3f) as u8) + } +} +impl W { + #[doc = "Bits 0:5 - Scaler Value"] + #[inline(always)] + pub fn value(&mut self) -> VALUE_W { + VALUE_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 = "Scaler n\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 [scaler](index.html) module"] +pub struct SCALER_SPEC; +impl crate::RegisterSpec for SCALER_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [scaler::R](R) reader structure"] +impl crate::Readable for SCALER_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [scaler::W](W) writer structure"] +impl crate::Writable for SCALER_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets SCALER[%s] +to value 0"] +impl crate::Resettable for SCALER_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/ac/statusa.rs b/src/ac/statusa.rs new file mode 100644 index 0000000..2fe4391 --- /dev/null +++ b/src/ac/statusa.rs @@ -0,0 +1,231 @@ +#[doc = "Register `STATUSA` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Field `STATE0` reader - Comparator 0 Current State"] +pub struct STATE0_R(crate::FieldReader); +impl STATE0_R { + pub(crate) fn new(bits: bool) -> Self { + STATE0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for STATE0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `STATE1` reader - Comparator 1 Current State"] +pub struct STATE1_R(crate::FieldReader); +impl STATE1_R { + pub(crate) fn new(bits: bool) -> Self { + STATE1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for STATE1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `STATE2` reader - Comparator 2 Current State"] +pub struct STATE2_R(crate::FieldReader); +impl STATE2_R { + pub(crate) fn new(bits: bool) -> Self { + STATE2_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for STATE2_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `STATE3` reader - Comparator 3 Current State"] +pub struct STATE3_R(crate::FieldReader); +impl STATE3_R { + pub(crate) fn new(bits: bool) -> Self { + STATE3_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for STATE3_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Window 0 Current State\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum WSTATE0_A { + #[doc = "0: Signal is above window"] + ABOVE = 0, + #[doc = "1: Signal is inside window"] + INSIDE = 1, + #[doc = "2: Signal is below window"] + BELOW = 2, +} +impl From for u8 { + #[inline(always)] + fn from(variant: WSTATE0_A) -> Self { + variant as _ + } +} +#[doc = "Field `WSTATE0` reader - Window 0 Current State"] +pub struct WSTATE0_R(crate::FieldReader); +impl WSTATE0_R { + pub(crate) fn new(bits: u8) -> Self { + WSTATE0_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(WSTATE0_A::ABOVE), + 1 => Some(WSTATE0_A::INSIDE), + 2 => Some(WSTATE0_A::BELOW), + _ => None, + } + } + #[doc = "Checks if the value of the field is `ABOVE`"] + #[inline(always)] + pub fn is_above(&self) -> bool { + **self == WSTATE0_A::ABOVE + } + #[doc = "Checks if the value of the field is `INSIDE`"] + #[inline(always)] + pub fn is_inside(&self) -> bool { + **self == WSTATE0_A::INSIDE + } + #[doc = "Checks if the value of the field is `BELOW`"] + #[inline(always)] + pub fn is_below(&self) -> bool { + **self == WSTATE0_A::BELOW + } +} +impl core::ops::Deref for WSTATE0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Window 1 Current State\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum WSTATE1_A { + #[doc = "0: Signal is above window"] + ABOVE = 0, + #[doc = "1: Signal is inside window"] + INSIDE = 1, + #[doc = "2: Signal is below window"] + BELOW = 2, +} +impl From for u8 { + #[inline(always)] + fn from(variant: WSTATE1_A) -> Self { + variant as _ + } +} +#[doc = "Field `WSTATE1` reader - Window 1 Current State"] +pub struct WSTATE1_R(crate::FieldReader); +impl WSTATE1_R { + pub(crate) fn new(bits: u8) -> Self { + WSTATE1_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option { + match self.bits { + 0 => Some(WSTATE1_A::ABOVE), + 1 => Some(WSTATE1_A::INSIDE), + 2 => Some(WSTATE1_A::BELOW), + _ => None, + } + } + #[doc = "Checks if the value of the field is `ABOVE`"] + #[inline(always)] + pub fn is_above(&self) -> bool { + **self == WSTATE1_A::ABOVE + } + #[doc = "Checks if the value of the field is `INSIDE`"] + #[inline(always)] + pub fn is_inside(&self) -> bool { + **self == WSTATE1_A::INSIDE + } + #[doc = "Checks if the value of the field is `BELOW`"] + #[inline(always)] + pub fn is_below(&self) -> bool { + **self == WSTATE1_A::BELOW + } +} +impl core::ops::Deref for WSTATE1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bit 0 - Comparator 0 Current State"] + #[inline(always)] + pub fn state0(&self) -> STATE0_R { + STATE0_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Comparator 1 Current State"] + #[inline(always)] + pub fn state1(&self) -> STATE1_R { + STATE1_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Comparator 2 Current State"] + #[inline(always)] + pub fn state2(&self) -> STATE2_R { + STATE2_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - Comparator 3 Current State"] + #[inline(always)] + pub fn state3(&self) -> STATE3_R { + STATE3_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bits 4:5 - Window 0 Current State"] + #[inline(always)] + pub fn wstate0(&self) -> WSTATE0_R { + WSTATE0_R::new(((self.bits >> 4) & 0x03) as u8) + } + #[doc = "Bits 6:7 - Window 1 Current State"] + #[inline(always)] + pub fn wstate1(&self) -> WSTATE1_R { + WSTATE1_R::new(((self.bits >> 6) & 0x03) as u8) + } +} +#[doc = "Status A\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 [statusa](index.html) module"] +pub struct STATUSA_SPEC; +impl crate::RegisterSpec for STATUSA_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [statusa::R](R) reader structure"] +impl crate::Readable for STATUSA_SPEC { + type Reader = R; +} +#[doc = "`reset()` method sets STATUSA to value 0"] +impl crate::Resettable for STATUSA_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/ac/statusb.rs b/src/ac/statusb.rs new file mode 100644 index 0000000..c6baeb3 --- /dev/null +++ b/src/ac/statusb.rs @@ -0,0 +1,109 @@ +#[doc = "Register `STATUSB` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Field `READY0` reader - Comparator 0 Ready"] +pub struct READY0_R(crate::FieldReader); +impl READY0_R { + pub(crate) fn new(bits: bool) -> Self { + READY0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for READY0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `READY1` reader - Comparator 1 Ready"] +pub struct READY1_R(crate::FieldReader); +impl READY1_R { + pub(crate) fn new(bits: bool) -> Self { + READY1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for READY1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `READY2` reader - Comparator 2 Ready"] +pub struct READY2_R(crate::FieldReader); +impl READY2_R { + pub(crate) fn new(bits: bool) -> Self { + READY2_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for READY2_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `READY3` reader - Comparator 3 Ready"] +pub struct READY3_R(crate::FieldReader); +impl READY3_R { + pub(crate) fn new(bits: bool) -> Self { + READY3_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for READY3_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bit 0 - Comparator 0 Ready"] + #[inline(always)] + pub fn ready0(&self) -> READY0_R { + READY0_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Comparator 1 Ready"] + #[inline(always)] + pub fn ready1(&self) -> READY1_R { + READY1_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Comparator 2 Ready"] + #[inline(always)] + pub fn ready2(&self) -> READY2_R { + READY2_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - Comparator 3 Ready"] + #[inline(always)] + pub fn ready3(&self) -> READY3_R { + READY3_R::new(((self.bits >> 3) & 0x01) != 0) + } +} +#[doc = "Status B\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 [statusb](index.html) module"] +pub struct STATUSB_SPEC; +impl crate::RegisterSpec for STATUSB_SPEC { + type Ux = u8; +} +#[doc = "`read()` method returns [statusb::R](R) reader structure"] +impl crate::Readable for STATUSB_SPEC { + type Reader = R; +} +#[doc = "`reset()` method sets STATUSB to value 0"] +impl crate::Resettable for STATUSB_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/ac/syncbusy.rs b/src/ac/syncbusy.rs new file mode 100644 index 0000000..5b7078f --- /dev/null +++ b/src/ac/syncbusy.rs @@ -0,0 +1,166 @@ +#[doc = "Register `SYNCBUSY` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Field `SWRST` reader - Software Reset Synchronization Busy"] +pub struct SWRST_R(crate::FieldReader); +impl SWRST_R { + pub(crate) fn new(bits: bool) -> Self { + SWRST_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SWRST_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ENABLE` reader - Enable Synchronization Busy"] +pub struct ENABLE_R(crate::FieldReader); +impl ENABLE_R { + pub(crate) fn new(bits: bool) -> Self { + ENABLE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ENABLE_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINCTRL` reader - WINCTRL Synchronization Busy"] +pub struct WINCTRL_R(crate::FieldReader); +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; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPCTRL0` reader - COMPCTRL 0 Synchronization Busy"] +pub struct COMPCTRL0_R(crate::FieldReader); +impl COMPCTRL0_R { + pub(crate) fn new(bits: bool) -> Self { + COMPCTRL0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPCTRL0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPCTRL1` reader - COMPCTRL 1 Synchronization Busy"] +pub struct COMPCTRL1_R(crate::FieldReader); +impl COMPCTRL1_R { + pub(crate) fn new(bits: bool) -> Self { + COMPCTRL1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPCTRL1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPCTRL2` reader - COMPCTRL 2 Synchronization Busy"] +pub struct COMPCTRL2_R(crate::FieldReader); +impl COMPCTRL2_R { + pub(crate) fn new(bits: bool) -> Self { + COMPCTRL2_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPCTRL2_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `COMPCTRL3` reader - COMPCTRL 3 Synchronization Busy"] +pub struct COMPCTRL3_R(crate::FieldReader); +impl COMPCTRL3_R { + pub(crate) fn new(bits: bool) -> Self { + COMPCTRL3_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for COMPCTRL3_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bit 0 - Software Reset 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 - WINCTRL Synchronization Busy"] + #[inline(always)] + pub fn winctrl(&self) -> WINCTRL_R { + WINCTRL_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - COMPCTRL 0 Synchronization Busy"] + #[inline(always)] + pub fn compctrl0(&self) -> COMPCTRL0_R { + COMPCTRL0_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 4 - COMPCTRL 1 Synchronization Busy"] + #[inline(always)] + pub fn compctrl1(&self) -> COMPCTRL1_R { + COMPCTRL1_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bit 5 - COMPCTRL 2 Synchronization Busy"] + #[inline(always)] + pub fn compctrl2(&self) -> COMPCTRL2_R { + COMPCTRL2_R::new(((self.bits >> 5) & 0x01) != 0) + } + #[doc = "Bit 6 - COMPCTRL 3 Synchronization Busy"] + #[inline(always)] + pub fn compctrl3(&self) -> COMPCTRL3_R { + COMPCTRL3_R::new(((self.bits >> 6) & 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/ac/winctrl.rs b/src/ac/winctrl.rs new file mode 100644 index 0000000..6ebf768 --- /dev/null +++ b/src/ac/winctrl.rs @@ -0,0 +1,380 @@ +#[doc = "Register `WINCTRL` reader"] +pub struct R(crate::R); +impl core::ops::Deref for R { + type Target = crate::R; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From> for R { + #[inline(always)] + fn from(reader: crate::R) -> Self { + R(reader) + } +} +#[doc = "Register `WINCTRL` writer"] +pub struct W(crate::W); +impl core::ops::Deref for W { + type Target = crate::W; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From> for W { + #[inline(always)] + fn from(writer: crate::W) -> Self { + W(writer) + } +} +#[doc = "Field `WEN0` reader - Window 0 Mode Enable"] +pub struct WEN0_R(crate::FieldReader); +impl WEN0_R { + pub(crate) fn new(bits: bool) -> Self { + WEN0_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WEN0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WEN0` writer - Window 0 Mode Enable"] +pub struct WEN0_W<'a> { + w: &'a mut W, +} +impl<'a> WEN0_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 = "Window 0 Interrupt Selection\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum WINTSEL0_A { + #[doc = "0: Interrupt on signal above window"] + ABOVE = 0, + #[doc = "1: Interrupt on signal inside window"] + INSIDE = 1, + #[doc = "2: Interrupt on signal below window"] + BELOW = 2, + #[doc = "3: Interrupt on signal outside window"] + OUTSIDE = 3, +} +impl From for u8 { + #[inline(always)] + fn from(variant: WINTSEL0_A) -> Self { + variant as _ + } +} +#[doc = "Field `WINTSEL0` reader - Window 0 Interrupt Selection"] +pub struct WINTSEL0_R(crate::FieldReader); +impl WINTSEL0_R { + pub(crate) fn new(bits: u8) -> Self { + WINTSEL0_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> WINTSEL0_A { + match self.bits { + 0 => WINTSEL0_A::ABOVE, + 1 => WINTSEL0_A::INSIDE, + 2 => WINTSEL0_A::BELOW, + 3 => WINTSEL0_A::OUTSIDE, + _ => unreachable!(), + } + } + #[doc = "Checks if the value of the field is `ABOVE`"] + #[inline(always)] + pub fn is_above(&self) -> bool { + **self == WINTSEL0_A::ABOVE + } + #[doc = "Checks if the value of the field is `INSIDE`"] + #[inline(always)] + pub fn is_inside(&self) -> bool { + **self == WINTSEL0_A::INSIDE + } + #[doc = "Checks if the value of the field is `BELOW`"] + #[inline(always)] + pub fn is_below(&self) -> bool { + **self == WINTSEL0_A::BELOW + } + #[doc = "Checks if the value of the field is `OUTSIDE`"] + #[inline(always)] + pub fn is_outside(&self) -> bool { + **self == WINTSEL0_A::OUTSIDE + } +} +impl core::ops::Deref for WINTSEL0_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINTSEL0` writer - Window 0 Interrupt Selection"] +pub struct WINTSEL0_W<'a> { + w: &'a mut W, +} +impl<'a> WINTSEL0_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: WINTSEL0_A) -> &'a mut W { + self.bits(variant.into()) + } + #[doc = "Interrupt on signal above window"] + #[inline(always)] + pub fn above(self) -> &'a mut W { + self.variant(WINTSEL0_A::ABOVE) + } + #[doc = "Interrupt on signal inside window"] + #[inline(always)] + pub fn inside(self) -> &'a mut W { + self.variant(WINTSEL0_A::INSIDE) + } + #[doc = "Interrupt on signal below window"] + #[inline(always)] + pub fn below(self) -> &'a mut W { + self.variant(WINTSEL0_A::BELOW) + } + #[doc = "Interrupt on signal outside window"] + #[inline(always)] + pub fn outside(self) -> &'a mut W { + self.variant(WINTSEL0_A::OUTSIDE) + } + #[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 << 1)) | ((value as u8 & 0x03) << 1); + self.w + } +} +#[doc = "Field `WEN1` reader - Window 1 Mode Enable"] +pub struct WEN1_R(crate::FieldReader); +impl WEN1_R { + pub(crate) fn new(bits: bool) -> Self { + WEN1_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for WEN1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WEN1` writer - Window 1 Mode Enable"] +pub struct WEN1_W<'a> { + w: &'a mut W, +} +impl<'a> WEN1_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 = "Window 1 Interrupt Selection\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum WINTSEL1_A { + #[doc = "0: Interrupt on signal above window"] + ABOVE = 0, + #[doc = "1: Interrupt on signal inside window"] + INSIDE = 1, + #[doc = "2: Interrupt on signal below window"] + BELOW = 2, + #[doc = "3: Interrupt on signal outside window"] + OUTSIDE = 3, +} +impl From for u8 { + #[inline(always)] + fn from(variant: WINTSEL1_A) -> Self { + variant as _ + } +} +#[doc = "Field `WINTSEL1` reader - Window 1 Interrupt Selection"] +pub struct WINTSEL1_R(crate::FieldReader); +impl WINTSEL1_R { + pub(crate) fn new(bits: u8) -> Self { + WINTSEL1_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> WINTSEL1_A { + match self.bits { + 0 => WINTSEL1_A::ABOVE, + 1 => WINTSEL1_A::INSIDE, + 2 => WINTSEL1_A::BELOW, + 3 => WINTSEL1_A::OUTSIDE, + _ => unreachable!(), + } + } + #[doc = "Checks if the value of the field is `ABOVE`"] + #[inline(always)] + pub fn is_above(&self) -> bool { + **self == WINTSEL1_A::ABOVE + } + #[doc = "Checks if the value of the field is `INSIDE`"] + #[inline(always)] + pub fn is_inside(&self) -> bool { + **self == WINTSEL1_A::INSIDE + } + #[doc = "Checks if the value of the field is `BELOW`"] + #[inline(always)] + pub fn is_below(&self) -> bool { + **self == WINTSEL1_A::BELOW + } + #[doc = "Checks if the value of the field is `OUTSIDE`"] + #[inline(always)] + pub fn is_outside(&self) -> bool { + **self == WINTSEL1_A::OUTSIDE + } +} +impl core::ops::Deref for WINTSEL1_R { + type Target = crate::FieldReader; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `WINTSEL1` writer - Window 1 Interrupt Selection"] +pub struct WINTSEL1_W<'a> { + w: &'a mut W, +} +impl<'a> WINTSEL1_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: WINTSEL1_A) -> &'a mut W { + self.bits(variant.into()) + } + #[doc = "Interrupt on signal above window"] + #[inline(always)] + pub fn above(self) -> &'a mut W { + self.variant(WINTSEL1_A::ABOVE) + } + #[doc = "Interrupt on signal inside window"] + #[inline(always)] + pub fn inside(self) -> &'a mut W { + self.variant(WINTSEL1_A::INSIDE) + } + #[doc = "Interrupt on signal below window"] + #[inline(always)] + pub fn below(self) -> &'a mut W { + self.variant(WINTSEL1_A::BELOW) + } + #[doc = "Interrupt on signal outside window"] + #[inline(always)] + pub fn outside(self) -> &'a mut W { + self.variant(WINTSEL1_A::OUTSIDE) + } + #[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 << 5)) | ((value as u8 & 0x03) << 5); + self.w + } +} +impl R { + #[doc = "Bit 0 - Window 0 Mode Enable"] + #[inline(always)] + pub fn wen0(&self) -> WEN0_R { + WEN0_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bits 1:2 - Window 0 Interrupt Selection"] + #[inline(always)] + pub fn wintsel0(&self) -> WINTSEL0_R { + WINTSEL0_R::new(((self.bits >> 1) & 0x03) as u8) + } + #[doc = "Bit 4 - Window 1 Mode Enable"] + #[inline(always)] + pub fn wen1(&self) -> WEN1_R { + WEN1_R::new(((self.bits >> 4) & 0x01) != 0) + } + #[doc = "Bits 5:6 - Window 1 Interrupt Selection"] + #[inline(always)] + pub fn wintsel1(&self) -> WINTSEL1_R { + WINTSEL1_R::new(((self.bits >> 5) & 0x03) as u8) + } +} +impl W { + #[doc = "Bit 0 - Window 0 Mode Enable"] + #[inline(always)] + pub fn wen0(&mut self) -> WEN0_W { + WEN0_W { w: self } + } + #[doc = "Bits 1:2 - Window 0 Interrupt Selection"] + #[inline(always)] + pub fn wintsel0(&mut self) -> WINTSEL0_W { + WINTSEL0_W { w: self } + } + #[doc = "Bit 4 - Window 1 Mode Enable"] + #[inline(always)] + pub fn wen1(&mut self) -> WEN1_W { + WEN1_W { w: self } + } + #[doc = "Bits 5:6 - Window 1 Interrupt Selection"] + #[inline(always)] + pub fn wintsel1(&mut self) -> WINTSEL1_W { + WINTSEL1_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 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 + } +} -- cgit v1.2.3-70-g09d2