Skip to content

Commit 1196d6d

Browse files
committed
#51 more keyboard improvements. Examples recompiled
1 parent 18a9f18 commit 1196d6d

File tree

11 files changed

+197
-278
lines changed

11 files changed

+197
-278
lines changed

examples/dynamicMenuItems/dynamicMenuItems.emf

Lines changed: 105 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
"codeOptions": {
262262
"embeddedPlatform": "ARDUINO32",
263263
"lastDisplayUuid": "4dcb12ec-13d8-4466-b8b6-bd575eae4612",
264-
"lastInputUuid": "6dd87e7d-e751-4912-a70d-91793b1d3d87",
264+
"lastInputUuid": "71DAF854-DF8D-4F0B-9039-23C5583C85B1",
265265
"lastRemoteUuid": "2c101fec-1f7d-4ff3-8d2b-992ad41e7fcb",
266266
"lastRemoteUuids": [
267267
"2c101fec-1f7d-4ff3-8d2b-992ad41e7fcb"
@@ -331,48 +331,133 @@
331331
"subsystem": "DISPLAY"
332332
},
333333
{
334-
"name": "SW_POLLING_MODE",
335-
"latestValue": "SWITCHES_POLL_EVERYTHING",
334+
"name": "MK_KEYBOARD_NEXT",
335+
"latestValue": "B",
336336
"subsystem": "INPUT"
337337
},
338338
{
339-
"name": "SWITCH_IODEVICE",
340-
"latestValue": "devicePins",
339+
"name": "MK_KEYBOARD_BACK",
340+
"latestValue": "A",
341341
"subsystem": "INPUT"
342342
},
343343
{
344-
"name": "ENCODER_PIN_A",
345-
"latestValue": "6",
344+
"name": "MK_KEYBOARD_ENTER",
345+
"latestValue": "*",
346346
"subsystem": "INPUT"
347347
},
348348
{
349-
"name": "ENCODER_PIN_B",
350-
"latestValue": "5",
349+
"name": "MK_KEYBOARD_DEL",
350+
"latestValue": "#",
351+
"subsystem": "INPUT"
352+
},
353+
{
354+
"name": "MK_KEYBOARD_LAYOUT",
355+
"latestValue": "LAYOUT_4X4",
356+
"subsystem": "INPUT"
357+
},
358+
{
359+
"name": "MK_ROW_PIN_0",
360+
"latestValue": "11",
361+
"subsystem": "INPUT"
362+
},
363+
{
364+
"name": "MK_ROW_PIN_1",
365+
"latestValue": "10",
351366
"subsystem": "INPUT"
352367
},
353368
{
354-
"name": "ENCODER_PIN_OK",
369+
"name": "MK_ROW_PIN_2",
355370
"latestValue": "9",
356371
"subsystem": "INPUT"
357372
},
358373
{
359-
"name": "ENCODER_BACK_PIN",
360-
"latestValue": "-1",
374+
"name": "MK_ROW_PIN_3",
375+
"latestValue": "8",
361376
"subsystem": "INPUT"
362377
},
363378
{
364-
"name": "ENCODER_NEXT_PIN",
365-
"latestValue": "-1",
379+
"name": "MK_COL_PIN_0",
380+
"latestValue": "15",
381+
"subsystem": "INPUT"
382+
},
383+
{
384+
"name": "MK_COL_PIN_1",
385+
"latestValue": "14",
386+
"subsystem": "INPUT"
387+
},
388+
{
389+
"name": "MK_COL_PIN_2",
390+
"latestValue": "13",
391+
"subsystem": "INPUT"
392+
},
393+
{
394+
"name": "MK_COL_PIN_3",
395+
"latestValue": "12",
396+
"subsystem": "INPUT"
397+
},
398+
{
399+
"name": "MK_KEYBOARD_DEVICE",
400+
"latestValue": "io23017",
401+
"subsystem": "INPUT"
402+
},
403+
{
404+
"name": "MK_REPEAT_START",
405+
"latestValue": "850",
406+
"subsystem": "INPUT"
407+
},
408+
{
409+
"name": "MK_REPEAT_INTERVAL",
410+
"latestValue": "350",
411+
"subsystem": "INPUT"
412+
},
413+
{
414+
"name": "MK_KEYBOARD_INTERRUPTS",
415+
"latestValue": "true",
416+
"subsystem": "INPUT"
417+
},
418+
{
419+
"name": "SEPARATOR",
420+
"latestValue": "",
366421
"subsystem": "INPUT"
367422
},
368423
{
369-
"name": "PULLUP_LOGIC",
424+
"name": "MK_NEED_ENCODER",
370425
"latestValue": "true",
371426
"subsystem": "INPUT"
372427
},
373428
{
374-
"name": "ENCODER_IS_QUARTER_CYCLE",
375-
"latestValue": "false",
429+
"name": "MK_USE_PULL_UP",
430+
"latestValue": "true",
431+
"subsystem": "INPUT"
432+
},
433+
{
434+
"name": "MK_ENCODER_A",
435+
"latestValue": "6",
436+
"subsystem": "INPUT"
437+
},
438+
{
439+
"name": "MK_ENCODER_B",
440+
"latestValue": "5",
441+
"subsystem": "INPUT"
442+
},
443+
{
444+
"name": "MK_ENCODER_SEL",
445+
"latestValue": "9",
446+
"subsystem": "INPUT"
447+
},
448+
{
449+
"name": "MK_ENCODER_DEVICE",
450+
"latestValue": "devicePins",
451+
"subsystem": "INPUT"
452+
},
453+
{
454+
"name": "MK_POLLING_MODE",
455+
"latestValue": "SWITCHES_POLL_KEYS_ONLY",
456+
"subsystem": "INPUT"
457+
},
458+
{
459+
"name": "MK_ENCODER_TYPE",
460+
"latestValue": "FULL_CYCLE",
376461
"subsystem": "INPUT"
377462
},
378463
{
@@ -413,11 +498,12 @@
413498
"authenticatorDefinition": "",
414499
"projectIoExpanders": [
415500
"deviceIO:",
416-
"pcf8574:io8574:32:0"
501+
"mcp23017:io23017:32:10"
417502
],
418503
"menuInMenuCollection": {
419504
"menuDefinitions": []
420505
},
421-
"packageNamespace": ""
506+
"packageNamespace": "",
507+
"appIsModular": false
422508
}
423509
}

