[FL-2119] BT HID App (#888)
* view_dispatcher: add default back processing for Long events * assets: add ble connected and disconnected assets * bt keyboard: introduce new application * bt keyboard: add logic to keyboard mode * bt: remove debug ble hid application * bt hid: introduce media controller * gui canvas: rename CanvasFontDirection -> CanvasDirection * gui canvas: add arrow element * assets: update finilized assets * bt hid: finalise keynote GUI * bt hid: finalise media player GUI * bt: add media key buttons support * bt: add exit confirm view * bt: change Clicker -> Remote * bt: support f6 target * bt: hopefully final bt hid design * bt hid: add blue led notification when device is connected * bt: leave only bt clicker for now * bt: add display notification on pin code show event
This commit is contained in:
31
applications/gui/canvas.c
Normal file → Executable file
31
applications/gui/canvas.c
Normal file → Executable file
@@ -47,7 +47,7 @@ void canvas_reset(Canvas* canvas) {
|
||||
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_set_font_direction(canvas, CanvasFontDirectionLeftToRight);
|
||||
canvas_set_font_direction(canvas, CanvasDirectionLeftToRight);
|
||||
}
|
||||
|
||||
void canvas_commit(Canvas* canvas) {
|
||||
@@ -115,7 +115,7 @@ void canvas_set_color(Canvas* canvas, Color color) {
|
||||
u8g2_SetDrawColor(&canvas->fb, color);
|
||||
}
|
||||
|
||||
void canvas_set_font_direction(Canvas* canvas, CanvasFontDirection dir) {
|
||||
void canvas_set_font_direction(Canvas* canvas, CanvasDirection dir) {
|
||||
furi_assert(canvas);
|
||||
u8g2_SetFontDirection(&canvas->fb, dir);
|
||||
}
|
||||
@@ -304,6 +304,33 @@ void canvas_draw_disc(Canvas* canvas, uint8_t x, uint8_t y, uint8_t radius) {
|
||||
u8g2_DrawDisc(&canvas->fb, x, y, radius, U8G2_DRAW_ALL);
|
||||
}
|
||||
|
||||
void canvas_draw_triangle(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
uint8_t y,
|
||||
uint8_t base,
|
||||
uint8_t height,
|
||||
CanvasDirection dir) {
|
||||
furi_assert(canvas);
|
||||
if(dir == CanvasDirectionBottomToTop) {
|
||||
canvas_draw_line(canvas, x - base / 2, y, x + base / 2, y);
|
||||
canvas_draw_line(canvas, x - base / 2, y, x, y - height + 1);
|
||||
canvas_draw_line(canvas, x, y - height + 1, x + base / 2, y);
|
||||
} else if(dir == CanvasDirectionTopToBottom) {
|
||||
canvas_draw_line(canvas, x - base / 2, y, x + base / 2, y);
|
||||
canvas_draw_line(canvas, x - base / 2, y, x, y + height - 1);
|
||||
canvas_draw_line(canvas, x, y + height - 1, x + base / 2, y);
|
||||
} else if(dir == CanvasDirectionRightToLeft) {
|
||||
canvas_draw_line(canvas, x, y - base / 2, x, y + base / 2);
|
||||
canvas_draw_line(canvas, x, y - base / 2, x - height + 1, y);
|
||||
canvas_draw_line(canvas, x - height + 1, y, x, y + base / 2);
|
||||
} else if(dir == CanvasDirectionLeftToRight) {
|
||||
canvas_draw_line(canvas, x, y - base / 2, x, y + base / 2);
|
||||
canvas_draw_line(canvas, x, y - base / 2, x + height - 1, y);
|
||||
canvas_draw_line(canvas, x + height - 1, y, x, y + base / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void canvas_draw_xbm(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
|
29
applications/gui/canvas.h
Normal file → Executable file
29
applications/gui/canvas.h
Normal file → Executable file
@@ -47,11 +47,11 @@ typedef enum {
|
||||
|
||||
/** Font Direction */
|
||||
typedef enum {
|
||||
CanvasFontDirectionLeftToRight,
|
||||
CanvasFontDirectionTopToDown,
|
||||
CanvasFontDirectionRightToLeft,
|
||||
CanvasFontDirectionDownToTop,
|
||||
} CanvasFontDirection;
|
||||
CanvasDirectionLeftToRight,
|
||||
CanvasDirectionTopToBottom,
|
||||
CanvasDirectionRightToLeft,
|
||||
CanvasDirectionBottomToTop,
|
||||
} CanvasDirection;
|
||||
|
||||
/** Font parameters */
|
||||
typedef struct {
|
||||
@@ -116,7 +116,7 @@ void canvas_set_color(Canvas* canvas, Color color);
|
||||
* @param canvas Canvas instance
|
||||
* @param dir Direction font
|
||||
*/
|
||||
void canvas_set_font_direction(Canvas* canvas, CanvasFontDirection dir);
|
||||
void canvas_set_font_direction(Canvas* canvas, CanvasDirection dir);
|
||||
|
||||
/** Invert drawing color
|
||||
*
|
||||
@@ -273,6 +273,23 @@ void canvas_draw_circle(Canvas* canvas, uint8_t x, uint8_t y, uint8_t r);
|
||||
*/
|
||||
void canvas_draw_disc(Canvas* canvas, uint8_t x, uint8_t y, uint8_t r);
|
||||
|
||||
/** Draw triangle with given base and height lengths and their intersection coordinate
|
||||
*
|
||||
* @param canvas Canvas instance
|
||||
* @param x x coordinate of base and height intersection
|
||||
* @param y y coordinate of base and height intersection
|
||||
* @param base length of triangle side
|
||||
* @param height length of triangle height
|
||||
* @param dir CanvasDirection triangle orientaion
|
||||
*/
|
||||
void canvas_draw_triangle(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
uint8_t y,
|
||||
uint8_t base,
|
||||
uint8_t height,
|
||||
CanvasDirection dir);
|
||||
|
||||
/** Draw glyph
|
||||
*
|
||||
* @param canvas Canvas instance
|
||||
|
@@ -258,7 +258,7 @@ void view_dispatcher_handle_input(ViewDispatcher* view_dispatcher, InputEvent* e
|
||||
if(view_dispatcher->current_view) {
|
||||
is_consumed = view_input(view_dispatcher->current_view, event);
|
||||
}
|
||||
if(!is_consumed && event->type == InputTypeShort) {
|
||||
if(!is_consumed && (event->type == InputTypeShort || event->type == InputTypeLong)) {
|
||||
// TODO remove view navigation handlers
|
||||
uint32_t view_id = VIEW_IGNORE;
|
||||
if(event->key == InputKeyBack) {
|
||||
|
Reference in New Issue
Block a user