aboutsummaryrefslogtreecommitdiff
path: root/keyboard/IIgs_Standard/matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/IIgs_Standard/matrix.c')
-rw-r--r--keyboard/IIgs_Standard/matrix.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/keyboard/IIgs_Standard/matrix.c b/keyboard/IIgs_Standard/matrix.c
index 89a09877d..6cd806e2d 100644
--- a/keyboard/IIgs_Standard/matrix.c
+++ b/keyboard/IIgs_Standard/matrix.c
@@ -86,6 +86,8 @@ void matrix_init(void)
86 PORTC |= 0b01111111; 86 PORTC |= 0b01111111;
87 DDRE &= ~0b00000010; 87 DDRE &= ~0b00000010;
88 PORTE |= 0b00000010; 88 PORTE |= 0b00000010;
89 //DDRB &= ~0b00000100;
90 //PORTB |= 0b00000100;
89 // modifier B3/4,F4/5,E4 always input 91 // modifier B3/4,F4/5,E4 always input
90 // A0 92 // A0
91 //DDRA |= 0b00000001; 93 //DDRA |= 0b00000001;
@@ -255,12 +257,13 @@ static uint8_t read_col(uint8_t row)
255 // Modifier would be copied to report->mods except E4(CAPSLOCK) 257 // Modifier would be copied to report->mods except E4(CAPSLOCK)
256 uint8_t tmp; 258 uint8_t tmp;
257 if ( row == 10 ) { 259 if ( row == 10 ) {
258 tmp = 0xE0; 260 tmp = 0xC0;
259 tmp |= (PINB >> 3 ) & 0b00000011; // LEFT CTRL is 0bit in modifier (HID Spec) 261 tmp |= (PINB >> 3 ) & 0b00000011; // LEFT CTRL is 0bit in modifier (HID Spec)
260 // LEFT SHIFT is 1bit in modifier (HID Spec) 262 // LEFT SHIFT is 1bit in modifier (HID Spec)
261 tmp |= (PINF >> 3 ) & 0b00000100; // LEFT ALT is 2bit in modifier (HID Spec) 263 tmp |= (PINF >> 3 ) & 0b00000100; // LEFT ALT is 2bit in modifier (HID Spec)
262 tmp |= (PINF >> 1 ) & 0b00001000; // LEFT GUI is 3bit in modifier (HID Spec) 264 tmp |= (PINF >> 1 ) & 0b00001000; // LEFT GUI is 3bit in modifier (HID Spec)
263 tmp |= (PINA << 4 ) & 0b00010000; // 265 tmp |= (PINA << 4 ) & 0b00010000; // CAPSLOCK
266 tmp |= (PINB << 3 ) & 0b00100000; // POWER
264 //tmp |= (PINE << 1 ) & 0b00010000; // Caps Lock(Should not be in modifier 267 //tmp |= (PINE << 1 ) & 0b00010000; // Caps Lock(Should not be in modifier
265 } else { 268 } else {
266 tmp = 0x00; 269 tmp = 0x00;
@@ -284,10 +287,10 @@ static void unselect_rows(void)
284 DDRF &= ~0b11000111; // PF: 7,6,2,1,0 287 DDRF &= ~0b11000111; // PF: 7,6,2,1,0
285 PORTF &= ~0b11000111; 288 PORTF &= ~0b11000111;
286 // to unselect virtual row(modifier), set port to output with low 289 // to unselect virtual row(modifier), set port to output with low
287 DDRA |= 0b00000001; // PA: 0 290 DDRA |= 0b00000001; // PA: 0 for CAPSLOCK
288 PORTA &= ~0b00000001; 291 PORTA &= ~0b00000001;
289 DDRB |= 0b00011000; // PB: 3,4 for modifier(row10) 292 DDRB |= 0b00011100; // PB: 3,4 for modifier(row10)
290 PORTB &= ~0b00011000; 293 PORTB &= ~0b00011100; // PB: 2 for power
291 DDRF |= 0b00110000; // PF: 4,5 for modifier 294 DDRF |= 0b00110000; // PF: 4,5 for modifier
292 PORTF &= ~0b00110000; 295 PORTF &= ~0b00110000;
293} 296}
@@ -345,8 +348,8 @@ static void select_row(uint8_t row)
345 // to select virtual row, set port as input 348 // to select virtual row, set port as input
346 DDRA &= ~0b00000001; 349 DDRA &= ~0b00000001;
347 PORTA |= 0b00000001; 350 PORTA |= 0b00000001;
348 DDRB &= ~0b00011000; 351 DDRB &= ~0b00011100;
349 PORTB |= 0b00011000; 352 PORTB |= 0b00011100;
350 DDRF &= ~0b00110000; 353 DDRF &= ~0b00110000;
351 PORTF |= 0b00110000; 354 PORTF |= 0b00110000;
352 break; 355 break;