pub fn open_drain<T>(pin: &Pin<T>, op: bool) {
  let peripheral_ptr;
  unsafe {peripheral_ptr = stm32f4::stm32f446::Peripherals::steal();} 

  match pin.block {
    'a' => {
      let gpioa = &peripheral_ptr.GPIOA;
      if op {gpioa.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (1 << pin.number))});}
      else {gpioa.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (0 << pin.number))});}
    },
    'b' => {
      let gpiob = &peripheral_ptr.GPIOB;
      if op {gpiob.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (1 << pin.number))});}
      else {gpiob.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (0 << pin.number))});}
    },
    'c' => {
      let gpioc = &peripheral_ptr.GPIOC;
      if op {gpioc.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (1 << pin.number))});}
      else {gpioc.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (0 << pin.number))});}
    },
    'd' => {
      let gpiod = &peripheral_ptr.GPIOD;
      if op {gpiod.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (1 << pin.number))});}
      else {gpiod.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (0 << pin.number))});}
    },
    'h' => {
      let gpioh = &peripheral_ptr.GPIOH;
      if op {gpioh.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (1 << pin.number))});}
      else {gpioh.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (0 << pin.number))});}
    },
    _   => unreachable!()
  };
}
/// Sets if the pin is driven in push-pull- or open-drain-configuration.
/// 
/// Takes [pin-struct](crate::gpio::Pin) of a pin and a boolean value as arguments and sets the drive-mode of that pin.
/// If the value is false the config is push-pull, if the value is true the config is open-drain.
Sets if the pin is driven in push-pull- or open-drain-configuration.
Takes [pin-struct](crate::gpio::Pin) of a pin and a boolean value as arguments and sets the drive-mode of that pin.
If the value is false the config is push-pull, if the value is true the config is open-drain.
Sets if the pin is driven in push - pull - or open - drain - configuration . Takes [ pin - struct ] ( crate :: gpio :: Pin ) of a pin and a boolean value as arguments and sets the drive - mode of that pin . If the value is false the config is push - pull if the value is true the config is open - drain .
pub fn open_drain<T>(pin: &Pin<T>, op: bool) {
  let peripheral_ptr;
  unsafe {peripheral_ptr = stm32f4::stm32f446::Peripherals::steal();} 
  match pin.block {
    'a' => {
      let gpioa = &peripheral_ptr.GPIOA;
      if op {gpioa.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (1 << pin.number))});}
      else {gpioa.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (0 << pin.number))});}
    },
    'b' => {
      let gpiob = &peripheral_ptr.GPIOB;
      if op {gpiob.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (1 << pin.number))});}
      else {gpiob.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (0 << pin.number))});}
    },
    'c' => {
      let gpioc = &peripheral_ptr.GPIOC;
      if op {gpioc.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (1 << pin.number))});}
      else {gpioc.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (0 << pin.number))});}
    },
    'd' => {
      let gpiod = &peripheral_ptr.GPIOD;
      if op {gpiod.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (1 << pin.number))});}
      else {gpiod.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (0 << pin.number))});}
    },
    'h' => {
      let gpioh = &peripheral_ptr.GPIOH;
      if op {gpioh.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (1 << pin.number))});}
      else {gpioh.otyper.modify(|r, w| unsafe {w.bits(r.bits() | (0 << pin.number))});}
    },
    _   => unreachable!()
  };
}
pub fn open_drain < T > ( pin : & Pin < T > , op : bool ) { let peripheral_ptr ; unsafe { peripheral_ptr = stm32f4 :: stm32f446 :: Peripherals :: steal ( ) ; } match pin . block { 'a' => { let gpioa = & peripheral_ptr . GPIOA ; if op { gpioa . otyper . modify ( | r , w | unsafe { w . bits ( r . bits ( ) | ( 1 << pin . number ) ) } ) ; } else { gpioa . otyper . modify ( | r , w | unsafe { w . bits ( r . bits ( ) | ( 0 << pin . number ) ) } ) ; } } , 'b' => { let gpiob = & peripheral_ptr . GPIOB ; if op { gpiob . otyper . modify ( | r , w | unsafe { w . bits ( r . bits ( ) | ( 1 << pin . number ) ) } ) ; } else { gpiob . otyper . modify ( | r , w | unsafe { w . bits ( r . bits ( ) | ( 0 << pin . number ) ) } ) ; } } , 'c' => { let gpioc = & peripheral_ptr . GPIOC ; if op { gpioc . otyper . modify ( | r , w | unsafe { w . bits ( r . bits ( ) | ( 1 << pin . number ) ) } ) ; } else { gpioc . otyper . modify ( | r , w | unsafe { w . bits ( r . bits ( ) | ( 0 << pin . number ) ) } ) ; } } , 'd' => { let gpiod = & peripheral_ptr . GPIOD ; if op { gpiod . otyper . modify ( | r , w | unsafe { w . bits ( r . bits ( ) | ( 1 << pin . number ) ) } ) ; } else { gpiod . otyper . modify ( | r , w | unsafe { w . bits ( r . bits ( ) | ( 0 << pin . number ) ) } ) ; } } , 'h' => { let gpioh = & peripheral_ptr . GPIOH ; if op { gpioh . otyper . modify ( | r , w | unsafe { w . bits ( r . bits ( ) | ( 1 << pin . number ) ) } ) ; } else { gpioh . otyper . modify ( | r , w | unsafe { w . bits ( r . bits ( ) | ( 0 << pin . number ) ) } ) ; } } , _ => unreachable ! ( ) } ; }
Sets if the pin is driven in push-pull- or open-drain-configuration.
Sets if the pin is driven in push - pull - or open - drain - configuration .
pin
&Pin<T>
op
bool
pin
&Pin<T>
op
bool