s32k144_pac/lpit0/
tval0.rs1#[doc = "Register `TVAL0` reader"]
2pub struct R(crate::R<TVAL0_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<TVAL0_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<TVAL0_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<TVAL0_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `TVAL0` writer"]
17pub struct W(crate::W<TVAL0_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<TVAL0_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<TVAL0_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<TVAL0_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Timer Value\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u32)]
40pub enum TMR_VAL_A {
41 #[doc = "0: Invalid load value in compare modes."]
42 _0 = 0,
43 #[doc = "1: Invalid load value in compare modes."]
44 _1 = 1,
45}
46impl From<TMR_VAL_A> for u32 {
47 #[inline(always)]
48 fn from(variant: TMR_VAL_A) -> Self {
49 variant as _
50 }
51}
52#[doc = "Field `TMR_VAL` reader - Timer Value"]
53pub struct TMR_VAL_R(crate::FieldReader<u32, TMR_VAL_A>);
54impl TMR_VAL_R {
55 #[inline(always)]
56 pub(crate) fn new(bits: u32) -> Self {
57 TMR_VAL_R(crate::FieldReader::new(bits))
58 }
59 #[doc = r"Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> Option<TMR_VAL_A> {
62 match self.bits {
63 0 => Some(TMR_VAL_A::_0),
64 1 => Some(TMR_VAL_A::_1),
65 _ => None,
66 }
67 }
68 #[doc = "Checks if the value of the field is `_0`"]
69 #[inline(always)]
70 pub fn is_0(&self) -> bool {
71 **self == TMR_VAL_A::_0
72 }
73 #[doc = "Checks if the value of the field is `_1`"]
74 #[inline(always)]
75 pub fn is_1(&self) -> bool {
76 **self == TMR_VAL_A::_1
77 }
78}
79impl core::ops::Deref for TMR_VAL_R {
80 type Target = crate::FieldReader<u32, TMR_VAL_A>;
81 #[inline(always)]
82 fn deref(&self) -> &Self::Target {
83 &self.0
84 }
85}
86#[doc = "Field `TMR_VAL` writer - Timer Value"]
87pub struct TMR_VAL_W<'a> {
88 w: &'a mut W,
89}
90impl<'a> TMR_VAL_W<'a> {
91 #[doc = r"Writes `variant` to the field"]
92 #[inline(always)]
93 pub fn variant(self, variant: TMR_VAL_A) -> &'a mut W {
94 unsafe { self.bits(variant.into()) }
95 }
96 #[doc = "Invalid load value in compare modes."]
97 #[inline(always)]
98 pub fn _0(self) -> &'a mut W {
99 self.variant(TMR_VAL_A::_0)
100 }
101 #[doc = "Invalid load value in compare modes."]
102 #[inline(always)]
103 pub fn _1(self) -> &'a mut W {
104 self.variant(TMR_VAL_A::_1)
105 }
106 #[doc = r"Writes raw bits to the field"]
107 #[inline(always)]
108 pub unsafe fn bits(self, value: u32) -> &'a mut W {
109 self.w.bits = value;
110 self.w
111 }
112}
113impl R {
114 #[doc = "Bits 0:31 - Timer Value"]
115 #[inline(always)]
116 pub fn tmr_val(&self) -> TMR_VAL_R {
117 TMR_VAL_R::new(self.bits)
118 }
119}
120impl W {
121 #[doc = "Bits 0:31 - Timer Value"]
122 #[inline(always)]
123 pub fn tmr_val(&mut self) -> TMR_VAL_W {
124 TMR_VAL_W { w: self }
125 }
126 #[doc = "Writes raw bits to the register."]
127 #[inline(always)]
128 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
129 self.0.bits(bits);
130 self
131 }
132}
133#[doc = "Timer Value 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 [tval0](index.html) module"]
134pub struct TVAL0_SPEC;
135impl crate::RegisterSpec for TVAL0_SPEC {
136 type Ux = u32;
137}
138#[doc = "`read()` method returns [tval0::R](R) reader structure"]
139impl crate::Readable for TVAL0_SPEC {
140 type Reader = R;
141}
142#[doc = "`write(|w| ..)` method takes [tval0::W](W) writer structure"]
143impl crate::Writable for TVAL0_SPEC {
144 type Writer = W;
145}
146#[doc = "`reset()` method sets TVAL0 to value 0"]
147impl crate::Resettable for TVAL0_SPEC {
148 #[inline(always)]
149 fn reset_value() -> Self::Ux {
150 0
151 }
152}