Example #1
0
void matrix_init(void)
{
    //debug_enable = true;
    
    //dprint("matrix_init"); dprintln();
    // output high (leds)
    DDRD    = 0xFF;
    PORTD   = 0xFF;
    
    // output low (multiplexers)
    DDRF    = 0xFF;
    PORTF   = 0x00;
    
    // input with pullup (matrix)
    DDRB    = 0x00;
    PORTB   = 0xFF;
    
    // input with pullup (program and keypad buttons)
    DDRC    = 0x00;
    PORTC   = 0xFF;
    
    // initialize row and col
    unselect();

    // initialize matrix state: all keys off
    for (uint8_t i=0; i < MATRIX_ROWS; i++) {
        matrix[i] = 0;
        matrix_debouncing[i] = 0;
    }
	
	blink_all_leds();
}
Example #2
0
 void matrix_init_kb(void) {
	  blink_all_leds();
	  matrix_init_user();
}