nrf52840_pac/spis0/
status.rs

1#[doc = "Register `STATUS` reader"]
2pub struct R(crate::R<STATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<STATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<STATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<STATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `STATUS` writer"]
17pub struct W(crate::W<STATUS_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<STATUS_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<STATUS_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<STATUS_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `OVERREAD` reader - TX buffer over-read detected, and prevented"]
38pub type OVERREAD_R = crate::BitReader<OVERREAD_A>;
39#[doc = "TX buffer over-read detected, and prevented\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum OVERREAD_A {
42    #[doc = "0: Read: error not present"]
43    NOT_PRESENT = 0,
44    #[doc = "1: Read: error present"]
45    PRESENT = 1,
46}
47impl From<OVERREAD_A> for bool {
48    #[inline(always)]
49    fn from(variant: OVERREAD_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl OVERREAD_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> OVERREAD_A {
57        match self.bits {
58            false => OVERREAD_A::NOT_PRESENT,
59            true => OVERREAD_A::PRESENT,
60        }
61    }
62    #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
63    #[inline(always)]
64    pub fn is_not_present(&self) -> bool {
65        *self == OVERREAD_A::NOT_PRESENT
66    }
67    #[doc = "Checks if the value of the field is `PRESENT`"]
68    #[inline(always)]
69    pub fn is_present(&self) -> bool {
70        *self == OVERREAD_A::PRESENT
71    }
72}
73#[doc = "TX buffer over-read detected, and prevented\n\nValue on reset: 0"]
74#[derive(Clone, Copy, Debug, PartialEq)]
75pub enum OVERREAD_AW {
76    #[doc = "1: Write: clear error on writing '1'"]
77    CLEAR = 1,
78}
79impl From<OVERREAD_AW> for bool {
80    #[inline(always)]
81    fn from(variant: OVERREAD_AW) -> Self {
82        variant as u8 != 0
83    }
84}
85#[doc = "Field `OVERREAD` writer - TX buffer over-read detected, and prevented"]
86pub type OVERREAD_W<'a, const O: u8> = crate::BitWriter<'a, u32, STATUS_SPEC, OVERREAD_AW, O>;
87impl<'a, const O: u8> OVERREAD_W<'a, O> {
88    #[doc = "Write: clear error on writing '1'"]
89    #[inline(always)]
90    pub fn clear(self) -> &'a mut W {
91        self.variant(OVERREAD_AW::CLEAR)
92    }
93}
94#[doc = "Field `OVERFLOW` reader - RX buffer overflow detected, and prevented"]
95pub type OVERFLOW_R = crate::BitReader<OVERFLOW_A>;
96#[doc = "RX buffer overflow detected, and prevented\n\nValue on reset: 0"]
97#[derive(Clone, Copy, Debug, PartialEq)]
98pub enum OVERFLOW_A {
99    #[doc = "0: Read: error not present"]
100    NOT_PRESENT = 0,
101    #[doc = "1: Read: error present"]
102    PRESENT = 1,
103}
104impl From<OVERFLOW_A> for bool {
105    #[inline(always)]
106    fn from(variant: OVERFLOW_A) -> Self {
107        variant as u8 != 0
108    }
109}
110impl OVERFLOW_R {
111    #[doc = "Get enumerated values variant"]
112    #[inline(always)]
113    pub fn variant(&self) -> OVERFLOW_A {
114        match self.bits {
115            false => OVERFLOW_A::NOT_PRESENT,
116            true => OVERFLOW_A::PRESENT,
117        }
118    }
119    #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
120    #[inline(always)]
121    pub fn is_not_present(&self) -> bool {
122        *self == OVERFLOW_A::NOT_PRESENT
123    }
124    #[doc = "Checks if the value of the field is `PRESENT`"]
125    #[inline(always)]
126    pub fn is_present(&self) -> bool {
127        *self == OVERFLOW_A::PRESENT
128    }
129}
130#[doc = "RX buffer overflow detected, and prevented\n\nValue on reset: 0"]
131#[derive(Clone, Copy, Debug, PartialEq)]
132pub enum OVERFLOW_AW {
133    #[doc = "1: Write: clear error on writing '1'"]
134    CLEAR = 1,
135}
136impl From<OVERFLOW_AW> for bool {
137    #[inline(always)]
138    fn from(variant: OVERFLOW_AW) -> Self {
139        variant as u8 != 0
140    }
141}
142#[doc = "Field `OVERFLOW` writer - RX buffer overflow detected, and prevented"]
143pub type OVERFLOW_W<'a, const O: u8> = crate::BitWriter<'a, u32, STATUS_SPEC, OVERFLOW_AW, O>;
144impl<'a, const O: u8> OVERFLOW_W<'a, O> {
145    #[doc = "Write: clear error on writing '1'"]
146    #[inline(always)]
147    pub fn clear(self) -> &'a mut W {
148        self.variant(OVERFLOW_AW::CLEAR)
149    }
150}
151impl R {
152    #[doc = "Bit 0 - TX buffer over-read detected, and prevented"]
153    #[inline(always)]
154    pub fn overread(&self) -> OVERREAD_R {
155        OVERREAD_R::new((self.bits & 1) != 0)
156    }
157    #[doc = "Bit 1 - RX buffer overflow detected, and prevented"]
158    #[inline(always)]
159    pub fn overflow(&self) -> OVERFLOW_R {
160        OVERFLOW_R::new(((self.bits >> 1) & 1) != 0)
161    }
162}
163impl W {
164    #[doc = "Bit 0 - TX buffer over-read detected, and prevented"]
165    #[inline(always)]
166    pub fn overread(&mut self) -> OVERREAD_W<0> {
167        OVERREAD_W::new(self)
168    }
169    #[doc = "Bit 1 - RX buffer overflow detected, and prevented"]
170    #[inline(always)]
171    pub fn overflow(&mut self) -> OVERFLOW_W<1> {
172        OVERFLOW_W::new(self)
173    }
174    #[doc = "Writes raw bits to the register."]
175    #[inline(always)]
176    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
177        self.0.bits(bits);
178        self
179    }
180}
181#[doc = "Status from last transaction\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 [status](index.html) module"]
182pub struct STATUS_SPEC;
183impl crate::RegisterSpec for STATUS_SPEC {
184    type Ux = u32;
185}
186#[doc = "`read()` method returns [status::R](R) reader structure"]
187impl crate::Readable for STATUS_SPEC {
188    type Reader = R;
189}
190#[doc = "`write(|w| ..)` method takes [status::W](W) writer structure"]
191impl crate::Writable for STATUS_SPEC {
192    type Writer = W;
193}
194#[doc = "`reset()` method sets STATUS to value 0"]
195impl crate::Resettable for STATUS_SPEC {
196    #[inline(always)]
197    fn reset_value() -> Self::Ux {
198        0
199    }
200}