diff options
| author | tmk <nobody@nowhere> | 2013-01-24 01:02:11 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2013-01-24 01:02:11 +0900 |
| commit | d8dddf9f25181e29e3fb82250833a00a11921452 (patch) | |
| tree | eb0b416b77edfd432f9976a562a7d3331e97a05b /common/keyboard.c | |
| parent | 28b5f69ce5c8b35d40725b490e7a2d4bfe922ad4 (diff) | |
| download | qmk_firmware-d8dddf9f25181e29e3fb82250833a00a11921452.tar.gz qmk_firmware-d8dddf9f25181e29e3fb82250833a00a11921452.zip | |
Minor fixes in keyboard.c.
Diffstat (limited to 'common/keyboard.c')
| -rw-r--r-- | common/keyboard.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/common/keyboard.c b/common/keyboard.c index 6677e8011..1aff81f54 100644 --- a/common/keyboard.c +++ b/common/keyboard.c | |||
| @@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 26 | #include "command.h" | 26 | #include "command.h" |
| 27 | #include "util.h" | 27 | #include "util.h" |
| 28 | #include "sendchar.h" | 28 | #include "sendchar.h" |
| 29 | #include "bootloader.h" | ||
| 29 | #ifdef MOUSEKEY_ENABLE | 30 | #ifdef MOUSEKEY_ENABLE |
| 30 | #include "mousekey.h" | 31 | #include "mousekey.h" |
| 31 | #endif | 32 | #endif |
| @@ -68,21 +69,21 @@ void keyboard_task(void) | |||
| 68 | matrix_row_t matrix_change = 0; | 69 | matrix_row_t matrix_change = 0; |
| 69 | 70 | ||
| 70 | matrix_scan(); | 71 | matrix_scan(); |
| 71 | for (int r = 0; r < MATRIX_ROWS; r++) { | 72 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { |
| 72 | matrix_row = matrix_get_row(r); | 73 | matrix_row = matrix_get_row(r); |
| 73 | matrix_change = matrix_row ^ matrix_prev[r]; | 74 | matrix_change = matrix_row ^ matrix_prev[r]; |
| 74 | if (matrix_change) { | 75 | if (matrix_change) { |
| 75 | if (debug_matrix) matrix_print(); | 76 | if (debug_matrix) matrix_print(); |
| 76 | 77 | ||
| 77 | for (int c = 0; c < MATRIX_COLS; c++) { | 78 | for (uint8_t c = 0; c < MATRIX_COLS; c++) { |
| 78 | if (matrix_change & (1<<c)) { | 79 | if (matrix_change & ((matrix_row_t)1<<c)) { |
| 79 | action_exec((keyevent_t){ | 80 | action_exec((keyevent_t){ |
| 80 | .key.pos = (keypos_t){ .row = r, .col = c }, | 81 | .key.pos = (keypos_t){ .row = r, .col = c }, |
| 81 | .pressed = (matrix_row & (1<<c)), | 82 | .pressed = (matrix_row & (1<<c)), |
| 82 | .time = (timer_read() | 1) /* NOTE: 0 means no event */ | 83 | .time = (timer_read() | 1) /* NOTE: 0 means no event */ |
| 83 | }); | 84 | }); |
| 84 | // record a processed key | 85 | // record a processed key |
| 85 | matrix_prev[r] ^= (1<<c); | 86 | matrix_prev[r] ^= ((matrix_row_t)1<<c); |
| 86 | // process a key per task call | 87 | // process a key per task call |
| 87 | goto MATRIX_LOOP_END; | 88 | goto MATRIX_LOOP_END; |
| 88 | } | 89 | } |
| @@ -90,12 +91,7 @@ void keyboard_task(void) | |||
| 90 | } | 91 | } |
| 91 | } | 92 | } |
| 92 | // call with not real event to update state of aciton | 93 | // call with not real event to update state of aciton |
| 93 | // TODO: use NOEVENT macro | 94 | action_exec(NOEVENT); |
| 94 | action_exec((keyevent_t) { | ||
| 95 | .key.pos = (keypos_t){ .row = 255, .col = 255 }, // assume this key doesn't exist | ||
| 96 | .pressed = false, | ||
| 97 | .time = 0, | ||
| 98 | }); | ||
| 99 | 95 | ||
| 100 | MATRIX_LOOP_END: | 96 | MATRIX_LOOP_END: |
| 101 | 97 | ||
