@ -60,8 +60,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern const matrix_row_t matrix_mask [ ] ;
extern const matrix_row_t matrix_mask [ ] ;
# endif
# endif
# if (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
static const uint8_t row_pins [ MATRIX_ROWS ] = MATRIX_ROW_PINS ;
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 col_pins [ MATRIX_COLS ] = MATRIX_COL_PINS ;
# endif
/* matrix state(1:on, 0:off) */
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix [ MATRIX_ROWS ] ;
static matrix_row_t matrix [ MATRIX_ROWS ] ;
@ -75,7 +77,7 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS];
static void unselect_rows ( void ) ;
static void unselect_rows ( void ) ;
static void select_row ( uint8_t row ) ;
static void select_row ( uint8_t row ) ;
static void unselect_row ( uint8_t row ) ;
static void unselect_row ( uint8_t row ) ;
# el se // ROW2COL
# el if (DIODE_DIRECTION == ROW2COL)
static void init_rows ( void ) ;
static void init_rows ( void ) ;
static bool read_rows_on_col ( matrix_row_t current_matrix [ ] , uint8_t current_col ) ;
static bool read_rows_on_col ( matrix_row_t current_matrix [ ] , uint8_t current_col ) ;
static void unselect_cols ( void ) ;
static void unselect_cols ( void ) ;
@ -132,7 +134,7 @@ uint8_t matrix_cols(void) {
// /* PORTxn */
// /* PORTxn */
// _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF);
// _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF);
// }
// }
// #el se
// #el if (DIODE_DIRECTION == ROW2COL)
// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
// /* DDRxn */
// /* DDRxn */
// _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF);
// _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF);
@ -157,7 +159,7 @@ void matrix_init(void) {
# if (DIODE_DIRECTION == COL2ROW)
# if (DIODE_DIRECTION == COL2ROW)
unselect_rows ( ) ;
unselect_rows ( ) ;
init_cols ( ) ;
init_cols ( ) ;
# el se // ROW2COL
# el if (DIODE_DIRECTION == ROW2COL)
unselect_cols ( ) ;
unselect_cols ( ) ;
init_rows ( ) ;
init_rows ( ) ;
# endif
# endif
@ -192,7 +194,7 @@ uint8_t matrix_scan(void)
}
}
# el se // ROW2COL
# el if (DIODE_DIRECTION == ROW2COL)
// Set col, read rows
// Set col, read rows
for ( uint8_t current_col = 0 ; current_col < MATRIX_COLS ; current_col + + ) {
for ( uint8_t current_col = 0 ; current_col < MATRIX_COLS ; current_col + + ) {
@ -334,7 +336,7 @@ static void unselect_rows(void)
}
}
}
}
# el se // ROW2COL
# el if (DIODE_DIRECTION == ROW2COL)
static void init_rows ( void )
static void init_rows ( void )
{
{