mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-19 09:13:11 +00:00
f58b322bb5
* enable transparent mode * rssi ok, transmit ok, fifo ok * I see the signal * successful async rx (registers from smartrf) * refactor rfstudio register config * rewrite config, found some issues * handle G0 interrupts * g0 irq enable after cc1101 init * update cube
55 lines
1 KiB
C
55 lines
1 KiB
C
#pragma once
|
|
#include "main.h"
|
|
#include "stdbool.h"
|
|
|
|
// hw-api
|
|
|
|
typedef char GPIO_TypeDef;
|
|
|
|
typedef enum {
|
|
GpioModeInput,
|
|
GpioModeOutputPushPull,
|
|
GpioModeOutputOpenDrain,
|
|
GpioModeAltFunctionPushPull,
|
|
GpioModeAltFunctionOpenDrain,
|
|
GpioModeAnalog,
|
|
GpioModeInterruptRise,
|
|
GpioModeInterruptFall,
|
|
GpioModeInterruptRiseFall,
|
|
GpioModeEventRise,
|
|
GpioModeEventFall,
|
|
GpioModeEventRiseFall,
|
|
} GpioMode;
|
|
|
|
typedef enum {
|
|
GpioSpeedLow,
|
|
GpioSpeedMedium,
|
|
GpioSpeedHigh,
|
|
GpioSpeedVeryHigh,
|
|
} GpioSpeed;
|
|
|
|
typedef enum {
|
|
GpioPullNo,
|
|
GpioPullUp,
|
|
GpioPullDown,
|
|
} GpioPull;
|
|
|
|
typedef struct {
|
|
GPIO_TypeDef* port;
|
|
uint16_t pin;
|
|
} GpioPin;
|
|
|
|
// init GPIO
|
|
void hal_gpio_init(
|
|
const GpioPin* gpio,
|
|
const GpioMode mode,
|
|
const GpioPull pull,
|
|
const GpioSpeed speed);
|
|
|
|
// write value to GPIO, false = LOW, true = HIGH
|
|
void hal_gpio_write(const GpioPin* gpio, const bool state);
|
|
|
|
// read value from GPIO, false = LOW, true = HIGH
|
|
bool hal_gpio_read(const GpioPin* gpio);
|
|
|
|
void enable_cc1101_irq();
|