Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-02-10 09:06:29 +00:00
|
|
|
#include "gui.h"
|
|
|
|
|
|
|
|
#include <furi.h>
|
|
|
|
#include <m-array.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2021-02-13 11:40:20 +00:00
|
|
|
#include <cli/cli.h>
|
2021-02-10 09:06:29 +00:00
|
|
|
#include "canvas.h"
|
|
|
|
#include "canvas_i.h"
|
|
|
|
#include "view_port.h"
|
|
|
|
#include "view_port_i.h"
|
|
|
|
|
|
|
|
#define GUI_DISPLAY_WIDTH 128
|
|
|
|
#define GUI_DISPLAY_HEIGHT 64
|
|
|
|
|
|
|
|
#define GUI_STATUS_BAR_X 0
|
|
|
|
#define GUI_STATUS_BAR_Y 0
|
|
|
|
#define GUI_STATUS_BAR_WIDTH GUI_DISPLAY_WIDTH
|
2021-04-06 17:09:15 +00:00
|
|
|
#define GUI_STATUS_BAR_HEIGHT 13
|
2021-02-10 09:06:29 +00:00
|
|
|
|
|
|
|
#define GUI_MAIN_X 0
|
|
|
|
#define GUI_MAIN_Y 9
|
|
|
|
#define GUI_MAIN_WIDTH GUI_DISPLAY_WIDTH
|
|
|
|
#define GUI_MAIN_HEIGHT (GUI_DISPLAY_HEIGHT - GUI_MAIN_Y)
|
|
|
|
|
|
|
|
#define GUI_THREAD_FLAG_DRAW (1 << 0)
|
|
|
|
#define GUI_THREAD_FLAG_INPUT (1 << 1)
|
|
|
|
#define GUI_THREAD_FLAG_ALL (GUI_THREAD_FLAG_DRAW | GUI_THREAD_FLAG_INPUT)
|
|
|
|
|
|
|
|
ARRAY_DEF(ViewPortArray, ViewPort*, M_PTR_OPLIST);
|
|
|
|
|
|
|
|
struct Gui {
|
|
|
|
// Thread and lock
|
|
|
|
osThreadId_t thread;
|
|
|
|
osMutexId_t mutex;
|
|
|
|
// Layers and Canvas
|
|
|
|
ViewPortArray_t layers[GuiLayerMAX];
|
|
|
|
Canvas* canvas;
|
2021-02-13 11:40:20 +00:00
|
|
|
GuiCanvasCommitCallback canvas_callback;
|
|
|
|
void* canvas_callback_context;
|
2021-02-10 09:06:29 +00:00
|
|
|
// Input
|
|
|
|
osMessageQueueId_t input_queue;
|
|
|
|
PubSub* input_events;
|
2021-02-13 11:40:20 +00:00
|
|
|
// Cli
|
|
|
|
Cli* cli;
|
2021-02-10 09:06:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
ViewPort* gui_view_port_find_enabled(ViewPortArray_t array);
|
|
|
|
|
|
|
|
/* Update GUI, request redraw
|
|
|
|
* @param gui, Gui instance
|
|
|
|
*/
|
2021-02-14 23:46:59 +00:00
|
|
|
void gui_update(Gui* gui);
|
2021-02-10 09:06:29 +00:00
|
|
|
|
|
|
|
void gui_input_events_callback(const void* value, void* ctx);
|
2020-10-16 15:25:06 +00:00
|
|
|
|
2020-10-26 17:00:17 +00:00
|
|
|
void gui_lock(Gui* gui);
|
2021-02-10 09:06:29 +00:00
|
|
|
|
2021-02-13 11:40:20 +00:00
|
|
|
void gui_unlock(Gui* gui);
|
|
|
|
|
|
|
|
void gui_cli_screen_stream_callback(uint8_t* data, size_t size, void* context);
|
|
|
|
|
|
|
|
void gui_cli_screen_stream(string_t args, void* context);
|