#[doc = "Reader of register CSR"]
pub type R = crate::R<u32, super::CSR>;
#[doc = "Writer for register CSR"]
pub type W = crate::W<u32, super::CSR>;
#[doc = "Register CSR `reset()`'s with value 0"]
impl crate::ResetValue for super::CSR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Enable WKUP pin 2\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EWUP2_A {
#[doc = "0: WKUP pin 2 is used for general purpose I/Os. An event on the WKUP pin 2 does not wakeup the device from Standby mode"]
DISABLED,
#[doc = "1: WKUP pin 2 is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP pin 2 wakes-up the system from Standby mode)"]
ENABLED,
}
impl From<EWUP2_A> for bool {
#[inline(always)]
fn from(variant: EWUP2_A) -> Self {
match variant {
EWUP2_A::DISABLED => false,
EWUP2_A::ENABLED => true,
}
}
}
#[doc = "Reader of field `EWUP2`"]
pub type EWUP2_R = crate::R<bool, EWUP2_A>;
impl EWUP2_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> EWUP2_A {
match self.bits {
false => EWUP2_A::DISABLED,
true => EWUP2_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == EWUP2_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == EWUP2_A::ENABLED
}
}
#[doc = "Write proxy for field `EWUP2`"]
pub struct EWUP2_W<'a> {
w: &'a mut W,
}
impl<'a> EWUP2_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: EWUP2_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "WKUP pin 2 is used for general purpose I/Os. An event on the WKUP pin 2 does not wakeup the device from Standby mode"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(EWUP2_A::DISABLED)
}
#[doc = "WKUP pin 2 is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP pin 2 wakes-up the system from Standby mode)"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(EWUP2_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 << 9)) | (((value as u32) & 0x01) << 9);
self.w
}
}
#[doc = "Enable WKUP pin 1\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EWUP1_A {
#[doc = "0: WKUP pin 1 is used for general purpose I/Os. An event on the WKUP pin 1 does not wakeup the device from Standby mode"]
DISABLED,
#[doc = "1: WKUP pin 1 is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP pin 1 wakes-up the system from Standby mode)"]
ENABLED,
}
impl From<EWUP1_A> for bool {
#[inline(always)]
fn from(variant: EWUP1_A) -> Self {
match variant {
EWUP1_A::DISABLED => false,
EWUP1_A::ENABLED => true,
}
}
}
#[doc = "Reader of field `EWUP1`"]
pub type EWUP1_R = crate::R<bool, EWUP1_A>;
impl EWUP1_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> EWUP1_A {
match self.bits {
false => EWUP1_A::DISABLED,
true => EWUP1_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == EWUP1_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == EWUP1_A::ENABLED
}
}
#[doc = "Write proxy for field `EWUP1`"]
pub struct EWUP1_W<'a> {
w: &'a mut W,
}
impl<'a> EWUP1_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: EWUP1_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "WKUP pin 1 is used for general purpose I/Os. An event on the WKUP pin 1 does not wakeup the device from Standby mode"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(EWUP1_A::DISABLED)
}
#[doc = "WKUP pin 1 is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP pin 1 wakes-up the system from Standby mode)"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(EWUP1_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 << 8)) | (((value as u32) & 0x01) << 8);
self.w
}
}
#[doc = "Internal voltage reference ready flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VREFINTRDYF_A {
#[doc = "0: VREFINT is OFF"]
NOTREADY,
#[doc = "1: VREFINT is ready"]
READY,
}
impl From<VREFINTRDYF_A> for bool {
#[inline(always)]
fn from(variant: VREFINTRDYF_A) -> Self {
match variant {
VREFINTRDYF_A::NOTREADY => false,
VREFINTRDYF_A::READY => true,
}
}
}
#[doc = "Reader of field `VREFINTRDYF`"]
pub type VREFINTRDYF_R = crate::R<bool, VREFINTRDYF_A>;
impl VREFINTRDYF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> VREFINTRDYF_A {
match self.bits {
false => VREFINTRDYF_A::NOTREADY,
true => VREFINTRDYF_A::READY,
}
}
#[doc = "Checks if the value of the field is `NOTREADY`"]
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == VREFINTRDYF_A::NOTREADY
}
#[doc = "Checks if the value of the field is `READY`"]
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == VREFINTRDYF_A::READY
}
}
#[doc = "PVD output\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PVDO_A {
#[doc = "0: VDD is higher than the PVD threshold selected with the PLS\\[2:0\\] bits"]
ABOVETHRESHOLD,
#[doc = "1: VDD is lower than the PVD threshold selected with the PLS\\[2:0\\] bits"]
BELOWTHRESHOLD,
}
impl From<PVDO_A> for bool {
#[inline(always)]
fn from(variant: PVDO_A) -> Self {
match variant {
PVDO_A::ABOVETHRESHOLD => false,
PVDO_A::BELOWTHRESHOLD => true,
}
}
}
#[doc = "Reader of field `PVDO`"]
pub type PVDO_R = crate::R<bool, PVDO_A>;
impl PVDO_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> PVDO_A {
match self.bits {
false => PVDO_A::ABOVETHRESHOLD,
true => PVDO_A::BELOWTHRESHOLD,
}
}
#[doc = "Checks if the value of the field is `ABOVETHRESHOLD`"]
#[inline(always)]
pub fn is_above_threshold(&self) -> bool {
*self == PVDO_A::ABOVETHRESHOLD
}
#[doc = "Checks if the value of the field is `BELOWTHRESHOLD`"]
#[inline(always)]
pub fn is_below_threshold(&self) -> bool {
*self == PVDO_A::BELOWTHRESHOLD
}
}
#[doc = "Standby flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SBF_A {
#[doc = "0: Device has not been in Standby mode"]
NOSTANDBYEVENT,
#[doc = "1: Device has been in Standby mode"]
STANDBYEVENT,
}
impl From<SBF_A> for bool {
#[inline(always)]
fn from(variant: SBF_A) -> Self {
match variant {
SBF_A::NOSTANDBYEVENT => false,
SBF_A::STANDBYEVENT => true,
}
}
}
#[doc = "Reader of field `SBF`"]
pub type SBF_R = crate::R<bool, SBF_A>;
impl SBF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> SBF_A {
match self.bits {
false => SBF_A::NOSTANDBYEVENT,
true => SBF_A::STANDBYEVENT,
}
}
#[doc = "Checks if the value of the field is `NOSTANDBYEVENT`"]
#[inline(always)]
pub fn is_no_standby_event(&self) -> bool {
*self == SBF_A::NOSTANDBYEVENT
}
#[doc = "Checks if the value of the field is `STANDBYEVENT`"]
#[inline(always)]
pub fn is_standby_event(&self) -> bool {
*self == SBF_A::STANDBYEVENT
}
}
#[doc = "Wakeup flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum WUF_A {
#[doc = "0: No wakeup event occurred"]
NOWAKEUPEVENT,
#[doc = "1: A wakeup event was received from the WKUP pin or from the RTC alarm (Alarm A or Alarm B), RTC Tamper event, RTC TimeStamp event or RTC Wakeup)"]
WAKEUPEVENT,
}
impl From<WUF_A> for bool {
#[inline(always)]
fn from(variant: WUF_A) -> Self {
match variant {
WUF_A::NOWAKEUPEVENT => false,
WUF_A::WAKEUPEVENT => true,
}
}
}
#[doc = "Reader of field `WUF`"]
pub type WUF_R = crate::R<bool, WUF_A>;
impl WUF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> WUF_A {
match self.bits {
false => WUF_A::NOWAKEUPEVENT,
true => WUF_A::WAKEUPEVENT,
}
}
#[doc = "Checks if the value of the field is `NOWAKEUPEVENT`"]
#[inline(always)]
pub fn is_no_wakeup_event(&self) -> bool {
*self == WUF_A::NOWAKEUPEVENT
}
#[doc = "Checks if the value of the field is `WAKEUPEVENT`"]
#[inline(always)]
pub fn is_wakeup_event(&self) -> bool {
*self == WUF_A::WAKEUPEVENT
}
}
#[doc = "Voltage Scaling select flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VOSF_A {
#[doc = "0: Regulator is ready in the selected voltage range"]
READY,
#[doc = "1: Regulator voltage output is changing to the required VOS level"]
NOTREADY,
}
impl From<VOSF_A> for bool {
#[inline(always)]
fn from(variant: VOSF_A) -> Self {
match variant {
VOSF_A::READY => false,
VOSF_A::NOTREADY => true,
}
}
}
#[doc = "Reader of field `VOSF`"]
pub type VOSF_R = crate::R<bool, VOSF_A>;
impl VOSF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> VOSF_A {
match self.bits {
false => VOSF_A::READY,
true => VOSF_A::NOTREADY,
}
}
#[doc = "Checks if the value of the field is `READY`"]
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == VOSF_A::READY
}
#[doc = "Checks if the value of the field is `NOTREADY`"]
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == VOSF_A::NOTREADY
}
}
#[doc = "Regulator LP flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum REGLPF_A {
#[doc = "0: Regulator is ready in Main mode"]
READY,
#[doc = "1: Regulator voltage is in low-power mode"]
NOTREADY,
}
impl From<REGLPF_A> for bool {
#[inline(always)]
fn from(variant: REGLPF_A) -> Self {
match variant {
REGLPF_A::READY => false,
REGLPF_A::NOTREADY => true,
}
}
}
#[doc = "Reader of field `REGLPF`"]
pub type REGLPF_R = crate::R<bool, REGLPF_A>;
impl REGLPF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> REGLPF_A {
match self.bits {
false => REGLPF_A::READY,
true => REGLPF_A::NOTREADY,
}
}
#[doc = "Checks if the value of the field is `READY`"]
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == REGLPF_A::READY
}
#[doc = "Checks if the value of the field is `NOTREADY`"]
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == REGLPF_A::NOTREADY
}
}
#[doc = "Enable WKUP pin 3\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EWUP3_A {
#[doc = "0: WKUP pin 3 is used for general purpose I/Os. An event on the WKUP pin 3 does not wakeup the device from Standby mode"]
DISABLED,
#[doc = "1: WKUP pin 3 is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP pin 3wakes-up the system from Standby mode)"]
ENABLED,
}
impl From<EWUP3_A> for bool {
#[inline(always)]
fn from(variant: EWUP3_A) -> Self {
match variant {
EWUP3_A::DISABLED => false,
EWUP3_A::ENABLED => true,
}
}
}
#[doc = "Reader of field `EWUP3`"]
pub type EWUP3_R = crate::R<bool, EWUP3_A>;
impl EWUP3_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> EWUP3_A {
match self.bits {
false => EWUP3_A::DISABLED,
true => EWUP3_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == EWUP3_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == EWUP3_A::ENABLED
}
}
#[doc = "Write proxy for field `EWUP3`"]
pub struct EWUP3_W<'a> {
w: &'a mut W,
}
impl<'a> EWUP3_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: EWUP3_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "WKUP pin 3 is used for general purpose I/Os. An event on the WKUP pin 3 does not wakeup the device from Standby mode"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(EWUP3_A::DISABLED)
}
#[doc = "WKUP pin 3 is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP pin 3wakes-up the system from Standby mode)"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(EWUP3_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 << 10)) | (((value as u32) & 0x01) << 10);
self.w
}
}
impl R {
#[doc = "Bit 9 - Enable WKUP pin 2"]
#[inline(always)]
pub fn ewup2(&self) -> EWUP2_R {
EWUP2_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 8 - Enable WKUP pin 1"]
#[inline(always)]
pub fn ewup1(&self) -> EWUP1_R {
EWUP1_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 3 - Internal voltage reference ready flag"]
#[inline(always)]
pub fn vrefintrdyf(&self) -> VREFINTRDYF_R {
VREFINTRDYF_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 2 - PVD output"]
#[inline(always)]
pub fn pvdo(&self) -> PVDO_R {
PVDO_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1 - Standby flag"]
#[inline(always)]
pub fn sbf(&self) -> SBF_R {
SBF_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - Wakeup flag"]
#[inline(always)]
pub fn wuf(&self) -> WUF_R {
WUF_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 4 - Voltage Scaling select flag"]
#[inline(always)]
pub fn vosf(&self) -> VOSF_R {
VOSF_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 5 - Regulator LP flag"]
#[inline(always)]
pub fn reglpf(&self) -> REGLPF_R {
REGLPF_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 10 - Enable WKUP pin 3"]
#[inline(always)]
pub fn ewup3(&self) -> EWUP3_R {
EWUP3_R::new(((self.bits >> 10) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 9 - Enable WKUP pin 2"]
#[inline(always)]
pub fn ewup2(&mut self) -> EWUP2_W {
EWUP2_W { w: self }
}
#[doc = "Bit 8 - Enable WKUP pin 1"]
#[inline(always)]
pub fn ewup1(&mut self) -> EWUP1_W {
EWUP1_W { w: self }
}
#[doc = "Bit 10 - Enable WKUP pin 3"]
#[inline(always)]
pub fn ewup3(&mut self) -> EWUP3_W {
EWUP3_W { w: self }
}
}