atsam4e16c_pac/rtc/
timalr.rs

1#[doc = "Register `TIMALR` reader"]
2pub struct R(crate::R<TIMALR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TIMALR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TIMALR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TIMALR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TIMALR` writer"]
17pub struct W(crate::W<TIMALR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TIMALR_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<TIMALR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TIMALR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SEC` reader - Second Alarm"]
38pub type SEC_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `SEC` writer - Second Alarm"]
40pub type SEC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, TIMALR_SPEC, u8, u8, 7, O>;
41#[doc = "Field `SECEN` reader - Second Alarm Enable"]
42pub type SECEN_R = crate::BitReader<bool>;
43#[doc = "Field `SECEN` writer - Second Alarm Enable"]
44pub type SECEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, TIMALR_SPEC, bool, O>;
45#[doc = "Field `MIN` reader - Minute Alarm"]
46pub type MIN_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `MIN` writer - Minute Alarm"]
48pub type MIN_W<'a, const O: u8> = crate::FieldWriter<'a, u32, TIMALR_SPEC, u8, u8, 7, O>;
49#[doc = "Field `MINEN` reader - Minute Alarm Enable"]
50pub type MINEN_R = crate::BitReader<bool>;
51#[doc = "Field `MINEN` writer - Minute Alarm Enable"]
52pub type MINEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, TIMALR_SPEC, bool, O>;
53#[doc = "Field `HOUR` reader - Hour Alarm"]
54pub type HOUR_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `HOUR` writer - Hour Alarm"]
56pub type HOUR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, TIMALR_SPEC, u8, u8, 6, O>;
57#[doc = "Field `AMPM` reader - AM/PM Indicator"]
58pub type AMPM_R = crate::BitReader<bool>;
59#[doc = "Field `AMPM` writer - AM/PM Indicator"]
60pub type AMPM_W<'a, const O: u8> = crate::BitWriter<'a, u32, TIMALR_SPEC, bool, O>;
61#[doc = "Field `HOUREN` reader - Hour Alarm Enable"]
62pub type HOUREN_R = crate::BitReader<bool>;
63#[doc = "Field `HOUREN` writer - Hour Alarm Enable"]
64pub type HOUREN_W<'a, const O: u8> = crate::BitWriter<'a, u32, TIMALR_SPEC, bool, O>;
65impl R {
66    #[doc = "Bits 0:6 - Second Alarm"]
67    #[inline(always)]
68    pub fn sec(&self) -> SEC_R {
69        SEC_R::new((self.bits & 0x7f) as u8)
70    }
71    #[doc = "Bit 7 - Second Alarm Enable"]
72    #[inline(always)]
73    pub fn secen(&self) -> SECEN_R {
74        SECEN_R::new(((self.bits >> 7) & 1) != 0)
75    }
76    #[doc = "Bits 8:14 - Minute Alarm"]
77    #[inline(always)]
78    pub fn min(&self) -> MIN_R {
79        MIN_R::new(((self.bits >> 8) & 0x7f) as u8)
80    }
81    #[doc = "Bit 15 - Minute Alarm Enable"]
82    #[inline(always)]
83    pub fn minen(&self) -> MINEN_R {
84        MINEN_R::new(((self.bits >> 15) & 1) != 0)
85    }
86    #[doc = "Bits 16:21 - Hour Alarm"]
87    #[inline(always)]
88    pub fn hour(&self) -> HOUR_R {
89        HOUR_R::new(((self.bits >> 16) & 0x3f) as u8)
90    }
91    #[doc = "Bit 22 - AM/PM Indicator"]
92    #[inline(always)]
93    pub fn ampm(&self) -> AMPM_R {
94        AMPM_R::new(((self.bits >> 22) & 1) != 0)
95    }
96    #[doc = "Bit 23 - Hour Alarm Enable"]
97    #[inline(always)]
98    pub fn houren(&self) -> HOUREN_R {
99        HOUREN_R::new(((self.bits >> 23) & 1) != 0)
100    }
101}
102impl W {
103    #[doc = "Bits 0:6 - Second Alarm"]
104    #[inline(always)]
105    #[must_use]
106    pub fn sec(&mut self) -> SEC_W<0> {
107        SEC_W::new(self)
108    }
109    #[doc = "Bit 7 - Second Alarm Enable"]
110    #[inline(always)]
111    #[must_use]
112    pub fn secen(&mut self) -> SECEN_W<7> {
113        SECEN_W::new(self)
114    }
115    #[doc = "Bits 8:14 - Minute Alarm"]
116    #[inline(always)]
117    #[must_use]
118    pub fn min(&mut self) -> MIN_W<8> {
119        MIN_W::new(self)
120    }
121    #[doc = "Bit 15 - Minute Alarm Enable"]
122    #[inline(always)]
123    #[must_use]
124    pub fn minen(&mut self) -> MINEN_W<15> {
125        MINEN_W::new(self)
126    }
127    #[doc = "Bits 16:21 - Hour Alarm"]
128    #[inline(always)]
129    #[must_use]
130    pub fn hour(&mut self) -> HOUR_W<16> {
131        HOUR_W::new(self)
132    }
133    #[doc = "Bit 22 - AM/PM Indicator"]
134    #[inline(always)]
135    #[must_use]
136    pub fn ampm(&mut self) -> AMPM_W<22> {
137        AMPM_W::new(self)
138    }
139    #[doc = "Bit 23 - Hour Alarm Enable"]
140    #[inline(always)]
141    #[must_use]
142    pub fn houren(&mut self) -> HOUREN_W<23> {
143        HOUREN_W::new(self)
144    }
145    #[doc = "Writes raw bits to the register."]
146    #[inline(always)]
147    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
148        self.0.bits(bits);
149        self
150    }
151}
152#[doc = "Time 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 [timalr](index.html) module"]
153pub struct TIMALR_SPEC;
154impl crate::RegisterSpec for TIMALR_SPEC {
155    type Ux = u32;
156}
157#[doc = "`read()` method returns [timalr::R](R) reader structure"]
158impl crate::Readable for TIMALR_SPEC {
159    type Reader = R;
160}
161#[doc = "`write(|w| ..)` method takes [timalr::W](W) writer structure"]
162impl crate::Writable for TIMALR_SPEC {
163    type Writer = W;
164    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
165    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
166}
167#[doc = "`reset()` method sets TIMALR to value 0"]
168impl crate::Resettable for TIMALR_SPEC {
169    const RESET_VALUE: Self::Ux = 0;
170}