nrf52840_pac/clock/
hfxodebounce.rs
1#[doc = "Register `HFXODEBOUNCE` reader"]
2pub struct R(crate::R<HFXODEBOUNCE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<HFXODEBOUNCE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<HFXODEBOUNCE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<HFXODEBOUNCE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `HFXODEBOUNCE` writer"]
17pub struct W(crate::W<HFXODEBOUNCE_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<HFXODEBOUNCE_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<HFXODEBOUNCE_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<HFXODEBOUNCE_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `HFXODEBOUNCE` reader - HFXO debounce time. Debounce time = HFXODEBOUNCE * 16 us."]
38pub type HFXODEBOUNCE_R = crate::FieldReader<u8, HFXODEBOUNCE_A>;
39#[doc = "HFXO debounce time. Debounce time = HFXODEBOUNCE * 16 us.\n\nValue on reset: 16"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u8)]
42pub enum HFXODEBOUNCE_A {
43 #[doc = "16: 256 us debounce time. Recommended for TSX-3225, FA-20H and FA-128 crystals."]
44 DB256US = 16,
45 #[doc = "64: 1024 us debounce time. Recommended for NX1612AA and NX1210AB crystals."]
46 DB1024US = 64,
47}
48impl From<HFXODEBOUNCE_A> for u8 {
49 #[inline(always)]
50 fn from(variant: HFXODEBOUNCE_A) -> Self {
51 variant as _
52 }
53}
54impl HFXODEBOUNCE_R {
55 #[doc = "Get enumerated values variant"]
56 #[inline(always)]
57 pub fn variant(&self) -> Option<HFXODEBOUNCE_A> {
58 match self.bits {
59 16 => Some(HFXODEBOUNCE_A::DB256US),
60 64 => Some(HFXODEBOUNCE_A::DB1024US),
61 _ => None,
62 }
63 }
64 #[doc = "Checks if the value of the field is `DB256US`"]
65 #[inline(always)]
66 pub fn is_db256us(&self) -> bool {
67 *self == HFXODEBOUNCE_A::DB256US
68 }
69 #[doc = "Checks if the value of the field is `DB1024US`"]
70 #[inline(always)]
71 pub fn is_db1024us(&self) -> bool {
72 *self == HFXODEBOUNCE_A::DB1024US
73 }
74}
75#[doc = "Field `HFXODEBOUNCE` writer - HFXO debounce time. Debounce time = HFXODEBOUNCE * 16 us."]
76pub type HFXODEBOUNCE_W<'a, const O: u8> =
77 crate::FieldWriter<'a, u32, HFXODEBOUNCE_SPEC, u8, HFXODEBOUNCE_A, 8, O>;
78impl<'a, const O: u8> HFXODEBOUNCE_W<'a, O> {
79 #[doc = "256 us debounce time. Recommended for TSX-3225, FA-20H and FA-128 crystals."]
80 #[inline(always)]
81 pub fn db256us(self) -> &'a mut W {
82 self.variant(HFXODEBOUNCE_A::DB256US)
83 }
84 #[doc = "1024 us debounce time. Recommended for NX1612AA and NX1210AB crystals."]
85 #[inline(always)]
86 pub fn db1024us(self) -> &'a mut W {
87 self.variant(HFXODEBOUNCE_A::DB1024US)
88 }
89}
90impl R {
91 #[doc = "Bits 0:7 - HFXO debounce time. Debounce time = HFXODEBOUNCE * 16 us."]
92 #[inline(always)]
93 pub fn hfxodebounce(&self) -> HFXODEBOUNCE_R {
94 HFXODEBOUNCE_R::new((self.bits & 0xff) as u8)
95 }
96}
97impl W {
98 #[doc = "Bits 0:7 - HFXO debounce time. Debounce time = HFXODEBOUNCE * 16 us."]
99 #[inline(always)]
100 pub fn hfxodebounce(&mut self) -> HFXODEBOUNCE_W<0> {
101 HFXODEBOUNCE_W::new(self)
102 }
103 #[doc = "Writes raw bits to the register."]
104 #[inline(always)]
105 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
106 self.0.bits(bits);
107 self
108 }
109}
110#[doc = "HFXO debounce time. The HFXO is started by triggering the TASKS_HFCLKSTART task.\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 [hfxodebounce](index.html) module"]
111pub struct HFXODEBOUNCE_SPEC;
112impl crate::RegisterSpec for HFXODEBOUNCE_SPEC {
113 type Ux = u32;
114}
115#[doc = "`read()` method returns [hfxodebounce::R](R) reader structure"]
116impl crate::Readable for HFXODEBOUNCE_SPEC {
117 type Reader = R;
118}
119#[doc = "`write(|w| ..)` method takes [hfxodebounce::W](W) writer structure"]
120impl crate::Writable for HFXODEBOUNCE_SPEC {
121 type Writer = W;
122}
123#[doc = "`reset()` method sets HFXODEBOUNCE to value 0x10"]
124impl crate::Resettable for HFXODEBOUNCE_SPEC {
125 #[inline(always)]
126 fn reset_value() -> Self::Ux {
127 0x10
128 }
129}