api-hal-gpio.c 391 B

1234567891011121314
  1. #include "api-hal-gpio.h"
  2. // init GPIO
  3. void hal_gpio_init(GpioPin* gpio, GpioMode mode, GpioPull pull, GpioSpeed speed) {
  4. // TODO: Alternate Functions
  5. GPIO_InitTypeDef GPIO_InitStruct = {0};
  6. GPIO_InitStruct.Pin = gpio->pin;
  7. GPIO_InitStruct.Mode = mode;
  8. GPIO_InitStruct.Pull = pull;
  9. GPIO_InitStruct.Speed = speed;
  10. HAL_GPIO_Init(gpio->port, &GPIO_InitStruct);
  11. }