So I recently rewired my custom keyboard (the wires I was using previously were too thick) and now I'm running into some problems.
Initially I rewired the columns like this:
Then re-did it to make it look like this:
Here's what's been happening:
Initially when I did the first rewiring this is what happened:
When I press grv it says that I've pressed grv + tab
When I press 1 it says that I also press grv + tab
When I press 2 it say I pressed LCTRL (I placed the LCTRL where caps lock usually is
When I press 3 it says I pressed LShift
When I press 4 it say I pressed the LWIN key.
Then I rewired it (the second pic) and the same thing above happens except for when I pressed grv it says I pressed grv and when I pressed 1 it says I pressed tab only - everything else stayed the same. I then attempted to rewrite the firmware since I suck at reading the code and finding my mistakes and when I finished doing that, it improve a
little bit.
Here's a pic of the keys that registered after using the newer firmware:
The majority of the keys are jumbled up and the only one working as intended are the Enter, semi colon, O and S keys. Everything else is either jumbled up or not working (interestingly, the GRV, 1, 2 and 4 keys no longer register as anything despite it registering with the older firmware). I am absolutely lost right now, since I have no access to a multimeter at the moment (I'm planning to get one soon) I cannot check the continuity of the columns and rows and check for shorts. Whilst I plan to get a multimeter for the hardware aspect if any of you could check through my modified code to find any silly mistakes that I've made (I think the way I wired up the matrix has confused me) I would be extremely grateful.
Here's the matrix of how I hooked it up to the teensy vs the real life picture of it(please note that the real life picture is mirrored to the paint version so the side where the teensy is the side of the ENTER key):
And here's the code of only the parts I've modified:
matrix.c: (
dropbox link)
/* Column pin configuration
* col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
* pin: F0 F1 E6 C7 C6 B6 D4 B1 B0 B5 B4 D7 D6 B3 (Rev.A)
* pin: B7 (Rev.B)
*/
static void init_cols(void)
{
// Input with pull-up(DDR:0, PORT:1)
DDRF &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0);
PORTF |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0);
DDRD &= ~(1<<7 | 1<<5 | 1<<4 | 1<<3);
PORTD |= (1<<7 | 1<<5 | 1<<4 | 1<<3);
DDRC &= ~(1<<6);
PORTC |= (1<<6);
DDRB &= ~(1<<6 | 1<< 5 | 1<<4);
PORTB |= (1<<6 | 1<< 5 | 1<<4);
}
static matrix_row_t read_cols(void)
{
return (PINC&(1<<6) ? 0 : (1<<0)) |
(PIND&(1<<5) ? 0 : (1<<1)) |
(PIND&(1<<3) ? 0 : (1<<2)) |
(PIND&(1<<4) ? 0 : (1<<3)) |
(PIND&(1<<7) ? 0 : (1<<4)) |
(PINB&(1<<4) ? 0 : (1<<5)) |
(PINB&(1<<5) ? 0 : (1<<6)) |
(PINB&(1<<6) ? 0 : (1<<7)) |
(PINF&(1<<7) ? 0 : (1<<8 )) |
(PINF&(1<<6) ? 0 : (1<<9)) |
(PINF&(1<<5) ? 0 : (1<<10)) |
(PINF&(1<<4) ? 0 : (1<<11)) |
(PINF&(1<<1) ? 0 : (1<<12)) |
(PINF&(1<<0) ? 0 : (1<<13));
}
/* Row pin configuration
* row: 0 1 2 3 4
* pin: D0 D1 D2 D3 D5
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
DDRD &= ~0b00000111;
PORTD &= ~0b00000111;
DDRB &= ~0b00000011;
PORTB &= ~0b00000011;
}
static void select_row(uint8_t row)
{
// Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
DDRD |= (1<<2);
PORTD &= ~(1<<2);
break;
case 1:
DDRD |= (1<<1);
PORTD &= ~(1<<1);
break;
case 2:
DDRD |= (1<<0);
PORTD &= ~(1<<0);
break;
case 3:
DDRB |= (1<<0);
PORTB &= ~(1<<0);
break;
case 4:
DDRB |= (1<<1);
PORTB &= ~(1<<1);
break;
}
}
Keymap_common.h (
dropbox link):
#include "keymap_common.h"
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \
LGUI,LALT, SPC, FN0, SPC, PAUS, FN1),
/* 1: FN 1 */
KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
TRNS,TRNS, UP, TRNS,TRNS,TRNS,TRNS,VOLU,VOLD,TRNS,PSCR,TRNS,INS,TRNS, \
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, \
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS),
/* 2: FN 2 */
KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
TRNS,TRNS, UP, TRNS,TRNS,TRNS,TRNS,VOLU,VOLD,TRNS,PSCR,TRNS,INS,TRNS, \
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, \
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS),
};
const uint16_t PROGMEM fn_actions[] = {
/* Poker Layout */
= ACTION_LAYER_MOMENTARY(6), // to Fn overlay
[1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay
};
Keymap_poker.c (
dropbox link)
#include "keymap_common.h"
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \
LGUI,LALT, SPC, FN0, SPC, PAUS, FN1),
/* 1: FN 1 */
KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
TRNS,TRNS, UP, TRNS,TRNS,TRNS,TRNS,VOLU,VOLD,TRNS,PSCR,TRNS,INS,TRNS, \
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, \
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS),
/* 2: FN 2 */
KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
TRNS,TRNS, UP, TRNS,TRNS,TRNS,TRNS,VOLU,VOLD,TRNS,PSCR,TRNS,INS,TRNS, \
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, \
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS),
};
const uint16_t PROGMEM fn_actions[] = {
/* Poker Layout */
= ACTION_LAYER_MOMENTARY(6), // to Fn overlay
[1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay
};