aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-12-17 22:09:14 +0100
committerDario Nieuwenhuis <[email protected]>2023-12-18 00:53:18 +0100
commit80c9d04bbd83367340a4f3a1e991df825a0b6029 (patch)
treed79b74b0ca17dd943dfcb3b809e895918f4ae629 /embassy-nrf
parenta2d4bab2f8a4a9b994bc0289938a9f725950715f (diff)
stm32: add some docs.
Diffstat (limited to 'embassy-nrf')
-rw-r--r--embassy-nrf/src/gpio.rs25
1 files changed, 12 insertions, 13 deletions
diff --git a/embassy-nrf/src/gpio.rs b/embassy-nrf/src/gpio.rs
index 85977a804..a47fb8350 100644
--- a/embassy-nrf/src/gpio.rs
+++ b/embassy-nrf/src/gpio.rs
@@ -50,19 +50,19 @@ impl<'d, T: Pin> Input<'d, T> {
50 Self { pin } 50 Self { pin }
51 } 51 }
52 52
53 /// Test if current pin level is high. 53 /// Get whether the pin input level is high.
54 #[inline] 54 #[inline]
55 pub fn is_high(&mut self) -> bool { 55 pub fn is_high(&mut self) -> bool {
56 self.pin.is_high() 56 self.pin.is_high()
57 } 57 }
58 58
59 /// Test if current pin level is low. 59 /// Get whether the pin input level is low.
60 #[inline] 60 #[inline]
61 pub fn is_low(&mut self) -> bool { 61 pub fn is_low(&mut self) -> bool {
62 self.pin.is_low() 62 self.pin.is_low()
63 } 63 }
64 64
65 /// Returns current pin level 65 /// Get the pin input level.
66 #[inline] 66 #[inline]
67 pub fn get_level(&mut self) -> Level { 67 pub fn get_level(&mut self) -> Level {
68 self.pin.get_level() 68 self.pin.get_level()
@@ -158,19 +158,19 @@ impl<'d, T: Pin> Output<'d, T> {
158 self.pin.set_level(level) 158 self.pin.set_level(level)
159 } 159 }
160 160
161 /// Is the output pin set as high? 161 /// Get whether the output level is set to high.
162 #[inline] 162 #[inline]
163 pub fn is_set_high(&mut self) -> bool { 163 pub fn is_set_high(&mut self) -> bool {
164 self.pin.is_set_high() 164 self.pin.is_set_high()
165 } 165 }
166 166
167 /// Is the output pin set as low? 167 /// Get whether the output level is set to low.
168 #[inline] 168 #[inline]
169 pub fn is_set_low(&mut self) -> bool { 169 pub fn is_set_low(&mut self) -> bool {
170 self.pin.is_set_low() 170 self.pin.is_set_low()
171 } 171 }
172 172
173 /// What level output is set to 173 /// Get the current output level.
174 #[inline] 174 #[inline]
175 pub fn get_output_level(&mut self) -> Level { 175 pub fn get_output_level(&mut self) -> Level {
176 self.pin.get_output_level() 176 self.pin.get_output_level()
@@ -275,13 +275,13 @@ impl<'d, T: Pin> Flex<'d, T> {
275 self.pin.conf().reset(); 275 self.pin.conf().reset();
276 } 276 }
277 277
278 /// Test if current pin level is high. 278 /// Get whether the pin input level is high.
279 #[inline] 279 #[inline]
280 pub fn is_high(&mut self) -> bool { 280 pub fn is_high(&mut self) -> bool {
281 !self.is_low() 281 !self.is_low()
282 } 282 }
283 283
284 /// Test if current pin level is low. 284 /// Get whether the pin input level is low.
285 #[inline] 285 #[inline]
286 pub fn is_low(&mut self) -> bool { 286 pub fn is_low(&mut self) -> bool {
287 self.ref_is_low() 287 self.ref_is_low()
@@ -292,7 +292,7 @@ impl<'d, T: Pin> Flex<'d, T> {
292 self.pin.block().in_.read().bits() & (1 << self.pin.pin()) == 0 292 self.pin.block().in_.read().bits() & (1 << self.pin.pin()) == 0
293 } 293 }
294 294
295 /// Returns current pin level 295 /// Get the pin input level.
296 #[inline] 296 #[inline]
297 pub fn get_level(&mut self) -> Level { 297 pub fn get_level(&mut self) -> Level {
298 self.is_high().into() 298 self.is_high().into()
@@ -319,25 +319,24 @@ impl<'d, T: Pin> Flex<'d, T> {
319 } 319 }
320 } 320 }
321 321
322 /// Is the output pin set as high? 322 /// Get whether the output level is set to high.
323 #[inline] 323 #[inline]
324 pub fn is_set_high(&mut self) -> bool { 324 pub fn is_set_high(&mut self) -> bool {
325 !self.is_set_low() 325 !self.is_set_low()
326 } 326 }
327 327
328 /// Is the output pin set as low? 328 /// Get whether the output level is set to low.
329 #[inline] 329 #[inline]
330 pub fn is_set_low(&mut self) -> bool { 330 pub fn is_set_low(&mut self) -> bool {
331 self.ref_is_set_low() 331 self.ref_is_set_low()
332 } 332 }
333 333
334 /// Is the output pin set as low?
335 #[inline] 334 #[inline]
336 pub(crate) fn ref_is_set_low(&self) -> bool { 335 pub(crate) fn ref_is_set_low(&self) -> bool {
337 self.pin.block().out.read().bits() & (1 << self.pin.pin()) == 0 336 self.pin.block().out.read().bits() & (1 << self.pin.pin()) == 0
338 } 337 }
339 338
340 /// What level output is set to 339 /// Get the current output level.
341 #[inline] 340 #[inline]
342 pub fn get_output_level(&mut self) -> Level { 341 pub fn get_output_level(&mut self) -> Level {
343 self.is_set_high().into() 342 self.is_set_high().into()