summaryrefslogtreecommitdiffstats
path: root/keyboards/frosty_flake/matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/frosty_flake/matrix.c')
-rw-r--r--keyboards/frosty_flake/matrix.c55
1 files changed, 22 insertions, 33 deletions
diff --git a/keyboards/frosty_flake/matrix.c b/keyboards/frosty_flake/matrix.c
index f289f506a..5d711a660 100644
--- a/keyboards/frosty_flake/matrix.c
+++ b/keyboards/frosty_flake/matrix.c
@@ -24,17 +24,6 @@
#include "util.h"
#include "matrix.h"
-#define CONFIG_LED_IO \
- DDRB |= (1<<7); \
- DDRC |= (1<<5) | (1<<6);
-
-#define USB_LED_CAPS_LOCK_ON PORTC &= ~(1<<5)
-#define USB_LED_CAPS_LOCK_OFF PORTC |= (1<<5)
-#define USB_LED_NUM_LOCK_ON PORTB &= ~(1<<7)
-#define USB_LED_NUM_LOCK_OFF PORTB |= (1<<7)
-#define USB_LED_SCROLL_LOCK_ON PORTC &= ~(1<<6)
-#define USB_LED_SCROLL_LOCK_OFF PORTC |= (1<<6)
-
#ifndef DEBOUNCING_DELAY
# define DEBOUNCING_DELAY 5
#endif
@@ -62,34 +51,34 @@ void matrix_init(void) {
}
uint8_t matrix_scan(void) {
- for (uint8_t col = 0; col < MATRIX_COLS; col++) {
- select_col(col);
- _delay_us(3);
- matrix_row_t col_scan = scan_col();
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
- bool curr_bit = col_scan & (1<<row);
- if (prev_bit != curr_bit) {
- matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
- debouncing = DEBOUNCING_DELAY;
- }
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ select_col(col);
+ _delay_us(3);
+ matrix_row_t col_scan = scan_col();
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
+ bool curr_bit = col_scan & (1<<row);
+ if (prev_bit != curr_bit) {
+ matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
+ debouncing = DEBOUNCING_DELAY;
+ }
+ }
}
- }
- if (debouncing) {
- if (--debouncing)
- _delay_ms(1);
- else
- for (uint8_t i = 0; i < MATRIX_ROWS; i++)
- matrix[i] = matrix_debouncing[i];
- }
+ 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;
+ matrix_scan_quantum();
+ return 1;
}
inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
+ return matrix[row];
}
void matrix_print(void) {