summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-01-24 01:02:11 +0900
committertmk <nobody@nowhere>2013-01-24 01:02:11 +0900
commitd8dddf9f25181e29e3fb82250833a00a11921452 (patch)
treeeb0b416b77edfd432f9976a562a7d3331e97a05b /common
parent28b5f69ce5c8b35d40725b490e7a2d4bfe922ad4 (diff)
Minor fixes in keyboard.c.
Diffstat (limited to 'common')
-rw-r--r--common/keyboard.c16
-rw-r--r--common/keyboard.h8
2 files changed, 10 insertions, 14 deletions
diff --git a/common/keyboard.c b/common/keyboard.c
index 6677e8011c..1aff81f54c 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/>.
#include "command.h"
#include "util.h"
#include "sendchar.h"
+#include "bootloader.h"
#ifdef MOUSEKEY_ENABLE
#include "mousekey.h"
#endif
@@ -68,21 +69,21 @@ void keyboard_task(void)
matrix_row_t matrix_change = 0;
matrix_scan();
- for (int r = 0; r < MATRIX_ROWS; r++) {
+ for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
matrix_row = matrix_get_row(r);
matrix_change = matrix_row ^ matrix_prev[r];
if (matrix_change) {
if (debug_matrix) matrix_print();
- for (int c = 0; c < MATRIX_COLS; c++) {
- if (matrix_change & (1<<c)) {
+ for (uint8_t c = 0; c < MATRIX_COLS; c++) {
+ if (matrix_change & ((matrix_row_t)1<<c)) {
action_exec((keyevent_t){
.key.pos = (keypos_t){ .row = r, .col = c },
.pressed = (matrix_row & (1<<c)),
.time = (timer_read() | 1) /* NOTE: 0 means no event */
});
// record a processed key
- matrix_prev[r] ^= (1<<c);
+ matrix_prev[r] ^= ((matrix_row_t)1<<c);
// process a key per task call
goto MATRIX_LOOP_END;
}
@@ -90,12 +91,7 @@ void keyboard_task(void)
}
}
// call with not real event to update state of aciton
- // TODO: use NOEVENT macro
- action_exec((keyevent_t) {
- .key.pos = (keypos_t){ .row = 255, .col = 255 }, // assume this key doesn't exist
- .pressed = false,
- .time = 0,
- });
+ action_exec(NOEVENT);
MATRIX_LOOP_END:
diff --git a/common/keyboard.h b/common/keyboard.h
index 6d06c95bbd..84f03c9a68 100644
--- a/common/keyboard.h
+++ b/common/keyboard.h
@@ -44,10 +44,10 @@ typedef struct {
#define KEYEQ(keya, keyb) (keya.raw == keyb.raw)
#define IS_NOEVENT(event) (event.time == 0)
-#define NOEVENT (keyevent_t){ \
- .key = (keypos_t){ .row = 255, .col = 255 }, \
- .pressed = false, \
- .time = 0 \
+#define NOEVENT (keyevent_t){ \
+ .key.pos = (keypos_t){ .row = 255, .col = 255 }, \
+ .pressed = false, \
+ .time = 0 \
}