|
|
@ -42,22 +42,22 @@ static void select_col(uint8_t col);
|
|
|
|
reaches the value in the output compare register,
|
|
|
|
reaches the value in the output compare register,
|
|
|
|
and are turned on when it reaches TOP (=256). */
|
|
|
|
and are turned on when it reaches TOP (=256). */
|
|
|
|
static
|
|
|
|
static
|
|
|
|
void setup_leds(void) {
|
|
|
|
void setup_leds(void)
|
|
|
|
TCCR1A |= // Timer control register 1A
|
|
|
|
{
|
|
|
|
(1<<WGM10) | // Fast PWM 8-bit
|
|
|
|
TCCR1A |= // Timer control register 1A
|
|
|
|
(1<<COM1B1)| // Clear OC1B on match, set at TOP
|
|
|
|
(1<<WGM10) | // Fast PWM 8-bit
|
|
|
|
(1<<COM1C1); // Clear OC1C on match, set at TOP
|
|
|
|
(1<<COM1B1)| // Clear OC1B on match, set at TOP
|
|
|
|
TCCR1B |= // Timer control register 1B
|
|
|
|
(1<<COM1C1); // Clear OC1C on match, set at TOP
|
|
|
|
(1<<WGM12) | // Fast PWM 8-bit
|
|
|
|
TCCR1B |= // Timer control register 1B
|
|
|
|
(1<<CS12); // Prescaler 256
|
|
|
|
(1<<WGM12) | // Fast PWM 8-bit
|
|
|
|
OCR1B = 250; // Output compare register 1B
|
|
|
|
(1<<CS12); // Prescaler 256
|
|
|
|
OCR1C = 250; // Output compare register 1C
|
|
|
|
OCR1B = 250; // Output compare register 1B
|
|
|
|
// LEDs: LED_A -> PORTB6, LED_B -> PORTB7
|
|
|
|
OCR1C = 250; // Output compare register 1C
|
|
|
|
DDRB &= 0x3F;
|
|
|
|
// LEDs: LED_A -> PORTB6, LED_B -> PORTB7
|
|
|
|
PORTB &= 0x3F;
|
|
|
|
DDRB &= 0x3F;
|
|
|
|
|
|
|
|
PORTB &= 0x3F;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
uint8_t matrix_rows(void)
|
|
|
|
uint8_t matrix_rows(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -82,7 +82,7 @@ void matrix_init(void)
|
|
|
|
setup_leds();
|
|
|
|
setup_leds();
|
|
|
|
|
|
|
|
|
|
|
|
// initialize matrix state: all keys off
|
|
|
|
// initialize matrix state: all keys off
|
|
|
|
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
|
|
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
|
|
|
matrix[i] = 0;
|
|
|
|
matrix[i] = 0;
|
|
|
|
matrix_debouncing[i] = 0;
|
|
|
|
matrix_debouncing[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|