pub type R = crate::R<LFRCOCTRLrs>;
pub type W = crate::W<LFRCOCTRLrs>;
pub type TuningR = crate::FieldReader<u16>;
pub type TuningW<'a, REG> = crate::FieldWriter<'a, REG, 9, u16>;
pub type EnvrefR = crate::BitReader;
pub type EnvrefW<'a, REG> = crate::BitWriter<'a, REG>;
pub type EnchopR = crate::BitReader;
pub type EnchopW<'a, REG> = crate::BitWriter<'a, REG>;
pub type EndemR = crate::BitReader;
pub type EndemW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TIMEOUT {
_2cycles = 0,
_16cycles = 1,
_32cycles = 2,
}
impl From<TIMEOUT> for u8 {
#[inline(always)]
fn from(variant: TIMEOUT) -> Self {
variant as _
}
}
impl crate::FieldSpec for TIMEOUT {
type Ux = u8;
}
impl crate::IsEnum for TIMEOUT {}
pub type TimeoutR = crate::FieldReader<TIMEOUT>;
impl TimeoutR {
#[inline(always)]
pub const fn variant(&self) -> Option<TIMEOUT> {
match self.bits {
0 => Some(TIMEOUT::_2cycles),
1 => Some(TIMEOUT::_16cycles),
2 => Some(TIMEOUT::_32cycles),
_ => None,
}
}
#[inline(always)]
pub fn is_2cycles(&self) -> bool {
*self == TIMEOUT::_2cycles
}
#[inline(always)]
pub fn is_16cycles(&self) -> bool {
*self == TIMEOUT::_16cycles
}
#[inline(always)]
pub fn is_32cycles(&self) -> bool {
*self == TIMEOUT::_32cycles
}
}
pub type TimeoutW<'a, REG> = crate::FieldWriter<'a, REG, 2, TIMEOUT>;
impl<'a, REG> TimeoutW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn _2cycles(self) -> &'a mut crate::W<REG> {
self.variant(TIMEOUT::_2cycles)
}
#[inline(always)]
pub fn _16cycles(self) -> &'a mut crate::W<REG> {
self.variant(TIMEOUT::_16cycles)
}
#[inline(always)]
pub fn _32cycles(self) -> &'a mut crate::W<REG> {
self.variant(TIMEOUT::_32cycles)
}
}
pub type GmccurtuneR = crate::FieldReader;
pub type GmccurtuneW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
impl R {
#[inline(always)]
pub fn tuning(&self) -> TuningR {
TuningR::new((self.bits & 0x01ff) as u16)
}
#[inline(always)]
pub fn envref(&self) -> EnvrefR {
EnvrefR::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn enchop(&self) -> EnchopR {
EnchopR::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn endem(&self) -> EndemR {
EndemR::new(((self.bits >> 18) & 1) != 0)
}
#[inline(always)]
pub fn timeout(&self) -> TimeoutR {
TimeoutR::new(((self.bits >> 24) & 3) as u8)
}
#[inline(always)]
pub fn gmccurtune(&self) -> GmccurtuneR {
GmccurtuneR::new(((self.bits >> 28) & 0x0f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("LFRCOCTRL")
.field("tuning", &self.tuning())
.field("envref", &self.envref())
.field("enchop", &self.enchop())
.field("endem", &self.endem())
.field("timeout", &self.timeout())
.field("gmccurtune", &self.gmccurtune())
.finish()
}
}
impl W {
#[inline(always)]
pub fn tuning(&mut self) -> TuningW<'_, LFRCOCTRLrs> {
TuningW::new(self, 0)
}
#[inline(always)]
pub fn envref(&mut self) -> EnvrefW<'_, LFRCOCTRLrs> {
EnvrefW::new(self, 16)
}
#[inline(always)]
pub fn enchop(&mut self) -> EnchopW<'_, LFRCOCTRLrs> {
EnchopW::new(self, 17)
}
#[inline(always)]
pub fn endem(&mut self) -> EndemW<'_, LFRCOCTRLrs> {
EndemW::new(self, 18)
}
#[inline(always)]
pub fn timeout(&mut self) -> TimeoutW<'_, LFRCOCTRLrs> {
TimeoutW::new(self, 24)
}
#[inline(always)]
pub fn gmccurtune(&mut self) -> GmccurtuneW<'_, LFRCOCTRLrs> {
GmccurtuneW::new(self, 28)
}
}
pub struct LFRCOCTRLrs;
impl crate::RegisterSpec for LFRCOCTRLrs {
type Ux = u32;
}
impl crate::Readable for LFRCOCTRLrs {}
impl crate::Writable for LFRCOCTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for LFRCOCTRLrs {
const RESET_VALUE: u32 = 0x8106_0100;
}