-static
-uint8_t *const row_pin[MATRIX_ROWS] = {_PINB, _PINB, _PINB, _PINB, _PINB, _PINB};
-
-static
-const uint8_t row_bit[MATRIX_ROWS] = { _BIT0, _BIT1, _BIT2, _BIT3, _BIT4, _BIT5};
-
-/* Specifies the ports and pin numbers for the columns */
-static
-uint8_t *const col_ddr[MATRIX_COLS] = { _DDRD, _DDRC, _DDRC, _DDRD, _DDRD, _DDRE,
- _DDRF, _DDRF, _DDRF, _DDRF, _DDRF, _DDRF,
- _DDRD, _DDRD, _DDRD, _DDRD, _DDRD};
-
-static
-uint8_t *const col_port[MATRIX_COLS] = {_PORTD, _PORTC, _PORTC, _PORTD, _PORTD, _PORTE,
- _PORTF, _PORTF, _PORTF, _PORTF, _PORTF, _PORTF,
- _PORTD, _PORTD, _PORTD, _PORTD, _PORTD};
-
-static
-const uint8_t col_bit[MATRIX_COLS] = { _BIT5, _BIT7, _BIT6, _BIT4, _BIT0, _BIT6,
- _BIT0, _BIT1, _BIT4, _BIT5, _BIT6, _BIT7,
- _BIT7, _BIT6, _BIT1, _BIT2, _BIT3};
-
-static
-inline void pull_column(int col) {
- *col_port[col] &= ~col_bit[col];
-}
-
-static
-inline void release_column(int col) {
- *col_port[col] |= col_bit[col];
-}
-
-/* PORTB is set as input with pull-up resistors
- PORTC,D,E,F are set to high output */
-
-static
-void setup_io_pins(void) {
- uint8_t row, col;
- for(row = 0; row < MATRIX_ROWS; row++) {
- *row_ddr[row] &= ~row_bit[row];
- *row_port[row] |= row_bit[row];
- }
- for(col = 0; col < MATRIX_COLS; col++) {
- *col_ddr[col] |= col_bit[col];
- *col_port[col] |= col_bit[col];
- }
-}