nrf51_pac/radio/
override4.rs1#[doc = "Register `OVERRIDE4` reader"]
2pub struct R(crate::R<OVERRIDE4_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<OVERRIDE4_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<OVERRIDE4_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<OVERRIDE4_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `OVERRIDE4` writer"]
17pub struct W(crate::W<OVERRIDE4_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<OVERRIDE4_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<OVERRIDE4_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<OVERRIDE4_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `OVERRIDE4` reader - Trim value override 4."]
38pub type OVERRIDE4_R = crate::FieldReader<u32, u32>;
39#[doc = "Field `OVERRIDE4` writer - Trim value override 4."]
40pub type OVERRIDE4_W<'a, const O: u8> =
41 crate::FieldWriter<'a, u32, OVERRIDE4_SPEC, u32, u32, 28, O>;
42#[doc = "Field `ENABLE` reader - Enable or disable override of default trim values."]
43pub type ENABLE_R = crate::BitReader<ENABLE_A>;
44#[doc = "Enable or disable override of default trim values.\n\nValue on reset: 0"]
45#[derive(Clone, Copy, Debug, PartialEq)]
46pub enum ENABLE_A {
47 #[doc = "0: Override trim values disabled."]
48 DISABLED = 0,
49 #[doc = "1: Override trim values enabled."]
50 ENABLED = 1,
51}
52impl From<ENABLE_A> for bool {
53 #[inline(always)]
54 fn from(variant: ENABLE_A) -> Self {
55 variant as u8 != 0
56 }
57}
58impl ENABLE_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> ENABLE_A {
62 match self.bits {
63 false => ENABLE_A::DISABLED,
64 true => ENABLE_A::ENABLED,
65 }
66 }
67 #[doc = "Checks if the value of the field is `DISABLED`"]
68 #[inline(always)]
69 pub fn is_disabled(&self) -> bool {
70 *self == ENABLE_A::DISABLED
71 }
72 #[doc = "Checks if the value of the field is `ENABLED`"]
73 #[inline(always)]
74 pub fn is_enabled(&self) -> bool {
75 *self == ENABLE_A::ENABLED
76 }
77}
78#[doc = "Field `ENABLE` writer - Enable or disable override of default trim values."]
79pub type ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, OVERRIDE4_SPEC, ENABLE_A, O>;
80impl<'a, const O: u8> ENABLE_W<'a, O> {
81 #[doc = "Override trim values disabled."]
82 #[inline(always)]
83 pub fn disabled(self) -> &'a mut W {
84 self.variant(ENABLE_A::DISABLED)
85 }
86 #[doc = "Override trim values enabled."]
87 #[inline(always)]
88 pub fn enabled(self) -> &'a mut W {
89 self.variant(ENABLE_A::ENABLED)
90 }
91}
92impl R {
93 #[doc = "Bits 0:27 - Trim value override 4."]
94 #[inline(always)]
95 pub fn override4(&self) -> OVERRIDE4_R {
96 OVERRIDE4_R::new((self.bits & 0x0fff_ffff) as u32)
97 }
98 #[doc = "Bit 31 - Enable or disable override of default trim values."]
99 #[inline(always)]
100 pub fn enable(&self) -> ENABLE_R {
101 ENABLE_R::new(((self.bits >> 31) & 1) != 0)
102 }
103}
104impl W {
105 #[doc = "Bits 0:27 - Trim value override 4."]
106 #[inline(always)]
107 pub fn override4(&mut self) -> OVERRIDE4_W<0> {
108 OVERRIDE4_W::new(self)
109 }
110 #[doc = "Bit 31 - Enable or disable override of default trim values."]
111 #[inline(always)]
112 pub fn enable(&mut self) -> ENABLE_W<31> {
113 ENABLE_W::new(self)
114 }
115 #[doc = "Writes raw bits to the register."]
116 #[inline(always)]
117 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
118 self.0.bits(bits);
119 self
120 }
121}
122#[doc = "Trim value override register 4.\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 [override4](index.html) module"]
123pub struct OVERRIDE4_SPEC;
124impl crate::RegisterSpec for OVERRIDE4_SPEC {
125 type Ux = u32;
126}
127#[doc = "`read()` method returns [override4::R](R) reader structure"]
128impl crate::Readable for OVERRIDE4_SPEC {
129 type Reader = R;
130}
131#[doc = "`write(|w| ..)` method takes [override4::W](W) writer structure"]
132impl crate::Writable for OVERRIDE4_SPEC {
133 type Writer = W;
134}
135#[doc = "`reset()` method sets OVERRIDE4 to value 0"]
136impl crate::Resettable for OVERRIDE4_SPEC {
137 #[inline(always)]
138 fn reset_value() -> Self::Ux {
139 0
140 }
141}