atsamd11c/sercom0/spi/
ctrlb.rs

1#[doc = "Register `CTRLB` reader"]
2pub type R = crate::R<CtrlbSpec>;
3#[doc = "Register `CTRLB` writer"]
4pub type W = crate::W<CtrlbSpec>;
5#[doc = "Field `CHSIZE` reader - Character Size"]
6pub type ChsizeR = crate::FieldReader;
7#[doc = "Field `CHSIZE` writer - Character Size"]
8pub type ChsizeW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
9#[doc = "Field `PLOADEN` reader - Data Preload Enable"]
10pub type PloadenR = crate::BitReader;
11#[doc = "Field `PLOADEN` writer - Data Preload Enable"]
12pub type PloadenW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `SSDE` reader - Slave Select Low Detect Enable"]
14pub type SsdeR = crate::BitReader;
15#[doc = "Field `SSDE` writer - Slave Select Low Detect Enable"]
16pub type SsdeW<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `MSSEN` reader - Master Slave Select Enable"]
18pub type MssenR = crate::BitReader;
19#[doc = "Field `MSSEN` writer - Master Slave Select Enable"]
20pub type MssenW<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `AMODE` reader - Address Mode"]
22pub type AmodeR = crate::FieldReader;
23#[doc = "Field `AMODE` writer - Address Mode"]
24pub type AmodeW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
25#[doc = "Field `RXEN` reader - Receiver Enable"]
26pub type RxenR = crate::BitReader;
27#[doc = "Field `RXEN` writer - Receiver Enable"]
28pub type RxenW<'a, REG> = crate::BitWriter<'a, REG>;
29impl R {
30    #[doc = "Bits 0:2 - Character Size"]
31    #[inline(always)]
32    pub fn chsize(&self) -> ChsizeR {
33        ChsizeR::new((self.bits & 7) as u8)
34    }
35    #[doc = "Bit 6 - Data Preload Enable"]
36    #[inline(always)]
37    pub fn ploaden(&self) -> PloadenR {
38        PloadenR::new(((self.bits >> 6) & 1) != 0)
39    }
40    #[doc = "Bit 9 - Slave Select Low Detect Enable"]
41    #[inline(always)]
42    pub fn ssde(&self) -> SsdeR {
43        SsdeR::new(((self.bits >> 9) & 1) != 0)
44    }
45    #[doc = "Bit 13 - Master Slave Select Enable"]
46    #[inline(always)]
47    pub fn mssen(&self) -> MssenR {
48        MssenR::new(((self.bits >> 13) & 1) != 0)
49    }
50    #[doc = "Bits 14:15 - Address Mode"]
51    #[inline(always)]
52    pub fn amode(&self) -> AmodeR {
53        AmodeR::new(((self.bits >> 14) & 3) as u8)
54    }
55    #[doc = "Bit 17 - Receiver Enable"]
56    #[inline(always)]
57    pub fn rxen(&self) -> RxenR {
58        RxenR::new(((self.bits >> 17) & 1) != 0)
59    }
60}
61impl W {
62    #[doc = "Bits 0:2 - Character Size"]
63    #[inline(always)]
64    #[must_use]
65    pub fn chsize(&mut self) -> ChsizeW<CtrlbSpec> {
66        ChsizeW::new(self, 0)
67    }
68    #[doc = "Bit 6 - Data Preload Enable"]
69    #[inline(always)]
70    #[must_use]
71    pub fn ploaden(&mut self) -> PloadenW<CtrlbSpec> {
72        PloadenW::new(self, 6)
73    }
74    #[doc = "Bit 9 - Slave Select Low Detect Enable"]
75    #[inline(always)]
76    #[must_use]
77    pub fn ssde(&mut self) -> SsdeW<CtrlbSpec> {
78        SsdeW::new(self, 9)
79    }
80    #[doc = "Bit 13 - Master Slave Select Enable"]
81    #[inline(always)]
82    #[must_use]
83    pub fn mssen(&mut self) -> MssenW<CtrlbSpec> {
84        MssenW::new(self, 13)
85    }
86    #[doc = "Bits 14:15 - Address Mode"]
87    #[inline(always)]
88    #[must_use]
89    pub fn amode(&mut self) -> AmodeW<CtrlbSpec> {
90        AmodeW::new(self, 14)
91    }
92    #[doc = "Bit 17 - Receiver Enable"]
93    #[inline(always)]
94    #[must_use]
95    pub fn rxen(&mut self) -> RxenW<CtrlbSpec> {
96        RxenW::new(self, 17)
97    }
98}
99#[doc = "SPI Control B\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrlb::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrlb::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
100pub struct CtrlbSpec;
101impl crate::RegisterSpec for CtrlbSpec {
102    type Ux = u32;
103}
104#[doc = "`read()` method returns [`ctrlb::R`](R) reader structure"]
105impl crate::Readable for CtrlbSpec {}
106#[doc = "`write(|w| ..)` method takes [`ctrlb::W`](W) writer structure"]
107impl crate::Writable for CtrlbSpec {
108    type Safety = crate::Unsafe;
109    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
110    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
111}
112#[doc = "`reset()` method sets CTRLB to value 0"]
113impl crate::Resettable for CtrlbSpec {
114    const RESET_VALUE: u32 = 0;
115}