The previous two options were COL2ROW, ROW2COL; this adds CUSTOM_MATRIX
to disable the built-in matrix scanning code.
Most notably, this obviates the need to set MATRIX_ROW_PINS or
MATRIX_COL_PINS.
#define CONFIG_DEFINITIONS_H
/* diode directions */
#define CONFIG_DEFINITIONS_H
/* diode directions */
-#define COL2ROW 0
-#define ROW2COL 1
+#define COL2ROW 0
+#define ROW2COL 1
+#define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */
+
/* I/O pins */
#ifndef F0
#define B0 0x30
/* I/O pins */
#ifndef F0
#define B0 0x30
extern const matrix_row_t matrix_mask[];
#endif
extern const matrix_row_t matrix_mask[];
#endif
+#if (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
static void unselect_rows(void);
static void select_row(uint8_t row);
static void unselect_row(uint8_t row);
static void unselect_rows(void);
static void select_row(uint8_t row);
static void unselect_row(uint8_t row);
+#elif (DIODE_DIRECTION == ROW2COL)
static void init_rows(void);
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
static void unselect_cols(void);
static void init_rows(void);
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
static void unselect_cols(void);
// /* PORTxn */
// _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF);
// }
// /* PORTxn */
// _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF);
// }
+// #elif (DIODE_DIRECTION == ROW2COL)
// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
// /* DDRxn */
// _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF);
// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
// /* DDRxn */
// _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF);
#if (DIODE_DIRECTION == COL2ROW)
unselect_rows();
init_cols();
#if (DIODE_DIRECTION == COL2ROW)
unselect_rows();
init_cols();
+#elif (DIODE_DIRECTION == ROW2COL)
unselect_cols();
init_rows();
#endif
unselect_cols();
init_rows();
#endif
+#elif (DIODE_DIRECTION == ROW2COL)
// Set col, read rows
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
// Set col, read rows
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
+#elif (DIODE_DIRECTION == ROW2COL)
static void init_rows(void)
{
static void init_rows(void)
{
#define MATRIX_COL_PINS { F1, F0, B0 }
#define UNUSED_PINS
#define MATRIX_COL_PINS { F1, F0, B0 }
#define UNUSED_PINS
-/* COL2ROW or ROW2COL */
+/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
#define DIODE_DIRECTION COL2ROW
// #define BACKLIGHT_PIN B7
#define DIODE_DIRECTION COL2ROW
// #define BACKLIGHT_PIN B7