mcxa_pac/usb0/
clk_recover_irc_en.rs1#[doc = "Register `CLK_RECOVER_IRC_EN` reader"]
2pub type R = crate::R<ClkRecoverIrcEnSpec>;
3#[doc = "Register `CLK_RECOVER_IRC_EN` writer"]
4pub type W = crate::W<ClkRecoverIrcEnSpec>;
5#[doc = "Fast IRC enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum IrcEn {
9 #[doc = "0: Disable"]
10 DisIrc = 0,
11 #[doc = "1: Enable"]
12 EnIrc = 1,
13}
14impl From<IrcEn> for bool {
15 #[inline(always)]
16 fn from(variant: IrcEn) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `IRC_EN` reader - Fast IRC enable"]
21pub type IrcEnR = crate::BitReader<IrcEn>;
22impl IrcEnR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> IrcEn {
26 match self.bits {
27 false => IrcEn::DisIrc,
28 true => IrcEn::EnIrc,
29 }
30 }
31 #[doc = "Disable"]
32 #[inline(always)]
33 pub fn is_dis_irc(&self) -> bool {
34 *self == IrcEn::DisIrc
35 }
36 #[doc = "Enable"]
37 #[inline(always)]
38 pub fn is_en_irc(&self) -> bool {
39 *self == IrcEn::EnIrc
40 }
41}
42#[doc = "Field `IRC_EN` writer - Fast IRC enable"]
43pub type IrcEnW<'a, REG> = crate::BitWriter<'a, REG, IrcEn>;
44impl<'a, REG> IrcEnW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Disable"]
49 #[inline(always)]
50 pub fn dis_irc(self) -> &'a mut crate::W<REG> {
51 self.variant(IrcEn::DisIrc)
52 }
53 #[doc = "Enable"]
54 #[inline(always)]
55 pub fn en_irc(self) -> &'a mut crate::W<REG> {
56 self.variant(IrcEn::EnIrc)
57 }
58}
59impl R {
60 #[doc = "Bit 1 - Fast IRC enable"]
61 #[inline(always)]
62 pub fn irc_en(&self) -> IrcEnR {
63 IrcEnR::new(((self.bits >> 1) & 1) != 0)
64 }
65}
66#[cfg(feature = "debug")]
67impl core::fmt::Debug for R {
68 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
69 f.debug_struct("CLK_RECOVER_IRC_EN")
70 .field("irc_en", &self.irc_en())
71 .finish()
72 }
73}
74impl W {
75 #[doc = "Bit 1 - Fast IRC enable"]
76 #[inline(always)]
77 pub fn irc_en(&mut self) -> IrcEnW<'_, ClkRecoverIrcEnSpec> {
78 IrcEnW::new(self, 1)
79 }
80}
81#[doc = "FIRC Oscillator Enable\n\nYou can [`read`](crate::Reg::read) this register and get [`clk_recover_irc_en::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`clk_recover_irc_en::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
82pub struct ClkRecoverIrcEnSpec;
83impl crate::RegisterSpec for ClkRecoverIrcEnSpec {
84 type Ux = u8;
85}
86#[doc = "`read()` method returns [`clk_recover_irc_en::R`](R) reader structure"]
87impl crate::Readable for ClkRecoverIrcEnSpec {}
88#[doc = "`write(|w| ..)` method takes [`clk_recover_irc_en::W`](W) writer structure"]
89impl crate::Writable for ClkRecoverIrcEnSpec {
90 type Safety = crate::Unsafe;
91}
92#[doc = "`reset()` method sets CLK_RECOVER_IRC_EN to value 0x01"]
93impl crate::Resettable for ClkRecoverIrcEnSpec {
94 const RESET_VALUE: u8 = 0x01;
95}