How to build your very own keyboard firmware

User avatar
Halvar

27 Jul 2015, 13:20

Congratulations on getting it to work, that looks like a very nice keyboard. Beautiful keycaps!

IMO it's better to do the mapping on the side of the PC operating system. You could write macros for it in the firmware (i have no experience with this yet, but I know it's possible), but its much more of a hassle and rather unelegant if you ask me. There's a short documentation for that in Hasu's code repository.

User avatar
Ray

27 Jul 2015, 15:14

It is quite a beauty!
I would personally do this in firmware, because then I will only have to do it once ;)
TMK can't do that out of the box if you want shift reported to the OS normally, but it's 20 lines of code or so if your shift-layer is accessible on a normal keyboard with shift (as "+" is on the Numpad, i believe). On the OS-side though, you can do are not restricted by existing keyboard layouts.

But are the printed legends enough anyways? you might want to have tab and alt somewhere. Together with that awesome caps/func key.

Caeyden

27 Jul 2015, 19:03

Hey everyone,

Need a bit of help with loading my tmk keymap unto a keyboard.

I've just finished defining a keymap for a planck that I have coming in the mail. I don't have any of the other files, as the seller told me that they're already burned into the planck's controller. I followed some guides on how to define a keymap, and looked at examples of others, so as of now, all I have is this, in .txt form.

Code: Select all

#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = KEYMAP( /* QWERTY BASE */
  TAB,		Q,		W,		E,		R,		T,		Y,		U,		I,		O,		P,		BSPC,	
  LCTL,		A,		S,		D,		F,		G,		H,		J,		K,		L,		QUOT,	ENT,		
  LSFT,		Z,		X,		C,		V,		B,		N,		M,		COMM,	DOT,		SLSH,	FN3,		
  ESC,		CAPS,	LGUI, 	LALT,	FN1,		SPC,				FN2,		LEFT,	DOWN,	UP,		RGHT),

[1] = KEYMAP( /* FN1 numbers, hold */
  TRNS,		1,		2,		3,		4,		5,		6,		7,		8,		9,		0,		TRNS,
  TRNS,		TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	MINS,	EQL,		TRNS,
  TRNS,		TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	TRNS,
  TRNS,		TRNS,	TRNS,	TRNS,	TRNS,	TRNS,			TRNS,	TRNS,	TRNS,	TRNS,	TRNS),

[2] = KEYMAP( /* FN2 numpad, toggle */
  TRNS,		NO,		UP,		NO,		TRNS,	TRNS,	TRNS,	7,		8,		9,		MINS,	TRNS,
  TRNS,		LEFT,	DOWN,	RIGHT,	TRNS,	TRNS,	TRNS,	4,		5,		6,		FN4,		TRNS,
  TRNS,		TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	TRNS,	1,		2,		3,		ENT,		TRNS,
  TRNS,		TRNS,	TRNS,	TRNS,	TRNS,	TRNS,			TRNS,	0,		DOT,		ENT,		TRNS),

[3] = KEYMAP( /* FN3 navigation, delete, hold down */
  PSCR,		MPRV,	MPLY,	MNXT,	TRNS,	NO,		NO,		NO,		SCLN,	UP,		FN5,		DELETE,
  TRNS,		VOLD,	VOLU,	MUTE,	TRNS,	NO,		HOME,	PGUP,	LEFT,	RGHT,	NO,		TRNS,
  TRNS,		TRNS,	TRNS,	TRNS,	TRNS,	NO,		END,		PGDN,	DOWN,	LBRC,	RBRC,	TRNS,
  TRNS,		TRNS,	TRNS,	TRNS,	TRNS,	NO,				NO,		NO,		NO,		NO,		NO),
};

const uint16_t PROGMEM fn_actions[] = {
    [1] = ACTION_LAYER_MOMENTARY(1),
    [2] = ACTION_LAYER_TOGGLE(2),
    [3] = ACTION_LAYER_MOMENTARY(3),
    [4] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL),
    [5] = ACTION_MODS_KEY(MOD_LSFT, KC_SCLN),
};
What are my next step's from here? If my understanding is correct, the last step would be to load a hex version of this unto the teensy using the loader. But I'm quite unsure as to how to transform this into the hex file.

User avatar
Ray

28 Jul 2015, 00:42

with tmk, you have to compile the whole thing – not only the keymap – to a .hex (you should be able to find info of how to do that)
that's different e.g. with soarer's, where the keymap is not part of the firmware itself, but more like a configfile for it.

Morinaka

28 Jul 2015, 00:44

Caeyden wrote: What are my next step's from here? If my understanding is correct, the last step would be to load a hex version of this unto the teensy using the loader. But I'm quite unsure as to how to transform this into the hex file.
You need to compile the code. If you look at the start of the first part of the guide it says to download and install WinAVR, and near the end of the second part it talks about compiling with the command make -f Makefile in a command prompt, that will produce the hex file.
Halvar wrote: Congratulations on getting it to work, that looks like a very nice keyboard. Beautiful keycaps!

