mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Update ampd code
This commit is contained in:
@@ -119,11 +119,14 @@ static void subghz_scene_reciever_config_set_ext_mod_power_amp_text(VariableItem
|
||||
|
||||
if(index == 1) {
|
||||
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
|
||||
furi_hal_gpio_write(&gpio_ext_pc3, 0);
|
||||
} else {
|
||||
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog);
|
||||
}
|
||||
|
||||
subghz->last_settings->external_module_power_amp = index == 1;
|
||||
|
||||
furi_hal_subghz_set_ext_power_amp(subghz->last_settings->external_module_power_amp);
|
||||
subghz_last_settings_save(subghz->last_settings);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
entry,status,name,type,params
|
||||
Version,+,34.3,,
|
||||
Version,+,34.4,,
|
||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||
Header,+,applications/main/archive/helpers/favorite_timeout.h,,
|
||||
Header,+,applications/services/applications.h,,
|
||||
@@ -1441,6 +1441,7 @@ Function,-,furi_hal_subghz_dump_state,void,
|
||||
Function,+,furi_hal_subghz_flush_rx,void,
|
||||
Function,+,furi_hal_subghz_flush_tx,void,
|
||||
Function,+,furi_hal_subghz_get_data_gpio,const GpioPin*,
|
||||
Function,+,furi_hal_subghz_get_ext_power_amp,_Bool,
|
||||
Function,+,furi_hal_subghz_get_lqi,uint8_t,
|
||||
Function,+,furi_hal_subghz_get_rolling_counter_mult,uint8_t,
|
||||
Function,+,furi_hal_subghz_get_rssi,float,
|
||||
@@ -1458,6 +1459,7 @@ Function,+,furi_hal_subghz_reset,void,
|
||||
Function,+,furi_hal_subghz_rx,void,
|
||||
Function,+,furi_hal_subghz_rx_pipe_not_empty,_Bool,
|
||||
Function,+,furi_hal_subghz_set_async_mirror_pin,void,const GpioPin*
|
||||
Function,+,furi_hal_subghz_set_ext_power_amp,void,_Bool
|
||||
Function,+,furi_hal_subghz_set_frequency,uint32_t,uint32_t
|
||||
Function,+,furi_hal_subghz_set_frequency_and_path,uint32_t,uint32_t
|
||||
Function,+,furi_hal_subghz_set_path,void,FuriHalSubGhzPath
|
||||
|
||||
|
@@ -55,6 +55,7 @@ typedef struct {
|
||||
uint8_t rolling_counter_mult;
|
||||
bool timestamp_file_names : 1;
|
||||
bool extended_frequency_i : 1;
|
||||
bool external_module_power_amp : 1;
|
||||
} FuriHalSubGhz;
|
||||
|
||||
volatile FuriHalSubGhz furi_hal_subghz = {
|
||||
@@ -63,6 +64,7 @@ volatile FuriHalSubGhz furi_hal_subghz = {
|
||||
.async_mirror_pin = NULL,
|
||||
.rolling_counter_mult = 1,
|
||||
.extended_frequency_i = false,
|
||||
.external_module_power_amp = false,
|
||||
};
|
||||
|
||||
uint8_t furi_hal_subghz_get_rolling_counter_mult(void) {
|
||||
@@ -77,6 +79,14 @@ void furi_hal_subghz_set_extended_frequency(bool state_i) {
|
||||
furi_hal_subghz.extended_frequency_i = state_i;
|
||||
}
|
||||
|
||||
bool furi_hal_subghz_get_ext_power_amp() {
|
||||
return furi_hal_subghz.external_module_power_amp;
|
||||
}
|
||||
|
||||
void furi_hal_subghz_set_ext_power_amp(bool enabled) {
|
||||
furi_hal_subghz.external_module_power_amp = enabled;
|
||||
}
|
||||
|
||||
void furi_hal_subghz_set_async_mirror_pin(const GpioPin* pin) {
|
||||
furi_hal_subghz.async_mirror_pin = pin;
|
||||
}
|
||||
|
||||
@@ -238,6 +238,16 @@ bool furi_hal_subghz_is_async_tx_complete();
|
||||
*/
|
||||
void furi_hal_subghz_stop_async_tx();
|
||||
|
||||
/** Get external amplifier power state
|
||||
* @return true if amplifier is enabled
|
||||
*/
|
||||
bool furi_hal_subghz_get_ext_power_amp();
|
||||
|
||||
/** Set external amplifier power state
|
||||
* @param enabled true to enable amplifier state, false to disable state
|
||||
*/
|
||||
void furi_hal_subghz_set_ext_power_amp(bool enabled);
|
||||
|
||||
// /** Initialize and switch to power save mode Used by internal API-HAL
|
||||
// * initialization routine Can be used to reinitialize device to safe state and
|
||||
// * send it to sleep
|
||||
|
||||
@@ -13,6 +13,7 @@ void subghz_devices_init() {
|
||||
|
||||
if(last_settings->external_module_power_amp) {
|
||||
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
|
||||
furi_hal_subghz_set_ext_power_amp(true);
|
||||
}
|
||||
|
||||
subghz_last_settings_free(last_settings);
|
||||
@@ -22,14 +23,9 @@ 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) {
|
||||
if(furi_hal_subghz_get_ext_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) {
|
||||
@@ -51,6 +47,10 @@ bool subghz_devices_begin(const SubGhzDevice* device) {
|
||||
furi_assert(device);
|
||||
if(device->interconnect->begin) {
|
||||
ret = device->interconnect->begin();
|
||||
|
||||
if(furi_hal_subghz_get_ext_power_amp()) {
|
||||
furi_hal_gpio_write(&gpio_ext_pc3, 0);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -89,7 +89,9 @@ 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);
|
||||
if(furi_hal_subghz_get_ext_power_amp()) {
|
||||
furi_hal_gpio_write(&gpio_ext_pc3, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,14 +145,9 @@ bool subghz_devices_set_tx(const SubGhzDevice* 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) {
|
||||
if(furi_hal_subghz_get_ext_power_amp()) {
|
||||
furi_hal_gpio_write(&gpio_ext_pc3, 1);
|
||||
}
|
||||
|
||||
subghz_last_settings_free(last_settings);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -191,14 +188,10 @@ 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) {
|
||||
if(furi_hal_subghz_get_ext_power_amp()) {
|
||||
furi_hal_gpio_write(&gpio_ext_pc3, 0);
|
||||
}
|
||||
|
||||
subghz_last_settings_free(last_settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user