cc2538/rfcore_xreg/
agcctrl3.rs

1#[doc = "Reader of register AGCCTRL3"]
2pub type R = crate::R<u32, super::AGCCTRL3>;
3#[doc = "Writer for register AGCCTRL3"]
4pub type W = crate::W<u32, super::AGCCTRL3>;
5#[doc = "Register AGCCTRL3 `reset()`'s with value 0"]
6impl crate::ResetValue for super::AGCCTRL3 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `Reserved32`"]
14pub type RESERVED32_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `Reserved32`"]
16pub struct RESERVED32_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> RESERVED32_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u32) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x00ff_ffff << 8)) | (((value as u32) & 0x00ff_ffff) << 8);
24        self.w
25    }
26}
27#[doc = "Reader of field `Reserved8`"]
28pub type RESERVED8_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `Reserved8`"]
30pub struct RESERVED8_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> RESERVED8_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
48        self.w
49    }
50}
51#[doc = "Reader of field `AGC_SETTLE_WAIT`"]
52pub type AGC_SETTLE_WAIT_R = crate::R<u8, u8>;
53#[doc = "Write proxy for field `AGC_SETTLE_WAIT`"]
54pub struct AGC_SETTLE_WAIT_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> AGC_SETTLE_WAIT_W<'a> {
58    #[doc = r"Writes raw bits to the field"]
59    #[inline(always)]
60    pub unsafe fn bits(self, value: u8) -> &'a mut W {
61        self.w.bits = (self.w.bits & !(0x03 << 5)) | (((value as u32) & 0x03) << 5);
62        self.w
63    }
64}
65#[doc = "Reader of field `AGC_WIN_SIZE`"]
66pub type AGC_WIN_SIZE_R = crate::R<u8, u8>;
67#[doc = "Write proxy for field `AGC_WIN_SIZE`"]
68pub struct AGC_WIN_SIZE_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> AGC_WIN_SIZE_W<'a> {
72    #[doc = r"Writes raw bits to the field"]
73    #[inline(always)]
74    pub unsafe fn bits(self, value: u8) -> &'a mut W {
75        self.w.bits = (self.w.bits & !(0x03 << 3)) | (((value as u32) & 0x03) << 3);
76        self.w
77    }
78}
79#[doc = "Reader of field `AAF_RP`"]
80pub type AAF_RP_R = crate::R<u8, u8>;
81#[doc = "Write proxy for field `AAF_RP`"]
82pub struct AAF_RP_W<'a> {
83    w: &'a mut W,
84}
85impl<'a> AAF_RP_W<'a> {
86    #[doc = r"Writes raw bits to the field"]
87    #[inline(always)]
88    pub unsafe fn bits(self, value: u8) -> &'a mut W {
89        self.w.bits = (self.w.bits & !(0x03 << 1)) | (((value as u32) & 0x03) << 1);
90        self.w
91    }
92}
93#[doc = "Reader of field `AAF_RP_OE`"]
94pub type AAF_RP_OE_R = crate::R<bool, bool>;
95#[doc = "Write proxy for field `AAF_RP_OE`"]
96pub struct AAF_RP_OE_W<'a> {
97    w: &'a mut W,
98}
99impl<'a> AAF_RP_OE_W<'a> {
100    #[doc = r"Sets the field bit"]
101    #[inline(always)]
102    pub fn set_bit(self) -> &'a mut W {
103        self.bit(true)
104    }
105    #[doc = r"Clears the field bit"]
106    #[inline(always)]
107    pub fn clear_bit(self) -> &'a mut W {
108        self.bit(false)
109    }
110    #[doc = r"Writes raw bits to the field"]
111    #[inline(always)]
112    pub fn bit(self, value: bool) -> &'a mut W {
113        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
114        self.w
115    }
116}
117impl R {
118    #[doc = "Bits 8:31 - 31:8\\] This register is 8 bits in a 32-bit address space."]
119    #[inline(always)]
120    pub fn reserved32(&self) -> RESERVED32_R {
121        RESERVED32_R::new(((self.bits >> 8) & 0x00ff_ffff) as u32)
122    }
123    #[doc = "Bit 7 - 7:7\\] Reserved. Always read 0."]
124    #[inline(always)]
125    pub fn reserved8(&self) -> RESERVED8_R {
126        RESERVED8_R::new(((self.bits >> 7) & 0x01) != 0)
127    }
128    #[doc = "Bits 5:6 - 6:5\\] Timing for AGC to wait for analog gain to settle after a gain change. During this period, the energy measurement in the AGC is paused. 00: 15 periods 01: 20 periods 10: 25 periods 11: 30 periods"]
129    #[inline(always)]
130    pub fn agc_settle_wait(&self) -> AGC_SETTLE_WAIT_R {
131        AGC_SETTLE_WAIT_R::new(((self.bits >> 5) & 0x03) as u8)
132    }
133    #[doc = "Bits 3:4 - 4:3\\] Window size for the accumulate-and-dump function in the AGC. 00: 16 samples 01: 32 samples 10: 64 samples 11: 128 samples"]
134    #[inline(always)]
135    pub fn agc_win_size(&self) -> AGC_WIN_SIZE_R {
136        AGC_WIN_SIZE_R::new(((self.bits >> 3) & 0x03) as u8)
137    }
138    #[doc = "Bits 1:2 - 2:1\\] Overrides the control signals of the AGC to AAF when AAF_RP_OE = 1. When read, it returns the applied signal to the AAF. 00: 9-dB attenuation in AAF 01: 6-dB attenuation in AAF 10: 3-dB attenuation in AAF 11: 0-dB attenuation in AAF (reference level)"]
139    #[inline(always)]
140    pub fn aaf_rp(&self) -> AAF_RP_R {
141        AAF_RP_R::new(((self.bits >> 1) & 0x03) as u8)
142    }
143    #[doc = "Bit 0 - 0:0\\] Override the AAF control signals of the AGC with the values stored in AAF_RP."]
144    #[inline(always)]
145    pub fn aaf_rp_oe(&self) -> AAF_RP_OE_R {
146        AAF_RP_OE_R::new((self.bits & 0x01) != 0)
147    }
148}
149impl W {
150    #[doc = "Bits 8:31 - 31:8\\] This register is 8 bits in a 32-bit address space."]
151    #[inline(always)]
152    pub fn reserved32(&mut self) -> RESERVED32_W {
153        RESERVED32_W { w: self }
154    }
155    #[doc = "Bit 7 - 7:7\\] Reserved. Always read 0."]
156    #[inline(always)]
157    pub fn reserved8(&mut self) -> RESERVED8_W {
158        RESERVED8_W { w: self }
159    }
160    #[doc = "Bits 5:6 - 6:5\\] Timing for AGC to wait for analog gain to settle after a gain change. During this period, the energy measurement in the AGC is paused. 00: 15 periods 01: 20 periods 10: 25 periods 11: 30 periods"]
161    #[inline(always)]
162    pub fn agc_settle_wait(&mut self) -> AGC_SETTLE_WAIT_W {
163        AGC_SETTLE_WAIT_W { w: self }
164    }
165    #[doc = "Bits 3:4 - 4:3\\] Window size for the accumulate-and-dump function in the AGC. 00: 16 samples 01: 32 samples 10: 64 samples 11: 128 samples"]
166    #[inline(always)]
167    pub fn agc_win_size(&mut self) -> AGC_WIN_SIZE_W {
168        AGC_WIN_SIZE_W { w: self }
169    }
170    #[doc = "Bits 1:2 - 2:1\\] Overrides the control signals of the AGC to AAF when AAF_RP_OE = 1. When read, it returns the applied signal to the AAF. 00: 9-dB attenuation in AAF 01: 6-dB attenuation in AAF 10: 3-dB attenuation in AAF 11: 0-dB attenuation in AAF (reference level)"]
171    #[inline(always)]
172    pub fn aaf_rp(&mut self) -> AAF_RP_W {
173        AAF_RP_W { w: self }
174    }
175    #[doc = "Bit 0 - 0:0\\] Override the AAF control signals of the AGC with the values stored in AAF_RP."]
176    #[inline(always)]
177    pub fn aaf_rp_oe(&mut self) -> AAF_RP_OE_W {
178        AAF_RP_OE_W { w: self }
179    }
180}