AleX83Xpert/add f keys to keyboard layout (#2362)

* Assets: png images for F1..F12 keys: Will be used for HID keyboard layout
* HID KEYBOARD F1..F12 keys were added
  - a new row with functional keys was added
  - logic for displaying the keyboard layout was improved
* HidApp: hid functional keys by default

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
nas 2023-02-06 20:24:05 +05:00 committed by GitHub
parent 6e179bda1f
commit 79d45c97f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 25 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

View File

@ -46,11 +46,25 @@ typedef struct {
#define KEY_WIDTH 9
#define KEY_HEIGHT 12
#define KEY_PADDING 1
#define ROW_COUNT 6
#define ROW_COUNT 7
#define COLUMN_COUNT 12
// 0 width items are not drawn, but there value is used
const HidKeyboardKey hid_keyboard_keyset[ROW_COUNT][COLUMN_COUNT] = {
{
{.width = 1, .icon = &I_ButtonF1_5x8, .value = HID_KEYBOARD_F1},
{.width = 1, .icon = &I_ButtonF2_5x8, .value = HID_KEYBOARD_F2},
{.width = 1, .icon = &I_ButtonF3_5x8, .value = HID_KEYBOARD_F3},
{.width = 1, .icon = &I_ButtonF4_5x8, .value = HID_KEYBOARD_F4},
{.width = 1, .icon = &I_ButtonF5_5x8, .value = HID_KEYBOARD_F5},
{.width = 1, .icon = &I_ButtonF6_5x8, .value = HID_KEYBOARD_F6},
{.width = 1, .icon = &I_ButtonF7_5x8, .value = HID_KEYBOARD_F7},
{.width = 1, .icon = &I_ButtonF8_5x8, .value = HID_KEYBOARD_F8},
{.width = 1, .icon = &I_ButtonF9_5x8, .value = HID_KEYBOARD_F9},
{.width = 1, .icon = &I_ButtonF10_5x8, .value = HID_KEYBOARD_F10},
{.width = 1, .icon = &I_ButtonF11_5x8, .value = HID_KEYBOARD_F11},
{.width = 1, .icon = &I_ButtonF12_5x8, .value = HID_KEYBOARD_F12},
},
{
{.width = 1, .icon = NULL, .key = "1", .shift_key = "!", .value = HID_KEYBOARD_1},
{.width = 1, .icon = NULL, .key = "2", .shift_key = "@", .value = HID_KEYBOARD_2},
@ -224,7 +238,12 @@ static void hid_keyboard_draw_callback(Canvas* canvas, void* context) {
canvas_set_font(canvas, FontKeyboard);
// Start shifting the all keys up if on the next row (Scrolling)
uint8_t initY = model->y - 4 > 0 ? model->y - 4 : 0;
uint8_t initY = model->y == 0 ? 0 : 1;
if(model->y > 5) {
initY = model->y - 4;
}
for(uint8_t y = initY; y < ROW_COUNT; y++) {
const HidKeyboardKey* keyboardKeyRow = hid_keyboard_keyset[y];
uint8_t x = 0;
@ -365,7 +384,10 @@ HidKeyboard* hid_keyboard_alloc(Hid* bt_hid) {
with_view_model(
hid_keyboard->view,
HidKeyboardModel * model,
{ model->transport = bt_hid->transport; },
{
model->transport = bt_hid->transport;
model->y = 1;
},
true);
return hid_keyboard;