/* Copyright 2014 Kai Ryu This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #define KIMERA_C #include #include #include "kimera.h" uint8_t mux_mapping[MUX_COUNT] = { MUX_FOR_ROW, MUX_FOR_COL, MUX_FOR_COL, MUX_FOR_COL }; uint8_t row_mapping[MATRIX_ROWS] = { 0, 1, 2, 3, 4, 5, 6, 7, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED }; uint8_t col_mapping[MATRIX_COLS] = { 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; uint8_t row_max_count = MUX_PORTS * 1; uint8_t col_max_count = MUX_PORTS * (MUX_COUNT - 1); uint16_t shift_out_cache = 0; void kimera_init(void) { // read config if (read_matrix_mapping()) { write_matrix_mapping(); } // init shift out pins MOSI_DDR |= (1<>8) & 0xFF); while (!(SPSR & (1<