atsaml21e18a/sercom0/spi/
intflag.rs

1#[doc = "Register `INTFLAG` reader"]
2pub struct R(crate::R<INTFLAG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<INTFLAG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<INTFLAG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<INTFLAG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `INTFLAG` writer"]
17pub struct W(crate::W<INTFLAG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<INTFLAG_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<INTFLAG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<INTFLAG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DRE` reader - Data Register Empty Interrupt"]
38pub type DRE_R = crate::BitReader<bool>;
39#[doc = "Field `TXC` reader - Transmit Complete Interrupt"]
40pub type TXC_R = crate::BitReader<bool>;
41#[doc = "Field `TXC` writer - Transmit Complete Interrupt"]
42pub type TXC_W<'a, const O: u8> = crate::BitWriter<'a, u8, INTFLAG_SPEC, bool, O>;
43#[doc = "Field `RXC` reader - Receive Complete Interrupt"]
44pub type RXC_R = crate::BitReader<bool>;
45#[doc = "Field `SSL` reader - Slave Select Low Interrupt Flag"]
46pub type SSL_R = crate::BitReader<bool>;
47#[doc = "Field `SSL` writer - Slave Select Low Interrupt Flag"]
48pub type SSL_W<'a, const O: u8> = crate::BitWriter<'a, u8, INTFLAG_SPEC, bool, O>;
49#[doc = "Field `ERROR` reader - Combined Error Interrupt"]
50pub type ERROR_R = crate::BitReader<bool>;
51#[doc = "Field `ERROR` writer - Combined Error Interrupt"]
52pub type ERROR_W<'a, const O: u8> = crate::BitWriter<'a, u8, INTFLAG_SPEC, bool, O>;
53impl R {
54    #[doc = "Bit 0 - Data Register Empty Interrupt"]
55    #[inline(always)]
56    pub fn dre(&self) -> DRE_R {
57        DRE_R::new((self.bits & 1) != 0)
58    }
59    #[doc = "Bit 1 - Transmit Complete Interrupt"]
60    #[inline(always)]
61    pub fn txc(&self) -> TXC_R {
62        TXC_R::new(((self.bits >> 1) & 1) != 0)
63    }
64    #[doc = "Bit 2 - Receive Complete Interrupt"]
65    #[inline(always)]
66    pub fn rxc(&self) -> RXC_R {
67        RXC_R::new(((self.bits >> 2) & 1) != 0)
68    }
69    #[doc = "Bit 3 - Slave Select Low Interrupt Flag"]
70    #[inline(always)]
71    pub fn ssl(&self) -> SSL_R {
72        SSL_R::new(((self.bits >> 3) & 1) != 0)
73    }
74    #[doc = "Bit 7 - Combined Error Interrupt"]
75    #[inline(always)]
76    pub fn error(&self) -> ERROR_R {
77        ERROR_R::new(((self.bits >> 7) & 1) != 0)
78    }
79}
80impl W {
81    #[doc = "Bit 1 - Transmit Complete Interrupt"]
82    #[inline(always)]
83    #[must_use]
84    pub fn txc(&mut self) -> TXC_W<1> {
85        TXC_W::new(self)
86    }
87    #[doc = "Bit 3 - Slave Select Low Interrupt Flag"]
88    #[inline(always)]
89    #[must_use]
90    pub fn ssl(&mut self) -> SSL_W<3> {
91        SSL_W::new(self)
92    }
93    #[doc = "Bit 7 - Combined Error Interrupt"]
94    #[inline(always)]
95    #[must_use]
96    pub fn error(&mut self) -> ERROR_W<7> {
97        ERROR_W::new(self)
98    }
99    #[doc = "Writes raw bits to the register."]
100    #[inline(always)]
101    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
102        self.0.bits(bits);
103        self
104    }
105}
106#[doc = "SPI Interrupt Flag Status and Clear\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 [intflag](index.html) module"]
107pub struct INTFLAG_SPEC;
108impl crate::RegisterSpec for INTFLAG_SPEC {
109    type Ux = u8;
110}
111#[doc = "`read()` method returns [intflag::R](R) reader structure"]
112impl crate::Readable for INTFLAG_SPEC {
113    type Reader = R;
114}
115#[doc = "`write(|w| ..)` method takes [intflag::W](W) writer structure"]
116impl crate::Writable for INTFLAG_SPEC {
117    type Writer = W;
118    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
119    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
120}
121#[doc = "`reset()` method sets INTFLAG to value 0"]
122impl crate::Resettable for INTFLAG_SPEC {
123    const RESET_VALUE: Self::Ux = 0;
124}