Thought I would post here rather than hijack matt3o's thread.
Used the TMK gh60 guide to put my firmware together.
When I make the firmware I get the following error:
matrix.c: In function 'read_cols':
matrix.c:172: warning: left shift count >= width of type
matrix.c:173: warning: left shift count >= width of type
matrix.c:176: error: expected expression before ';' token
make: *** [obj_gh60_lufa/matrix.o] Error 1
This refers to the following lines in my matrix.c
Code: Select all
(PIND&(1<<1) ? 0 : (1<<15))|
(PIND&(1<<0) ? 0 : (1<<16))|
(PINB&(1<<7) ? 0 : (1<<17))|
I think that I am missing a reference to how many columns there are in the keyboard.
Here is my matrix.c
Code: Select all
/* Column pin configuration
* col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
* pin: D7 B4 B5 B6 F7 F6 F5 F4 F1 F0 D4 D5 C7 C6 D3 D1 D0 B7
*/
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 | 1<<1 | 1<<0);
PORTD |= (1<<7 | 1<<5 | 1<<4 | 1<<3 | 1<<1 | 1<<0);
DDRC &= ~(1<<7 | 1<<6);
PORTC |= (1<<7 | 1<<6);
DDRB &= ~(1<<7 | 1<<6 | 1<< 5 | 1<<4);
PORTB |= (1<<7 | 1<<6 | 1<< 5 | 1<<4);
}
static matrix_row_t read_cols(void)
{
return (PIND&(1<<7) ? 0 : (1<<0)) |
(PINB&(1<<4) ? 0 : (1<<1)) |
(PINB&(1<<5) ? 0 : (1<<2)) |
(PINB&(1<<6) ? 0 : (1<<3)) |
(PINF&(1<<7) ? 0 : (1<<4)) |
(PINF&(1<<6) ? 0 : (1<<5)) |
(PINF&(1<<5) ? 0 : (1<<6)) |
(PINF&(1<<4) ? 0 : (1<<7)) |
(PINF&(1<<1) ? 0 : (1<<8)) |
(PINF&(1<<0) ? 0 : (1<<9)) |
(PIND&(1<<4) ? 0 : (1<<10)) |
(PIND&(1<<5) ? 0 : (1<<11)) |
(PINC&(1<<7) ? 0 : (1<<12)) |
(PINC&(1<<6) ? 0 : (1<<13)) |
(PIND&(1<<3) ? 0 : (1<<14))|
(PIND&(1<<1) ? 0 : (1<<15))|
(PIND&(1<<0) ? 0 : (1<<16))|
(PINB&(1<<7) ? 0 : (1<<17))|
;
}
/* Row pin configuration
* row: 0 1 2 3 4
* pin: E6 B3 B1 B2 B0
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
DDRE &= ~0b00000010;
PORTE &= ~0b00000010;
DDRD &= ~0b11110000;
PORTD &= ~0b11110000;
}
static void select_row(uint8_t row)
{
// Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
DDRE |= (1<<6);
PORTE &= ~(1<<6);
break;
case 1:
DDRB |= (1<<3);
PORTB &= ~(1<<3);
break;
case 2:
DDRB |= (1<<1);
PORTB &= ~(1<<1);
break;
case 3:
DDRB |= (1<<2);
PORTB &= ~(1<<2);
break;
case 4:
DDRB |= (1<<0);
PORTB &= ~(1<<0);
break;
}
}
Config.h
Code: Select all
#ifndef CONFIG_H
#define CONFIG_H
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER geekhack
#define PRODUCT GH60
#define DESCRIPTION t.m.k. keyboard firmware for GH60
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 18
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#endif
And finally keymap_poker.c
Code: Select all
#include "keymap_common.h"
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP(
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC, DEL, BSPC, HOME, PGUP, \
ESC, TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, END, DEL, PGDN, \
CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, \
LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, UP, \
LCTL,LGUI,LALT, SPC, SPC, RALT, RGUI, RCTL, LEFT, DOWN, RIGHT),
};
const uint16_t PROGMEM fn_actions[] = {
};
Any help would be appreciated