efm32gg_pac/efm32gg995/lcd/
ctrl.rs1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CTRL_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<CTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `EN` reader - LCD Enable"]
38pub type EN_R = crate::BitReader<bool>;
39#[doc = "Field `EN` writer - LCD Enable"]
40pub type EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
41#[doc = "Field `UDCTRL` reader - Update Data Control"]
42pub type UDCTRL_R = crate::FieldReader<u8, UDCTRL_A>;
43#[doc = "Update Data Control\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum UDCTRL_A {
47 #[doc = "0: The data transfer is controlled by SW. Transfer is performed as soon as possible"]
48 REGULAR = 0,
49 #[doc = "1: The data transfer is done at the next event triggered by the Frame Counter"]
50 FCEVENT = 1,
51 #[doc = "2: The data transfer is done continuously at every LCD frame start"]
52 FRAMESTART = 2,
53}
54impl From<UDCTRL_A> for u8 {
55 #[inline(always)]
56 fn from(variant: UDCTRL_A) -> Self {
57 variant as _
58 }
59}
60impl UDCTRL_R {
61 #[doc = "Get enumerated values variant"]
62 #[inline(always)]
63 pub fn variant(&self) -> Option<UDCTRL_A> {
64 match self.bits {
65 0 => Some(UDCTRL_A::REGULAR),
66 1 => Some(UDCTRL_A::FCEVENT),
67 2 => Some(UDCTRL_A::FRAMESTART),
68 _ => None,
69 }
70 }
71 #[doc = "Checks if the value of the field is `REGULAR`"]
72 #[inline(always)]
73 pub fn is_regular(&self) -> bool {
74 *self == UDCTRL_A::REGULAR
75 }
76 #[doc = "Checks if the value of the field is `FCEVENT`"]
77 #[inline(always)]
78 pub fn is_fcevent(&self) -> bool {
79 *self == UDCTRL_A::FCEVENT
80 }
81 #[doc = "Checks if the value of the field is `FRAMESTART`"]
82 #[inline(always)]
83 pub fn is_framestart(&self) -> bool {
84 *self == UDCTRL_A::FRAMESTART
85 }
86}
87#[doc = "Field `UDCTRL` writer - Update Data Control"]
88pub type UDCTRL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, UDCTRL_A, 2, O>;
89impl<'a, const O: u8> UDCTRL_W<'a, O> {
90 #[doc = "The data transfer is controlled by SW. Transfer is performed as soon as possible"]
91 #[inline(always)]
92 pub fn regular(self) -> &'a mut W {
93 self.variant(UDCTRL_A::REGULAR)
94 }
95 #[doc = "The data transfer is done at the next event triggered by the Frame Counter"]
96 #[inline(always)]
97 pub fn fcevent(self) -> &'a mut W {
98 self.variant(UDCTRL_A::FCEVENT)
99 }
100 #[doc = "The data transfer is done continuously at every LCD frame start"]
101 #[inline(always)]
102 pub fn framestart(self) -> &'a mut W {
103 self.variant(UDCTRL_A::FRAMESTART)
104 }
105}
106#[doc = "Field `DSC` reader - Direct Segment Control"]
107pub type DSC_R = crate::BitReader<bool>;
108#[doc = "Field `DSC` writer - Direct Segment Control"]
109pub type DSC_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
110impl R {
111 #[doc = "Bit 0 - LCD Enable"]
112 #[inline(always)]
113 pub fn en(&self) -> EN_R {
114 EN_R::new((self.bits & 1) != 0)
115 }
116 #[doc = "Bits 1:2 - Update Data Control"]
117 #[inline(always)]
118 pub fn udctrl(&self) -> UDCTRL_R {
119 UDCTRL_R::new(((self.bits >> 1) & 3) as u8)
120 }
121 #[doc = "Bit 23 - Direct Segment Control"]
122 #[inline(always)]
123 pub fn dsc(&self) -> DSC_R {
124 DSC_R::new(((self.bits >> 23) & 1) != 0)
125 }
126}
127impl W {
128 #[doc = "Bit 0 - LCD Enable"]
129 #[inline(always)]
130 #[must_use]
131 pub fn en(&mut self) -> EN_W<0> {
132 EN_W::new(self)
133 }
134 #[doc = "Bits 1:2 - Update Data Control"]
135 #[inline(always)]
136 #[must_use]
137 pub fn udctrl(&mut self) -> UDCTRL_W<1> {
138 UDCTRL_W::new(self)
139 }
140 #[doc = "Bit 23 - Direct Segment Control"]
141 #[inline(always)]
142 #[must_use]
143 pub fn dsc(&mut self) -> DSC_W<23> {
144 DSC_W::new(self)
145 }
146 #[doc = "Writes raw bits to the register."]
147 #[inline(always)]
148 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
149 self.0.bits(bits);
150 self
151 }
152}
153#[doc = "Control Register\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 [ctrl](index.html) module"]
154pub struct CTRL_SPEC;
155impl crate::RegisterSpec for CTRL_SPEC {
156 type Ux = u32;
157}
158#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
159impl crate::Readable for CTRL_SPEC {
160 type Reader = R;
161}
162#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
163impl crate::Writable for CTRL_SPEC {
164 type Writer = W;
165 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
166 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
167}
168#[doc = "`reset()` method sets CTRL to value 0"]
169impl crate::Resettable for CTRL_SPEC {
170 const RESET_VALUE: Self::Ux = 0;
171}