atsamd51p/rtc/mode2/
mask1.rs
1#[doc = "Register `MASK1` reader"]
2pub type R = crate::R<Mask1Spec>;
3#[doc = "Register `MASK1` writer"]
4pub type W = crate::W<Mask1Spec>;
5#[doc = "Alarm Mask Selection\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Selselect {
9 #[doc = "0: Alarm Disabled"]
10 Off = 0,
11 #[doc = "1: Match seconds only"]
12 Ss = 1,
13 #[doc = "2: Match seconds and minutes only"]
14 Mmss = 2,
15 #[doc = "3: Match seconds, minutes, and hours only"]
16 Hhmmss = 3,
17 #[doc = "4: Match seconds, minutes, hours, and days only"]
18 Ddhhmmss = 4,
19 #[doc = "5: Match seconds, minutes, hours, days, and months only"]
20 Mmddhhmmss = 5,
21 #[doc = "6: Match seconds, minutes, hours, days, months, and years"]
22 Yymmddhhmmss = 6,
23}
24impl From<Selselect> for u8 {
25 #[inline(always)]
26 fn from(variant: Selselect) -> Self {
27 variant as _
28 }
29}
30impl crate::FieldSpec for Selselect {
31 type Ux = u8;
32}
33impl crate::IsEnum for Selselect {}
34#[doc = "Field `SEL` reader - Alarm Mask Selection"]
35pub type SelR = crate::FieldReader<Selselect>;
36impl SelR {
37 #[doc = "Get enumerated values variant"]
38 #[inline(always)]
39 pub const fn variant(&self) -> Option<Selselect> {
40 match self.bits {
41 0 => Some(Selselect::Off),
42 1 => Some(Selselect::Ss),
43 2 => Some(Selselect::Mmss),
44 3 => Some(Selselect::Hhmmss),
45 4 => Some(Selselect::Ddhhmmss),
46 5 => Some(Selselect::Mmddhhmmss),
47 6 => Some(Selselect::Yymmddhhmmss),
48 _ => None,
49 }
50 }
51 #[doc = "Alarm Disabled"]
52 #[inline(always)]
53 pub fn is_off(&self) -> bool {
54 *self == Selselect::Off
55 }
56 #[doc = "Match seconds only"]
57 #[inline(always)]
58 pub fn is_ss(&self) -> bool {
59 *self == Selselect::Ss
60 }
61 #[doc = "Match seconds and minutes only"]
62 #[inline(always)]
63 pub fn is_mmss(&self) -> bool {
64 *self == Selselect::Mmss
65 }
66 #[doc = "Match seconds, minutes, and hours only"]
67 #[inline(always)]
68 pub fn is_hhmmss(&self) -> bool {
69 *self == Selselect::Hhmmss
70 }
71 #[doc = "Match seconds, minutes, hours, and days only"]
72 #[inline(always)]
73 pub fn is_ddhhmmss(&self) -> bool {
74 *self == Selselect::Ddhhmmss
75 }
76 #[doc = "Match seconds, minutes, hours, days, and months only"]
77 #[inline(always)]
78 pub fn is_mmddhhmmss(&self) -> bool {
79 *self == Selselect::Mmddhhmmss
80 }
81 #[doc = "Match seconds, minutes, hours, days, months, and years"]
82 #[inline(always)]
83 pub fn is_yymmddhhmmss(&self) -> bool {
84 *self == Selselect::Yymmddhhmmss
85 }
86}
87#[doc = "Field `SEL` writer - Alarm Mask Selection"]
88pub type SelW<'a, REG> = crate::FieldWriter<'a, REG, 3, Selselect>;
89impl<'a, REG> SelW<'a, REG>
90where
91 REG: crate::Writable + crate::RegisterSpec,
92 REG::Ux: From<u8>,
93{
94 #[doc = "Alarm Disabled"]
95 #[inline(always)]
96 pub fn off(self) -> &'a mut crate::W<REG> {
97 self.variant(Selselect::Off)
98 }
99 #[doc = "Match seconds only"]
100 #[inline(always)]
101 pub fn ss(self) -> &'a mut crate::W<REG> {
102 self.variant(Selselect::Ss)
103 }
104 #[doc = "Match seconds and minutes only"]
105 #[inline(always)]
106 pub fn mmss(self) -> &'a mut crate::W<REG> {
107 self.variant(Selselect::Mmss)
108 }
109 #[doc = "Match seconds, minutes, and hours only"]
110 #[inline(always)]
111 pub fn hhmmss(self) -> &'a mut crate::W<REG> {
112 self.variant(Selselect::Hhmmss)
113 }
114 #[doc = "Match seconds, minutes, hours, and days only"]
115 #[inline(always)]
116 pub fn ddhhmmss(self) -> &'a mut crate::W<REG> {
117 self.variant(Selselect::Ddhhmmss)
118 }
119 #[doc = "Match seconds, minutes, hours, days, and months only"]
120 #[inline(always)]
121 pub fn mmddhhmmss(self) -> &'a mut crate::W<REG> {
122 self.variant(Selselect::Mmddhhmmss)
123 }
124 #[doc = "Match seconds, minutes, hours, days, months, and years"]
125 #[inline(always)]
126 pub fn yymmddhhmmss(self) -> &'a mut crate::W<REG> {
127 self.variant(Selselect::Yymmddhhmmss)
128 }
129}
130impl R {
131 #[doc = "Bits 0:2 - Alarm Mask Selection"]
132 #[inline(always)]
133 pub fn sel(&self) -> SelR {
134 SelR::new(self.bits & 7)
135 }
136}
137impl W {
138 #[doc = "Bits 0:2 - Alarm Mask Selection"]
139 #[inline(always)]
140 #[must_use]
141 pub fn sel(&mut self) -> SelW<Mask1Spec> {
142 SelW::new(self, 0)
143 }
144}
145#[doc = "MODE2_ALARM Alarm n Mask\n\nYou can [`read`](crate::Reg::read) this register and get [`mask1::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mask1::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
146pub struct Mask1Spec;
147impl crate::RegisterSpec for Mask1Spec {
148 type Ux = u8;
149}
150#[doc = "`read()` method returns [`mask1::R`](R) reader structure"]
151impl crate::Readable for Mask1Spec {}
152#[doc = "`write(|w| ..)` method takes [`mask1::W`](W) writer structure"]
153impl crate::Writable for Mask1Spec {
154 type Safety = crate::Unsafe;
155 const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
156 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
157}
158#[doc = "`reset()` method sets MASK1 to value 0"]
159impl crate::Resettable for Mask1Spec {
160 const RESET_VALUE: u8 = 0;
161}