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

1103 lines
32 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::CSCTL2 {
#[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 `LFXTDRIVE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LFXTDRIVER {
#[doc = "Lowest drive strength and current consumption LFXT oscillator."]
LFXTDRIVE_0,
#[doc = "Increased drive strength LFXT oscillator."]
LFXTDRIVE_1,
#[doc = "Increased drive strength LFXT oscillator."]
LFXTDRIVE_2,
#[doc = "Maximum drive strength and maximum current consumption LFXT oscillator."]
LFXTDRIVE_3,
}
impl LFXTDRIVER {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
LFXTDRIVER::LFXTDRIVE_0 => 0,
LFXTDRIVER::LFXTDRIVE_1 => 1,
LFXTDRIVER::LFXTDRIVE_2 => 2,
LFXTDRIVER::LFXTDRIVE_3 => 3,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> LFXTDRIVER {
match value {
0 => LFXTDRIVER::LFXTDRIVE_0,
1 => LFXTDRIVER::LFXTDRIVE_1,
2 => LFXTDRIVER::LFXTDRIVE_2,
3 => LFXTDRIVER::LFXTDRIVE_3,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `LFXTDRIVE_0`"]
#[inline]
pub fn is_lfxtdrive_0(&self) -> bool {
*self == LFXTDRIVER::LFXTDRIVE_0
}
#[doc = "Checks if the value of the field is `LFXTDRIVE_1`"]
#[inline]
pub fn is_lfxtdrive_1(&self) -> bool {
*self == LFXTDRIVER::LFXTDRIVE_1
}
#[doc = "Checks if the value of the field is `LFXTDRIVE_2`"]
#[inline]
pub fn is_lfxtdrive_2(&self) -> bool {
*self == LFXTDRIVER::LFXTDRIVE_2
}
#[doc = "Checks if the value of the field is `LFXTDRIVE_3`"]
#[inline]
pub fn is_lfxtdrive_3(&self) -> bool {
*self == LFXTDRIVER::LFXTDRIVE_3
}
}
#[doc = "Possible values of the field `LFXTAGCOFF`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LFXTAGCOFFR {
#[doc = "AGC enabled."]
LFXTAGCOFF_0,
#[doc = "AGC disabled."]
LFXTAGCOFF_1,
}
impl LFXTAGCOFFR {
#[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 {
LFXTAGCOFFR::LFXTAGCOFF_0 => false,
LFXTAGCOFFR::LFXTAGCOFF_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> LFXTAGCOFFR {
match value {
false => LFXTAGCOFFR::LFXTAGCOFF_0,
true => LFXTAGCOFFR::LFXTAGCOFF_1,
}
}
#[doc = "Checks if the value of the field is `LFXTAGCOFF_0`"]
#[inline]
pub fn is_lfxtagcoff_0(&self) -> bool {
*self == LFXTAGCOFFR::LFXTAGCOFF_0
}
#[doc = "Checks if the value of the field is `LFXTAGCOFF_1`"]
#[inline]
pub fn is_lfxtagcoff_1(&self) -> bool {
*self == LFXTAGCOFFR::LFXTAGCOFF_1
}
}
#[doc = "Possible values of the field `LFXT_EN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LFXT_ENR {
#[doc = "LFXT is on if it is used as a source for ACLK, MCLK, HSMCLK , or SMCLK\r\r\nand is selected via the port selection and not in bypass mode of operation."]
LFXT_EN_0,
#[doc = "LFXT is on if LFXT is selected via the port selection and LFXT is not in\r\r\nbypass mode of operation."]
LFXT_EN_1,
}
impl LFXT_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 {
LFXT_ENR::LFXT_EN_0 => false,
LFXT_ENR::LFXT_EN_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> LFXT_ENR {
match value {
false => LFXT_ENR::LFXT_EN_0,
true => LFXT_ENR::LFXT_EN_1,
}
}
#[doc = "Checks if the value of the field is `LFXT_EN_0`"]
#[inline]
pub fn is_lfxt_en_0(&self) -> bool {
*self == LFXT_ENR::LFXT_EN_0
}
#[doc = "Checks if the value of the field is `LFXT_EN_1`"]
#[inline]
pub fn is_lfxt_en_1(&self) -> bool {
*self == LFXT_ENR::LFXT_EN_1
}
}
#[doc = "Possible values of the field `LFXTBYPASS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LFXTBYPASSR {
#[doc = "LFXT sourced by external crystal."]
LFXTBYPASS_0,
#[doc = "LFXT sourced by external square wave."]
LFXTBYPASS_1,
}
impl LFXTBYPASSR {
#[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 {
LFXTBYPASSR::LFXTBYPASS_0 => false,
LFXTBYPASSR::LFXTBYPASS_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> LFXTBYPASSR {
match value {
false => LFXTBYPASSR::LFXTBYPASS_0,
true => LFXTBYPASSR::LFXTBYPASS_1,
}
}
#[doc = "Checks if the value of the field is `LFXTBYPASS_0`"]
#[inline]
pub fn is_lfxtbypass_0(&self) -> bool {
*self == LFXTBYPASSR::LFXTBYPASS_0
}
#[doc = "Checks if the value of the field is `LFXTBYPASS_1`"]
#[inline]
pub fn is_lfxtbypass_1(&self) -> bool {
*self == LFXTBYPASSR::LFXTBYPASS_1
}
}
#[doc = "Possible values of the field `HFXTDRIVE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HFXTDRIVER {
#[doc = "To be used for HFXTFREQ setting 000b"]
HFXTDRIVE_0,
#[doc = "To be used for HFXTFREQ settings 001b to 110b"]
HFXTDRIVE_1,
}
impl HFXTDRIVER {
#[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 {
HFXTDRIVER::HFXTDRIVE_0 => false,
HFXTDRIVER::HFXTDRIVE_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> HFXTDRIVER {
match value {
false => HFXTDRIVER::HFXTDRIVE_0,
true => HFXTDRIVER::HFXTDRIVE_1,
}
}
#[doc = "Checks if the value of the field is `HFXTDRIVE_0`"]
#[inline]
pub fn is_hfxtdrive_0(&self) -> bool {
*self == HFXTDRIVER::HFXTDRIVE_0
}
#[doc = "Checks if the value of the field is `HFXTDRIVE_1`"]
#[inline]
pub fn is_hfxtdrive_1(&self) -> bool {
*self == HFXTDRIVER::HFXTDRIVE_1
}
}
#[doc = "Possible values of the field `HFXTFREQ`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HFXTFREQR {
#[doc = "1 MHz to 4 MHz"]
HFXTFREQ_0,
#[doc = ">4 MHz to 8 MHz"]
HFXTFREQ_1,
#[doc = ">8 MHz to 16 MHz"]
HFXTFREQ_2,
#[doc = ">16 MHz to 24 MHz"]
HFXTFREQ_3,
#[doc = ">24 MHz to 32 MHz"]
HFXTFREQ_4,
#[doc = ">32 MHz to 40 MHz"]
HFXTFREQ_5,
#[doc = ">40 MHz to 48 MHz"]
HFXTFREQ_6,
#[doc = r" Reserved"]
_Reserved(u8),
}
impl HFXTFREQR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
HFXTFREQR::HFXTFREQ_0 => 0,
HFXTFREQR::HFXTFREQ_1 => 1,
HFXTFREQR::HFXTFREQ_2 => 2,
HFXTFREQR::HFXTFREQ_3 => 3,
HFXTFREQR::HFXTFREQ_4 => 4,
HFXTFREQR::HFXTFREQ_5 => 5,
HFXTFREQR::HFXTFREQ_6 => 6,
HFXTFREQR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> HFXTFREQR {
match value {
0 => HFXTFREQR::HFXTFREQ_0,
1 => HFXTFREQR::HFXTFREQ_1,
2 => HFXTFREQR::HFXTFREQ_2,
3 => HFXTFREQR::HFXTFREQ_3,
4 => HFXTFREQR::HFXTFREQ_4,
5 => HFXTFREQR::HFXTFREQ_5,
6 => HFXTFREQR::HFXTFREQ_6,
i => HFXTFREQR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `HFXTFREQ_0`"]
#[inline]
pub fn is_hfxtfreq_0(&self) -> bool {
*self == HFXTFREQR::HFXTFREQ_0
}
#[doc = "Checks if the value of the field is `HFXTFREQ_1`"]
#[inline]
pub fn is_hfxtfreq_1(&self) -> bool {
*self == HFXTFREQR::HFXTFREQ_1
}
#[doc = "Checks if the value of the field is `HFXTFREQ_2`"]
#[inline]
pub fn is_hfxtfreq_2(&self) -> bool {
*self == HFXTFREQR::HFXTFREQ_2
}
#[doc = "Checks if the value of the field is `HFXTFREQ_3`"]
#[inline]
pub fn is_hfxtfreq_3(&self) -> bool {
*self == HFXTFREQR::HFXTFREQ_3
}
#[doc = "Checks if the value of the field is `HFXTFREQ_4`"]
#[inline]
pub fn is_hfxtfreq_4(&self) -> bool {
*self == HFXTFREQR::HFXTFREQ_4
}
#[doc = "Checks if the value of the field is `HFXTFREQ_5`"]
#[inline]
pub fn is_hfxtfreq_5(&self) -> bool {
*self == HFXTFREQR::HFXTFREQ_5
}
#[doc = "Checks if the value of the field is `HFXTFREQ_6`"]
#[inline]
pub fn is_hfxtfreq_6(&self) -> bool {
*self == HFXTFREQR::HFXTFREQ_6
}
}
#[doc = "Possible values of the field `HFXT_EN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HFXT_ENR {
#[doc = "HFXT is on if it is used as a source for MCLK, HSMCLK , or SMCLK and is selected via the port selection and not in bypass mode of operation."]
HFXT_EN_0,
#[doc = "HFXT is on if HFXT is selected via the port selection and HFXT is not in bypass mode of operation."]
HFXT_EN_1,
}
impl HFXT_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 {
HFXT_ENR::HFXT_EN_0 => false,
HFXT_ENR::HFXT_EN_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> HFXT_ENR {
match value {
false => HFXT_ENR::HFXT_EN_0,
true => HFXT_ENR::HFXT_EN_1,
}
}
#[doc = "Checks if the value of the field is `HFXT_EN_0`"]
#[inline]
pub fn is_hfxt_en_0(&self) -> bool {
*self == HFXT_ENR::HFXT_EN_0
}
#[doc = "Checks if the value of the field is `HFXT_EN_1`"]
#[inline]
pub fn is_hfxt_en_1(&self) -> bool {
*self == HFXT_ENR::HFXT_EN_1
}
}
#[doc = "Possible values of the field `HFXTBYPASS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HFXTBYPASSR {
#[doc = "HFXT sourced by external crystal."]
HFXTBYPASS_0,
#[doc = "HFXT sourced by external square wave."]
HFXTBYPASS_1,
}
impl HFXTBYPASSR {
#[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 {
HFXTBYPASSR::HFXTBYPASS_0 => false,
HFXTBYPASSR::HFXTBYPASS_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> HFXTBYPASSR {
match value {
false => HFXTBYPASSR::HFXTBYPASS_0,
true => HFXTBYPASSR::HFXTBYPASS_1,
}
}
#[doc = "Checks if the value of the field is `HFXTBYPASS_0`"]
#[inline]
pub fn is_hfxtbypass_0(&self) -> bool {
*self == HFXTBYPASSR::HFXTBYPASS_0
}
#[doc = "Checks if the value of the field is `HFXTBYPASS_1`"]
#[inline]
pub fn is_hfxtbypass_1(&self) -> bool {
*self == HFXTBYPASSR::HFXTBYPASS_1
}
}
#[doc = "Values that can be written to the field `LFXTDRIVE`"]
pub enum LFXTDRIVEW {
#[doc = "Lowest drive strength and current consumption LFXT oscillator."]
LFXTDRIVE_0,
#[doc = "Increased drive strength LFXT oscillator."]
LFXTDRIVE_1,
#[doc = "Increased drive strength LFXT oscillator."]
LFXTDRIVE_2,
#[doc = "Maximum drive strength and maximum current consumption LFXT oscillator."]
LFXTDRIVE_3,
}
impl LFXTDRIVEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
LFXTDRIVEW::LFXTDRIVE_0 => 0,
LFXTDRIVEW::LFXTDRIVE_1 => 1,
LFXTDRIVEW::LFXTDRIVE_2 => 2,
LFXTDRIVEW::LFXTDRIVE_3 => 3,
}
}
}
#[doc = r" Proxy"]
pub struct _LFXTDRIVEW<'a> {
w: &'a mut W,
}
impl<'a> _LFXTDRIVEW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: LFXTDRIVEW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "Lowest drive strength and current consumption LFXT oscillator."]
#[inline]
pub fn lfxtdrive_0(self) -> &'a mut W {
self.variant(LFXTDRIVEW::LFXTDRIVE_0)
}
#[doc = "Increased drive strength LFXT oscillator."]
#[inline]
pub fn lfxtdrive_1(self) -> &'a mut W {
self.variant(LFXTDRIVEW::LFXTDRIVE_1)
}
#[doc = "Increased drive strength LFXT oscillator."]
#[inline]
pub fn lfxtdrive_2(self) -> &'a mut W {
self.variant(LFXTDRIVEW::LFXTDRIVE_2)
}
#[doc = "Maximum drive strength and maximum current consumption LFXT oscillator."]
#[inline]
pub fn lfxtdrive_3(self) -> &'a mut W {
self.variant(LFXTDRIVEW::LFXTDRIVE_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 `LFXTAGCOFF`"]
pub enum LFXTAGCOFFW {
#[doc = "AGC enabled."]
LFXTAGCOFF_0,
#[doc = "AGC disabled."]
LFXTAGCOFF_1,
}
impl LFXTAGCOFFW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
LFXTAGCOFFW::LFXTAGCOFF_0 => false,
LFXTAGCOFFW::LFXTAGCOFF_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _LFXTAGCOFFW<'a> {
w: &'a mut W,
}
impl<'a> _LFXTAGCOFFW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: LFXTAGCOFFW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "AGC enabled."]
#[inline]
pub fn lfxtagcoff_0(self) -> &'a mut W {
self.variant(LFXTAGCOFFW::LFXTAGCOFF_0)
}
#[doc = "AGC disabled."]
#[inline]
pub fn lfxtagcoff_1(self) -> &'a mut W {
self.variant(LFXTAGCOFFW::LFXTAGCOFF_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 `LFXT_EN`"]
pub enum LFXT_ENW {
#[doc = "LFXT is on if it is used as a source for ACLK, MCLK, HSMCLK , or SMCLK\r\r\nand is selected via the port selection and not in bypass mode of operation."]
LFXT_EN_0,
#[doc = "LFXT is on if LFXT is selected via the port selection and LFXT is not in\r\r\nbypass mode of operation."]
LFXT_EN_1,
}
impl LFXT_ENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
LFXT_ENW::LFXT_EN_0 => false,
LFXT_ENW::LFXT_EN_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _LFXT_ENW<'a> {
w: &'a mut W,
}
impl<'a> _LFXT_ENW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: LFXT_ENW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "LFXT is on if it is used as a source for ACLK, MCLK, HSMCLK , or SMCLK and is selected via the port selection and not in bypass mode of operation."]
#[inline]
pub fn lfxt_en_0(self) -> &'a mut W {
self.variant(LFXT_ENW::LFXT_EN_0)
}
#[doc = "LFXT is on if LFXT is selected via the port selection and LFXT is not in bypass mode of operation."]
#[inline]
pub fn lfxt_en_1(self) -> &'a mut W {
self.variant(LFXT_ENW::LFXT_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 = 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 `LFXTBYPASS`"]
pub enum LFXTBYPASSW {
#[doc = "LFXT sourced by external crystal."]
LFXTBYPASS_0,
#[doc = "LFXT sourced by external square wave."]
LFXTBYPASS_1,
}
impl LFXTBYPASSW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
LFXTBYPASSW::LFXTBYPASS_0 => false,
LFXTBYPASSW::LFXTBYPASS_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _LFXTBYPASSW<'a> {
w: &'a mut W,
}
impl<'a> _LFXTBYPASSW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: LFXTBYPASSW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "LFXT sourced by external crystal."]
#[inline]
pub fn lfxtbypass_0(self) -> &'a mut W {
self.variant(LFXTBYPASSW::LFXTBYPASS_0)
}
#[doc = "LFXT sourced by external square wave."]
#[inline]
pub fn lfxtbypass_1(self) -> &'a mut W {
self.variant(LFXTBYPASSW::LFXTBYPASS_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 = 9;
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 `HFXTDRIVE`"]
pub enum HFXTDRIVEW {
#[doc = "To be used for HFXTFREQ setting 000b"]
HFXTDRIVE_0,
#[doc = "To be used for HFXTFREQ settings 001b to 110b"]
HFXTDRIVE_1,
}
impl HFXTDRIVEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
HFXTDRIVEW::HFXTDRIVE_0 => false,
HFXTDRIVEW::HFXTDRIVE_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _HFXTDRIVEW<'a> {
w: &'a mut W,
}
impl<'a> _HFXTDRIVEW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: HFXTDRIVEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "To be used for HFXTFREQ setting 000b"]
#[inline]
pub fn hfxtdrive_0(self) -> &'a mut W {
self.variant(HFXTDRIVEW::HFXTDRIVE_0)
}
#[doc = "To be used for HFXTFREQ settings 001b to 110b"]
#[inline]
pub fn hfxtdrive_1(self) -> &'a mut W {
self.variant(HFXTDRIVEW::HFXTDRIVE_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 = 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 `HFXTFREQ`"]
pub enum HFXTFREQW {
#[doc = "1 MHz to 4 MHz"]
HFXTFREQ_0,
#[doc = ">4 MHz to 8 MHz"]
HFXTFREQ_1,
#[doc = ">8 MHz to 16 MHz"]
HFXTFREQ_2,
#[doc = ">16 MHz to 24 MHz"]
HFXTFREQ_3,
#[doc = ">24 MHz to 32 MHz"]
HFXTFREQ_4,
#[doc = ">32 MHz to 40 MHz"]
HFXTFREQ_5,
#[doc = ">40 MHz to 48 MHz"]
HFXTFREQ_6,
}
impl HFXTFREQW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
HFXTFREQW::HFXTFREQ_0 => 0,
HFXTFREQW::HFXTFREQ_1 => 1,
HFXTFREQW::HFXTFREQ_2 => 2,
HFXTFREQW::HFXTFREQ_3 => 3,
HFXTFREQW::HFXTFREQ_4 => 4,
HFXTFREQW::HFXTFREQ_5 => 5,
HFXTFREQW::HFXTFREQ_6 => 6,
}
}
}
#[doc = r" Proxy"]
pub struct _HFXTFREQW<'a> {
w: &'a mut W,
}
impl<'a> _HFXTFREQW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: HFXTFREQW) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "1 MHz to 4 MHz"]
#[inline]
pub fn hfxtfreq_0(self) -> &'a mut W {
self.variant(HFXTFREQW::HFXTFREQ_0)
}
#[doc = ">4 MHz to 8 MHz"]
#[inline]
pub fn hfxtfreq_1(self) -> &'a mut W {
self.variant(HFXTFREQW::HFXTFREQ_1)
}
#[doc = ">8 MHz to 16 MHz"]
#[inline]
pub fn hfxtfreq_2(self) -> &'a mut W {
self.variant(HFXTFREQW::HFXTFREQ_2)
}
#[doc = ">16 MHz to 24 MHz"]
#[inline]
pub fn hfxtfreq_3(self) -> &'a mut W {
self.variant(HFXTFREQW::HFXTFREQ_3)
}
#[doc = ">24 MHz to 32 MHz"]
#[inline]
pub fn hfxtfreq_4(self) -> &'a mut W {
self.variant(HFXTFREQW::HFXTFREQ_4)
}
#[doc = ">32 MHz to 40 MHz"]
#[inline]
pub fn hfxtfreq_5(self) -> &'a mut W {
self.variant(HFXTFREQW::HFXTFREQ_5)
}
#[doc = ">40 MHz to 48 MHz"]
#[inline]
pub fn hfxtfreq_6(self) -> &'a mut W {
self.variant(HFXTFREQW::HFXTFREQ_6)
}
#[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 `HFXT_EN`"]
pub enum HFXT_ENW {
#[doc = "HFXT is on if it is used as a source for MCLK, HSMCLK , or SMCLK and is selected via the port selection and not in bypass mode of operation."]
HFXT_EN_0,
#[doc = "HFXT is on if HFXT is selected via the port selection and HFXT is not in bypass mode of operation."]
HFXT_EN_1,
}
impl HFXT_ENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
HFXT_ENW::HFXT_EN_0 => false,
HFXT_ENW::HFXT_EN_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _HFXT_ENW<'a> {
w: &'a mut W,
}
impl<'a> _HFXT_ENW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: HFXT_ENW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "HFXT is on if it is used as a source for MCLK, HSMCLK , or SMCLK and is selected via the port selection and not in bypass mode of operation."]
#[inline]
pub fn hfxt_en_0(self) -> &'a mut W {
self.variant(HFXT_ENW::HFXT_EN_0)
}
#[doc = "HFXT is on if HFXT is selected via the port selection and HFXT is not in bypass mode of operation."]
#[inline]
pub fn hfxt_en_1(self) -> &'a mut W {
self.variant(HFXT_ENW::HFXT_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 = 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 `HFXTBYPASS`"]
pub enum HFXTBYPASSW {
#[doc = "HFXT sourced by external crystal."]
HFXTBYPASS_0,
#[doc = "HFXT sourced by external square wave."]
HFXTBYPASS_1,
}
impl HFXTBYPASSW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
HFXTBYPASSW::HFXTBYPASS_0 => false,
HFXTBYPASSW::HFXTBYPASS_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _HFXTBYPASSW<'a> {
w: &'a mut W,
}
impl<'a> _HFXTBYPASSW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: HFXTBYPASSW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "HFXT sourced by external crystal."]
#[inline]
pub fn hfxtbypass_0(self) -> &'a mut W {
self.variant(HFXTBYPASSW::HFXTBYPASS_0)
}
#[doc = "HFXT sourced by external square wave."]
#[inline]
pub fn hfxtbypass_1(self) -> &'a mut W {
self.variant(HFXTBYPASSW::HFXTBYPASS_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 = 25;
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 - LFXT oscillator current can be adjusted to its drive needs"]
#[inline]
pub fn lfxtdrive(&self) -> LFXTDRIVER {
LFXTDRIVER::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 7 - Disables the automatic gain control of the LFXT crystal"]
#[inline]
pub fn lfxtagcoff(&self) -> LFXTAGCOFFR {
LFXTAGCOFFR::_from({
const MASK: bool = true;
const OFFSET: u8 = 7;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 8 - Turns on the LFXT oscillator regardless if used as a clock resource"]
#[inline]
pub fn lfxt_en(&self) -> LFXT_ENR {
LFXT_ENR::_from({
const MASK: bool = true;
const OFFSET: u8 = 8;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 9 - LFXT bypass select"]
#[inline]
pub fn lfxtbypass(&self) -> LFXTBYPASSR {
LFXTBYPASSR::_from({
const MASK: bool = true;
const OFFSET: u8 = 9;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 16 - HFXT oscillator drive selection"]
#[inline]
pub fn hfxtdrive(&self) -> HFXTDRIVER {
HFXTDRIVER::_from({
const MASK: bool = true;
const OFFSET: u8 = 16;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 20:22 - HFXT frequency selection"]
#[inline]
pub fn hfxtfreq(&self) -> HFXTFREQR {
HFXTFREQR::_from({
const MASK: u8 = 7;
const OFFSET: u8 = 20;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 24 - Turns on the HFXT oscillator regardless if used as a clock resource"]
#[inline]
pub fn hfxt_en(&self) -> HFXT_ENR {
HFXT_ENR::_from({
const MASK: bool = true;
const OFFSET: u8 = 24;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 25 - HFXT bypass select"]
#[inline]
pub fn hfxtbypass(&self) -> HFXTBYPASSR {
HFXTBYPASSR::_from({
const MASK: bool = true;
const OFFSET: u8 = 25;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 65539 }
}
#[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 - LFXT oscillator current can be adjusted to its drive needs"]
#[inline]
pub fn lfxtdrive(&mut self) -> _LFXTDRIVEW {
_LFXTDRIVEW { w: self }
}
#[doc = "Bit 7 - Disables the automatic gain control of the LFXT crystal"]
#[inline]
pub fn lfxtagcoff(&mut self) -> _LFXTAGCOFFW {
_LFXTAGCOFFW { w: self }
}
#[doc = "Bit 8 - Turns on the LFXT oscillator regardless if used as a clock resource"]
#[inline]
pub fn lfxt_en(&mut self) -> _LFXT_ENW {
_LFXT_ENW { w: self }
}
#[doc = "Bit 9 - LFXT bypass select"]
#[inline]
pub fn lfxtbypass(&mut self) -> _LFXTBYPASSW {
_LFXTBYPASSW { w: self }
}
#[doc = "Bit 16 - HFXT oscillator drive selection"]
#[inline]
pub fn hfxtdrive(&mut self) -> _HFXTDRIVEW {
_HFXTDRIVEW { w: self }
}
#[doc = "Bits 20:22 - HFXT frequency selection"]
#[inline]
pub fn hfxtfreq(&mut self) -> _HFXTFREQW {
_HFXTFREQW { w: self }
}
#[doc = "Bit 24 - Turns on the HFXT oscillator regardless if used as a clock resource"]
#[inline]
pub fn hfxt_en(&mut self) -> _HFXT_ENW {
_HFXT_ENW { w: self }
}
#[doc = "Bit 25 - HFXT bypass select"]
#[inline]
pub fn hfxtbypass(&mut self) -> _HFXTBYPASSW {
_HFXTBYPASSW { w: self }
}
}