3 Note for ErgoDox EZ customizers: Here be dragons!
4 This is not a file you want to be messing with.
5 All of the interesting stuff for you is under keymaps/ :)
8 Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
30 #include <util/delay.h>
31 #include "action_layer.h"
36 #include "sixkeyboard.h"
38 /* matrix state(1:on, 0:off) */
39 static matrix_row_t matrix[MATRIX_ROWS];
41 __attribute__ ((weak))
42 void matrix_init_kb(void) {
46 __attribute__ ((weak))
47 void matrix_scan_kb(void) {
51 __attribute__ ((weak))
52 void matrix_init_user(void) {
55 __attribute__ ((weak))
56 void matrix_scan_user(void) {
60 uint8_t matrix_rows(void)
66 uint8_t matrix_cols(void)
71 void matrix_init(void)
76 DDRB &= ~(1<<7 | 1<<5);
77 PORTB |= (1<<7 | 1<<5);
78 DDRD &= ~(1<<6 | 1<<4 | 1<<1);
79 PORTD |= (1<<6 | 1<<4 | 1<<1);
85 uint8_t matrix_scan(void)
87 matrix[0] = (PINC&(1<<7) ? 0 : (1<<0)) | (PINB&(1<<7) ? 0 : (1<<1)) | (PINB&(1<<5) ? 0 : (1<<2));
88 matrix[1] = (PIND&(1<<6) ? 0 : (1<<0)) | (PIND&(1<<1) ? 0 : (1<<1)) | (PIND&(1<<4) ? 0 : (1<<2));
95 bool matrix_is_modified(void)
101 bool matrix_is_on(uint8_t row, uint8_t col)
103 return (matrix[row] & ((matrix_row_t)1<<col));
107 matrix_row_t matrix_get_row(uint8_t row)
112 void matrix_print(void)
114 print("\nr/c 0123456789ABCDEF\n");
115 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
116 phex(row); print(": ");
117 pbin_reverse16(matrix_get_row(row));
122 uint8_t matrix_key_count(void)
125 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
126 count += bitpop16(matrix[i]);