1#[doc = "Register `SSPCR1` reader"]
2pub type R = crate::R<SSPCR1_SPEC>;
3#[doc = "Register `SSPCR1` writer"]
4pub type W = crate::W<SSPCR1_SPEC>;
5#[doc = "Field `LBM` reader - Loop back mode: 0 Normal serial port operation enabled. 1 Output of transmit serial shifter is connected to input of receive serial shifter internally."]
6pub type LBM_R = crate::BitReader;
7#[doc = "Field `LBM` writer - Loop back mode: 0 Normal serial port operation enabled. 1 Output of transmit serial shifter is connected to input of receive serial shifter internally."]
8pub type LBM_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `SSE` reader - Synchronous serial port enable: 0 SSP operation disabled. 1 SSP operation enabled."]
10pub type SSE_R = crate::BitReader;
11#[doc = "Field `SSE` writer - Synchronous serial port enable: 0 SSP operation disabled. 1 SSP operation enabled."]
12pub type SSE_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `MS` reader - Master or slave mode select. This bit can be modified only when the PrimeCell SSP is disabled, SSE=0: 0 Device configured as master, default. 1 Device configured as slave."]
14pub type MS_R = crate::BitReader;
15#[doc = "Field `MS` writer - Master or slave mode select. This bit can be modified only when the PrimeCell SSP is disabled, SSE=0: 0 Device configured as master, default. 1 Device configured as slave."]
16pub type MS_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `SOD` reader - Slave-mode output disable. This bit is relevant only in the slave mode, MS=1. In multiple-slave systems, it is possible for an PrimeCell SSP master to broadcast a message to all slaves in the system while ensuring that only one slave drives data onto its serial output line. In such systems the RXD lines from multiple slaves could be tied together. To operate in such systems, the SOD bit can be set if the PrimeCell SSP slave is not supposed to drive the SSPTXD line: 0 SSP can drive the SSPTXD output in slave mode. 1 SSP must not drive the SSPTXD output in slave mode."]
18pub type SOD_R = crate::BitReader;
19#[doc = "Field `SOD` writer - Slave-mode output disable. This bit is relevant only in the slave mode, MS=1. In multiple-slave systems, it is possible for an PrimeCell SSP master to broadcast a message to all slaves in the system while ensuring that only one slave drives data onto its serial output line. In such systems the RXD lines from multiple slaves could be tied together. To operate in such systems, the SOD bit can be set if the PrimeCell SSP slave is not supposed to drive the SSPTXD line: 0 SSP can drive the SSPTXD output in slave mode. 1 SSP must not drive the SSPTXD output in slave mode."]
20pub type SOD_W<'a, REG> = crate::BitWriter<'a, REG>;
21impl R {
22#[doc = "Bit 0 - Loop back mode: 0 Normal serial port operation enabled. 1 Output of transmit serial shifter is connected to input of receive serial shifter internally."]
23 #[inline(always)]
24pub fn lbm(&self) -> LBM_R {
25 LBM_R::new((self.bits & 1) != 0)
26 }
27#[doc = "Bit 1 - Synchronous serial port enable: 0 SSP operation disabled. 1 SSP operation enabled."]
28 #[inline(always)]
29pub fn sse(&self) -> SSE_R {
30 SSE_R::new(((self.bits >> 1) & 1) != 0)
31 }
32#[doc = "Bit 2 - Master or slave mode select. This bit can be modified only when the PrimeCell SSP is disabled, SSE=0: 0 Device configured as master, default. 1 Device configured as slave."]
33 #[inline(always)]
34pub fn ms(&self) -> MS_R {
35 MS_R::new(((self.bits >> 2) & 1) != 0)
36 }
37#[doc = "Bit 3 - Slave-mode output disable. This bit is relevant only in the slave mode, MS=1. In multiple-slave systems, it is possible for an PrimeCell SSP master to broadcast a message to all slaves in the system while ensuring that only one slave drives data onto its serial output line. In such systems the RXD lines from multiple slaves could be tied together. To operate in such systems, the SOD bit can be set if the PrimeCell SSP slave is not supposed to drive the SSPTXD line: 0 SSP can drive the SSPTXD output in slave mode. 1 SSP must not drive the SSPTXD output in slave mode."]
38 #[inline(always)]
39pub fn sod(&self) -> SOD_R {
40 SOD_R::new(((self.bits >> 3) & 1) != 0)
41 }
42}
43impl W {
44#[doc = "Bit 0 - Loop back mode: 0 Normal serial port operation enabled. 1 Output of transmit serial shifter is connected to input of receive serial shifter internally."]
45 #[inline(always)]
46 #[must_use]
47pub fn lbm(&mut self) -> LBM_W<SSPCR1_SPEC> {
48 LBM_W::new(self, 0)
49 }
50#[doc = "Bit 1 - Synchronous serial port enable: 0 SSP operation disabled. 1 SSP operation enabled."]
51 #[inline(always)]
52 #[must_use]
53pub fn sse(&mut self) -> SSE_W<SSPCR1_SPEC> {
54 SSE_W::new(self, 1)
55 }
56#[doc = "Bit 2 - Master or slave mode select. This bit can be modified only when the PrimeCell SSP is disabled, SSE=0: 0 Device configured as master, default. 1 Device configured as slave."]
57 #[inline(always)]
58 #[must_use]
59pub fn ms(&mut self) -> MS_W<SSPCR1_SPEC> {
60 MS_W::new(self, 2)
61 }
62#[doc = "Bit 3 - Slave-mode output disable. This bit is relevant only in the slave mode, MS=1. In multiple-slave systems, it is possible for an PrimeCell SSP master to broadcast a message to all slaves in the system while ensuring that only one slave drives data onto its serial output line. In such systems the RXD lines from multiple slaves could be tied together. To operate in such systems, the SOD bit can be set if the PrimeCell SSP slave is not supposed to drive the SSPTXD line: 0 SSP can drive the SSPTXD output in slave mode. 1 SSP must not drive the SSPTXD output in slave mode."]
63 #[inline(always)]
64 #[must_use]
65pub fn sod(&mut self) -> SOD_W<SSPCR1_SPEC> {
66 SOD_W::new(self, 3)
67 }
68#[doc = r" Writes raw bits to the register."]
69 #[doc = r""]
70 #[doc = r" # Safety"]
71 #[doc = r""]
72 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
73 #[inline(always)]
74pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
75self.bits = bits;
76self
77}
78}
79#[doc = "Control register 1, SSPCR1 on page 3-5
8081You can [`read`](crate::generic::Reg::read) this register and get [`sspcr1::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`sspcr1::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
82pub struct SSPCR1_SPEC;
83impl crate::RegisterSpec for SSPCR1_SPEC {
84type Ux = u32;
85}
86#[doc = "`read()` method returns [`sspcr1::R`](R) reader structure"]
87impl crate::Readable for SSPCR1_SPEC {}
88#[doc = "`write(|w| ..)` method takes [`sspcr1::W`](W) writer structure"]
89impl crate::Writable for SSPCR1_SPEC {
90const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
91const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
92}
93#[doc = "`reset()` method sets SSPCR1 to value 0"]
94impl crate::Resettable for SSPCR1_SPEC {
95const RESET_VALUE: u32 = 0;
96}