This commit is contained in:
aanper 2020-10-15 18:57:21 +03:00
parent f0f3615c55
commit f9bda68ef8
5 changed files with 19 additions and 21 deletions

View file

@ -18,10 +18,7 @@ CanvasApi* canvas_api_init() {
CanvasApi* api = furi_alloc(sizeof(CanvasApi));
u8g2_Setup_st7565_erc12864_alt_f(
&api->canvas.fb,
U8G2_R0,
u8x8_hw_spi_stm32,
u8g2_gpio_and_delay_stm32);
&api->canvas.fb, U8G2_R0, u8x8_hw_spi_stm32, u8g2_gpio_and_delay_stm32);
// send init sequence to the display, display is in sleep mode after this
u8g2_InitDisplay(&api->canvas.fb);

View file

@ -4,15 +4,15 @@
#include <u8g2.h>
typedef enum {
ColorWhite = 0x00,
ColorBlack = 0x01,
ColorWhite = 0x00,
ColorBlack = 0x01,
} Color;
typedef const uint8_t* Font;
typedef struct {
Font primary;
Font secondary;
Font primary;
Font secondary;
} Fonts;
struct _CanvasApi;
@ -31,7 +31,7 @@ typedef struct {
struct _CanvasApi {
Canvas canvas;
Fonts* fonts;
uint8_t (*width)(CanvasApi* canvas);
uint8_t (*height)(CanvasApi* canvas);

View file

@ -32,20 +32,21 @@ void gui_add_widget(GuiApi* gui_api, Widget* widget, WidgetLayer layer) {
WidgetArray_t* widget_array = NULL;
switch(layer) {
case WidgetLayerStatusBar:
widget_array = &gui_api->gui->widgets_status_bar;
case WidgetLayerStatusBar:
widget_array = &gui_api->gui->widgets_status_bar;
break;
case WidgetLayerMain:
widget_array = &gui_api->gui->widgets;
case WidgetLayerMain:
widget_array = &gui_api->gui->widgets;
break;
case WidgetLayerFullscreen:
widget_array = &gui_api->gui->widgets_fs;
case WidgetLayerFullscreen:
widget_array = &gui_api->gui->widgets_fs;
break;
case WidgetLayerDialog:
widget_array = &gui_api->gui->widgets_dialog;
case WidgetLayerDialog:
widget_array = &gui_api->gui->widgets_dialog;
break;
default: break;
default:
break;
}
assert(widget);

View file

@ -70,7 +70,7 @@ void widget_draw(Widget* widget, CanvasApi* canvas_api) {
assert(widget->gui);
if(widget->draw_callback) {
widget->draw_callback(canvas_api, widget->draw_callback_context);
widget->draw_callback(canvas_api, widget->draw_callback_context);
}
}

View file

@ -15,7 +15,7 @@ struct Menu {
// GUI
Widget* widget;
// State
MenuItem* root;
MenuItem* settings;
@ -175,7 +175,7 @@ void menu_exit(Menu* menu) {
void menu_task(void* p) {
Menu* menu = menu_init();
menu_build_main(menu);
menu_build_main(menu);
if(!furi_create_deprecated("menu", menu, sizeof(menu))) {
printf("[menu_task] cannot create the menu record\n");