Switch sub-1GHz band (#349)
* switch band * extract subghz api to files
This commit is contained in:
18
firmware/targets/api-hal-include/api-hal-subghz.h
Normal file
18
firmware/targets/api-hal-include/api-hal-subghz.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
RfBandIsolation = 0,
|
||||
RfBand1 = 1,
|
||||
RfBand2 = 2,
|
||||
RfBand3 = 3
|
||||
} RfBand;
|
||||
|
||||
void api_hal_rf_band_set(RfBand band);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -21,5 +21,6 @@ template <unsigned int N> struct STOP_EXTERNING_ME {};
|
||||
#include "api-hal-bt.h"
|
||||
#include "api-hal-spi.h"
|
||||
#include "api-hal-flash.h"
|
||||
#include "api-hal-subghz.h"
|
||||
|
||||
void api_hal_init();
|
||||
|
5
firmware/targets/f4/api-hal/api-hal-subghz.c
Normal file
5
firmware/targets/f4/api-hal/api-hal-subghz.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "api-hal-subghz.h"
|
||||
|
||||
void api_hal_rf_band_set(RfBand band) {
|
||||
|
||||
}
|
@@ -7,4 +7,4 @@ void api_hal_init() {
|
||||
api_hal_i2c_init();
|
||||
api_hal_power_init();
|
||||
api_hal_light_init();
|
||||
}
|
||||
}
|
19
firmware/targets/f5/api-hal/api-hal-subghz.c
Normal file
19
firmware/targets/f5/api-hal/api-hal-subghz.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "api-hal-subghz.h"
|
||||
#include <stm32wbxx_ll_gpio.h>
|
||||
#include "main.h"
|
||||
|
||||
void api_hal_rf_band_set(RfBand band) {
|
||||
if (band == RfBand1) {
|
||||
LL_GPIO_ResetOutputPin(PA_SW_0_GPIO_Port, PA_SW_0_Pin);
|
||||
LL_GPIO_SetOutputPin(PA_SW_1_GPIO_Port, PA_SW_1_Pin);
|
||||
} else if (band == RfBand2) {
|
||||
LL_GPIO_SetOutputPin(PA_SW_0_GPIO_Port, PA_SW_0_Pin);
|
||||
LL_GPIO_ResetOutputPin(PA_SW_1_GPIO_Port, PA_SW_1_Pin);
|
||||
} else if (band == RfBand3) {
|
||||
LL_GPIO_SetOutputPin(PA_SW_0_GPIO_Port, PA_SW_0_Pin);
|
||||
LL_GPIO_SetOutputPin(PA_SW_1_GPIO_Port, PA_SW_1_Pin);
|
||||
} else if (band == RfBandIsolation) {
|
||||
LL_GPIO_ResetOutputPin(PA_SW_0_GPIO_Port, PA_SW_0_Pin);
|
||||
LL_GPIO_ResetOutputPin(PA_SW_1_GPIO_Port, PA_SW_1_Pin);
|
||||
}
|
||||
}
|
@@ -7,4 +7,4 @@ void api_hal_init() {
|
||||
api_hal_i2c_init();
|
||||
api_hal_power_init();
|
||||
api_hal_light_init();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user