IMO it's better to do the mapping on the side of the PC operating system. You could write macros for it in the firmware (i have no experience with this yet, but I know it's possible), but its much more of a hassle and rather unelegant if you ask me. There's a short documentation for that in Hasu's code repository.
Key caps are double-shot ABS, the orange BASIC function legends on the front are dye-sub or something like that. The switches are inverted cross futaba's, so close to MX mount but too fat.

Well my project is to turn the Acorn Electron into a computer with a Raspberry Pi 2 in it (maybe a Intel NUC later on), converting the keyboard to USB is the first part of that. I also plan to wire up a switching USB cable so the keyboard can be used for the Pi, or as a standalone keyboard on any other PC with a USB-B or Mini-USB port on the back.
So with that in mind i wanted it all in firmware so it can be used on anything.
Ray wrote: It is quite a beauty!
I would personally do this in firmware, because then I will only have to do it once ;)
TMK can't do that out of the box if you want shift reported to the OS normally, but it's 20 lines of code or so if your shift-layer is accessible on a normal keyboard with shift (as "+" is on the Numpad, i believe). On the OS-side though, you can do are not restricted by existing keyboard layouts.

But are the printed legends enough anyways? you might want to have tab and alt somewhere. Together with that awesome caps/func key.
I'll try and do it in firmware as i'd prefer it that way as well, i'll just have to play around and see what i can do.
I know about the OS side being more flexible with stuff like AHK, i use it on my main board since i have DSA Dolch caps on a UK board so i made a program so the output matches the caps.

There aren't really enough keys for a fully functional layout but it's good enough. I probably won't be using the board a lot, i just like doing projects and this was part of the larger one i'm doing.

Caeyden

28 Jul 2015, 01:16

I see! So even though I've made the keymap myself, I still have to run through the entire process using the guide? That shouldn't be too hard then.

XRA

30 Jul 2015, 10:53

this thread has helped a ton getting things setup here, but I think I'm hitting a wall & not sure if it's a simple thing I'm overlooking or more complicated.

I'm working on using a Teensy 2.0 w/ Hasu's firmware to convert a Toshiba T3100e keyboard to USB,
it has a 22 pin ribbon cable off the keyboard, according to the T3100e manual it looks to have 11 columns and 8 rows (& 3 common grounds). It also has the column pins are marked as OUT and rows are IN. (im assuming SC is column and RTN is row)

Image

I checked continuity for all the keys with the 22 pins and determined the key layout in rows/columns in a spreadsheet, i need to finish marking the keys K** to match up with my code...
Image

When I first tested the keyboard using 11 columns and 8 rows, I got no keys working, and also no voltage drops at a row's pin, when a row is trigged by pressing the relevant key.

So because of that I assumed the diodes are facing the opposite way..

so then swapped around the rows and columns in code, so it has 11 rows and 8 columns:

this is the current keymap_common.h

Code: Select all

