mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-25 01:47:10 +06:00
Migrate annepro2 away from custom matrix (#23221)
* Migrate annepro2 away from custom matrix * LTO
This commit is contained in:
parent
83e6ddbbb4
commit
c48f372c87
|
@ -19,27 +19,12 @@
|
|||
|
||||
#include "pin_defs.h"
|
||||
|
||||
// key matrix size
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 14
|
||||
// layer size: MATRIX_ROWS * MATRIX_COLS * sizeof(uint16_t) = 140 bytes
|
||||
|
||||
#define LINE_UART_TX B0 // Master TX, LED RX
|
||||
#define LINE_UART_RX B1 // Master RX, LED TX
|
||||
|
||||
#define LINE_BT_UART_TX A4 // Master TX, BLE RX
|
||||
#define LINE_BT_UART_RX A5 // Master RX, BLE TX
|
||||
|
||||
// outputs (rows are pulled low)
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ C2, C1, B5, B4, C3 }
|
||||
|
||||
// inputs (columns are sampled)
|
||||
// PORTA 12,13 conflict with SWD
|
||||
|
||||
#define MATRIX_COL_PINS \
|
||||
{ C4, C5, B10, B11, C0, A15, A8, A10, A11, A12, A13, A14, B2, B3 }
|
||||
|
||||
// Obins stock firmware has something similar to this already enabled, but disabled by default in QMK
|
||||
#define PERMISSIVE_HOLD
|
||||
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
"backing_size": 2048
|
||||
}
|
||||
},
|
||||
"diode_direction": "COL2ROW",
|
||||
"matrix_pins": {
|
||||
"cols": ["C4", "C5", "B10", "B11", "C0", "A15", "A8", "A10", "A11", "A12", "A13", "A14", "B2", "B3"],
|
||||
"rows": ["C2", "C1", "B5", "B4", "C3"]
|
||||
},
|
||||
"rgb_matrix": {
|
||||
"animations":{
|
||||
"alphas_mods": true,
|
||||
|
|
|
@ -26,12 +26,8 @@ NKRO_ENABLE = no # Enable N-Key Rollover
|
|||
# Custom RGB matrix handling
|
||||
RGB_MATRIX_ENABLE = yes
|
||||
|
||||
# Keys
|
||||
CUSTOM_MATRIX = lite
|
||||
|
||||
# Anne Pro 2
|
||||
SRC = \
|
||||
matrix.c \
|
||||
annepro2_ble.c \
|
||||
ap2_led.c \
|
||||
protocol.c \
|
||||
|
|
|
@ -19,25 +19,12 @@
|
|||
|
||||
#include "pin_defs.h"
|
||||
|
||||
// key matrix size
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 14
|
||||
// layer size: MATRIX_ROWS * MATRIX_COLS * sizeof(uint16_t) = 140 bytes
|
||||
|
||||
#define LINE_UART_TX B0
|
||||
#define LINE_UART_RX B1
|
||||
|
||||
#define LINE_BT_UART_TX A4 // Master TX, BLE RX
|
||||
#define LINE_BT_UART_RX A5 // Master RX, BLE TX
|
||||
|
||||
// outputs (rows are pulled low)
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ B5, B4, B3, B2, D1 }
|
||||
|
||||
// inputs (columns are sampled)
|
||||
#define MATRIX_COL_PINS \
|
||||
{ C4, C5, D0, B15, C11, A15, C12, C13, A8, A10, A11, A14, D2, D3 }
|
||||
|
||||
// Obins stock firmware has something similar to this already enabled, but disabled by default in QMK
|
||||
#define PERMISSIVE_HOLD
|
||||
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
"backing_size": 2048
|
||||
}
|
||||
},
|
||||
"diode_direction": "COL2ROW",
|
||||
"matrix_pins": {
|
||||
"cols": ["C4", "C5", "D0", "B15", "C11", "A15", "C12", "C13", "A8", "A10", "A11", "A14", "D2", "D3"],
|
||||
"rows": ["B5", "B4", "B3", "B2", "D1"]
|
||||
},
|
||||
"rgb_matrix": {
|
||||
"animations":{
|
||||
"alphas_mods": true,
|
||||
|
|
|
@ -26,12 +26,8 @@ NKRO_ENABLE = no # Enable N-Key Rollover
|
|||
# Custom RGB matrix handling
|
||||
RGB_MATRIX_ENABLE = yes
|
||||
|
||||
# Keys
|
||||
CUSTOM_MATRIX = lite
|
||||
|
||||
# Anne Pro 2
|
||||
SRC = \
|
||||
matrix.c \
|
||||
annepro2_ble.c \
|
||||
ap2_led.c \
|
||||
protocol.c \
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
"vid": "0xAC20",
|
||||
"device_version": "13.3.7"
|
||||
},
|
||||
"build": {
|
||||
"lto": true
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT_60_ansi": {
|
||||
"layout": [
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Charlie Waters
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <hal.h>
|
||||
#include "timer.h"
|
||||
#include "wait.h"
|
||||
#include "print.h"
|
||||
#include "matrix.h"
|
||||
#include "annepro2.h"
|
||||
|
||||
pin_t row_list[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
pin_t col_list[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
|
||||
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
||||
bool matrix_has_changed = false;
|
||||
// cache of input ports for columns
|
||||
static uint16_t port_cache[4];
|
||||
// scan each row
|
||||
for (int row = 0; row < MATRIX_ROWS; row++) {
|
||||
palClearLine(row_list[row]);
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
// read i/o ports
|
||||
port_cache[0] = palReadPort(IOPORTA);
|
||||
port_cache[1] = palReadPort(IOPORTB);
|
||||
port_cache[2] = palReadPort(IOPORTC);
|
||||
port_cache[3] = palReadPort(IOPORTD);
|
||||
palSetLine(row_list[row]);
|
||||
|
||||
// get columns from ports
|
||||
matrix_row_t data = 0;
|
||||
for (int col = 0; col < MATRIX_COLS; ++col) {
|
||||
pin_t line = col_list[col];
|
||||
uint16_t port = port_cache[HT32_PAL_IDX(PAL_PORT(line))];
|
||||
data |= (((port & (1 << PAL_PAD(line))) ? 0 : 1) << col);
|
||||
}
|
||||
|
||||
if (current_matrix[row] != data) {
|
||||
current_matrix[row] = data;
|
||||
matrix_has_changed = true;
|
||||
}
|
||||
}
|
||||
return matrix_has_changed;
|
||||
}
|
Loading…
Reference in New Issue
Block a user