d1_pac/tve_top/
tve_dac_map.rs1#[doc = "Register `tve_dac_map` reader"]
2pub type R = crate::R<TVE_DAC_MAP_SPEC>;
3#[doc = "Register `tve_dac_map` writer"]
4pub type W = crate::W<TVE_DAC_MAP_SPEC>;
5#[doc = "Field `dac_sel` reader - "]
6pub type DAC_SEL_R = crate::FieldReader<DAC_SEL_A>;
7#[doc = "\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum DAC_SEL_A {
11 #[doc = "1: TVE0"]
12 TVE0 = 1,
13}
14impl From<DAC_SEL_A> for u8 {
15 #[inline(always)]
16 fn from(variant: DAC_SEL_A) -> Self {
17 variant as _
18 }
19}
20impl crate::FieldSpec for DAC_SEL_A {
21 type Ux = u8;
22}
23impl DAC_SEL_R {
24 #[doc = "Get enumerated values variant"]
25 #[inline(always)]
26 pub const fn variant(&self) -> Option<DAC_SEL_A> {
27 match self.bits {
28 1 => Some(DAC_SEL_A::TVE0),
29 _ => None,
30 }
31 }
32 #[doc = "TVE0"]
33 #[inline(always)]
34 pub fn is_tve0(&self) -> bool {
35 *self == DAC_SEL_A::TVE0
36 }
37}
38#[doc = "Field `dac_sel` writer - "]
39pub type DAC_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, DAC_SEL_A>;
40impl<'a, REG> DAC_SEL_W<'a, REG>
41where
42 REG: crate::Writable + crate::RegisterSpec,
43 REG::Ux: From<u8>,
44{
45 #[doc = "TVE0"]
46 #[inline(always)]
47 pub fn tve0(self) -> &'a mut crate::W<REG> {
48 self.variant(DAC_SEL_A::TVE0)
49 }
50}
51#[doc = "Field `dac_map` reader - "]
52pub type DAC_MAP_R = crate::FieldReader<DAC_MAP_A>;
53#[doc = "\n\nValue on reset: 0"]
54#[derive(Clone, Copy, Debug, PartialEq, Eq)]
55#[repr(u8)]
56pub enum DAC_MAP_A {
57 #[doc = "0: OUT0"]
58 OUT0 = 0,
59}
60impl From<DAC_MAP_A> for u8 {
61 #[inline(always)]
62 fn from(variant: DAC_MAP_A) -> Self {
63 variant as _
64 }
65}
66impl crate::FieldSpec for DAC_MAP_A {
67 type Ux = u8;
68}
69impl DAC_MAP_R {
70 #[doc = "Get enumerated values variant"]
71 #[inline(always)]
72 pub const fn variant(&self) -> Option<DAC_MAP_A> {
73 match self.bits {
74 0 => Some(DAC_MAP_A::OUT0),
75 _ => None,
76 }
77 }
78 #[doc = "OUT0"]
79 #[inline(always)]
80 pub fn is_out0(&self) -> bool {
81 *self == DAC_MAP_A::OUT0
82 }
83}
84#[doc = "Field `dac_map` writer - "]
85pub type DAC_MAP_W<'a, REG> = crate::FieldWriter<'a, REG, 3, DAC_MAP_A>;
86impl<'a, REG> DAC_MAP_W<'a, REG>
87where
88 REG: crate::Writable + crate::RegisterSpec,
89 REG::Ux: From<u8>,
90{
91 #[doc = "OUT0"]
92 #[inline(always)]
93 pub fn out0(self) -> &'a mut crate::W<REG> {
94 self.variant(DAC_MAP_A::OUT0)
95 }
96}
97impl R {
98 #[doc = "Bits 0:1"]
99 #[inline(always)]
100 pub fn dac_sel(&self) -> DAC_SEL_R {
101 DAC_SEL_R::new((self.bits & 3) as u8)
102 }
103 #[doc = "Bits 4:6"]
104 #[inline(always)]
105 pub fn dac_map(&self) -> DAC_MAP_R {
106 DAC_MAP_R::new(((self.bits >> 4) & 7) as u8)
107 }
108}
109impl W {
110 #[doc = "Bits 0:1"]
111 #[inline(always)]
112 #[must_use]
113 pub fn dac_sel(&mut self) -> DAC_SEL_W<TVE_DAC_MAP_SPEC> {
114 DAC_SEL_W::new(self, 0)
115 }
116 #[doc = "Bits 4:6"]
117 #[inline(always)]
118 #[must_use]
119 pub fn dac_map(&mut self) -> DAC_MAP_W<TVE_DAC_MAP_SPEC> {
120 DAC_MAP_W::new(self, 4)
121 }
122 #[doc = r" Writes raw bits to the register."]
123 #[doc = r""]
124 #[doc = r" # Safety"]
125 #[doc = r""]
126 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
127 #[inline(always)]
128 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
129 self.bits = bits;
130 self
131 }
132}
133#[doc = "TV Encoder DAC MAP Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`tve_dac_map::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 [`tve_dac_map::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
134pub struct TVE_DAC_MAP_SPEC;
135impl crate::RegisterSpec for TVE_DAC_MAP_SPEC {
136 type Ux = u32;
137}
138#[doc = "`read()` method returns [`tve_dac_map::R`](R) reader structure"]
139impl crate::Readable for TVE_DAC_MAP_SPEC {}
140#[doc = "`write(|w| ..)` method takes [`tve_dac_map::W`](W) writer structure"]
141impl crate::Writable for TVE_DAC_MAP_SPEC {
142 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
143 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
144}
145#[doc = "`reset()` method sets tve_dac_map to value 0"]
146impl crate::Resettable for TVE_DAC_MAP_SPEC {
147 const RESET_VALUE: Self::Ux = 0;
148}