#define KEYMAP( \
	K00,  K01,  K02,  K03,  K04,  K05,  K06,  K07,  K08,  K09,  K0A,  K0B,  K0C,  K0D,  K0E, \
    K10,  K11,  K12,  K13,  K14,  K15,  K16,  K17,  K18,  K19,  K1A,  K1B,  K1C,        K1D, \
    K20,  K21,  K22,  K23,  K24,  K25,  K26,  K27,  K28,  K29,  K2A,  K2B,  K2C,  K2D,  K2E, \
    K30,  K31,  K32,  K33,  K34,  K35,  K36,  K37,  K38,  K39,  K3A,  K3B,  K3C,        K3D, \
    K40,  K41,  K42,  K43,  K44,  K45,  K46,  K47,  K48,  K49,  K4A,  K4B,        K4C,  K4D, \
    K50,  K51,  K52,  K53,                                K54,  K55,  K56,  K57,  K58,  K59  \
) { \
{ KC_##K01, KC_##K0B, KC_##K03, KC_##K3D,  KC_##K05,  KC_##K07,  KC_##K09,  KC_##K4D },\
{ KC_##K02, KC_##K0C, KC_##K04, KC_##K2E,  KC_##K06,  KC_##K08,  KC_##K0A,  KC_##K50 },\
{ KC_##K00, KC_##K10, KC_##K20, KC_##K21,  KC_##K31,  KC_##K30,  KC_##K40,  KC_##K2D },\
{ KC_##K11, KC_##K12, KC_##K22, KC_##K23,  KC_##K32,  KC_##K33,  KC_##K41,  KC_##K42 },\
{ KC_##K13, KC_##K14, KC_##K24, KC_##K25,  KC_##K34,  KC_##K35,  KC_##K44,  KC_##K43 },\
{ KC_##K15, KC_##K16, KC_##K26, KC_##K27,  KC_##K36,  KC_##K45,  KC_##K46,  KC_##K53 },\
{ KC_##K17, KC_##K18, KC_##K28, KC_##K29,  KC_##K37,  KC_##K38,  KC_##K48,  KC_##K47 },\
{ KC_##K19, KC_##K1A, KC_##K2A, KC_##K57,  KC_##K39,  KC_##K3A,  KC_##K49,  KC_##K56 },\
{ KC_##K1B, KC_##K4C, KC_##K2B, KC_##K2C,  KC_##K59,  KC_##K3B,  KC_##K4A,  KC_##K51 },\
{ KC_##K1C, KC_##K58, KC_NO,    KC_##K3C,  KC_##K54,  KC_##K4B,  KC_##K0D,  KC_##K55 },\
{ KC_##K0E, KC_##K52, KC_##K1D, KC_NO,     KC_NO,     KC_NO,     KC_NO,     KC_NO    } \
Now with that change, some keys do things, but none of them are correct, and the only unique character/codes i can get are the following (I tested all keys), they don't seem to relate to any sort of pattern in the rows/columns either...

3 f d n e b 4 a g , END 5 F6
(I also highlighted them blue in the spreadsheet above)

When I check the voltage on the row pins, it is dropping correctly when a row is activated- so for example I can press any key of a specific row, and that row's pin on the Teensy pcb will drop in voltage, which I believe means my wiring is correct/

But as far as where to go from here, I'm feeling stuck, I've been doing changes in code, like reversing the ordering of rows or columns but having no luck so far..

I've also tried disabling NKRO and enabling matrix_has_ghost and playing around with other config options

any suggestions are extremely appreciated!!

here is the important matrix.c

Code: Select all

 /* Column pin configuration 
 * col: 0  1  2  3  4  5  6  7
 * pin: F4 F5 F6 F7 B6 B5 B4 D7 
 */
static void  init_cols(void)
{
    // Input with pull-up(DDR:0, PORT:1)
    DDRF  &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 );
    PORTF |=  (1<<7 | 1<<6 | 1<<5 | 1<<4 );

    DDRB  &= ~(1<<6 | 1<<5 | 1<<4 );
    PORTB |=  (1<<6 | 1<<5 | 1<<4 );

    DDRD  &= ~(1<<7 );
    PORTD |=  (1<<7 );
}

static matrix_row_t read_cols(void)
{
    return (PINF&(1<<4) ? 0 : (1<<0)) |
           (PINF&(1<<5) ? 0 : (1<<1)) |
           (PINF&(1<<6) ? 0 : (1<<2)) |
           (PINF&(1<<7) ? 0 : (1<<3)) |
           (PINB&(1<<6) ? 0 : (1<<4)) |
           (PINB&(1<<5) ? 0 : (1<<5)) |
           (PINB&(1<<4) ? 0 : (1<<6)) |
           (PIND&(1<<7) ? 0 : (1<<7));
}

/* Row pin configuration
 * row: 0  1  2  3  4  5  6  7  8  9  10  
 * pin: B0 B1 B2 B3 B7 D0 D1 D2 D3 C6 C7
 */
static void unselect_rows(void)
{
    // Hi-Z(DDR:0, PORT:0) to unselect  
    DDRB  &= ~0b10001111;
    PORTB &= ~0b10001111;
    DDRD  &= ~0b00001111;
    PORTD &= ~0b00001111;
    DDRC  &= ~0b11000000;
    PORTC &= ~0b11000000;
}

static void select_row(uint8_t row)
{
    // Output low(DDR:1, PORT:0) to select
    switch (row) {
        case 0:
            DDRB  |= (1<<0);
            PORTB &= ~(1<<0);
            break;
        case 1:
            DDRB  |= (1<<1);
            PORTB &= ~(1<<1);
            break;
        case 2:
            DDRB  |= (1<<2);
            PORTB &= ~(1<<2);
            break;
        case 3:
            DDRB  |= (1<<3);
            PORTB &= ~(1<<3);
            break;
        case 4:
            DDRB  |= (1<<7);
            PORTB &= ~(1<<7);
            break;
        case 5:
            DDRD  |= (1<<0);
            PORTD &= ~(1<<0);
            break;
        case 6:
            DDRD  |= (1<<1);
            PORTD &= ~(1<<1);
            break;
        case 7:
            DDRD  |= (1<<2);
            PORTD &= ~(1<<2);
            break;
        case 8:
            DDRD  |= (1<<3);
            PORTD &= ~(1<<3);
            break;
        case 9:
            DDRC  |= (1<<6);
            PORTC &= ~(1<<6);
            break;
        case 10:
            DDRC  |= (1<<7);
            PORTC &= ~(1<<7);
            break;
    }
}
this is my keymap.c

Code: Select all

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0: qwerty */
    KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F10,  NLCK, SLCK, PSCR, TRNS,\
           1,    2,    3,    4,    5,    6,    7,    8,    9,    0,    MINS, EQL,  BSPC,       HOME,\
           TAB,  Q,    W,    E,    R,    T,    Y,    U,    I,    O,    P,    LBRC, RBRC, BSLS, PGUP,\
           LCTL, A,    S,    D,    F,    G,    H,    J,    K,    L,    SCLN, QUOT, ENT,        PGDN,\
           LSFT, Z,    X,    C,    V,    B,    N,    M,    COMM, DOT,  SLSH, RSFT, UP,         END, \
           LALT, CAPS, FN0,  SPC,                                GRV,  INS,  DEL,  LEFT, DOWN, RGHT),
};

User avatar
Ray

30 Jul 2015, 12:36

XRA wrote:Now with that change, some keys do things, but none of them are correct, and the only unique character/codes i can get are the following (I tested all keys), they don't seem to relate to any sort of pattern in the rows/columns either...
well, that's strange. If it is on software or on hardware, either way, it would be related to rows/columns…

Can you check that the pins in matrix.c are the actual ones connected to the ribbon cable?

keymap_common.h looks good enough, as does keymap.c
as long as it compiles, your problem doesn't sit there.

to sum it up:
you got a keyboard matrix where you tested every switch for continuity at the ribbon cables. You double checked the rows/colums while doing so.
you got a KEYMAP that fits that.
only 13 keys register something.

at that point I would double check my wireing and soldering.
and check if my changes in code are actually compiled.

XRA

30 Jul 2015, 20:02

Ray wrote: well, that's strange. If it is on software or on hardware, either way, it would be related to rows/columns…

Can you check that the pins in matrix.c are the actual ones connected to the ribbon cable?

keymap_common.h looks good enough, as does keymap.c
as long as it compiles, your problem doesn't sit there.

to sum it up:
you got a keyboard matrix where you tested every switch for continuity at the ribbon cables. You double checked the rows/colums while doing so.
you got a KEYMAP that fits that.
only 13 keys register something.

at that point I would double check my wireing and soldering.
and check if my changes in code are actually compiled.
thanks for the suggestions! I started making sure it was compiling my changes, I ended up clearing some unused files, (all the keymap c's i wasnt using since i started with the gh60), as a result I modified the makefile to point to just the specific keymap.c

there still wasn't a difference, but then while looking in the makefile I tried commenting out these lines:

Code: Select all

#BOOTMAGIC_ENABLE = yes	# Virtual DIP switch configuration(+1000)
#MOUSEKEY_ENABLE = yes	# Mouse keys(+4700)
#EXTRAKEY_ENABLE = yes	# Audio control and System control(+450)
and now everything works as expected, all keys are fine, just one column pin has a loose connection that i'll fix

I'm not exactly sure why those build options were causing trouble for me, but I'm really glad it is working finally!

User avatar
Eszett

09 Aug 2015, 04:08

Can someone help me with this configuration problem:
IMG_0168.JPG
IMG_0168.JPG (50.92 KiB) Viewed 7225 times
My guess would be, that it has to do with hexadecimal counting, because col17 and col18 don't work anymore. All the other keys on the keyboard work. It is a software problem, no hardware problem, because the same hardware worked flawlessly before with Soarer's firmware. Here my configuration files.

User avatar
hasu

09 Aug 2015, 09:05

Probably this code are handled 16bit integer and col16 and col17 bit are ignored.
https://github.com/tmk/tmk_keyboard/wik ... -beyond-16

Code: Select all

static matrix_row_t read_cols(void)
{
    return (PINF&(1<<1) ? 0 : (1<<0)) |
           (PINF&(1<<0) ? 0 : (1<<1)) |
           (PINE&(1<<6) ? 0 : (1<<2)) |
           (PIND&(1<<5) ? 0 : (1<<3)) |
           (PINC&(1<<7) ? 0 : (1<<4)) |
           (PINC&(1<<6) ? 0 : (1<<5)) |
           (PIND&(1<<3) ? 0 : (1<<6)) |
           (PIND&(1<<2) ? 0 : (1<<7)) |
           (PIND&(1<<1) ? 0 : (1<<8)) |
           (PIND&(1<<0) ? 0 : (1<<9)) |
           (PINB&(1<<7) ? 0 : (1<<10)) |
           (PINB&(1<<3) ? 0 : (1<<11)) |
           (PINB&(1<<2) ? 0 : (1<<12)) |
           (PINB&(1<<1) ? 0 : (1<<13)) |
           (PINB&(1<<0) ? 0 : (1<<14)) |
           (PIND&(1<<4) ? 0 : (1<<15)) |
           (PIND&(1<<7) ? 0 : (1<<16)) |
           (PINB&(1<<4) ? 0 : (1<<17));
}

User avatar
Eszett

09 Aug 2015, 12:36

Hi hasu. That was it, it works now! I changed to "1UL<<...". Cheers! :)

Code: Select all

static matrix_row_t read_cols(void)
{
    return (PINF&(1<<1) ? 0 : (1UL<<0)) |
           (PINF&(1<<0) ? 0 : (1UL<<1)) |
           (PINE&(1<<6) ? 0 : (1UL<<2)) |
           (PIND&(1<<5) ? 0 : (1UL<<3)) |
           (PINC&(1<<7) ? 0 : (1UL<<4)) |
           (PINC&(1<<6) ? 0 : (1UL<<5)) |
           (PIND&(1<<3) ? 0 : (1UL<<6)) |
           (PIND&(1<<2) ? 0 : (1UL<<7)) |
           (PIND&(1<<1) ? 0 : (1UL<<8)) |
           (PIND&(1<<0) ? 0 : (1UL<<9)) |
           (PINB&(1<<7) ? 0 : (1UL<<10)) |
           (PINB&(1<<3) ? 0 : (1UL<<11)) |
           (PINB&(1<<2) ? 0 : (1UL<<12)) |
           (PINB&(1<<1) ? 0 : (1UL<<13)) |
           (PINB&(1<<0) ? 0 : (1UL<<14)) |
           (PIND&(1<<4) ? 0 : (1UL<<15)) |
           (PIND&(1<<7) ? 0 : (1UL<<16)) |
           (PINB&(1<<4) ? 0 : (1UL<<17));
}

ambergrismonger

15 Aug 2015, 00:42

I just built a Quark and I'm trying to compile my firmware but I am winding up with this error and I can't figure out what's wrong:
keymap_poker.c:10: error: expected '}' before '{' token
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1
Here is my keymap_poker file:

#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC,
TAB, A, S, D, F, G, H, J, K, L, ENT,
FN1, LSFT, Z, X, C, V, B, N, M, COMM, DOT, LSFT,
LCTL, LALT, PAUSE, FN2, SPC, FN1, COPY, PASTE, UNDO)
/* 1: FN 1 */
KEYMAP(TRNS, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, DEL,
TRNS, VOLUP, VOLDOWN, MUTE, TRNS, LBRC, RBRC, BSLS, MINS, EQL, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, GRAVE, SCLN, QUOT, SLSH, HOME, PGUP, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, END, PGDN, TRNS)
/* 2: FN 2 */
KEYMAP(TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F0, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, UP, TRNS,
TRNS, LGUI, TRNS, TRNS, TRNS, TRNS, LEFT, DOWN, RGHT)
};

const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),
};
And my keymap_common file:
/* GH60 keymap definition macro
* K2C, K31 and K3C are extra keys for ISO
*/
#define KEYMAP( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
K10, K11, K12, K13, K14, K15, K16, K18, K19, K1A, K1B, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
K30, K31, K32, K34, K35, K38, K39, K3A, K3B \
) { \
{ 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_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_NO, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_NO, KC_##K34, KC_##K35, KC_NO, KC_NO, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \
}
Thanks for any help!

shaymdev

15 Aug 2015, 00:48

In your key map file after each keymap(...) you need a semicolon.

ambergrismonger

15 Aug 2015, 00:57

I put semicolons where you described and I got:
keymap_poker.c:8: error: expected '}' before ';' token
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1

ambergrismonger

15 Aug 2015, 01:14

Figured it out thanks to you Shaymdev, there were supposed to be comma's after each (...) on the poker_keymap. Time to flash, cross your fingers for me!

shaymdev

15 Aug 2015, 01:16

Oh yeah commas, I totally meant commas. I ran into the same issue earlier this week. [SMILING FACE WITH SMILING EYES]

ambergrismonger

15 Aug 2015, 01:42

So, I flashed the firmware and the keyboard goes crazy firing random keys and freaking out in general. Here are all of the files that I edited. Thanks for any help!

https://gist.github.com/ambergrismonger ... 068cc09a1b

Boywonder

15 Aug 2015, 19:35

Could Someone help me compile my code? I have no clue how to and I honestly don't understand how I would go about compiling it. Any help or advice or tutorial would be greatly appreciated. I modified all the code in the gh60 directory and the poker keymap directory, just like the tutorial, however I don't know how or what to do to open the GNU GCC compiler or terminal and then turn it into a hex file.
Thanks

ambergrismonger

15 Aug 2015, 21:00

I figured out my first issue and got my keyboard working! Unfortunately the fn buttons aren't working. When I press the FN1 key it registers as an 8 keypress and when I press FN2 it registers as g. Any idea what's going on here? Everything else seems to be firing right.

Boywonder

15 Aug 2015, 21:29

So I figured out how to compile my code, however now I get errors saying that say this

Code: Select all

-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


mkdir -p obj_gh60_lufa
Compiling C: keymap_poker.c
avr-gcc -c -mmcu=atmega32u4 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=4096 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DBOOTMAGIC_ENABLE -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DNKRO_ENABLE -DVERSION=unknown -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_gh60_lufa/keymap_poker.lst -I. -I../../tmk_core -I../../tmk_core/protocol/lufa -I../../tmk_core/protocol/lufa/LUFA-git -I../../tmk_core/common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_gh60_lufa_keymap_poker.o.d  keymap_poker.c -o obj_gh60_lufa/keymap_poker.o 
In file included from keymap_poker.c:1:
keymap_poker.c:5: warning: implicit declaration of function 'KEYMAP'
keymap_poker.c:5: error: 'ESC' undeclared here (not in a function)
keymap_poker.c:5: error: 'MINS' undeclared here (not in a function)
keymap_poker.c:5: error: 'EQL' undeclared here (not in a function)
keymap_poker.c:5: error: 'BSPC' undeclared here (not in a function)
keymap_poker.c:5: error: 'PGUP' undeclared here (not in a function)
keymap_poker.c:6: error: 'TAB' undeclared here (not in a function)
keymap_poker.c:6: error: 'Q' undeclared here (not in a function)
keymap_poker.c:6: error: 'W' undeclared here (not in a function)
keymap_poker.c:6: error: 'E' undeclared here (not in a function)
keymap_poker.c:6: error: 'R' undeclared here (not in a function)
keymap_poker.c:6: error: 'T' undeclared here (not in a function)
keymap_poker.c:6: error: 'Y' undeclared here (not in a function)
keymap_poker.c:6: error: 'U' undeclared here (not in a function)
keymap_poker.c:6: error: 'I' undeclared here (not in a function)
keymap_poker.c:6: error: 'O' undeclared here (not in a function)
keymap_poker.c:6: error: 'P' undeclared here (not in a function)
keymap_poker.c:6: error: 'LBRC' undeclared here (not in a function)
keymap_poker.c:6: error: 'RBRC' undeclared here (not in a function)
keymap_poker.c:6: error: 'BSLS' undeclared here (not in a function)
keymap_poker.c:6: error: 'PGDN' undeclared here (not in a function)
keymap_poker.c:7: error: expected ')' before 'CAPS'
keymap_poker.c:7: warning: missing braces around initializer
keymap_poker.c:7: warning: (near initialization for 'keymaps[0]')
keymap_poker.c:7: error: initializer element is not constant
keymap_poker.c:7: error: (near initialization for 'keymaps[0][0][0]')
keymap_poker.c:11: error: 'MUTE' undeclared here (not in a function)
keymap_poker.c:11: error: 'F1' undeclared here (not in a function)
keymap_poker.c:11: error: 'F2' undeclared here (not in a function)
keymap_poker.c:11: error: 'F3' undeclared here (not in a function)
keymap_poker.c:11: error: 'F4' undeclared here (not in a function)
keymap_poker.c:11: error: 'F5' undeclared here (not in a function)
keymap_poker.c:11: error: 'F6' undeclared here (not in a function)
keymap_poker.c:11: error: 'F7' undeclared here (not in a function)
keymap_poker.c:11: error: 'F8' undeclared here (not in a function)
keymap_poker.c:11: error: 'F9' undeclared here (not in a function)
keymap_poker.c:11: error: 'F10' undeclared here (not in a function)
keymap_poker.c:11: error: 'F11' undeclared here (not in a function)
keymap_poker.c:11: error: 'F12' undeclared here (not in a function)
keymap_poker.c:11: error: 'VOLU' undeclared here (not in a function)
keymap_poker.c:11: error: 'VOLD' undeclared here (not in a function)
keymap_poker.c:12: error: 'TRNS' undeclared here (not in a function)
keymap_poker.c:12: error: 'UP' undeclared here (not in a function)
keymap_poker.c:12: error: 'DEL' undeclared here (not in a function)
keymap_poker.c:13: error: 'MYCM' undeclared here (not in a function)
keymap_poker.c:13: error: 'LEFT' undeclared here (not in a function)
keymap_poker.c:13: error: 'RGHT' undeclared here (not in a function)
keymap_poker.c:14: error: 'CALC' undeclared here (not in a function)
keymap_poker.c:14: error: 'HOME' undeclared here (not in a function)
keymap_poker.c:14: error: 'DOWN' undeclared here (not in a function)
keymap_poker.c:15: error: 'LGUI' undeclared here (not in a function)
keymap_poker.c:15: error: 'RCTL' undeclared here (not in a function)
keymap_poker.c:11: error: initializer element is not constant
keymap_poker.c:11: error: (near initialization for 'keymaps[0][0][1]')
make.exe: *** [obj_gh60_lufa/keymap_poker.o] Error 1
No idea what its doing and I've tried getting the newest firmware from github, still no success.

User avatar
Halvar

16 Aug 2015, 13:03

The important part are the first error messages shown:

Code: Select all

In file included from keymap_poker.c:1:
keymap_poker.c:5: warning: implicit declaration of function 'KEYMAP'
So what's going on in your keymap_poker.c file around line around line 5?

Show us the first 10 lines or so...

Boywonder

17 Aug 2015, 18:55

Halvar wrote: The important part are the first error messages shown:

Code: Select all

In file included from keymap_poker.c:1:
keymap_poker.c:5: warning: implicit declaration of function 'KEYMAP'
So what's going on in your keymap_poker.c file around line around line 5?

Show us the first 10 lines or so...
Thanks for responding! So I got all the code to compile now however, after loading it onto my teensy, the bottom three rows dont work! The top two work fine, yet the last three arn't working properly. Instead of normal output, some of the keys open the start menu, while others are acting as arrow keys. I checked all the wiring and I can't find a short.

Here is all my code

Keymap common.h

Code: Select all

/*
Copyright 2012,2013 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEYMAP_COMMON_H
#define KEYMAP_COMMON_H

#include <stdint.h>
#include <stdbool.h>
#include <avr/pgmspace.h>
#include "keycode.h"
#include "action.h"
#include "action_macro.h"
#include "report.h"
#include "host.h"
#include "print.h"
#include "debug.h"
#include "keymap.h"


extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
extern const uint16_t fn_actions[];


/* GH60 keymap definition macro
 * K2C, K31 and  K3C are extra keys for ISO
 */
#define KEYMAP( \
	     K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \
         K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, \
         K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D,      K2F, \
         K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,      K3D, K3E, K3F, \
    K40, K41, K42,                K46,                K4A, K4B, K4C, K4D, K4E, K4F  \
) { \
    { KC_NO   , 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_NO   , 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_##K1E, KC_##K1F }, \
    { KC_NO   , KC_##K21, 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_NO, KC_##K2F }, \
    { KC_NO   , KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B,    KC_NO, KC_##K3D, KC_##K3E, KC_##K3F }, \
    { KC_##K40, KC_##K41, KC_##K42,    KC_NO,    KC_NO,    KC_NO, KC_##K46,    KC_NO,    KC_NO,    KC_NO, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }  \
}

/* ANSI valiant. No extra keys for ISO */
#define KEYMAP_ANSI( \
    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,      K2D, \
    K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,           K3D, \
    K40, K41, K42,           K45,                     K4A, K4B, K4C, K4D  \
) KEYMAP( \
    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO,  K2D, \
    K30, NO,  K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, NO,  K3D, \
    K40, K41, K42,           K45,                NO,  K4A, K4B, K4C, K4D  \
)


#define KEYMAP_HHKB( \
    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K49,\
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,      K2D, \
    K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,      K3D, K3C, \
    K40, K41, K42,           K45,                     K4A, K4B, K4C, K4D  \
) KEYMAP( \
    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO,  K2D, \
    K30, NO,  K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
    K40, K41, K42,           K45,                K49, K4A, K4B, K4C, K4D  \
)

#endif
Matrix.c

Code: Select all

/*
Copyright 2012 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/*
 * scan matrix
 */
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
#include <util/delay.h>
#include "print.h"
#include "debug.h"
#include "util.h"
#include "matrix.h"


#ifndef DEBOUNCE
#   define DEBOUNCE	5
#endif
static uint8_t debouncing = DEBOUNCE;

/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
static matrix_row_t matrix_debouncing[MATRIX_ROWS];

static matrix_row_t read_cols(void);
static void init_cols(void);
static void unselect_rows(void);
static void select_row(uint8_t row);


inline
uint8_t matrix_rows(void)
{
    return MATRIX_ROWS;
}

inline
uint8_t matrix_cols(void)
{
    return MATRIX_COLS;
}

void matrix_init(void)
{
    // initialize row and col
    unselect_rows();
    init_cols();

    // initialize matrix state: all keys off
    for (uint8_t i=0; i < MATRIX_ROWS; i++) {
        matrix[i] = 0;
        matrix_debouncing[i] = 0;
    }
}

uint8_t matrix_scan(void)
{
    for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
        select_row(i);
        _delay_us(30);  // without this wait read unstable value.
        matrix_row_t cols = read_cols();
        if (matrix_debouncing[i] != cols) {
            matrix_debouncing[i] = cols;
            if (debouncing) {
                debug("bounce!: "); debug_hex(debouncing); debug("\n");
            }
            debouncing = DEBOUNCE;
        }
        unselect_rows();
    }

    if (debouncing) {
        if (--debouncing) {
            _delay_ms(1);
        } else {
            for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
                matrix[i] = matrix_debouncing[i];
            }
        }
    }

    return 1;
}

bool matrix_is_modified(void)
{
    if (debouncing) return false;
    return true;
}

inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
    return (matrix[row] & ((matrix_row_t)1<<col));
}

inline
matrix_row_t matrix_get_row(uint8_t row)
{
    return matrix[row];
}

void matrix_print(void)
{
    print("\nr/c 0123456789ABCDEF\n");
    for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
        phex(row); print(": ");
        pbin_reverse16(matrix_get_row(row));
        print("\n");
    }
}

uint8_t matrix_key_count(void)
{
    uint8_t count = 0;
    for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
        count += bitpop16(matrix[i]);
    }
    return count;
}

/* 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);
    PORTF |=  (1<<7);
    DDRD  &= ~(1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);
    PORTD |=  (1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);
    DDRB  &= ~(1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);
    PORTB |=  (1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);
}

static matrix_row_t read_cols(void)
{
    return (PINB&(1<<0) ? 0 : (1<<0)) |
           (PINB&(1<<1) ? 0 : (1<<1)) |
           (PINB&(1<<2) ? 0 : (1<<2)) |
           (PINB&(1<<3) ? 0 : (1<<3)) |
           (PINB&(1<<7) ? 0 : (1<<4)) |
           (PIND&(1<<0) ? 0 : (1<<5)) |
           (PIND&(1<<1) ? 0 : (1<<6)) |
           (PIND&(1<<2) ? 0 : (1<<7)) |
           (PIND&(1<<3) ? 0 : (1<<8)) |     // Rev.A and B
           (PIND&(1<<4) ? 0 : (1<<9)) |
           (PINF&(1<<7) ? 0 : (1<<10)) |
           (PINB&(1<<6) ? 0 : (1<<11)) |
           (PINB&(1<<4) ? 0 : (1<<12)) |
		   (PINB&(1<<5) ? 0 : (1<<13)) |
		   (PIND&(1<<5) ? 0 : (1<<14)) |
           (PINC&(1<<7) ? 0 : (1<<15));
}

/* 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  &= ~0b01110011;
    PORTF &= ~0b01110011;
}

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<<2);
            PORTF &= ~(1<<2);
            break;
        case 3:
            DDRF  |= (1<<3);
            PORTF &= ~(1<<3);
            break;
        case 4:
            DDRF  |= (1<<5);
            PORTF &= ~(1<<5);
            break;
    }
}
Poker.c

Code: Select all

#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0: qwerty */
    KEYMAP(ESC,  1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL,BSPC,PGUP, \
           TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,PGDN, \
           CAPS, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,END,       \
           LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,UP,DEL,        \
           LCTL,LGUI,LALT,           SPC,                PAUS,HOME,FN1,LEFT,DOWN,RGHT),
	/* 1: FN 1 */
    KEYMAP(MUTE, F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F10,  F11,  F12,  VOLU, VOLD, \
           TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, PGUP, UP,   TRNS, DEL, TRNS,  \
           TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MYCM, TRNS, TRNS, PGDN, LEFT, RGHT, TRNS, TRNS,       \
           TRNS, TRNS, TRNS, CALC, TRNS, TRNS, TRNS, TRNS, HOME, END,  DOWN, TRNS, TRNS, TRNS,       \
           LGUI, TRNS, TRNS,             TRNS,                   TRNS, RCTL, TRNS,TRNS,TRNS,TRNS),
};

