bl602_pac/cks/
cks_config.rs

1#[doc = "Register `cks_config` reader"]
2pub struct R(crate::R<CKS_CONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CKS_CONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CKS_CONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CKS_CONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `cks_config` writer"]
17pub struct W(crate::W<CKS_CONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CKS_CONFIG_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<CKS_CONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CKS_CONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `cr_cks_clr` reader - "]
38pub type CR_CKS_CLR_R = crate::BitReader<bool>;
39#[doc = "Field `cr_cks_clr` writer - "]
40pub type CR_CKS_CLR_W<'a, const O: u8> = crate::BitWriter<'a, u32, CKS_CONFIG_SPEC, bool, O>;
41#[doc = "Field `cr_cks_byte_swap` reader - Endianness."]
42pub type CR_CKS_BYTE_SWAP_R = crate::BitReader<CKSBYTE_SWAP_A>;
43#[doc = "Endianness.\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum CKSBYTE_SWAP_A {
46    #[doc = "0: Little endian."]
47    LITTLE_ENDIAN = 0,
48    #[doc = "1: Big endian."]
49    BIG_ENDIAN = 1,
50}
51impl From<CKSBYTE_SWAP_A> for bool {
52    #[inline(always)]
53    fn from(variant: CKSBYTE_SWAP_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl CR_CKS_BYTE_SWAP_R {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> CKSBYTE_SWAP_A {
61        match self.bits {
62            false => CKSBYTE_SWAP_A::LITTLE_ENDIAN,
63            true => CKSBYTE_SWAP_A::BIG_ENDIAN,
64        }
65    }
66    #[doc = "Checks if the value of the field is `LITTLE_ENDIAN`"]
67    #[inline(always)]
68    pub fn is_little_endian(&self) -> bool {
69        *self == CKSBYTE_SWAP_A::LITTLE_ENDIAN
70    }
71    #[doc = "Checks if the value of the field is `BIG_ENDIAN`"]
72    #[inline(always)]
73    pub fn is_big_endian(&self) -> bool {
74        *self == CKSBYTE_SWAP_A::BIG_ENDIAN
75    }
76}
77#[doc = "Field `cr_cks_byte_swap` writer - Endianness."]
78pub type CR_CKS_BYTE_SWAP_W<'a, const O: u8> =
79    crate::BitWriter<'a, u32, CKS_CONFIG_SPEC, CKSBYTE_SWAP_A, O>;
80impl<'a, const O: u8> CR_CKS_BYTE_SWAP_W<'a, O> {
81    #[doc = "Little endian."]
82    #[inline(always)]
83    pub fn little_endian(self) -> &'a mut W {
84        self.variant(CKSBYTE_SWAP_A::LITTLE_ENDIAN)
85    }
86    #[doc = "Big endian."]
87    #[inline(always)]
88    pub fn big_endian(self) -> &'a mut W {
89        self.variant(CKSBYTE_SWAP_A::BIG_ENDIAN)
90    }
91}
92impl R {
93    #[doc = "Bit 0"]
94    #[inline(always)]
95    pub fn cr_cks_clr(&self) -> CR_CKS_CLR_R {
96        CR_CKS_CLR_R::new((self.bits & 1) != 0)
97    }
98    #[doc = "Bit 1 - Endianness."]
99    #[inline(always)]
100    pub fn cr_cks_byte_swap(&self) -> CR_CKS_BYTE_SWAP_R {
101        CR_CKS_BYTE_SWAP_R::new(((self.bits >> 1) & 1) != 0)
102    }
103}
104impl W {
105    #[doc = "Bit 0"]
106    #[inline(always)]
107    #[must_use]
108    pub fn cr_cks_clr(&mut self) -> CR_CKS_CLR_W<0> {
109        CR_CKS_CLR_W::new(self)
110    }
111    #[doc = "Bit 1 - Endianness."]
112    #[inline(always)]
113    #[must_use]
114    pub fn cr_cks_byte_swap(&mut self) -> CR_CKS_BYTE_SWAP_W<1> {
115        CR_CKS_BYTE_SWAP_W::new(self)
116    }
117    #[doc = "Writes raw bits to the register."]
118    #[inline(always)]
119    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
120        self.0.bits(bits);
121        self
122    }
123}
124#[doc = "cks_config.\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 [cks_config](index.html) module"]
125pub struct CKS_CONFIG_SPEC;
126impl crate::RegisterSpec for CKS_CONFIG_SPEC {
127    type Ux = u32;
128}
129#[doc = "`read()` method returns [cks_config::R](R) reader structure"]
130impl crate::Readable for CKS_CONFIG_SPEC {
131    type Reader = R;
132}
133#[doc = "`write(|w| ..)` method takes [cks_config::W](W) writer structure"]
134impl crate::Writable for CKS_CONFIG_SPEC {
135    type Writer = W;
136    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
137    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
138}
139#[doc = "`reset()` method sets cks_config to value 0"]
140impl crate::Resettable for CKS_CONFIG_SPEC {
141    const RESET_VALUE: Self::Ux = 0;
142}