diff options
| author | tmk <nobody@nowhere> | 2013-02-13 12:16:24 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2013-02-13 12:16:24 +0900 |
| commit | c4421f585b085d3eef5e468ff1defcbc3b4ec8d3 (patch) | |
| tree | 335730a0308cdb2e2ec094fe08ac63ee29ce4f80 | |
| parent | 9bc82bf61c342ca96e6f942b169b7c88b6bf95cf (diff) | |
| download | qmk_firmware-c4421f585b085d3eef5e468ff1defcbc3b4ec8d3.tar.gz qmk_firmware-c4421f585b085d3eef5e468ff1defcbc3b4ec8d3.zip | |
Change struct key_t
| -rw-r--r-- | common/action.c | 2 | ||||
| -rw-r--r-- | common/keyboard.c | 2 | ||||
| -rw-r--r-- | common/keyboard.h | 14 | ||||
| -rw-r--r-- | common/keymap.c | 2 | ||||
| -rw-r--r-- | keyboard/gh60/keymap.c | 2 | ||||
| -rw-r--r-- | keyboard/hhkb/keymap.c | 2 |
6 files changed, 9 insertions, 15 deletions
diff --git a/common/action.c b/common/action.c index 840d70f34..6528cd46c 100644 --- a/common/action.c +++ b/common/action.c | |||
| @@ -859,7 +859,7 @@ bool is_tap_key(key_t key) | |||
| 859 | */ | 859 | */ |
| 860 | static void debug_event(keyevent_t event) | 860 | static void debug_event(keyevent_t event) |
| 861 | { | 861 | { |
| 862 | debug_hex16(event.key.raw); | 862 | debug_hex16((event.key.row<<8) | event.key.col); |
| 863 | if (event.pressed) debug("d("); else debug("u("); | 863 | if (event.pressed) debug("d("); else debug("u("); |
| 864 | debug_dec(event.time); debug(")"); | 864 | debug_dec(event.time); debug(")"); |
| 865 | } | 865 | } |
diff --git a/common/keyboard.c b/common/keyboard.c index 2c88b3e43..e4bc3dc8c 100644 --- a/common/keyboard.c +++ b/common/keyboard.c | |||
| @@ -85,7 +85,7 @@ void keyboard_task(void) | |||
| 85 | for (uint8_t c = 0; c < MATRIX_COLS; c++) { | 85 | for (uint8_t c = 0; c < MATRIX_COLS; c++) { |
| 86 | if (matrix_change & ((matrix_row_t)1<<c)) { | 86 | if (matrix_change & ((matrix_row_t)1<<c)) { |
| 87 | action_exec((keyevent_t){ | 87 | action_exec((keyevent_t){ |
| 88 | .key.pos = (keypos_t){ .row = r, .col = c }, | 88 | .key = (key_t){ .row = r, .col = c }, |
| 89 | .pressed = (matrix_row & (1<<c)), | 89 | .pressed = (matrix_row & (1<<c)), |
| 90 | .time = (timer_read() | 1) /* time should not be 0 */ | 90 | .time = (timer_read() | 1) /* time should not be 0 */ |
| 91 | }); | 91 | }); |
diff --git a/common/keyboard.h b/common/keyboard.h index e1cab3119..78cb24034 100644 --- a/common/keyboard.h +++ b/common/keyboard.h | |||
| @@ -30,12 +30,6 @@ extern "C" { | |||
| 30 | typedef struct { | 30 | typedef struct { |
| 31 | uint8_t col; | 31 | uint8_t col; |
| 32 | uint8_t row; | 32 | uint8_t row; |
| 33 | } keypos_t; | ||
| 34 | |||
| 35 | // TODO: need raw? keypos_t -> key_t? | ||
| 36 | typedef union { | ||
| 37 | uint16_t raw; | ||
| 38 | keypos_t pos; | ||
| 39 | } key_t; | 33 | } key_t; |
| 40 | 34 | ||
| 41 | /* key event */ | 35 | /* key event */ |
| @@ -46,20 +40,20 @@ typedef struct { | |||
| 46 | } keyevent_t; | 40 | } keyevent_t; |
| 47 | 41 | ||
| 48 | /* equivalent test of key_t */ | 42 | /* equivalent test of key_t */ |
| 49 | #define KEYEQ(keya, keyb) ((keya).raw == (keyb).raw) | 43 | #define KEYEQ(keya, keyb) ((keya).row == (keyb).row && (keya).col == (keyb).col) |
| 50 | 44 | ||
| 51 | /* (time == 0) means no event and assumes matrix has no 255 line. */ | 45 | /* (time == 0) means no event and assumes matrix has no 255 line. */ |
| 52 | #define IS_NOEVENT(event) ((event).time == 0 || ((event).key.pos.row == 255 && (event).key.pos.col == 255)) | 46 | #define IS_NOEVENT(event) ((event).time == 0 || ((event).key.row == 255 && (event).key.col == 255)) |
| 53 | 47 | ||
| 54 | #define NOEVENT (keyevent_t){ \ | 48 | #define NOEVENT (keyevent_t){ \ |
| 55 | .key.pos = (keypos_t){ .row = 255, .col = 255 }, \ | 49 | .key = (key_t){ .row = 255, .col = 255 }, \ |
| 56 | .pressed = false, \ | 50 | .pressed = false, \ |
| 57 | .time = 0 \ | 51 | .time = 0 \ |
| 58 | } | 52 | } |
| 59 | 53 | ||
| 60 | /* tick event */ | 54 | /* tick event */ |
| 61 | #define TICK (keyevent_t){ \ | 55 | #define TICK (keyevent_t){ \ |
| 62 | .key.pos = (keypos_t){ .row = 255, .col = 255 }, \ | 56 | .key = (key_t){ .row = 255, .col = 255 }, \ |
| 63 | .pressed = false, \ | 57 | .pressed = false, \ |
| 64 | .time = (timer_read() | 1) \ | 58 | .time = (timer_read() | 1) \ |
| 65 | } | 59 | } |
diff --git a/common/keymap.c b/common/keymap.c index 6bae17f99..078615814 100644 --- a/common/keymap.c +++ b/common/keymap.c | |||
| @@ -58,7 +58,7 @@ __attribute__ ((weak)) | |||
| 58 | action_t action_for_key(uint8_t layer, key_t key) | 58 | action_t action_for_key(uint8_t layer, key_t key) |
| 59 | { | 59 | { |
| 60 | /* convert from legacy keycode to action */ | 60 | /* convert from legacy keycode to action */ |
| 61 | uint8_t keycode = keymap_get_keycode(layer, key.pos.row, key.pos.col); | 61 | uint8_t keycode = keymap_get_keycode(layer, key.row, key.col); |
| 62 | action_t action; | 62 | action_t action; |
| 63 | switch (keycode) { | 63 | switch (keycode) { |
| 64 | case KC_FN0 ... KC_FN31: | 64 | case KC_FN0 ... KC_FN31: |
diff --git a/keyboard/gh60/keymap.c b/keyboard/gh60/keymap.c index 9cef2137b..a17c11fc3 100644 --- a/keyboard/gh60/keymap.c +++ b/keyboard/gh60/keymap.c | |||
| @@ -165,7 +165,7 @@ static const uint16_t PROGMEM fn_actions[] = { | |||
| 165 | /* translates key to keycode */ | 165 | /* translates key to keycode */ |
| 166 | uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) | 166 | uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) |
| 167 | { | 167 | { |
| 168 | return pgm_read_byte(&keymaps[(layer)][(key.pos.row)][(key.pos.col)]); | 168 | return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | /* translates Fn index to action */ | 171 | /* translates Fn index to action */ |
diff --git a/keyboard/hhkb/keymap.c b/keyboard/hhkb/keymap.c index b1407e1ad..ef21282ff 100644 --- a/keyboard/hhkb/keymap.c +++ b/keyboard/hhkb/keymap.c | |||
| @@ -314,7 +314,7 @@ void keymap_call_function(keyrecord_t *record, uint8_t id, uint8_t opt) | |||
| 314 | /* translates key to keycode */ | 314 | /* translates key to keycode */ |
| 315 | uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) | 315 | uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) |
| 316 | { | 316 | { |
| 317 | return pgm_read_byte(&keymaps[(layer)][(key.pos.row)][(key.pos.col)]); | 317 | return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); |
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | /* translates Fn index to action */ | 320 | /* translates Fn index to action */ |
