aboutsummaryrefslogtreecommitdiff
path: root/keyboards/duck/eagle_viper/v2/matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/duck/eagle_viper/v2/matrix.c')
-rw-r--r--keyboards/duck/eagle_viper/v2/matrix.c60
1 files changed, 29 insertions, 31 deletions
diff --git a/keyboards/duck/eagle_viper/v2/matrix.c b/keyboards/duck/eagle_viper/v2/matrix.c
index a6bc56342..b705ae49f 100644
--- a/keyboards/duck/eagle_viper/v2/matrix.c
+++ b/keyboards/duck/eagle_viper/v2/matrix.c
@@ -123,31 +123,27 @@ void matrix_print(void) {
123 } 123 }
124} 124}
125 125
126/* Row pin configuration 126/* Row pin configuration - diode connected
127 * row: 0 1 2 3 4 5 127 * row: 0 1 2 3 4
128 * pin: PB7 PD0 PD1 PD2 PD3 PD5 128 * pin: PD0 PD1 PD2 PD3 PD5
129 * 129 *
130 * Esc uses its own pin PE2 130 * Caps Lock uses its own pin PE2 on the column pin, row pin is grounded
131 */ 131 */
132static void init_rows(void) { 132static void init_rows(void) {
133 DDRD &= ~0b00101111; 133 DDRD &= ~0b00101111;
134 PORTD &= ~0b00101111; 134 PORTD &= ~0b00101111;
135 135
136 DDRB &= ~0b10000000;
137 PORTB &= ~0b10000000;
138
139 DDRE &= ~0b00000100; 136 DDRE &= ~0b00000100;
140 PORTE |= 0b00000100; 137 PORTE |= 0b00000100;
141} 138}
142 139
143static uint8_t read_rows(uint8_t col) { 140static uint8_t read_rows(uint8_t col) {
144 141
145 return (PIND&(1<<0) ? (1<<0) : 0) | 142 return (PIND&(1<<0) ? (1<<0) : 0) |
146 (PIND&(1<<1) ? (1<<1) : 0) | 143 (PIND&(1<<1) ? (1<<1) : 0) |
147 (PIND&(1<<2) ? (1<<2) : 0) | 144 (PIND&(1<<2) ? (1<<2) : 0) |
148 (PIND&(1<<3) ? (1<<3) : 0) | 145 (PIND&(1<<3) ? (1<<3) : 0) |
149 (PIND&(1<<5) ? (1<<4) : 0) | 146 (PIND&(1<<5) ? (1<<4) : 0) |
150 (PINB&(1<<7) ? (1<<5) : 0) |
151 (col==0 ? ((PINE&(1<<2) ? 0 : (1<<2))) : 0); 147 (col==0 ? ((PINE&(1<<2) ? 0 : (1<<2))) : 0);
152 148
153} 149}
@@ -158,24 +154,31 @@ uint8_t read_fwkey(void)
158} 154}
159 155
160/* Columns 0 - 15 156/* Columns 0 - 15
157 *
158 * atmega32u4 decoder pin
159 * PC6 U1 E3
160 * PB6 U2 E3
161 * PF0 U1, U2 A0
162 * PF1 U1, U2 A1
163 * PC7 U1, U2 A2
164 *
161 * These columns uses two 74HC237D 3 to 8 bit demultiplexers. 165 * These columns uses two 74HC237D 3 to 8 bit demultiplexers.
162 * col / pin: PC6 PB6 PF0 PF1 PC7 166 * col / pin: PC6 PB6 PF0 PF1 PC7 Decoder Pin
163 * 0: 1 0 0 0 0 167 * 0: 1 0 0 0 0 U1 Y0
164 * 1: 1 0 1 0 0 168 * 1: 1 0 1 0 0 U1 Y1
165 * 2: 1 0 0 1 0 169 * 2: 1 0 0 1 0 U1 Y2
166 * 3: 1 0 1 1 0 170 * 3: 1 0 1 1 0 U1 Y3
167 * 4: 1 0 0 0 1 171 * 4: 1 0 0 0 1 U1 Y4
168 * 5: 1 0 1 0 1 172 * 5: 1 0 1 0 1 U1 Y5
169 * 6: 1 0 0 1 1 173 * 6: 1 0 0 1 1 U1 Y6
170 * 7: 1 0 1 1 1 174 * 7: 1 0 1 1 1 U1 Y7
171 * 8: 0 1 0 0 0 175 * 8: 0 1 0 0 0 U2 Y0
172 * 9: 0 1 1 0 0 176 * 9: 0 1 1 0 0 U2 Y1
173 * 10: 0 1 0 1 0 177 * 10: 0 1 0 1 0 U2 Y2
174 * 11: 0 1 1 1 0 178 * 11: 0 1 1 1 0 U2 Y3
175 * 12: 0 1 0 0 1 179 * 12: 0 1 0 0 1 U2 Y4
176 * 13: 0 1 1 0 1 180 * 13: 0 1 1 0 1 U2 Y5
177 * 14: 0 1 0 1 1 181 * 14: 0 1 0 1 1 U2 Y6
178 * 15: 0 1 1 1 1
179 * 182 *
180 */ 183 */
181static void unselect_cols(void) { 184static void unselect_cols(void) {
@@ -251,10 +254,5 @@ static void select_col(uint8_t col) {
251 PORTF |= 0b00000010; 254 PORTF |= 0b00000010;
252 PORTC |= 0b10000000; 255 PORTC |= 0b10000000;
253 break; 256 break;
254 case 15:
255 PORTB |= 0b01000000;
256 PORTF |= 0b00000011;
257 PORTC |= 0b10000000;
258 break;
259 } 257 }
260} 258}