2021-02-18 12:49:32 +00:00
|
|
|
#include <api-hal-gpio.h>
|
2021-04-11 13:47:36 +00:00
|
|
|
#include <api-hal-version.h>
|
2020-11-06 10:52:50 +00:00
|
|
|
|
|
|
|
// init GPIO
|
2020-11-19 12:25:32 +00:00
|
|
|
void hal_gpio_init(
|
|
|
|
const GpioPin* gpio,
|
|
|
|
const GpioMode mode,
|
|
|
|
const GpioPull pull,
|
|
|
|
const GpioSpeed speed) {
|
2020-11-06 10:52:50 +00:00
|
|
|
// TODO: Alternate Functions
|
|
|
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
|
|
|
|
|
|
GPIO_InitStruct.Pin = gpio->pin;
|
|
|
|
GPIO_InitStruct.Mode = mode;
|
|
|
|
GPIO_InitStruct.Pull = pull;
|
|
|
|
GPIO_InitStruct.Speed = speed;
|
|
|
|
|
|
|
|
HAL_GPIO_Init(gpio->port, &GPIO_InitStruct);
|
|
|
|
}
|
2020-11-11 06:17:53 +00:00
|
|
|
|
2021-03-02 10:17:27 +00:00
|
|
|
extern COMP_HandleTypeDef hcomp1;
|
|
|
|
|
|
|
|
bool get_rfid_in_level() {
|
2021-04-11 13:47:36 +00:00
|
|
|
#ifdef INVERT_RFID_IN
|
|
|
|
return (HAL_COMP_GetOutputLevel(&hcomp1) == COMP_OUTPUT_LEVEL_LOW);
|
|
|
|
#else
|
|
|
|
return (HAL_COMP_GetOutputLevel(&hcomp1) == COMP_OUTPUT_LEVEL_HIGH);
|
|
|
|
#endif
|
2021-03-02 10:17:27 +00:00
|
|
|
}
|