/* Set 0 if debouncing isn't needed */
-#ifndef DEBOUNCING_DELAY
-# define DEBOUNCING_DELAY 5
+#ifndef DEBOUNCE
+# define DEBOUNCE 5
#endif
-#if (DEBOUNCING_DELAY > 0)
+#if (DEBOUNCE > 0)
static uint16_t debouncing_time;
static bool debouncing = false;
#endif
uint8_t matrix_scan(void)
{
- if (mcp23018_status) {
+ if (mcp23018_status) {
/* if there was an error */
if (++mcp23018_reset_loop == 0) {
/* since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans
/* Set row, read cols */
for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
-# if (DEBOUNCING_DELAY > 0)
+# if (DEBOUNCE > 0)
bool matrix_changed = read_cols_on_row(matrix_debouncing, current_row);
if (matrix_changed) {
# endif
}
-# if (DEBOUNCING_DELAY > 0)
- if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
+# if (DEBOUNCE > 0)
+ if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCE)) {
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
matrix[i] = matrix_debouncing[i];
}
bool matrix_is_modified(void)
{
-#if (DEBOUNCING_DELAY > 0)
+#if (DEBOUNCE > 0)
if (debouncing) return false;
#endif
return true;
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
- return (matrix[row] & ((matrix_row_t)1<col));
+ return (matrix[row] & ((matrix_row_t)1<<col));
}
inline
select_row(current_row);
wait_us(30);
- if (mcp23018_status) {
+ if (mcp23018_status) {
/* if there was an error */
return 0;
} else {
static void select_row(uint8_t row)
{
- if (mcp23018_status) {
+ if (mcp23018_status) {
/* if there was an error do nothing */
} else {
/* set active row low : 0