summaryrefslogtreecommitdiffstats
path: root/keyboards/duck/eagle_viper/v2/matrix.c
diff options
context:
space:
mode:
authorMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-04-26 11:21:40 -0700
committerDrashna Jaelre <drashna@live.com>2019-04-26 11:21:40 -0700
commitffd10d41168a7bf3eb2631490c61fb7a552fa6a6 (patch)
tree03ab98994cbcc0973ca182c7fe2a022149670910 /keyboards/duck/eagle_viper/v2/matrix.c
parent90cd383d4622b7d4603e05ad101916df47775d7c (diff)
[Keyboard] Eagle/Viper V2 Cleanups (#5709)
* cleanup matrix of unused row and column, and add more documentation * update matrix notes * update readmes * update readmes * fix comments E2 to E3
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 a6bc563422..b705ae49ff 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) {
}
}
-/* Row pin configuration
- * row: 0 1 2 3 4 5
- * pin: PB7 PD0 PD1 PD2 PD3 PD5
+/* Row pin configuration - diode connected
+ * row: 0 1 2 3 4
+ * pin: PD0 PD1 PD2 PD3 PD5
*
- * Esc uses its own pin PE2
+ * Caps Lock uses its own pin PE2 on the column pin, row pin is grounded
*/
static void init_rows(void) {
DDRD &= ~0b00101111;
PORTD &= ~0b00101111;
- DDRB &= ~0b10000000;
- PORTB &= ~0b10000000;
-
DDRE &= ~0b00000100;
PORTE |= 0b00000100;
}
static uint8_t read_rows(uint8_t col) {
- return (PIND&(1<<0) ? (1<<0) : 0) |
+ return (PIND&(1<<0) ? (1<<0) : 0) |
(PIND&(1<<1) ? (1<<1) : 0) |
(PIND&(1<<2) ? (1<<2) : 0) |
(PIND&(1<<3) ? (1<<3) : 0) |
(PIND&(1<<5) ? (1<<4) : 0) |
- (PINB&(1<<7) ? (1<<5) : 0) |
(col==0 ? ((PINE&(1<<2) ? 0 : (1<<2))) : 0);
}
@@ -158,24 +154,31 @@ uint8_t read_fwkey(void)
}
/* Columns 0 - 15
+ *
+ * atmega32u4 decoder pin
+ * PC6 U1 E3
+ * PB6 U2 E3
+ * PF0 U1, U2 A0
+ * PF1 U1, U2 A1
+ * PC7 U1, U2 A2
+ *
* These columns uses two 74HC237D 3 to 8 bit demultiplexers.
- * col / pin: PC6 PB6 PF0 PF1 PC7
- * 0: 1 0 0 0 0
- * 1: 1 0 1 0 0
- * 2: 1 0 0 1 0
- * 3: 1 0 1 1 0
- * 4: 1 0 0 0 1
- * 5: 1 0 1 0 1
- * 6: 1 0 0 1 1
- * 7: 1 0 1 1 1
- * 8: 0 1 0 0 0
- * 9: 0 1 1 0 0
- * 10: 0 1 0 1 0
- * 11: 0 1 1 1 0
- * 12: 0 1 0 0 1
- * 13: 0 1 1 0 1
- * 14: 0 1 0 1 1
- * 15: 0 1 1 1 1
+ * col / pin: PC6 PB6 PF0 PF1 PC7 Decoder Pin
+ * 0: 1 0 0 0 0 U1 Y0
+ * 1: 1 0 1 0 0 U1 Y1
+ * 2: 1 0 0 1 0 U1 Y2
+ * 3: 1 0 1 1 0 U1 Y3
+ * 4: 1 0 0 0 1 U1 Y4
+ * 5: 1 0 1 0 1 U1 Y5
+ * 6: 1 0 0 1 1 U1 Y6
+ * 7: 1 0 1 1 1 U1 Y7
+ * 8: 0 1 0 0 0 U2 Y0
+ * 9: 0 1 1 0 0 U2 Y1
+ * 10: 0 1 0 1 0 U2 Y2
+ * 11: 0 1 1 1 0 U2 Y3
+ * 12: 0 1 0 0 1 U2 Y4
+ * 13: 0 1 1 0 1 U2 Y5
+ * 14: 0 1 0 1 1 U2 Y6
*
*/
static void unselect_cols(void) {
@@ -251,10 +254,5 @@ static void select_col(uint8_t col) {
PORTF |= 0b00000010;
PORTC |= 0b10000000;
break;
- case 15:
- PORTB |= 0b01000000;
- PORTF |= 0b00000011;
- PORTC |= 0b10000000;
- break;
}
}