stm32f1_staging/stm32f101/gpioa/
idr.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
///Register `IDR` reader
pub type R = crate::R<IDRrs>;
/**Port input data

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum IDR0 {
    ///0: Input is logic low
    Low = 0,
    ///1: Input is logic high
    High = 1,
}
impl From<IDR0> for bool {
    #[inline(always)]
    fn from(variant: IDR0) -> Self {
        variant as u8 != 0
    }
}
///Field `IDR(0-15)` reader - Port input data
pub type IDR_R = crate::BitReader<IDR0>;
impl IDR_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> IDR0 {
        match self.bits {
            false => IDR0::Low,
            true => IDR0::High,
        }
    }
    ///Input is logic low
    #[inline(always)]
    pub fn is_low(&self) -> bool {
        *self == IDR0::Low
    }
    ///Input is logic high
    #[inline(always)]
    pub fn is_high(&self) -> bool {
        *self == IDR0::High
    }
}
impl R {
    ///Port input data
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `IDR0` field.</div>
    #[inline(always)]
    pub fn idr(&self, n: u8) -> IDR_R {
        #[allow(clippy::no_effect)]
        [(); 16][n as usize];
        IDR_R::new(((self.bits >> n) & 1) != 0)
    }
    ///Iterator for array of:
    ///Port input data
    #[inline(always)]
    pub fn idr_iter(&self) -> impl Iterator<Item = IDR_R> + '_ {
        (0..16).map(move |n| IDR_R::new(((self.bits >> n) & 1) != 0))
    }
    ///Bit 0 - Port input data
    #[inline(always)]
    pub fn idr0(&self) -> IDR_R {
        IDR_R::new((self.bits & 1) != 0)
    }
    ///Bit 1 - Port input data
    #[inline(always)]
    pub fn idr1(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 1) & 1) != 0)
    }
    ///Bit 2 - Port input data
    #[inline(always)]
    pub fn idr2(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 2) & 1) != 0)
    }
    ///Bit 3 - Port input data
    #[inline(always)]
    pub fn idr3(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 3) & 1) != 0)
    }
    ///Bit 4 - Port input data
    #[inline(always)]
    pub fn idr4(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 4) & 1) != 0)
    }
    ///Bit 5 - Port input data
    #[inline(always)]
    pub fn idr5(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 5) & 1) != 0)
    }
    ///Bit 6 - Port input data
    #[inline(always)]
    pub fn idr6(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 6) & 1) != 0)
    }
    ///Bit 7 - Port input data
    #[inline(always)]
    pub fn idr7(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 7) & 1) != 0)
    }
    ///Bit 8 - Port input data
    #[inline(always)]
    pub fn idr8(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 8) & 1) != 0)
    }
    ///Bit 9 - Port input data
    #[inline(always)]
    pub fn idr9(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 9) & 1) != 0)
    }
    ///Bit 10 - Port input data
    #[inline(always)]
    pub fn idr10(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 10) & 1) != 0)
    }
    ///Bit 11 - Port input data
    #[inline(always)]
    pub fn idr11(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 11) & 1) != 0)
    }
    ///Bit 12 - Port input data
    #[inline(always)]
    pub fn idr12(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 12) & 1) != 0)
    }
    ///Bit 13 - Port input data
    #[inline(always)]
    pub fn idr13(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 13) & 1) != 0)
    }
    ///Bit 14 - Port input data
    #[inline(always)]
    pub fn idr14(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 14) & 1) != 0)
    }
    ///Bit 15 - Port input data
    #[inline(always)]
    pub fn idr15(&self) -> IDR_R {
        IDR_R::new(((self.bits >> 15) & 1) != 0)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("IDR")
            .field("idr0", &self.idr0())
            .field("idr1", &self.idr1())
            .field("idr2", &self.idr2())
            .field("idr3", &self.idr3())
            .field("idr4", &self.idr4())
            .field("idr5", &self.idr5())
            .field("idr6", &self.idr6())
            .field("idr7", &self.idr7())
            .field("idr8", &self.idr8())
            .field("idr9", &self.idr9())
            .field("idr10", &self.idr10())
            .field("idr11", &self.idr11())
            .field("idr12", &self.idr12())
            .field("idr13", &self.idr13())
            .field("idr14", &self.idr14())
            .field("idr15", &self.idr15())
            .finish()
    }
}
/**Port input data register (GPIOn_IDR)

You can [`read`](crate::Reg::read) this register and get [`idr::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api).

See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F101.html#GPIOA:IDR)*/
pub struct IDRrs;
impl crate::RegisterSpec for IDRrs {
    type Ux = u32;
}
///`read()` method returns [`idr::R`](R) reader structure
impl crate::Readable for IDRrs {}
///`reset()` method sets IDR to value 0
impl crate::Resettable for IDRrs {
    const RESET_VALUE: u32 = 0;
}