b9a766d909
* Added support for running applications from SD card (FAPs - Flipper Application Packages) * Added plugin_dist target for fbt to build FAPs * All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default * Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them * Added debugging support for FAPs with fbt debug & VSCode * Added public firmware API with automated versioning Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
44 lines
1.3 KiB
C
44 lines
1.3 KiB
C
#include "power_unplug_usb.h"
|
|
#include <furi.h>
|
|
#include <gui/elements.h>
|
|
|
|
struct PowerUnplugUsb {
|
|
View* view;
|
|
};
|
|
|
|
static void power_unplug_usb_draw_callback(Canvas* canvas, void* _model) {
|
|
UNUSED(_model);
|
|
|
|
canvas_set_color(canvas, ColorBlack);
|
|
canvas_draw_icon(canvas, 0, 0, &I_Unplug_bg_top_128x14);
|
|
canvas_draw_box(canvas, 0, 14, 128, (64 - 10 - 14));
|
|
canvas_draw_icon(canvas, 0, (64 - 10), &I_Unplug_bg_bottom_128x10);
|
|
|
|
canvas_set_color(canvas, ColorWhite);
|
|
canvas_set_font(canvas, FontPrimary);
|
|
elements_multiline_text_aligned(
|
|
canvas, 64, 32, AlignCenter, AlignCenter, "It's now safe to unplug\nthe USB cable");
|
|
}
|
|
|
|
PowerUnplugUsb* power_unplug_usb_alloc() {
|
|
PowerUnplugUsb* power_unplug_usb = malloc(sizeof(PowerUnplugUsb));
|
|
|
|
power_unplug_usb->view = view_alloc();
|
|
view_set_context(power_unplug_usb->view, power_unplug_usb);
|
|
view_set_draw_callback(power_unplug_usb->view, power_unplug_usb_draw_callback);
|
|
view_set_input_callback(power_unplug_usb->view, NULL);
|
|
|
|
return power_unplug_usb;
|
|
}
|
|
|
|
void power_unplug_usb_free(PowerUnplugUsb* power_unplug_usb) {
|
|
furi_assert(power_unplug_usb);
|
|
view_free(power_unplug_usb->view);
|
|
free(power_unplug_usb);
|
|
}
|
|
|
|
View* power_unplug_usb_get_view(PowerUnplugUsb* power_unplug_usb) {
|
|
furi_assert(power_unplug_usb);
|
|
return power_unplug_usb->view;
|
|
}
|