2 Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 Ported to QMK by Techsock <info@techsock.com>
24 #include <util/delay.h>
36 #define CAPS_BREAK (CAPS | 0x80)
37 #define ROW(key) ((key)>>3&0x0F)
38 #define COL(key) ((key)&0x07)
41 static bool is_modified = false;
43 // matrix state buffer(1:on, 0:off)
44 static uint8_t *matrix;
45 static uint8_t _matrix0[MATRIX_ROWS];
47 static void register_key(uint8_t key);
50 __attribute__ ((weak))
51 void matrix_init_kb(void) {
55 __attribute__ ((weak))
56 void matrix_scan_kb(void) {
60 __attribute__ ((weak))
61 void matrix_init_user(void) {
64 __attribute__ ((weak))
65 void matrix_scan_user(void) {
68 void matrix_init(void)
71 // initialize matrix state: all keys off
72 for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00;
75 matrix_init_quantum();
79 uint8_t matrix_scan(void)
84 key = m0110_recv_key();
86 if (key == M0110_NULL) {
88 } else if (key == M0110_ERROR) {
96 print("["); phex(key); print("]\n");
99 matrix_scan_quantum();
103 void matrix_print(void){
108 uint8_t matrix_get_row(uint8_t row)
114 static void register_key(uint8_t key)
117 matrix[ROW(key)] &= ~(1<<COL(key));
119 matrix[ROW(key)] |= (1<<COL(key));