hackndev / zinc

The bare metal stack for rust
zinc.rs
Apache License 2.0
1k stars 100 forks source link

Added toggle for the stm32f4 GPIO #320

Closed darayus closed 9 years ago

darayus commented 9 years ago

This adds the toggle function to the stm32f4's GPIO pins. This is a ported function from the HAL provided by STM:

void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
{
  /* Check the parameters */
  assert_param(IS_GPIO_PIN(GPIO_Pin));

  GPIOx->ODR ^= GPIO_Pin;
}
hacknbot commented 9 years ago

Can one of the admins verify this patch?

farcaller commented 9 years ago

We should move gpio API into a trait, but otherwise it makes sense to see what use cases are required. LGTM.

farcaller commented 9 years ago

test this please

darayus commented 9 years ago

I have tested this on a STM32F407 discovery board and the toggle works correctly. I agree, the GPIO API should be in a trait.

farcaller commented 9 years ago

Sorry, that was meant to jenkins bot, not you :smile: the trigger phrases could be better.

0xc0170 commented 9 years ago

the trigger phrases could be better.

It should ! :grinning: