1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
#[doc = "Reader of register CLOCK"] pub type R = crate::R<u32, super::CLOCK>; #[doc = "Writer for register CLOCK"] pub type W = crate::W<u32, super::CLOCK>; #[doc = "Register CLOCK `reset()`'s with value 0"] impl crate::ResetValue for super::CLOCK { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `SECOND`"] pub type SECOND_R = crate::R<u8, u8>; #[doc = "Write proxy for field `SECOND`"] pub struct SECOND_W<'a> { w: &'a mut W, } impl<'a> SECOND_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0x3f) | ((value as u32) & 0x3f); self.w } } #[doc = "Reader of field `MINUTE`"] pub type MINUTE_R = crate::R<u8, u8>; #[doc = "Write proxy for field `MINUTE`"] pub struct MINUTE_W<'a> { w: &'a mut W, } impl<'a> MINUTE_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x3f << 6)) | (((value as u32) & 0x3f) << 6); self.w } } #[doc = "Hour\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum HOUR_A { #[doc = "0: AM when CLKREP in 12-hour"] AM, #[doc = "16: PM when CLKREP in 12-hour"] PM, } impl From<HOUR_A> for u8 { #[inline(always)] fn from(variant: HOUR_A) -> Self { match variant { HOUR_A::AM => 0, HOUR_A::PM => 16, } } } #[doc = "Reader of field `HOUR`"] pub type HOUR_R = crate::R<u8, HOUR_A>; impl HOUR_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, HOUR_A> { use crate::Variant::*; match self.bits { 0 => Val(HOUR_A::AM), 16 => Val(HOUR_A::PM), i => Res(i), } } #[doc = "Checks if the value of the field is `AM`"] #[inline(always)] pub fn is_am(&self) -> bool { *self == HOUR_A::AM } #[doc = "Checks if the value of the field is `PM`"] #[inline(always)] pub fn is_pm(&self) -> bool { *self == HOUR_A::PM } } #[doc = "Write proxy for field `HOUR`"] pub struct HOUR_W<'a> { w: &'a mut W, } impl<'a> HOUR_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: HOUR_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "AM when CLKREP in 12-hour"] #[inline(always)] pub fn am(self) -> &'a mut W { self.variant(HOUR_A::AM) } #[doc = "PM when CLKREP in 12-hour"] #[inline(always)] pub fn pm(self) -> &'a mut W { self.variant(HOUR_A::PM) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x1f << 12)) | (((value as u32) & 0x1f) << 12); self.w } } #[doc = "Reader of field `DAY`"] pub type DAY_R = crate::R<u8, u8>; #[doc = "Write proxy for field `DAY`"] pub struct DAY_W<'a> { w: &'a mut W, } impl<'a> DAY_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x1f << 17)) | (((value as u32) & 0x1f) << 17); self.w } } #[doc = "Reader of field `MONTH`"] pub type MONTH_R = crate::R<u8, u8>; #[doc = "Write proxy for field `MONTH`"] pub struct MONTH_W<'a> { w: &'a mut W, } impl<'a> MONTH_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 22)) | (((value as u32) & 0x0f) << 22); self.w } } #[doc = "Reader of field `YEAR`"] pub type YEAR_R = crate::R<u8, u8>; #[doc = "Write proxy for field `YEAR`"] pub struct YEAR_W<'a> { w: &'a mut W, } impl<'a> YEAR_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x3f << 26)) | (((value as u32) & 0x3f) << 26); self.w } } impl R { #[doc = "Bits 0:5 - Second"] #[inline(always)] pub fn second(&self) -> SECOND_R { SECOND_R::new((self.bits & 0x3f) as u8) } #[doc = "Bits 6:11 - Minute"] #[inline(always)] pub fn minute(&self) -> MINUTE_R { MINUTE_R::new(((self.bits >> 6) & 0x3f) as u8) } #[doc = "Bits 12:16 - Hour"] #[inline(always)] pub fn hour(&self) -> HOUR_R { HOUR_R::new(((self.bits >> 12) & 0x1f) as u8) } #[doc = "Bits 17:21 - Day"] #[inline(always)] pub fn day(&self) -> DAY_R { DAY_R::new(((self.bits >> 17) & 0x1f) as u8) } #[doc = "Bits 22:25 - Month"] #[inline(always)] pub fn month(&self) -> MONTH_R { MONTH_R::new(((self.bits >> 22) & 0x0f) as u8) } #[doc = "Bits 26:31 - Year"] #[inline(always)] pub fn year(&self) -> YEAR_R { YEAR_R::new(((self.bits >> 26) & 0x3f) as u8) } } impl W { #[doc = "Bits 0:5 - Second"] #[inline(always)] pub fn second(&mut self) -> SECOND_W { SECOND_W { w: self } } #[doc = "Bits 6:11 - Minute"] #[inline(always)] pub fn minute(&mut self) -> MINUTE_W { MINUTE_W { w: self } } #[doc = "Bits 12:16 - Hour"] #[inline(always)] pub fn hour(&mut self) -> HOUR_W { HOUR_W { w: self } } #[doc = "Bits 17:21 - Day"] #[inline(always)] pub fn day(&mut self) -> DAY_W { DAY_W { w: self } } #[doc = "Bits 22:25 - Month"] #[inline(always)] pub fn month(&mut self) -> MONTH_W { MONTH_W { w: self } } #[doc = "Bits 26:31 - Year"] #[inline(always)] pub fn year(&mut self) -> YEAR_W { YEAR_W { w: self } } }