-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chores(lua): generate keys definitions
- Loading branch information
1 parent
f1968f9
commit dfabe7a
Showing
3 changed files
with
144 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
// | ||
// WARNING: DO NOT EDIT THIS FILE | ||
// This file has been generated from the target's JSON hardware description | ||
// | ||
|
||
{% set key_plus = keys | selectattr("key","==","KEY_PLUS") | first %} | ||
{% set key_up = keys | selectattr("key","==","KEY_UP") | first %} | ||
{% set key_shift = keys | selectattr("key","==","KEY_SHIFT") | first %} | ||
{% set key_page = keys | selectattr("key","==","KEY_PAGE") | first %} | ||
{% set key_pageup = keys | selectattr("key","==","KEY_PAGEUP") | first %} | ||
{% set key_model = keys | selectattr("key","==","KEY_MODEL") | first %} | ||
{% set key_menu = keys | selectattr("key","==","KEY_MENU") | first %} | ||
{% set key_tele = keys | selectattr("key","==","KEY_TELE") | first %} | ||
{% set key_sys = keys | selectattr("key","==","KEY_SYS") | first %} | ||
|
||
{% if key_plus %} | ||
LROT_NUMENTRY( EVT_VIRTUAL_PREV, EVT_KEY_FIRST(KEY_PLUS) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_REPT, EVT_KEY_REPT(KEY_PLUS) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT, EVT_KEY_FIRST(KEY_MINUS) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_REPT, EVT_KEY_REPT(KEY_MINUS) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_DEC, EVT_KEY_FIRST(KEY_MINUS) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_DEC_REPT, EVT_KEY_REPT(KEY_MINUS) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_INC, EVT_KEY_FIRST(KEY_PLUS) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_INC_REPT, EVT_KEY_REPT(KEY_PLUS) ) | ||
{% elif key_up %} | ||
LROT_NUMENTRY( EVT_VIRTUAL_PREV, EVT_KEY_FIRST(KEY_UP) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_REPT, EVT_KEY_REPT(KEY_UP) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT, EVT_KEY_FIRST(KEY_DOWN) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_REPT, EVT_KEY_REPT(KEY_DOWN) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_DEC, EVT_KEY_FIRST(KEY_DOWN) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_DEC_REPT, EVT_KEY_REPT(KEY_DOWN) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_INC, EVT_KEY_FIRST(KEY_UP) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_INC_REPT, EVT_KEY_REPT(KEY_UP) ) | ||
{% else %} | ||
LROT_NUMENTRY( EVT_VIRTUAL_PREV, EVT_ROTARY_LEFT ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT, EVT_ROTARY_RIGHT ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_DEC, EVT_ROTARY_LEFT ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_INC, EVT_ROTARY_RIGHT ) | ||
LROT_NUMENTRY( ROTENC_LOWSPEED, ROTENC_LOWSPEED ) | ||
LROT_NUMENTRY( ROTENC_MIDSPEED, ROTENC_MIDSPEED ) | ||
LROT_NUMENTRY( ROTENC_HIGHSPEED, ROTENC_HIGHSPEED ) | ||
{% endif %} | ||
|
||
{% if key_shift %} | ||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_LONG(KEY_LEFT) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_LONG(KEY_RIGHT) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_MENU, EVT_KEY_BREAK(KEY_SHIFT) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_MENU_LONG, EVT_KEY_LONG(KEY_SHIFT) ) | ||
{% elif key_up %} | ||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_LONG(KEY_LEFT) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_LEFT) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_MENU, EVT_KEY_BREAK(KEY_RIGHT) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_MENU_LONG, EVT_KEY_LONG(KEY_RIGHT) ) | ||
{% else %} | ||
{% if key_page %} | ||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_LONG(KEY_PAGE) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_PAGE) ) | ||
{% elif key_pageup %} | ||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_BREAK(KEY_PAGEUP) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_PAGEDN) ) | ||
{% else %} | ||
LROT_NUMENTRY( EVT_VIRTUAL_PREV_PAGE, EVT_KEY_LONG(KEY_PAGEDN) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_NEXT_PAGE, EVT_KEY_BREAK(KEY_PAGEDN) ) | ||
{% endif %} | ||
|
||
{% if key_model %} | ||
LROT_NUMENTRY( EVT_VIRTUAL_MENU, EVT_KEY_BREAK(KEY_MODEL) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_MENU_LONG, EVT_KEY_LONG(KEY_MODEL) ) | ||
{% else %} | ||
LROT_NUMENTRY( EVT_VIRTUAL_MENU, EVT_KEY_BREAK(KEY_MENU) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_MENU_LONG, EVT_KEY_LONG(KEY_MENU) ) | ||
{% endif %} | ||
{% endif %} | ||
|
||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER, EVT_KEY_BREAK(KEY_ENTER) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_ENTER_LONG, EVT_KEY_LONG(KEY_ENTER) ) | ||
LROT_NUMENTRY( EVT_VIRTUAL_EXIT, EVT_KEY_BREAK(KEY_EXIT) ) | ||
|
||
|
||
LROT_NUMENTRY( EVT_EXIT_BREAK, EVT_KEY_BREAK(KEY_EXIT) ) | ||
|
||
{% macro key_event(name, key) %} | ||
{ "EVT_{{ name }}_FIRST", LRO_NUMVAL(EVT_KEY_FIRST({{ key }})) }, | ||
{ "EVT_{{ name }}_BREAK", LRO_NUMVAL(EVT_KEY_BREAK({{ key }})) }, | ||
{ "EVT_{{ name }}_LONG", LRO_NUMVAL(EVT_KEY_LONG({{ key }})) }, | ||
{ "EVT_{{ name }}_REPT", LRO_NUMVAL(EVT_KEY_REPT({{ key }})) }, | ||
{% endmacro %} | ||
|
||
{{ key_event('ENTER','KEY_ENTER') }} | ||
|
||
{% if key_menu %} | ||
{{ key_event('MENU','KEY_MENU') }} | ||
{% endif %} | ||
|
||
{% if key_tele %} | ||
{{ key_event('TELEM','KEY_TELE') }} | ||
{% endif %} | ||
|
||
{% if key_model %} | ||
{{ key_event('MODEL','KEY_MODEL') }} | ||
{% endif %} | ||
|
||
{% if key_sys %} | ||
{{ key_event('SYS','KEY_SYS') }} | ||
{% endif %} | ||
|
||
{% if key_up %} | ||
{{ key_event('UP', 'KEY_UP') }} | ||
{{ key_event('DOWN', 'KEY_DOWN') }} | ||
{{ key_event('LEFT', 'KEY_LEFT') }} | ||
{{ key_event('RIGHT', 'KEY_RIGHT') }} | ||
{% endif %} | ||
|
||
{% if key_page %} | ||
{{ key_event('PAGE', 'KEY_PAGE') }} | ||
{% endif %} | ||
|
||
{% if key_pageup %} | ||
{{ key_event('PAGEUP', 'KEY_PAGEUP') }} | ||
{% endif %} | ||
|
||
{% if key_pagedn %} | ||
{{ key_event('PAGEDN', 'KEY_PAGEDN') }} | ||
{% endif %} | ||
|
||
{% if key_plus %} | ||
{{ key_event('PLUS', 'KEY_PLUS') }} | ||
{{ key_event('MINUS', 'KEY_MINUS') }} | ||
{% endif %} | ||
|
||
{% if key_shift %} | ||
{{ key_event('SHIFT', 'KEY_SHIFT') }} | ||
{% endif %} | ||
|
||
{% if (not key_plus) and (not key_up) %} | ||
{{ key_event('ROT', 'KEY_ENTER') }} | ||
LROT_NUMENTRY( EVT_ROT_LEFT, EVT_ROTARY_LEFT ) | ||
LROT_NUMENTRY( EVT_ROT_RIGHT, EVT_ROTARY_RIGHT ) | ||
{% endif %} |