uint8_t matrix_scan(void) { for (uint8_t col = 0; col < MATRIX_COLS; col++) { select_col(col); _delay_us(3); uint8_t rows = read_rows(col); for (uint8_t row = 0; row < MATRIX_ROWS; row++) { bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); bool curr_bit = rows & (1<<row); if (prev_bit != curr_bit) { matrix_debouncing[row] ^= ((matrix_row_t)1<<col); debouncing = DEBOUNCING_DELAY; } } unselect_cols(); } if (debouncing) { if (--debouncing) { _delay_ms(1); } else { for (uint8_t i = 0; i < MATRIX_ROWS; i++) { matrix[i] = matrix_debouncing[i]; } } } matrix_scan_quantum(); return 1; }
uint8_t matrix_scan(void) { for (uint8_t col = 0; col < MATRIX_COLS; col++) { // 0-16 select_col(col); _delay_us(30); // without this wait it won't read stable value. uint16_t rows = read_rows(); for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-5 bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); bool curr_bit = rows & (1<<row); if (prev_bit != curr_bit) { matrix_debouncing[row] ^= ((matrix_row_t)1<<col); if (debouncing) { dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); } debouncing = DEBOUNCE; } } unselect_cols(); } if (debouncing) { if (--debouncing) { _delay_ms(1); } else { for (uint8_t i = 0; i < MATRIX_ROWS; i++) { matrix[i] = matrix_debouncing[i]; } } } return 1; }
uint8_t matrix_scan(void) { for (uint8_t col = 0; col < MATRIX_COLS; col++) { select_col(col); _delay_us(3); // TODO: Determine the correct value needed here. uint8_t rows = read_rows(); if((col == 0 && !LAYOUT_MINI) || (col == 2 && LAYOUT_MINI) ) { rows |= read_caps(); } for (uint8_t row = 0; row < MATRIX_ROWS; row++) { bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); bool curr_bit = rows & (1<<row); if (prev_bit != curr_bit) { matrix_debouncing[row] ^= ((matrix_row_t)1<<col); if (debouncing) { dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); } debouncing = DEBOUNCE; } } unselect_cols(); } if (debouncing) { if (--debouncing) { _delay_ms(1); } else { for (uint8_t i = 0; i < MATRIX_ROWS; i++) { matrix[i] = matrix_debouncing[i]; } } } return 1; }
void matrix_init(void) { unselect_cols(); init_rows(); for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; matrix_debouncing[i] = 0; } }
void matrix_init(void) { unselect_cols(); init_rows(); // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; matrix_debouncing[i] = 0; } }
void matrix_init(void) { backlight_init_ports(); unselect_cols(); init_rows(); for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; matrix_debouncing[i] = 0; } matrix_init_quantum(); }
void matrix_init(void) { // initialize row and col #if (DIODE_DIRECTION == COL2ROW) unselect_rows(); init_cols(); #elif (DIODE_DIRECTION == ROW2COL) unselect_cols(); init_rows(); #endif // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; matrix_debouncing[i] = 0; } matrix_init_quantum(); }
void matrix_init(void) { // To use PORTF disable JTAG with writing JTD bit twice within four cycles. //MCUCR |= (1<<JTD); //MCUCR |= (1<<JTD); // initialize row and col unselect_cols(); init_rows(); #ifndef SLEEP_LED_ENABLE setup_leds(); #endif // initialize matrix state: all keys off for (uint8_t i = 0; i < MATRIX_ROWS; i++) { matrix[i] = 0; matrix_debouncing[i] = 0; } }
void matrix_init(void) { DDRD |= 0b11010000; PORTD &= ~0b01010000; DDRB |= 0b00011111; PORTB &= ~0b00001110; PORTB |= 0b00010001; DDRE |= 0b01000000; PORTE &= ~0b01000000; unselect_cols(); init_rows(); for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; matrix_debouncing[i] = 0; } matrix_init_quantum(); }
static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { setPinInputHigh(row_pins[x]); } }