d1_pac/rtc/
ic_chara.rs

1#[doc = "Register `ic_chara` reader"]
2pub type R = crate::R<IC_CHARA_SPEC>;
3#[doc = "Register `ic_chara` writer"]
4pub type W = crate::W<IC_CHARA_SPEC>;
5#[doc = "Field `id_data` reader - Return 0x16AA only if the KEY_FIELD is set as 0x16AA when read those bits, otherwise return 0x0."]
6pub type ID_DATA_R = crate::FieldReader<u16>;
7#[doc = "Field `id_data` writer - Return 0x16AA only if the KEY_FIELD is set as 0x16AA when read those bits, otherwise return 0x0."]
8pub type ID_DATA_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
9#[doc = "Field `key_field` reader - Key Field\n\nThe field should be written as 0x16AA. Writing any other value in this field aborts the write-operation."]
10pub type KEY_FIELD_R = crate::FieldReader<u16>;
11#[doc = "Field `key_field` writer - Key Field\n\nThe field should be written as 0x16AA. Writing any other value in this field aborts the write-operation."]
12pub type KEY_FIELD_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
13impl R {
14    #[doc = "Bits 0:15 - Return 0x16AA only if the KEY_FIELD is set as 0x16AA when read those bits, otherwise return 0x0."]
15    #[inline(always)]
16    pub fn id_data(&self) -> ID_DATA_R {
17        ID_DATA_R::new((self.bits & 0xffff) as u16)
18    }
19    #[doc = "Bits 16:31 - Key Field\n\nThe field should be written as 0x16AA. Writing any other value in this field aborts the write-operation."]
20    #[inline(always)]
21    pub fn key_field(&self) -> KEY_FIELD_R {
22        KEY_FIELD_R::new(((self.bits >> 16) & 0xffff) as u16)
23    }
24}
25impl W {
26    #[doc = "Bits 0:15 - Return 0x16AA only if the KEY_FIELD is set as 0x16AA when read those bits, otherwise return 0x0."]
27    #[inline(always)]
28    #[must_use]
29    pub fn id_data(&mut self) -> ID_DATA_W<IC_CHARA_SPEC> {
30        ID_DATA_W::new(self, 0)
31    }
32    #[doc = "Bits 16:31 - Key Field\n\nThe field should be written as 0x16AA. Writing any other value in this field aborts the write-operation."]
33    #[inline(always)]
34    #[must_use]
35    pub fn key_field(&mut self) -> KEY_FIELD_W<IC_CHARA_SPEC> {
36        KEY_FIELD_W::new(self, 16)
37    }
38    #[doc = r" Writes raw bits to the register."]
39    #[doc = r""]
40    #[doc = r" # Safety"]
41    #[doc = r""]
42    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
43    #[inline(always)]
44    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
45        self.bits = bits;
46        self
47    }
48}
49#[doc = "IC Characteristic Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ic_chara::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ic_chara::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
50pub struct IC_CHARA_SPEC;
51impl crate::RegisterSpec for IC_CHARA_SPEC {
52    type Ux = u32;
53}
54#[doc = "`read()` method returns [`ic_chara::R`](R) reader structure"]
55impl crate::Readable for IC_CHARA_SPEC {}
56#[doc = "`write(|w| ..)` method takes [`ic_chara::W`](W) writer structure"]
57impl crate::Writable for IC_CHARA_SPEC {
58    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
59    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
60}
61#[doc = "`reset()` method sets ic_chara to value 0"]
62impl crate::Resettable for IC_CHARA_SPEC {
63    const RESET_VALUE: Self::Ux = 0;
64}