mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-20 01:33:18 +00:00
5439e232cc
* API HAL SPI: refactoring, split into layers, prepare ST HAL separation. API HAL SubGhz: initialize on start. Drivers: add basic cc1101 driver. Update API usage. Debug: increase max debugger port speed. Remove subghz apps. * CC1101: chip status handling. ApiHalSpi: increase SubGhz bus speed to 8mhz. F4: backport subghz initialization. * Api Hal SubGhz: rx path and frequency. CC1101: frequency control. * SubGhz Application: basic tests * SubGhz app: tone and packet test. API HAL SUBGHZ: update configs, add missing bits and pieces.
31 lines
780 B
C
31 lines
780 B
C
#include <api-hal-gpio.h>
|
|
#include <api-hal-spi.h>
|
|
#include <api-hal-resources.h>
|
|
#include <api-hal-delay.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
|
|
}
|