void blink_all_leds(void) { all_led_on(); _delay_ms(500); all_led_off(); _delay_ms(100); caps_lock_led_on(); _delay_ms(100); num_lock_led_on(); _delay_ms(100); scroll_lock_led_on(); _delay_ms(100); keypad_led_on(); _delay_ms(100); //back scroll_lock_led_on(); _delay_ms(100); num_lock_led_on(); _delay_ms(100); caps_lock_led_on(); _delay_ms(100); all_led_off(); }
uint8_t matrix_scan(void) { uint8_t layer = biton32(layer_state); switch (layer) { case 0: all_led_off(); break; case 1: if (!(host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK))) { all_led_off(); caps_lock_led_on(); } break; case 2: all_led_off(); num_lock_led_on(); break; default: break; } for (uint8_t i = 0; i < MATRIX_ROWS; i++) { select(i); uint8_t row = read(i); if (matrix_debouncing[i] != row) { matrix_debouncing[i] = row; if (debouncing) { debug("bounce!: "); debug_hex(debouncing); debug("\n"); } debouncing = DEBOUNCE; } unselect(); } if (debouncing) { if (--debouncing) { _delay_ms(1); } else { for (uint8_t i = 0; i < MATRIX_ROWS; i++) { matrix[i] = matrix_debouncing[i]; } } } return 1; }