const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_TOGGLE(1),
};
I have no clue what is wrong, and I've looked over my code so many times. Slowly I am learning :(

Thanks for any and all help!

User avatar
Halvar

17 Aug 2015, 19:15

This part looks suspicious, although I think it doesn't fit the problem you see:

Which pins are you using, D0 D1 D2 D3 D5 as it says in the comment, or F0 F1 F2 F3 F5 as it says in the code? Also seems like you're "unselecting" the wrong bits.

Code: Select all

/* 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  &= ~0b01110011;
    PORTF &= ~0b01110011;
}

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<<2);
            PORTF &= ~(1<<2);
            break;
        case 3:
            DDRF  |= (1<<3);
            PORTF &= ~(1<<3);
            break;
        case 4:
            DDRF  |= (1<<5);
            PORTF &= ~(1<<5);
            break;
    }
}

Boywonder

17 Aug 2015, 19:53

I'm using f0 f1 f4 f5 f6, the row pin config was from the software that i downloaded, but its greened out (annotation)

User avatar
Halvar

17 Aug 2015, 21:01

OK, then check the select_row() function. You're setting F0 F1 F2 F3 F5 there at the moment. :-)

Boywonder

17 Aug 2015, 22:12

Halvar wrote: OK, then check the select_row() function. You're setting F0 F1 F2 F3 F5 there at the moment. :-)
Ahh success..... almost. so now almost everything works, except row 3 is firing 1qaz(alt), b doesn't work, and when i press g it also triggers a

Where could these problems originate from?

User avatar
flabbergast

17 Aug 2015, 22:28

@Boywonder: I'm not sure this will solve your problem (which might be a diode backwards?), but you should also initialise the C7 pin you're using for column 15:

Code: Select all

    DDRC  &= ~(1<<7);
    PORTC |=  (1<<7);
in the init_cols function.

EDIT: (What I wrote before in the edit was completely wrong.)

Boywonder

17 Aug 2015, 23:26

flabbergast wrote: @Boywonder: I'm not sure this will solve your problem (which might be a diode backwards?), but you should also initialise the C7 pin you're using for column 15:

Code: Select all

    DDRC  &= ~(1<<7);
    PORTC |=  (1<<7);
in the init_cols function.

EDIT: (What I wrote before in the edit was completely wrong.)
Thank you very much! I'm typing on it right now!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! woooooooooo except my B key doesn't work might e a ad switch

User avatar
flabbergast

17 Aug 2015, 23:41

Boywonder wrote: Thank you very much! I'm typing on it right now!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! woooooooooo except my B key doesn't work might e a ad switch
No worries. Glad it helped!

For the 'B': check the diode, and the switch by itself with a multimeter.

Post Reply

Return to “Workshop”