mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-24 22:07:14 +03:00
[FL-1491] Gui: input injection in screen stream (#573)
* Gui: input injection in screen stream * Cli: expose ASCII table in public header
This commit is contained in:
parent
fe3bedbd3c
commit
c3fda0c8c3
@ -6,6 +6,20 @@ extern "C" {
|
||||
|
||||
#include <m-string.h>
|
||||
|
||||
typedef enum {
|
||||
CliSymbolAsciiSOH = 0x01,
|
||||
CliSymbolAsciiETX = 0x03,
|
||||
CliSymbolAsciiEOT = 0x04,
|
||||
CliSymbolAsciiBell = 0x07,
|
||||
CliSymbolAsciiBackspace = 0x08,
|
||||
CliSymbolAsciiTab = 0x09,
|
||||
CliSymbolAsciiCR = 0x0D,
|
||||
CliSymbolAsciiEsc = 0x1B,
|
||||
CliSymbolAsciiUS = 0x1F,
|
||||
CliSymbolAsciiSpace = 0x20,
|
||||
CliSymbolAsciiDel = 0x7F,
|
||||
} CliSymbols;
|
||||
|
||||
/* Cli type
|
||||
* Anonymous structure. Use cli_i.h if you need to go deeper.
|
||||
*/
|
||||
|
@ -24,20 +24,6 @@ BPTREE_DEF2(
|
||||
CliCommand,
|
||||
M_POD_OPLIST)
|
||||
|
||||
typedef enum {
|
||||
CliSymbolAsciiSOH = 0x01,
|
||||
CliSymbolAsciiETX = 0x03,
|
||||
CliSymbolAsciiEOT = 0x04,
|
||||
CliSymbolAsciiBell = 0x07,
|
||||
CliSymbolAsciiBackspace = 0x08,
|
||||
CliSymbolAsciiTab = 0x09,
|
||||
CliSymbolAsciiCR = 0x0D,
|
||||
CliSymbolAsciiEsc = 0x1B,
|
||||
CliSymbolAsciiUS = 0x1F,
|
||||
CliSymbolAsciiSpace = 0x20,
|
||||
CliSymbolAsciiDel = 0x7F,
|
||||
} CliSymbols;
|
||||
|
||||
struct Cli {
|
||||
CliCommandTree_t commands;
|
||||
osMutexId_t mutex;
|
||||
|
@ -262,7 +262,24 @@ void gui_cli_screen_stream(Cli* cli, string_t args, void* context) {
|
||||
gui_set_framebuffer_callback_context(gui, gui);
|
||||
gui_set_framebuffer_callback(gui, gui_cli_screen_stream_callback);
|
||||
gui_redraw(gui);
|
||||
cli_getc(gui->cli);
|
||||
|
||||
// Wait for control events
|
||||
while(true) {
|
||||
char c = cli_getc(gui->cli);
|
||||
if(c == CliSymbolAsciiEsc) {
|
||||
c = cli_getc(gui->cli);
|
||||
if(c == 'i') {
|
||||
InputEvent input_event;
|
||||
input_event.key = cli_getc(gui->cli);
|
||||
input_event.type = cli_getc(gui->cli);
|
||||
osMessageQueuePut(gui->input_queue, &input_event, 0, osWaitForever);
|
||||
osThreadFlagsSet(gui->thread, GUI_THREAD_FLAG_INPUT);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gui_set_framebuffer_callback(gui, NULL);
|
||||
gui_set_framebuffer_callback_context(gui, NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user