Initial commit

This commit is contained in:
Thomas Klaehn
2021-06-04 07:58:05 +02:00
commit 060cfea264
805 changed files with 204833 additions and 0 deletions

151
src/comp/enable.rs Normal file
View File

@@ -0,0 +1,151 @@
#[doc = "Register `ENABLE` reader"]
pub struct R(crate::R<ENABLE_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<ENABLE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<ENABLE_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<ENABLE_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `ENABLE` writer"]
pub struct W(crate::W<ENABLE_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<ENABLE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<ENABLE_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<ENABLE_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Enable or disable COMP\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum ENABLE_A {
#[doc = "0: Disable"]
DISABLED = 0,
#[doc = "2: Enable"]
ENABLED = 2,
}
impl From<ENABLE_A> for u8 {
#[inline(always)]
fn from(variant: ENABLE_A) -> Self {
variant as _
}
}
#[doc = "Field `ENABLE` reader - Enable or disable COMP"]
pub struct ENABLE_R(crate::FieldReader<u8, ENABLE_A>);
impl ENABLE_R {
pub(crate) fn new(bits: u8) -> Self {
ENABLE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<ENABLE_A> {
match self.bits {
0 => Some(ENABLE_A::DISABLED),
2 => Some(ENABLE_A::ENABLED),
_ => None,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == ENABLE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == ENABLE_A::ENABLED
}
}
impl core::ops::Deref for ENABLE_R {
type Target = crate::FieldReader<u8, ENABLE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `ENABLE` writer - Enable or disable COMP"]
pub struct ENABLE_W<'a> {
w: &'a mut W,
}
impl<'a> ENABLE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ENABLE_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "Disable"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(ENABLE_A::DISABLED)
}
#[doc = "Enable"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(ENABLE_A::ENABLED)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
self.w
}
}
impl R {
#[doc = "Bits 0:1 - Enable or disable COMP"]
#[inline(always)]
pub fn enable(&self) -> ENABLE_R {
ENABLE_R::new((self.bits & 0x03) as u8)
}
}
impl W {
#[doc = "Bits 0:1 - Enable or disable COMP"]
#[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: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "COMP enable\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 [enable](index.html) module"]
pub struct ENABLE_SPEC;
impl crate::RegisterSpec for ENABLE_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [enable::R](R) reader structure"]
impl crate::Readable for ENABLE_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [enable::W](W) writer structure"]
impl crate::Writable for ENABLE_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets ENABLE to value 0"]
impl crate::Resettable for ENABLE_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

64
src/comp/events_cross.rs Normal file
View File

@@ -0,0 +1,64 @@
#[doc = "Register `EVENTS_CROSS` reader"]
pub struct R(crate::R<EVENTS_CROSS_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<EVENTS_CROSS_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<EVENTS_CROSS_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<EVENTS_CROSS_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `EVENTS_CROSS` writer"]
pub struct W(crate::W<EVENTS_CROSS_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<EVENTS_CROSS_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<EVENTS_CROSS_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<EVENTS_CROSS_SPEC>) -> Self {
W(writer)
}
}
impl W {
#[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 = "Downward or upward crossing\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 [events_cross](index.html) module"]
pub struct EVENTS_CROSS_SPEC;
impl crate::RegisterSpec for EVENTS_CROSS_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [events_cross::R](R) reader structure"]
impl crate::Readable for EVENTS_CROSS_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [events_cross::W](W) writer structure"]
impl crate::Writable for EVENTS_CROSS_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets EVENTS_CROSS to value 0"]
impl crate::Resettable for EVENTS_CROSS_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

64
src/comp/events_down.rs Normal file
View File

@@ -0,0 +1,64 @@
#[doc = "Register `EVENTS_DOWN` reader"]
pub struct R(crate::R<EVENTS_DOWN_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<EVENTS_DOWN_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<EVENTS_DOWN_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<EVENTS_DOWN_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `EVENTS_DOWN` writer"]
pub struct W(crate::W<EVENTS_DOWN_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<EVENTS_DOWN_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<EVENTS_DOWN_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<EVENTS_DOWN_SPEC>) -> Self {
W(writer)
}
}
impl W {
#[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 = "Downward crossing\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 [events_down](index.html) module"]
pub struct EVENTS_DOWN_SPEC;
impl crate::RegisterSpec for EVENTS_DOWN_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [events_down::R](R) reader structure"]
impl crate::Readable for EVENTS_DOWN_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [events_down::W](W) writer structure"]
impl crate::Writable for EVENTS_DOWN_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets EVENTS_DOWN to value 0"]
impl crate::Resettable for EVENTS_DOWN_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

64
src/comp/events_ready.rs Normal file
View File

@@ -0,0 +1,64 @@
#[doc = "Register `EVENTS_READY` reader"]
pub struct R(crate::R<EVENTS_READY_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<EVENTS_READY_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<EVENTS_READY_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<EVENTS_READY_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `EVENTS_READY` writer"]
pub struct W(crate::W<EVENTS_READY_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<EVENTS_READY_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<EVENTS_READY_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<EVENTS_READY_SPEC>) -> Self {
W(writer)
}
}
impl W {
#[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 = "COMP is ready and output is valid\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 [events_ready](index.html) module"]
pub struct EVENTS_READY_SPEC;
impl crate::RegisterSpec for EVENTS_READY_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [events_ready::R](R) reader structure"]
impl crate::Readable for EVENTS_READY_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [events_ready::W](W) writer structure"]
impl crate::Writable for EVENTS_READY_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets EVENTS_READY to value 0"]
impl crate::Resettable for EVENTS_READY_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

64
src/comp/events_up.rs Normal file
View File

@@ -0,0 +1,64 @@
#[doc = "Register `EVENTS_UP` reader"]
pub struct R(crate::R<EVENTS_UP_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<EVENTS_UP_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<EVENTS_UP_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<EVENTS_UP_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `EVENTS_UP` writer"]
pub struct W(crate::W<EVENTS_UP_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<EVENTS_UP_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<EVENTS_UP_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<EVENTS_UP_SPEC>) -> Self {
W(writer)
}
}
impl W {
#[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 = "Upward crossing\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 [events_up](index.html) module"]
pub struct EVENTS_UP_SPEC;
impl crate::RegisterSpec for EVENTS_UP_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [events_up::R](R) reader structure"]
impl crate::Readable for EVENTS_UP_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [events_up::W](W) writer structure"]
impl crate::Writable for EVENTS_UP_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets EVENTS_UP to value 0"]
impl crate::Resettable for EVENTS_UP_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

229
src/comp/extrefsel.rs Normal file
View File

@@ -0,0 +1,229 @@
#[doc = "Register `EXTREFSEL` reader"]
pub struct R(crate::R<EXTREFSEL_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<EXTREFSEL_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<EXTREFSEL_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<EXTREFSEL_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `EXTREFSEL` writer"]
pub struct W(crate::W<EXTREFSEL_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<EXTREFSEL_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<EXTREFSEL_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<EXTREFSEL_SPEC>) -> Self {
W(writer)
}
}
#[doc = "External analog reference select\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum EXTREFSEL_A {
#[doc = "0: Use AIN0 as external analog reference"]
ANALOGREFERENCE0 = 0,
#[doc = "1: Use AIN1 as external analog reference"]
ANALOGREFERENCE1 = 1,
#[doc = "2: Use AIN2 as external analog reference"]
ANALOGREFERENCE2 = 2,
#[doc = "3: Use AIN3 as external analog reference"]
ANALOGREFERENCE3 = 3,
#[doc = "4: Use AIN4 as external analog reference"]
ANALOGREFERENCE4 = 4,
#[doc = "5: Use AIN5 as external analog reference"]
ANALOGREFERENCE5 = 5,
#[doc = "6: Use AIN6 as external analog reference"]
ANALOGREFERENCE6 = 6,
#[doc = "7: Use AIN7 as external analog reference"]
ANALOGREFERENCE7 = 7,
}
impl From<EXTREFSEL_A> for u8 {
#[inline(always)]
fn from(variant: EXTREFSEL_A) -> Self {
variant as _
}
}
#[doc = "Field `EXTREFSEL` reader - External analog reference select"]
pub struct EXTREFSEL_R(crate::FieldReader<u8, EXTREFSEL_A>);
impl EXTREFSEL_R {
pub(crate) fn new(bits: u8) -> Self {
EXTREFSEL_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> EXTREFSEL_A {
match self.bits {
0 => EXTREFSEL_A::ANALOGREFERENCE0,
1 => EXTREFSEL_A::ANALOGREFERENCE1,
2 => EXTREFSEL_A::ANALOGREFERENCE2,
3 => EXTREFSEL_A::ANALOGREFERENCE3,
4 => EXTREFSEL_A::ANALOGREFERENCE4,
5 => EXTREFSEL_A::ANALOGREFERENCE5,
6 => EXTREFSEL_A::ANALOGREFERENCE6,
7 => EXTREFSEL_A::ANALOGREFERENCE7,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `ANALOGREFERENCE0`"]
#[inline(always)]
pub fn is_analog_reference0(&self) -> bool {
**self == EXTREFSEL_A::ANALOGREFERENCE0
}
#[doc = "Checks if the value of the field is `ANALOGREFERENCE1`"]
#[inline(always)]
pub fn is_analog_reference1(&self) -> bool {
**self == EXTREFSEL_A::ANALOGREFERENCE1
}
#[doc = "Checks if the value of the field is `ANALOGREFERENCE2`"]
#[inline(always)]
pub fn is_analog_reference2(&self) -> bool {
**self == EXTREFSEL_A::ANALOGREFERENCE2
}
#[doc = "Checks if the value of the field is `ANALOGREFERENCE3`"]
#[inline(always)]
pub fn is_analog_reference3(&self) -> bool {
**self == EXTREFSEL_A::ANALOGREFERENCE3
}
#[doc = "Checks if the value of the field is `ANALOGREFERENCE4`"]
#[inline(always)]
pub fn is_analog_reference4(&self) -> bool {
**self == EXTREFSEL_A::ANALOGREFERENCE4
}
#[doc = "Checks if the value of the field is `ANALOGREFERENCE5`"]
#[inline(always)]
pub fn is_analog_reference5(&self) -> bool {
**self == EXTREFSEL_A::ANALOGREFERENCE5
}
#[doc = "Checks if the value of the field is `ANALOGREFERENCE6`"]
#[inline(always)]
pub fn is_analog_reference6(&self) -> bool {
**self == EXTREFSEL_A::ANALOGREFERENCE6
}
#[doc = "Checks if the value of the field is `ANALOGREFERENCE7`"]
#[inline(always)]
pub fn is_analog_reference7(&self) -> bool {
**self == EXTREFSEL_A::ANALOGREFERENCE7
}
}
impl core::ops::Deref for EXTREFSEL_R {
type Target = crate::FieldReader<u8, EXTREFSEL_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `EXTREFSEL` writer - External analog reference select"]
pub struct EXTREFSEL_W<'a> {
w: &'a mut W,
}
impl<'a> EXTREFSEL_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: EXTREFSEL_A) -> &'a mut W {
self.bits(variant.into())
}
#[doc = "Use AIN0 as external analog reference"]
#[inline(always)]
pub fn analog_reference0(self) -> &'a mut W {
self.variant(EXTREFSEL_A::ANALOGREFERENCE0)
}
#[doc = "Use AIN1 as external analog reference"]
#[inline(always)]
pub fn analog_reference1(self) -> &'a mut W {
self.variant(EXTREFSEL_A::ANALOGREFERENCE1)
}
#[doc = "Use AIN2 as external analog reference"]
#[inline(always)]
pub fn analog_reference2(self) -> &'a mut W {
self.variant(EXTREFSEL_A::ANALOGREFERENCE2)
}
#[doc = "Use AIN3 as external analog reference"]
#[inline(always)]
pub fn analog_reference3(self) -> &'a mut W {
self.variant(EXTREFSEL_A::ANALOGREFERENCE3)
}
#[doc = "Use AIN4 as external analog reference"]
#[inline(always)]
pub fn analog_reference4(self) -> &'a mut W {
self.variant(EXTREFSEL_A::ANALOGREFERENCE4)
}
#[doc = "Use AIN5 as external analog reference"]
#[inline(always)]
pub fn analog_reference5(self) -> &'a mut W {
self.variant(EXTREFSEL_A::ANALOGREFERENCE5)
}
#[doc = "Use AIN6 as external analog reference"]
#[inline(always)]
pub fn analog_reference6(self) -> &'a mut W {
self.variant(EXTREFSEL_A::ANALOGREFERENCE6)
}
#[doc = "Use AIN7 as external analog reference"]
#[inline(always)]
pub fn analog_reference7(self) -> &'a mut W {
self.variant(EXTREFSEL_A::ANALOGREFERENCE7)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
self.w
}
}
impl R {
#[doc = "Bits 0:2 - External analog reference select"]
#[inline(always)]
pub fn extrefsel(&self) -> EXTREFSEL_R {
EXTREFSEL_R::new((self.bits & 0x07) as u8)
}
}
impl W {
#[doc = "Bits 0:2 - External analog reference select"]
#[inline(always)]
pub fn extrefsel(&mut self) -> EXTREFSEL_W {
EXTREFSEL_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 = "External reference select\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 [extrefsel](index.html) module"]
pub struct EXTREFSEL_SPEC;
impl crate::RegisterSpec for EXTREFSEL_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [extrefsel::R](R) reader structure"]
impl crate::Readable for EXTREFSEL_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [extrefsel::W](W) writer structure"]
impl crate::Writable for EXTREFSEL_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets EXTREFSEL to value 0"]
impl crate::Resettable for EXTREFSEL_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

159
src/comp/hyst.rs Normal file
View File

@@ -0,0 +1,159 @@
#[doc = "Register `HYST` reader"]
pub struct R(crate::R<HYST_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<HYST_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<HYST_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<HYST_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `HYST` writer"]
pub struct W(crate::W<HYST_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<HYST_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<HYST_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<HYST_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Comparator hysteresis\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HYST_A {
#[doc = "0: Comparator hysteresis disabled"]
NOHYST = 0,
#[doc = "1: Comparator hysteresis enabled"]
HYST50MV = 1,
}
impl From<HYST_A> for bool {
#[inline(always)]
fn from(variant: HYST_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `HYST` reader - Comparator hysteresis"]
pub struct HYST_R(crate::FieldReader<bool, HYST_A>);
impl HYST_R {
pub(crate) fn new(bits: bool) -> Self {
HYST_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> HYST_A {
match self.bits {
false => HYST_A::NOHYST,
true => HYST_A::HYST50MV,
}
}
#[doc = "Checks if the value of the field is `NOHYST`"]
#[inline(always)]
pub fn is_no_hyst(&self) -> bool {
**self == HYST_A::NOHYST
}
#[doc = "Checks if the value of the field is `HYST50MV`"]
#[inline(always)]
pub fn is_hyst50m_v(&self) -> bool {
**self == HYST_A::HYST50MV
}
}
impl core::ops::Deref for HYST_R {
type Target = crate::FieldReader<bool, HYST_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `HYST` writer - Comparator hysteresis"]
pub struct HYST_W<'a> {
w: &'a mut W,
}
impl<'a> HYST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: HYST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Comparator hysteresis disabled"]
#[inline(always)]
pub fn no_hyst(self) -> &'a mut W {
self.variant(HYST_A::NOHYST)
}
#[doc = "Comparator hysteresis enabled"]
#[inline(always)]
pub fn hyst50m_v(self) -> &'a mut W {
self.variant(HYST_A::HYST50MV)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
self.w
}
}
impl R {
#[doc = "Bit 0 - Comparator hysteresis"]
#[inline(always)]
pub fn hyst(&self) -> HYST_R {
HYST_R::new((self.bits & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Comparator hysteresis"]
#[inline(always)]
pub fn hyst(&mut self) -> HYST_W {
HYST_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 hysteresis enable\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 [hyst](index.html) module"]
pub struct HYST_SPEC;
impl crate::RegisterSpec for HYST_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [hyst::R](R) reader structure"]
impl crate::Readable for HYST_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [hyst::W](W) writer structure"]
impl crate::Writable for HYST_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets HYST to value 0"]
impl crate::Resettable for HYST_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

438
src/comp/inten.rs Normal file
View File

@@ -0,0 +1,438 @@
#[doc = "Register `INTEN` reader"]
pub struct R(crate::R<INTEN_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<INTEN_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<INTEN_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<INTEN_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `INTEN` writer"]
pub struct W(crate::W<INTEN_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<INTEN_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<INTEN_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<INTEN_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Enable or disable interrupt for READY event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum READY_A {
#[doc = "0: Disable"]
DISABLED = 0,
#[doc = "1: Enable"]
ENABLED = 1,
}
impl From<READY_A> for bool {
#[inline(always)]
fn from(variant: READY_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `READY` reader - Enable or disable interrupt for READY event"]
pub struct READY_R(crate::FieldReader<bool, READY_A>);
impl READY_R {
pub(crate) fn new(bits: bool) -> Self {
READY_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> READY_A {
match self.bits {
false => READY_A::DISABLED,
true => READY_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == READY_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == READY_A::ENABLED
}
}
impl core::ops::Deref for READY_R {
type Target = crate::FieldReader<bool, READY_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `READY` writer - Enable or disable interrupt for READY event"]
pub struct READY_W<'a> {
w: &'a mut W,
}
impl<'a> READY_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: READY_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(READY_A::DISABLED)
}
#[doc = "Enable"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(READY_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
self.w
}
}
#[doc = "Enable or disable interrupt for DOWN event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DOWN_A {
#[doc = "0: Disable"]
DISABLED = 0,
#[doc = "1: Enable"]
ENABLED = 1,
}
impl From<DOWN_A> for bool {
#[inline(always)]
fn from(variant: DOWN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `DOWN` reader - Enable or disable interrupt for DOWN event"]
pub struct DOWN_R(crate::FieldReader<bool, DOWN_A>);
impl DOWN_R {
pub(crate) fn new(bits: bool) -> Self {
DOWN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> DOWN_A {
match self.bits {
false => DOWN_A::DISABLED,
true => DOWN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == DOWN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == DOWN_A::ENABLED
}
}
impl core::ops::Deref for DOWN_R {
type Target = crate::FieldReader<bool, DOWN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `DOWN` writer - Enable or disable interrupt for DOWN event"]
pub struct DOWN_W<'a> {
w: &'a mut W,
}
impl<'a> DOWN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: DOWN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(DOWN_A::DISABLED)
}
#[doc = "Enable"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(DOWN_A::ENABLED)
}
#[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 = "Enable or disable interrupt for UP event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum UP_A {
#[doc = "0: Disable"]
DISABLED = 0,
#[doc = "1: Enable"]
ENABLED = 1,
}
impl From<UP_A> for bool {
#[inline(always)]
fn from(variant: UP_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `UP` reader - Enable or disable interrupt for UP event"]
pub struct UP_R(crate::FieldReader<bool, UP_A>);
impl UP_R {
pub(crate) fn new(bits: bool) -> Self {
UP_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> UP_A {
match self.bits {
false => UP_A::DISABLED,
true => UP_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == UP_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == UP_A::ENABLED
}
}
impl core::ops::Deref for UP_R {
type Target = crate::FieldReader<bool, UP_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `UP` writer - Enable or disable interrupt for UP event"]
pub struct UP_W<'a> {
w: &'a mut W,
}
impl<'a> UP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: UP_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(UP_A::DISABLED)
}
#[doc = "Enable"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(UP_A::ENABLED)
}
#[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 = "Enable or disable interrupt for CROSS event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CROSS_A {
#[doc = "0: Disable"]
DISABLED = 0,
#[doc = "1: Enable"]
ENABLED = 1,
}
impl From<CROSS_A> for bool {
#[inline(always)]
fn from(variant: CROSS_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `CROSS` reader - Enable or disable interrupt for CROSS event"]
pub struct CROSS_R(crate::FieldReader<bool, CROSS_A>);
impl CROSS_R {
pub(crate) fn new(bits: bool) -> Self {
CROSS_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> CROSS_A {
match self.bits {
false => CROSS_A::DISABLED,
true => CROSS_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == CROSS_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == CROSS_A::ENABLED
}
}
impl core::ops::Deref for CROSS_R {
type Target = crate::FieldReader<bool, CROSS_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CROSS` writer - Enable or disable interrupt for CROSS event"]
pub struct CROSS_W<'a> {
w: &'a mut W,
}
impl<'a> CROSS_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CROSS_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(CROSS_A::DISABLED)
}
#[doc = "Enable"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(CROSS_A::ENABLED)
}
#[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 u32 & 0x01) << 3);
self.w
}
}
impl R {
#[doc = "Bit 0 - Enable or disable interrupt for READY event"]
#[inline(always)]
pub fn ready(&self) -> READY_R {
READY_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - Enable or disable interrupt for DOWN event"]
#[inline(always)]
pub fn down(&self) -> DOWN_R {
DOWN_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - Enable or disable interrupt for UP event"]
#[inline(always)]
pub fn up(&self) -> UP_R {
UP_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Enable or disable interrupt for CROSS event"]
#[inline(always)]
pub fn cross(&self) -> CROSS_R {
CROSS_R::new(((self.bits >> 3) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Enable or disable interrupt for READY event"]
#[inline(always)]
pub fn ready(&mut self) -> READY_W {
READY_W { w: self }
}
#[doc = "Bit 1 - Enable or disable interrupt for DOWN event"]
#[inline(always)]
pub fn down(&mut self) -> DOWN_W {
DOWN_W { w: self }
}
#[doc = "Bit 2 - Enable or disable interrupt for UP event"]
#[inline(always)]
pub fn up(&mut self) -> UP_W {
UP_W { w: self }
}
#[doc = "Bit 3 - Enable or disable interrupt for CROSS event"]
#[inline(always)]
pub fn cross(&mut self) -> CROSS_W {
CROSS_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 = "Enable or disable interrupt\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 [inten](index.html) module"]
pub struct INTEN_SPEC;
impl crate::RegisterSpec for INTEN_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [inten::R](R) reader structure"]
impl crate::Readable for INTEN_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [inten::W](W) writer structure"]
impl crate::Writable for INTEN_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets INTEN to value 0"]
impl crate::Resettable for INTEN_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

466
src/comp/intenclr.rs Normal file
View File

@@ -0,0 +1,466 @@
#[doc = "Register `INTENCLR` reader"]
pub struct R(crate::R<INTENCLR_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<INTENCLR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<INTENCLR_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<INTENCLR_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `INTENCLR` writer"]
pub struct W(crate::W<INTENCLR_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<INTENCLR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<INTENCLR_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<INTENCLR_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Write '1' to Disable interrupt for READY event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum READY_A {
#[doc = "0: Read: Disabled"]
DISABLED = 0,
#[doc = "1: Read: Enabled"]
ENABLED = 1,
}
impl From<READY_A> for bool {
#[inline(always)]
fn from(variant: READY_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `READY` reader - Write '1' to Disable interrupt for READY event"]
pub struct READY_R(crate::FieldReader<bool, READY_A>);
impl READY_R {
pub(crate) fn new(bits: bool) -> Self {
READY_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> READY_A {
match self.bits {
false => READY_A::DISABLED,
true => READY_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == READY_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == READY_A::ENABLED
}
}
impl core::ops::Deref for READY_R {
type Target = crate::FieldReader<bool, READY_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Write '1' to Disable interrupt for READY event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum READY_AW {
#[doc = "1: Disable"]
CLEAR = 1,
}
impl From<READY_AW> for bool {
#[inline(always)]
fn from(variant: READY_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `READY` writer - Write '1' to Disable interrupt for READY event"]
pub struct READY_W<'a> {
w: &'a mut W,
}
impl<'a> READY_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: READY_AW) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(READY_AW::CLEAR)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
self.w
}
}
#[doc = "Write '1' to Disable interrupt for DOWN event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DOWN_A {
#[doc = "0: Read: Disabled"]
DISABLED = 0,
#[doc = "1: Read: Enabled"]
ENABLED = 1,
}
impl From<DOWN_A> for bool {
#[inline(always)]
fn from(variant: DOWN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `DOWN` reader - Write '1' to Disable interrupt for DOWN event"]
pub struct DOWN_R(crate::FieldReader<bool, DOWN_A>);
impl DOWN_R {
pub(crate) fn new(bits: bool) -> Self {
DOWN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> DOWN_A {
match self.bits {
false => DOWN_A::DISABLED,
true => DOWN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == DOWN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == DOWN_A::ENABLED
}
}
impl core::ops::Deref for DOWN_R {
type Target = crate::FieldReader<bool, DOWN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Write '1' to Disable interrupt for DOWN event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DOWN_AW {
#[doc = "1: Disable"]
CLEAR = 1,
}
impl From<DOWN_AW> for bool {
#[inline(always)]
fn from(variant: DOWN_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `DOWN` writer - Write '1' to Disable interrupt for DOWN event"]
pub struct DOWN_W<'a> {
w: &'a mut W,
}
impl<'a> DOWN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: DOWN_AW) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(DOWN_AW::CLEAR)
}
#[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 = "Write '1' to Disable interrupt for UP event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum UP_A {
#[doc = "0: Read: Disabled"]
DISABLED = 0,
#[doc = "1: Read: Enabled"]
ENABLED = 1,
}
impl From<UP_A> for bool {
#[inline(always)]
fn from(variant: UP_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `UP` reader - Write '1' to Disable interrupt for UP event"]
pub struct UP_R(crate::FieldReader<bool, UP_A>);
impl UP_R {
pub(crate) fn new(bits: bool) -> Self {
UP_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> UP_A {
match self.bits {
false => UP_A::DISABLED,
true => UP_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == UP_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == UP_A::ENABLED
}
}
impl core::ops::Deref for UP_R {
type Target = crate::FieldReader<bool, UP_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Write '1' to Disable interrupt for UP event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum UP_AW {
#[doc = "1: Disable"]
CLEAR = 1,
}
impl From<UP_AW> for bool {
#[inline(always)]
fn from(variant: UP_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `UP` writer - Write '1' to Disable interrupt for UP event"]
pub struct UP_W<'a> {
w: &'a mut W,
}
impl<'a> UP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: UP_AW) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(UP_AW::CLEAR)
}
#[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 = "Write '1' to Disable interrupt for CROSS event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CROSS_A {
#[doc = "0: Read: Disabled"]
DISABLED = 0,
#[doc = "1: Read: Enabled"]
ENABLED = 1,
}
impl From<CROSS_A> for bool {
#[inline(always)]
fn from(variant: CROSS_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `CROSS` reader - Write '1' to Disable interrupt for CROSS event"]
pub struct CROSS_R(crate::FieldReader<bool, CROSS_A>);
impl CROSS_R {
pub(crate) fn new(bits: bool) -> Self {
CROSS_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> CROSS_A {
match self.bits {
false => CROSS_A::DISABLED,
true => CROSS_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == CROSS_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == CROSS_A::ENABLED
}
}
impl core::ops::Deref for CROSS_R {
type Target = crate::FieldReader<bool, CROSS_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Write '1' to Disable interrupt for CROSS event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CROSS_AW {
#[doc = "1: Disable"]
CLEAR = 1,
}
impl From<CROSS_AW> for bool {
#[inline(always)]
fn from(variant: CROSS_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `CROSS` writer - Write '1' to Disable interrupt for CROSS event"]
pub struct CROSS_W<'a> {
w: &'a mut W,
}
impl<'a> CROSS_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CROSS_AW) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(CROSS_AW::CLEAR)
}
#[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 u32 & 0x01) << 3);
self.w
}
}
impl R {
#[doc = "Bit 0 - Write '1' to Disable interrupt for READY event"]
#[inline(always)]
pub fn ready(&self) -> READY_R {
READY_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - Write '1' to Disable interrupt for DOWN event"]
#[inline(always)]
pub fn down(&self) -> DOWN_R {
DOWN_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - Write '1' to Disable interrupt for UP event"]
#[inline(always)]
pub fn up(&self) -> UP_R {
UP_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Write '1' to Disable interrupt for CROSS event"]
#[inline(always)]
pub fn cross(&self) -> CROSS_R {
CROSS_R::new(((self.bits >> 3) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Write '1' to Disable interrupt for READY event"]
#[inline(always)]
pub fn ready(&mut self) -> READY_W {
READY_W { w: self }
}
#[doc = "Bit 1 - Write '1' to Disable interrupt for DOWN event"]
#[inline(always)]
pub fn down(&mut self) -> DOWN_W {
DOWN_W { w: self }
}
#[doc = "Bit 2 - Write '1' to Disable interrupt for UP event"]
#[inline(always)]
pub fn up(&mut self) -> UP_W {
UP_W { w: self }
}
#[doc = "Bit 3 - Write '1' to Disable interrupt for CROSS event"]
#[inline(always)]
pub fn cross(&mut self) -> CROSS_W {
CROSS_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 = "Disable interrupt\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 = u32;
}
#[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
}
}

466
src/comp/intenset.rs Normal file
View File

@@ -0,0 +1,466 @@
#[doc = "Register `INTENSET` reader"]
pub struct R(crate::R<INTENSET_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<INTENSET_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<INTENSET_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<INTENSET_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `INTENSET` writer"]
pub struct W(crate::W<INTENSET_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<INTENSET_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<INTENSET_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<INTENSET_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Write '1' to Enable interrupt for READY event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum READY_A {
#[doc = "0: Read: Disabled"]
DISABLED = 0,
#[doc = "1: Read: Enabled"]
ENABLED = 1,
}
impl From<READY_A> for bool {
#[inline(always)]
fn from(variant: READY_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `READY` reader - Write '1' to Enable interrupt for READY event"]
pub struct READY_R(crate::FieldReader<bool, READY_A>);
impl READY_R {
pub(crate) fn new(bits: bool) -> Self {
READY_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> READY_A {
match self.bits {
false => READY_A::DISABLED,
true => READY_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == READY_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == READY_A::ENABLED
}
}
impl core::ops::Deref for READY_R {
type Target = crate::FieldReader<bool, READY_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Write '1' to Enable interrupt for READY event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum READY_AW {
#[doc = "1: Enable"]
SET = 1,
}
impl From<READY_AW> for bool {
#[inline(always)]
fn from(variant: READY_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `READY` writer - Write '1' to Enable interrupt for READY event"]
pub struct READY_W<'a> {
w: &'a mut W,
}
impl<'a> READY_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: READY_AW) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Enable"]
#[inline(always)]
pub fn set(self) -> &'a mut W {
self.variant(READY_AW::SET)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
self.w
}
}
#[doc = "Write '1' to Enable interrupt for DOWN event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DOWN_A {
#[doc = "0: Read: Disabled"]
DISABLED = 0,
#[doc = "1: Read: Enabled"]
ENABLED = 1,
}
impl From<DOWN_A> for bool {
#[inline(always)]
fn from(variant: DOWN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `DOWN` reader - Write '1' to Enable interrupt for DOWN event"]
pub struct DOWN_R(crate::FieldReader<bool, DOWN_A>);
impl DOWN_R {
pub(crate) fn new(bits: bool) -> Self {
DOWN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> DOWN_A {
match self.bits {
false => DOWN_A::DISABLED,
true => DOWN_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == DOWN_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == DOWN_A::ENABLED
}
}
impl core::ops::Deref for DOWN_R {
type Target = crate::FieldReader<bool, DOWN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Write '1' to Enable interrupt for DOWN event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DOWN_AW {
#[doc = "1: Enable"]
SET = 1,
}
impl From<DOWN_AW> for bool {
#[inline(always)]
fn from(variant: DOWN_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `DOWN` writer - Write '1' to Enable interrupt for DOWN event"]
pub struct DOWN_W<'a> {
w: &'a mut W,
}
impl<'a> DOWN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: DOWN_AW) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Enable"]
#[inline(always)]
pub fn set(self) -> &'a mut W {
self.variant(DOWN_AW::SET)
}
#[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 = "Write '1' to Enable interrupt for UP event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum UP_A {
#[doc = "0: Read: Disabled"]
DISABLED = 0,
#[doc = "1: Read: Enabled"]
ENABLED = 1,
}
impl From<UP_A> for bool {
#[inline(always)]
fn from(variant: UP_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `UP` reader - Write '1' to Enable interrupt for UP event"]
pub struct UP_R(crate::FieldReader<bool, UP_A>);
impl UP_R {
pub(crate) fn new(bits: bool) -> Self {
UP_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> UP_A {
match self.bits {
false => UP_A::DISABLED,
true => UP_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == UP_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == UP_A::ENABLED
}
}
impl core::ops::Deref for UP_R {
type Target = crate::FieldReader<bool, UP_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Write '1' to Enable interrupt for UP event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum UP_AW {
#[doc = "1: Enable"]
SET = 1,
}
impl From<UP_AW> for bool {
#[inline(always)]
fn from(variant: UP_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `UP` writer - Write '1' to Enable interrupt for UP event"]
pub struct UP_W<'a> {
w: &'a mut W,
}
impl<'a> UP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: UP_AW) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Enable"]
#[inline(always)]
pub fn set(self) -> &'a mut W {
self.variant(UP_AW::SET)
}
#[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 = "Write '1' to Enable interrupt for CROSS event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CROSS_A {
#[doc = "0: Read: Disabled"]
DISABLED = 0,
#[doc = "1: Read: Enabled"]
ENABLED = 1,
}
impl From<CROSS_A> for bool {
#[inline(always)]
fn from(variant: CROSS_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `CROSS` reader - Write '1' to Enable interrupt for CROSS event"]
pub struct CROSS_R(crate::FieldReader<bool, CROSS_A>);
impl CROSS_R {
pub(crate) fn new(bits: bool) -> Self {
CROSS_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> CROSS_A {
match self.bits {
false => CROSS_A::DISABLED,
true => CROSS_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == CROSS_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == CROSS_A::ENABLED
}
}
impl core::ops::Deref for CROSS_R {
type Target = crate::FieldReader<bool, CROSS_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Write '1' to Enable interrupt for CROSS event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CROSS_AW {
#[doc = "1: Enable"]
SET = 1,
}
impl From<CROSS_AW> for bool {
#[inline(always)]
fn from(variant: CROSS_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `CROSS` writer - Write '1' to Enable interrupt for CROSS event"]
pub struct CROSS_W<'a> {
w: &'a mut W,
}
impl<'a> CROSS_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CROSS_AW) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Enable"]
#[inline(always)]
pub fn set(self) -> &'a mut W {
self.variant(CROSS_AW::SET)
}
#[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 u32 & 0x01) << 3);
self.w
}
}
impl R {
#[doc = "Bit 0 - Write '1' to Enable interrupt for READY event"]
#[inline(always)]
pub fn ready(&self) -> READY_R {
READY_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - Write '1' to Enable interrupt for DOWN event"]
#[inline(always)]
pub fn down(&self) -> DOWN_R {
DOWN_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - Write '1' to Enable interrupt for UP event"]
#[inline(always)]
pub fn up(&self) -> UP_R {
UP_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Write '1' to Enable interrupt for CROSS event"]
#[inline(always)]
pub fn cross(&self) -> CROSS_R {
CROSS_R::new(((self.bits >> 3) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Write '1' to Enable interrupt for READY event"]
#[inline(always)]
pub fn ready(&mut self) -> READY_W {
READY_W { w: self }
}
#[doc = "Bit 1 - Write '1' to Enable interrupt for DOWN event"]
#[inline(always)]
pub fn down(&mut self) -> DOWN_W {
DOWN_W { w: self }
}
#[doc = "Bit 2 - Write '1' to Enable interrupt for UP event"]
#[inline(always)]
pub fn up(&mut self) -> UP_W {
UP_W { w: self }
}
#[doc = "Bit 3 - Write '1' to Enable interrupt for CROSS event"]
#[inline(always)]
pub fn cross(&mut self) -> CROSS_W {
CROSS_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 = "Enable interrupt\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 = u32;
}
#[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
}
}

177
src/comp/isource.rs Normal file
View File

@@ -0,0 +1,177 @@
#[doc = "Register `ISOURCE` reader"]
pub struct R(crate::R<ISOURCE_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<ISOURCE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<ISOURCE_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<ISOURCE_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `ISOURCE` writer"]
pub struct W(crate::W<ISOURCE_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<ISOURCE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<ISOURCE_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<ISOURCE_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Comparator hysteresis\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum ISOURCE_A {
#[doc = "0: Current source disabled"]
OFF = 0,
#[doc = "1: Current source enabled (+/- 2.5 uA)"]
IEN2MA5 = 1,
#[doc = "2: Current source enabled (+/- 5 uA)"]
IEN5MA = 2,
#[doc = "3: Current source enabled (+/- 10 uA)"]
IEN10MA = 3,
}
impl From<ISOURCE_A> for u8 {
#[inline(always)]
fn from(variant: ISOURCE_A) -> Self {
variant as _
}
}
#[doc = "Field `ISOURCE` reader - Comparator hysteresis"]
pub struct ISOURCE_R(crate::FieldReader<u8, ISOURCE_A>);
impl ISOURCE_R {
pub(crate) fn new(bits: u8) -> Self {
ISOURCE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ISOURCE_A {
match self.bits {
0 => ISOURCE_A::OFF,
1 => ISOURCE_A::IEN2MA5,
2 => ISOURCE_A::IEN5MA,
3 => ISOURCE_A::IEN10MA,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `OFF`"]
#[inline(always)]
pub fn is_off(&self) -> bool {
**self == ISOURCE_A::OFF
}
#[doc = "Checks if the value of the field is `IEN2MA5`"]
#[inline(always)]
pub fn is_ien2m_a5(&self) -> bool {
**self == ISOURCE_A::IEN2MA5
}
#[doc = "Checks if the value of the field is `IEN5MA`"]
#[inline(always)]
pub fn is_ien5m_a(&self) -> bool {
**self == ISOURCE_A::IEN5MA
}
#[doc = "Checks if the value of the field is `IEN10MA`"]
#[inline(always)]
pub fn is_ien10m_a(&self) -> bool {
**self == ISOURCE_A::IEN10MA
}
}
impl core::ops::Deref for ISOURCE_R {
type Target = crate::FieldReader<u8, ISOURCE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `ISOURCE` writer - Comparator hysteresis"]
pub struct ISOURCE_W<'a> {
w: &'a mut W,
}
impl<'a> ISOURCE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ISOURCE_A) -> &'a mut W {
self.bits(variant.into())
}
#[doc = "Current source disabled"]
#[inline(always)]
pub fn off(self) -> &'a mut W {
self.variant(ISOURCE_A::OFF)
}
#[doc = "Current source enabled (+/- 2.5 uA)"]
#[inline(always)]
pub fn ien2m_a5(self) -> &'a mut W {
self.variant(ISOURCE_A::IEN2MA5)
}
#[doc = "Current source enabled (+/- 5 uA)"]
#[inline(always)]
pub fn ien5m_a(self) -> &'a mut W {
self.variant(ISOURCE_A::IEN5MA)
}
#[doc = "Current source enabled (+/- 10 uA)"]
#[inline(always)]
pub fn ien10m_a(self) -> &'a mut W {
self.variant(ISOURCE_A::IEN10MA)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
self.w
}
}
impl R {
#[doc = "Bits 0:1 - Comparator hysteresis"]
#[inline(always)]
pub fn isource(&self) -> ISOURCE_R {
ISOURCE_R::new((self.bits & 0x03) as u8)
}
}
impl W {
#[doc = "Bits 0:1 - Comparator hysteresis"]
#[inline(always)]
pub fn isource(&mut self) -> ISOURCE_W {
ISOURCE_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 = "Current source select on analog input\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 [isource](index.html) module"]
pub struct ISOURCE_SPEC;
impl crate::RegisterSpec for ISOURCE_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [isource::R](R) reader structure"]
impl crate::Readable for ISOURCE_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [isource::W](W) writer structure"]
impl crate::Writable for ISOURCE_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets ISOURCE to value 0"]
impl crate::Resettable for ISOURCE_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

257
src/comp/mode.rs Normal file
View File

@@ -0,0 +1,257 @@
#[doc = "Register `MODE` reader"]
pub struct R(crate::R<MODE_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<MODE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<MODE_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<MODE_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `MODE` writer"]
pub struct W(crate::W<MODE_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<MODE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<MODE_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<MODE_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Speed and power modes\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum SP_A {
#[doc = "0: Low-power mode"]
LOW = 0,
#[doc = "1: Normal mode"]
NORMAL = 1,
#[doc = "2: High-speed mode"]
HIGH = 2,
}
impl From<SP_A> for u8 {
#[inline(always)]
fn from(variant: SP_A) -> Self {
variant as _
}
}
#[doc = "Field `SP` reader - Speed and power modes"]
pub struct SP_R(crate::FieldReader<u8, SP_A>);
impl SP_R {
pub(crate) fn new(bits: u8) -> Self {
SP_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<SP_A> {
match self.bits {
0 => Some(SP_A::LOW),
1 => Some(SP_A::NORMAL),
2 => Some(SP_A::HIGH),
_ => None,
}
}
#[doc = "Checks if the value of the field is `LOW`"]
#[inline(always)]
pub fn is_low(&self) -> bool {
**self == SP_A::LOW
}
#[doc = "Checks if the value of the field is `NORMAL`"]
#[inline(always)]
pub fn is_normal(&self) -> bool {
**self == SP_A::NORMAL
}
#[doc = "Checks if the value of the field is `HIGH`"]
#[inline(always)]
pub fn is_high(&self) -> bool {
**self == SP_A::HIGH
}
}
impl core::ops::Deref for SP_R {
type Target = crate::FieldReader<u8, SP_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SP` writer - Speed and power modes"]
pub struct SP_W<'a> {
w: &'a mut W,
}
impl<'a> SP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: SP_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "Low-power mode"]
#[inline(always)]
pub fn low(self) -> &'a mut W {
self.variant(SP_A::LOW)
}
#[doc = "Normal mode"]
#[inline(always)]
pub fn normal(self) -> &'a mut W {
self.variant(SP_A::NORMAL)
}
#[doc = "High-speed mode"]
#[inline(always)]
pub fn high(self) -> &'a mut W {
self.variant(SP_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) | (value as u32 & 0x03);
self.w
}
}
#[doc = "Main operation modes\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MAIN_A {
#[doc = "0: Single-ended mode"]
SE = 0,
#[doc = "1: Differential mode"]
DIFF = 1,
}
impl From<MAIN_A> for bool {
#[inline(always)]
fn from(variant: MAIN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `MAIN` reader - Main operation modes"]
pub struct MAIN_R(crate::FieldReader<bool, MAIN_A>);
impl MAIN_R {
pub(crate) fn new(bits: bool) -> Self {
MAIN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> MAIN_A {
match self.bits {
false => MAIN_A::SE,
true => MAIN_A::DIFF,
}
}
#[doc = "Checks if the value of the field is `SE`"]
#[inline(always)]
pub fn is_se(&self) -> bool {
**self == MAIN_A::SE
}
#[doc = "Checks if the value of the field is `DIFF`"]
#[inline(always)]
pub fn is_diff(&self) -> bool {
**self == MAIN_A::DIFF
}
}
impl core::ops::Deref for MAIN_R {
type Target = crate::FieldReader<bool, MAIN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MAIN` writer - Main operation modes"]
pub struct MAIN_W<'a> {
w: &'a mut W,
}
impl<'a> MAIN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: MAIN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Single-ended mode"]
#[inline(always)]
pub fn se(self) -> &'a mut W {
self.variant(MAIN_A::SE)
}
#[doc = "Differential mode"]
#[inline(always)]
pub fn diff(self) -> &'a mut W {
self.variant(MAIN_A::DIFF)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 8)) | ((value as u32 & 0x01) << 8);
self.w
}
}
impl R {
#[doc = "Bits 0:1 - Speed and power modes"]
#[inline(always)]
pub fn sp(&self) -> SP_R {
SP_R::new((self.bits & 0x03) as u8)
}
#[doc = "Bit 8 - Main operation modes"]
#[inline(always)]
pub fn main(&self) -> MAIN_R {
MAIN_R::new(((self.bits >> 8) & 0x01) != 0)
}
}
impl W {
#[doc = "Bits 0:1 - Speed and power modes"]
#[inline(always)]
pub fn sp(&mut self) -> SP_W {
SP_W { w: self }
}
#[doc = "Bit 8 - Main operation modes"]
#[inline(always)]
pub fn main(&mut self) -> MAIN_W {
MAIN_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 = "Mode configuration\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 [mode](index.html) module"]
pub struct MODE_SPEC;
impl crate::RegisterSpec for MODE_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [mode::R](R) reader structure"]
impl crate::Readable for MODE_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [mode::W](W) writer structure"]
impl crate::Writable for MODE_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets MODE to value 0"]
impl crate::Resettable for MODE_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

229
src/comp/psel.rs Normal file
View File

@@ -0,0 +1,229 @@
#[doc = "Register `PSEL` reader"]
pub struct R(crate::R<PSEL_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<PSEL_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<PSEL_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<PSEL_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `PSEL` writer"]
pub struct W(crate::W<PSEL_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<PSEL_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<PSEL_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<PSEL_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Analog pin select\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum PSEL_A {
#[doc = "0: AIN0 selected as analog input"]
ANALOGINPUT0 = 0,
#[doc = "1: AIN1 selected as analog input"]
ANALOGINPUT1 = 1,
#[doc = "2: AIN2 selected as analog input"]
ANALOGINPUT2 = 2,
#[doc = "3: AIN3 selected as analog input"]
ANALOGINPUT3 = 3,
#[doc = "4: AIN4 selected as analog input"]
ANALOGINPUT4 = 4,
#[doc = "5: AIN5 selected as analog input"]
ANALOGINPUT5 = 5,
#[doc = "6: AIN6 selected as analog input"]
ANALOGINPUT6 = 6,
#[doc = "7: AIN7 selected as analog input"]
ANALOGINPUT7 = 7,
}
impl From<PSEL_A> for u8 {
#[inline(always)]
fn from(variant: PSEL_A) -> Self {
variant as _
}
}
#[doc = "Field `PSEL` reader - Analog pin select"]
pub struct PSEL_R(crate::FieldReader<u8, PSEL_A>);
impl PSEL_R {
pub(crate) fn new(bits: u8) -> Self {
PSEL_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> PSEL_A {
match self.bits {
0 => PSEL_A::ANALOGINPUT0,
1 => PSEL_A::ANALOGINPUT1,
2 => PSEL_A::ANALOGINPUT2,
3 => PSEL_A::ANALOGINPUT3,
4 => PSEL_A::ANALOGINPUT4,
5 => PSEL_A::ANALOGINPUT5,
6 => PSEL_A::ANALOGINPUT6,
7 => PSEL_A::ANALOGINPUT7,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `ANALOGINPUT0`"]
#[inline(always)]
pub fn is_analog_input0(&self) -> bool {
**self == PSEL_A::ANALOGINPUT0
}
#[doc = "Checks if the value of the field is `ANALOGINPUT1`"]
#[inline(always)]
pub fn is_analog_input1(&self) -> bool {
**self == PSEL_A::ANALOGINPUT1
}
#[doc = "Checks if the value of the field is `ANALOGINPUT2`"]
#[inline(always)]
pub fn is_analog_input2(&self) -> bool {
**self == PSEL_A::ANALOGINPUT2
}
#[doc = "Checks if the value of the field is `ANALOGINPUT3`"]
#[inline(always)]
pub fn is_analog_input3(&self) -> bool {
**self == PSEL_A::ANALOGINPUT3
}
#[doc = "Checks if the value of the field is `ANALOGINPUT4`"]
#[inline(always)]
pub fn is_analog_input4(&self) -> bool {
**self == PSEL_A::ANALOGINPUT4
}
#[doc = "Checks if the value of the field is `ANALOGINPUT5`"]
#[inline(always)]
pub fn is_analog_input5(&self) -> bool {
**self == PSEL_A::ANALOGINPUT5
}
#[doc = "Checks if the value of the field is `ANALOGINPUT6`"]
#[inline(always)]
pub fn is_analog_input6(&self) -> bool {
**self == PSEL_A::ANALOGINPUT6
}
#[doc = "Checks if the value of the field is `ANALOGINPUT7`"]
#[inline(always)]
pub fn is_analog_input7(&self) -> bool {
**self == PSEL_A::ANALOGINPUT7
}
}
impl core::ops::Deref for PSEL_R {
type Target = crate::FieldReader<u8, PSEL_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PSEL` writer - Analog pin select"]
pub struct PSEL_W<'a> {
w: &'a mut W,
}
impl<'a> PSEL_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PSEL_A) -> &'a mut W {
self.bits(variant.into())
}
#[doc = "AIN0 selected as analog input"]
#[inline(always)]
pub fn analog_input0(self) -> &'a mut W {
self.variant(PSEL_A::ANALOGINPUT0)
}
#[doc = "AIN1 selected as analog input"]
#[inline(always)]
pub fn analog_input1(self) -> &'a mut W {
self.variant(PSEL_A::ANALOGINPUT1)
}
#[doc = "AIN2 selected as analog input"]
#[inline(always)]
pub fn analog_input2(self) -> &'a mut W {
self.variant(PSEL_A::ANALOGINPUT2)
}
#[doc = "AIN3 selected as analog input"]
#[inline(always)]
pub fn analog_input3(self) -> &'a mut W {
self.variant(PSEL_A::ANALOGINPUT3)
}
#[doc = "AIN4 selected as analog input"]
#[inline(always)]
pub fn analog_input4(self) -> &'a mut W {
self.variant(PSEL_A::ANALOGINPUT4)
}
#[doc = "AIN5 selected as analog input"]
#[inline(always)]
pub fn analog_input5(self) -> &'a mut W {
self.variant(PSEL_A::ANALOGINPUT5)
}
#[doc = "AIN6 selected as analog input"]
#[inline(always)]
pub fn analog_input6(self) -> &'a mut W {
self.variant(PSEL_A::ANALOGINPUT6)
}
#[doc = "AIN7 selected as analog input"]
#[inline(always)]
pub fn analog_input7(self) -> &'a mut W {
self.variant(PSEL_A::ANALOGINPUT7)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
self.w
}
}
impl R {
#[doc = "Bits 0:2 - Analog pin select"]
#[inline(always)]
pub fn psel(&self) -> PSEL_R {
PSEL_R::new((self.bits & 0x07) as u8)
}
}
impl W {
#[doc = "Bits 0:2 - Analog pin select"]
#[inline(always)]
pub fn psel(&mut self) -> PSEL_W {
PSEL_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 = "Pin select\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 [psel](index.html) module"]
pub struct PSEL_SPEC;
impl crate::RegisterSpec for PSEL_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [psel::R](R) reader structure"]
impl crate::Readable for PSEL_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [psel::W](W) writer structure"]
impl crate::Writable for PSEL_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets PSEL to value 0"]
impl crate::Resettable for PSEL_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

190
src/comp/refsel.rs Normal file
View File

@@ -0,0 +1,190 @@
#[doc = "Register `REFSEL` reader"]
pub struct R(crate::R<REFSEL_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<REFSEL_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<REFSEL_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<REFSEL_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `REFSEL` writer"]
pub struct W(crate::W<REFSEL_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<REFSEL_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<REFSEL_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<REFSEL_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Reference select\n\nValue on reset: 4"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum REFSEL_A {
#[doc = "0: VREF = internal 1.2 V reference (VDD &gt;= 1.7 V)"]
INT1V2 = 0,
#[doc = "1: VREF = internal 1.8 V reference (VDD &gt;= VREF + 0.2 V)"]
INT1V8 = 1,
#[doc = "2: VREF = internal 2.4 V reference (VDD &gt;= VREF + 0.2 V)"]
INT2V4 = 2,
#[doc = "4: VREF = VDD"]
VDD = 4,
#[doc = "7: VREF = AREF (VDD &gt;= VREF &gt;= AREFMIN)"]
AREF = 7,
}
impl From<REFSEL_A> for u8 {
#[inline(always)]
fn from(variant: REFSEL_A) -> Self {
variant as _
}
}
#[doc = "Field `REFSEL` reader - Reference select"]
pub struct REFSEL_R(crate::FieldReader<u8, REFSEL_A>);
impl REFSEL_R {
pub(crate) fn new(bits: u8) -> Self {
REFSEL_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<REFSEL_A> {
match self.bits {
0 => Some(REFSEL_A::INT1V2),
1 => Some(REFSEL_A::INT1V8),
2 => Some(REFSEL_A::INT2V4),
4 => Some(REFSEL_A::VDD),
7 => Some(REFSEL_A::AREF),
_ => None,
}
}
#[doc = "Checks if the value of the field is `INT1V2`"]
#[inline(always)]
pub fn is_int1v2(&self) -> bool {
**self == REFSEL_A::INT1V2
}
#[doc = "Checks if the value of the field is `INT1V8`"]
#[inline(always)]
pub fn is_int1v8(&self) -> bool {
**self == REFSEL_A::INT1V8
}
#[doc = "Checks if the value of the field is `INT2V4`"]
#[inline(always)]
pub fn is_int2v4(&self) -> bool {
**self == REFSEL_A::INT2V4
}
#[doc = "Checks if the value of the field is `VDD`"]
#[inline(always)]
pub fn is_vdd(&self) -> bool {
**self == REFSEL_A::VDD
}
#[doc = "Checks if the value of the field is `AREF`"]
#[inline(always)]
pub fn is_aref(&self) -> bool {
**self == REFSEL_A::AREF
}
}
impl core::ops::Deref for REFSEL_R {
type Target = crate::FieldReader<u8, REFSEL_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `REFSEL` writer - Reference select"]
pub struct REFSEL_W<'a> {
w: &'a mut W,
}
impl<'a> REFSEL_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: REFSEL_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "VREF = internal 1.2 V reference (VDD &gt;= 1.7 V)"]
#[inline(always)]
pub fn int1v2(self) -> &'a mut W {
self.variant(REFSEL_A::INT1V2)
}
#[doc = "VREF = internal 1.8 V reference (VDD &gt;= VREF + 0.2 V)"]
#[inline(always)]
pub fn int1v8(self) -> &'a mut W {
self.variant(REFSEL_A::INT1V8)
}
#[doc = "VREF = internal 2.4 V reference (VDD &gt;= VREF + 0.2 V)"]
#[inline(always)]
pub fn int2v4(self) -> &'a mut W {
self.variant(REFSEL_A::INT2V4)
}
#[doc = "VREF = VDD"]
#[inline(always)]
pub fn vdd(self) -> &'a mut W {
self.variant(REFSEL_A::VDD)
}
#[doc = "VREF = AREF (VDD &gt;= VREF &gt;= AREFMIN)"]
#[inline(always)]
pub fn aref(self) -> &'a mut W {
self.variant(REFSEL_A::AREF)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
self.w
}
}
impl R {
#[doc = "Bits 0:2 - Reference select"]
#[inline(always)]
pub fn refsel(&self) -> REFSEL_R {
REFSEL_R::new((self.bits & 0x07) as u8)
}
}
impl W {
#[doc = "Bits 0:2 - Reference select"]
#[inline(always)]
pub fn refsel(&mut self) -> REFSEL_W {
REFSEL_W { w: self }
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "Reference source select for single-ended mode\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 [refsel](index.html) module"]
pub struct REFSEL_SPEC;
impl crate::RegisterSpec for REFSEL_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [refsel::R](R) reader structure"]
impl crate::Readable for REFSEL_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [refsel::W](W) writer structure"]
impl crate::Writable for REFSEL_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets REFSEL to value 0x04"]
impl crate::Resettable for REFSEL_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0x04
}
}

84
src/comp/result.rs Normal file
View File

@@ -0,0 +1,84 @@
#[doc = "Register `RESULT` reader"]
pub struct R(crate::R<RESULT_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<RESULT_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<RESULT_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<RESULT_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Result of last compare. Decision point SAMPLE task.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RESULT_A {
#[doc = "0: Input voltage is below the threshold (VIN+ &lt; VIN-)"]
BELOW = 0,
#[doc = "1: Input voltage is above the threshold (VIN+ &gt; VIN-)"]
ABOVE = 1,
}
impl From<RESULT_A> for bool {
#[inline(always)]
fn from(variant: RESULT_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `RESULT` reader - Result of last compare. Decision point SAMPLE task."]
pub struct RESULT_R(crate::FieldReader<bool, RESULT_A>);
impl RESULT_R {
pub(crate) fn new(bits: bool) -> Self {
RESULT_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RESULT_A {
match self.bits {
false => RESULT_A::BELOW,
true => RESULT_A::ABOVE,
}
}
#[doc = "Checks if the value of the field is `BELOW`"]
#[inline(always)]
pub fn is_below(&self) -> bool {
**self == RESULT_A::BELOW
}
#[doc = "Checks if the value of the field is `ABOVE`"]
#[inline(always)]
pub fn is_above(&self) -> bool {
**self == RESULT_A::ABOVE
}
}
impl core::ops::Deref for RESULT_R {
type Target = crate::FieldReader<bool, RESULT_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl R {
#[doc = "Bit 0 - Result of last compare. Decision point SAMPLE task."]
#[inline(always)]
pub fn result(&self) -> RESULT_R {
RESULT_R::new((self.bits & 0x01) != 0)
}
}
#[doc = "Compare result\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [result](index.html) module"]
pub struct RESULT_SPEC;
impl crate::RegisterSpec for RESULT_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [result::R](R) reader structure"]
impl crate::Readable for RESULT_SPEC {
type Reader = R;
}
#[doc = "`reset()` method sets RESULT to value 0"]
impl crate::Resettable for RESULT_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

531
src/comp/shorts.rs Normal file
View File

@@ -0,0 +1,531 @@
#[doc = "Register `SHORTS` reader"]
pub struct R(crate::R<SHORTS_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<SHORTS_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<SHORTS_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<SHORTS_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `SHORTS` writer"]
pub struct W(crate::W<SHORTS_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<SHORTS_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<SHORTS_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<SHORTS_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Shortcut between READY event and SAMPLE task\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum READY_SAMPLE_A {
#[doc = "0: Disable shortcut"]
DISABLED = 0,
#[doc = "1: Enable shortcut"]
ENABLED = 1,
}
impl From<READY_SAMPLE_A> for bool {
#[inline(always)]
fn from(variant: READY_SAMPLE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `READY_SAMPLE` reader - Shortcut between READY event and SAMPLE task"]
pub struct READY_SAMPLE_R(crate::FieldReader<bool, READY_SAMPLE_A>);
impl READY_SAMPLE_R {
pub(crate) fn new(bits: bool) -> Self {
READY_SAMPLE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> READY_SAMPLE_A {
match self.bits {
false => READY_SAMPLE_A::DISABLED,
true => READY_SAMPLE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == READY_SAMPLE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == READY_SAMPLE_A::ENABLED
}
}
impl core::ops::Deref for READY_SAMPLE_R {
type Target = crate::FieldReader<bool, READY_SAMPLE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `READY_SAMPLE` writer - Shortcut between READY event and SAMPLE task"]
pub struct READY_SAMPLE_W<'a> {
w: &'a mut W,
}
impl<'a> READY_SAMPLE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: READY_SAMPLE_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable shortcut"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(READY_SAMPLE_A::DISABLED)
}
#[doc = "Enable shortcut"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(READY_SAMPLE_A::ENABLED)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
self.w
}
}
#[doc = "Shortcut between READY event and STOP task\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum READY_STOP_A {
#[doc = "0: Disable shortcut"]
DISABLED = 0,
#[doc = "1: Enable shortcut"]
ENABLED = 1,
}
impl From<READY_STOP_A> for bool {
#[inline(always)]
fn from(variant: READY_STOP_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `READY_STOP` reader - Shortcut between READY event and STOP task"]
pub struct READY_STOP_R(crate::FieldReader<bool, READY_STOP_A>);
impl READY_STOP_R {
pub(crate) fn new(bits: bool) -> Self {
READY_STOP_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> READY_STOP_A {
match self.bits {
false => READY_STOP_A::DISABLED,
true => READY_STOP_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == READY_STOP_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == READY_STOP_A::ENABLED
}
}
impl core::ops::Deref for READY_STOP_R {
type Target = crate::FieldReader<bool, READY_STOP_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `READY_STOP` writer - Shortcut between READY event and STOP task"]
pub struct READY_STOP_W<'a> {
w: &'a mut W,
}
impl<'a> READY_STOP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: READY_STOP_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable shortcut"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(READY_STOP_A::DISABLED)
}
#[doc = "Enable shortcut"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(READY_STOP_A::ENABLED)
}
#[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 = "Shortcut between DOWN event and STOP task\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DOWN_STOP_A {
#[doc = "0: Disable shortcut"]
DISABLED = 0,
#[doc = "1: Enable shortcut"]
ENABLED = 1,
}
impl From<DOWN_STOP_A> for bool {
#[inline(always)]
fn from(variant: DOWN_STOP_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `DOWN_STOP` reader - Shortcut between DOWN event and STOP task"]
pub struct DOWN_STOP_R(crate::FieldReader<bool, DOWN_STOP_A>);
impl DOWN_STOP_R {
pub(crate) fn new(bits: bool) -> Self {
DOWN_STOP_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> DOWN_STOP_A {
match self.bits {
false => DOWN_STOP_A::DISABLED,
true => DOWN_STOP_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == DOWN_STOP_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == DOWN_STOP_A::ENABLED
}
}
impl core::ops::Deref for DOWN_STOP_R {
type Target = crate::FieldReader<bool, DOWN_STOP_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `DOWN_STOP` writer - Shortcut between DOWN event and STOP task"]
pub struct DOWN_STOP_W<'a> {
w: &'a mut W,
}
impl<'a> DOWN_STOP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: DOWN_STOP_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable shortcut"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(DOWN_STOP_A::DISABLED)
}
#[doc = "Enable shortcut"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(DOWN_STOP_A::ENABLED)
}
#[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 = "Shortcut between UP event and STOP task\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum UP_STOP_A {
#[doc = "0: Disable shortcut"]
DISABLED = 0,
#[doc = "1: Enable shortcut"]
ENABLED = 1,
}
impl From<UP_STOP_A> for bool {
#[inline(always)]
fn from(variant: UP_STOP_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `UP_STOP` reader - Shortcut between UP event and STOP task"]
pub struct UP_STOP_R(crate::FieldReader<bool, UP_STOP_A>);
impl UP_STOP_R {
pub(crate) fn new(bits: bool) -> Self {
UP_STOP_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> UP_STOP_A {
match self.bits {
false => UP_STOP_A::DISABLED,
true => UP_STOP_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == UP_STOP_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == UP_STOP_A::ENABLED
}
}
impl core::ops::Deref for UP_STOP_R {
type Target = crate::FieldReader<bool, UP_STOP_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `UP_STOP` writer - Shortcut between UP event and STOP task"]
pub struct UP_STOP_W<'a> {
w: &'a mut W,
}
impl<'a> UP_STOP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: UP_STOP_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable shortcut"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(UP_STOP_A::DISABLED)
}
#[doc = "Enable shortcut"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(UP_STOP_A::ENABLED)
}
#[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 u32 & 0x01) << 3);
self.w
}
}
#[doc = "Shortcut between CROSS event and STOP task\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CROSS_STOP_A {
#[doc = "0: Disable shortcut"]
DISABLED = 0,
#[doc = "1: Enable shortcut"]
ENABLED = 1,
}
impl From<CROSS_STOP_A> for bool {
#[inline(always)]
fn from(variant: CROSS_STOP_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `CROSS_STOP` reader - Shortcut between CROSS event and STOP task"]
pub struct CROSS_STOP_R(crate::FieldReader<bool, CROSS_STOP_A>);
impl CROSS_STOP_R {
pub(crate) fn new(bits: bool) -> Self {
CROSS_STOP_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> CROSS_STOP_A {
match self.bits {
false => CROSS_STOP_A::DISABLED,
true => CROSS_STOP_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
**self == CROSS_STOP_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
**self == CROSS_STOP_A::ENABLED
}
}
impl core::ops::Deref for CROSS_STOP_R {
type Target = crate::FieldReader<bool, CROSS_STOP_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CROSS_STOP` writer - Shortcut between CROSS event and STOP task"]
pub struct CROSS_STOP_W<'a> {
w: &'a mut W,
}
impl<'a> CROSS_STOP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CROSS_STOP_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Disable shortcut"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(CROSS_STOP_A::DISABLED)
}
#[doc = "Enable shortcut"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(CROSS_STOP_A::ENABLED)
}
#[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 u32 & 0x01) << 4);
self.w
}
}
impl R {
#[doc = "Bit 0 - Shortcut between READY event and SAMPLE task"]
#[inline(always)]
pub fn ready_sample(&self) -> READY_SAMPLE_R {
READY_SAMPLE_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - Shortcut between READY event and STOP task"]
#[inline(always)]
pub fn ready_stop(&self) -> READY_STOP_R {
READY_STOP_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - Shortcut between DOWN event and STOP task"]
#[inline(always)]
pub fn down_stop(&self) -> DOWN_STOP_R {
DOWN_STOP_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Shortcut between UP event and STOP task"]
#[inline(always)]
pub fn up_stop(&self) -> UP_STOP_R {
UP_STOP_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - Shortcut between CROSS event and STOP task"]
#[inline(always)]
pub fn cross_stop(&self) -> CROSS_STOP_R {
CROSS_STOP_R::new(((self.bits >> 4) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Shortcut between READY event and SAMPLE task"]
#[inline(always)]
pub fn ready_sample(&mut self) -> READY_SAMPLE_W {
READY_SAMPLE_W { w: self }
}
#[doc = "Bit 1 - Shortcut between READY event and STOP task"]
#[inline(always)]
pub fn ready_stop(&mut self) -> READY_STOP_W {
READY_STOP_W { w: self }
}
#[doc = "Bit 2 - Shortcut between DOWN event and STOP task"]
#[inline(always)]
pub fn down_stop(&mut self) -> DOWN_STOP_W {
DOWN_STOP_W { w: self }
}
#[doc = "Bit 3 - Shortcut between UP event and STOP task"]
#[inline(always)]
pub fn up_stop(&mut self) -> UP_STOP_W {
UP_STOP_W { w: self }
}
#[doc = "Bit 4 - Shortcut between CROSS event and STOP task"]
#[inline(always)]
pub fn cross_stop(&mut self) -> CROSS_STOP_W {
CROSS_STOP_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 = "Shortcut register\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 [shorts](index.html) module"]
pub struct SHORTS_SPEC;
impl crate::RegisterSpec for SHORTS_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [shorts::R](R) reader structure"]
impl crate::Readable for SHORTS_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [shorts::W](W) writer structure"]
impl crate::Writable for SHORTS_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets SHORTS to value 0"]
impl crate::Resettable for SHORTS_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

45
src/comp/tasks_sample.rs Normal file
View File

@@ -0,0 +1,45 @@
#[doc = "Register `TASKS_SAMPLE` writer"]
pub struct W(crate::W<TASKS_SAMPLE_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<TASKS_SAMPLE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<TASKS_SAMPLE_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<TASKS_SAMPLE_SPEC>) -> Self {
W(writer)
}
}
impl W {
#[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 = "Sample comparator value\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 [tasks_sample](index.html) module"]
pub struct TASKS_SAMPLE_SPEC;
impl crate::RegisterSpec for TASKS_SAMPLE_SPEC {
type Ux = u32;
}
#[doc = "`write(|w| ..)` method takes [tasks_sample::W](W) writer structure"]
impl crate::Writable for TASKS_SAMPLE_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets TASKS_SAMPLE to value 0"]
impl crate::Resettable for TASKS_SAMPLE_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

45
src/comp/tasks_start.rs Normal file
View File

@@ -0,0 +1,45 @@
#[doc = "Register `TASKS_START` writer"]
pub struct W(crate::W<TASKS_START_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<TASKS_START_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<TASKS_START_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<TASKS_START_SPEC>) -> Self {
W(writer)
}
}
impl W {
#[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 = "Start comparator\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 [tasks_start](index.html) module"]
pub struct TASKS_START_SPEC;
impl crate::RegisterSpec for TASKS_START_SPEC {
type Ux = u32;
}
#[doc = "`write(|w| ..)` method takes [tasks_start::W](W) writer structure"]
impl crate::Writable for TASKS_START_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets TASKS_START to value 0"]
impl crate::Resettable for TASKS_START_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

45
src/comp/tasks_stop.rs Normal file
View File

@@ -0,0 +1,45 @@
#[doc = "Register `TASKS_STOP` writer"]
pub struct W(crate::W<TASKS_STOP_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<TASKS_STOP_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<TASKS_STOP_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<TASKS_STOP_SPEC>) -> Self {
W(writer)
}
}
impl W {
#[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 = "Stop comparator\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 [tasks_stop](index.html) module"]
pub struct TASKS_STOP_SPEC;
impl crate::RegisterSpec for TASKS_STOP_SPEC {
type Ux = u32;
}
#[doc = "`write(|w| ..)` method takes [tasks_stop::W](W) writer structure"]
impl crate::Writable for TASKS_STOP_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets TASKS_STOP to value 0"]
impl crate::Resettable for TASKS_STOP_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}

138
src/comp/th.rs Normal file
View File

@@ -0,0 +1,138 @@
#[doc = "Register `TH` reader"]
pub struct R(crate::R<TH_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<TH_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<TH_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<TH_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `TH` writer"]
pub struct W(crate::W<TH_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<TH_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<TH_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<TH_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `THDOWN` reader - VDOWN = (THDOWN+1)/64*VREF"]
pub struct THDOWN_R(crate::FieldReader<u8, u8>);
impl THDOWN_R {
pub(crate) fn new(bits: u8) -> Self {
THDOWN_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for THDOWN_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `THDOWN` writer - VDOWN = (THDOWN+1)/64*VREF"]
pub struct THDOWN_W<'a> {
w: &'a mut W,
}
impl<'a> THDOWN_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 u32 & 0x3f);
self.w
}
}
#[doc = "Field `THUP` reader - VUP = (THUP+1)/64*VREF"]
pub struct THUP_R(crate::FieldReader<u8, u8>);
impl THUP_R {
pub(crate) fn new(bits: u8) -> Self {
THUP_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for THUP_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `THUP` writer - VUP = (THUP+1)/64*VREF"]
pub struct THUP_W<'a> {
w: &'a mut W,
}
impl<'a> THUP_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 << 8)) | ((value as u32 & 0x3f) << 8);
self.w
}
}
impl R {
#[doc = "Bits 0:5 - VDOWN = (THDOWN+1)/64*VREF"]
#[inline(always)]
pub fn thdown(&self) -> THDOWN_R {
THDOWN_R::new((self.bits & 0x3f) as u8)
}
#[doc = "Bits 8:13 - VUP = (THUP+1)/64*VREF"]
#[inline(always)]
pub fn thup(&self) -> THUP_R {
THUP_R::new(((self.bits >> 8) & 0x3f) as u8)
}
}
impl W {
#[doc = "Bits 0:5 - VDOWN = (THDOWN+1)/64*VREF"]
#[inline(always)]
pub fn thdown(&mut self) -> THDOWN_W {
THDOWN_W { w: self }
}
#[doc = "Bits 8:13 - VUP = (THUP+1)/64*VREF"]
#[inline(always)]
pub fn thup(&mut self) -> THUP_W {
THUP_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 = "Threshold configuration for hysteresis unit\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 [th](index.html) module"]
pub struct TH_SPEC;
impl crate::RegisterSpec for TH_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [th::R](R) reader structure"]
impl crate::Readable for TH_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [th::W](W) writer structure"]
impl crate::Writable for TH_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets TH to value 0"]
impl crate::Resettable for TH_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}