1
0

Fix a col mismatched with pcb

This commit is contained in:
Kai Ryu 2014-08-25 16:19:22 +09:00
parent 3d11d06b41
commit 6d6efd10f1

View File

@ -168,16 +168,22 @@ uint8_t matrix_key_count(void)
/* Column pin configuration /* Column pin configuration
* col: 0 1 2 3 4 * col: 0 1 2 3 4
* pin: D1 D2 D5 D6 B3 * pin: B0 B1 B2 B3 B4
*/ */
static void init_cols(void) static void init_cols(void)
{ {
#ifndef EXPERIMENTAL #ifndef EXPERIMENTAL
// Input with pull-up(DDR:0, PORT:1) // Input with pull-up(DDR:0, PORT:1)
/*
DDRD &= ~(1<<PD1 | 1<<PD2 | 1<<PD5 | 1<<PD6); DDRD &= ~(1<<PD1 | 1<<PD2 | 1<<PD5 | 1<<PD6);
PORTD |= (1<<PD1 | 1<<PD2 | 1<<PD5 | 1<<PD6); PORTD |= (1<<PD1 | 1<<PD2 | 1<<PD5 | 1<<PD6);
DDRB &= ~(1<<PB3); DDRB &= ~(1<<PB3);
PORTB |= (1<<PB3); PORTB |= (1<<PB3);
*/
DDRB &= ~(1<<PB0 | 1<<PB1 | 1<<PB2 | 1<<PB3 | 1<<PB4);
PORTB |= (1<<PB0 | 1<<PB1 | 1<<PB2 | 1<<PB3 | 1<<PB4);
DDRB |= (1<<PB5);
PORTB |= (1<<PB5);
#else #else
DDRD |= (1<<PD3); DDRD |= (1<<PD3);
PORTD &= ~(1<<PD3); PORTD &= ~(1<<PD3);
@ -194,16 +200,25 @@ static void init_cols(void)
/* Column pin configuration /* Column pin configuration
* col: 0 1 2 3 4 * col: 0 1 2 3 4
* pin: D1 D2 D5 D6 B3 * pin: B0 B1 B2 B3 B4
*/ */
static matrix_row_t read_cols(void) static matrix_row_t read_cols(void)
{ {
#ifndef EXPERIMENTAL #ifndef EXPERIMENTAL
/*
return (PIND&(1<<PD1) ? 0 : (1<<0)) | return (PIND&(1<<PD1) ? 0 : (1<<0)) |
(PIND&(1<<PD2) ? 0 : (1<<1)) | (PIND&(1<<PD2) ? 0 : (1<<1)) |
(PIND&(1<<PD5) ? 0 : (1<<2)) | (PIND&(1<<PD5) ? 0 : (1<<2)) |
(PIND&(1<<PD6) ? 0 : (1<<3)) | (PIND&(1<<PD6) ? 0 : (1<<3)) |
(PINB&(1<<PB3) ? 0 : (1<<4)); (PINB&(1<<PB3) ? 0 : (1<<4));
*/
return (PINB&(1<<PB0) ? 0 : (1<<0)) |
(PINB&(1<<PB1) ? 0 : (1<<1)) |
(PINB&(1<<PB3) ? 0 : (1<<2)) |
(PINB&(1<<PB2) ? 0 : (1<<3)) |
(PINB&(1<<PB4) ? 0 : (1<<4));
//return (~PINB) & 0b00011111;
#else #else
return (PINE&(1<<PE6) ? 0 : (1<<0)) | return (PINE&(1<<PE6) ? 0 : (1<<0)) |
(PINC&(1<<PC7) ? 0 : (1<<1)) | (PINC&(1<<PC7) ? 0 : (1<<1)) |