mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-26 03:39:58 -07:00
Merge branch 'dev' of https://github.com/Sil333033/Flipper-Xtreme into xfw-dev
This commit is contained in:
@@ -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,15 @@ bool subghz_devices_set_tx(const SubGhzDevice* device) {
|
||||
furi_assert(device);
|
||||
if(device->interconnect->set_tx) {
|
||||
ret = device->interconnect->set_tx();
|
||||
|
||||
SubGhzLastSettings* last_settings = subghz_last_settings_alloc();
|
||||
subghz_last_settings_load(last_settings, 0);
|
||||
|
||||
if(last_settings->external_module_power_amp) {
|
||||
furi_hal_gpio_write(&gpio_ext_pc3, 1);
|
||||
}
|
||||
|
||||
subghz_last_settings_free(last_settings);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -161,6 +191,14 @@ void subghz_devices_set_rx(const SubGhzDevice* device) {
|
||||
furi_assert(device);
|
||||
if(device->interconnect->set_rx) {
|
||||
device->interconnect->set_rx();
|
||||
SubGhzLastSettings* last_settings = subghz_last_settings_alloc();
|
||||
subghz_last_settings_load(last_settings, 0);
|
||||
|
||||
if(last_settings->external_module_power_amp) {
|
||||
furi_hal_gpio_write(&gpio_ext_pc3, 0);
|
||||
}
|
||||
|
||||
subghz_last_settings_free(last_settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user