#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::CSR {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
let r = R { bits: bits };
let mut w = W { bits: bits };
f(&r, &mut w);
self.register.set(w.bits);
}
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.bits);
}
#[doc = r" Writes the reset value to the register"]
#[inline]
pub fn reset(&self) {
self.write(|w| w)
}
}
#[doc = "Possible values of the field `COMP1EN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP1ENR {
#[doc = "Comparator 1 disabled"]
DISABLED,
#[doc = "Comparator 1 enabled"]
ENABLED,
}
impl COMP1ENR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
COMP1ENR::DISABLED => false,
COMP1ENR::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> COMP1ENR {
match value {
false => COMP1ENR::DISABLED,
true => COMP1ENR::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline]
pub fn is_disabled(&self) -> bool {
*self == COMP1ENR::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline]
pub fn is_enabled(&self) -> bool {
*self == COMP1ENR::ENABLED
}
}
#[doc = "Possible values of the field `COMP1MODE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP1MODER {
#[doc = "High speed / full power"]
HIGHSPEED,
#[doc = "Medium speed / medium power"]
MEDIUMSPEED,
#[doc = "Low speed / low power"]
LOWSPEED,
#[doc = "Very-low speed / ultra-low power"]
VERYLOWSPEED,
}
impl COMP1MODER {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
COMP1MODER::HIGHSPEED => 0,
COMP1MODER::MEDIUMSPEED => 1,
COMP1MODER::LOWSPEED => 2,
COMP1MODER::VERYLOWSPEED => 3,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> COMP1MODER {
match value {
0 => COMP1MODER::HIGHSPEED,
1 => COMP1MODER::MEDIUMSPEED,
2 => COMP1MODER::LOWSPEED,
3 => COMP1MODER::VERYLOWSPEED,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `HIGHSPEED`"]
#[inline]
pub fn is_high_speed(&self) -> bool {
*self == COMP1MODER::HIGHSPEED
}
#[doc = "Checks if the value of the field is `MEDIUMSPEED`"]
#[inline]
pub fn is_medium_speed(&self) -> bool {
*self == COMP1MODER::MEDIUMSPEED
}
#[doc = "Checks if the value of the field is `LOWSPEED`"]
#[inline]
pub fn is_low_speed(&self) -> bool {
*self == COMP1MODER::LOWSPEED
}
#[doc = "Checks if the value of the field is `VERYLOWSPEED`"]
#[inline]
pub fn is_very_low_speed(&self) -> bool {
*self == COMP1MODER::VERYLOWSPEED
}
}
#[doc = "Possible values of the field `COMP1INSEL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP1INSELR {
#[doc = "1/4 of VRefint"]
ONEQUARTERVREF,
#[doc = "1/2 of VRefint"]
ONEHALFVREF,
#[doc = "3/4 of VRefint"]
THREEQUARTERVREF,
#[doc = "VRefint"]
VREF,
#[doc = "COMP1_INM4 (PA4 with DAC_OUT1 if enabled)"]
COMP1_INM4,
#[doc = "COMP1_INM5 (PA5 with DAC_OUT2 if present and enabled)"]
COMP1_INM5,
#[doc = "COMP1_INM6 (PA0)"]
COMP1_INM6,
#[doc = r" Reserved"]
_Reserved(u8),
}
impl COMP1INSELR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
COMP1INSELR::ONEQUARTERVREF => 0,
COMP1INSELR::ONEHALFVREF => 1,
COMP1INSELR::THREEQUARTERVREF => 2,
COMP1INSELR::VREF => 3,
COMP1INSELR::COMP1_INM4 => 4,
COMP1INSELR::COMP1_INM5 => 5,
COMP1INSELR::COMP1_INM6 => 6,
COMP1INSELR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> COMP1INSELR {
match value {
0 => COMP1INSELR::ONEQUARTERVREF,
1 => COMP1INSELR::ONEHALFVREF,
2 => COMP1INSELR::THREEQUARTERVREF,
3 => COMP1INSELR::VREF,
4 => COMP1INSELR::COMP1_INM4,
5 => COMP1INSELR::COMP1_INM5,
6 => COMP1INSELR::COMP1_INM6,
i => COMP1INSELR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `ONEQUARTERVREF`"]
#[inline]
pub fn is_one_quarter_vref(&self) -> bool {
*self == COMP1INSELR::ONEQUARTERVREF
}
#[doc = "Checks if the value of the field is `ONEHALFVREF`"]
#[inline]
pub fn is_one_half_vref(&self) -> bool {
*self == COMP1INSELR::ONEHALFVREF
}
#[doc = "Checks if the value of the field is `THREEQUARTERVREF`"]
#[inline]
pub fn is_three_quarter_vref(&self) -> bool {
*self == COMP1INSELR::THREEQUARTERVREF
}
#[doc = "Checks if the value of the field is `VREF`"]
#[inline]
pub fn is_vref(&self) -> bool {
*self == COMP1INSELR::VREF
}
#[doc = "Checks if the value of the field is `COMP1_INM4`"]
#[inline]
pub fn is_comp1_inm4(&self) -> bool {
*self == COMP1INSELR::COMP1_INM4
}
#[doc = "Checks if the value of the field is `COMP1_INM5`"]
#[inline]
pub fn is_comp1_inm5(&self) -> bool {
*self == COMP1INSELR::COMP1_INM5
}
#[doc = "Checks if the value of the field is `COMP1_INM6`"]
#[inline]
pub fn is_comp1_inm6(&self) -> bool {
*self == COMP1INSELR::COMP1_INM6
}
}
#[doc = "Possible values of the field `COMP1OUTSEL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP1OUTSELR {
#[doc = "No selection"]
NOSELECTION,
#[doc = "Timer 1 break input"]
TIMER1BREAKINPUT,
#[doc = "Timer 1 Input capture 1"]
TIMER1INPUTCAPTURE1,
#[doc = "Timer 1 OCrefclear input"]
TIMER1OCREFCLEARINPUT,
#[doc = "Timer 2 input capture 4"]
TIMER2INPUTCAPTURE4,
#[doc = "Timer 2 OCrefclear input"]
TIMER2OCREFCLEARINPUT,
#[doc = "Timer 3 input capture 1"]
TIMER3INPUTCAPTURE1,
#[doc = "Timer 3 OCrefclear input"]
TIMER3OCREFCLEARINPUT,
}
impl COMP1OUTSELR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
COMP1OUTSELR::NOSELECTION => 0,
COMP1OUTSELR::TIMER1BREAKINPUT => 1,
COMP1OUTSELR::TIMER1INPUTCAPTURE1 => 2,
COMP1OUTSELR::TIMER1OCREFCLEARINPUT => 3,
COMP1OUTSELR::TIMER2INPUTCAPTURE4 => 4,
COMP1OUTSELR::TIMER2OCREFCLEARINPUT => 5,
COMP1OUTSELR::TIMER3INPUTCAPTURE1 => 6,
COMP1OUTSELR::TIMER3OCREFCLEARINPUT => 7,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> COMP1OUTSELR {
match value {
0 => COMP1OUTSELR::NOSELECTION,
1 => COMP1OUTSELR::TIMER1BREAKINPUT,
2 => COMP1OUTSELR::TIMER1INPUTCAPTURE1,
3 => COMP1OUTSELR::TIMER1OCREFCLEARINPUT,
4 => COMP1OUTSELR::TIMER2INPUTCAPTURE4,
5 => COMP1OUTSELR::TIMER2OCREFCLEARINPUT,
6 => COMP1OUTSELR::TIMER3INPUTCAPTURE1,
7 => COMP1OUTSELR::TIMER3OCREFCLEARINPUT,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `NOSELECTION`"]
#[inline]
pub fn is_no_selection(&self) -> bool {
*self == COMP1OUTSELR::NOSELECTION
}
#[doc = "Checks if the value of the field is `TIMER1BREAKINPUT`"]
#[inline]
pub fn is_timer1break_input(&self) -> bool {
*self == COMP1OUTSELR::TIMER1BREAKINPUT
}
#[doc = "Checks if the value of the field is `TIMER1INPUTCAPTURE1`"]
#[inline]
pub fn is_timer1input_capture1(&self) -> bool {
*self == COMP1OUTSELR::TIMER1INPUTCAPTURE1
}
#[doc = "Checks if the value of the field is `TIMER1OCREFCLEARINPUT`"]
#[inline]
pub fn is_timer1ocref_clear_input(&self) -> bool {
*self == COMP1OUTSELR::TIMER1OCREFCLEARINPUT
}
#[doc = "Checks if the value of the field is `TIMER2INPUTCAPTURE4`"]
#[inline]
pub fn is_timer2input_capture4(&self) -> bool {
*self == COMP1OUTSELR::TIMER2INPUTCAPTURE4
}
#[doc = "Checks if the value of the field is `TIMER2OCREFCLEARINPUT`"]
#[inline]
pub fn is_timer2ocref_clear_input(&self) -> bool {
*self == COMP1OUTSELR::TIMER2OCREFCLEARINPUT
}
#[doc = "Checks if the value of the field is `TIMER3INPUTCAPTURE1`"]
#[inline]
pub fn is_timer3input_capture1(&self) -> bool {
*self == COMP1OUTSELR::TIMER3INPUTCAPTURE1
}
#[doc = "Checks if the value of the field is `TIMER3OCREFCLEARINPUT`"]
#[inline]
pub fn is_timer3ocref_clear_input(&self) -> bool {
*self == COMP1OUTSELR::TIMER3OCREFCLEARINPUT
}
}
#[doc = "Possible values of the field `COMP1POL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP1POLR {
#[doc = "Output is not inverted"]
NOTINVERTED,
#[doc = "Output is inverted"]
INVERTED,
}
impl COMP1POLR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
COMP1POLR::NOTINVERTED => false,
COMP1POLR::INVERTED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> COMP1POLR {
match value {
false => COMP1POLR::NOTINVERTED,
true => COMP1POLR::INVERTED,
}
}
#[doc = "Checks if the value of the field is `NOTINVERTED`"]
#[inline]
pub fn is_not_inverted(&self) -> bool {
*self == COMP1POLR::NOTINVERTED
}
#[doc = "Checks if the value of the field is `INVERTED`"]
#[inline]
pub fn is_inverted(&self) -> bool {
*self == COMP1POLR::INVERTED
}
}
#[doc = "Possible values of the field `COMP1HYST`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP1HYSTR {
#[doc = "No hysteresis"]
NOHYSTERESIS,
#[doc = "Low hysteresis"]
LOWHYSTERESIS,
#[doc = "Medium hysteresis"]
MEDIUMHYSTERESIS,
#[doc = "High hysteresis"]
HIGHHYSTERESIS,
}
impl COMP1HYSTR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
COMP1HYSTR::NOHYSTERESIS => 0,
COMP1HYSTR::LOWHYSTERESIS => 1,
COMP1HYSTR::MEDIUMHYSTERESIS => 2,
COMP1HYSTR::HIGHHYSTERESIS => 3,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> COMP1HYSTR {
match value {
0 => COMP1HYSTR::NOHYSTERESIS,
1 => COMP1HYSTR::LOWHYSTERESIS,
2 => COMP1HYSTR::MEDIUMHYSTERESIS,
3 => COMP1HYSTR::HIGHHYSTERESIS,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `NOHYSTERESIS`"]
#[inline]
pub fn is_no_hysteresis(&self) -> bool {
*self == COMP1HYSTR::NOHYSTERESIS
}
#[doc = "Checks if the value of the field is `LOWHYSTERESIS`"]
#[inline]
pub fn is_low_hysteresis(&self) -> bool {
*self == COMP1HYSTR::LOWHYSTERESIS
}
#[doc = "Checks if the value of the field is `MEDIUMHYSTERESIS`"]
#[inline]
pub fn is_medium_hysteresis(&self) -> bool {
*self == COMP1HYSTR::MEDIUMHYSTERESIS
}
#[doc = "Checks if the value of the field is `HIGHHYSTERESIS`"]
#[inline]
pub fn is_high_hysteresis(&self) -> bool {
*self == COMP1HYSTR::HIGHHYSTERESIS
}
}
#[doc = "Possible values of the field `COMP1OUT`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP1OUTR {
#[doc = "Non-inverting input below inverting input"]
LOW,
#[doc = "Non-inverting input above inverting input"]
HIGH,
}
impl COMP1OUTR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
COMP1OUTR::LOW => false,
COMP1OUTR::HIGH => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> COMP1OUTR {
match value {
false => COMP1OUTR::LOW,
true => COMP1OUTR::HIGH,
}
}
#[doc = "Checks if the value of the field is `LOW`"]
#[inline]
pub fn is_low(&self) -> bool {
*self == COMP1OUTR::LOW
}
#[doc = "Checks if the value of the field is `HIGH`"]
#[inline]
pub fn is_high(&self) -> bool {
*self == COMP1OUTR::HIGH
}
}
#[doc = "Possible values of the field `COMP1LOCK`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP1LOCKR {
#[doc = "Comparator 1 CSR bits (CSR\\[15:0\\]) are read-write"]
UNLOCKED,
#[doc = "Comparator 1 CSR bits (CSR\\[15:0\\]) are read-only"]
LOCKED,
}
impl COMP1LOCKR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
COMP1LOCKR::UNLOCKED => false,
COMP1LOCKR::LOCKED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> COMP1LOCKR {
match value {
false => COMP1LOCKR::UNLOCKED,
true => COMP1LOCKR::LOCKED,
}
}
#[doc = "Checks if the value of the field is `UNLOCKED`"]
#[inline]
pub fn is_unlocked(&self) -> bool {
*self == COMP1LOCKR::UNLOCKED
}
#[doc = "Checks if the value of the field is `LOCKED`"]
#[inline]
pub fn is_locked(&self) -> bool {
*self == COMP1LOCKR::LOCKED
}
}
#[doc = "Possible values of the field `COMP2EN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP2ENR {
#[doc = "Comparator 2 disabled"]
DISABLED,
#[doc = "Comparator 2 enabled"]
ENABLED,
}
impl COMP2ENR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
COMP2ENR::DISABLED => false,
COMP2ENR::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> COMP2ENR {
match value {
false => COMP2ENR::DISABLED,
true => COMP2ENR::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline]
pub fn is_disabled(&self) -> bool {
*self == COMP2ENR::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline]
pub fn is_enabled(&self) -> bool {
*self == COMP2ENR::ENABLED
}
}
#[doc = "Possible values of the field `COMP2MODE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP2MODER {
#[doc = "High speed / full power"]
HIGHSPEED,
#[doc = "Medium speed / medium power"]
MEDIUMSPEED,
#[doc = "Low speed / low power"]
LOWSPEED,
#[doc = "Very-low speed / ultra-low power"]
VERYLOWSPEED,
}
impl COMP2MODER {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
COMP2MODER::HIGHSPEED => 0,
COMP2MODER::MEDIUMSPEED => 1,
COMP2MODER::LOWSPEED => 2,
COMP2MODER::VERYLOWSPEED => 3,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> COMP2MODER {
match value {
0 => COMP2MODER::HIGHSPEED,
1 => COMP2MODER::MEDIUMSPEED,
2 => COMP2MODER::LOWSPEED,
3 => COMP2MODER::VERYLOWSPEED,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `HIGHSPEED`"]
#[inline]
pub fn is_high_speed(&self) -> bool {
*self == COMP2MODER::HIGHSPEED
}
#[doc = "Checks if the value of the field is `MEDIUMSPEED`"]
#[inline]
pub fn is_medium_speed(&self) -> bool {
*self == COMP2MODER::MEDIUMSPEED
}
#[doc = "Checks if the value of the field is `LOWSPEED`"]
#[inline]
pub fn is_low_speed(&self) -> bool {
*self == COMP2MODER::LOWSPEED
}
#[doc = "Checks if the value of the field is `VERYLOWSPEED`"]
#[inline]
pub fn is_very_low_speed(&self) -> bool {
*self == COMP2MODER::VERYLOWSPEED
}
}
#[doc = "Possible values of the field `COMP2INSEL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP2INSELR {
#[doc = "1/4 of VRefint"]
ONEQUARTERVREF,
#[doc = "1/2 of VRefint"]
ONEHALFVREF,
#[doc = "3/4 of VRefint"]
THREEQUARTERVREF,
#[doc = "VRefint"]
VREF,
#[doc = "COMP1_INM4 (PA4 with DAC_OUT1 if enabled)"]
COMP2_INM4,
#[doc = "COMP1_INM5 (PA5 with DAC_OUT2 if present and enabled)"]
COMP2_INM5,
#[doc = "COMP1_INM6 (PA2)"]
COMP2_INM6,
#[doc = r" Reserved"]
_Reserved(u8),
}
impl COMP2INSELR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
COMP2INSELR::ONEQUARTERVREF => 0,
COMP2INSELR::ONEHALFVREF => 1,
COMP2INSELR::THREEQUARTERVREF => 2,
COMP2INSELR::VREF => 3,
COMP2INSELR::COMP2_INM4 => 4,
COMP2INSELR::COMP2_INM5 => 5,
COMP2INSELR::COMP2_INM6 => 6,
COMP2INSELR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> COMP2INSELR {
match value {
0 => COMP2INSELR::ONEQUARTERVREF,
1 => COMP2INSELR::ONEHALFVREF,
2 => COMP2INSELR::THREEQUARTERVREF,
3 => COMP2INSELR::VREF,
4 => COMP2INSELR::COMP2_INM4,
5 => COMP2INSELR::COMP2_INM5,
6 => COMP2INSELR::COMP2_INM6,
i => COMP2INSELR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `ONEQUARTERVREF`"]
#[inline]
pub fn is_one_quarter_vref(&self) -> bool {
*self == COMP2INSELR::ONEQUARTERVREF
}
#[doc = "Checks if the value of the field is `ONEHALFVREF`"]
#[inline]
pub fn is_one_half_vref(&self) -> bool {
*self == COMP2INSELR::ONEHALFVREF
}
#[doc = "Checks if the value of the field is `THREEQUARTERVREF`"]
#[inline]
pub fn is_three_quarter_vref(&self) -> bool {
*self == COMP2INSELR::THREEQUARTERVREF
}
#[doc = "Checks if the value of the field is `VREF`"]
#[inline]
pub fn is_vref(&self) -> bool {
*self == COMP2INSELR::VREF
}
#[doc = "Checks if the value of the field is `COMP2_INM4`"]
#[inline]
pub fn is_comp2_inm4(&self) -> bool {
*self == COMP2INSELR::COMP2_INM4
}
#[doc = "Checks if the value of the field is `COMP2_INM5`"]
#[inline]
pub fn is_comp2_inm5(&self) -> bool {
*self == COMP2INSELR::COMP2_INM5
}
#[doc = "Checks if the value of the field is `COMP2_INM6`"]
#[inline]
pub fn is_comp2_inm6(&self) -> bool {
*self == COMP2INSELR::COMP2_INM6
}
}
#[doc = "Possible values of the field `WNDWEN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum WNDWENR {
#[doc = "Window mode disabled"]
DISABLED,
#[doc = "Window mode enabled"]
ENABLED,
}
impl WNDWENR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
WNDWENR::DISABLED => false,
WNDWENR::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> WNDWENR {
match value {
false => WNDWENR::DISABLED,
true => WNDWENR::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline]
pub fn is_disabled(&self) -> bool {
*self == WNDWENR::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline]
pub fn is_enabled(&self) -> bool {
*self == WNDWENR::ENABLED
}
}
#[doc = "Possible values of the field `COMP2OUTSEL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP2OUTSELR {
#[doc = "No selection"]
NOSELECTION,
#[doc = "Timer 1 break input"]
TIMER1BREAKINPUT,
#[doc = "Timer 1 Input capture 1"]
TIMER1INPUTCAPTURE1,
#[doc = "Timer 1 OCrefclear input"]
TIMER1OCREFCLEARINPUT,
#[doc = "Timer 2 input capture 4"]
TIMER2INPUTCAPTURE4,
#[doc = "Timer 2 OCrefclear input"]
TIMER2OCREFCLEARINPUT,
#[doc = "Timer 3 input capture 1"]
TIMER3INPUTCAPTURE1,
#[doc = "Timer 3 OCrefclear input"]
TIMER3OCREFCLEARINPUT,
}
impl COMP2OUTSELR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
COMP2OUTSELR::NOSELECTION => 0,
COMP2OUTSELR::TIMER1BREAKINPUT => 1,
COMP2OUTSELR::TIMER1INPUTCAPTURE1 => 2,
COMP2OUTSELR::TIMER1OCREFCLEARINPUT => 3,
COMP2OUTSELR::TIMER2INPUTCAPTURE4 => 4,
COMP2OUTSELR::TIMER2OCREFCLEARINPUT => 5,
COMP2OUTSELR::TIMER3INPUTCAPTURE1 => 6,
COMP2OUTSELR::TIMER3OCREFCLEARINPUT => 7,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> COMP2OUTSELR {
match value {
0 => COMP2OUTSELR::NOSELECTION,
1 => COMP2OUTSELR::TIMER1BREAKINPUT,
2 => COMP2OUTSELR::TIMER1INPUTCAPTURE1,
3 => COMP2OUTSELR::TIMER1OCREFCLEARINPUT,
4 => COMP2OUTSELR::TIMER2INPUTCAPTURE4,
5 => COMP2OUTSELR::TIMER2OCREFCLEARINPUT,
6 => COMP2OUTSELR::TIMER3INPUTCAPTURE1,
7 => COMP2OUTSELR::TIMER3OCREFCLEARINPUT,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `NOSELECTION`"]
#[inline]
pub fn is_no_selection(&self) -> bool {
*self == COMP2OUTSELR::NOSELECTION
}
#[doc = "Checks if the value of the field is `TIMER1BREAKINPUT`"]
#[inline]
pub fn is_timer1break_input(&self) -> bool {
*self == COMP2OUTSELR::TIMER1BREAKINPUT
}
#[doc = "Checks if the value of the field is `TIMER1INPUTCAPTURE1`"]
#[inline]
pub fn is_timer1input_capture1(&self) -> bool {
*self == COMP2OUTSELR::TIMER1INPUTCAPTURE1
}
#[doc = "Checks if the value of the field is `TIMER1OCREFCLEARINPUT`"]
#[inline]
pub fn is_timer1ocref_clear_input(&self) -> bool {
*self == COMP2OUTSELR::TIMER1OCREFCLEARINPUT
}
#[doc = "Checks if the value of the field is `TIMER2INPUTCAPTURE4`"]
#[inline]
pub fn is_timer2input_capture4(&self) -> bool {
*self == COMP2OUTSELR::TIMER2INPUTCAPTURE4
}
#[doc = "Checks if the value of the field is `TIMER2OCREFCLEARINPUT`"]
#[inline]
pub fn is_timer2ocref_clear_input(&self) -> bool {
*self == COMP2OUTSELR::TIMER2OCREFCLEARINPUT
}
#[doc = "Checks if the value of the field is `TIMER3INPUTCAPTURE1`"]
#[inline]
pub fn is_timer3input_capture1(&self) -> bool {
*self == COMP2OUTSELR::TIMER3INPUTCAPTURE1
}
#[doc = "Checks if the value of the field is `TIMER3OCREFCLEARINPUT`"]
#[inline]
pub fn is_timer3ocref_clear_input(&self) -> bool {
*self == COMP2OUTSELR::TIMER3OCREFCLEARINPUT
}
}
#[doc = "Possible values of the field `COMP2POL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP2POLR {
#[doc = "Output is not inverted"]
NOTINVERTED,
#[doc = "Output is inverted"]
INVERTED,
}
impl COMP2POLR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
COMP2POLR::NOTINVERTED => false,
COMP2POLR::INVERTED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> COMP2POLR {
match value {
false => COMP2POLR::NOTINVERTED,
true => COMP2POLR::INVERTED,
}
}
#[doc = "Checks if the value of the field is `NOTINVERTED`"]
#[inline]
pub fn is_not_inverted(&self) -> bool {
*self == COMP2POLR::NOTINVERTED
}
#[doc = "Checks if the value of the field is `INVERTED`"]
#[inline]
pub fn is_inverted(&self) -> bool {
*self == COMP2POLR::INVERTED
}
}
#[doc = "Possible values of the field `COMP2HYST`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP2HYSTR {
#[doc = "No hysteresis"]
NOHYSTERESIS,
#[doc = "Low hysteresis"]
LOWHYSTERESIS,
#[doc = "Medium hysteresis"]
MEDIUMHYSTERESIS,
#[doc = "High hysteresis"]
HIGHHYSTERESIS,
}
impl COMP2HYSTR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
COMP2HYSTR::NOHYSTERESIS => 0,
COMP2HYSTR::LOWHYSTERESIS => 1,
COMP2HYSTR::MEDIUMHYSTERESIS => 2,
COMP2HYSTR::HIGHHYSTERESIS => 3,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> COMP2HYSTR {
match value {
0 => COMP2HYSTR::NOHYSTERESIS,
1 => COMP2HYSTR::LOWHYSTERESIS,
2 => COMP2HYSTR::MEDIUMHYSTERESIS,
3 => COMP2HYSTR::HIGHHYSTERESIS,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `NOHYSTERESIS`"]
#[inline]
pub fn is_no_hysteresis(&self) -> bool {
*self == COMP2HYSTR::NOHYSTERESIS
}
#[doc = "Checks if the value of the field is `LOWHYSTERESIS`"]
#[inline]
pub fn is_low_hysteresis(&self) -> bool {
*self == COMP2HYSTR::LOWHYSTERESIS
}
#[doc = "Checks if the value of the field is `MEDIUMHYSTERESIS`"]
#[inline]
pub fn is_medium_hysteresis(&self) -> bool {
*self == COMP2HYSTR::MEDIUMHYSTERESIS
}
#[doc = "Checks if the value of the field is `HIGHHYSTERESIS`"]
#[inline]
pub fn is_high_hysteresis(&self) -> bool {
*self == COMP2HYSTR::HIGHHYSTERESIS
}
}
#[doc = "Possible values of the field `COMP2OUT`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP2OUTR {
#[doc = "Non-inverting input below inverting input"]
LOW,
#[doc = "Non-inverting input above inverting input"]
HIGH,
}
impl COMP2OUTR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
COMP2OUTR::LOW => false,
COMP2OUTR::HIGH => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> COMP2OUTR {
match value {
false => COMP2OUTR::LOW,
true => COMP2OUTR::HIGH,
}
}
#[doc = "Checks if the value of the field is `LOW`"]
#[inline]
pub fn is_low(&self) -> bool {
*self == COMP2OUTR::LOW
}
#[doc = "Checks if the value of the field is `HIGH`"]
#[inline]
pub fn is_high(&self) -> bool {
*self == COMP2OUTR::HIGH
}
}
#[doc = "Possible values of the field `COMP2LOCK`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP2LOCKR {
#[doc = "Comparator 2 CSR bits (CSR\\[31:16\\]) are read-write"]
UNLOCKED,
#[doc = "Comparator 2 CSR bits (CSR\\[31:16\\]) are read-only"]
LOCKED,
}
impl COMP2LOCKR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
COMP2LOCKR::UNLOCKED => false,
COMP2LOCKR::LOCKED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> COMP2LOCKR {
match value {
false => COMP2LOCKR::UNLOCKED,
true => COMP2LOCKR::LOCKED,
}
}
#[doc = "Checks if the value of the field is `UNLOCKED`"]
#[inline]
pub fn is_unlocked(&self) -> bool {
*self == COMP2LOCKR::UNLOCKED
}
#[doc = "Checks if the value of the field is `LOCKED`"]
#[inline]
pub fn is_locked(&self) -> bool {
*self == COMP2LOCKR::LOCKED
}
}
#[doc = "Possible values of the field `COMP1SW1`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP1SW1R {
#[doc = "Switch open"]
OPEN,
#[doc = "Switch closed"]
CLOSED,
}
impl COMP1SW1R {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
COMP1SW1R::OPEN => false,
COMP1SW1R::CLOSED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> COMP1SW1R {
match value {
false => COMP1SW1R::OPEN,
true => COMP1SW1R::CLOSED,
}
}
#[doc = "Checks if the value of the field is `OPEN`"]
#[inline]
pub fn is_open(&self) -> bool {
*self == COMP1SW1R::OPEN
}
#[doc = "Checks if the value of the field is `CLOSED`"]
#[inline]
pub fn is_closed(&self) -> bool {
*self == COMP1SW1R::CLOSED
}
}
#[doc = "Values that can be written to the field `COMP1EN`"]
pub enum COMP1ENW {
#[doc = "Comparator 1 disabled"]
DISABLED,
#[doc = "Comparator 1 enabled"]
ENABLED,
}
impl COMP1ENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
COMP1ENW::DISABLED => false,
COMP1ENW::ENABLED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP1ENW<'a> {
w: &'a mut W,
}
impl<'a> _COMP1ENW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP1ENW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Comparator 1 disabled"]
#[inline]
pub fn disabled(self) -> &'a mut W {
self.variant(COMP1ENW::DISABLED)
}
#[doc = "Comparator 1 enabled"]
#[inline]
pub fn enabled(self) -> &'a mut W {
self.variant(COMP1ENW::ENABLED)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 0;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP1MODE`"]
pub enum COMP1MODEW {
#[doc = "High speed / full power"]
HIGHSPEED,
#[doc = "Medium speed / medium power"]
MEDIUMSPEED,
#[doc = "Low speed / low power"]
LOWSPEED,
#[doc = "Very-low speed / ultra-low power"]
VERYLOWSPEED,
}
impl COMP1MODEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
COMP1MODEW::HIGHSPEED => 0,
COMP1MODEW::MEDIUMSPEED => 1,
COMP1MODEW::LOWSPEED => 2,
COMP1MODEW::VERYLOWSPEED => 3,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP1MODEW<'a> {
w: &'a mut W,
}
impl<'a> _COMP1MODEW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP1MODEW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "High speed / full power"]
#[inline]
pub fn high_speed(self) -> &'a mut W {
self.variant(COMP1MODEW::HIGHSPEED)
}
#[doc = "Medium speed / medium power"]
#[inline]
pub fn medium_speed(self) -> &'a mut W {
self.variant(COMP1MODEW::MEDIUMSPEED)
}
#[doc = "Low speed / low power"]
#[inline]
pub fn low_speed(self) -> &'a mut W {
self.variant(COMP1MODEW::LOWSPEED)
}
#[doc = "Very-low speed / ultra-low power"]
#[inline]
pub fn very_low_speed(self) -> &'a mut W {
self.variant(COMP1MODEW::VERYLOWSPEED)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 3;
const OFFSET: u8 = 2;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP1INSEL`"]
pub enum COMP1INSELW {
#[doc = "1/4 of VRefint"]
ONEQUARTERVREF,
#[doc = "1/2 of VRefint"]
ONEHALFVREF,
#[doc = "3/4 of VRefint"]
THREEQUARTERVREF,
#[doc = "VRefint"]
VREF,
#[doc = "COMP1_INM4 (PA4 with DAC_OUT1 if enabled)"]
COMP1_INM4,
#[doc = "COMP1_INM5 (PA5 with DAC_OUT2 if present and enabled)"]
COMP1_INM5,
#[doc = "COMP1_INM6 (PA0)"]
COMP1_INM6,
}
impl COMP1INSELW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
COMP1INSELW::ONEQUARTERVREF => 0,
COMP1INSELW::ONEHALFVREF => 1,
COMP1INSELW::THREEQUARTERVREF => 2,
COMP1INSELW::VREF => 3,
COMP1INSELW::COMP1_INM4 => 4,
COMP1INSELW::COMP1_INM5 => 5,
COMP1INSELW::COMP1_INM6 => 6,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP1INSELW<'a> {
w: &'a mut W,
}
impl<'a> _COMP1INSELW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP1INSELW) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "1/4 of VRefint"]
#[inline]
pub fn one_quarter_vref(self) -> &'a mut W {
self.variant(COMP1INSELW::ONEQUARTERVREF)
}
#[doc = "1/2 of VRefint"]
#[inline]
pub fn one_half_vref(self) -> &'a mut W {
self.variant(COMP1INSELW::ONEHALFVREF)
}
#[doc = "3/4 of VRefint"]
#[inline]
pub fn three_quarter_vref(self) -> &'a mut W {
self.variant(COMP1INSELW::THREEQUARTERVREF)
}
#[doc = "VRefint"]
#[inline]
pub fn vref(self) -> &'a mut W {
self.variant(COMP1INSELW::VREF)
}
#[doc = "COMP1_INM4 (PA4 with DAC_OUT1 if enabled)"]
#[inline]
pub fn comp1_inm4(self) -> &'a mut W {
self.variant(COMP1INSELW::COMP1_INM4)
}
#[doc = "COMP1_INM5 (PA5 with DAC_OUT2 if present and enabled)"]
#[inline]
pub fn comp1_inm5(self) -> &'a mut W {
self.variant(COMP1INSELW::COMP1_INM5)
}
#[doc = "COMP1_INM6 (PA0)"]
#[inline]
pub fn comp1_inm6(self) -> &'a mut W {
self.variant(COMP1INSELW::COMP1_INM6)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 7;
const OFFSET: u8 = 4;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP1OUTSEL`"]
pub enum COMP1OUTSELW {
#[doc = "No selection"]
NOSELECTION,
#[doc = "Timer 1 break input"]
TIMER1BREAKINPUT,
#[doc = "Timer 1 Input capture 1"]
TIMER1INPUTCAPTURE1,
#[doc = "Timer 1 OCrefclear input"]
TIMER1OCREFCLEARINPUT,
#[doc = "Timer 2 input capture 4"]
TIMER2INPUTCAPTURE4,
#[doc = "Timer 2 OCrefclear input"]
TIMER2OCREFCLEARINPUT,
#[doc = "Timer 3 input capture 1"]
TIMER3INPUTCAPTURE1,
#[doc = "Timer 3 OCrefclear input"]
TIMER3OCREFCLEARINPUT,
}
impl COMP1OUTSELW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
COMP1OUTSELW::NOSELECTION => 0,
COMP1OUTSELW::TIMER1BREAKINPUT => 1,
COMP1OUTSELW::TIMER1INPUTCAPTURE1 => 2,
COMP1OUTSELW::TIMER1OCREFCLEARINPUT => 3,
COMP1OUTSELW::TIMER2INPUTCAPTURE4 => 4,
COMP1OUTSELW::TIMER2OCREFCLEARINPUT => 5,
COMP1OUTSELW::TIMER3INPUTCAPTURE1 => 6,
COMP1OUTSELW::TIMER3OCREFCLEARINPUT => 7,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP1OUTSELW<'a> {
w: &'a mut W,
}
impl<'a> _COMP1OUTSELW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP1OUTSELW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "No selection"]
#[inline]
pub fn no_selection(self) -> &'a mut W {
self.variant(COMP1OUTSELW::NOSELECTION)
}
#[doc = "Timer 1 break input"]
#[inline]
pub fn timer1break_input(self) -> &'a mut W {
self.variant(COMP1OUTSELW::TIMER1BREAKINPUT)
}
#[doc = "Timer 1 Input capture 1"]
#[inline]
pub fn timer1input_capture1(self) -> &'a mut W {
self.variant(COMP1OUTSELW::TIMER1INPUTCAPTURE1)
}
#[doc = "Timer 1 OCrefclear input"]
#[inline]
pub fn timer1ocref_clear_input(self) -> &'a mut W {
self.variant(COMP1OUTSELW::TIMER1OCREFCLEARINPUT)
}
#[doc = "Timer 2 input capture 4"]
#[inline]
pub fn timer2input_capture4(self) -> &'a mut W {
self.variant(COMP1OUTSELW::TIMER2INPUTCAPTURE4)
}
#[doc = "Timer 2 OCrefclear input"]
#[inline]
pub fn timer2ocref_clear_input(self) -> &'a mut W {
self.variant(COMP1OUTSELW::TIMER2OCREFCLEARINPUT)
}
#[doc = "Timer 3 input capture 1"]
#[inline]
pub fn timer3input_capture1(self) -> &'a mut W {
self.variant(COMP1OUTSELW::TIMER3INPUTCAPTURE1)
}
#[doc = "Timer 3 OCrefclear input"]
#[inline]
pub fn timer3ocref_clear_input(self) -> &'a mut W {
self.variant(COMP1OUTSELW::TIMER3OCREFCLEARINPUT)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 7;
const OFFSET: u8 = 8;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP1POL`"]
pub enum COMP1POLW {
#[doc = "Output is not inverted"]
NOTINVERTED,
#[doc = "Output is inverted"]
INVERTED,
}
impl COMP1POLW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
COMP1POLW::NOTINVERTED => false,
COMP1POLW::INVERTED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP1POLW<'a> {
w: &'a mut W,
}
impl<'a> _COMP1POLW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP1POLW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Output is not inverted"]
#[inline]
pub fn not_inverted(self) -> &'a mut W {
self.variant(COMP1POLW::NOTINVERTED)
}
#[doc = "Output is inverted"]
#[inline]
pub fn inverted(self) -> &'a mut W {
self.variant(COMP1POLW::INVERTED)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 11;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP1HYST`"]
pub enum COMP1HYSTW {
#[doc = "No hysteresis"]
NOHYSTERESIS,
#[doc = "Low hysteresis"]
LOWHYSTERESIS,
#[doc = "Medium hysteresis"]
MEDIUMHYSTERESIS,
#[doc = "High hysteresis"]
HIGHHYSTERESIS,
}
impl COMP1HYSTW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
COMP1HYSTW::NOHYSTERESIS => 0,
COMP1HYSTW::LOWHYSTERESIS => 1,
COMP1HYSTW::MEDIUMHYSTERESIS => 2,
COMP1HYSTW::HIGHHYSTERESIS => 3,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP1HYSTW<'a> {
w: &'a mut W,
}
impl<'a> _COMP1HYSTW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP1HYSTW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "No hysteresis"]
#[inline]
pub fn no_hysteresis(self) -> &'a mut W {
self.variant(COMP1HYSTW::NOHYSTERESIS)
}
#[doc = "Low hysteresis"]
#[inline]
pub fn low_hysteresis(self) -> &'a mut W {
self.variant(COMP1HYSTW::LOWHYSTERESIS)
}
#[doc = "Medium hysteresis"]
#[inline]
pub fn medium_hysteresis(self) -> &'a mut W {
self.variant(COMP1HYSTW::MEDIUMHYSTERESIS)
}
#[doc = "High hysteresis"]
#[inline]
pub fn high_hysteresis(self) -> &'a mut W {
self.variant(COMP1HYSTW::HIGHHYSTERESIS)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 3;
const OFFSET: u8 = 12;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP1LOCK`"]
pub enum COMP1LOCKW {
#[doc = "Comparator 1 CSR bits (CSR\\[15:0\\]) are read-write"]
UNLOCKED,
#[doc = "Comparator 1 CSR bits (CSR\\[15:0\\]) are read-only"]
LOCKED,
}
impl COMP1LOCKW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
COMP1LOCKW::UNLOCKED => false,
COMP1LOCKW::LOCKED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP1LOCKW<'a> {
w: &'a mut W,
}
impl<'a> _COMP1LOCKW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP1LOCKW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Comparator 1 CSR bits (CSR\\[15:0\\]) are read-write"]
#[inline]
pub fn unlocked(self) -> &'a mut W {
self.variant(COMP1LOCKW::UNLOCKED)
}
#[doc = "Comparator 1 CSR bits (CSR\\[15:0\\]) are read-only"]
#[inline]
pub fn locked(self) -> &'a mut W {
self.variant(COMP1LOCKW::LOCKED)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 15;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP2EN`"]
pub enum COMP2ENW {
#[doc = "Comparator 2 disabled"]
DISABLED,
#[doc = "Comparator 2 enabled"]
ENABLED,
}
impl COMP2ENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
COMP2ENW::DISABLED => false,
COMP2ENW::ENABLED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP2ENW<'a> {
w: &'a mut W,
}
impl<'a> _COMP2ENW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP2ENW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Comparator 2 disabled"]
#[inline]
pub fn disabled(self) -> &'a mut W {
self.variant(COMP2ENW::DISABLED)
}
#[doc = "Comparator 2 enabled"]
#[inline]
pub fn enabled(self) -> &'a mut W {
self.variant(COMP2ENW::ENABLED)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 16;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP2MODE`"]
pub enum COMP2MODEW {
#[doc = "High speed / full power"]
HIGHSPEED,
#[doc = "Medium speed / medium power"]
MEDIUMSPEED,
#[doc = "Low speed / low power"]
LOWSPEED,
#[doc = "Very-low speed / ultra-low power"]
VERYLOWSPEED,
}
impl COMP2MODEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
COMP2MODEW::HIGHSPEED => 0,
COMP2MODEW::MEDIUMSPEED => 1,
COMP2MODEW::LOWSPEED => 2,
COMP2MODEW::VERYLOWSPEED => 3,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP2MODEW<'a> {
w: &'a mut W,
}
impl<'a> _COMP2MODEW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP2MODEW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "High speed / full power"]
#[inline]
pub fn high_speed(self) -> &'a mut W {
self.variant(COMP2MODEW::HIGHSPEED)
}
#[doc = "Medium speed / medium power"]
#[inline]
pub fn medium_speed(self) -> &'a mut W {
self.variant(COMP2MODEW::MEDIUMSPEED)
}
#[doc = "Low speed / low power"]
#[inline]
pub fn low_speed(self) -> &'a mut W {
self.variant(COMP2MODEW::LOWSPEED)
}
#[doc = "Very-low speed / ultra-low power"]
#[inline]
pub fn very_low_speed(self) -> &'a mut W {
self.variant(COMP2MODEW::VERYLOWSPEED)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 3;
const OFFSET: u8 = 18;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP2INSEL`"]
pub enum COMP2INSELW {
#[doc = "1/4 of VRefint"]
ONEQUARTERVREF,
#[doc = "1/2 of VRefint"]
ONEHALFVREF,
#[doc = "3/4 of VRefint"]
THREEQUARTERVREF,
#[doc = "VRefint"]
VREF,
#[doc = "COMP1_INM4 (PA4 with DAC_OUT1 if enabled)"]
COMP2_INM4,
#[doc = "COMP1_INM5 (PA5 with DAC_OUT2 if present and enabled)"]
COMP2_INM5,
#[doc = "COMP1_INM6 (PA2)"]
COMP2_INM6,
}
impl COMP2INSELW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
COMP2INSELW::ONEQUARTERVREF => 0,
COMP2INSELW::ONEHALFVREF => 1,
COMP2INSELW::THREEQUARTERVREF => 2,
COMP2INSELW::VREF => 3,
COMP2INSELW::COMP2_INM4 => 4,
COMP2INSELW::COMP2_INM5 => 5,
COMP2INSELW::COMP2_INM6 => 6,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP2INSELW<'a> {
w: &'a mut W,
}
impl<'a> _COMP2INSELW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP2INSELW) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "1/4 of VRefint"]
#[inline]
pub fn one_quarter_vref(self) -> &'a mut W {
self.variant(COMP2INSELW::ONEQUARTERVREF)
}
#[doc = "1/2 of VRefint"]
#[inline]
pub fn one_half_vref(self) -> &'a mut W {
self.variant(COMP2INSELW::ONEHALFVREF)
}
#[doc = "3/4 of VRefint"]
#[inline]
pub fn three_quarter_vref(self) -> &'a mut W {
self.variant(COMP2INSELW::THREEQUARTERVREF)
}
#[doc = "VRefint"]
#[inline]
pub fn vref(self) -> &'a mut W {
self.variant(COMP2INSELW::VREF)
}
#[doc = "COMP1_INM4 (PA4 with DAC_OUT1 if enabled)"]
#[inline]
pub fn comp2_inm4(self) -> &'a mut W {
self.variant(COMP2INSELW::COMP2_INM4)
}
#[doc = "COMP1_INM5 (PA5 with DAC_OUT2 if present and enabled)"]
#[inline]
pub fn comp2_inm5(self) -> &'a mut W {
self.variant(COMP2INSELW::COMP2_INM5)
}
#[doc = "COMP1_INM6 (PA2)"]
#[inline]
pub fn comp2_inm6(self) -> &'a mut W {
self.variant(COMP2INSELW::COMP2_INM6)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 7;
const OFFSET: u8 = 20;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `WNDWEN`"]
pub enum WNDWENW {
#[doc = "Window mode disabled"]
DISABLED,
#[doc = "Window mode enabled"]
ENABLED,
}
impl WNDWENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
WNDWENW::DISABLED => false,
WNDWENW::ENABLED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _WNDWENW<'a> {
w: &'a mut W,
}
impl<'a> _WNDWENW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: WNDWENW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Window mode disabled"]
#[inline]
pub fn disabled(self) -> &'a mut W {
self.variant(WNDWENW::DISABLED)
}
#[doc = "Window mode enabled"]
#[inline]
pub fn enabled(self) -> &'a mut W {
self.variant(WNDWENW::ENABLED)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 23;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP2OUTSEL`"]
pub enum COMP2OUTSELW {
#[doc = "No selection"]
NOSELECTION,
#[doc = "Timer 1 break input"]
TIMER1BREAKINPUT,
#[doc = "Timer 1 Input capture 1"]
TIMER1INPUTCAPTURE1,
#[doc = "Timer 1 OCrefclear input"]
TIMER1OCREFCLEARINPUT,
#[doc = "Timer 2 input capture 4"]
TIMER2INPUTCAPTURE4,
#[doc = "Timer 2 OCrefclear input"]
TIMER2OCREFCLEARINPUT,
#[doc = "Timer 3 input capture 1"]
TIMER3INPUTCAPTURE1,
#[doc = "Timer 3 OCrefclear input"]
TIMER3OCREFCLEARINPUT,
}
impl COMP2OUTSELW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
COMP2OUTSELW::NOSELECTION => 0,
COMP2OUTSELW::TIMER1BREAKINPUT => 1,
COMP2OUTSELW::TIMER1INPUTCAPTURE1 => 2,
COMP2OUTSELW::TIMER1OCREFCLEARINPUT => 3,
COMP2OUTSELW::TIMER2INPUTCAPTURE4 => 4,
COMP2OUTSELW::TIMER2OCREFCLEARINPUT => 5,
COMP2OUTSELW::TIMER3INPUTCAPTURE1 => 6,
COMP2OUTSELW::TIMER3OCREFCLEARINPUT => 7,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP2OUTSELW<'a> {
w: &'a mut W,
}
impl<'a> _COMP2OUTSELW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP2OUTSELW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "No selection"]
#[inline]
pub fn no_selection(self) -> &'a mut W {
self.variant(COMP2OUTSELW::NOSELECTION)
}
#[doc = "Timer 1 break input"]
#[inline]
pub fn timer1break_input(self) -> &'a mut W {
self.variant(COMP2OUTSELW::TIMER1BREAKINPUT)
}
#[doc = "Timer 1 Input capture 1"]
#[inline]
pub fn timer1input_capture1(self) -> &'a mut W {
self.variant(COMP2OUTSELW::TIMER1INPUTCAPTURE1)
}
#[doc = "Timer 1 OCrefclear input"]
#[inline]
pub fn timer1ocref_clear_input(self) -> &'a mut W {
self.variant(COMP2OUTSELW::TIMER1OCREFCLEARINPUT)
}
#[doc = "Timer 2 input capture 4"]
#[inline]
pub fn timer2input_capture4(self) -> &'a mut W {
self.variant(COMP2OUTSELW::TIMER2INPUTCAPTURE4)
}
#[doc = "Timer 2 OCrefclear input"]
#[inline]
pub fn timer2ocref_clear_input(self) -> &'a mut W {
self.variant(COMP2OUTSELW::TIMER2OCREFCLEARINPUT)
}
#[doc = "Timer 3 input capture 1"]
#[inline]
pub fn timer3input_capture1(self) -> &'a mut W {
self.variant(COMP2OUTSELW::TIMER3INPUTCAPTURE1)
}
#[doc = "Timer 3 OCrefclear input"]
#[inline]
pub fn timer3ocref_clear_input(self) -> &'a mut W {
self.variant(COMP2OUTSELW::TIMER3OCREFCLEARINPUT)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 7;
const OFFSET: u8 = 24;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP2POL`"]
pub enum COMP2POLW {
#[doc = "Output is not inverted"]
NOTINVERTED,
#[doc = "Output is inverted"]
INVERTED,
}
impl COMP2POLW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
COMP2POLW::NOTINVERTED => false,
COMP2POLW::INVERTED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP2POLW<'a> {
w: &'a mut W,
}
impl<'a> _COMP2POLW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP2POLW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Output is not inverted"]
#[inline]
pub fn not_inverted(self) -> &'a mut W {
self.variant(COMP2POLW::NOTINVERTED)
}
#[doc = "Output is inverted"]
#[inline]
pub fn inverted(self) -> &'a mut W {
self.variant(COMP2POLW::INVERTED)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 27;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP2HYST`"]
pub enum COMP2HYSTW {
#[doc = "No hysteresis"]
NOHYSTERESIS,
#[doc = "Low hysteresis"]
LOWHYSTERESIS,
#[doc = "Medium hysteresis"]
MEDIUMHYSTERESIS,
#[doc = "High hysteresis"]
HIGHHYSTERESIS,
}
impl COMP2HYSTW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
COMP2HYSTW::NOHYSTERESIS => 0,
COMP2HYSTW::LOWHYSTERESIS => 1,
COMP2HYSTW::MEDIUMHYSTERESIS => 2,
COMP2HYSTW::HIGHHYSTERESIS => 3,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP2HYSTW<'a> {
w: &'a mut W,
}
impl<'a> _COMP2HYSTW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP2HYSTW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "No hysteresis"]
#[inline]
pub fn no_hysteresis(self) -> &'a mut W {
self.variant(COMP2HYSTW::NOHYSTERESIS)
}
#[doc = "Low hysteresis"]
#[inline]
pub fn low_hysteresis(self) -> &'a mut W {
self.variant(COMP2HYSTW::LOWHYSTERESIS)
}
#[doc = "Medium hysteresis"]
#[inline]
pub fn medium_hysteresis(self) -> &'a mut W {
self.variant(COMP2HYSTW::MEDIUMHYSTERESIS)
}
#[doc = "High hysteresis"]
#[inline]
pub fn high_hysteresis(self) -> &'a mut W {
self.variant(COMP2HYSTW::HIGHHYSTERESIS)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 3;
const OFFSET: u8 = 28;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP2LOCK`"]
pub enum COMP2LOCKW {
#[doc = "Comparator 2 CSR bits (CSR\\[31:16\\]) are read-write"]
UNLOCKED,
#[doc = "Comparator 2 CSR bits (CSR\\[31:16\\]) are read-only"]
LOCKED,
}
impl COMP2LOCKW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
COMP2LOCKW::UNLOCKED => false,
COMP2LOCKW::LOCKED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP2LOCKW<'a> {
w: &'a mut W,
}
impl<'a> _COMP2LOCKW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP2LOCKW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Comparator 2 CSR bits (CSR\\[31:16\\]) are read-write"]
#[inline]
pub fn unlocked(self) -> &'a mut W {
self.variant(COMP2LOCKW::UNLOCKED)
}
#[doc = "Comparator 2 CSR bits (CSR\\[31:16\\]) are read-only"]
#[inline]
pub fn locked(self) -> &'a mut W {
self.variant(COMP2LOCKW::LOCKED)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 31;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `COMP1SW1`"]
pub enum COMP1SW1W {
#[doc = "Switch open"]
OPEN,
#[doc = "Switch closed"]
CLOSED,
}
impl COMP1SW1W {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
COMP1SW1W::OPEN => false,
COMP1SW1W::CLOSED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _COMP1SW1W<'a> {
w: &'a mut W,
}
impl<'a> _COMP1SW1W<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: COMP1SW1W) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Switch open"]
#[inline]
pub fn open(self) -> &'a mut W {
self.variant(COMP1SW1W::OPEN)
}
#[doc = "Switch closed"]
#[inline]
pub fn closed(self) -> &'a mut W {
self.variant(COMP1SW1W::CLOSED)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 1;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 0 - Comparator 1 enable"]
#[inline]
pub fn comp1en(&self) -> COMP1ENR {
COMP1ENR::_from({
const MASK: bool = true;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 2:3 - Comparator 1 mode"]
#[inline]
pub fn comp1mode(&self) -> COMP1MODER {
COMP1MODER::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 2;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bits 4:6 - Comparator 1 inverting input selection"]
#[inline]
pub fn comp1insel(&self) -> COMP1INSELR {
COMP1INSELR::_from({
const MASK: u8 = 7;
const OFFSET: u8 = 4;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bits 8:10 - Comparator 1 output selection"]
#[inline]
pub fn comp1outsel(&self) -> COMP1OUTSELR {
COMP1OUTSELR::_from({
const MASK: u8 = 7;
const OFFSET: u8 = 8;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 11 - Comparator 1 output polarity"]
#[inline]
pub fn comp1pol(&self) -> COMP1POLR {
COMP1POLR::_from({
const MASK: bool = true;
const OFFSET: u8 = 11;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 12:13 - Comparator 1 hysteresis"]
#[inline]
pub fn comp1hyst(&self) -> COMP1HYSTR {
COMP1HYSTR::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 12;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 14 - Comparator 1 output"]
#[inline]
pub fn comp1out(&self) -> COMP1OUTR {
COMP1OUTR::_from({
const MASK: bool = true;
const OFFSET: u8 = 14;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 15 - Comparator 1 lock"]
#[inline]
pub fn comp1lock(&self) -> COMP1LOCKR {
COMP1LOCKR::_from({
const MASK: bool = true;
const OFFSET: u8 = 15;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 16 - Comparator 2 enable"]
#[inline]
pub fn comp2en(&self) -> COMP2ENR {
COMP2ENR::_from({
const MASK: bool = true;
const OFFSET: u8 = 16;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 18:19 - Comparator 2 mode"]
#[inline]
pub fn comp2mode(&self) -> COMP2MODER {
COMP2MODER::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 18;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bits 20:22 - Comparator 2 inverting input selection"]
#[inline]
pub fn comp2insel(&self) -> COMP2INSELR {
COMP2INSELR::_from({
const MASK: u8 = 7;
const OFFSET: u8 = 20;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 23 - Window mode enable"]
#[inline]
pub fn wndwen(&self) -> WNDWENR {
WNDWENR::_from({
const MASK: bool = true;
const OFFSET: u8 = 23;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 24:26 - Comparator 2 output selection"]
#[inline]
pub fn comp2outsel(&self) -> COMP2OUTSELR {
COMP2OUTSELR::_from({
const MASK: u8 = 7;
const OFFSET: u8 = 24;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 27 - Comparator 2 output polarity"]
#[inline]
pub fn comp2pol(&self) -> COMP2POLR {
COMP2POLR::_from({
const MASK: bool = true;
const OFFSET: u8 = 27;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 28:29 - Comparator 2 hysteresis"]
#[inline]
pub fn comp2hyst(&self) -> COMP2HYSTR {
COMP2HYSTR::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 28;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 30 - Comparator 2 output"]
#[inline]
pub fn comp2out(&self) -> COMP2OUTR {
COMP2OUTR::_from({
const MASK: bool = true;
const OFFSET: u8 = 30;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 31 - Comparator 2 lock"]
#[inline]
pub fn comp2lock(&self) -> COMP2LOCKR {
COMP2LOCKR::_from({
const MASK: bool = true;
const OFFSET: u8 = 31;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 1 - Comparator 1 non inverting input DAC switch"]
#[inline]
pub fn comp1sw1(&self) -> COMP1SW1R {
COMP1SW1R::_from({
const MASK: bool = true;
const OFFSET: u8 = 1;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 0 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 0 - Comparator 1 enable"]
#[inline]
pub fn comp1en(&mut self) -> _COMP1ENW {
_COMP1ENW { w: self }
}
#[doc = "Bits 2:3 - Comparator 1 mode"]
#[inline]
pub fn comp1mode(&mut self) -> _COMP1MODEW {
_COMP1MODEW { w: self }
}
#[doc = "Bits 4:6 - Comparator 1 inverting input selection"]
#[inline]
pub fn comp1insel(&mut self) -> _COMP1INSELW {
_COMP1INSELW { w: self }
}
#[doc = "Bits 8:10 - Comparator 1 output selection"]
#[inline]
pub fn comp1outsel(&mut self) -> _COMP1OUTSELW {
_COMP1OUTSELW { w: self }
}
#[doc = "Bit 11 - Comparator 1 output polarity"]
#[inline]
pub fn comp1pol(&mut self) -> _COMP1POLW {
_COMP1POLW { w: self }
}
#[doc = "Bits 12:13 - Comparator 1 hysteresis"]
#[inline]
pub fn comp1hyst(&mut self) -> _COMP1HYSTW {
_COMP1HYSTW { w: self }
}
#[doc = "Bit 15 - Comparator 1 lock"]
#[inline]
pub fn comp1lock(&mut self) -> _COMP1LOCKW {
_COMP1LOCKW { w: self }
}
#[doc = "Bit 16 - Comparator 2 enable"]
#[inline]
pub fn comp2en(&mut self) -> _COMP2ENW {
_COMP2ENW { w: self }
}
#[doc = "Bits 18:19 - Comparator 2 mode"]
#[inline]
pub fn comp2mode(&mut self) -> _COMP2MODEW {
_COMP2MODEW { w: self }
}
#[doc = "Bits 20:22 - Comparator 2 inverting input selection"]
#[inline]
pub fn comp2insel(&mut self) -> _COMP2INSELW {
_COMP2INSELW { w: self }
}
#[doc = "Bit 23 - Window mode enable"]
#[inline]
pub fn wndwen(&mut self) -> _WNDWENW {
_WNDWENW { w: self }
}
#[doc = "Bits 24:26 - Comparator 2 output selection"]
#[inline]
pub fn comp2outsel(&mut self) -> _COMP2OUTSELW {
_COMP2OUTSELW { w: self }
}
#[doc = "Bit 27 - Comparator 2 output polarity"]
#[inline]
pub fn comp2pol(&mut self) -> _COMP2POLW {
_COMP2POLW { w: self }
}
#[doc = "Bits 28:29 - Comparator 2 hysteresis"]
#[inline]
pub fn comp2hyst(&mut self) -> _COMP2HYSTW {
_COMP2HYSTW { w: self }
}
#[doc = "Bit 31 - Comparator 2 lock"]
#[inline]
pub fn comp2lock(&mut self) -> _COMP2LOCKW {
_COMP2LOCKW { w: self }
}
#[doc = "Bit 1 - Comparator 1 non inverting input DAC switch"]
#[inline]
pub fn comp1sw1(&mut self) -> _COMP1SW1W {
_COMP1SW1W { w: self }
}
}