geekhack
geekhack Projects => Making Stuff Together! => Topic started by: gelmoak on Sat, 25 June 2016, 10:53:54
-
Hi! I have built my own handwired keyboard using matt30s informative guides at deskthority. Unfortunately I've hit a small bump and I am finding it very difficult to solve it so I was hoping that one of you might know what is causing the issue. The issue in hand has to do with specific keymappings not appearing on the right switch. If you look at the layout for my keyboard down below I will give you a quick example: http://imgur.com/2vm8ahY.
The rightmost column which should contain Pgup, Pgdn, home, end, arrowup, arrowdown will only respond to the pgup and arrowdown switches, the rest of the switches are non responsive. I have tried switching colums/rows on the teensy and replacing switches/diodes on the keyboard but I think it is a software problem since I discovered that most of the layout is shifted one column to the left except some keys. Home appears where Enter should be and End appears on the button left of enter etc.. Backspace is nowhere to be found.
I really dont know what to do I feel like I have tried everything to make it work but I just cannot find the fault, plz geekhack gods, lead me on to the right path!
Here is some of the code for the controller, if you need to see anything else to diagnose the problem let me know!
Keymap_common.h
#define KEYMAP( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F,\
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1F,\
K20, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2F, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, \
K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4F, \
K50, K52, K53, K56, K5B, K5C, K5D, K5E, K5F \
) { \
{KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
{KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1F}, \
{KC_##K20, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2F }, \
{KC_##K30,KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
{KC_##K40, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47, KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4F }, \
{KC_##K50, KC_NO, KC_##K52, KC_##K53, KC_NO, KC_NO, KC_##K56, KC_NO, KC_NO, KC_NO ,KC_NO, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F} \
}
Matrix.c
static void init_cols(void)
{
// Input with pull-up(DDR:0, PORT:1)
DDRD &= ~(1<<7 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);
PORTD |= (1<<7 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);
DDRC &= ~(1<<7 | 1<<6);
PORTC |= (1<<7 | 1<<6);
DDRE &= ~(1<<6);
PORTE |= (1<<6);
DDRB &= ~(1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 |1<<2);
PORTB |= (1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 |1<<2);
}
static matrix_row_t read_cols(void)
{
return (PINB&(1<<6) ? 0 : (1<<15)) |
(PINB&(1<<5) ? 0 : (1<<14)) |
(PINB&(1<<4) ? 0 : (1<<13)) |
(PIND&(1<<7) ? 0 : (1<<12)) |
(PIND&(1<<4) ? 0 : (1<<11)) |
(PIND&(1<<5) ? 0 : (1<<10)) |
(PINC&(1<<6) ? 0 : (1<<9)) |
(PIND&(1<<3) ? 0 : (1<<8)) |
(PIND&(1<<2) ? 0 : (1<<7)) |
(PIND&(1<<1) ? 0 : (1<<6)) |
(PIND&(1<<0) ? 0 : (1<<5)) |
(PINB&(1<<7) ? 0 : (1<<4)) |
(PINB&(1<<3) ? 0 : (1<<3)) |
(PINB&(1<<2) ? 0 : (1<<2)) |
(PINC&(1<<7) ? 0 : (1<<1)) |
(PINE&(1<<6) ? 0 : (1<<0));
}
/* 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
DDRF &= ~0b11110011;
PORTF &= ~0b11110011;
}
static void select_row(uint8_t row)
{
// Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
DDRF |= (1<<0);
PORTF &= ~(1<<0);
break;
case 1:
DDRF |= (1<<1);
PORTF &= ~(1<<1);
break;
case 2:
DDRF |= (1<<4);
PORTF &= ~(1<<4);
break;
case 3:
DDRF |= (1<<5);
PORTF &= ~(1<<5);
break;
case 4:
DDRF |= (1<<6);
PORTF &= ~(1<<6);
break;
case 5:
DDRF |= (1<<7);
PORTF &= ~(1<<7);
break;
}
Keymap_poker.c
#include "keymap_common.h"
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, PGUP, \
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, NUBS, EQL, BSPC,PGDN, \
TAB, Q, W, E, R, T, Y, U, I , O ,P, LBRC, RBRC, ENT, HOME, \
CAPS, A, S, D, F, G, H, J, K, L, O, SCLN, QUOT, END, \
LSFT, BSLS, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \
LCTL, FN1, LALT, SPC, RALT, FN2, LEFT, RIGHT, DOWN),
};
const uint16_t PROGMEM fn_actions[] = {
};
-
There is a separate thread for tmk firmware where you might get some more help. Someone might come along here also! Good luck. I'm useless in tmk myself, I hate it hahaha
Sent from my local payphone
-
Your KEYMAP macro is wrong. Check the tutorial again.
https://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177.html#p141386
-
Sorry hasu, what exactly is that is wrong with the keymap? I been fiddling with the code back and forth so much I grown blind to the problem..
-
Definition of 'KEYMAP' in Keymap_common.h. Latter part of it should have elements as same as row*column size, but you have less because you ommit some for non-exist keys. Use 'KC_NO' instead of the omit.
-
Oh wow had completly missed that I thought it was needed only for the last row but obviously not, keyboard seems to working fine now. Thanks so much for the help!