d1_pac/tcon_tv0/
tv_safe_period.rs1#[doc = "Register `tv_safe_period` reader"]
2pub type R = crate::R<TV_SAFE_PERIOD_SPEC>;
3#[doc = "Register `tv_safe_period` writer"]
4pub type W = crate::W<TV_SAFE_PERIOD_SPEC>;
5#[doc = "Field `safe_period_mode` reader - Safe Period Mode"]
6pub type SAFE_PERIOD_MODE_R = crate::FieldReader<SAFE_PERIOD_MODE_A>;
7#[doc = "Safe Period Mode\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum SAFE_PERIOD_MODE_A {
11 #[doc = "0: unsafe"]
12 UNSAFE = 0,
13 #[doc = "1: safe"]
14 SAFE = 1,
15 #[doc = "2: safe at LINE_BUF_CURR_NUM > SAFE_PERIOD_FIFO_NUM"]
16 SAFE_LINE_BUF_CURR_NUM_GT_SAFE_PERIOD_FIFO_NUM = 2,
17 #[doc = "3: safe at 2 and safe at sync active"]
18 SAFE_2_SYNC_ACTIVE = 3,
19 #[doc = "4: safe at line"]
20 SAFE_LINE = 4,
21}
22impl From<SAFE_PERIOD_MODE_A> for u8 {
23 #[inline(always)]
24 fn from(variant: SAFE_PERIOD_MODE_A) -> Self {
25 variant as _
26 }
27}
28impl crate::FieldSpec for SAFE_PERIOD_MODE_A {
29 type Ux = u8;
30}
31impl SAFE_PERIOD_MODE_R {
32 #[doc = "Get enumerated values variant"]
33 #[inline(always)]
34 pub const fn variant(&self) -> Option<SAFE_PERIOD_MODE_A> {
35 match self.bits {
36 0 => Some(SAFE_PERIOD_MODE_A::UNSAFE),
37 1 => Some(SAFE_PERIOD_MODE_A::SAFE),
38 2 => Some(SAFE_PERIOD_MODE_A::SAFE_LINE_BUF_CURR_NUM_GT_SAFE_PERIOD_FIFO_NUM),
39 3 => Some(SAFE_PERIOD_MODE_A::SAFE_2_SYNC_ACTIVE),
40 4 => Some(SAFE_PERIOD_MODE_A::SAFE_LINE),
41 _ => None,
42 }
43 }
44 #[doc = "unsafe"]
45 #[inline(always)]
46 pub fn is_unsafe(&self) -> bool {
47 *self == SAFE_PERIOD_MODE_A::UNSAFE
48 }
49 #[doc = "safe"]
50 #[inline(always)]
51 pub fn is_safe(&self) -> bool {
52 *self == SAFE_PERIOD_MODE_A::SAFE
53 }
54 #[doc = "safe at LINE_BUF_CURR_NUM > SAFE_PERIOD_FIFO_NUM"]
55 #[inline(always)]
56 pub fn is_safe_line_buf_curr_num_gt_safe_period_fifo_num(&self) -> bool {
57 *self == SAFE_PERIOD_MODE_A::SAFE_LINE_BUF_CURR_NUM_GT_SAFE_PERIOD_FIFO_NUM
58 }
59 #[doc = "safe at 2 and safe at sync active"]
60 #[inline(always)]
61 pub fn is_safe_2_sync_active(&self) -> bool {
62 *self == SAFE_PERIOD_MODE_A::SAFE_2_SYNC_ACTIVE
63 }
64 #[doc = "safe at line"]
65 #[inline(always)]
66 pub fn is_safe_line(&self) -> bool {
67 *self == SAFE_PERIOD_MODE_A::SAFE_LINE
68 }
69}
70#[doc = "Field `safe_period_mode` writer - Safe Period Mode"]
71pub type SAFE_PERIOD_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, SAFE_PERIOD_MODE_A>;
72impl<'a, REG> SAFE_PERIOD_MODE_W<'a, REG>
73where
74 REG: crate::Writable + crate::RegisterSpec,
75 REG::Ux: From<u8>,
76{
77 #[doc = "unsafe"]
78 #[inline(always)]
79 pub fn unsafe_(self) -> &'a mut crate::W<REG> {
80 self.variant(SAFE_PERIOD_MODE_A::UNSAFE)
81 }
82 #[doc = "safe"]
83 #[inline(always)]
84 pub fn safe(self) -> &'a mut crate::W<REG> {
85 self.variant(SAFE_PERIOD_MODE_A::SAFE)
86 }
87 #[doc = "safe at LINE_BUF_CURR_NUM > SAFE_PERIOD_FIFO_NUM"]
88 #[inline(always)]
89 pub fn safe_line_buf_curr_num_gt_safe_period_fifo_num(self) -> &'a mut crate::W<REG> {
90 self.variant(SAFE_PERIOD_MODE_A::SAFE_LINE_BUF_CURR_NUM_GT_SAFE_PERIOD_FIFO_NUM)
91 }
92 #[doc = "safe at 2 and safe at sync active"]
93 #[inline(always)]
94 pub fn safe_2_sync_active(self) -> &'a mut crate::W<REG> {
95 self.variant(SAFE_PERIOD_MODE_A::SAFE_2_SYNC_ACTIVE)
96 }
97 #[doc = "safe at line"]
98 #[inline(always)]
99 pub fn safe_line(self) -> &'a mut crate::W<REG> {
100 self.variant(SAFE_PERIOD_MODE_A::SAFE_LINE)
101 }
102}
103#[doc = "Field `safe_period_line` reader - Safe Period Line"]
104pub type SAFE_PERIOD_LINE_R = crate::FieldReader<u16>;
105#[doc = "Field `safe_period_line` writer - Safe Period Line"]
106pub type SAFE_PERIOD_LINE_W<'a, REG> = crate::FieldWriter<'a, REG, 12, u16>;
107#[doc = "Field `safe_period_fifo_num` reader - Safe Period FIFO Number"]
108pub type SAFE_PERIOD_FIFO_NUM_R = crate::FieldReader<u16>;
109#[doc = "Field `safe_period_fifo_num` writer - Safe Period FIFO Number"]
110pub type SAFE_PERIOD_FIFO_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 13, u16>;
111impl R {
112 #[doc = "Bits 0:2 - Safe Period Mode"]
113 #[inline(always)]
114 pub fn safe_period_mode(&self) -> SAFE_PERIOD_MODE_R {
115 SAFE_PERIOD_MODE_R::new((self.bits & 7) as u8)
116 }
117 #[doc = "Bits 4:15 - Safe Period Line"]
118 #[inline(always)]
119 pub fn safe_period_line(&self) -> SAFE_PERIOD_LINE_R {
120 SAFE_PERIOD_LINE_R::new(((self.bits >> 4) & 0x0fff) as u16)
121 }
122 #[doc = "Bits 16:28 - Safe Period FIFO Number"]
123 #[inline(always)]
124 pub fn safe_period_fifo_num(&self) -> SAFE_PERIOD_FIFO_NUM_R {
125 SAFE_PERIOD_FIFO_NUM_R::new(((self.bits >> 16) & 0x1fff) as u16)
126 }
127}
128impl W {
129 #[doc = "Bits 0:2 - Safe Period Mode"]
130 #[inline(always)]
131 #[must_use]
132 pub fn safe_period_mode(&mut self) -> SAFE_PERIOD_MODE_W<TV_SAFE_PERIOD_SPEC> {
133 SAFE_PERIOD_MODE_W::new(self, 0)
134 }
135 #[doc = "Bits 4:15 - Safe Period Line"]
136 #[inline(always)]
137 #[must_use]
138 pub fn safe_period_line(&mut self) -> SAFE_PERIOD_LINE_W<TV_SAFE_PERIOD_SPEC> {
139 SAFE_PERIOD_LINE_W::new(self, 4)
140 }
141 #[doc = "Bits 16:28 - Safe Period FIFO Number"]
142 #[inline(always)]
143 #[must_use]
144 pub fn safe_period_fifo_num(&mut self) -> SAFE_PERIOD_FIFO_NUM_W<TV_SAFE_PERIOD_SPEC> {
145 SAFE_PERIOD_FIFO_NUM_W::new(self, 16)
146 }
147 #[doc = r" Writes raw bits to the register."]
148 #[doc = r""]
149 #[doc = r" # Safety"]
150 #[doc = r""]
151 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
152 #[inline(always)]
153 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
154 self.bits = bits;
155 self
156 }
157}
158#[doc = "TV Safe Period Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tv_safe_period::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 [`tv_safe_period::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
159pub struct TV_SAFE_PERIOD_SPEC;
160impl crate::RegisterSpec for TV_SAFE_PERIOD_SPEC {
161 type Ux = u32;
162}
163#[doc = "`read()` method returns [`tv_safe_period::R`](R) reader structure"]
164impl crate::Readable for TV_SAFE_PERIOD_SPEC {}
165#[doc = "`write(|w| ..)` method takes [`tv_safe_period::W`](W) writer structure"]
166impl crate::Writable for TV_SAFE_PERIOD_SPEC {
167 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
168 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
169}
170#[doc = "`reset()` method sets tv_safe_period to value 0"]
171impl crate::Resettable for TV_SAFE_PERIOD_SPEC {
172 const RESET_VALUE: Self::Ux = 0;
173}