nrf52820_pac/clock/
lfxodebounce.rs1#[doc = "Register `LFXODEBOUNCE` reader"]
2pub struct R(crate::R<LFXODEBOUNCE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<LFXODEBOUNCE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<LFXODEBOUNCE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<LFXODEBOUNCE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `LFXODEBOUNCE` writer"]
17pub struct W(crate::W<LFXODEBOUNCE_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<LFXODEBOUNCE_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<LFXODEBOUNCE_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<LFXODEBOUNCE_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `LFXODEBOUNCE` reader - LFXO debounce time."]
38pub type LFXODEBOUNCE_R = crate::BitReader<LFXODEBOUNCE_A>;
39#[doc = "LFXO debounce time.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum LFXODEBOUNCE_A {
42 #[doc = "0: 8192 32.768 kHz periods, or 0.25 s. Recommended for normal Operating Temperature conditions."]
43 NORMAL = 0,
44 #[doc = "1: 16384 32.768 kHz periods, or 0.5 s. Recommended for Extended Operating Temperature conditions."]
45 EXTENDED = 1,
46}
47impl From<LFXODEBOUNCE_A> for bool {
48 #[inline(always)]
49 fn from(variant: LFXODEBOUNCE_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl LFXODEBOUNCE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> LFXODEBOUNCE_A {
57 match self.bits {
58 false => LFXODEBOUNCE_A::NORMAL,
59 true => LFXODEBOUNCE_A::EXTENDED,
60 }
61 }
62 #[doc = "Checks if the value of the field is `NORMAL`"]
63 #[inline(always)]
64 pub fn is_normal(&self) -> bool {
65 *self == LFXODEBOUNCE_A::NORMAL
66 }
67 #[doc = "Checks if the value of the field is `EXTENDED`"]
68 #[inline(always)]
69 pub fn is_extended(&self) -> bool {
70 *self == LFXODEBOUNCE_A::EXTENDED
71 }
72}
73#[doc = "Field `LFXODEBOUNCE` writer - LFXO debounce time."]
74pub type LFXODEBOUNCE_W<'a, const O: u8> =
75 crate::BitWriter<'a, u32, LFXODEBOUNCE_SPEC, LFXODEBOUNCE_A, O>;
76impl<'a, const O: u8> LFXODEBOUNCE_W<'a, O> {
77 #[doc = "8192 32.768 kHz periods, or 0.25 s. Recommended for normal Operating Temperature conditions."]
78 #[inline(always)]
79 pub fn normal(self) -> &'a mut W {
80 self.variant(LFXODEBOUNCE_A::NORMAL)
81 }
82 #[doc = "16384 32.768 kHz periods, or 0.5 s. Recommended for Extended Operating Temperature conditions."]
83 #[inline(always)]
84 pub fn extended(self) -> &'a mut W {
85 self.variant(LFXODEBOUNCE_A::EXTENDED)
86 }
87}
88impl R {
89 #[doc = "Bit 0 - LFXO debounce time."]
90 #[inline(always)]
91 pub fn lfxodebounce(&self) -> LFXODEBOUNCE_R {
92 LFXODEBOUNCE_R::new((self.bits & 1) != 0)
93 }
94}
95impl W {
96 #[doc = "Bit 0 - LFXO debounce time."]
97 #[inline(always)]
98 pub fn lfxodebounce(&mut self) -> LFXODEBOUNCE_W<0> {
99 LFXODEBOUNCE_W::new(self)
100 }
101 #[doc = "Writes raw bits to the register."]
102 #[inline(always)]
103 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
104 self.0.bits(bits);
105 self
106 }
107}
108#[doc = "LFXO debounce time. The LFXO is started by triggering the TASKS_LFCLKSTART task when the LFCLKSRC register is configured for Xtal.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [lfxodebounce](index.html) module"]
109pub struct LFXODEBOUNCE_SPEC;
110impl crate::RegisterSpec for LFXODEBOUNCE_SPEC {
111 type Ux = u32;
112}
113#[doc = "`read()` method returns [lfxodebounce::R](R) reader structure"]
114impl crate::Readable for LFXODEBOUNCE_SPEC {
115 type Reader = R;
116}
117#[doc = "`write(|w| ..)` method takes [lfxodebounce::W](W) writer structure"]
118impl crate::Writable for LFXODEBOUNCE_SPEC {
119 type Writer = W;
120}
121#[doc = "`reset()` method sets LFXODEBOUNCE to value 0"]
122impl crate::Resettable for LFXODEBOUNCE_SPEC {
123 #[inline(always)]
124 fn reset_value() -> Self::Ux {
125 0
126 }
127}