examples/dynamicMenuItems/dynamicMenuItems_menu.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414

1515
// Global variable declarations
1616
const ConnectorLocalInfo applicationInfo = { "Dynamic Menus", "5f22995e-8da2-49c4-9ec8-d055901003af" };
17-
IoAbstractionRef ioexp_io8574 = ioFrom8574(0x20, 0);
17+
IoAbstractionRef ioexp_io23017 = ioFrom23017(0x20, ACTIVE_LOW_OPEN, 10);
1818
Adafruit_ST7735 gfx(1, 0, -1);
1919
AdafruitDrawable gfxDrawable(&gfx);
2020
GraphicsDeviceRenderer renderer(30, applicationInfo.name, &gfxDrawable);
21+
MatrixKeyboardManager keyboard;
22+
const char keyboardKeys[] = "123A456B789C*0#D";
23+
KeyboardLayout keyboardLayout(4, 4, keyboardKeys);
24+
MenuEditingKeyListener tcMenuKeyListener('*', '#', 'A', 'B');
2125

2226
// Global Menu Item declarations
2327
ListRuntimeMenuItem menuList(13, 0, fnListRtCall, NULL);
@@ -72,8 +76,18 @@ void setupMenu() {
7276
gfx.initR(INITR_REDTAB);
7377
gfx.setRotation(0);
7478
renderer.setUpdatesPerSecond(5);
75-
switches.init(internalDigitalIo(), SWITCHES_POLL_EVERYTHING, true);
76-
menuMgr.initForEncoder(&renderer, &menuMainPower, 6, 5, 9);
79+
switches.init(internalDigitalIo(), SWITCHES_POLL_KEYS_ONLY, true);
80+
menuMgr.initForEncoder(&renderer, &menuMainPower, 6, 5, 9, FULL_CYCLE);
81+
keyboardLayout.setRowPin(0, 11);
82+
keyboardLayout.setRowPin(1, 10);
83+
keyboardLayout.setRowPin(2, 9);
84+
keyboardLayout.setRowPin(3, 8);
85+
keyboardLayout.setColPin(0, 15);
86+
keyboardLayout.setColPin(1, 14);
87+
keyboardLayout.setColPin(2, 13);
88+
keyboardLayout.setColPin(3, 12);
89+
keyboard.initialise(ioexp_io23017, &keyboardLayout, &tcMenuKeyListener, true);
90+
keyboard.setRepeatKeyMillis(850, 350);
7791
renderer.setTitleMode(BaseGraphicalRenderer::TITLE_FIRST_ROW);
7892
renderer.setUseSliderForAnalog(true);
7993
installCoolBlueTraditionalTheme(renderer, MenuFontDef(nullptr, 1), MenuFontDef(nullptr, 1), true);

examples/dynamicMenuItems/dynamicMenuItems_menu.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <Arduino.h>
1515
#include <tcMenu.h>
1616
#include "tcMenuAdaFruitGfx.h"
17+
#include <tcMenuKeyboard.h>
1718
#include <RuntimeMenuItem.h>
1819
#include <ScrollChoiceMenuItem.h>
1920
#include <IoAbstraction.h>
@@ -24,9 +25,11 @@ extern const PROGMEM ConnectorLocalInfo applicationInfo;
2425
extern Adafruit_ST7735 gfx;
2526
extern AdafruitDrawable gfxDrawable;
2627
extern GraphicsDeviceRenderer renderer;
28+
extern MatrixKeyboardManager keyboard;
29+
extern MenuEditingKeyListener tcMenuKeyListener;
2730

2831
// Any externals needed by IO expanders, EEPROMs etc
29-
extern IoAbstractionRef ioexp_io8574;
32+
extern IoAbstractionRef ioexp_io23017;
3033

3134
// Global Menu Item exports
3235
extern ListRuntimeMenuItem menuList;

examples/nano33ble/nano33ble.emf

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,8 @@
255255
"subsystem": "DISPLAY"
256256
},
257257
{
258-
"name": "PULLUP_LOGIC",
259-
"latestValue": "true",
260-
"subsystem": "INPUT"
261-
},
262-
{
263-
"name": "INTERRUPT_SWITCHES",
264-
"latestValue": "false",
258+
"name": "SW_POLLING_MODE",
259+
"latestValue": "SWITCHES_POLL_EVERYTHING",
265260
"subsystem": "INPUT"
266261
},
267262
{
@@ -294,6 +289,11 @@
294289
"latestValue": "-1",
295290
"subsystem": "INPUT"
296291
},
292+
{
293+
"name": "PULLUP_LOGIC",
294+
"latestValue": "true",
295+
"subsystem": "INPUT"
296+
},
297297
{
298298
"name": "ENCODER_IS_QUARTER_CYCLE",
299299
"latestValue": "false",
@@ -333,6 +333,11 @@
333333
"projectIoExpanders": [
334334
"deviceIO:",
335335
"customIO:io23017"
336-
]
336+
],
337+
"menuInMenuCollection": {
338+
"menuDefinitions": []
339+
},
340+
"packageNamespace": "",
341+
"appIsModular": false
337342
}
338343
}

examples/nano33ble/nano33ble_menu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void setupMenu() {
6262
// Code generated by plugins.
6363
gfx.begin();
6464
renderer.setUpdatesPerSecond(10);
65-
switches.initialise(internalDigitalIo(), true);
65+
switches.init(internalDigitalIo(), SWITCHES_POLL_EVERYTHING, true);
6666
menuMgr.initForEncoder(&renderer, &menuTemp, 5, 6, 4);
6767
renderer.setTitleMode(BaseGraphicalRenderer::TITLE_FIRST_ROW);
6868
renderer.setUseSliderForAnalog(false);

examples/nano33ble/nano33ble_menu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern U8G2_SSD1306_128X64_NONAME_F_HW_I2C gfx;
2222
extern GraphicsDeviceRenderer renderer;
2323

2424
// Any externals needed by IO expanders, EEPROMs etc
25-
25+
extern IoAbstractionRef io23017;
2626

2727
// Global Menu Item exports
2828
extern AnalogMenuItem menuAnalogReadingsOutputPWM;

examples/nano33ble/tcMenuBLERemoteConnector.cpp

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)