ra6m3/bus/
csrec.rs

1#[doc = "Register `CS%sREC` reader"]
2pub struct R(crate::R<CSREC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CSREC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CSREC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CSREC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CS%sREC` writer"]
17pub struct W(crate::W<CSREC_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CSREC_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<CSREC_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CSREC_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `RRCV` reader - Read Recovery"]
38pub type RRCV_R = crate::FieldReader<u8, RRCV_A>;
39#[doc = "Read Recovery\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum RRCV_A {
43    #[doc = "0: No recovery cycle is inserted."]
44    _0X0 = 0,
45}
46impl From<RRCV_A> for u8 {
47    #[inline(always)]
48    fn from(variant: RRCV_A) -> Self {
49        variant as _
50    }
51}
52impl RRCV_R {
53    #[doc = "Get enumerated values variant"]
54    #[inline(always)]
55    pub fn variant(&self) -> Option<RRCV_A> {
56        match self.bits {
57            0 => Some(RRCV_A::_0X0),
58            _ => None,
59        }
60    }
61    #[doc = "Checks if the value of the field is `_0X0`"]
62    #[inline(always)]
63    pub fn is_0x0(&self) -> bool {
64        *self == RRCV_A::_0X0
65    }
66}
67#[doc = "Field `RRCV` writer - Read Recovery"]
68pub type RRCV_W<'a, const O: u8> = crate::FieldWriter<'a, u16, CSREC_SPEC, u8, RRCV_A, 4, O>;
69impl<'a, const O: u8> RRCV_W<'a, O> {
70    #[doc = "No recovery cycle is inserted."]
71    #[inline(always)]
72    pub fn _0x0(self) -> &'a mut W {
73        self.variant(RRCV_A::_0X0)
74    }
75}
76#[doc = "Field `WRCV` reader - Write Recovery"]
77pub type WRCV_R = crate::FieldReader<u8, WRCV_A>;
78#[doc = "Write Recovery\n\nValue on reset: 0"]
79#[derive(Clone, Copy, Debug, PartialEq, Eq)]
80#[repr(u8)]
81pub enum WRCV_A {
82    #[doc = "0: No recovery cycle is inserted."]
83    _0X0 = 0,
84}
85impl From<WRCV_A> for u8 {
86    #[inline(always)]
87    fn from(variant: WRCV_A) -> Self {
88        variant as _
89    }
90}
91impl WRCV_R {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub fn variant(&self) -> Option<WRCV_A> {
95        match self.bits {
96            0 => Some(WRCV_A::_0X0),
97            _ => None,
98        }
99    }
100    #[doc = "Checks if the value of the field is `_0X0`"]
101    #[inline(always)]
102    pub fn is_0x0(&self) -> bool {
103        *self == WRCV_A::_0X0
104    }
105}
106#[doc = "Field `WRCV` writer - Write Recovery"]
107pub type WRCV_W<'a, const O: u8> = crate::FieldWriter<'a, u16, CSREC_SPEC, u8, WRCV_A, 4, O>;
108impl<'a, const O: u8> WRCV_W<'a, O> {
109    #[doc = "No recovery cycle is inserted."]
110    #[inline(always)]
111    pub fn _0x0(self) -> &'a mut W {
112        self.variant(WRCV_A::_0X0)
113    }
114}
115impl R {
116    #[doc = "Bits 0:3 - Read Recovery"]
117    #[inline(always)]
118    pub fn rrcv(&self) -> RRCV_R {
119        RRCV_R::new((self.bits & 0x0f) as u8)
120    }
121    #[doc = "Bits 8:11 - Write Recovery"]
122    #[inline(always)]
123    pub fn wrcv(&self) -> WRCV_R {
124        WRCV_R::new(((self.bits >> 8) & 0x0f) as u8)
125    }
126}
127impl W {
128    #[doc = "Bits 0:3 - Read Recovery"]
129    #[inline(always)]
130    #[must_use]
131    pub fn rrcv(&mut self) -> RRCV_W<0> {
132        RRCV_W::new(self)
133    }
134    #[doc = "Bits 8:11 - Write Recovery"]
135    #[inline(always)]
136    #[must_use]
137    pub fn wrcv(&mut self) -> WRCV_W<8> {
138        WRCV_W::new(self)
139    }
140    #[doc = "Writes raw bits to the register."]
141    #[inline(always)]
142    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
143        self.0.bits(bits);
144        self
145    }
146}
147#[doc = "CS%s Recovery Cycle 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 [csrec](index.html) module"]
148pub struct CSREC_SPEC;
149impl crate::RegisterSpec for CSREC_SPEC {
150    type Ux = u16;
151}
152#[doc = "`read()` method returns [csrec::R](R) reader structure"]
153impl crate::Readable for CSREC_SPEC {
154    type Reader = R;
155}
156#[doc = "`write(|w| ..)` method takes [csrec::W](W) writer structure"]
157impl crate::Writable for CSREC_SPEC {
158    type Writer = W;
159    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
160    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
161}
162#[doc = "`reset()` method sets CS%sREC to value 0"]
163impl crate::Resettable for CSREC_SPEC {
164    const RESET_VALUE: Self::Ux = 0;
165}