parent
4afd970dc4
commit
f14d9a57ea
@ -1,28 +1,32 @@
|
||||
{
|
||||
"keyboard_name": "DZ60",
|
||||
"url": "",
|
||||
"maintainer": "qmk",
|
||||
"width": 15,
|
||||
"height": 5,
|
||||
"keyboard_name": "DZ60",
|
||||
"manufacturer": "KBDFans",
|
||||
"identifier": "",
|
||||
"url": "",
|
||||
"maintainer": "qmk",
|
||||
"processor": "atmega32u4",
|
||||
"bootloader": "atmel-dfu",
|
||||
"width": 15,
|
||||
"height": 5,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"KEYMAP": {
|
||||
"layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"~", "x":13, "y":0}, {"label":"Del", "x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"Fn", "x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":2.25}, {"x":6, "y":4, "w":1.25}, {"x":7.25, "y":4, "w":2.75}, {"x":10, "y":4}, {"label":"Alt", "x":11, "y":4}, {"label":"Win", "x":12, "y":4}, {"label":"Menu", "x":13, "y":4}, {"label":"Ctrl", "x":14, "y":4}]
|
||||
},
|
||||
|
||||
"LAYOUT_hhkb": {
|
||||
"KEYMAP_HHKB": {
|
||||
"layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"~", "x":13, "y":0}, {"label":"Del", "x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Ctrl", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"Fn", "x":14, "y":3}, {"label":"Alt", "x":1.5, "y":4}, {"x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":6}, {"x":10, "y":4, "w":1.5}, {"label":"Alt", "x":11.5, "y":4}]
|
||||
},
|
||||
|
||||
"LAYOUT_true_hhkb": {
|
||||
"KEYMAP_TRUE_HHKB": {
|
||||
"layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"~", "x":13, "y":0}, {"label":"Del", "x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Ctrl", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"Fn", "x":14, "y":3}, {"label":"Alt", "x":1.5, "y":4}, {"x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":6}, {"x":10, "y":4, "w":1.5}, {"label":"Alt", "x":11.5, "y":4}]
|
||||
},
|
||||
|
||||
"LAYOUT_2_shifts": {
|
||||
"KEYMAP_2_SHIFTS": {
|
||||
"layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"~", "x":13, "y":0}, {"label":"Del", "x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3}, {"x":1, "y":3}, {"label":"Z", "x":2, "y":3}, {"label":"X", "x":3, "y":3}, {"label":"C", "x":4, "y":3}, {"label":"V", "x":5, "y":3}, {"label":"B", "x":6, "y":3}, {"label":"N", "x":7, "y":3}, {"label":"M", "x":8, "y":3}, {"label":"<", "x":9, "y":3}, {"label":">", "x":10, "y":3}, {"label":"?", "x":11, "y":3}, {"label":"Shift", "x":12, "y":3}, {"x":13, "y":3}, {"label":"Fn", "x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":2.25}, {"x":6, "y":4, "w":1.25}, {"x":7.25, "y":4, "w":2.75}, {"x":10, "y":4}, {"label":"Alt", "x":11, "y":4}, {"label":"Win", "x":12, "y":4}, {"label":"Menu", "x":13, "y":4}, {"label":"Ctrl", "x":14, "y":4}]
|
||||
},
|
||||
|
||||
"LAYOUT_directional": {
|
||||
"KEYMAP_DIRECTIONAL": {
|
||||
"layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"~", "x":13, "y":0}, {"label":"Del", "x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2}, {"label":"Z", "x":2, "y":3}, {"label":"X", "x":3, "y":3}, {"label":"C", "x":4, "y":3}, {"label":"V", "x":5, "y":3}, {"label":"B", "x":6, "y":3}, {"label":"N", "x":7, "y":3}, {"label":"M", "x":8, "y":3}, {"label":"<", "x":9, "y":3}, {"label":">", "x":10, "y":3}, {"label":"?", "x":11, "y":3}, {"label":"Shift", "x":12, "y":3}, {"x":13, "y":3}, {"label":"Fn", "x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":2.25}, {"x":6, "y":4, "w":1.25}, {"x":7.25, "y":4, "w":2.75}, {"x":10, "y":4}, {"label":"Alt", "x":11, "y":4}, {"label":"Win", "x":12, "y":4}, {"label":"Menu", "x":13, "y":4}, {"label":"Ctrl", "x":14, "y":4}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,563 @@
|
||||
#include "dz60.h"
|
||||
#include "math.h"
|
||||
|
||||
#define NO_ACTION_ONESHOT
|
||||
#define NO_ACTION_MACRO
|
||||
|
||||
#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
|
||||
|
||||
#define ______ KC_NO
|
||||
|
||||
#define BUFFER_SIZE 32
|
||||
|
||||
#define CHAR_BEG '('
|
||||
#define CHAR_END ')'
|
||||
|
||||
#define CHAR_ADD '+'
|
||||
#define CHAR_SUB '-'
|
||||
#define CHAR_MUL '*'
|
||||
#define CHAR_DIV '/'
|
||||
|
||||
#define CHAR_EXP '^'
|
||||
|
||||
#define CHAR_SIN 's'
|
||||
#define CHAR_COS 'c'
|
||||
#define CHAR_TAN 't'
|
||||
|
||||
#define CHAR_ASN 'S'
|
||||
#define CHAR_ACS 'C'
|
||||
#define CHAR_ATN 'T'
|
||||
|
||||
#define CHAR_LGE 'l'
|
||||
#define CHAR_LOG 'L'
|
||||
|
||||
#define CHAR_SQT 'q'
|
||||
|
||||
struct OP
|
||||
{
|
||||
char c;
|
||||
unsigned char priority;
|
||||
bool ltr;
|
||||
};
|
||||
|
||||
union TokenRaw
|
||||
{
|
||||
double num;
|
||||
struct OP op;
|
||||
};
|
||||
|
||||
struct Token
|
||||
{
|
||||
bool isNum;
|
||||
union TokenRaw raw;
|
||||
};
|
||||
|
||||
enum CalcFunctions
|
||||
{
|
||||
CALC = SAFE_RANGE,
|
||||
ENDCALC
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------------.
|
||||
* | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bkspc |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | FN | A | S | D | F | G | H | J | K | L | ; | ' | Enter |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | Shift | Z | X | C | V | B | N | M | , | . | RSh | U | Del |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | Ctrl | Cmd | Alt | Space | / | FN | L | D | R |
|
||||
* `-----------------------------------------------------------------------------------------'
|
||||
*/
|
||||
|
||||
KEYMAP_DIRECTIONAL(
|
||||
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, ______, KC_BSPC,
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
|
||||
MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
|
||||
KC_LSFT, ______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_RSFT, KC_UP, KC_DELETE,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SLSH, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT
|
||||
),
|
||||
|
||||
/* FN Layer
|
||||
* ,-----------------------------------------------------------------------------------------.
|
||||
* | ~ | F1 | F2 | F3 | F4 | F5 | F6 | f7 | F8 | F9 | F10 | F11 | F12 | CALC |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* |Num_Lock| NP1 | | | | | | | | | NP0 |VolD |VolU |Mute |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | | AA | AE | AI | AO | AU | AN | | |BLD |BLI | BLT | Menu |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* |Shift | Cyc+| Cyc-| Val+| Val-| Hue+| Hue-| Sat+| Sat-| TOG | RSh | Pup | Ins |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | Ctrl | Cmd | Alt | | CALC| | Home| Pdn | End |
|
||||
* `-----------------------------------------------------------------------------------------'
|
||||
*/
|
||||
|
||||
KEYMAP_DIRECTIONAL(
|
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ______, KC_CALC,
|
||||
RESET, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_0, KC_VOLD, KC_VOLU, KC_MUTE,
|
||||
______, ______, ______, ______, ______, ______, ______, ______, ______, BL_DEC, BL_INC, BL_TOGG, KC_APP,
|
||||
KC_LSFT, ______, RGB_MOD, RGB_RMOD, RGB_VAI, RGB_VAD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_TOG, KC_RSFT, KC_PGUP, KC_INSERT,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, TO(2), ______, KC_HOME, KC_PGDOWN, KC_END
|
||||
),
|
||||
|
||||
/* CALC Layer
|
||||
* ,-----------------------------------------------------------------------------------------.
|
||||
* | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BKSPC |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | | | | | | | | | | | | | | |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | | | | | | | | | | | | |CALC |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* |Shift | | | | | | | | | | RSh | | |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | | | | | / | | | | |
|
||||
* `-----------------------------------------------------------------------------------------'
|
||||
*/
|
||||
|
||||
KEYMAP_DIRECTIONAL(
|
||||
ENDCALC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, ______, KC_BSPC,
|
||||
______, KC_Q, ______, ______, ______, KC_T, ______, ______, ______, ______, ______, ______, ______, ______,
|
||||
______, ______, KC_S, ______, ______, ______, ______, ______, ______, KC_L, ______, ______, CALC,
|
||||
KC_LSFT, ______, ______, ______, KC_C, ______, ______, ______, ______, ______, KC_DOT, KC_RSFT, ______, ______,
|
||||
______, ______, ______, ______, ______, ______, KC_SLSH, ______, ______, ______, ______
|
||||
),
|
||||
};
|
||||
|
||||
static char backspaceText[BUFFER_SIZE + 1];
|
||||
static char text[BUFFER_SIZE + 1];
|
||||
static unsigned char inputLocation = 0;
|
||||
|
||||
double calc(char input[])
|
||||
{
|
||||
char inputToken[BUFFER_SIZE + 1];
|
||||
unsigned char inputTokenLocation = 0, inputLocation = 0;
|
||||
|
||||
struct Token tokens[BUFFER_SIZE];
|
||||
unsigned char tokenCount = 0;
|
||||
|
||||
bool dashAsMinus = false;
|
||||
|
||||
while(inputLocation < BUFFER_SIZE)
|
||||
{
|
||||
short number = input[inputLocation] - '0';
|
||||
if((number < 10 && number >= 0) || (inputTokenLocation != 0 && input[inputLocation] == '.') || (!dashAsMinus && inputTokenLocation == 0 && input[inputLocation] == '-'))
|
||||
{
|
||||
inputToken[inputTokenLocation] = input[inputLocation];
|
||||
inputTokenLocation++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(inputTokenLocation != 0)
|
||||
{
|
||||
//sscanf(inputToken, "%lf", &tokens[tokenCount].raw.num);
|
||||
tokens[tokenCount].raw.num = atof(inputToken);
|
||||
tokens[tokenCount].isNum = true;
|
||||
for(unsigned char i = 0; i < inputTokenLocation + 1; i++)
|
||||
{
|
||||
inputToken[i] = '\0';
|
||||
}
|
||||
inputTokenLocation = 0;
|
||||
tokenCount++;
|
||||
dashAsMinus = true;
|
||||
}
|
||||
tokens[tokenCount].isNum = false;
|
||||
tokens[tokenCount].raw.op.c = input[inputLocation];
|
||||
tokens[tokenCount].raw.op.priority = 0;
|
||||
tokens[tokenCount].raw.op.ltr = true;
|
||||
dashAsMinus = false;
|
||||
switch(input[inputLocation])
|
||||
{
|
||||
case CHAR_BEG:
|
||||
break;
|
||||
case CHAR_END:
|
||||
dashAsMinus = true;
|
||||
break;
|
||||
case CHAR_ADD:
|
||||
tokens[tokenCount].raw.op.priority = 1;
|
||||
break;
|
||||
case CHAR_SUB:
|
||||
tokens[tokenCount].raw.op.priority = 1;
|
||||
break;
|
||||
case CHAR_MUL:
|
||||
tokens[tokenCount].raw.op.priority = 2;
|
||||
break;
|
||||
case CHAR_DIV:
|
||||
tokens[tokenCount].raw.op.priority = 2;
|
||||
break;
|
||||
case CHAR_EXP:
|
||||
tokens[tokenCount].raw.op.priority = 3;
|
||||
tokens[tokenCount].raw.op.ltr = false;
|
||||
break;
|
||||
case CHAR_SIN:
|
||||
break;
|
||||
case CHAR_COS:
|
||||
break;
|
||||
case CHAR_TAN:
|
||||
break;
|
||||
case CHAR_ASN:
|
||||
break;
|
||||
case CHAR_ACS:
|
||||
break;
|
||||
case CHAR_ATN:
|
||||
break;
|
||||
case CHAR_LGE:
|
||||
break;
|
||||
case CHAR_LOG:
|
||||
break;
|
||||
case CHAR_SQT:
|
||||
break;
|
||||
case '\0':
|
||||
tokenCount--;
|
||||
inputLocation = BUFFER_SIZE;
|
||||
break;
|
||||
default:
|
||||
tokenCount--;
|
||||
break;
|
||||
}
|
||||
tokenCount++;
|
||||
}
|
||||
inputLocation++;
|
||||
}
|
||||
|
||||
struct Token output[BUFFER_SIZE + 1];
|
||||
struct Token opstack[BUFFER_SIZE + 1];
|
||||
unsigned char outputLocation = 0, opstackLocation = 0;
|
||||
|
||||
unsigned char numBrackets = 0;
|
||||
|
||||
for(unsigned char i = 0; i < tokenCount; i++)
|
||||
{
|
||||
if(tokens[i].isNum)
|
||||
{
|
||||
output[outputLocation] = tokens[i];
|
||||
outputLocation++;
|
||||
}
|
||||
else if(tokens[i].raw.op.c == CHAR_BEG)
|
||||
{
|
||||
opstack[opstackLocation] = tokens[i];
|
||||
opstackLocation++;
|
||||
}
|
||||
else if(tokens[i].raw.op.c == CHAR_END)
|
||||
{
|
||||
while(opstack[opstackLocation - 1].raw.op.c != CHAR_BEG)
|
||||
{
|
||||
output[outputLocation] = opstack[opstackLocation - 1];
|
||||
outputLocation++;
|
||||
opstackLocation--;
|
||||
}
|
||||
opstackLocation--;
|
||||
|
||||
numBrackets += 2;
|
||||
}
|
||||
else if(tokens[i].raw.op.priority == 0)
|
||||
{
|
||||
opstack[opstackLocation] = tokens[i];
|
||||
opstackLocation++;
|
||||
}
|
||||
else
|
||||
{
|
||||
while(opstackLocation != 0
|
||||
&& (opstack[opstackLocation - 1].raw.op.priority == 0
|
||||
|| tokens[i].raw.op.priority < opstack[opstackLocation - 1].raw.op.priority
|
||||
|| (tokens[i].raw.op.priority == opstack[opstackLocation - 1].raw.op.priority && opstack[opstackLocation - 1].raw.op.ltr))
|
||||
&& opstack[opstackLocation - 1].raw.op.c != CHAR_BEG)
|
||||
{
|
||||
output[outputLocation] = opstack[opstackLocation - 1];
|
||||
outputLocation++;
|
||||
opstackLocation--;
|
||||
}
|
||||
opstack[opstackLocation] = tokens[i];
|
||||
opstackLocation++;
|
||||
}
|
||||
}
|
||||
|
||||
tokenCount -= numBrackets;
|
||||
|
||||
for(signed char i = opstackLocation - 1; i >= 0; i--)
|
||||
{
|
||||
output[outputLocation] = opstack[i];
|
||||
outputLocation++;
|
||||
opstackLocation--;
|
||||
}
|
||||
|
||||
double answer[BUFFER_SIZE];
|
||||
unsigned char answerLocation = 0;
|
||||
|
||||
for(unsigned char i = 0; i < tokenCount; i++)
|
||||
{
|
||||
if(output[i].isNum)
|
||||
{
|
||||
answer[answerLocation] = output[i].raw.num;
|
||||
answerLocation++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(output[i].raw.op.priority == 0)
|
||||
{
|
||||
if(answerLocation >= 1)
|
||||
{
|
||||
switch(output[i].raw.op.c)
|
||||
{
|
||||
case CHAR_SIN:
|
||||
answer[answerLocation - 1] = sin(answer[answerLocation - 1]);
|
||||
break;
|
||||
case CHAR_COS:
|
||||
answer[answerLocation - 1] = cos(answer[answerLocation - 1]);
|
||||
break;
|
||||
case CHAR_TAN:
|
||||
answer[answerLocation - 1] = tan(answer[answerLocation - 1]);
|
||||
break;
|
||||
case CHAR_ASN:
|
||||
answer[answerLocation - 1] = asin(answer[answerLocation - 1]);
|
||||
break;
|
||||
case CHAR_ACS:
|
||||
answer[answerLocation - 1] = acos(answer[answerLocation - 1]);
|
||||
break;
|
||||
case CHAR_ATN:
|
||||
answer[answerLocation - 1] = atan(answer[answerLocation - 1]);
|
||||
break;
|
||||
case CHAR_LGE:
|
||||
answer[answerLocation - 1] = log(answer[answerLocation - 1]);
|
||||
break;
|
||||
case CHAR_LOG:
|
||||
answer[answerLocation - 1] = log10(answer[answerLocation - 1]);
|
||||
break;
|
||||
case CHAR_SQT:
|
||||
answer[answerLocation - 1] = sqrt(answer[answerLocation - 1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(answerLocation >= 2)
|
||||
{
|
||||
switch(output[i].raw.op.c)
|
||||
{
|
||||
case CHAR_ADD:
|
||||
answer[answerLocation - 2] += answer[answerLocation - 1];
|
||||
break;
|
||||
case CHAR_SUB:
|
||||
answer[answerLocation - 2] -= answer[answerLocation - 1];
|
||||
break;
|
||||
case CHAR_MUL:
|
||||
answer[answerLocation - 2] *= answer[answerLocation - 1];
|
||||
break;
|
||||
case CHAR_DIV:
|
||||
answer[answerLocation - 2] /= answer[answerLocation - 1];
|
||||
break;
|
||||
case CHAR_EXP:
|
||||
answer[answerLocation - 2] = pow(answer[answerLocation - 2], answer[answerLocation - 1]);
|
||||
break;
|
||||
}
|
||||
|
||||
answerLocation--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return answer[0];
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record)
|
||||
{
|
||||
bool numpadKeyPressed = false;
|
||||
|
||||
if(record->event.pressed)
|
||||
{
|
||||
if(!(get_mods() & MODS_SHIFT_MASK))
|
||||
{
|
||||
switch(keycode)
|
||||
{
|
||||
case KC_KP_0:
|
||||
numpadKeyPressed = true;
|
||||
break;
|
||||
case KC_KP_1:
|
||||
numpadKeyPressed = true;
|
||||
break;
|
||||
case KC_KP_2:
|
||||
numpadKeyPressed = true;
|
||||
break;
|
||||
case KC_KP_3:
|
||||
numpadKeyPressed = true;
|
||||
break;
|
||||
case KC_KP_4:
|
||||
numpadKeyPressed = true;
|
||||
break;
|
||||
case KC_KP_5:
|
||||
numpadKeyPressed = true;
|
||||
break;
|
||||
case KC_KP_6:
|
||||
numpadKeyPressed = true;
|
||||
break;
|
||||
case KC_KP_7:
|
||||
numpadKeyPressed = true;
|
||||
break;
|
||||
case KC_KP_8:
|
||||
numpadKeyPressed = true;
|
||||
break;
|
||||
case KC_KP_9:
|
||||
numpadKeyPressed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(numpadKeyPressed && !(host_keyboard_leds() & (1 << USB_LED_NUM_LOCK)))
|
||||
{
|
||||
add_key(KC_NLCK);
|
||||
send_keyboard_report();
|
||||
}
|
||||
|
||||
if(biton32(layer_state) == 2)
|
||||
{
|
||||
char characterPressed = '\0';
|
||||
|
||||
bool forceReturnTrue = false;
|
||||
|
||||
if(record->event.pressed)
|
||||
{
|
||||
if(!(get_mods() & MODS_SHIFT_MASK))
|
||||
{
|
||||
switch(keycode)
|
||||
{
|
||||
case KC_0:
|
||||
characterPressed = '0';
|
||||
break;
|
||||
case KC_1:
|
||||
characterPressed = '1';
|
||||
break;
|
||||
case KC_2:
|
||||
characterPressed = '2';
|
||||
break;
|
||||
case KC_3:
|
||||
characterPressed = '3';
|
||||
break;
|
||||
case KC_4:
|
||||
characterPressed = '4';
|
||||
break;
|
||||
case KC_5:
|
||||
characterPressed = '5';
|
||||
break;
|
||||
case KC_6:
|
||||
characterPressed = '6';
|
||||
break;
|
||||
case KC_7:
|
||||
characterPressed = '7';
|
||||
break;
|
||||
case KC_8:
|
||||
characterPressed = '8';
|
||||
break;
|
||||
case KC_9:
|
||||
characterPressed = '9';
|
||||
break;
|
||||
case KC_MINUS:
|
||||
characterPressed = CHAR_SUB;
|
||||
break;
|
||||
case KC_SLASH:
|
||||
characterPressed = CHAR_DIV;
|
||||
break;
|
||||
case KC_S:
|
||||
characterPressed = CHAR_SIN;
|
||||
break;
|
||||
case KC_C:
|
||||
characterPressed = CHAR_COS;
|
||||
break;
|
||||
case KC_T:
|
||||
characterPressed = CHAR_TAN;
|
||||
break;
|
||||
case KC_Q:
|
||||
characterPressed = CHAR_SQT;
|
||||
break;
|
||||
case KC_L:
|
||||
characterPressed = CHAR_LGE;
|
||||
break;
|
||||
case KC_DOT:
|
||||
characterPressed = '.';
|
||||
break;
|
||||
case KC_BSPC:
|
||||
if(inputLocation > 0)
|
||||
{
|
||||
inputLocation--;
|
||||
}
|
||||
forceReturnTrue = true;
|
||||
break;
|
||||
case KC_RSFT:
|
||||
forceReturnTrue = true;
|
||||
break;
|
||||
case KC_LSFT:
|
||||
forceReturnTrue = true;
|
||||
break;
|
||||
case CALC:
|
||||
for(int i = 0; i < inputLocation; i++)
|
||||
{
|
||||
backspaceText[i] = (char)8;
|
||||
}
|
||||
send_string(backspaceText);
|
||||
dtostrf(calc(text), 6, 6, text);
|
||||
send_string(text);
|
||||
for(unsigned char i = 0; i < BUFFER_SIZE; i++)
|
||||
{
|
||||
text[i] = '\0';
|
||||
backspaceText[i] = '\0';
|
||||
}
|
||||
inputLocation = 0;
|
||||
break;
|
||||
case ENDCALC:
|
||||
layer_state = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(keycode)
|
||||
{
|
||||
case KC_9:
|
||||
characterPressed = CHAR_BEG;
|
||||
break;
|
||||
case KC_0:
|
||||
characterPressed = CHAR_END;
|
||||
break;
|
||||
case KC_EQUAL:
|
||||
characterPressed = CHAR_ADD;
|
||||
break;
|
||||
case KC_6:
|
||||
characterPressed = CHAR_EXP;
|
||||
break;
|
||||
case KC_8:
|
||||
characterPressed = CHAR_MUL;
|
||||
break;
|
||||
case KC_S:
|
||||
characterPressed = CHAR_ASN;
|
||||
break;
|
||||
case KC_C:
|
||||
characterPressed = CHAR_ACS;
|
||||
break;
|
||||
case KC_T:
|
||||
characterPressed = CHAR_ATN;
|
||||
break;
|
||||
case KC_L:
|
||||
characterPressed = CHAR_LOG;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(inputLocation < BUFFER_SIZE && characterPressed != '\0')
|
||||
{
|
||||
text[inputLocation] = characterPressed;
|
||||
inputLocation++;
|
||||
}
|
||||
|
||||
return (!record->event.pressed || (record->event.pressed && (characterPressed != '\0' || forceReturnTrue)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,259 @@
|
||||
#include "dz60.h"
|
||||
|
||||
#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
|
||||
|
||||
#define ______ KC_TRNS
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------------.
|
||||
* | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bkspc |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | FN | A | S | D | F | G | H | J | K | L | ; | ' | Enter |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | Shift | Z | X | C | V | B | N | M | , | . | RSh | U | Del |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | Ctrl | Cmd | Alt | Space | / | FN | L | D | R |
|
||||
* `-----------------------------------------------------------------------------------------'
|
||||
*/
|
||||
|
||||
KEYMAP_DIRECTIONAL(
|
||||
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, ______, KC_BSPC,
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
|
||||
MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
|
||||
KC_LSFT, ______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_RSFT, KC_UP, KC_DELETE,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SLSH, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT
|
||||
),
|
||||
|
||||
/* FN Layer
|
||||
* ,-----------------------------------------------------------------------------------------.
|
||||
* | ~ | F1 | F2 | F3 | F4 | F5 | F6 | f7 | F8 | F9 | F10 | F11 | F12 | CALC |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* |Num_Lock| NP1 | | | | | | | | | NP0 |VolD |VolU |Mute |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | | AA | AE | AI | AO | AU | AN | | | | | | Menu |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* |Shift | Cyc+| Cyc-| Val+| Val-| Hue+| Hue-| Sat+| Sat-| TOG | RSh | Pup | Ins |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | Ctrl | Cmd | Alt | | Alt | | Home| Pdn | End |
|
||||
* `-----------------------------------------------------------------------------------------'
|
||||
*/
|
||||
|
||||
KEYMAP_DIRECTIONAL(
|
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ______, KC_CALC,
|
||||
RESET, F(1), F(2), F(3), F(4), F(5), F(6), F(7), F(8), F(9), F(0), KC_VOLD, KC_VOLU, KC_MUTE,
|
||||
______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_APP,
|
||||
KC_LSFT, ______, RGB_MOD, RGB_RMOD, RGB_VAI, RGB_VAD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_TOG, KC_RSFT, KC_PGUP, KC_INSERT,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, ______, KC_HOME, KC_PGDOWN, KC_END
|
||||
),
|
||||
};
|
||||
|
||||
enum function_id
|
||||
{
|
||||
NUM_0,
|
||||
NUM_1,
|
||||
NUM_2,
|
||||
NUM_3,
|
||||
NUM_4,
|
||||
NUM_5,
|
||||
NUM_6,
|
||||
NUM_7,
|
||||
NUM_8,
|
||||
NUM_9,
|
||||
//SHIFT_ESC
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM fn_actions[] = {
|
||||
//[10] = ACTION_FUNCTION(SHIFT_ESC),
|
||||
[0] = ACTION_FUNCTION(NUM_0),
|
||||
[1] = ACTION_FUNCTION(NUM_1),
|
||||
[2] = ACTION_FUNCTION(NUM_2),
|
||||
[3] = ACTION_FUNCTION(NUM_3),
|
||||
[4] = ACTION_FUNCTION(NUM_4),
|
||||
[5] = ACTION_FUNCTION(NUM_5),
|
||||
[6] = ACTION_FUNCTION(NUM_6),
|
||||
[7] = ACTION_FUNCTION(NUM_7),
|
||||
[8] = ACTION_FUNCTION(NUM_8),
|
||||
[9] = ACTION_FUNCTION(NUM_9)
|
||||
};
|
||||
|
||||
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||
{
|
||||
//static uint8_t shift_esc_shift_mask;
|
||||
bool numpadKeyPressed = false;
|
||||
|
||||
static short numpad[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
switch(id)
|
||||
{
|
||||
case NUM_0:
|
||||
if(record->event.pressed)
|
||||
{
|
||||
numpad[0] = 1;
|
||||
numpadKeyPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
numpad[0] = -1;
|
||||
}
|
||||
break;
|
||||
case NUM_1:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
numpad[1] = 1;
|
||||
numpadKeyPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
numpad[1] = -1;
|
||||
}
|
||||
break;
|
||||
case NUM_2:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
numpad[2] = 1;
|
||||
numpadKeyPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
numpad[2] = -1;
|
||||
}
|
||||
break;
|
||||
case NUM_3:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
numpad[3] = 1;
|
||||
numpadKeyPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
numpad[3] = -1;
|
||||
}
|
||||
break;
|
||||
case NUM_4:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
numpad[4] = 1;
|
||||
numpadKeyPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
numpad[4] = -1;
|
||||
}
|
||||
break;
|
||||
case NUM_5:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
numpad[5] = 1;
|
||||
numpadKeyPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
numpad[5] = -1;
|
||||
}
|
||||
break;
|
||||
case NUM_6:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
numpad[6] = 1;
|
||||
numpadKeyPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
numpad[6] = -1;
|
||||
}
|
||||
break;
|
||||
case NUM_7:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
numpad[7] = 1;
|
||||
numpadKeyPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
numpad[7] = -1;
|
||||
}
|
||||
break;
|
||||
case NUM_8:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
numpad[8] = 1;
|
||||
numpadKeyPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
numpad[8] = -1;
|
||||
}
|
||||
break;
|
||||
case NUM_9:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
numpad[9] = 1;
|
||||
numpadKeyPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
numpad[9] = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(numpadKeyPressed)
|
||||
{
|
||||
if(host_keyboard_leds() & (1 << USB_LED_NUM_LOCK))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
add_key(KC_NLCK);
|
||||
|
||||
send_keyboard_report();
|
||||
}
|
||||
}
|
||||
if (numpad[0] == 1) { add_key(KC_P0); }
|
||||
else if (numpad[0] == -1) { del_key(KC_P0); }
|
||||
if (numpad[1] == 1) { add_key(KC_P1); }
|
||||
else if (numpad[1] == -1) { del_key(KC_P1); }
|
||||
if (numpad[2] == 1) { add_key(KC_P2); }
|
||||
else if (numpad[2] == -1) { del_key(KC_P2); }
|
||||
if (numpad[3] == 1) { add_key(KC_P3); }
|
||||
else if (numpad[3] == -1) { del_key(KC_P3); }
|
||||
if (numpad[4] == 1) { add_key(KC_P4); }
|
||||
else if (numpad[4] == -1) { del_key(KC_P4); }
|
||||
if (numpad[5] == 1) { add_key(KC_P5); }
|
||||
else if (numpad[5] == -1) { del_key(KC_P5); }
|
||||
if (numpad[6] == 1) { add_key(KC_P6); }
|
||||
else if (numpad[6] == -1) { del_key(KC_P6); }
|
||||
if (numpad[7] == 1) { add_key(KC_P7); }
|
||||
else if (numpad[7] == -1) { del_key(KC_P7); }
|
||||
if (numpad[8] == 1) { add_key(KC_P8); }
|
||||
else if (numpad[8] == -1) { del_key(KC_P8); }
|
||||
if (numpad[9] == 1) { add_key(KC_P9); }
|
||||
else if (numpad[9] == -1) { del_key(KC_P9); }
|
||||
send_keyboard_report();
|
||||
}
|
||||
|
||||
/*case SHIFT_ESC:
|
||||
shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
|
||||
if (record->event.pressed) {
|
||||
if (shift_esc_shift_mask) {
|
||||
add_key(KC_GRV);
|
||||
send_keyboard_report();
|
||||
} else {
|
||||
add_key(KC_ESC);
|
||||
send_keyboard_report();
|
||||
}
|
||||
} else {
|
||||
if (shift_esc_shift_mask) {
|
||||
del_key(KC_GRV);
|
||||
send_keyboard_report();
|
||||
} else {
|
||||
del_key(KC_ESC);
|
||||
send_keyboard_report();
|
||||
}
|
||||
}
|
||||
break;*/
|
Loading…
Reference in new issue