ext amp support!!

This commit is contained in:
Sil 333033
2023-07-17 18:39:11 +02:00
parent 5de2f8d201
commit ad0c7644b4
4 changed files with 73 additions and 0 deletions
+23
View File
@@ -2,14 +2,34 @@
#include "registry.h"
#include <subghz/subghz_last_settings.h>
void subghz_devices_init() {
furi_check(!subghz_device_registry_is_valid());
subghz_device_registry_init();
SubGhzLastSettings* last_settings = subghz_last_settings_alloc();
subghz_last_settings_load(last_settings, 0);
if(last_settings->external_module_power_amp) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
}
subghz_last_settings_free(last_settings);
}
void subghz_devices_deinit(void) {
furi_check(subghz_device_registry_is_valid());
subghz_device_registry_deinit();
SubGhzLastSettings* last_settings = subghz_last_settings_alloc();
subghz_last_settings_load(last_settings, 0);
if(last_settings->external_module_power_amp) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog);
}
subghz_last_settings_free(last_settings);
}
const SubGhzDevice* subghz_devices_get_by_name(const char* device_name) {
@@ -69,6 +89,7 @@ void subghz_devices_idle(const SubGhzDevice* device) {
furi_assert(device);
if(device->interconnect->idle) {
device->interconnect->idle();
furi_hal_gpio_write(&gpio_ext_pc3, 0);
}
}
@@ -121,6 +142,7 @@ bool subghz_devices_set_tx(const SubGhzDevice* device) {
furi_assert(device);
if(device->interconnect->set_tx) {
ret = device->interconnect->set_tx();
furi_hal_gpio_write(&gpio_ext_pc3, 1);
}
return ret;
}
@@ -161,6 +183,7 @@ void subghz_devices_set_rx(const SubGhzDevice* device) {
furi_assert(device);
if(device->interconnect->set_rx) {
device->interconnect->set_rx();
furi_hal_gpio_write(&gpio_ext_pc3, 0);
}
}