SHOW:
|
|
- or go back to the newest paste.
| 1 | In keymap_common.h : | |
| 2 | ||
| 3 | #define KEYMAP( \ | |
| 4 | K00, K01, K02, K03, \ | |
| 5 | K10, K11, K12, \ | |
| 6 | K20, K21, K22, K23, \ | |
| 7 | K30, K31, K32, \ | |
| 8 | K40, K41, K42, \ | |
| 9 | ) { \
| |
| 10 | { KC_##K00, KC_##K01, KC_##K02, KC_##K03 }, \
| |
| 11 | { KC_##K10, KC_##K11, KC_##K12, KC_NO}, \
| |
| 12 | { KC_##K20, KC_##K21, KC_##K22, KC_##K23 }, \
| |
| 13 | { KC_##K30, KC_##K31, KC_##K32, KC_NO }, \
| |
| 14 | { KC_##K40, KC_NO, KC_##K41, KC_##K42} \
| |
| 15 | } | |
| 16 | #endif | |
| 17 | ||
| 18 | ----------------------- | |
| 19 | In config.h : | |
| 20 | /* key matrix size */ | |
| 21 | #define MATRIX_ROWS 5 | |
| 22 | #define MATRIX_COLS 4 | |
| 23 | ||
| 24 | ----------------------- | |
| 25 | In keymap_poker.h : | |
| 26 | ||
| 27 | #include "keymap_common.h" | |
| 28 | ||
| 29 | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
| |
| 30 | KEYMAP(KC_ESCAPE,KC_KP_SLASH,KC_KP_ASTERISK,KC_KP_MINUS, \ | |
| 31 | KC_KP_7,KC_KP_8,KC_KP_9, \ | |
| 32 | KC_KP_4,KC_KP_5,KC_KP_6,KC_KP_PLUS, \ | |
| 33 | KC_KP_1,KC_KP_2,KC_KP_3, \ | |
| 34 | KC_KP_ENTER,KC_KP_DOT,KC_KP_0), | |
| 35 | }; | |
| 36 | ||
| 37 | const uint16_t PROGMEM fn_actions[] = {
| |
| 38 | ||
| 39 | }; | |
| 40 | ||
| 41 | ---------------------- | |
| 42 | In config.h : | |
| 43 | ||
| 44 | /* Column pin configuration | |
| 45 | * col: 0 1 2 3 | |
| 46 | * pin: F4 F1 F5 F6 | |
| 47 | */ | |
| 48 | static void init_cols(void) | |
| 49 | {
| |
| 50 | DDRF &= ~(1<<4 | 1<<1 | 1<<5 | 1<<6); | |
| 51 | PORTF |= (1<<4 | 1<<1 | 1<<5 | 1<<6); | |
| 52 | // Input with pull-up(DDR:0, PORT:1) | |
| 53 | } | |
| 54 | ||
| 55 | static matrix_row_t read_cols(void) | |
| 56 | {
| |
| 57 | return (PINF&(1<<4) ? 0 : (1<<0)) | | |
| 58 | (PINF&(1<<1) ? 0 : (1<<1)) | | |
| 59 | (PINF&(1<<5) ? 0 : (1<<2)) | | |
| 60 | (PINF&(1<<6) ? 0 : (1<<3)); | |
| 61 | } | |
| 62 | ||
| 63 | /* Row pin configuration | |
| 64 | * row: 0 1 2 3 4 | |
| 65 | * pin: B1 B2 B3 B7 B0 | |
| 66 | */ | |
| 67 | static void unselect_rows(void) | |
| 68 | {
| |
| 69 | // Hi-Z(DDR:0, PORT:0) to unselect | |
| 70 | DDRB &= ~0b10001111; | |
| 71 | PORTB &= ~0b00001111; | |
| 72 | } | |
| 73 | ||
| 74 | static void select_row(uint8_t row) | |
| 75 | {
| |
| 76 | // Output low(DDR:1, PORT:0) to select | |
| 77 | switch (row) {
| |
| 78 | case 0: | |
| 79 | DDRB |= (1<<1); | |
| 80 | PORTB &= ~(1<<1); | |
| 81 | break; | |
| 82 | case 1: | |
| 83 | DDRB |= (1<<2); | |
| 84 | PORTB &= ~(1<<2); | |
| 85 | break; | |
| 86 | case 2: | |
| 87 | DDRB |= (1<<3); | |
| 88 | PORTB &= ~(1<<3); | |
| 89 | break; | |
| 90 | case 3: | |
| 91 | DDRB |= (1<<7); | |
| 92 | PORTB &= ~(1<<7); | |
| 93 | break; | |
| 94 | case 4: | |
| 95 | DDRB |= (1<<0); | |
| 96 | PORTB &= ~(1<<0); | |
| 97 | break; | |
| 98 | } | |
| 99 | } | |
| 100 | ---------------------- | |
| 101 | Full error from cygwin64 : | |
| 102 | ||
| 103 | mkdir -p obj_gh60_lufa | |
| 104 | Compiling C: keymap_poker.c | |
| 105 | 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 -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_gh60_lufa/keymap_poker.lst -I. -I../.. -I../../protocol/lufa -I../../protocol/lufa/LUFA-120730 -I../../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 | |
| 106 | In file included from keymap_poker.c:1:0: | |
| 107 | keymap_common.h:46:1: error: parameter name missing | |
| 108 | ) { \
| |
| 109 | ^ | |
| 110 | keymap_poker.c:4:6: warning: implicit declaration of function 'KEYMAP' [-Wimplicit-function-declaration] | |
| 111 | KEYMAP(KC_ESCAPE,KC_KP_SLASH,KC_KP_ASTERISK,KC_KP_MINUS, \ | |
| 112 | ^ | |
| 113 | keymap_poker.c:4:6: warning: missing braces around initializer [-Wmissing-braces] | |
| 114 | keymap_poker.c:4:6: warning: (near initialization for 'keymaps[0]') [-Wmissing-braces] | |
| 115 | keymap_poker.c:4:6: error: initializer element is not constant | |
| 116 | keymap_poker.c:4:6: error: (near initialization for 'keymaps[0][0][0]') | |
| 117 | ../../rules.mk:541: recipe for target 'obj_gh60_lufa/keymap_poker.o' failed | |
| 118 | make: *** [obj_gh60_lufa/keymap_poker.o] Error 1 |