eos_s3/iomux/
spi_sensor_miso_sel.rs1#[doc = "Register `SPI_SENSOR_MISO_SEL` reader"]
2pub struct R(crate::R<SPI_SENSOR_MISO_SEL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SPI_SENSOR_MISO_SEL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SPI_SENSOR_MISO_SEL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SPI_SENSOR_MISO_SEL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `SPI_SENSOR_MISO_SEL` writer"]
17pub struct W(crate::W<SPI_SENSOR_MISO_SEL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<SPI_SENSOR_MISO_SEL_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<SPI_SENSOR_MISO_SEL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<SPI_SENSOR_MISO_SEL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Sel\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum SEL_A {
41 #[doc = "0: undefined (0:0 in documentation)"]
42 UNDEFINED = 0,
43 #[doc = "1: Selects pad #8 for sensor SPI MISO"]
44 PAD_08 = 1,
45 #[doc = "2: Selects pad #29 for sensor SPI MISO"]
46 PAD_29 = 2,
47}
48impl From<SEL_A> for u8 {
49 #[inline(always)]
50 fn from(variant: SEL_A) -> Self {
51 variant as _
52 }
53}
54#[doc = "Field `SEL` reader - Sel"]
55pub struct SEL_R(crate::FieldReader<u8, SEL_A>);
56impl SEL_R {
57 #[inline(always)]
58 pub(crate) fn new(bits: u8) -> Self {
59 SEL_R(crate::FieldReader::new(bits))
60 }
61 #[doc = r"Get enumerated values variant"]
62 #[inline(always)]
63 pub fn variant(&self) -> Option<SEL_A> {
64 match self.bits {
65 0 => Some(SEL_A::UNDEFINED),
66 1 => Some(SEL_A::PAD_08),
67 2 => Some(SEL_A::PAD_29),
68 _ => None,
69 }
70 }
71 #[doc = "Checks if the value of the field is `UNDEFINED`"]
72 #[inline(always)]
73 pub fn is_undefined(&self) -> bool {
74 **self == SEL_A::UNDEFINED
75 }
76 #[doc = "Checks if the value of the field is `PAD_08`"]
77 #[inline(always)]
78 pub fn is_pad_08(&self) -> bool {
79 **self == SEL_A::PAD_08
80 }
81 #[doc = "Checks if the value of the field is `PAD_29`"]
82 #[inline(always)]
83 pub fn is_pad_29(&self) -> bool {
84 **self == SEL_A::PAD_29
85 }
86}
87impl core::ops::Deref for SEL_R {
88 type Target = crate::FieldReader<u8, SEL_A>;
89 #[inline(always)]
90 fn deref(&self) -> &Self::Target {
91 &self.0
92 }
93}
94#[doc = "Field `SEL` writer - Sel"]
95pub struct SEL_W<'a> {
96 w: &'a mut W,
97}
98impl<'a> SEL_W<'a> {
99 #[doc = r"Writes `variant` to the field"]
100 #[inline(always)]
101 pub fn variant(self, variant: SEL_A) -> &'a mut W {
102 unsafe { self.bits(variant.into()) }
103 }
104 #[doc = "undefined (0:0 in documentation)"]
105 #[inline(always)]
106 pub fn undefined(self) -> &'a mut W {
107 self.variant(SEL_A::UNDEFINED)
108 }
109 #[doc = "Selects pad #8 for sensor SPI MISO"]
110 #[inline(always)]
111 pub fn pad_08(self) -> &'a mut W {
112 self.variant(SEL_A::PAD_08)
113 }
114 #[doc = "Selects pad #29 for sensor SPI MISO"]
115 #[inline(always)]
116 pub fn pad_29(self) -> &'a mut W {
117 self.variant(SEL_A::PAD_29)
118 }
119 #[doc = r"Writes raw bits to the field"]
120 #[inline(always)]
121 pub unsafe fn bits(self, value: u8) -> &'a mut W {
122 self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
123 self.w
124 }
125}
126impl R {
127 #[doc = "Bits 0:1 - Sel"]
128 #[inline(always)]
129 pub fn sel(&self) -> SEL_R {
130 SEL_R::new((self.bits & 0x03) as u8)
131 }
132}
133impl W {
134 #[doc = "Bits 0:1 - Sel"]
135 #[inline(always)]
136 pub fn sel(&mut self) -> SEL_W {
137 SEL_W { w: self }
138 }
139 #[doc = "Writes raw bits to the register."]
140 #[inline(always)]
141 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
142 self.0.bits(bits);
143 self
144 }
145}
146#[doc = "Selects pad for MISO function for the sensor SPI\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 [spi_sensor_miso_sel](index.html) module"]
147pub struct SPI_SENSOR_MISO_SEL_SPEC;
148impl crate::RegisterSpec for SPI_SENSOR_MISO_SEL_SPEC {
149 type Ux = u32;
150}
151#[doc = "`read()` method returns [spi_sensor_miso_sel::R](R) reader structure"]
152impl crate::Readable for SPI_SENSOR_MISO_SEL_SPEC {
153 type Reader = R;
154}
155#[doc = "`write(|w| ..)` method takes [spi_sensor_miso_sel::W](W) writer structure"]
156impl crate::Writable for SPI_SENSOR_MISO_SEL_SPEC {
157 type Writer = W;
158}
159#[doc = "`reset()` method sets SPI_SENSOR_MISO_SEL to value 0"]
160impl crate::Resettable for SPI_SENSOR_MISO_SEL_SPEC {
161 #[inline(always)]
162 fn reset_value() -> Self::Ux {
163 0
164 }
165}