Takeshi ISHII b89abc402b | 2 years ago | |
---|---|---|
.. | ||
cpp_map.h | 2 years ago | |
gpio_extr.h | 2 years ago | |
matrix.c | 2 years ago | |
matrix_config_expand.c | 2 years ago | |
matrix_extension_74hc15x.c | 2 years ago | |
matrix_extr.h | 2 years ago | |
readme.md | 2 years ago | |
test_config.h | 2 years ago | |
test_config_74hc157.h | 2 years ago | |
test_config_direct.h | 2 years ago |
This matrix.c is faster and more extensible than the standard quantum/matrix.c.
matrix_scan()
function is several times faster than quantum/matrix.c.This matrix.c requires a different configuration than quantum/matrix.c.
The output pins is the Row pins if DIODE_DIRECTION == COL2ROW
, and the Col pins if DIODE_DIRECTION == ROW2COL
. When DIRECT_PINS is defined, the output pins do not need to be set.
Example:
// list of OUTPUT(row) ports
#define MATRIX_OUT_PORTS \
(Port_D, MCU_GPIO, D0), \
(Port_C, MCU_GPIO, C0), \
(Port_E, MCU_GPIO, E0), \
(Port_B, MCU_GPIO, B0)
// list of OUTPUT pins
#define MATRIX_OUT_PINS \
(0, Port_D, 4), \
(1, Port_C, 6), \
(2, Port_D, 7), \
(3, Port_E, 6), \
(4, Port_B, 4), \
(5, Port_B, 5)
The input pins is the Col pins if DIODE_DIRECTION == COL2ROW
, and the Row pins if DIODE_DIRECTION == ROW2COL
. When DIRECT_PINS is defined, the input pin settings will enumerate the connection pins of all switches.
Example:
// list of INPUT ports
#define MATRIX_IN_PORTS (Port_F, MCU_GPIO, F0), (Port_B, MCU_GPIO, B0)
// list of INPUT pins
#define MATRIX_IN_PINS \
(0, Port_F, 4), \
(1, Port_F, 5), \
(2, Port_F, 6), \
(3, Port_F, 7), \
(4, Port_B, 1), \
(5, Port_B, 3)
By defining the MATRIX_EXTENSION_74HC157
macro or MATRIX_EXTENSION_74HC153
macro, you can connect a multiplexer to the GPIO to extend the input pins.
Example:
#define MATRIX_EXTENSION_74HC157 B2 /* or #define MATRIX_EXTENSION_74HC153 B2, B6 */
// list of OUTPUT ports
#define MATRIX_OUT_PORTS (Port_D, MCU_GPIO, D0), (Port_C, MCU_GPIO, C0), (Port_E, MCU_GPIO, E0), (Port_B, MCU_GPIO, B0)
// list of OUTPUT pins
#define MATRIX_OUT_PINS (0, Port_D, 4), (1, Port_C, 6), (2, Port_D, 7), (3, Port_E, 6), (4, Port_B, 4), (5, Port_B, 5)
// list of INPUT ports
#define MATRIX_IN_PORTS \
(Port_Fa, MCU_GPIOa, F0), \
(Port_Ba, MCU_GPIOa, B0), \
(Port_Fb, MCU_GPIOb, F0), \
(Port_Bb, MCU_GPIOb, B0)
// list of INPUT pins
#define MATRIX_IN_PINS \
(0, Port_Fa, 4), \
(1, Port_Fb, 5), \
(2, Port_Fb, 6), \
(3, Port_Fa, 7), \
(4, Port_Ba, 1), \
(5, Port_Bb, 3)
I plan to provide extensions to support I/O expanders such as MCP23018 and PCA9555.
make MTEST=matrix_debug_scan[,<other options>..] handwired/symmetric70_proto/promicro/fast:default:flash
make MTEST=matrix_debug_delay[,<other options>..] handwired/symmetric70_proto/promicro/fast:default:flash
matrix_scan()
time)make MTEST=matrix_debug_scan handwired/symmetric70_proto/promicro/fast:default:flash
make MTEST=matrix_debug_delay handwired/symmetric70_proto/promicro/fast:default:flash
matrix_scan()
time)make MTEST=matrix_debug_scan handwired/symmetric70_proto/proton_c/fast:default:flash
make MTEST=matrix_debug_delay handwired/symmetric70_proto/proton_c/fast:default:flash