rust-embedded-talk/example-source/msp432p401r/src/cs/csctl3.rs

1019 lines
27 KiB
Rust

#[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::CSCTL3 {
#[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 `FCNTLF`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FCNTLFR {
#[doc = "4096 cycles"]
FCNTLF_0,
#[doc = "8192 cycles"]
FCNTLF_1,
#[doc = "16384 cycles"]
FCNTLF_2,
#[doc = "32768 cycles"]
FCNTLF_3,
}
impl FCNTLFR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
FCNTLFR::FCNTLF_0 => 0,
FCNTLFR::FCNTLF_1 => 1,
FCNTLFR::FCNTLF_2 => 2,
FCNTLFR::FCNTLF_3 => 3,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> FCNTLFR {
match value {
0 => FCNTLFR::FCNTLF_0,
1 => FCNTLFR::FCNTLF_1,
2 => FCNTLFR::FCNTLF_2,
3 => FCNTLFR::FCNTLF_3,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `FCNTLF_0`"]
#[inline]
pub fn is_fcntlf_0(&self) -> bool {
*self == FCNTLFR::FCNTLF_0
}
#[doc = "Checks if the value of the field is `FCNTLF_1`"]
#[inline]
pub fn is_fcntlf_1(&self) -> bool {
*self == FCNTLFR::FCNTLF_1
}
#[doc = "Checks if the value of the field is `FCNTLF_2`"]
#[inline]
pub fn is_fcntlf_2(&self) -> bool {
*self == FCNTLFR::FCNTLF_2
}
#[doc = "Checks if the value of the field is `FCNTLF_3`"]
#[inline]
pub fn is_fcntlf_3(&self) -> bool {
*self == FCNTLFR::FCNTLF_3
}
}
#[doc = "Possible values of the field `FCNTLF_EN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FCNTLF_ENR {
#[doc = "Startup fault counter disabled. Counter is cleared."]
FCNTLF_EN_0,
#[doc = "Startup fault counter enabled."]
FCNTLF_EN_1,
}
impl FCNTLF_ENR {
#[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 {
FCNTLF_ENR::FCNTLF_EN_0 => false,
FCNTLF_ENR::FCNTLF_EN_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> FCNTLF_ENR {
match value {
false => FCNTLF_ENR::FCNTLF_EN_0,
true => FCNTLF_ENR::FCNTLF_EN_1,
}
}
#[doc = "Checks if the value of the field is `FCNTLF_EN_0`"]
#[inline]
pub fn is_fcntlf_en_0(&self) -> bool {
*self == FCNTLF_ENR::FCNTLF_EN_0
}
#[doc = "Checks if the value of the field is `FCNTLF_EN_1`"]
#[inline]
pub fn is_fcntlf_en_1(&self) -> bool {
*self == FCNTLF_ENR::FCNTLF_EN_1
}
}
#[doc = "Possible values of the field `FCNTHF`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FCNTHFR {
#[doc = "2048 cycles"]
FCNTHF_0,
#[doc = "4096 cycles"]
FCNTHF_1,
#[doc = "8192 cycles"]
FCNTHF_2,
#[doc = "16384 cycles"]
FCNTHF_3,
}
impl FCNTHFR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
FCNTHFR::FCNTHF_0 => 0,
FCNTHFR::FCNTHF_1 => 1,
FCNTHFR::FCNTHF_2 => 2,
FCNTHFR::FCNTHF_3 => 3,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> FCNTHFR {
match value {
0 => FCNTHFR::FCNTHF_0,
1 => FCNTHFR::FCNTHF_1,
2 => FCNTHFR::FCNTHF_2,
3 => FCNTHFR::FCNTHF_3,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `FCNTHF_0`"]
#[inline]
pub fn is_fcnthf_0(&self) -> bool {
*self == FCNTHFR::FCNTHF_0
}
#[doc = "Checks if the value of the field is `FCNTHF_1`"]
#[inline]
pub fn is_fcnthf_1(&self) -> bool {
*self == FCNTHFR::FCNTHF_1
}
#[doc = "Checks if the value of the field is `FCNTHF_2`"]
#[inline]
pub fn is_fcnthf_2(&self) -> bool {
*self == FCNTHFR::FCNTHF_2
}
#[doc = "Checks if the value of the field is `FCNTHF_3`"]
#[inline]
pub fn is_fcnthf_3(&self) -> bool {
*self == FCNTHFR::FCNTHF_3
}
}
#[doc = "Possible values of the field `FCNTHF_EN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FCNTHF_ENR {
#[doc = "Startup fault counter disabled. Counter is cleared."]
FCNTHF_EN_0,
#[doc = "Startup fault counter enabled."]
FCNTHF_EN_1,
}
impl FCNTHF_ENR {
#[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 {
FCNTHF_ENR::FCNTHF_EN_0 => false,
FCNTHF_ENR::FCNTHF_EN_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> FCNTHF_ENR {
match value {
false => FCNTHF_ENR::FCNTHF_EN_0,
true => FCNTHF_ENR::FCNTHF_EN_1,
}
}
#[doc = "Checks if the value of the field is `FCNTHF_EN_0`"]
#[inline]
pub fn is_fcnthf_en_0(&self) -> bool {
*self == FCNTHF_ENR::FCNTHF_EN_0
}
#[doc = "Checks if the value of the field is `FCNTHF_EN_1`"]
#[inline]
pub fn is_fcnthf_en_1(&self) -> bool {
*self == FCNTHF_ENR::FCNTHF_EN_1
}
}
#[doc = "Possible values of the field `FCNTHF2`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FCNTHF2R {
#[doc = "2048 cycles"]
FCNTHF2_0,
#[doc = "4096 cycles"]
FCNTHF2_1,
#[doc = "8192 cycles"]
FCNTHF2_2,
#[doc = "16384 cycles"]
FCNTHF2_3,
}
impl FCNTHF2R {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
FCNTHF2R::FCNTHF2_0 => 0,
FCNTHF2R::FCNTHF2_1 => 1,
FCNTHF2R::FCNTHF2_2 => 2,
FCNTHF2R::FCNTHF2_3 => 3,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> FCNTHF2R {
match value {
0 => FCNTHF2R::FCNTHF2_0,
1 => FCNTHF2R::FCNTHF2_1,
2 => FCNTHF2R::FCNTHF2_2,
3 => FCNTHF2R::FCNTHF2_3,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `FCNTHF2_0`"]
#[inline]
pub fn is_fcnthf2_0(&self) -> bool {
*self == FCNTHF2R::FCNTHF2_0
}
#[doc = "Checks if the value of the field is `FCNTHF2_1`"]
#[inline]
pub fn is_fcnthf2_1(&self) -> bool {
*self == FCNTHF2R::FCNTHF2_1
}
#[doc = "Checks if the value of the field is `FCNTHF2_2`"]
#[inline]
pub fn is_fcnthf2_2(&self) -> bool {
*self == FCNTHF2R::FCNTHF2_2
}
#[doc = "Checks if the value of the field is `FCNTHF2_3`"]
#[inline]
pub fn is_fcnthf2_3(&self) -> bool {
*self == FCNTHF2R::FCNTHF2_3
}
}
#[doc = "Possible values of the field `FCNTHF2_EN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FCNTHF2_ENR {
#[doc = "Startup fault counter disabled. Counter is cleared."]
FCNTHF2_EN_0,
#[doc = "Startup fault counter enabled."]
FCNTHF2_EN_1,
}
impl FCNTHF2_ENR {
#[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 {
FCNTHF2_ENR::FCNTHF2_EN_0 => false,
FCNTHF2_ENR::FCNTHF2_EN_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> FCNTHF2_ENR {
match value {
false => FCNTHF2_ENR::FCNTHF2_EN_0,
true => FCNTHF2_ENR::FCNTHF2_EN_1,
}
}
#[doc = "Checks if the value of the field is `FCNTHF2_EN_0`"]
#[inline]
pub fn is_fcnthf2_en_0(&self) -> bool {
*self == FCNTHF2_ENR::FCNTHF2_EN_0
}
#[doc = "Checks if the value of the field is `FCNTHF2_EN_1`"]
#[inline]
pub fn is_fcnthf2_en_1(&self) -> bool {
*self == FCNTHF2_ENR::FCNTHF2_EN_1
}
}
#[doc = "Values that can be written to the field `FCNTLF`"]
pub enum FCNTLFW {
#[doc = "4096 cycles"]
FCNTLF_0,
#[doc = "8192 cycles"]
FCNTLF_1,
#[doc = "16384 cycles"]
FCNTLF_2,
#[doc = "32768 cycles"]
FCNTLF_3,
}
impl FCNTLFW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
FCNTLFW::FCNTLF_0 => 0,
FCNTLFW::FCNTLF_1 => 1,
FCNTLFW::FCNTLF_2 => 2,
FCNTLFW::FCNTLF_3 => 3,
}
}
}
#[doc = r" Proxy"]
pub struct _FCNTLFW<'a> {
w: &'a mut W,
}
impl<'a> _FCNTLFW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: FCNTLFW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "4096 cycles"]
#[inline]
pub fn fcntlf_0(self) -> &'a mut W {
self.variant(FCNTLFW::FCNTLF_0)
}
#[doc = "8192 cycles"]
#[inline]
pub fn fcntlf_1(self) -> &'a mut W {
self.variant(FCNTLFW::FCNTLF_1)
}
#[doc = "16384 cycles"]
#[inline]
pub fn fcntlf_2(self) -> &'a mut W {
self.variant(FCNTLFW::FCNTLF_2)
}
#[doc = "32768 cycles"]
#[inline]
pub fn fcntlf_3(self) -> &'a mut W {
self.variant(FCNTLFW::FCNTLF_3)
}
#[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 = 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 `RFCNTLF`"]
pub enum RFCNTLFW {
#[doc = "Not applicable. Always reads as zero due to self clearing."]
RFCNTLF_0,
#[doc = "Restarts the counter immediately."]
RFCNTLF_1,
}
impl RFCNTLFW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
RFCNTLFW::RFCNTLF_0 => false,
RFCNTLFW::RFCNTLF_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _RFCNTLFW<'a> {
w: &'a mut W,
}
impl<'a> _RFCNTLFW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: RFCNTLFW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Not applicable. Always reads as zero due to self clearing."]
#[inline]
pub fn rfcntlf_0(self) -> &'a mut W {
self.variant(RFCNTLFW::RFCNTLF_0)
}
#[doc = "Restarts the counter immediately."]
#[inline]
pub fn rfcntlf_1(self) -> &'a mut W {
self.variant(RFCNTLFW::RFCNTLF_1)
}
#[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 = 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 `FCNTLF_EN`"]
pub enum FCNTLF_ENW {
#[doc = "Startup fault counter disabled. Counter is cleared."]
FCNTLF_EN_0,
#[doc = "Startup fault counter enabled."]
FCNTLF_EN_1,
}
impl FCNTLF_ENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
FCNTLF_ENW::FCNTLF_EN_0 => false,
FCNTLF_ENW::FCNTLF_EN_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _FCNTLF_ENW<'a> {
w: &'a mut W,
}
impl<'a> _FCNTLF_ENW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: FCNTLF_ENW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Startup fault counter disabled. Counter is cleared."]
#[inline]
pub fn fcntlf_en_0(self) -> &'a mut W {
self.variant(FCNTLF_ENW::FCNTLF_EN_0)
}
#[doc = "Startup fault counter enabled."]
#[inline]
pub fn fcntlf_en_1(self) -> &'a mut W {
self.variant(FCNTLF_ENW::FCNTLF_EN_1)
}
#[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 = 3;
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 `FCNTHF`"]
pub enum FCNTHFW {
#[doc = "2048 cycles"]
FCNTHF_0,
#[doc = "4096 cycles"]
FCNTHF_1,
#[doc = "8192 cycles"]
FCNTHF_2,
#[doc = "16384 cycles"]
FCNTHF_3,
}
impl FCNTHFW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
FCNTHFW::FCNTHF_0 => 0,
FCNTHFW::FCNTHF_1 => 1,
FCNTHFW::FCNTHF_2 => 2,
FCNTHFW::FCNTHF_3 => 3,
}
}
}
#[doc = r" Proxy"]
pub struct _FCNTHFW<'a> {
w: &'a mut W,
}
impl<'a> _FCNTHFW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: FCNTHFW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "2048 cycles"]
#[inline]
pub fn fcnthf_0(self) -> &'a mut W {
self.variant(FCNTHFW::FCNTHF_0)
}
#[doc = "4096 cycles"]
#[inline]
pub fn fcnthf_1(self) -> &'a mut W {
self.variant(FCNTHFW::FCNTHF_1)
}
#[doc = "8192 cycles"]
#[inline]
pub fn fcnthf_2(self) -> &'a mut W {
self.variant(FCNTHFW::FCNTHF_2)
}
#[doc = "16384 cycles"]
#[inline]
pub fn fcnthf_3(self) -> &'a mut W {
self.variant(FCNTHFW::FCNTHF_3)
}
#[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 = 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 `RFCNTHF`"]
pub enum RFCNTHFW {
#[doc = "Not applicable. Always reads as zero due to self clearing."]
RFCNTHF_0,
#[doc = "Restarts the counter immediately."]
RFCNTHF_1,
}
impl RFCNTHFW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
RFCNTHFW::RFCNTHF_0 => false,
RFCNTHFW::RFCNTHF_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _RFCNTHFW<'a> {
w: &'a mut W,
}
impl<'a> _RFCNTHFW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: RFCNTHFW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Not applicable. Always reads as zero due to self clearing."]
#[inline]
pub fn rfcnthf_0(self) -> &'a mut W {
self.variant(RFCNTHFW::RFCNTHF_0)
}
#[doc = "Restarts the counter immediately."]
#[inline]
pub fn rfcnthf_1(self) -> &'a mut W {
self.variant(RFCNTHFW::RFCNTHF_1)
}
#[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 = 6;
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 `FCNTHF_EN`"]
pub enum FCNTHF_ENW {
#[doc = "Startup fault counter disabled. Counter is cleared."]
FCNTHF_EN_0,
#[doc = "Startup fault counter enabled."]
FCNTHF_EN_1,
}
impl FCNTHF_ENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
FCNTHF_ENW::FCNTHF_EN_0 => false,
FCNTHF_ENW::FCNTHF_EN_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _FCNTHF_ENW<'a> {
w: &'a mut W,
}
impl<'a> _FCNTHF_ENW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: FCNTHF_ENW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Startup fault counter disabled. Counter is cleared."]
#[inline]
pub fn fcnthf_en_0(self) -> &'a mut W {
self.variant(FCNTHF_ENW::FCNTHF_EN_0)
}
#[doc = "Startup fault counter enabled."]
#[inline]
pub fn fcnthf_en_1(self) -> &'a mut W {
self.variant(FCNTHF_ENW::FCNTHF_EN_1)
}
#[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 = 7;
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 `FCNTHF2`"]
pub enum FCNTHF2W {
#[doc = "2048 cycles"]
FCNTHF2_0,
#[doc = "4096 cycles"]
FCNTHF2_1,
#[doc = "8192 cycles"]
FCNTHF2_2,
#[doc = "16384 cycles"]
FCNTHF2_3,
}
impl FCNTHF2W {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
FCNTHF2W::FCNTHF2_0 => 0,
FCNTHF2W::FCNTHF2_1 => 1,
FCNTHF2W::FCNTHF2_2 => 2,
FCNTHF2W::FCNTHF2_3 => 3,
}
}
}
#[doc = r" Proxy"]
pub struct _FCNTHF2W<'a> {
w: &'a mut W,
}
impl<'a> _FCNTHF2W<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: FCNTHF2W) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "2048 cycles"]
#[inline]
pub fn fcnthf2_0(self) -> &'a mut W {
self.variant(FCNTHF2W::FCNTHF2_0)
}
#[doc = "4096 cycles"]
#[inline]
pub fn fcnthf2_1(self) -> &'a mut W {
self.variant(FCNTHF2W::FCNTHF2_1)
}
#[doc = "8192 cycles"]
#[inline]
pub fn fcnthf2_2(self) -> &'a mut W {
self.variant(FCNTHF2W::FCNTHF2_2)
}
#[doc = "16384 cycles"]
#[inline]
pub fn fcnthf2_3(self) -> &'a mut W {
self.variant(FCNTHF2W::FCNTHF2_3)
}
#[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 = 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 `RFCNTHF2`"]
pub enum RFCNTHF2W {
#[doc = "Not applicable. Always reads as zero due to self clearing."]
RFCNTHF2_0,
#[doc = "Restarts the counter immediately."]
RFCNTHF2_1,
}
impl RFCNTHF2W {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
RFCNTHF2W::RFCNTHF2_0 => false,
RFCNTHF2W::RFCNTHF2_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _RFCNTHF2W<'a> {
w: &'a mut W,
}
impl<'a> _RFCNTHF2W<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: RFCNTHF2W) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Not applicable. Always reads as zero due to self clearing."]
#[inline]
pub fn rfcnthf2_0(self) -> &'a mut W {
self.variant(RFCNTHF2W::RFCNTHF2_0)
}
#[doc = "Restarts the counter immediately."]
#[inline]
pub fn rfcnthf2_1(self) -> &'a mut W {
self.variant(RFCNTHF2W::RFCNTHF2_1)
}
#[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 = 10;
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 `FCNTHF2_EN`"]
pub enum FCNTHF2_ENW {
#[doc = "Startup fault counter disabled. Counter is cleared."]
FCNTHF2_EN_0,
#[doc = "Startup fault counter enabled."]
FCNTHF2_EN_1,
}
impl FCNTHF2_ENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
FCNTHF2_ENW::FCNTHF2_EN_0 => false,
FCNTHF2_ENW::FCNTHF2_EN_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _FCNTHF2_ENW<'a> {
w: &'a mut W,
}
impl<'a> _FCNTHF2_ENW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: FCNTHF2_ENW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Startup fault counter disabled. Counter is cleared."]
#[inline]
pub fn fcnthf2_en_0(self) -> &'a mut W {
self.variant(FCNTHF2_ENW::FCNTHF2_EN_0)
}
#[doc = "Startup fault counter enabled."]
#[inline]
pub fn fcnthf2_en_1(self) -> &'a mut W {
self.variant(FCNTHF2_ENW::FCNTHF2_EN_1)
}
#[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
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 0:1 - Start flag counter for LFXT"]
#[inline]
pub fn fcntlf(&self) -> FCNTLFR {
FCNTLFR::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 3 - Enable start fault counter for LFXT"]
#[inline]
pub fn fcntlf_en(&self) -> FCNTLF_ENR {
FCNTLF_ENR::_from({
const MASK: bool = true;
const OFFSET: u8 = 3;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 4:5 - Start flag counter for HFXT"]
#[inline]
pub fn fcnthf(&self) -> FCNTHFR {
FCNTHFR::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 4;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 7 - Enable start fault counter for HFXT"]
#[inline]
pub fn fcnthf_en(&self) -> FCNTHF_ENR {
FCNTHF_ENR::_from({
const MASK: bool = true;
const OFFSET: u8 = 7;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 8:9 - Start flag counter for HFXT2"]
#[inline]
pub fn fcnthf2(&self) -> FCNTHF2R {
FCNTHF2R::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 8;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 11 - Enable start fault counter for HFXT2"]
#[inline]
pub fn fcnthf2_en(&self) -> FCNTHF2_ENR {
FCNTHF2_ENR::_from({
const MASK: bool = true;
const OFFSET: u8 = 11;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 3003 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bits 0:1 - Start flag counter for LFXT"]
#[inline]
pub fn fcntlf(&mut self) -> _FCNTLFW {
_FCNTLFW { w: self }
}
#[doc = "Bit 2 - Reset start fault counter for LFXT"]
#[inline]
pub fn rfcntlf(&mut self) -> _RFCNTLFW {
_RFCNTLFW { w: self }
}
#[doc = "Bit 3 - Enable start fault counter for LFXT"]
#[inline]
pub fn fcntlf_en(&mut self) -> _FCNTLF_ENW {
_FCNTLF_ENW { w: self }
}
#[doc = "Bits 4:5 - Start flag counter for HFXT"]
#[inline]
pub fn fcnthf(&mut self) -> _FCNTHFW {
_FCNTHFW { w: self }
}
#[doc = "Bit 6 - Reset start fault counter for HFXT"]
#[inline]
pub fn rfcnthf(&mut self) -> _RFCNTHFW {
_RFCNTHFW { w: self }
}
#[doc = "Bit 7 - Enable start fault counter for HFXT"]
#[inline]
pub fn fcnthf_en(&mut self) -> _FCNTHF_ENW {
_FCNTHF_ENW { w: self }
}
#[doc = "Bits 8:9 - Start flag counter for HFXT2"]
#[inline]
pub fn fcnthf2(&mut self) -> _FCNTHF2W {
_FCNTHF2W { w: self }
}
#[doc = "Bit 10 - Reset start fault counter for HFXT2"]
#[inline]
pub fn rfcnthf2(&mut self) -> _RFCNTHF2W {
_RFCNTHF2W { w: self }
}
#[doc = "Bit 11 - Enable start fault counter for HFXT2"]
#[inline]
pub fn fcnthf2_en(&mut self) -> _FCNTHF2_ENW {
_FCNTHF2_ENW { w: self }
}
}