avr_device/devices/atmega2560/spi/
spsr.rs

1#[doc = "Register `SPSR` reader"]
2pub struct R(crate::R<SPSR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SPSR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SPSR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SPSR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SPSR` writer"]
17pub struct W(crate::W<SPSR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SPSR_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<SPSR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SPSR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SPI2X` reader - Double SPI Speed Bit"]
38pub type SPI2X_R = crate::BitReader<bool>;
39#[doc = "Field `SPI2X` writer - Double SPI Speed Bit"]
40pub type SPI2X_W<'a, const O: u8> = crate::BitWriter<'a, u8, SPSR_SPEC, bool, O>;
41#[doc = "Field `WCOL` reader - Write Collision Flag"]
42pub type WCOL_R = crate::BitReader<bool>;
43#[doc = "Field `SPIF` reader - SPI Interrupt Flag"]
44pub type SPIF_R = crate::BitReader<bool>;
45impl R {
46    #[doc = "Bit 0 - Double SPI Speed Bit"]
47    #[inline(always)]
48    pub fn spi2x(&self) -> SPI2X_R {
49        SPI2X_R::new((self.bits & 1) != 0)
50    }
51    #[doc = "Bit 6 - Write Collision Flag"]
52    #[inline(always)]
53    pub fn wcol(&self) -> WCOL_R {
54        WCOL_R::new(((self.bits >> 6) & 1) != 0)
55    }
56    #[doc = "Bit 7 - SPI Interrupt Flag"]
57    #[inline(always)]
58    pub fn spif(&self) -> SPIF_R {
59        SPIF_R::new(((self.bits >> 7) & 1) != 0)
60    }
61}
62impl W {
63    #[doc = "Bit 0 - Double SPI Speed Bit"]
64    #[inline(always)]
65    #[must_use]
66    pub fn spi2x(&mut self) -> SPI2X_W<0> {
67        SPI2X_W::new(self)
68    }
69    #[doc = "Writes raw bits to the register."]
70    #[inline(always)]
71    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
72        self.0.bits(bits);
73        self
74    }
75}
76#[doc = "SPI Status 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 [spsr](index.html) module"]
77pub struct SPSR_SPEC;
78impl crate::RegisterSpec for SPSR_SPEC {
79    type Ux = u8;
80}
81#[doc = "`read()` method returns [spsr::R](R) reader structure"]
82impl crate::Readable for SPSR_SPEC {
83    type Reader = R;
84}
85#[doc = "`write(|w| ..)` method takes [spsr::W](W) writer structure"]
86impl crate::Writable for SPSR_SPEC {
87    type Writer = W;
88    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
89    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
90}
91#[doc = "`reset()` method sets SPSR to value 0"]
92impl crate::Resettable for SPSR_SPEC {
93    const RESET_VALUE: Self::Ux = 0;
94}