pub type R = crate::R<COMP1_CSRrs>;
pub type W = crate::W<COMP1_CSRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP1EN {
Disabled = 0,
Enabled = 1,
}
impl From<COMP1EN> for bool {
#[inline(always)]
fn from(variant: COMP1EN) -> Self {
variant as u8 != 0
}
}
pub type COMP1EN_R = crate::BitReader<COMP1EN>;
impl COMP1EN_R {
#[inline(always)]
pub const fn variant(&self) -> COMP1EN {
match self.bits {
false => COMP1EN::Disabled,
true => COMP1EN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == COMP1EN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == COMP1EN::Enabled
}
}
pub type COMP1EN_W<'a, REG> = crate::BitWriter<'a, REG, COMP1EN>;
impl<'a, REG> COMP1EN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(COMP1EN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(COMP1EN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum COMP1INNSEL {
Vrefint = 0,
Pa0 = 1,
Pa4 = 2,
Pa5 = 3,
}
impl From<COMP1INNSEL> for u8 {
#[inline(always)]
fn from(variant: COMP1INNSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for COMP1INNSEL {
type Ux = u8;
}
impl crate::IsEnum for COMP1INNSEL {}
pub type COMP1INNSEL_R = crate::FieldReader<COMP1INNSEL>;
impl COMP1INNSEL_R {
#[inline(always)]
pub const fn variant(&self) -> COMP1INNSEL {
match self.bits {
0 => COMP1INNSEL::Vrefint,
1 => COMP1INNSEL::Pa0,
2 => COMP1INNSEL::Pa4,
3 => COMP1INNSEL::Pa5,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_vrefint(&self) -> bool {
*self == COMP1INNSEL::Vrefint
}
#[inline(always)]
pub fn is_pa0(&self) -> bool {
*self == COMP1INNSEL::Pa0
}
#[inline(always)]
pub fn is_pa4(&self) -> bool {
*self == COMP1INNSEL::Pa4
}
#[inline(always)]
pub fn is_pa5(&self) -> bool {
*self == COMP1INNSEL::Pa5
}
}
pub type COMP1INNSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, COMP1INNSEL, crate::Safe>;
impl<'a, REG> COMP1INNSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn vrefint(self) -> &'a mut crate::W<REG> {
self.variant(COMP1INNSEL::Vrefint)
}
#[inline(always)]
pub fn pa0(self) -> &'a mut crate::W<REG> {
self.variant(COMP1INNSEL::Pa0)
}
#[inline(always)]
pub fn pa4(self) -> &'a mut crate::W<REG> {
self.variant(COMP1INNSEL::Pa4)
}
#[inline(always)]
pub fn pa5(self) -> &'a mut crate::W<REG> {
self.variant(COMP1INNSEL::Pa5)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP1WM {
Pa1 = 0,
Comp2plus = 1,
}
impl From<COMP1WM> for bool {
#[inline(always)]
fn from(variant: COMP1WM) -> Self {
variant as u8 != 0
}
}
pub type COMP1WM_R = crate::BitReader<COMP1WM>;
impl COMP1WM_R {
#[inline(always)]
pub const fn variant(&self) -> COMP1WM {
match self.bits {
false => COMP1WM::Pa1,
true => COMP1WM::Comp2plus,
}
}
#[inline(always)]
pub fn is_pa1(&self) -> bool {
*self == COMP1WM::Pa1
}
#[inline(always)]
pub fn is_comp2plus(&self) -> bool {
*self == COMP1WM::Comp2plus
}
}
pub type COMP1WM_W<'a, REG> = crate::BitWriter<'a, REG, COMP1WM>;
impl<'a, REG> COMP1WM_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn pa1(self) -> &'a mut crate::W<REG> {
self.variant(COMP1WM::Pa1)
}
#[inline(always)]
pub fn comp2plus(self) -> &'a mut crate::W<REG> {
self.variant(COMP1WM::Comp2plus)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP1LPTIMIN1 {
Gated = 0,
NotGated = 1,
}
impl From<COMP1LPTIMIN1> for bool {
#[inline(always)]
fn from(variant: COMP1LPTIMIN1) -> Self {
variant as u8 != 0
}
}
pub type COMP1LPTIMIN1_R = crate::BitReader<COMP1LPTIMIN1>;
impl COMP1LPTIMIN1_R {
#[inline(always)]
pub const fn variant(&self) -> COMP1LPTIMIN1 {
match self.bits {
false => COMP1LPTIMIN1::Gated,
true => COMP1LPTIMIN1::NotGated,
}
}
#[inline(always)]
pub fn is_gated(&self) -> bool {
*self == COMP1LPTIMIN1::Gated
}
#[inline(always)]
pub fn is_not_gated(&self) -> bool {
*self == COMP1LPTIMIN1::NotGated
}
}
pub type COMP1LPTIMIN1_W<'a, REG> = crate::BitWriter<'a, REG, COMP1LPTIMIN1>;
impl<'a, REG> COMP1LPTIMIN1_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn gated(self) -> &'a mut crate::W<REG> {
self.variant(COMP1LPTIMIN1::Gated)
}
#[inline(always)]
pub fn not_gated(self) -> &'a mut crate::W<REG> {
self.variant(COMP1LPTIMIN1::NotGated)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP1POLARITY {
NotInverted = 0,
Inverted = 1,
}
impl From<COMP1POLARITY> for bool {
#[inline(always)]
fn from(variant: COMP1POLARITY) -> Self {
variant as u8 != 0
}
}
pub type COMP1POLARITY_R = crate::BitReader<COMP1POLARITY>;
impl COMP1POLARITY_R {
#[inline(always)]
pub const fn variant(&self) -> COMP1POLARITY {
match self.bits {
false => COMP1POLARITY::NotInverted,
true => COMP1POLARITY::Inverted,
}
}
#[inline(always)]
pub fn is_not_inverted(&self) -> bool {
*self == COMP1POLARITY::NotInverted
}
#[inline(always)]
pub fn is_inverted(&self) -> bool {
*self == COMP1POLARITY::Inverted
}
}
pub type COMP1POLARITY_W<'a, REG> = crate::BitWriter<'a, REG, COMP1POLARITY>;
impl<'a, REG> COMP1POLARITY_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_inverted(self) -> &'a mut crate::W<REG> {
self.variant(COMP1POLARITY::NotInverted)
}
#[inline(always)]
pub fn inverted(self) -> &'a mut crate::W<REG> {
self.variant(COMP1POLARITY::Inverted)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP1VALUER {
NotEqual = 0,
Equal = 1,
}
impl From<COMP1VALUER> for bool {
#[inline(always)]
fn from(variant: COMP1VALUER) -> Self {
variant as u8 != 0
}
}
pub type COMP1VALUE_R = crate::BitReader<COMP1VALUER>;
impl COMP1VALUE_R {
#[inline(always)]
pub const fn variant(&self) -> COMP1VALUER {
match self.bits {
false => COMP1VALUER::NotEqual,
true => COMP1VALUER::Equal,
}
}
#[inline(always)]
pub fn is_not_equal(&self) -> bool {
*self == COMP1VALUER::NotEqual
}
#[inline(always)]
pub fn is_equal(&self) -> bool {
*self == COMP1VALUER::Equal
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP1LOCK {
ReadWrite = 0,
ReadOnly = 1,
}
impl From<COMP1LOCK> for bool {
#[inline(always)]
fn from(variant: COMP1LOCK) -> Self {
variant as u8 != 0
}
}
pub type COMP1LOCK_R = crate::BitReader<COMP1LOCK>;
impl COMP1LOCK_R {
#[inline(always)]
pub const fn variant(&self) -> COMP1LOCK {
match self.bits {
false => COMP1LOCK::ReadWrite,
true => COMP1LOCK::ReadOnly,
}
}
#[inline(always)]
pub fn is_read_write(&self) -> bool {
*self == COMP1LOCK::ReadWrite
}
#[inline(always)]
pub fn is_read_only(&self) -> bool {
*self == COMP1LOCK::ReadOnly
}
}
impl R {
#[inline(always)]
pub fn comp1en(&self) -> COMP1EN_R {
COMP1EN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn comp1innsel(&self) -> COMP1INNSEL_R {
COMP1INNSEL_R::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn comp1wm(&self) -> COMP1WM_R {
COMP1WM_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn comp1lptimin1(&self) -> COMP1LPTIMIN1_R {
COMP1LPTIMIN1_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn comp1polarity(&self) -> COMP1POLARITY_R {
COMP1POLARITY_R::new(((self.bits >> 15) & 1) != 0)
}
#[inline(always)]
pub fn comp1value(&self) -> COMP1VALUE_R {
COMP1VALUE_R::new(((self.bits >> 30) & 1) != 0)
}
#[inline(always)]
pub fn comp1lock(&self) -> COMP1LOCK_R {
COMP1LOCK_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("COMP1_CSR")
.field("comp1lock", &self.comp1lock())
.field("comp1value", &self.comp1value())
.field("comp1polarity", &self.comp1polarity())
.field("comp1lptimin1", &self.comp1lptimin1())
.field("comp1wm", &self.comp1wm())
.field("comp1innsel", &self.comp1innsel())
.field("comp1en", &self.comp1en())
.finish()
}
}
impl W {
#[inline(always)]
pub fn comp1en(&mut self) -> COMP1EN_W<COMP1_CSRrs> {
COMP1EN_W::new(self, 0)
}
#[inline(always)]
pub fn comp1innsel(&mut self) -> COMP1INNSEL_W<COMP1_CSRrs> {
COMP1INNSEL_W::new(self, 4)
}
#[inline(always)]
pub fn comp1wm(&mut self) -> COMP1WM_W<COMP1_CSRrs> {
COMP1WM_W::new(self, 8)
}
#[inline(always)]
pub fn comp1lptimin1(&mut self) -> COMP1LPTIMIN1_W<COMP1_CSRrs> {
COMP1LPTIMIN1_W::new(self, 12)
}
#[inline(always)]
pub fn comp1polarity(&mut self) -> COMP1POLARITY_W<COMP1_CSRrs> {
COMP1POLARITY_W::new(self, 15)
}
}
pub struct COMP1_CSRrs;
impl crate::RegisterSpec for COMP1_CSRrs {
type Ux = u32;
}
impl crate::Readable for COMP1_CSRrs {}
impl crate::Writable for COMP1_CSRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for COMP1_CSRrs {}