Loading...
Searching...
No Matches
gui_i.h
Go to the documentation of this file.
1
6#pragma once
7
8#include "gui.h"
9
10#include <furi.h>
11#include <furi_hal_rtc.h>
12#include <m-array.h>
13#include <stdio.h>
14
15#include "canvas.h"
16#include "canvas_i.h"
17#include "view_port.h"
18#include "view_port_i.h"
19
20#define GUI_DISPLAY_WIDTH 128
21#define GUI_DISPLAY_HEIGHT 64
22
23#define GUI_STATUS_BAR_X 0
24#define GUI_STATUS_BAR_Y 0
25#define GUI_STATUS_BAR_WIDTH GUI_DISPLAY_WIDTH
26/* 0-1 pixels for upper thin frame
27 * 2-9 pixels for icons (battery, sd card, etc)
28 * 10-12 pixels for lower bold line */
29#define GUI_STATUS_BAR_HEIGHT 13
30/* icon itself area (battery, sd card, etc) excluding frame.
31 * painted 2 pixels below GUI_STATUS_BAR_X.
32 */
33#define GUI_STATUS_BAR_WORKAREA_HEIGHT 8
34
35#define GUI_WINDOW_X 0
36#define GUI_WINDOW_Y GUI_STATUS_BAR_HEIGHT
37#define GUI_WINDOW_WIDTH GUI_DISPLAY_WIDTH
38#define GUI_WINDOW_HEIGHT (GUI_DISPLAY_HEIGHT - GUI_WINDOW_Y)
39
40#define GUI_THREAD_FLAG_DRAW (1 << 0)
41#define GUI_THREAD_FLAG_INPUT (1 << 1)
42#define GUI_THREAD_FLAG_ALL (GUI_THREAD_FLAG_DRAW | GUI_THREAD_FLAG_INPUT)
43
44ARRAY_DEF(ViewPortArray, ViewPort*, M_PTR_OPLIST);
45
47struct Gui {
48 // Thread and lock
49 FuriThreadId thread_id;
50 FuriMutex* mutex;
51
52 // Layers and Canvas
53 bool lockdown;
54 bool direct_draw;
55 ViewPortArray_t layers[GuiLayerMAX];
56 Canvas* canvas;
57
58 // Input
59 FuriMessageQueue* input_queue;
60 FuriPubSub* input_events;
61 uint8_t ongoing_input;
62 ViewPort* ongoing_input_view_port;
63};
64
71ViewPort* gui_view_port_find_enabled(ViewPortArray_t array);
72
77void gui_update(Gui* gui);
78
86void gui_input_events_callback(const void* value, void* ctx);
87
93size_t gui_active_view_port_count(Gui* gui, GuiLayer layer);
94
99void gui_lock(Gui* gui);
100
105void gui_unlock(Gui* gui);
GUI: Canvas API.
GUI: internal Canvas API.
Furi Hal RTC API.
GUI: main API.
GuiLayer
Gui layers.
Definition gui.h:16
@ GuiLayerMAX
Don't use or move, special value.
Definition gui.h:26
void gui_input_events_callback(const void *value, void *ctx)
Input event callback.
Definition gui.c:45
void gui_update(Gui *gui)
Update GUI, request redraw.
Definition gui.c:40
void gui_unlock(Gui *gui)
Unlock GUI.
Definition gui.c:346
void gui_lock(Gui *gui)
Lock GUI.
Definition gui.c:341
size_t gui_active_view_port_count(Gui *gui, GuiLayer layer)
Get count of view ports in layer.
Definition gui.c:20
ViewPort * gui_view_port_find_enabled(ViewPortArray_t array)
Find enabled ViewPort in ViewPortArray.
Definition gui.c:6
Canvas structure.
Definition canvas_i.h:40
Definition message_queue.c:16
Definition mutex.c:13
Definition pubsub.c:14
Gui structure.
Definition gui_i.h:47
Definition view_port_i.h:11
void * FuriThreadId
Unique thread identifier type (used by the OS kernel).
Definition thread.h:56
GUI: ViewPort API.
GUI: internal ViewPort API.