/// Reads the state of an input pin.
/// 
/// Takes [pin-struct](crate::gpio::Pin) of an output pin as an argument and returns the boolean value of that pin.
Reads the state of an input pin.
Takes [pin-struct](crate::gpio::Pin) of an output pin as an argument and returns the boolean value of that pin.
Reads the state of an input pin . Takes [ pin - struct ] ( crate :: gpio :: Pin ) of an output pin as an argument and returns the boolean value of that pin .
pub fn digital_read(pin: &Pin<Input>) -> bool {
  let peripheral_ptr;
  unsafe {peripheral_ptr = stm32f4::stm32f446::Peripherals::steal();} 
  let bits = match pin.block {
    'a' => {
      let gpioa = &peripheral_ptr.GPIOA;
      gpioa.idr.read().bits()
    },
    'b' => {
      let gpiob = &peripheral_ptr.GPIOB;
      gpiob.idr.read().bits()
    },
    'c' => {
      let gpioc = &peripheral_ptr.GPIOC;
      gpioc.idr.read().bits()
    },
    'd' => {
      let gpiod = &peripheral_ptr.GPIOD;
      gpiod.idr.read().bits()
    },
    'h' => {
      let gpioh = &peripheral_ptr.GPIOH;
      gpioh.idr.read().bits()
    },
    _   => unreachable!()
  };
  return bits & (1 << pin.number) == (1 << pin.number);
}
pub fn digital_read ( pin : & Pin < Input > ) -> bool { let peripheral_ptr ; unsafe { peripheral_ptr = stm32f4 :: stm32f446 :: Peripherals :: steal ( ) ; } let bits = match pin . block { 'a' => { let gpioa = & peripheral_ptr . GPIOA ; gpioa . idr . read ( ) . bits ( ) } , 'b' => { let gpiob = & peripheral_ptr . GPIOB ; gpiob . idr . read ( ) . bits ( ) } , 'c' => { let gpioc = & peripheral_ptr . GPIOC ; gpioc . idr . read ( ) . bits ( ) } , 'd' => { let gpiod = & peripheral_ptr . GPIOD ; gpiod . idr . read ( ) . bits ( ) } , 'h' => { let gpioh = & peripheral_ptr . GPIOH ; gpioh . idr . read ( ) . bits ( ) } , _ => unreachable ! ( ) } ; return bits & ( 1 << pin . number ) == ( 1 << pin . number ) ; }
Reads the state of an input pin.
Reads the state of an input pin .
pin
&Pin<Input>