ra4w1/rtc/
rhrar.rs

1#[doc = "Register `RHRAR` reader"]
2pub struct R(crate::R<RHRAR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RHRAR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RHRAR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RHRAR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `RHRAR` writer"]
17pub struct W(crate::W<RHRAR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<RHRAR_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<RHRAR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<RHRAR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `HR1` reader - 1-Hour Count Value for the ones place of hours"]
38pub type HR1_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `HR1` writer - 1-Hour Count Value for the ones place of hours"]
40pub type HR1_W<'a, const O: u8> = crate::FieldWriter<'a, u8, RHRAR_SPEC, u8, u8, 4, O>;
41#[doc = "Field `HR10` reader - 10-Hour Count Value for the tens place of hours"]
42pub type HR10_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `HR10` writer - 10-Hour Count Value for the tens place of hours"]
44pub type HR10_W<'a, const O: u8> = crate::FieldWriter<'a, u8, RHRAR_SPEC, u8, u8, 2, O>;
45#[doc = "Field `PM` reader - Time Counter Setting for a.m./p.m."]
46pub type PM_R = crate::BitReader<PM_A>;
47#[doc = "Time Counter Setting for a.m./p.m.\n\nValue on reset: 0"]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49pub enum PM_A {
50    #[doc = "0: a.m."]
51    _0 = 0,
52    #[doc = "1: p.m."]
53    _1 = 1,
54}
55impl From<PM_A> for bool {
56    #[inline(always)]
57    fn from(variant: PM_A) -> Self {
58        variant as u8 != 0
59    }
60}
61impl PM_R {
62    #[doc = "Get enumerated values variant"]
63    #[inline(always)]
64    pub fn variant(&self) -> PM_A {
65        match self.bits {
66            false => PM_A::_0,
67            true => PM_A::_1,
68        }
69    }
70    #[doc = "Checks if the value of the field is `_0`"]
71    #[inline(always)]
72    pub fn is_0(&self) -> bool {
73        *self == PM_A::_0
74    }
75    #[doc = "Checks if the value of the field is `_1`"]
76    #[inline(always)]
77    pub fn is_1(&self) -> bool {
78        *self == PM_A::_1
79    }
80}
81#[doc = "Field `PM` writer - Time Counter Setting for a.m./p.m."]
82pub type PM_W<'a, const O: u8> = crate::BitWriter<'a, u8, RHRAR_SPEC, PM_A, O>;
83impl<'a, const O: u8> PM_W<'a, O> {
84    #[doc = "a.m."]
85    #[inline(always)]
86    pub fn _0(self) -> &'a mut W {
87        self.variant(PM_A::_0)
88    }
89    #[doc = "p.m."]
90    #[inline(always)]
91    pub fn _1(self) -> &'a mut W {
92        self.variant(PM_A::_1)
93    }
94}
95#[doc = "Field `ENB` reader - Compare enable"]
96pub type ENB_R = crate::BitReader<ENB_A>;
97#[doc = "Compare enable\n\nValue on reset: 0"]
98#[derive(Clone, Copy, Debug, PartialEq, Eq)]
99pub enum ENB_A {
100    #[doc = "0: The register value is not compared with the RHRCNT counter value."]
101    _0 = 0,
102    #[doc = "1: The register value is compared with the RHRCNT counter value."]
103    _1 = 1,
104}
105impl From<ENB_A> for bool {
106    #[inline(always)]
107    fn from(variant: ENB_A) -> Self {
108        variant as u8 != 0
109    }
110}
111impl ENB_R {
112    #[doc = "Get enumerated values variant"]
113    #[inline(always)]
114    pub fn variant(&self) -> ENB_A {
115        match self.bits {
116            false => ENB_A::_0,
117            true => ENB_A::_1,
118        }
119    }
120    #[doc = "Checks if the value of the field is `_0`"]
121    #[inline(always)]
122    pub fn is_0(&self) -> bool {
123        *self == ENB_A::_0
124    }
125    #[doc = "Checks if the value of the field is `_1`"]
126    #[inline(always)]
127    pub fn is_1(&self) -> bool {
128        *self == ENB_A::_1
129    }
130}
131#[doc = "Field `ENB` writer - Compare enable"]
132pub type ENB_W<'a, const O: u8> = crate::BitWriter<'a, u8, RHRAR_SPEC, ENB_A, O>;
133impl<'a, const O: u8> ENB_W<'a, O> {
134    #[doc = "The register value is not compared with the RHRCNT counter value."]
135    #[inline(always)]
136    pub fn _0(self) -> &'a mut W {
137        self.variant(ENB_A::_0)
138    }
139    #[doc = "The register value is compared with the RHRCNT counter value."]
140    #[inline(always)]
141    pub fn _1(self) -> &'a mut W {
142        self.variant(ENB_A::_1)
143    }
144}
145impl R {
146    #[doc = "Bits 0:3 - 1-Hour Count Value for the ones place of hours"]
147    #[inline(always)]
148    pub fn hr1(&self) -> HR1_R {
149        HR1_R::new(self.bits & 0x0f)
150    }
151    #[doc = "Bits 4:5 - 10-Hour Count Value for the tens place of hours"]
152    #[inline(always)]
153    pub fn hr10(&self) -> HR10_R {
154        HR10_R::new((self.bits >> 4) & 3)
155    }
156    #[doc = "Bit 6 - Time Counter Setting for a.m./p.m."]
157    #[inline(always)]
158    pub fn pm(&self) -> PM_R {
159        PM_R::new(((self.bits >> 6) & 1) != 0)
160    }
161    #[doc = "Bit 7 - Compare enable"]
162    #[inline(always)]
163    pub fn enb(&self) -> ENB_R {
164        ENB_R::new(((self.bits >> 7) & 1) != 0)
165    }
166}
167impl W {
168    #[doc = "Bits 0:3 - 1-Hour Count Value for the ones place of hours"]
169    #[inline(always)]
170    #[must_use]
171    pub fn hr1(&mut self) -> HR1_W<0> {
172        HR1_W::new(self)
173    }
174    #[doc = "Bits 4:5 - 10-Hour Count Value for the tens place of hours"]
175    #[inline(always)]
176    #[must_use]
177    pub fn hr10(&mut self) -> HR10_W<4> {
178        HR10_W::new(self)
179    }
180    #[doc = "Bit 6 - Time Counter Setting for a.m./p.m."]
181    #[inline(always)]
182    #[must_use]
183    pub fn pm(&mut self) -> PM_W<6> {
184        PM_W::new(self)
185    }
186    #[doc = "Bit 7 - Compare enable"]
187    #[inline(always)]
188    #[must_use]
189    pub fn enb(&mut self) -> ENB_W<7> {
190        ENB_W::new(self)
191    }
192    #[doc = "Writes raw bits to the register."]
193    #[inline(always)]
194    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
195        self.0.bits(bits);
196        self
197    }
198}
199#[doc = "Hour Alarm Register\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 [rhrar](index.html) module"]
200pub struct RHRAR_SPEC;
201impl crate::RegisterSpec for RHRAR_SPEC {
202    type Ux = u8;
203}
204#[doc = "`read()` method returns [rhrar::R](R) reader structure"]
205impl crate::Readable for RHRAR_SPEC {
206    type Reader = R;
207}
208#[doc = "`write(|w| ..)` method takes [rhrar::W](W) writer structure"]
209impl crate::Writable for RHRAR_SPEC {
210    type Writer = W;
211    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
212    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
213}
214#[doc = "`reset()` method sets RHRAR to value 0"]
215impl crate::Resettable for RHRAR_SPEC {
216    const RESET_VALUE: Self::Ux = 0;
217}