pub type R = crate::R<COMP2_CSRrs>;
pub type W = crate::W<COMP2_CSRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP2EN {
Disabled = 0,
Enabled = 1,
}
impl From<COMP2EN> for bool {
#[inline(always)]
fn from(variant: COMP2EN) -> Self {
variant as u8 != 0
}
}
pub type COMP2EN_R = crate::BitReader<COMP2EN>;
impl COMP2EN_R {
#[inline(always)]
pub const fn variant(&self) -> COMP2EN {
match self.bits {
false => COMP2EN::Disabled,
true => COMP2EN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == COMP2EN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == COMP2EN::Enabled
}
}
pub type COMP2EN_W<'a, REG> = crate::BitWriter<'a, REG, COMP2EN>;
impl<'a, REG> COMP2EN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(COMP2EN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(COMP2EN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP2SPEED {
Slow = 0,
Fast = 1,
}
impl From<COMP2SPEED> for bool {
#[inline(always)]
fn from(variant: COMP2SPEED) -> Self {
variant as u8 != 0
}
}
pub type COMP2SPEED_R = crate::BitReader<COMP2SPEED>;
impl COMP2SPEED_R {
#[inline(always)]
pub const fn variant(&self) -> COMP2SPEED {
match self.bits {
false => COMP2SPEED::Slow,
true => COMP2SPEED::Fast,
}
}
#[inline(always)]
pub fn is_slow(&self) -> bool {
*self == COMP2SPEED::Slow
}
#[inline(always)]
pub fn is_fast(&self) -> bool {
*self == COMP2SPEED::Fast
}
}
pub type COMP2SPEED_W<'a, REG> = crate::BitWriter<'a, REG, COMP2SPEED>;
impl<'a, REG> COMP2SPEED_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn slow(self) -> &'a mut crate::W<REG> {
self.variant(COMP2SPEED::Slow)
}
#[inline(always)]
pub fn fast(self) -> &'a mut crate::W<REG> {
self.variant(COMP2SPEED::Fast)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum COMP2INNSEL {
Vrefint = 0,
Pa2 = 1,
Pa4 = 2,
Pa5 = 3,
VrefintDiv4 = 4,
VrefintDiv2 = 5,
VrefintDiv3_4 = 6,
Pb3 = 7,
}
impl From<COMP2INNSEL> for u8 {
#[inline(always)]
fn from(variant: COMP2INNSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for COMP2INNSEL {
type Ux = u8;
}
impl crate::IsEnum for COMP2INNSEL {}
pub type COMP2INNSEL_R = crate::FieldReader<COMP2INNSEL>;
impl COMP2INNSEL_R {
#[inline(always)]
pub const fn variant(&self) -> COMP2INNSEL {
match self.bits {
0 => COMP2INNSEL::Vrefint,
1 => COMP2INNSEL::Pa2,
2 => COMP2INNSEL::Pa4,
3 => COMP2INNSEL::Pa5,
4 => COMP2INNSEL::VrefintDiv4,
5 => COMP2INNSEL::VrefintDiv2,
6 => COMP2INNSEL::VrefintDiv3_4,
7 => COMP2INNSEL::Pb3,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_vrefint(&self) -> bool {
*self == COMP2INNSEL::Vrefint
}
#[inline(always)]
pub fn is_pa2(&self) -> bool {
*self == COMP2INNSEL::Pa2
}
#[inline(always)]
pub fn is_pa4(&self) -> bool {
*self == COMP2INNSEL::Pa4
}
#[inline(always)]
pub fn is_pa5(&self) -> bool {
*self == COMP2INNSEL::Pa5
}
#[inline(always)]
pub fn is_vrefint_div4(&self) -> bool {
*self == COMP2INNSEL::VrefintDiv4
}
#[inline(always)]
pub fn is_vrefint_div2(&self) -> bool {
*self == COMP2INNSEL::VrefintDiv2
}
#[inline(always)]
pub fn is_vrefint_div3_4(&self) -> bool {
*self == COMP2INNSEL::VrefintDiv3_4
}
#[inline(always)]
pub fn is_pb3(&self) -> bool {
*self == COMP2INNSEL::Pb3
}
}
pub type COMP2INNSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3, COMP2INNSEL, crate::Safe>;
impl<'a, REG> COMP2INNSEL_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(COMP2INNSEL::Vrefint)
}
#[inline(always)]
pub fn pa2(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INNSEL::Pa2)
}
#[inline(always)]
pub fn pa4(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INNSEL::Pa4)
}
#[inline(always)]
pub fn pa5(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INNSEL::Pa5)
}
#[inline(always)]
pub fn vrefint_div4(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INNSEL::VrefintDiv4)
}
#[inline(always)]
pub fn vrefint_div2(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INNSEL::VrefintDiv2)
}
#[inline(always)]
pub fn vrefint_div3_4(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INNSEL::VrefintDiv3_4)
}
#[inline(always)]
pub fn pb3(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INNSEL::Pb3)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum COMP2INPSEL {
Pa3 = 0,
Pb4 = 1,
Pb5 = 2,
Pb6 = 3,
Pb7 = 4,
Pa7 = 5,
}
impl From<COMP2INPSEL> for u8 {
#[inline(always)]
fn from(variant: COMP2INPSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for COMP2INPSEL {
type Ux = u8;
}
impl crate::IsEnum for COMP2INPSEL {}
pub type COMP2INPSEL_R = crate::FieldReader<COMP2INPSEL>;
impl COMP2INPSEL_R {
#[inline(always)]
pub const fn variant(&self) -> Option<COMP2INPSEL> {
match self.bits {
0 => Some(COMP2INPSEL::Pa3),
1 => Some(COMP2INPSEL::Pb4),
2 => Some(COMP2INPSEL::Pb5),
3 => Some(COMP2INPSEL::Pb6),
4 => Some(COMP2INPSEL::Pb7),
5 => Some(COMP2INPSEL::Pa7),
_ => None,
}
}
#[inline(always)]
pub fn is_pa3(&self) -> bool {
*self == COMP2INPSEL::Pa3
}
#[inline(always)]
pub fn is_pb4(&self) -> bool {
*self == COMP2INPSEL::Pb4
}
#[inline(always)]
pub fn is_pb5(&self) -> bool {
*self == COMP2INPSEL::Pb5
}
#[inline(always)]
pub fn is_pb6(&self) -> bool {
*self == COMP2INPSEL::Pb6
}
#[inline(always)]
pub fn is_pb7(&self) -> bool {
*self == COMP2INPSEL::Pb7
}
#[inline(always)]
pub fn is_pa7(&self) -> bool {
*self == COMP2INPSEL::Pa7
}
}
pub type COMP2INPSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3, COMP2INPSEL>;
impl<'a, REG> COMP2INPSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn pa3(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INPSEL::Pa3)
}
#[inline(always)]
pub fn pb4(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INPSEL::Pb4)
}
#[inline(always)]
pub fn pb5(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INPSEL::Pb5)
}
#[inline(always)]
pub fn pb6(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INPSEL::Pb6)
}
#[inline(always)]
pub fn pb7(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INPSEL::Pb7)
}
#[inline(always)]
pub fn pa7(self) -> &'a mut crate::W<REG> {
self.variant(COMP2INPSEL::Pa7)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP2LPTIMIN2 {
Gated = 0,
NotGated = 1,
}
impl From<COMP2LPTIMIN2> for bool {
#[inline(always)]
fn from(variant: COMP2LPTIMIN2) -> Self {
variant as u8 != 0
}
}
pub type COMP2LPTIMIN2_R = crate::BitReader<COMP2LPTIMIN2>;
impl COMP2LPTIMIN2_R {
#[inline(always)]
pub const fn variant(&self) -> COMP2LPTIMIN2 {
match self.bits {
false => COMP2LPTIMIN2::Gated,
true => COMP2LPTIMIN2::NotGated,
}
}
#[inline(always)]
pub fn is_gated(&self) -> bool {
*self == COMP2LPTIMIN2::Gated
}
#[inline(always)]
pub fn is_not_gated(&self) -> bool {
*self == COMP2LPTIMIN2::NotGated
}
}
pub type COMP2LPTIMIN2_W<'a, REG> = crate::BitWriter<'a, REG, COMP2LPTIMIN2>;
impl<'a, REG> COMP2LPTIMIN2_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn gated(self) -> &'a mut crate::W<REG> {
self.variant(COMP2LPTIMIN2::Gated)
}
#[inline(always)]
pub fn not_gated(self) -> &'a mut crate::W<REG> {
self.variant(COMP2LPTIMIN2::NotGated)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP2LPTIMIN1 {
Gated = 0,
NotGated = 1,
}
impl From<COMP2LPTIMIN1> for bool {
#[inline(always)]
fn from(variant: COMP2LPTIMIN1) -> Self {
variant as u8 != 0
}
}
pub type COMP2LPTIMIN1_R = crate::BitReader<COMP2LPTIMIN1>;
impl COMP2LPTIMIN1_R {
#[inline(always)]
pub const fn variant(&self) -> COMP2LPTIMIN1 {
match self.bits {
false => COMP2LPTIMIN1::Gated,
true => COMP2LPTIMIN1::NotGated,
}
}
#[inline(always)]
pub fn is_gated(&self) -> bool {
*self == COMP2LPTIMIN1::Gated
}
#[inline(always)]
pub fn is_not_gated(&self) -> bool {
*self == COMP2LPTIMIN1::NotGated
}
}
pub type COMP2LPTIMIN1_W<'a, REG> = crate::BitWriter<'a, REG, COMP2LPTIMIN1>;
impl<'a, REG> COMP2LPTIMIN1_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn gated(self) -> &'a mut crate::W<REG> {
self.variant(COMP2LPTIMIN1::Gated)
}
#[inline(always)]
pub fn not_gated(self) -> &'a mut crate::W<REG> {
self.variant(COMP2LPTIMIN1::NotGated)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP2POLARITY {
NotInverted = 0,
Inverted = 1,
}
impl From<COMP2POLARITY> for bool {
#[inline(always)]
fn from(variant: COMP2POLARITY) -> Self {
variant as u8 != 0
}
}
pub type COMP2POLARITY_R = crate::BitReader<COMP2POLARITY>;
impl COMP2POLARITY_R {
#[inline(always)]
pub const fn variant(&self) -> COMP2POLARITY {
match self.bits {
false => COMP2POLARITY::NotInverted,
true => COMP2POLARITY::Inverted,
}
}
#[inline(always)]
pub fn is_not_inverted(&self) -> bool {
*self == COMP2POLARITY::NotInverted
}
#[inline(always)]
pub fn is_inverted(&self) -> bool {
*self == COMP2POLARITY::Inverted
}
}
pub type COMP2POLARITY_W<'a, REG> = crate::BitWriter<'a, REG, COMP2POLARITY>;
impl<'a, REG> COMP2POLARITY_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_inverted(self) -> &'a mut crate::W<REG> {
self.variant(COMP2POLARITY::NotInverted)
}
#[inline(always)]
pub fn inverted(self) -> &'a mut crate::W<REG> {
self.variant(COMP2POLARITY::Inverted)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP2VALUER {
NotEqual = 0,
Equal = 1,
}
impl From<COMP2VALUER> for bool {
#[inline(always)]
fn from(variant: COMP2VALUER) -> Self {
variant as u8 != 0
}
}
pub type COMP2VALUE_R = crate::BitReader<COMP2VALUER>;
impl COMP2VALUE_R {
#[inline(always)]
pub const fn variant(&self) -> COMP2VALUER {
match self.bits {
false => COMP2VALUER::NotEqual,
true => COMP2VALUER::Equal,
}
}
#[inline(always)]
pub fn is_not_equal(&self) -> bool {
*self == COMP2VALUER::NotEqual
}
#[inline(always)]
pub fn is_equal(&self) -> bool {
*self == COMP2VALUER::Equal
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum COMP2LOCK {
ReadWrite = 0,
ReadOnly = 1,
}
impl From<COMP2LOCK> for bool {
#[inline(always)]
fn from(variant: COMP2LOCK) -> Self {
variant as u8 != 0
}
}
pub type COMP2LOCK_R = crate::BitReader<COMP2LOCK>;
impl COMP2LOCK_R {
#[inline(always)]
pub const fn variant(&self) -> COMP2LOCK {
match self.bits {
false => COMP2LOCK::ReadWrite,
true => COMP2LOCK::ReadOnly,
}
}
#[inline(always)]
pub fn is_read_write(&self) -> bool {
*self == COMP2LOCK::ReadWrite
}
#[inline(always)]
pub fn is_read_only(&self) -> bool {
*self == COMP2LOCK::ReadOnly
}
}
impl R {
#[inline(always)]
pub fn comp2en(&self) -> COMP2EN_R {
COMP2EN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn comp2speed(&self) -> COMP2SPEED_R {
COMP2SPEED_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn comp2innsel(&self) -> COMP2INNSEL_R {
COMP2INNSEL_R::new(((self.bits >> 4) & 7) as u8)
}
#[inline(always)]
pub fn comp2inpsel(&self) -> COMP2INPSEL_R {
COMP2INPSEL_R::new(((self.bits >> 8) & 7) as u8)
}
#[inline(always)]
pub fn comp2lptimin2(&self) -> COMP2LPTIMIN2_R {
COMP2LPTIMIN2_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn comp2lptimin1(&self) -> COMP2LPTIMIN1_R {
COMP2LPTIMIN1_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn comp2polarity(&self) -> COMP2POLARITY_R {
COMP2POLARITY_R::new(((self.bits >> 15) & 1) != 0)
}
#[inline(always)]
pub fn comp2value(&self) -> COMP2VALUE_R {
COMP2VALUE_R::new(((self.bits >> 20) & 1) != 0)
}
#[inline(always)]
pub fn comp2lock(&self) -> COMP2LOCK_R {
COMP2LOCK_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("COMP2_CSR")
.field("comp2lock", &self.comp2lock())
.field("comp2value", &self.comp2value())
.field("comp2polarity", &self.comp2polarity())
.field("comp2lptimin1", &self.comp2lptimin1())
.field("comp2lptimin2", &self.comp2lptimin2())
.field("comp2inpsel", &self.comp2inpsel())
.field("comp2innsel", &self.comp2innsel())
.field("comp2speed", &self.comp2speed())
.field("comp2en", &self.comp2en())
.finish()
}
}
impl W {
#[inline(always)]
pub fn comp2en(&mut self) -> COMP2EN_W<COMP2_CSRrs> {
COMP2EN_W::new(self, 0)
}
#[inline(always)]
pub fn comp2speed(&mut self) -> COMP2SPEED_W<COMP2_CSRrs> {
COMP2SPEED_W::new(self, 3)
}
#[inline(always)]
pub fn comp2innsel(&mut self) -> COMP2INNSEL_W<COMP2_CSRrs> {
COMP2INNSEL_W::new(self, 4)
}
#[inline(always)]
pub fn comp2inpsel(&mut self) -> COMP2INPSEL_W<COMP2_CSRrs> {
COMP2INPSEL_W::new(self, 8)
}
#[inline(always)]
pub fn comp2lptimin2(&mut self) -> COMP2LPTIMIN2_W<COMP2_CSRrs> {
COMP2LPTIMIN2_W::new(self, 12)
}
#[inline(always)]
pub fn comp2lptimin1(&mut self) -> COMP2LPTIMIN1_W<COMP2_CSRrs> {
COMP2LPTIMIN1_W::new(self, 13)
}
#[inline(always)]
pub fn comp2polarity(&mut self) -> COMP2POLARITY_W<COMP2_CSRrs> {
COMP2POLARITY_W::new(self, 15)
}
}
pub struct COMP2_CSRrs;
impl crate::RegisterSpec for COMP2_CSRrs {
type Ux = u32;
}
impl crate::Readable for COMP2_CSRrs {}
impl crate::Writable for COMP2_CSRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for COMP2_CSRrs {}