Fix backlight blinking issue by another way
This commit is contained in:
parent
3cca7e0591
commit
215419e3b9
@ -39,6 +39,7 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
static matrix_row_t read_cols(void);
|
||||
static void init_cols(void);
|
||||
static void init_rows(void);
|
||||
static void unselect_rows(void);
|
||||
static void select_row(uint8_t row);
|
||||
|
||||
inline
|
||||
@ -83,8 +84,7 @@ uint8_t matrix_scan(void)
|
||||
}
|
||||
debouncing = DEBOUNCE;
|
||||
}
|
||||
// select next row
|
||||
select_row((i + 1) % MATRIX_ROWS);
|
||||
unselect_rows();
|
||||
}
|
||||
|
||||
if (debouncing) {
|
||||
@ -185,6 +185,14 @@ static void init_rows(void)
|
||||
DDRB |= (1<<PB2 | 1<<PB1 | 1<<PB0);
|
||||
}
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
//PORTB |= (1<<PB2 | 1<<PB1 | 1<<PB0);
|
||||
PORTB |= (1<<PB2);
|
||||
PORTB |= (1<<PB1);
|
||||
PORTB |= (1<<PB0);
|
||||
}
|
||||
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
(row & (1<<0)) ? (PORTB |= (1<<PB2)) : (PORTB &= ~(1<<PB2));
|
||||
|
Reference in New Issue
Block a user