#[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::TAMPCR {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
self.register.set(f(&R { bits }, &mut W { bits }).bits);
}
#[doc = r"Reads the contents of the register"]
#[inline(always)]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r"Writes to the register"]
#[inline(always)]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
self.register.set(
f(&mut W {
bits: Self::reset_value(),
})
.bits,
);
}
#[doc = r"Reset value of the register"]
#[inline(always)]
pub const fn reset_value() -> u32 {
0
}
#[doc = r"Writes the reset value to the register"]
#[inline(always)]
pub fn reset(&self) {
self.register.set(Self::reset_value())
}
}
#[doc = "Possible values of the field `TAMP2MF`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP2MFR {
#[doc = "Tamper x event generates a trigger event and TAMPxF must be cleared by software to allow next tamper event detection"]
NOTMASKED,
#[doc = "Tamper x event generates a trigger event. TAMPxF is masked and internally cleared by hardware. The backup registers are not erased."]
MASKED,
}
impl TAMP2MFR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TAMP2MFR::NOTMASKED => false,
TAMP2MFR::MASKED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TAMP2MFR {
match value {
false => TAMP2MFR::NOTMASKED,
true => TAMP2MFR::MASKED,
}
}
#[doc = "Checks if the value of the field is `NOTMASKED`"]
#[inline(always)]
pub fn is_not_masked(&self) -> bool {
*self == TAMP2MFR::NOTMASKED
}
#[doc = "Checks if the value of the field is `MASKED`"]
#[inline(always)]
pub fn is_masked(&self) -> bool {
*self == TAMP2MFR::MASKED
}
}
#[doc = "Values that can be written to the field `TAMP2MF`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP2MFW {
#[doc = "Tamper x event generates a trigger event and TAMPxF must be cleared by software to allow next tamper event detection"]
NOTMASKED,
#[doc = "Tamper x event generates a trigger event. TAMPxF is masked and internally cleared by hardware. The backup registers are not erased."]
MASKED,
}
impl TAMP2MFW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
TAMP2MFW::NOTMASKED => false,
TAMP2MFW::MASKED => true,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMP2MFW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP2MFW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP2MFW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper x event generates a trigger event and TAMPxF must be cleared by software to allow next tamper event detection"]
#[inline(always)]
pub fn not_masked(self) -> &'a mut W {
self.variant(TAMP2MFW::NOTMASKED)
}
#[doc = "Tamper x event generates a trigger event. TAMPxF is masked and internally cleared by hardware. The backup registers are not erased."]
#[inline(always)]
pub fn masked(self) -> &'a mut W {
self.variant(TAMP2MFW::MASKED)
}
#[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 &= !(0x01 << 21);
self.w.bits |= ((value as u32) & 0x01) << 21;
self.w
}
}
#[doc = "Possible values of the field `TAMP2NOERASE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP2NOERASER {
#[doc = "Tamper x event erases the backup registers"]
ERASE,
#[doc = "Tamper x event does not erase the backup registers"]
NOERASE,
}
impl TAMP2NOERASER {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TAMP2NOERASER::ERASE => false,
TAMP2NOERASER::NOERASE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TAMP2NOERASER {
match value {
false => TAMP2NOERASER::ERASE,
true => TAMP2NOERASER::NOERASE,
}
}
#[doc = "Checks if the value of the field is `ERASE`"]
#[inline(always)]
pub fn is_erase(&self) -> bool {
*self == TAMP2NOERASER::ERASE
}
#[doc = "Checks if the value of the field is `NOERASE`"]
#[inline(always)]
pub fn is_no_erase(&self) -> bool {
*self == TAMP2NOERASER::NOERASE
}
}
#[doc = "Values that can be written to the field `TAMP2NOERASE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP2NOERASEW {
#[doc = "Tamper x event erases the backup registers"]
ERASE,
#[doc = "Tamper x event does not erase the backup registers"]
NOERASE,
}
impl TAMP2NOERASEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
TAMP2NOERASEW::ERASE => false,
TAMP2NOERASEW::NOERASE => true,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMP2NOERASEW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP2NOERASEW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP2NOERASEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper x event erases the backup registers"]
#[inline(always)]
pub fn erase(self) -> &'a mut W {
self.variant(TAMP2NOERASEW::ERASE)
}
#[doc = "Tamper x event does not erase the backup registers"]
#[inline(always)]
pub fn no_erase(self) -> &'a mut W {
self.variant(TAMP2NOERASEW::NOERASE)
}
#[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 &= !(0x01 << 20);
self.w.bits |= ((value as u32) & 0x01) << 20;
self.w
}
}
#[doc = "Possible values of the field `TAMP2IE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP2IER {
#[doc = "Tamper x interrupt is disabled if TAMPIE = 0"]
DISABLED,
#[doc = "Tamper x interrupt enabled"]
ENABLED,
}
impl TAMP2IER {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TAMP2IER::DISABLED => false,
TAMP2IER::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TAMP2IER {
match value {
false => TAMP2IER::DISABLED,
true => TAMP2IER::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == TAMP2IER::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == TAMP2IER::ENABLED
}
}
#[doc = "Values that can be written to the field `TAMP2IE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP2IEW {
#[doc = "Tamper x interrupt is disabled if TAMPIE = 0"]
DISABLED,
#[doc = "Tamper x interrupt enabled"]
ENABLED,
}
impl TAMP2IEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
TAMP2IEW::DISABLED => false,
TAMP2IEW::ENABLED => true,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMP2IEW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP2IEW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP2IEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper x interrupt is disabled if TAMPIE = 0"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TAMP2IEW::DISABLED)
}
#[doc = "Tamper x interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TAMP2IEW::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 &= !(0x01 << 19);
self.w.bits |= ((value as u32) & 0x01) << 19;
self.w
}
}
#[doc = "Possible values of the field `TAMP1MF`"]
pub type TAMP1MFR = TAMP2MFR;
#[doc = "Values that can be written to the field `TAMP1MF`"]
pub type TAMP1MFW = TAMP2MFW;
#[doc = r"Proxy"]
pub struct _TAMP1MFW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP1MFW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP1MFW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper x event generates a trigger event and TAMPxF must be cleared by software to allow next tamper event detection"]
#[inline(always)]
pub fn not_masked(self) -> &'a mut W {
self.variant(TAMP2MFW::NOTMASKED)
}
#[doc = "Tamper x event generates a trigger event. TAMPxF is masked and internally cleared by hardware. The backup registers are not erased."]
#[inline(always)]
pub fn masked(self) -> &'a mut W {
self.variant(TAMP2MFW::MASKED)
}
#[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 &= !(0x01 << 18);
self.w.bits |= ((value as u32) & 0x01) << 18;
self.w
}
}
#[doc = "Possible values of the field `TAMP1NOERASE`"]
pub type TAMP1NOERASER = TAMP2NOERASER;
#[doc = "Values that can be written to the field `TAMP1NOERASE`"]
pub type TAMP1NOERASEW = TAMP2NOERASEW;
#[doc = r"Proxy"]
pub struct _TAMP1NOERASEW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP1NOERASEW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP1NOERASEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper x event erases the backup registers"]
#[inline(always)]
pub fn erase(self) -> &'a mut W {
self.variant(TAMP2NOERASEW::ERASE)
}
#[doc = "Tamper x event does not erase the backup registers"]
#[inline(always)]
pub fn no_erase(self) -> &'a mut W {
self.variant(TAMP2NOERASEW::NOERASE)
}
#[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 &= !(0x01 << 17);
self.w.bits |= ((value as u32) & 0x01) << 17;
self.w
}
}
#[doc = "Possible values of the field `TAMP1IE`"]
pub type TAMP1IER = TAMP2IER;
#[doc = "Values that can be written to the field `TAMP1IE`"]
pub type TAMP1IEW = TAMP2IEW;
#[doc = r"Proxy"]
pub struct _TAMP1IEW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP1IEW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP1IEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper x interrupt is disabled if TAMPIE = 0"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TAMP2IEW::DISABLED)
}
#[doc = "Tamper x interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TAMP2IEW::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 &= !(0x01 << 16);
self.w.bits |= ((value as u32) & 0x01) << 16;
self.w
}
}
#[doc = "Possible values of the field `TAMPPUDIS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPPUDISR {
#[doc = "Precharge RTC_TAMPx pins before sampling (enable internal pull-up)"]
ENABLED,
#[doc = "Disable precharge of RTC_TAMPx pins"]
DISABLED,
}
impl TAMPPUDISR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TAMPPUDISR::ENABLED => false,
TAMPPUDISR::DISABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TAMPPUDISR {
match value {
false => TAMPPUDISR::ENABLED,
true => TAMPPUDISR::DISABLED,
}
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == TAMPPUDISR::ENABLED
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == TAMPPUDISR::DISABLED
}
}
#[doc = "Values that can be written to the field `TAMPPUDIS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPPUDISW {
#[doc = "Precharge RTC_TAMPx pins before sampling (enable internal pull-up)"]
ENABLED,
#[doc = "Disable precharge of RTC_TAMPx pins"]
DISABLED,
}
impl TAMPPUDISW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
TAMPPUDISW::ENABLED => false,
TAMPPUDISW::DISABLED => true,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMPPUDISW<'a> {
w: &'a mut W,
}
impl<'a> _TAMPPUDISW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMPPUDISW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Precharge RTC_TAMPx pins before sampling (enable internal pull-up)"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TAMPPUDISW::ENABLED)
}
#[doc = "Disable precharge of RTC_TAMPx pins"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TAMPPUDISW::DISABLED)
}
#[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 &= !(0x01 << 15);
self.w.bits |= ((value as u32) & 0x01) << 15;
self.w
}
}
#[doc = "Possible values of the field `TAMPPRCH`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPPRCHR {
#[doc = "1 RTCCLK cycle"]
RTCCLK_1_CYCLE,
#[doc = "2 RTCCLK cycles"]
RTCCLK_2_CYCLE,
#[doc = "4 RTCCLK cycles"]
RTCCLK_4_CYCLE,
#[doc = "8 RTCCLK cycles"]
RTCCLK_8_CYCLE,
}
impl TAMPPRCHR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
match *self {
TAMPPRCHR::RTCCLK_1_CYCLE => 0,
TAMPPRCHR::RTCCLK_2_CYCLE => 0x01,
TAMPPRCHR::RTCCLK_4_CYCLE => 0x02,
TAMPPRCHR::RTCCLK_8_CYCLE => 0x03,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: u8) -> TAMPPRCHR {
match value {
0 => TAMPPRCHR::RTCCLK_1_CYCLE,
1 => TAMPPRCHR::RTCCLK_2_CYCLE,
2 => TAMPPRCHR::RTCCLK_4_CYCLE,
3 => TAMPPRCHR::RTCCLK_8_CYCLE,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `RTCCLK_1_CYCLE`"]
#[inline(always)]
pub fn is_rtcclk_1_cycle(&self) -> bool {
*self == TAMPPRCHR::RTCCLK_1_CYCLE
}
#[doc = "Checks if the value of the field is `RTCCLK_2_CYCLE`"]
#[inline(always)]
pub fn is_rtcclk_2_cycle(&self) -> bool {
*self == TAMPPRCHR::RTCCLK_2_CYCLE
}
#[doc = "Checks if the value of the field is `RTCCLK_4_CYCLE`"]
#[inline(always)]
pub fn is_rtcclk_4_cycle(&self) -> bool {
*self == TAMPPRCHR::RTCCLK_4_CYCLE
}
#[doc = "Checks if the value of the field is `RTCCLK_8_CYCLE`"]
#[inline(always)]
pub fn is_rtcclk_8_cycle(&self) -> bool {
*self == TAMPPRCHR::RTCCLK_8_CYCLE
}
}
#[doc = "Values that can be written to the field `TAMPPRCH`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPPRCHW {
#[doc = "1 RTCCLK cycle"]
RTCCLK_1_CYCLE,
#[doc = "2 RTCCLK cycles"]
RTCCLK_2_CYCLE,
#[doc = "4 RTCCLK cycles"]
RTCCLK_4_CYCLE,
#[doc = "8 RTCCLK cycles"]
RTCCLK_8_CYCLE,
}
impl TAMPPRCHW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> u8 {
match *self {
TAMPPRCHW::RTCCLK_1_CYCLE => 0,
TAMPPRCHW::RTCCLK_2_CYCLE => 1,
TAMPPRCHW::RTCCLK_4_CYCLE => 2,
TAMPPRCHW::RTCCLK_8_CYCLE => 3,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMPPRCHW<'a> {
w: &'a mut W,
}
impl<'a> _TAMPPRCHW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMPPRCHW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "1 RTCCLK cycle"]
#[inline(always)]
pub fn rtcclk_1_cycle(self) -> &'a mut W {
self.variant(TAMPPRCHW::RTCCLK_1_CYCLE)
}
#[doc = "2 RTCCLK cycles"]
#[inline(always)]
pub fn rtcclk_2_cycle(self) -> &'a mut W {
self.variant(TAMPPRCHW::RTCCLK_2_CYCLE)
}
#[doc = "4 RTCCLK cycles"]
#[inline(always)]
pub fn rtcclk_4_cycle(self) -> &'a mut W {
self.variant(TAMPPRCHW::RTCCLK_4_CYCLE)
}
#[doc = "8 RTCCLK cycles"]
#[inline(always)]
pub fn rtcclk_8_cycle(self) -> &'a mut W {
self.variant(TAMPPRCHW::RTCCLK_8_CYCLE)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x03 << 13);
self.w.bits |= ((value as u32) & 0x03) << 13;
self.w
}
}
#[doc = "Possible values of the field `TAMPFLT`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPFLTR {
#[doc = "Tamper event is activated on edge of RTC_TAMPx input transitions to the active level (no internal pull-up on RTC_TAMPx input)"]
IMMEDIATE,
#[doc = "Tamper event is activated after 2 consecutive samples at the active level"]
TWO_SAMPLES,
#[doc = "Tamper event is activated after 4 consecutive samples at the active level"]
FOUR_SAMPLES,
#[doc = "Tamper event is activated after 8 consecutive samples at the active level"]
EIGHT_SAMPLES,
}
impl TAMPFLTR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
match *self {
TAMPFLTR::IMMEDIATE => 0,
TAMPFLTR::TWO_SAMPLES => 0x01,
TAMPFLTR::FOUR_SAMPLES => 0x02,
TAMPFLTR::EIGHT_SAMPLES => 0x03,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: u8) -> TAMPFLTR {
match value {
0 => TAMPFLTR::IMMEDIATE,
1 => TAMPFLTR::TWO_SAMPLES,
2 => TAMPFLTR::FOUR_SAMPLES,
3 => TAMPFLTR::EIGHT_SAMPLES,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `IMMEDIATE`"]
#[inline(always)]
pub fn is_immediate(&self) -> bool {
*self == TAMPFLTR::IMMEDIATE
}
#[doc = "Checks if the value of the field is `TWO_SAMPLES`"]
#[inline(always)]
pub fn is_two_samples(&self) -> bool {
*self == TAMPFLTR::TWO_SAMPLES
}
#[doc = "Checks if the value of the field is `FOUR_SAMPLES`"]
#[inline(always)]
pub fn is_four_samples(&self) -> bool {
*self == TAMPFLTR::FOUR_SAMPLES
}
#[doc = "Checks if the value of the field is `EIGHT_SAMPLES`"]
#[inline(always)]
pub fn is_eight_samples(&self) -> bool {
*self == TAMPFLTR::EIGHT_SAMPLES
}
}
#[doc = "Values that can be written to the field `TAMPFLT`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPFLTW {
#[doc = "Tamper event is activated on edge of RTC_TAMPx input transitions to the active level (no internal pull-up on RTC_TAMPx input)"]
IMMEDIATE,
#[doc = "Tamper event is activated after 2 consecutive samples at the active level"]
TWO_SAMPLES,
#[doc = "Tamper event is activated after 4 consecutive samples at the active level"]
FOUR_SAMPLES,
#[doc = "Tamper event is activated after 8 consecutive samples at the active level"]
EIGHT_SAMPLES,
}
impl TAMPFLTW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> u8 {
match *self {
TAMPFLTW::IMMEDIATE => 0,
TAMPFLTW::TWO_SAMPLES => 1,
TAMPFLTW::FOUR_SAMPLES => 2,
TAMPFLTW::EIGHT_SAMPLES => 3,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMPFLTW<'a> {
w: &'a mut W,
}
impl<'a> _TAMPFLTW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMPFLTW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "Tamper event is activated on edge of RTC_TAMPx input transitions to the active level (no internal pull-up on RTC_TAMPx input)"]
#[inline(always)]
pub fn immediate(self) -> &'a mut W {
self.variant(TAMPFLTW::IMMEDIATE)
}
#[doc = "Tamper event is activated after 2 consecutive samples at the active level"]
#[inline(always)]
pub fn two_samples(self) -> &'a mut W {
self.variant(TAMPFLTW::TWO_SAMPLES)
}
#[doc = "Tamper event is activated after 4 consecutive samples at the active level"]
#[inline(always)]
pub fn four_samples(self) -> &'a mut W {
self.variant(TAMPFLTW::FOUR_SAMPLES)
}
#[doc = "Tamper event is activated after 8 consecutive samples at the active level"]
#[inline(always)]
pub fn eight_samples(self) -> &'a mut W {
self.variant(TAMPFLTW::EIGHT_SAMPLES)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x03 << 11);
self.w.bits |= ((value as u32) & 0x03) << 11;
self.w
}
}
#[doc = "Possible values of the field `TAMPFREQ`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPFREQR {
#[doc = "RTCCLK / 32768 (1 Hz when RTCCLK = 32768 Hz)"]
DIV32768,
#[doc = "RTCCLK / 16384 (2 Hz when RTCCLK = 32768 Hz)"]
DIV16384,
#[doc = "RTCCLK / 8192 (4 Hz when RTCCLK = 32768 Hz)"]
DIV8192,
#[doc = "RTCCLK / 4096 (8 Hz when RTCCLK = 32768 Hz)"]
DIV4096,
#[doc = "RTCCLK / 2048 (16 Hz when RTCCLK = 32768 Hz)"]
DIV2048,
#[doc = "RTCCLK / 1024 (32 Hz when RTCCLK = 32768 Hz)"]
DIV1024,
#[doc = "RTCCLK / 512 (64 Hz when RTCCLK = 32768 Hz)"]
DIV512,
#[doc = "RTCCLK / 256 (128 Hz when RTCCLK = 32768 Hz)"]
DIV256,
}
impl TAMPFREQR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
match *self {
TAMPFREQR::DIV32768 => 0,
TAMPFREQR::DIV16384 => 0x01,
TAMPFREQR::DIV8192 => 0x02,
TAMPFREQR::DIV4096 => 0x03,
TAMPFREQR::DIV2048 => 0x04,
TAMPFREQR::DIV1024 => 0x05,
TAMPFREQR::DIV512 => 0x06,
TAMPFREQR::DIV256 => 0x07,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: u8) -> TAMPFREQR {
match value {
0 => TAMPFREQR::DIV32768,
1 => TAMPFREQR::DIV16384,
2 => TAMPFREQR::DIV8192,
3 => TAMPFREQR::DIV4096,
4 => TAMPFREQR::DIV2048,
5 => TAMPFREQR::DIV1024,
6 => TAMPFREQR::DIV512,
7 => TAMPFREQR::DIV256,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `DIV32768`"]
#[inline(always)]
pub fn is_div32768(&self) -> bool {
*self == TAMPFREQR::DIV32768
}
#[doc = "Checks if the value of the field is `DIV16384`"]
#[inline(always)]
pub fn is_div16384(&self) -> bool {
*self == TAMPFREQR::DIV16384
}
#[doc = "Checks if the value of the field is `DIV8192`"]
#[inline(always)]
pub fn is_div8192(&self) -> bool {
*self == TAMPFREQR::DIV8192
}
#[doc = "Checks if the value of the field is `DIV4096`"]
#[inline(always)]
pub fn is_div4096(&self) -> bool {
*self == TAMPFREQR::DIV4096
}
#[doc = "Checks if the value of the field is `DIV2048`"]
#[inline(always)]
pub fn is_div2048(&self) -> bool {
*self == TAMPFREQR::DIV2048
}
#[doc = "Checks if the value of the field is `DIV1024`"]
#[inline(always)]
pub fn is_div1024(&self) -> bool {
*self == TAMPFREQR::DIV1024
}
#[doc = "Checks if the value of the field is `DIV512`"]
#[inline(always)]
pub fn is_div512(&self) -> bool {
*self == TAMPFREQR::DIV512
}
#[doc = "Checks if the value of the field is `DIV256`"]
#[inline(always)]
pub fn is_div256(&self) -> bool {
*self == TAMPFREQR::DIV256
}
}
#[doc = "Values that can be written to the field `TAMPFREQ`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPFREQW {
#[doc = "RTCCLK / 32768 (1 Hz when RTCCLK = 32768 Hz)"]
DIV32768,
#[doc = "RTCCLK / 16384 (2 Hz when RTCCLK = 32768 Hz)"]
DIV16384,
#[doc = "RTCCLK / 8192 (4 Hz when RTCCLK = 32768 Hz)"]
DIV8192,
#[doc = "RTCCLK / 4096 (8 Hz when RTCCLK = 32768 Hz)"]
DIV4096,
#[doc = "RTCCLK / 2048 (16 Hz when RTCCLK = 32768 Hz)"]
DIV2048,
#[doc = "RTCCLK / 1024 (32 Hz when RTCCLK = 32768 Hz)"]
DIV1024,
#[doc = "RTCCLK / 512 (64 Hz when RTCCLK = 32768 Hz)"]
DIV512,
#[doc = "RTCCLK / 256 (128 Hz when RTCCLK = 32768 Hz)"]
DIV256,
}
impl TAMPFREQW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> u8 {
match *self {
TAMPFREQW::DIV32768 => 0,
TAMPFREQW::DIV16384 => 1,
TAMPFREQW::DIV8192 => 2,
TAMPFREQW::DIV4096 => 3,
TAMPFREQW::DIV2048 => 4,
TAMPFREQW::DIV1024 => 5,
TAMPFREQW::DIV512 => 6,
TAMPFREQW::DIV256 => 7,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMPFREQW<'a> {
w: &'a mut W,
}
impl<'a> _TAMPFREQW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMPFREQW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "RTCCLK / 32768 (1 Hz when RTCCLK = 32768 Hz)"]
#[inline(always)]
pub fn div32768(self) -> &'a mut W {
self.variant(TAMPFREQW::DIV32768)
}
#[doc = "RTCCLK / 16384 (2 Hz when RTCCLK = 32768 Hz)"]
#[inline(always)]
pub fn div16384(self) -> &'a mut W {
self.variant(TAMPFREQW::DIV16384)
}
#[doc = "RTCCLK / 8192 (4 Hz when RTCCLK = 32768 Hz)"]
#[inline(always)]
pub fn div8192(self) -> &'a mut W {
self.variant(TAMPFREQW::DIV8192)
}
#[doc = "RTCCLK / 4096 (8 Hz when RTCCLK = 32768 Hz)"]
#[inline(always)]
pub fn div4096(self) -> &'a mut W {
self.variant(TAMPFREQW::DIV4096)
}
#[doc = "RTCCLK / 2048 (16 Hz when RTCCLK = 32768 Hz)"]
#[inline(always)]
pub fn div2048(self) -> &'a mut W {
self.variant(TAMPFREQW::DIV2048)
}
#[doc = "RTCCLK / 1024 (32 Hz when RTCCLK = 32768 Hz)"]
#[inline(always)]
pub fn div1024(self) -> &'a mut W {
self.variant(TAMPFREQW::DIV1024)
}
#[doc = "RTCCLK / 512 (64 Hz when RTCCLK = 32768 Hz)"]
#[inline(always)]
pub fn div512(self) -> &'a mut W {
self.variant(TAMPFREQW::DIV512)
}
#[doc = "RTCCLK / 256 (128 Hz when RTCCLK = 32768 Hz)"]
#[inline(always)]
pub fn div256(self) -> &'a mut W {
self.variant(TAMPFREQW::DIV256)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 8);
self.w.bits |= ((value as u32) & 0x07) << 8;
self.w
}
}
#[doc = "Possible values of the field `TAMPTS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPTSR {
#[doc = "Tamper detection event does not cause a timestamp to be saved"]
NOSAVE,
#[doc = "Save timestamp on tamper detection event"]
SAVE,
}
impl TAMPTSR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TAMPTSR::NOSAVE => false,
TAMPTSR::SAVE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TAMPTSR {
match value {
false => TAMPTSR::NOSAVE,
true => TAMPTSR::SAVE,
}
}
#[doc = "Checks if the value of the field is `NOSAVE`"]
#[inline(always)]
pub fn is_no_save(&self) -> bool {
*self == TAMPTSR::NOSAVE
}
#[doc = "Checks if the value of the field is `SAVE`"]
#[inline(always)]
pub fn is_save(&self) -> bool {
*self == TAMPTSR::SAVE
}
}
#[doc = "Values that can be written to the field `TAMPTS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPTSW {
#[doc = "Tamper detection event does not cause a timestamp to be saved"]
NOSAVE,
#[doc = "Save timestamp on tamper detection event"]
SAVE,
}
impl TAMPTSW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
TAMPTSW::NOSAVE => false,
TAMPTSW::SAVE => true,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMPTSW<'a> {
w: &'a mut W,
}
impl<'a> _TAMPTSW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMPTSW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper detection event does not cause a timestamp to be saved"]
#[inline(always)]
pub fn no_save(self) -> &'a mut W {
self.variant(TAMPTSW::NOSAVE)
}
#[doc = "Save timestamp on tamper detection event"]
#[inline(always)]
pub fn save(self) -> &'a mut W {
self.variant(TAMPTSW::SAVE)
}
#[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 &= !(0x01 << 7);
self.w.bits |= ((value as u32) & 0x01) << 7;
self.w
}
}
#[doc = "Possible values of the field `TAMP2TRG`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP2TRGR {
#[doc = "If TAMPFLT = 00: RTC_TAMPx input rising edge triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input staying low triggers a tamper detection event."]
RISINGEDGE,
#[doc = "If TAMPFLT = 00: RTC_TAMPx input staying high triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input falling edge triggers a tamper detection event"]
FALLINGEDGE,
}
impl TAMP2TRGR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TAMP2TRGR::RISINGEDGE => false,
TAMP2TRGR::FALLINGEDGE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TAMP2TRGR {
match value {
false => TAMP2TRGR::RISINGEDGE,
true => TAMP2TRGR::FALLINGEDGE,
}
}
#[doc = "Checks if the value of the field is `RISINGEDGE`"]
#[inline(always)]
pub fn is_rising_edge(&self) -> bool {
*self == TAMP2TRGR::RISINGEDGE
}
#[doc = "Checks if the value of the field is `FALLINGEDGE`"]
#[inline(always)]
pub fn is_falling_edge(&self) -> bool {
*self == TAMP2TRGR::FALLINGEDGE
}
}
#[doc = "Values that can be written to the field `TAMP2TRG`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP2TRGW {
#[doc = "If TAMPFLT = 00: RTC_TAMPx input rising edge triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input staying low triggers a tamper detection event."]
RISINGEDGE,
#[doc = "If TAMPFLT = 00: RTC_TAMPx input staying high triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input falling edge triggers a tamper detection event"]
FALLINGEDGE,
}
impl TAMP2TRGW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
TAMP2TRGW::RISINGEDGE => false,
TAMP2TRGW::FALLINGEDGE => true,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMP2TRGW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP2TRGW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP2TRGW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "If TAMPFLT = 00: RTC_TAMPx input rising edge triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input staying low triggers a tamper detection event."]
#[inline(always)]
pub fn rising_edge(self) -> &'a mut W {
self.variant(TAMP2TRGW::RISINGEDGE)
}
#[doc = "If TAMPFLT = 00: RTC_TAMPx input staying high triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input falling edge triggers a tamper detection event"]
#[inline(always)]
pub fn falling_edge(self) -> &'a mut W {
self.variant(TAMP2TRGW::FALLINGEDGE)
}
#[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 &= !(0x01 << 4);
self.w.bits |= ((value as u32) & 0x01) << 4;
self.w
}
}
#[doc = "Possible values of the field `TAMP2E`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP2ER {
#[doc = "RTC_TAMPx input detection disabled"]
DISABLED,
#[doc = "RTC_TAMPx input detection enabled"]
ENABLED,
}
impl TAMP2ER {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TAMP2ER::DISABLED => false,
TAMP2ER::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TAMP2ER {
match value {
false => TAMP2ER::DISABLED,
true => TAMP2ER::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == TAMP2ER::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == TAMP2ER::ENABLED
}
}
#[doc = "Values that can be written to the field `TAMP2E`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP2EW {
#[doc = "RTC_TAMPx input detection disabled"]
DISABLED,
#[doc = "RTC_TAMPx input detection enabled"]
ENABLED,
}
impl TAMP2EW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
TAMP2EW::DISABLED => false,
TAMP2EW::ENABLED => true,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMP2EW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP2EW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP2EW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "RTC_TAMPx input detection disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TAMP2EW::DISABLED)
}
#[doc = "RTC_TAMPx input detection enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TAMP2EW::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 &= !(0x01 << 3);
self.w.bits |= ((value as u32) & 0x01) << 3;
self.w
}
}
#[doc = "Possible values of the field `TAMPIE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPIER {
#[doc = "Tamper interrupt disabled"]
DISABLED,
#[doc = "Tamper interrupt enabled"]
ENABLED,
}
impl TAMPIER {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TAMPIER::DISABLED => false,
TAMPIER::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TAMPIER {
match value {
false => TAMPIER::DISABLED,
true => TAMPIER::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == TAMPIER::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == TAMPIER::ENABLED
}
}
#[doc = "Values that can be written to the field `TAMPIE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMPIEW {
#[doc = "Tamper interrupt disabled"]
DISABLED,
#[doc = "Tamper interrupt enabled"]
ENABLED,
}
impl TAMPIEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
TAMPIEW::DISABLED => false,
TAMPIEW::ENABLED => true,
}
}
}
#[doc = r"Proxy"]
pub struct _TAMPIEW<'a> {
w: &'a mut W,
}
impl<'a> _TAMPIEW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMPIEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper interrupt disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TAMPIEW::DISABLED)
}
#[doc = "Tamper interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TAMPIEW::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 &= !(0x01 << 2);
self.w.bits |= ((value as u32) & 0x01) << 2;
self.w
}
}
#[doc = "Possible values of the field `TAMP1TRG`"]
pub type TAMP1TRGR = TAMP2TRGR;
#[doc = "Values that can be written to the field `TAMP1TRG`"]
pub type TAMP1TRGW = TAMP2TRGW;
#[doc = r"Proxy"]
pub struct _TAMP1TRGW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP1TRGW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP1TRGW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "If TAMPFLT = 00: RTC_TAMPx input rising edge triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input staying low triggers a tamper detection event."]
#[inline(always)]
pub fn rising_edge(self) -> &'a mut W {
self.variant(TAMP2TRGW::RISINGEDGE)
}
#[doc = "If TAMPFLT = 00: RTC_TAMPx input staying high triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input falling edge triggers a tamper detection event"]
#[inline(always)]
pub fn falling_edge(self) -> &'a mut W {
self.variant(TAMP2TRGW::FALLINGEDGE)
}
#[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 &= !(0x01 << 1);
self.w.bits |= ((value as u32) & 0x01) << 1;
self.w
}
}
#[doc = "Possible values of the field `TAMP1E`"]
pub type TAMP1ER = TAMP2ER;
#[doc = "Values that can be written to the field `TAMP1E`"]
pub type TAMP1EW = TAMP2EW;
#[doc = r"Proxy"]
pub struct _TAMP1EW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP1EW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP1EW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "RTC_TAMPx input detection disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TAMP2EW::DISABLED)
}
#[doc = "RTC_TAMPx input detection enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TAMP2EW::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 &= !(0x01 << 0);
self.w.bits |= ((value as u32) & 0x01) << 0;
self.w
}
}
#[doc = "Possible values of the field `TAMP3MF`"]
pub type TAMP3MFR = TAMP2MFR;
#[doc = "Values that can be written to the field `TAMP3MF`"]
pub type TAMP3MFW = TAMP2MFW;
#[doc = r"Proxy"]
pub struct _TAMP3MFW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP3MFW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP3MFW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper x event generates a trigger event and TAMPxF must be cleared by software to allow next tamper event detection"]
#[inline(always)]
pub fn not_masked(self) -> &'a mut W {
self.variant(TAMP2MFW::NOTMASKED)
}
#[doc = "Tamper x event generates a trigger event. TAMPxF is masked and internally cleared by hardware. The backup registers are not erased."]
#[inline(always)]
pub fn masked(self) -> &'a mut W {
self.variant(TAMP2MFW::MASKED)
}
#[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 &= !(0x01 << 24);
self.w.bits |= ((value as u32) & 0x01) << 24;
self.w
}
}
#[doc = "Possible values of the field `TAMP3NOERASE`"]
pub type TAMP3NOERASER = TAMP2NOERASER;
#[doc = "Values that can be written to the field `TAMP3NOERASE`"]
pub type TAMP3NOERASEW = TAMP2NOERASEW;
#[doc = r"Proxy"]
pub struct _TAMP3NOERASEW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP3NOERASEW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP3NOERASEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper x event erases the backup registers"]
#[inline(always)]
pub fn erase(self) -> &'a mut W {
self.variant(TAMP2NOERASEW::ERASE)
}
#[doc = "Tamper x event does not erase the backup registers"]
#[inline(always)]
pub fn no_erase(self) -> &'a mut W {
self.variant(TAMP2NOERASEW::NOERASE)
}
#[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 &= !(0x01 << 23);
self.w.bits |= ((value as u32) & 0x01) << 23;
self.w
}
}
#[doc = "Possible values of the field `TAMP3IE`"]
pub type TAMP3IER = TAMP2IER;
#[doc = "Values that can be written to the field `TAMP3IE`"]
pub type TAMP3IEW = TAMP2IEW;
#[doc = r"Proxy"]
pub struct _TAMP3IEW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP3IEW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP3IEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Tamper x interrupt is disabled if TAMPIE = 0"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TAMP2IEW::DISABLED)
}
#[doc = "Tamper x interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TAMP2IEW::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 &= !(0x01 << 22);
self.w.bits |= ((value as u32) & 0x01) << 22;
self.w
}
}
#[doc = "Possible values of the field `TAMP3TRG`"]
pub type TAMP3TRGR = TAMP2TRGR;
#[doc = "Values that can be written to the field `TAMP3TRG`"]
pub type TAMP3TRGW = TAMP2TRGW;
#[doc = r"Proxy"]
pub struct _TAMP3TRGW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP3TRGW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP3TRGW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "If TAMPFLT = 00: RTC_TAMPx input rising edge triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input staying low triggers a tamper detection event."]
#[inline(always)]
pub fn rising_edge(self) -> &'a mut W {
self.variant(TAMP2TRGW::RISINGEDGE)
}
#[doc = "If TAMPFLT = 00: RTC_TAMPx input staying high triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input falling edge triggers a tamper detection event"]
#[inline(always)]
pub fn falling_edge(self) -> &'a mut W {
self.variant(TAMP2TRGW::FALLINGEDGE)
}
#[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 &= !(0x01 << 6);
self.w.bits |= ((value as u32) & 0x01) << 6;
self.w
}
}
#[doc = "Possible values of the field `TAMP3E`"]
pub type TAMP3ER = TAMP2ER;
#[doc = "Values that can be written to the field `TAMP3E`"]
pub type TAMP3EW = TAMP2EW;
#[doc = r"Proxy"]
pub struct _TAMP3EW<'a> {
w: &'a mut W,
}
impl<'a> _TAMP3EW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TAMP3EW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "RTC_TAMPx input detection disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TAMP2EW::DISABLED)
}
#[doc = "RTC_TAMPx input detection enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TAMP2EW::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 &= !(0x01 << 5);
self.w.bits |= ((value as u32) & 0x01) << 5;
self.w
}
}
impl R {
#[doc = r"Value of the register as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 21 - Tamper 2 mask flag"]
#[inline(always)]
pub fn tamp2mf(&self) -> TAMP2MFR {
TAMP2MFR::_from(((self.bits >> 21) & 0x01) != 0)
}
#[doc = "Bit 20 - Tamper 2 no erase"]
#[inline(always)]
pub fn tamp2noerase(&self) -> TAMP2NOERASER {
TAMP2NOERASER::_from(((self.bits >> 20) & 0x01) != 0)
}
#[doc = "Bit 19 - Tamper 2 interrupt enable"]
#[inline(always)]
pub fn tamp2ie(&self) -> TAMP2IER {
TAMP2IER::_from(((self.bits >> 19) & 0x01) != 0)
}
#[doc = "Bit 18 - Tamper 1 mask flag"]
#[inline(always)]
pub fn tamp1mf(&self) -> TAMP1MFR {
TAMP1MFR::_from(((self.bits >> 18) & 0x01) != 0)
}
#[doc = "Bit 17 - Tamper 1 no erase"]
#[inline(always)]
pub fn tamp1noerase(&self) -> TAMP1NOERASER {
TAMP1NOERASER::_from(((self.bits >> 17) & 0x01) != 0)
}
#[doc = "Bit 16 - Tamper 1 interrupt enable"]
#[inline(always)]
pub fn tamp1ie(&self) -> TAMP1IER {
TAMP1IER::_from(((self.bits >> 16) & 0x01) != 0)
}
#[doc = "Bit 15 - RTC_TAMPx pull-up disable"]
#[inline(always)]
pub fn tamppudis(&self) -> TAMPPUDISR {
TAMPPUDISR::_from(((self.bits >> 15) & 0x01) != 0)
}
#[doc = "Bits 13:14 - RTC_TAMPx precharge duration"]
#[inline(always)]
pub fn tampprch(&self) -> TAMPPRCHR {
TAMPPRCHR::_from(((self.bits >> 13) & 0x03) as u8)
}
#[doc = "Bits 11:12 - RTC_TAMPx filter count"]
#[inline(always)]
pub fn tampflt(&self) -> TAMPFLTR {
TAMPFLTR::_from(((self.bits >> 11) & 0x03) as u8)
}
#[doc = "Bits 8:10 - Tamper sampling frequency"]
#[inline(always)]
pub fn tampfreq(&self) -> TAMPFREQR {
TAMPFREQR::_from(((self.bits >> 8) & 0x07) as u8)
}
#[doc = "Bit 7 - Activate timestamp on tamper detection event"]
#[inline(always)]
pub fn tampts(&self) -> TAMPTSR {
TAMPTSR::_from(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 4 - Active level for RTC_TAMP2 input"]
#[inline(always)]
pub fn tamp2trg(&self) -> TAMP2TRGR {
TAMP2TRGR::_from(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 3 - RTC_TAMP2 input detection enable"]
#[inline(always)]
pub fn tamp2e(&self) -> TAMP2ER {
TAMP2ER::_from(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 2 - Tamper interrupt enable"]
#[inline(always)]
pub fn tampie(&self) -> TAMPIER {
TAMPIER::_from(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1 - Active level for RTC_TAMP1 input"]
#[inline(always)]
pub fn tamp1trg(&self) -> TAMP1TRGR {
TAMP1TRGR::_from(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - RTC_TAMP1 input detection enable"]
#[inline(always)]
pub fn tamp1e(&self) -> TAMP1ER {
TAMP1ER::_from(((self.bits >> 0) & 0x01) != 0)
}
#[doc = "Bit 24 - Tamper 3 mask flag"]
#[inline(always)]
pub fn tamp3mf(&self) -> TAMP3MFR {
TAMP3MFR::_from(((self.bits >> 24) & 0x01) != 0)
}
#[doc = "Bit 23 - Tamper 3 no erase"]
#[inline(always)]
pub fn tamp3noerase(&self) -> TAMP3NOERASER {
TAMP3NOERASER::_from(((self.bits >> 23) & 0x01) != 0)
}
#[doc = "Bit 22 - Tamper 3 interrupt enable"]
#[inline(always)]
pub fn tamp3ie(&self) -> TAMP3IER {
TAMP3IER::_from(((self.bits >> 22) & 0x01) != 0)
}
#[doc = "Bit 6 - Active level for RTC_TAMP3 input"]
#[inline(always)]
pub fn tamp3trg(&self) -> TAMP3TRGR {
TAMP3TRGR::_from(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 5 - RTC_TAMP3 detection enable"]
#[inline(always)]
pub fn tamp3e(&self) -> TAMP3ER {
TAMP3ER::_from(((self.bits >> 5) & 0x01) != 0)
}
}
impl W {
#[doc = r"Writes raw bits to the register"]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 21 - Tamper 2 mask flag"]
#[inline(always)]
pub fn tamp2mf(&mut self) -> _TAMP2MFW {
_TAMP2MFW { w: self }
}
#[doc = "Bit 20 - Tamper 2 no erase"]
#[inline(always)]
pub fn tamp2noerase(&mut self) -> _TAMP2NOERASEW {
_TAMP2NOERASEW { w: self }
}
#[doc = "Bit 19 - Tamper 2 interrupt enable"]
#[inline(always)]
pub fn tamp2ie(&mut self) -> _TAMP2IEW {
_TAMP2IEW { w: self }
}
#[doc = "Bit 18 - Tamper 1 mask flag"]
#[inline(always)]
pub fn tamp1mf(&mut self) -> _TAMP1MFW {
_TAMP1MFW { w: self }
}
#[doc = "Bit 17 - Tamper 1 no erase"]
#[inline(always)]
pub fn tamp1noerase(&mut self) -> _TAMP1NOERASEW {
_TAMP1NOERASEW { w: self }
}
#[doc = "Bit 16 - Tamper 1 interrupt enable"]
#[inline(always)]
pub fn tamp1ie(&mut self) -> _TAMP1IEW {
_TAMP1IEW { w: self }
}
#[doc = "Bit 15 - RTC_TAMPx pull-up disable"]
#[inline(always)]
pub fn tamppudis(&mut self) -> _TAMPPUDISW {
_TAMPPUDISW { w: self }
}
#[doc = "Bits 13:14 - RTC_TAMPx precharge duration"]
#[inline(always)]
pub fn tampprch(&mut self) -> _TAMPPRCHW {
_TAMPPRCHW { w: self }
}
#[doc = "Bits 11:12 - RTC_TAMPx filter count"]
#[inline(always)]
pub fn tampflt(&mut self) -> _TAMPFLTW {
_TAMPFLTW { w: self }
}
#[doc = "Bits 8:10 - Tamper sampling frequency"]
#[inline(always)]
pub fn tampfreq(&mut self) -> _TAMPFREQW {
_TAMPFREQW { w: self }
}
#[doc = "Bit 7 - Activate timestamp on tamper detection event"]
#[inline(always)]
pub fn tampts(&mut self) -> _TAMPTSW {
_TAMPTSW { w: self }
}
#[doc = "Bit 4 - Active level for RTC_TAMP2 input"]
#[inline(always)]
pub fn tamp2trg(&mut self) -> _TAMP2TRGW {
_TAMP2TRGW { w: self }
}
#[doc = "Bit 3 - RTC_TAMP2 input detection enable"]
#[inline(always)]
pub fn tamp2e(&mut self) -> _TAMP2EW {
_TAMP2EW { w: self }
}
#[doc = "Bit 2 - Tamper interrupt enable"]
#[inline(always)]
pub fn tampie(&mut self) -> _TAMPIEW {
_TAMPIEW { w: self }
}
#[doc = "Bit 1 - Active level for RTC_TAMP1 input"]
#[inline(always)]
pub fn tamp1trg(&mut self) -> _TAMP1TRGW {
_TAMP1TRGW { w: self }
}
#[doc = "Bit 0 - RTC_TAMP1 input detection enable"]
#[inline(always)]
pub fn tamp1e(&mut self) -> _TAMP1EW {
_TAMP1EW { w: self }
}
#[doc = "Bit 24 - Tamper 3 mask flag"]
#[inline(always)]
pub fn tamp3mf(&mut self) -> _TAMP3MFW {
_TAMP3MFW { w: self }
}
#[doc = "Bit 23 - Tamper 3 no erase"]
#[inline(always)]
pub fn tamp3noerase(&mut self) -> _TAMP3NOERASEW {
_TAMP3NOERASEW { w: self }
}
#[doc = "Bit 22 - Tamper 3 interrupt enable"]
#[inline(always)]
pub fn tamp3ie(&mut self) -> _TAMP3IEW {
_TAMP3IEW { w: self }
}
#[doc = "Bit 6 - Active level for RTC_TAMP3 input"]
#[inline(always)]
pub fn tamp3trg(&mut self) -> _TAMP3TRGW {
_TAMP3TRGW { w: self }
}
#[doc = "Bit 5 - RTC_TAMP3 detection enable"]
#[inline(always)]
pub fn tamp3e(&mut self) -> _TAMP3EW {
_TAMP3EW { w: self }
}
}