replace power amp in driver

This commit is contained in:
gid9798
2023-07-30 12:12:59 +03:00
parent c3f7a0d128
commit c6b6aec057
5 changed files with 87 additions and 142 deletions
+6 -33
View File
@@ -30,14 +30,13 @@ bool subghz_devices_begin(const SubGhzDevice* device) {
bool ret = false;
furi_assert(device);
if(device->interconnect->begin) {
// TODO: Remake this check and move this code
if(strcmp("cc1101_ext", device->name) == 0) {
if(furi_hal_subghz_get_ext_power_amp()) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
}
}
SubGhzDeviceConf conf = {
.ver = 1,
.extended_range = false, // TODO
.power_amp = furi_hal_subghz_get_ext_power_amp(),
};
ret = device->interconnect->begin();
ret = device->interconnect->begin(&conf);
}
return ret;
}
@@ -45,12 +44,6 @@ bool subghz_devices_begin(const SubGhzDevice* device) {
void subghz_devices_end(const SubGhzDevice* device) {
furi_assert(device);
if(device->interconnect->end) {
// TODO: Remake this check and move this code
if(strcmp("cc1101_ext", device->name) == 0) {
if(furi_hal_subghz_get_ext_power_amp()) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog);
}
}
device->interconnect->end();
}
}
@@ -82,12 +75,6 @@ void subghz_devices_idle(const SubGhzDevice* device) {
furi_assert(device);
if(device->interconnect->idle) {
device->interconnect->idle();
// TODO: Remake this check and move this code
if(strcmp("cc1101_ext", device->name) == 0) {
if(furi_hal_subghz_get_ext_power_amp()) {
furi_hal_gpio_write(&gpio_ext_pc3, 0);
}
}
}
}
@@ -140,13 +127,6 @@ bool subghz_devices_set_tx(const SubGhzDevice* device) {
furi_assert(device);
if(device->interconnect->set_tx) {
ret = device->interconnect->set_tx();
// TODO: Remake this check and move this code
if(strcmp("cc1101_ext", device->name) == 0) {
if(furi_hal_subghz_get_ext_power_amp()) {
furi_hal_gpio_write(&gpio_ext_pc3, 1);
}
}
}
return ret;
}
@@ -187,13 +167,6 @@ void subghz_devices_set_rx(const SubGhzDevice* device) {
furi_assert(device);
if(device->interconnect->set_rx) {
device->interconnect->set_rx();
// TODO: Remake this check and move this code
if(strcmp("cc1101_ext", device->name) == 0) {
if(furi_hal_subghz_get_ext_power_amp()) {
furi_hal_gpio_write(&gpio_ext_pc3, 0);
}
}
}
}
+9 -2
View File
@@ -12,12 +12,13 @@
#include <flipper_application/flipper_application.h>
#define SUBGHZ_RADIO_DEVICE_PLUGIN_APP_ID "subghz_radio_device"
#define SUBGHZ_RADIO_DEVICE_PLUGIN_API_VERSION 1
#define SUBGHZ_RADIO_DEVICE_PLUGIN_API_VERSION 2
typedef struct SubGhzDeviceRegistry SubGhzDeviceRegistry;
typedef struct SubGhzDevice SubGhzDevice;
typedef struct SubGhzDeviceConf SubGhzDeviceConf;
typedef bool (*SubGhzBegin)(void);
typedef bool (*SubGhzBegin)(SubGhzDeviceConf* conf);
typedef void (*SubGhzEnd)(void);
typedef bool (*SubGhzIsConnect)(void);
typedef void (*SubGhzReset)(void);
@@ -89,3 +90,9 @@ struct SubGhzDevice {
const char* name;
const SubGhzDeviceInterconnect* interconnect;
};
struct SubGhzDeviceConf {
uint8_t ver;
bool extended_range;
bool power_amp;
};