Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorあく <alleteam@gmail.com>2020-11-16 13:16:34 +0300
committerGitHub <noreply@github.com>2020-11-16 13:16:34 +0300
commit3749eb0eed6b6e7d59b2cbc5f8cdafda47e72cd9 (patch)
tree96fdd026c0800315b10eabc350a5a4a634a3ead3 /applications/power
parent466ea087a0f2cb684b0fdfec46444344088c4926 (diff)
USB VCP Cli (#237)
* Core: ring buffer. * Api: usb vcp. F3: vcp glue code. * Applications: cli draft version. * Cli: basic working version, includes help and version commands * HAL: vcp on f2 * Makefile: update openocd conf * F3: vcp rx with freertos stream * Cli: help * Cli: standard commands, api-hal-uid * Power: cli poweroff.
Diffstat (limited to 'applications/power')
-rw-r--r--applications/power/power.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/applications/power/power.c b/applications/power/power.c
index 3bbd5142..c8c0d5d6 100644
--- a/applications/power/power.c
+++ b/applications/power/power.c
@@ -8,6 +8,7 @@
#include <gui/widget.h>
#include <assets_icons.h>
#include <api-hal-power.h>
+#include <cli/cli.h>
struct Power {
Icon* usb_icon;
@@ -17,6 +18,7 @@ struct Power {
Widget* battery_widget;
ValueMutex* menu_vm;
+ Cli* cli;
MenuItem* menu;
uint8_t charge;
@@ -54,6 +56,9 @@ Power* power_alloc() {
power->menu_vm = furi_open("menu");
furi_check(power->menu_vm);
+ power->cli = furi_open("cli");
+ furi_check(power->cli);
+
power->menu = menu_item_alloc_menu("Power", NULL);
menu_item_subitem_add(
power->menu, menu_item_alloc_function("Poweroff", NULL, power_off_callback, power));
@@ -82,10 +87,18 @@ void power_free(Power* power) {
free(power);
}
+void power_cli_poweroff(string_t args, void* context) {
+ cli_print("Poweroff in 5 seconds");
+ osDelay(5000);
+ api_hal_power_off();
+}
+
void power_task(void* p) {
(void)p;
Power* power = power_alloc();
+ cli_add_command(power->cli, "poweroff", power_cli_poweroff, power);
+
FuriRecordSubscriber* gui_record = furi_open_deprecated("gui", false, false, NULL, NULL, NULL);
assert(gui_record);
GuiApi* gui = furi_take(gui_record);