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)); CanvasApi* api = furi_alloc(sizeof(CanvasApi));
u8g2_Setup_st7565_erc12864_alt_f( u8g2_Setup_st7565_erc12864_alt_f(
&api->canvas.fb, &api->canvas.fb, U8G2_R0, u8x8_hw_spi_stm32, u8g2_gpio_and_delay_stm32);
U8G2_R0,
u8x8_hw_spi_stm32,
u8g2_gpio_and_delay_stm32);
// send init sequence to the display, display is in sleep mode after this // send init sequence to the display, display is in sleep mode after this
u8g2_InitDisplay(&api->canvas.fb); u8g2_InitDisplay(&api->canvas.fb);

View File

@ -4,15 +4,15 @@
#include <u8g2.h> #include <u8g2.h>
typedef enum { typedef enum {
ColorWhite = 0x00, ColorWhite = 0x00,
ColorBlack = 0x01, ColorBlack = 0x01,
} Color; } Color;
typedef const uint8_t* Font; typedef const uint8_t* Font;
typedef struct { typedef struct {
Font primary; Font primary;
Font secondary; Font secondary;
} Fonts; } Fonts;
struct _CanvasApi; struct _CanvasApi;

View File

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

View File

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