forked from mirrors/qmk_userspace
sean
This commit is contained in:
parent
98f486a633
commit
2e0d872ab7
7 changed files with 92 additions and 61 deletions
|
@ -136,38 +136,36 @@ uint8_t matrix_key_count(void)
|
|||
|
||||
static void init_cols(void)
|
||||
{
|
||||
DDRB &= ~(1<<7 | 1<<4 | 1<<5 | 1<<6);
|
||||
PORTB |= (1<<7 | 1<<4 | 1<<5 | 1<<6);
|
||||
DDRC &= ~(1<<6);
|
||||
PORTC |= (1<<6);
|
||||
DDRD &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7);
|
||||
PORTD |= (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7);
|
||||
DDRF &= ~(1<<7 | 1<<6);
|
||||
PORTF |= (1<<7 | 1<<6);
|
||||
DDRB &= ~(1<<6 | 1<<5 | 1<<4);
|
||||
PORTB |= (1<<6 | 1<<5 | 1<<4);
|
||||
DDRD &= ~(1<<7 | 1<<6 | 1<<4);
|
||||
PORTD |= (1<<7 | 1<<6 | 1<<4);
|
||||
DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
|
||||
PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
|
||||
|
||||
}
|
||||
|
||||
static matrix_row_t read_cols(void)
|
||||
{
|
||||
return (PINB&(1<<7) ? 0 : (1<<0)) |
|
||||
(PIND&(1<<0) ? 0 : (1<<1)) |
|
||||
(PIND&(1<<1) ? 0 : (1<<2)) |
|
||||
(PIND&(1<<2) ? 0 : (1<<3)) |
|
||||
(PIND&(1<<3) ? 0 : (1<<4)) |
|
||||
(PINC&(1<<6) ? 0 : (1<<5)) |
|
||||
(PIND&(1<<7) ? 0 : (1<<6)) |
|
||||
(PINB&(1<<4) ? 0 : (1<<7)) |
|
||||
(PINB&(1<<5) ? 0 : (1<<8)) |
|
||||
(PINB&(1<<6) ? 0 : (1<<9)) |
|
||||
(PINF&(1<<7) ? 0 : (1<<10)) |
|
||||
(PINF&(1<<6) ? 0 : (1<<11));
|
||||
return (PIND&(1<<4) ? 0 : (1<<0)) |
|
||||
(PIND&(1<<6) ? 0 : (1<<1)) |
|
||||
(PIND&(1<<7) ? 0 : (1<<2)) |
|
||||
(PINB&(1<<4) ? 0 : (1<<3)) |
|
||||
(PINB&(1<<5) ? 0 : (1<<4)) |
|
||||
(PINB&(1<<6) ? 0 : (1<<5)) |
|
||||
(PINF&(1<<7) ? 0 : (1<<6)) |
|
||||
(PINF&(1<<6) ? 0 : (1<<7)) |
|
||||
(PINF&(1<<5) ? 0 : (1<<8)) |
|
||||
(PINF&(1<<4) ? 0 : (1<<9)) |
|
||||
(PINF&(1<<1) ? 0 : (1<<10)) |
|
||||
(PINF&(1<<0) ? 0 : (1<<11));
|
||||
|
||||
}
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5);
|
||||
PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5);
|
||||
DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3);
|
||||
PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3);
|
||||
|
||||
}
|
||||
|
||||
|
@ -175,20 +173,20 @@ static void select_row(uint8_t row)
|
|||
{
|
||||
switch (row) {
|
||||
case 0:
|
||||
DDRF |= (1<<0);
|
||||
PORTF &= ~(1<<0);
|
||||
DDRB |= (1<<0);
|
||||
PORTB &= ~(1<<0);
|
||||
break;
|
||||
case 1:
|
||||
DDRF |= (1<<1);
|
||||
PORTF &= ~(1<<1);
|
||||
DDRB |= (1<<1);
|
||||
PORTB &= ~(1<<1);
|
||||
break;
|
||||
case 2:
|
||||
DDRF |= (1<<4);
|
||||
PORTF &= ~(1<<4);
|
||||
DDRB |= (1<<2);
|
||||
PORTB &= ~(1<<2);
|
||||
break;
|
||||
case 3:
|
||||
DDRF |= (1<<5);
|
||||
PORTF &= ~(1<<5);
|
||||
DDRB |= (1<<3);
|
||||
PORTB &= ~(1<<3);
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue