cc2538/rfcore_xreg/
freqctrl.rs1#[doc = "Reader of register FREQCTRL"]
2pub type R = crate::R<u32, super::FREQCTRL>;
3#[doc = "Writer for register FREQCTRL"]
4pub type W = crate::W<u32, super::FREQCTRL>;
5#[doc = "Register FREQCTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::FREQCTRL {
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 `FREQ`"]
52pub type FREQ_R = crate::R<u8, u8>;
53#[doc = "Write proxy for field `FREQ`"]
54pub struct FREQ_W<'a> {
55 w: &'a mut W,
56}
57impl<'a> FREQ_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 & !0x7f) | ((value as u32) & 0x7f);
62 self.w
63 }
64}
65impl R {
66 #[doc = "Bits 8:31 - 31:8\\] This register is 8 bits in a 32-bit address space."]
67 #[inline(always)]
68 pub fn reserved32(&self) -> RESERVED32_R {
69 RESERVED32_R::new(((self.bits >> 8) & 0x00ff_ffff) as u32)
70 }
71 #[doc = "Bit 7 - 7:7\\] Reserved. Always read 0."]
72 #[inline(always)]
73 pub fn reserved8(&self) -> RESERVED8_R {
74 RESERVED8_R::new(((self.bits >> 7) & 0x01) != 0)
75 }
76 #[doc = "Bits 0:6 - 6:0\\] Frequency control word The frequency word in FREQ\\[6:0\\] is an offset value from 2394 (fRF = FREQ\\[6 0\\] + 2394). The RF-frequency is specified from 2405 to 2480 MHz in 1-MHz steps; hence, the only valid settings for FREQ\\[6:0\\] are 11 to 86 (11 + 2394 = 2405 and 86 + 2394 = 2480). The device supports the frequency range from 2394 to 2507 MHz. Consequently, the usable settings for FREQ\\[6:0\\] are 0 to 113. Settings outside of the usable range (114 to 127) give a frequency of 2507 MHz. IEEE 802.15.4-2006 specifies a frequency range from 2405 MHz to 2480 MHz with 16 channels 5 MHz apart. The channels are numbered 11 through 26. For an IEEE 802.15.4-2006 compliant system, the only valid settings are thus FREQ\\[6:0\\] = 11 + 5 (channel number - 11)."]
77 #[inline(always)]
78 pub fn freq(&self) -> FREQ_R {
79 FREQ_R::new((self.bits & 0x7f) as u8)
80 }
81}
82impl W {
83 #[doc = "Bits 8:31 - 31:8\\] This register is 8 bits in a 32-bit address space."]
84 #[inline(always)]
85 pub fn reserved32(&mut self) -> RESERVED32_W {
86 RESERVED32_W { w: self }
87 }
88 #[doc = "Bit 7 - 7:7\\] Reserved. Always read 0."]
89 #[inline(always)]
90 pub fn reserved8(&mut self) -> RESERVED8_W {
91 RESERVED8_W { w: self }
92 }
93 #[doc = "Bits 0:6 - 6:0\\] Frequency control word The frequency word in FREQ\\[6:0\\] is an offset value from 2394 (fRF = FREQ\\[6 0\\] + 2394). The RF-frequency is specified from 2405 to 2480 MHz in 1-MHz steps; hence, the only valid settings for FREQ\\[6:0\\] are 11 to 86 (11 + 2394 = 2405 and 86 + 2394 = 2480). The device supports the frequency range from 2394 to 2507 MHz. Consequently, the usable settings for FREQ\\[6:0\\] are 0 to 113. Settings outside of the usable range (114 to 127) give a frequency of 2507 MHz. IEEE 802.15.4-2006 specifies a frequency range from 2405 MHz to 2480 MHz with 16 channels 5 MHz apart. The channels are numbered 11 through 26. For an IEEE 802.15.4-2006 compliant system, the only valid settings are thus FREQ\\[6:0\\] = 11 + 5 (channel number - 11)."]
94 #[inline(always)]
95 pub fn freq(&mut self) -> FREQ_W {
96 FREQ_W { w: self }
97 }
98}