mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-26 01:48:10 -07:00
[FL-3774] Fix 5V on GPIO (#4103)
* Move OTG controls to the power service * Accessor: add missing power service import * Power: add is_otg_enabled to info and properly handle OTG enable with VBUS voltage present * Power: method naming * Power: add backward compatibility with old-style use of furi_hal_power * Scripts: lower MIN_GAP_PAGES to 1 * SubGhz: fix incorrect logging tag * SubGhz: delegate OTG management to power service * Power: fix condition race, various improvements Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
#include <stdarg.h>
|
||||
#include <power/power_service/power.h>
|
||||
|
||||
void AccessorApp::run(void) {
|
||||
AccessorEvent event;
|
||||
@@ -35,16 +36,18 @@ AccessorApp::AccessorApp()
|
||||
: text_store{0} {
|
||||
notification = static_cast<NotificationApp*>(furi_record_open(RECORD_NOTIFICATION));
|
||||
expansion = static_cast<Expansion*>(furi_record_open(RECORD_EXPANSION));
|
||||
power = static_cast<Power*>(furi_record_open(RECORD_POWER));
|
||||
onewire_host = onewire_host_alloc(&gpio_ibutton);
|
||||
expansion_disable(expansion);
|
||||
furi_hal_power_enable_otg();
|
||||
power_enable_otg(power, true);
|
||||
}
|
||||
|
||||
AccessorApp::~AccessorApp() {
|
||||
furi_hal_power_disable_otg();
|
||||
power_enable_otg(power, false);
|
||||
expansion_enable(expansion);
|
||||
furi_record_close(RECORD_EXPANSION);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
furi_record_close(RECORD_POWER);
|
||||
onewire_host_free(onewire_host);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <one_wire/one_wire_host.h>
|
||||
#include <notification/notification_messages.h>
|
||||
#include <expansion/expansion.h>
|
||||
#include <power/power_service/power.h>
|
||||
|
||||
class AccessorApp {
|
||||
public:
|
||||
@@ -53,4 +54,5 @@ private:
|
||||
|
||||
NotificationApp* notification;
|
||||
Expansion* expansion;
|
||||
Power* power;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user