cc2538/sttest/
gpt.rs

1#[doc = "Reader of register GPT"]
2pub type R = crate::R<u32, super::GPT>;
3#[doc = "Writer for register GPT"]
4pub type W = crate::W<u32, super::GPT>;
5#[doc = "Register GPT `reset()`'s with value 0"]
6impl crate::ResetValue for super::GPT {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `Reserved1`"]
14pub type RESERVED1_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `Reserved1`"]
16pub struct RESERVED1_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> RESERVED1_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 & !(0x007f_ffff << 9)) | (((value as u32) & 0x007f_ffff) << 9);
24        self.w
25    }
26}
27#[doc = "Reader of field `GPTIDOE`"]
28pub type GPTIDOE_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `GPTIDOE`"]
30pub struct GPTIDOE_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> GPTIDOE_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 << 8)) | (((value as u32) & 0x01) << 8);
48        self.w
49    }
50}
51#[doc = "Reader of field `Reserved2`"]
52pub type RESERVED2_R = crate::R<u8, u8>;
53#[doc = "Write proxy for field `Reserved2`"]
54pub struct RESERVED2_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> RESERVED2_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 & !(0x07 << 5)) | (((value as u32) & 0x07) << 5);
62        self.w
63    }
64}
65#[doc = "Reader of field `GPTIDOV`"]
66pub type GPTIDOV_R = crate::R<u8, u8>;
67#[doc = "Write proxy for field `GPTIDOV`"]
68pub struct GPTIDOV_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> GPTIDOV_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 & !0x1f) | ((value as u32) & 0x1f);
76        self.w
77    }
78}
79impl R {
80    #[doc = "Bits 9:31 - 31:9\\] Reserved"]
81    #[inline(always)]
82    pub fn reserved1(&self) -> RESERVED1_R {
83        RESERVED1_R::new(((self.bits >> 9) & 0x007f_ffff) as u32)
84    }
85    #[doc = "Bit 8 - 8:8\\] GPTimer increment/decrement override enable"]
86    #[inline(always)]
87    pub fn gptidoe(&self) -> GPTIDOE_R {
88        GPTIDOE_R::new(((self.bits >> 8) & 0x01) != 0)
89    }
90    #[doc = "Bits 5:7 - 7:5\\] Reserved"]
91    #[inline(always)]
92    pub fn reserved2(&self) -> RESERVED2_R {
93        RESERVED2_R::new(((self.bits >> 5) & 0x07) as u8)
94    }
95    #[doc = "Bits 0:4 - 4:0\\] GPTimer increment/decrement override value"]
96    #[inline(always)]
97    pub fn gptidov(&self) -> GPTIDOV_R {
98        GPTIDOV_R::new((self.bits & 0x1f) as u8)
99    }
100}
101impl W {
102    #[doc = "Bits 9:31 - 31:9\\] Reserved"]
103    #[inline(always)]
104    pub fn reserved1(&mut self) -> RESERVED1_W {
105        RESERVED1_W { w: self }
106    }
107    #[doc = "Bit 8 - 8:8\\] GPTimer increment/decrement override enable"]
108    #[inline(always)]
109    pub fn gptidoe(&mut self) -> GPTIDOE_W {
110        GPTIDOE_W { w: self }
111    }
112    #[doc = "Bits 5:7 - 7:5\\] Reserved"]
113    #[inline(always)]
114    pub fn reserved2(&mut self) -> RESERVED2_W {
115        RESERVED2_W { w: self }
116    }
117    #[doc = "Bits 0:4 - 4:0\\] GPTimer increment/decrement override value"]
118    #[inline(always)]
119    pub fn gptidov(&mut self) -> GPTIDOV_W {
120        GPTIDOV_W { w: self }
121    }
122}