bl808_pac/i2c/
period_start.rs1#[doc = "Register `period_start` reader"]
2pub struct R(crate::R<PERIOD_START_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PERIOD_START_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PERIOD_START_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PERIOD_START_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `period_start` writer"]
17pub struct W(crate::W<PERIOD_START_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PERIOD_START_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<PERIOD_START_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PERIOD_START_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `phase[0-3]` reader - Length of start condition phase %s"]
38pub type PHASE_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `phase[0-3]` writer - Length of start condition phase %s"]
40pub type PHASE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PERIOD_START_SPEC, u8, u8, 8, O>;
41impl R {
42 #[doc = "Length of start condition phase [0-3]"]
43 #[inline(always)]
44 pub unsafe fn phase(&self, n: u8) -> PHASE_R {
45 PHASE_R::new(((self.bits >> (n * 8)) & 0xff) as u8)
46 }
47 #[doc = "Bits 0:7 - Length of start condition phase 0"]
48 #[inline(always)]
49 pub fn phase0(&self) -> PHASE_R {
50 PHASE_R::new((self.bits & 0xff) as u8)
51 }
52 #[doc = "Bits 8:15 - Length of start condition phase 1"]
53 #[inline(always)]
54 pub fn phase1(&self) -> PHASE_R {
55 PHASE_R::new(((self.bits >> 8) & 0xff) as u8)
56 }
57 #[doc = "Bits 16:23 - Length of start condition phase 2"]
58 #[inline(always)]
59 pub fn phase2(&self) -> PHASE_R {
60 PHASE_R::new(((self.bits >> 16) & 0xff) as u8)
61 }
62 #[doc = "Bits 24:31 - Length of start condition phase 3"]
63 #[inline(always)]
64 pub fn phase3(&self) -> PHASE_R {
65 PHASE_R::new(((self.bits >> 24) & 0xff) as u8)
66 }
67}
68impl W {
69 #[doc = "Length of start condition phase [0-3]"]
70 #[inline(always)]
71 pub unsafe fn phase<const O: u8>(&mut self) -> PHASE_W<O> {
72 PHASE_W::new(self)
73 }
74 #[doc = "Bits 0:7 - Length of start condition phase 0"]
75 #[inline(always)]
76 pub fn phase0(&mut self) -> PHASE_W<0> {
77 PHASE_W::new(self)
78 }
79 #[doc = "Bits 8:15 - Length of start condition phase 1"]
80 #[inline(always)]
81 pub fn phase1(&mut self) -> PHASE_W<8> {
82 PHASE_W::new(self)
83 }
84 #[doc = "Bits 16:23 - Length of start condition phase 2"]
85 #[inline(always)]
86 pub fn phase2(&mut self) -> PHASE_W<16> {
87 PHASE_W::new(self)
88 }
89 #[doc = "Bits 24:31 - Length of start condition phase 3"]
90 #[inline(always)]
91 pub fn phase3(&mut self) -> PHASE_W<24> {
92 PHASE_W::new(self)
93 }
94 #[doc = "Writes raw bits to the register."]
95 #[inline(always)]
96 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
97 self.0.bits(bits);
98 self
99 }
100}
101#[doc = "Duration of start phase\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 [period_start](index.html) module"]
102pub struct PERIOD_START_SPEC;
103impl crate::RegisterSpec for PERIOD_START_SPEC {
104 type Ux = u32;
105}
106#[doc = "`read()` method returns [period_start::R](R) reader structure"]
107impl crate::Readable for PERIOD_START_SPEC {
108 type Reader = R;
109}
110#[doc = "`write(|w| ..)` method takes [period_start::W](W) writer structure"]
111impl crate::Writable for PERIOD_START_SPEC {
112 type Writer = W;
113}
114#[doc = "`reset()` method sets period_start to value 0x0f0f_0f0f"]
115impl crate::Resettable for PERIOD_START_SPEC {
116 #[inline(always)]
117 fn reset_value() -> Self::Ux {
118 0x0f0f_0f0f
119 }
120}