nrf52840_pac/clock/
lfclksrccopy.rs
1#[doc = "Register `LFCLKSRCCOPY` reader"]
2pub struct R(crate::R<LFCLKSRCCOPY_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<LFCLKSRCCOPY_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<LFCLKSRCCOPY_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<LFCLKSRCCOPY_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `SRC` reader - Clock source"]
17pub type SRC_R = crate::FieldReader<u8, SRC_A>;
18#[doc = "Clock source\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20#[repr(u8)]
21pub enum SRC_A {
22 #[doc = "0: 32.768 kHz RC oscillator (LFRC)"]
23 RC = 0,
24 #[doc = "1: 32.768 kHz crystal oscillator (LFXO)"]
25 XTAL = 1,
26 #[doc = "2: 32.768 kHz synthesized from HFCLK (LFSYNT)"]
27 SYNTH = 2,
28}
29impl From<SRC_A> for u8 {
30 #[inline(always)]
31 fn from(variant: SRC_A) -> Self {
32 variant as _
33 }
34}
35impl SRC_R {
36 #[doc = "Get enumerated values variant"]
37 #[inline(always)]
38 pub fn variant(&self) -> Option<SRC_A> {
39 match self.bits {
40 0 => Some(SRC_A::RC),
41 1 => Some(SRC_A::XTAL),
42 2 => Some(SRC_A::SYNTH),
43 _ => None,
44 }
45 }
46 #[doc = "Checks if the value of the field is `RC`"]
47 #[inline(always)]
48 pub fn is_rc(&self) -> bool {
49 *self == SRC_A::RC
50 }
51 #[doc = "Checks if the value of the field is `XTAL`"]
52 #[inline(always)]
53 pub fn is_xtal(&self) -> bool {
54 *self == SRC_A::XTAL
55 }
56 #[doc = "Checks if the value of the field is `SYNTH`"]
57 #[inline(always)]
58 pub fn is_synth(&self) -> bool {
59 *self == SRC_A::SYNTH
60 }
61}
62impl R {
63 #[doc = "Bits 0:1 - Clock source"]
64 #[inline(always)]
65 pub fn src(&self) -> SRC_R {
66 SRC_R::new((self.bits & 3) as u8)
67 }
68}
69#[doc = "Copy of LFCLKSRC register, set when LFCLKSTART task was triggered\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [lfclksrccopy](index.html) module"]
70pub struct LFCLKSRCCOPY_SPEC;
71impl crate::RegisterSpec for LFCLKSRCCOPY_SPEC {
72 type Ux = u32;
73}
74#[doc = "`read()` method returns [lfclksrccopy::R](R) reader structure"]
75impl crate::Readable for LFCLKSRCCOPY_SPEC {
76 type Reader = R;
77}
78#[doc = "`reset()` method sets LFCLKSRCCOPY to value 0"]
79impl crate::Resettable for LFCLKSRCCOPY_SPEC {
80 #[inline(always)]
81 fn reset_value() -> Self::Ux {
82 0
83 }
84}