mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-25 12:13:08 +00:00
5d08b35b54
* Interrupt manager: add memory barriers. * ISRs: remove TIM17 dead code. * API HAL Delay: rename initialization routine and move to API-HAL * Main: move FURI initialization to the start. * API HAL GPIO: drop CC1101 shenanigans, COMP inversion for new boards. * IButton: migrate Cyfral and Metakom to RFID comp routine, make it compatible with new boards. * RFID: Better keyboard handling and shutdown routines
29 lines
706 B
C
29 lines
706 B
C
#include <api-hal-gpio.h>
|
|
#include <api-hal-version.h>
|
|
|
|
// init GPIO
|
|
void hal_gpio_init(
|
|
const GpioPin* gpio,
|
|
const GpioMode mode,
|
|
const GpioPull pull,
|
|
const GpioSpeed speed) {
|
|
// 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);
|
|
}
|
|
|
|
extern COMP_HandleTypeDef hcomp1;
|
|
|
|
bool get_rfid_in_level() {
|
|
#ifdef INVERT_RFID_IN
|
|
return (HAL_COMP_GetOutputLevel(&hcomp1) == COMP_OUTPUT_LEVEL_LOW);
|
|
#else
|
|
return (HAL_COMP_GetOutputLevel(&hcomp1) == COMP_OUTPUT_LEVEL_HIGH);
|
|
#endif
|
|
}
|