atsamd51p/qspi/
baud.rs

1#[doc = "Register `BAUD` reader"]
2pub type R = crate::R<BaudSpec>;
3#[doc = "Register `BAUD` writer"]
4pub type W = crate::W<BaudSpec>;
5#[doc = "Field `CPOL` reader - Clock Polarity"]
6pub type CpolR = crate::BitReader;
7#[doc = "Field `CPOL` writer - Clock Polarity"]
8pub type CpolW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `CPHA` reader - Clock Phase"]
10pub type CphaR = crate::BitReader;
11#[doc = "Field `CPHA` writer - Clock Phase"]
12pub type CphaW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `BAUD` reader - Serial Clock Baud Rate"]
14pub type BaudR = crate::FieldReader;
15#[doc = "Field `BAUD` writer - Serial Clock Baud Rate"]
16pub type BaudW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
17#[doc = "Field `DLYBS` reader - Delay Before SCK"]
18pub type DlybsR = crate::FieldReader;
19#[doc = "Field `DLYBS` writer - Delay Before SCK"]
20pub type DlybsW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
21impl R {
22    #[doc = "Bit 0 - Clock Polarity"]
23    #[inline(always)]
24    pub fn cpol(&self) -> CpolR {
25        CpolR::new((self.bits & 1) != 0)
26    }
27    #[doc = "Bit 1 - Clock Phase"]
28    #[inline(always)]
29    pub fn cpha(&self) -> CphaR {
30        CphaR::new(((self.bits >> 1) & 1) != 0)
31    }
32    #[doc = "Bits 8:15 - Serial Clock Baud Rate"]
33    #[inline(always)]
34    pub fn baud(&self) -> BaudR {
35        BaudR::new(((self.bits >> 8) & 0xff) as u8)
36    }
37    #[doc = "Bits 16:23 - Delay Before SCK"]
38    #[inline(always)]
39    pub fn dlybs(&self) -> DlybsR {
40        DlybsR::new(((self.bits >> 16) & 0xff) as u8)
41    }
42}
43impl W {
44    #[doc = "Bit 0 - Clock Polarity"]
45    #[inline(always)]
46    #[must_use]
47    pub fn cpol(&mut self) -> CpolW<BaudSpec> {
48        CpolW::new(self, 0)
49    }
50    #[doc = "Bit 1 - Clock Phase"]
51    #[inline(always)]
52    #[must_use]
53    pub fn cpha(&mut self) -> CphaW<BaudSpec> {
54        CphaW::new(self, 1)
55    }
56    #[doc = "Bits 8:15 - Serial Clock Baud Rate"]
57    #[inline(always)]
58    #[must_use]
59    pub fn baud(&mut self) -> BaudW<BaudSpec> {
60        BaudW::new(self, 8)
61    }
62    #[doc = "Bits 16:23 - Delay Before SCK"]
63    #[inline(always)]
64    #[must_use]
65    pub fn dlybs(&mut self) -> DlybsW<BaudSpec> {
66        DlybsW::new(self, 16)
67    }
68}
69#[doc = "Baud Rate\n\nYou can [`read`](crate::Reg::read) this register and get [`baud::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`baud::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
70pub struct BaudSpec;
71impl crate::RegisterSpec for BaudSpec {
72    type Ux = u32;
73}
74#[doc = "`read()` method returns [`baud::R`](R) reader structure"]
75impl crate::Readable for BaudSpec {}
76#[doc = "`write(|w| ..)` method takes [`baud::W`](W) writer structure"]
77impl crate::Writable for BaudSpec {
78    type Safety = crate::Unsafe;
79    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
80    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
81}
82#[doc = "`reset()` method sets BAUD to value 0"]
83impl crate::Resettable for BaudSpec {
84    const RESET_VALUE: u32 = 0;
85}