diff options
| author | mechmerlin <mechmerlin@gmail.com> | 2019-07-14 18:00:09 -0700 |
|---|---|---|
| committer | mechmerlin <mechmerlin@gmail.com> | 2019-07-14 18:00:09 -0700 |
| commit | b8c5efa555eb680ad2bf6a7f9a12d0b4ccab0d15 (patch) | |
| tree | 39880b957a956f1102c7c8a5fe24c73a3e8c25ec | |
| parent | 421125211741993ba874068dadf4ab371d4d13de (diff) | |
| download | qmk_firmware-b8c5efa555eb680ad2bf6a7f9a12d0b4ccab0d15.tar.gz qmk_firmware-b8c5efa555eb680ad2bf6a7f9a12d0b4ccab0d15.zip | |
remove custom matrix support
| -rw-r--r-- | keyboards/winkeyless/bface/config.h | 9 | ||||
| -rw-r--r-- | keyboards/winkeyless/bface/matrix.c | 113 | ||||
| -rw-r--r-- | keyboards/winkeyless/bface/rules.mk | 5 |
3 files changed, 8 insertions, 119 deletions
diff --git a/keyboards/winkeyless/bface/config.h b/keyboards/winkeyless/bface/config.h index 11ac373c0..7a1fe3335 100644 --- a/keyboards/winkeyless/bface/config.h +++ b/keyboards/winkeyless/bface/config.h | |||
| @@ -16,8 +16,7 @@ You should have received a copy of the GNU General Public License | |||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #ifndef CONFIG_H | 19 | #pragma once |
| 20 | #define CONFIG_H | ||
| 21 | 20 | ||
| 22 | #define VENDOR_ID 0x20A0 | 21 | #define VENDOR_ID 0x20A0 |
| 23 | #define PRODUCT_ID 0x422D | 22 | #define PRODUCT_ID 0x422D |
| @@ -30,6 +29,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 30 | #define MATRIX_ROWS 8 | 29 | #define MATRIX_ROWS 8 |
| 31 | #define MATRIX_COLS 15 | 30 | #define MATRIX_COLS 15 |
| 32 | 31 | ||
| 32 | // 0 1 2 3 4 5 6 7 8 9 A B C D E | ||
| 33 | #define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 } | ||
| 34 | #define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7} | ||
| 35 | #define UNUSED_PINS | ||
| 36 | |||
| 33 | #define RGBLED_NUM 16 | 37 | #define RGBLED_NUM 16 |
| 34 | #define RGBLIGHT_ANIMATIONS | 38 | #define RGBLIGHT_ANIMATIONS |
| 35 | 39 | ||
| @@ -43,4 +47,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 43 | #define BACKLIGHT_PORT_NUM (1 << 4) | 47 | #define BACKLIGHT_PORT_NUM (1 << 4) |
| 44 | #endif | 48 | #endif |
| 45 | 49 | ||
| 46 | #endif | ||
diff --git a/keyboards/winkeyless/bface/matrix.c b/keyboards/winkeyless/bface/matrix.c deleted file mode 100644 index b3761a63c..000000000 --- a/keyboards/winkeyless/bface/matrix.c +++ /dev/null | |||
| @@ -1,113 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> | ||
| 3 | |||
| 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. | ||
| 8 | |||
| 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. | ||
| 13 | |||
| 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/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <avr/io.h> | ||
| 19 | #include <util/delay.h> | ||
| 20 | |||
| 21 | #include "matrix.h" | ||
| 22 | |||
| 23 | #ifndef DEBOUNCE | ||
| 24 | # define DEBOUNCE 5 | ||
| 25 | #endif | ||
| 26 | |||
| 27 | static uint8_t debouncing = DEBOUNCE; | ||
| 28 | |||
| 29 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 30 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
| 31 | |||
| 32 | void matrix_init(void) { | ||
| 33 | // all outputs for rows high | ||
| 34 | DDRB = 0xFF; | ||
| 35 | PORTB = 0xFF; | ||
| 36 | // all inputs for columns | ||
| 37 | DDRA = 0x00; | ||
| 38 | DDRC &= ~(0x111111<<2); | ||
| 39 | DDRD &= ~(1<<PIND7); | ||
| 40 | // all columns are pulled-up | ||
| 41 | PORTA = 0xFF; | ||
| 42 | PORTC |= (0b111111<<2); | ||
| 43 | PORTD |= (1<<PIND7); | ||
| 44 | |||
| 45 | // initialize matrix state: all keys off | ||
| 46 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 47 | matrix[row] = 0x00; | ||
| 48 | matrix_debouncing[row] = 0x00; | ||
| 49 | } | ||
| 50 | |||
| 51 | // activate backlight | ||
| 52 | //PORTD |= (1 << 4); | ||
| 53 | //_SFR_IO8(0x09) |= (1 << 4); //_BV(0x94 & 0xF); | ||
| 54 | // | ||
| 55 | // this is the code that *should* be executed in quantum.c | ||
| 56 | _SFR_IO8(0x12) |= _BV(0x4); | ||
| 57 | } | ||
| 58 | |||
| 59 | void matrix_set_row_status(uint8_t row) { | ||
| 60 | DDRB = (1 << row); | ||
| 61 | PORTB = ~(1 << row); | ||
| 62 | } | ||
| 63 | |||
| 64 | uint8_t bit_reverse(uint8_t x) { | ||
| 65 | x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); | ||
| 66 | x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); | ||
| 67 | x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); | ||
| 68 | return x; | ||
| 69 | } | ||
| 70 | |||
| 71 | uint8_t matrix_scan(void) { | ||
| 72 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 73 | matrix_set_row_status(row); | ||
| 74 | _delay_us(5); | ||
| 75 | |||
| 76 | matrix_row_t cols = ( | ||
| 77 | // cols 0..7, PORTA 0 -> 7 | ||
| 78 | (~PINA) & 0xFF | ||
| 79 | ) | ( | ||
| 80 | // cols 8..13, PORTC 7 -> 0 | ||
| 81 | bit_reverse((~PINC) & 0xFF) << 8 | ||
| 82 | ) | ( | ||
| 83 | // col 14, PORTD 7 | ||
| 84 | ((~PIND) & (1 << PIND7)) << 7 | ||
| 85 | ); | ||
| 86 | |||
| 87 | if (matrix_debouncing[row] != cols) { | ||
| 88 | matrix_debouncing[row] = cols; | ||
| 89 | debouncing = DEBOUNCE; | ||
| 90 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | if (debouncing) { | ||
| 94 | if (--debouncing) { | ||
| 95 | _delay_ms(1); | ||
| 96 | } else { | ||
| 97 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 98 | matrix[i] = matrix_debouncing[i]; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | matrix_scan_user(); | ||
| 104 | |||
| 105 | return 1; | ||
| 106 | } | ||
| 107 | |||
| 108 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
| 109 | return matrix[row]; | ||
| 110 | } | ||
| 111 | |||
| 112 | void matrix_print(void) { | ||
| 113 | } | ||
diff --git a/keyboards/winkeyless/bface/rules.mk b/keyboards/winkeyless/bface/rules.mk index 369ccf2ed..49b012e52 100644 --- a/keyboards/winkeyless/bface/rules.mk +++ b/keyboards/winkeyless/bface/rules.mk | |||
| @@ -25,7 +25,7 @@ NO_SUSPEND_POWER_DOWN = yes | |||
| 25 | F_CPU = 12000000 | 25 | F_CPU = 12000000 |
| 26 | 26 | ||
| 27 | # build options | 27 | # build options |
| 28 | BOOTMAGIC_ENABLE = yes | 28 | BOOTMAGIC_ENABLE = no |
| 29 | MOUSEKEY_ENABLE = yes | 29 | MOUSEKEY_ENABLE = yes |
| 30 | EXTRAKEY_ENABLE = yes | 30 | EXTRAKEY_ENABLE = yes |
| 31 | CONSOLE_ENABLE = no | 31 | CONSOLE_ENABLE = no |
| @@ -40,8 +40,7 @@ OPT_DEFS = -DDEBUG_LEVEL=0 | |||
| 40 | OPT_DEFS += -DBOOTLOADER_SIZE=2048 | 40 | OPT_DEFS += -DBOOTLOADER_SIZE=2048 |
| 41 | 41 | ||
| 42 | # custom matrix setup | 42 | # custom matrix setup |
| 43 | CUSTOM_MATRIX = yes | 43 | SRC = i2c.c backlight_ps2avrGB.c |
| 44 | SRC = matrix.c i2c.c backlight_ps2avrGB.c | ||
| 45 | 44 | ||
| 46 | # programming options | 45 | # programming options |
| 47 | PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex | 46 | PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex |
