Author Topic: TMK keyboard firmware  (Read 549719 times)

0 Members and 1 Guest are viewing this topic.

Offline BlueNalgene

  • Posts: 739
  • Location: Oklahoma, USA
Re: TMK keyboard firmware
« Reply #1100 on: Thu, 10 December 2015, 23:30:03 »
Great. Glad to hear that.

I had shallow sleep last night and this still scares me terribly, because annoying hardware/soldering problem like this can be happened to many Alps GB paticipants and most of them probably are not patient and don't have decent tools unlike you. Now I worry about diffculty in discrimination between their problem or my failure on board production.

Anyway, my worry is off topic here.

It is a valid concern.  Hardware problems are a lot more difficult to diagnose over a few thousand miles.  One of the purposes of me building this out early, is that I can notice things that other users might have questions about as they build them (Oh no, Idon't have a switch in K41 because of my Infinity layout, could that be why I have issues? Etc.)

Offline TalkingTree

  • Posts: 2376
  • Location: Italy (142)
    • My projects
Re: TMK keyboard firmware
« Reply #1101 on: Sun, 13 December 2015, 13:05:07 »
I need help.
I'm using a Filco TKL with a Pegasus Hoof 2015 revision.
My goal is to add extra key between Equal/Plus and Backspace.
The key is labeled J14 on the PCB, as you can see here (right under the USB connector).


Now, I used keymap.c and matrix.c from vpont's fork of the TMK firmware, as he already included the 2015 revision, and made the following changes:


In keymap.c I added the KB5 entry in the matrix as it's the entry for the J14 key. Like this:
Code: [Select]
//KB5 is J14 and belongs to JIS
#define KEYMAP( \
    KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0,      KC7, KC5, KA5, \
    KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB5, KB2, KL4, KO4, KQ4, \
KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, \
KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1,                     \
KN2, KI6, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3,           KO6,      \
    KA4, KP2, KC6,           KK6,                     KC3, KM3, KD0, KA1, KO0, KK0, KL0  \
) { \
/*             0         1         2         3         4         5         6         7     */ \
/* A */   { KC_NO,    KC_##KA1, KC_NO,    KC_NO   , KC_##KA4, KC_##KA5, KC_NO   , KC_##KA7 }, \
/* B */   { KC_##KB0, KC_##KB1, KC_##KB2, KC_##KB3, KC_##KB4, KC_##KB5, KC_##KB6, KC_##KB7 }, \
/* C */   { KC_NO,    KC_NO,    KC_NO,    KC_##KC3, KC_NO   , KC_##KC5, KC_##KC6, KC_##KC7 }, \
/* D */   { KC_##KD0, KC_##KD1, KC_##KD2, KC_##KD3, KC_##KD4, KC_##KD5, KC_NO   , KC_##KD7 }, \
/* E */   { KC_NO,    KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7 }, \
/* F */   { KC_##KF0, KC_##KF1, KC_##KF2, KC_##KF3, KC_##KF4, KC_##KF5, KC_##KF6, KC_##KF7 }, \
/* G */   { KC_##KG0, KC_##KG1, KC_##KG2, KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7 }, \
/* H */   { KC_NO,    KC_##KH1, KC_##KH2, KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7 }, \
/* I */   { KC_NO,    KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7 }, \
/* J */   { KC_NO,    KC_##KJ1, KC_##KJ2, KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7 }, \
/* K */   { KC_##KK0, KC_NO,    KC_NO,    KC_NO   , KC_##KK4, KC_NO   , KC_##KK6, KC_NO    }, \
/* L */   { KC_##KL0, KC_NO,    KC_NO   , KC_NO   , KC_##KL4, KC_NO   , KC_NO   , KC_NO    }, \
/* M */   { KC_NO,    KC_NO,    KC_NO   , KC_##KM3, KC_NO   , KC_NO   , KC_NO   , KC_NO    }, \
/* N */   { KC_NO   , KC_NO,    KC_##KN2, KC_##KN3, KC_NO   , KC_NO   , KC_NO   , KC_NO    }, \
/* O */   { KC_##KO0, KC_NO,    KC_NO   , KC_NO   , KC_##KO4, KC_NO   , KC_##KO6, KC_##KO7 }, \
/* P */   { KC_NO   , KC_NO,    KC_##KP2, KC_NO   , KC_NO   , KC_NO   , KC_NO   , KC_NO    }, \
/* Q */   { KC_NO   , KC_NO,    KC_NO,    KC_NO   , KC_##KQ4, KC_NO   , KC_NO   , KC_##KQ7 }, \
/* R */   { KC_##KR0, KC_NO,    KC_##KR2, KC_##KR3, KC_##KR4, KC_##KR5, KC_##KR6, KC_##KR7 }  \
}


In led.c I replaced USB_LED_CAPS_LOCK with USB_LED_NUM_LOCK (Just stating for the sake of it but I doubt it causes any issue).


And this would be my keymap.h
Code: [Select]
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Default layer


  KEYMAP(\
      ESC,   F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,  F10,  F11,  F12,       PSCR, SLCK,  BRK, \
      GRV,    1,    2,    3,    4,    5,    6,    7,    8,    9,    0, MINS,  EQL, BSLS, NUBS,  INS, HOME, PGUP, \
      TAB,    Q,    W,    E,    R,    T,    Y,    U,    I,    O,    P, LBRC, RBRC, BSPC,  DEL,  END, PGDN, \
    LCTRL,    A,    S,    D,    F,    G,    H,    J,    K,    L, SCLN, QUOT,        ENT,                   \ 
     LSFT, NUBS,    Z,    X,    C,    V,    B,    N,    M, COMM,  DOT, SLSH,       RSFT,         UP,       \
     FN0, LGUI, LALT,              SPC,                         RALT, RGUI,  APP, RCTL, LEFT, DOWN, RGHT),


// Layer 1
  KEYMAP(\
      PWR,   F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,  F10,  F11,  F12,       PSCR, LNUM,  BOOTLOADER, \
      GRV,    1,    2,    3,    4,    5,    6,   P7,   P8,   P9,    PSLS, MINS,  EQL, BSLS, NUBS,  INS, HOME, PGUP, \
      TAB,    HOME, UP,   END,  R,    T,    Y,   P4,   P5,   P6,    PAST, LBRC, RBRC, DEL,  DEL,  END, PGDN, \
    LCTRL,    LEFT, DOWN, RIGHT,F,    G,    H,   P1,   P2,   P3,  PMNS, QUOT,        ENT,                   \ 
     LSFT, NUBS,    Z,    X,    CALC,    V,    B,    N,   P0, P0,  PDOT, PPLS,       RSFT,         VOLU,       \
     FN0,   LGUI, LALT,             PENT,                         RALT, RGUI,  CAPS, RCTL, MPRV, VOLD, MNXT),


};


static const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1), // activate layer 1 when FN1 pressed
};
Everything compiles just fine, but when I load the hex to my board, it goes wild. It only registers one keystroke every now and then and it returns the wrong key, often numbers.
It's basically unusable.


My knowledge of C is very limited so I can't figure out what's going on [/size]on my own[/size][size=78%].[/size]
Is anyone sparing a moment to take a look at this?


Thanks.

My opensource projects: GH80-3000, TOAD, XMMX.

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1102 on: Mon, 14 December 2015, 04:01:05 »
Hey!

I've tried to make it further into the coding, but whenever I try to compile I get loads of warnings together with one error, which says:
Code: [Select]
keymap_poker.c:21: error: expected '}' before ';' token
This is my keymap_poker.c file:
Code: [Select]
#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  /* 0: qwerty */
  KEYMAP(Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P, 
            A,   S,   D,   F,   G,   H,   J,   K,   L,   
              Z,   X,   C,   V,   B,   N,   M, RSFT,     
                        FN0,   SPC,    FN1),

  /* 1: FN 1 */
  KEYMAP(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,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: FN 2 */
  KEYMAP(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, 
           TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     
             TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,       
                            TRNS,TRNS,TRNS)
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1)
[1] = ACTION_LAYER_MOMENTARY(2)
};

Thankfull for any help I can get!  :)

Offline TalkingTree

  • Posts: 2376
  • Location: Italy (142)
    • My projects
Re: TMK keyboard firmware
« Reply #1103 on: Mon, 14 December 2015, 05:11:52 »
Try this.
Backslashes are mandatory to tell the compiler the code continues to the next line (you might want to align them properly) and you missed a comma between your fn_actions.


Code: [Select]
#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  /* 0: qwerty */
  KEYMAP(Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,  \
            A,   S,   D,   F,   G,   H,   J,   K,   L,              \
              Z,   X,   C,   V,   B,   N,   M, RSFT,             \
                        FN0,   SPC,    FN1),                          \

  /* 1: FN 1 */
  KEYMAP(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,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: FN 2 */
  KEYMAP(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     \
           TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,                     \
             TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,                             \
                            TRNS,TRNS,TRNS)                               
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),
[1] = ACTION_LAYER_MOMENTARY(2)
};
My opensource projects: GH80-3000, TOAD, XMMX.

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1104 on: Mon, 14 December 2015, 05:36:38 »
Thanks for the notice; tried adding both things, but still no difference whatsoever... :(

Offline mrbishop

  • * Maker
  • Posts: 799
  • Location: South Carolina USA
  • Evil Genius
    • Bishop Computer Design web
Re: TMK keyboard firmware
« Reply #1105 on: Mon, 14 December 2015, 07:49:14 »
i took a look over my firmware and my device manager settings and i didnt see anything out of the ordinary.
my keyboard is still not waking my surface (either of them Pro2 or 3) from sleep. when it sleeps the keyboard stops responding until i unplug and plug it back in.

any thoughts?
Projects
Build to give back, 40% | Alps/Matias Removal ToolUltraHack 67% Hackdura  | ErgoDox case
                             
    

Offline hasu

  • Thread Starter
  • Posts: 3109
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #1106 on: Mon, 14 December 2015, 14:06:09 »
i took a look over my firmware and my device manager settings and i didnt see anything out of the ordinary.
my keyboard is still not waking my surface (either of them Pro2 or 3) from sleep. when it sleeps the keyboard stops responding until i unplug and plug it back in.

any thoughts?
Console feature has problems in some situations. Try disabling it if you have the build option in your makefile.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline mrbishop

  • * Maker
  • Posts: 799
  • Location: South Carolina USA
  • Evil Genius
    • Bishop Computer Design web
Re: TMK keyboard firmware
« Reply #1107 on: Mon, 14 December 2015, 14:06:57 »
i took a look over my firmware and my device manager settings and i didnt see anything out of the ordinary.
my keyboard is still not waking my surface (either of them Pro2 or 3) from sleep. when it sleeps the keyboard stops responding until i unplug and plug it back in.

any thoughts?
Console feature has problems in some situations. Try disabling it if you have the build option in your makefile.
Cool I'll give that a try tonight. Thanks
Projects
Build to give back, 40% | Alps/Matias Removal ToolUltraHack 67% Hackdura  | ErgoDox case
                             
    

Offline hasu

  • Thread Starter
  • Posts: 3109
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #1108 on: Mon, 14 December 2015, 14:53:03 »
I need help.
I'm using a Filco TKL with a Pegasus Hoof 2015 revision.
My goal is to add extra key between Equal/Plus and Backspace.
The key is labeled J14 on the PCB, as you can see here (right under the USB connector).


Now, I used keymap.c and matrix.c from vpont's fork of the TMK firmware, as he already included the 2015 revision, and made the following changes:


In keymap.c I added the KB5 entry in the matrix as it's the entry for the J14 key. Like this:
Code: [Select]
//KB5 is J14 and belongs to JIS
#define KEYMAP( \
    KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0,      KC7, KC5, KA5, \
    KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB5, KB2, KL4, KO4, KQ4, \
KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, \
KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1,                     \
KN2, KI6, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3,           KO6,      \
    KA4, KP2, KC6,           KK6,                     KC3, KM3, KD0, KA1, KO0, KK0, KL0  \
) { \
/*             0         1         2         3         4         5         6         7     */ \
/* A */   { KC_NO,    KC_##KA1, KC_NO,    KC_NO   , KC_##KA4, KC_##KA5, KC_NO   , KC_##KA7 }, \
/* B */   { KC_##KB0, KC_##KB1, KC_##KB2, KC_##KB3, KC_##KB4, KC_##KB5, KC_##KB6, KC_##KB7 }, \
/* C */   { KC_NO,    KC_NO,    KC_NO,    KC_##KC3, KC_NO   , KC_##KC5, KC_##KC6, KC_##KC7 }, \
/* D */   { KC_##KD0, KC_##KD1, KC_##KD2, KC_##KD3, KC_##KD4, KC_##KD5, KC_NO   , KC_##KD7 }, \
/* E */   { KC_NO,    KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7 }, \
/* F */   { KC_##KF0, KC_##KF1, KC_##KF2, KC_##KF3, KC_##KF4, KC_##KF5, KC_##KF6, KC_##KF7 }, \
/* G */   { KC_##KG0, KC_##KG1, KC_##KG2, KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7 }, \
/* H */   { KC_NO,    KC_##KH1, KC_##KH2, KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7 }, \
/* I */   { KC_NO,    KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7 }, \
/* J */   { KC_NO,    KC_##KJ1, KC_##KJ2, KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7 }, \
/* K */   { KC_##KK0, KC_NO,    KC_NO,    KC_NO   , KC_##KK4, KC_NO   , KC_##KK6, KC_NO    }, \
/* L */   { KC_##KL0, KC_NO,    KC_NO   , KC_NO   , KC_##KL4, KC_NO   , KC_NO   , KC_NO    }, \
/* M */   { KC_NO,    KC_NO,    KC_NO   , KC_##KM3, KC_NO   , KC_NO   , KC_NO   , KC_NO    }, \
/* N */   { KC_NO   , KC_NO,    KC_##KN2, KC_##KN3, KC_NO   , KC_NO   , KC_NO   , KC_NO    }, \
/* O */   { KC_##KO0, KC_NO,    KC_NO   , KC_NO   , KC_##KO4, KC_NO   , KC_##KO6, KC_##KO7 }, \
/* P */   { KC_NO   , KC_NO,    KC_##KP2, KC_NO   , KC_NO   , KC_NO   , KC_NO   , KC_NO    }, \
/* Q */   { KC_NO   , KC_NO,    KC_NO,    KC_NO   , KC_##KQ4, KC_NO   , KC_NO   , KC_##KQ7 }, \
/* R */   { KC_##KR0, KC_NO,    KC_##KR2, KC_##KR3, KC_##KR4, KC_##KR5, KC_##KR6, KC_##KR7 }  \
}


In led.c I replaced USB_LED_CAPS_LOCK with USB_LED_NUM_LOCK (Just stating for the sake of it but I doubt it causes any issue).


And this would be my keymap.h
Code: [Select]
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Default layer


  KEYMAP(\
      ESC,   F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,  F10,  F11,  F12,       PSCR, SLCK,  BRK, \
      GRV,    1,    2,    3,    4,    5,    6,    7,    8,    9,    0, MINS,  EQL, BSLS, NUBS,  INS, HOME, PGUP, \
      TAB,    Q,    W,    E,    R,    T,    Y,    U,    I,    O,    P, LBRC, RBRC, BSPC,  DEL,  END, PGDN, \
    LCTRL,    A,    S,    D,    F,    G,    H,    J,    K,    L, SCLN, QUOT,        ENT,                   \ 
     LSFT, NUBS,    Z,    X,    C,    V,    B,    N,    M, COMM,  DOT, SLSH,       RSFT,         UP,       \
     FN0, LGUI, LALT,              SPC,                         RALT, RGUI,  APP, RCTL, LEFT, DOWN, RGHT),


// Layer 1
  KEYMAP(\
      PWR,   F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,  F10,  F11,  F12,       PSCR, LNUM,  BOOTLOADER, \
      GRV,    1,    2,    3,    4,    5,    6,   P7,   P8,   P9,    PSLS, MINS,  EQL, BSLS, NUBS,  INS, HOME, PGUP, \
      TAB,    HOME, UP,   END,  R,    T,    Y,   P4,   P5,   P6,    PAST, LBRC, RBRC, DEL,  DEL,  END, PGDN, \
    LCTRL,    LEFT, DOWN, RIGHT,F,    G,    H,   P1,   P2,   P3,  PMNS, QUOT,        ENT,                   \ 
     LSFT, NUBS,    Z,    X,    CALC,    V,    B,    N,   P0, P0,  PDOT, PPLS,       RSFT,         VOLU,       \
     FN0,   LGUI, LALT,             PENT,                         RALT, RGUI,  CAPS, RCTL, MPRV, VOLD, MNXT),


};


static const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),// activate layer 1 when FN1 pressed
};
Everything compiles just fine, but when I load the hex to my board, it goes wild. It only registers one keystroke every now and then and it returns the wrong key, often numbers.
It's basically unusable.


My knowledge of C is very limited so I can't figure out what's going on [/size]on my own[/size][size=78%].[/size]
Is anyone sparing a moment to take a look at this?


Thanks.
Firstly, Did it work before you modified?
It seems to me your code is ok.

Are you sure your board revision?
Are you sure that firmware for 2015 revision ?
Are you sure the key matrix position?
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline VinnyCordeiro

  • Posts: 432
Re: TMK keyboard firmware
« Reply #1109 on: Mon, 14 December 2015, 15:15:18 »
I'm programming an spare of my custom designed PCB and preparing it for ABNT2. The PCB works with ANSI layout flawless and beautifully, so I just need to solve 2 questions.

Keep in mind that, as suggested by the USB HID standard, I'll have to program the keyboard firmware using US ANSI codes and let the operating system convert it back to PT-BR.

I've used two programs to test an ABNT2 keyboard I have here at home (rubber dome, unfortunately): Aqua'S KeyTest and Switch Hitter. Layout for UK ISO, US ANSI & BR ABNT2 in the image below for reference:

120107-0

Questions:
  • The red key is BACKSLASH on US ANSI, the programs confirmed that. But on the ABNT2 keyboard it is located where in the UK ISO it should be NONUS_HASH. Is there any problem on using BACKSLASH over NONUS_HASH?
  • Is the yellow key (BIOS code 0x56 and Windows code 0xE2) supposed to be NONUS_BSLASH? At this location both UK ANSI ISO & BR ABNT2 are the same.

The cyan button (BIOS code 0x73 and Windows code 0xC1) is to be set as INT1, as I read on the USB HID standard, if I'm not mistaken.
« Last Edit: Wed, 16 December 2015, 19:12:15 by VinnyCordeiro »

Offline TalkingTree

  • Posts: 2376
  • Location: Italy (142)
    • My projects
Re: TMK keyboard firmware
« Reply #1110 on: Mon, 14 December 2015, 15:23:28 »
Are you sure the key matrix position?
You're right, I got the layout from here, but bpiphany's code looks much different, I'll try with his.
Thanks for your time.
My opensource projects: GH80-3000, TOAD, XMMX.

Offline hasu

  • Thread Starter
  • Posts: 3109
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #1111 on: Mon, 14 December 2015, 17:06:14 »
Hey!

I've tried to make it further into the coding, but whenever I try to compile I get loads of warnings together with one error, which says:
Code: [Select]
keymap_poker.c:21: error: expected '}' before ';' token
This is my keymap_poker.c file:
Code: [Select]
#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  /* 0: qwerty */
  KEYMAP(Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P, 
            A,   S,   D,   F,   G,   H,   J,   K,   L,   
              Z,   X,   C,   V,   B,   N,   M, RSFT,     
                        FN0,   SPC,    FN1),

  /* 1: FN 1 */
  KEYMAP(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,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: FN 2 */
  KEYMAP(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, 
           TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     
             TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,       
                            TRNS,TRNS,TRNS)
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1)
[1] = ACTION_LAYER_MOMENTARY(2)
};

Thankfull for any help I can get!  :)

Probably your KEYMAP macro definition causes the error.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline mrbishop

  • * Maker
  • Posts: 799
  • Location: South Carolina USA
  • Evil Genius
    • Bishop Computer Design web
Re: TMK keyboard firmware
« Reply #1112 on: Mon, 14 December 2015, 19:17:22 »
i took a look over my firmware and my device manager settings and i didnt see anything out of the ordinary.
my keyboard is still not waking my surface (either of them Pro2 or 3) from sleep. when it sleeps the keyboard stops responding until i unplug and plug it back in.

any thoughts?
Console feature has problems in some situations. Try disabling it if you have the build option in your makefile.

i disabled all the things i didnt think were necessary. seems to be working for the moment. i'll be doing ongoing testing. thanks for the tip Hasu
Projects
Build to give back, 40% | Alps/Matias Removal ToolUltraHack 67% Hackdura  | ErgoDox case
                             
    

Offline hasu

  • Thread Starter
  • Posts: 3109
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #1113 on: Mon, 14 December 2015, 19:34:39 »
i took a look over my firmware and my device manager settings and i didnt see anything out of the ordinary.
my keyboard is still not waking my surface (either of them Pro2 or 3) from sleep. when it sleeps the keyboard stops responding until i unplug and plug it back in.

any thoughts?
Console feature has problems in some situations. Try disabling it if you have the build option in your makefile.

i disabled all the things i didnt think were necessary. seems to be working for the moment. i'll be doing ongoing testing. thanks for the tip Hasu

Great. If you can take time to narrow down which is exactly the cause of your problem, it would be appreciated.
Do you think the console is the cause or else?
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hasu

  • Thread Starter
  • Posts: 3109
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #1114 on: Mon, 14 December 2015, 21:21:48 »
I'm programming an spare of my custom designed PCB and preparing it for ABNT2. The PCB works with ANSI layout flawless and beautifully, so I just need to solve 2 questions.

Keep in mind that, as suggested by the USB HID standard, I'll have to program the keyboard firmware using US ANSI codes and let the operating system convert it back to PT-BR.

I've used two programs to test an ABNT2 keyboard I have here at home (rubber dome, unfortunately): Aqua'S KeyTest and Switch Hitter. Layout for UK ISO, US ANSI & BR ABNT2 in the image below for reference:

(Attachment Link)

Questions:
  • The red key is BACKSLASH on US ANSI, the programs confirmed that. But on the ABNT2 keyboard it is located where in the UK ISO it should be NONUS_HASH. Is there any problem on using BACKSLASH over NONUS_HASH?
  • Is the yellow key (BIOS code 0x56 and Windows code 0xE2) supposed to be NONUS_BSLASH? At this location both UK ANSI & BR ABNT2 are the same.

The cyan button (BIOS code 0x73 and Windows code 0xC1) is to be set as INT1, as I read on the USB HID standard, if I'm not mistaken.

Firstly, you cannot see real code sent from your keyboard with Aqua's tool and SwitchHitter.(I never tried SwitchHitter, I may be wrong about it, perhaps.) What you are seeing is virtual Windows scancode trasnlated by the OS. I think you'll have to use USB packet capture tool like wireshark to see real USB code.

I don't have any USB ISO/JIS/Brazilian keyboards and don't know what they send in real. But I'm also interested to know, it would be nice if you or someone can see them with capture tool.

You can know how Windows translates real USB codes into Windows scancodes with MIcrosoft document, see below. Windows scanocds is PS/2 scan code set 1 in fact.

Fun keyboard trivia: Windows still uses XT scancode(PS/2 set1) interanlly and Mac still uses ADB.

1. I don't know. Try it and report!
2. I think so.

I recommend to conform to HID spec first, if you have any problem let us know. It would be an interesting topic.



Today I learnt:
I had to search these things on the web to write this. Writing down these here may be useful for someone sometime.

ABNT2: Portuguese–Brazilian keyboard layout https://msdn.microsoft.com/en-us/library/cc195107.aspx
PT-BR: Portuguese Brazil locale
Aqua's Keytest: key test tool https://geekhack.org/index.php?topic=6643.0
Switch Hitter: Keyboard Diagnostic Software https://elitekeyboards.com/switchhitter.php

BIOS code: Windows scancodes  http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf
Windows code: virtual keycodes for GUI? https://msdn.microsoft.com/library/windows/desktop/dd375731(v=vs.85).aspx

And you can refer it about USB HID codes, around pp.54.
HID usage table: http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline mrbishop

  • * Maker
  • Posts: 799
  • Location: South Carolina USA
  • Evil Genius
    • Bishop Computer Design web
Re: TMK keyboard firmware
« Reply #1115 on: Mon, 14 December 2015, 21:25:22 »
i took a look over my firmware and my device manager settings and i didnt see anything out of the ordinary.
my keyboard is still not waking my surface (either of them Pro2 or 3) from sleep. when it sleeps the keyboard stops responding until i unplug and plug it back in.

any thoughts?
Console feature has problems in some situations. Try disabling it if you have the build option in your makefile.

i disabled all the things i didnt think were necessary. seems to be working for the moment. i'll be doing ongoing testing. thanks for the tip Hasu

Great. If you can take time to narrow down which is exactly the cause of your problem, it would be appreciated.
Do you think the console is the cause or else?
Console was not it. I'll have to test them one at a time which will take awhile. But I'll report back here in a day or so
Projects
Build to give back, 40% | Alps/Matias Removal ToolUltraHack 67% Hackdura  | ErgoDox case
                             
    

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1116 on: Tue, 15 December 2015, 01:51:05 »
Probably your KEYMAP macro definition causes the error.

Thanks! I had forgotten to place some brackets, which caused the error! That solved that error at least... Now there's 4 more..!
« Last Edit: Wed, 16 December 2015, 15:27:27 by Zorberema »

Offline mrbishop

  • * Maker
  • Posts: 799
  • Location: South Carolina USA
  • Evil Genius
    • Bishop Computer Design web
Re: TMK keyboard firmware
« Reply #1117 on: Tue, 15 December 2015, 08:23:09 »
i took a look over my firmware and my device manager settings and i didnt see anything out of the ordinary.
my keyboard is still not waking my surface (either of them Pro2 or 3) from sleep. when it sleeps the keyboard stops responding until i unplug and plug it back in.

any thoughts?
Console feature has problems in some situations. Try disabling it if you have the build option in your makefile.

i disabled all the things i didnt think were necessary. seems to be working for the moment. i'll be doing ongoing testing. thanks for the tip Hasu

Great. If you can take time to narrow down which is exactly the cause of your problem, it would be appreciated.
Do you think the console is the cause or else?

After testing it appears the combo of Sleep LED Enable and Command Enable were the combined issue. after commenting both out all is well with the world.
Projects
Build to give back, 40% | Alps/Matias Removal ToolUltraHack 67% Hackdura  | ErgoDox case
                             
    

Offline VinnyCordeiro

  • Posts: 432
Re: TMK keyboard firmware
« Reply #1118 on: Tue, 15 December 2015, 09:49:25 »
ABNT2: Portuguese–Brazilian keyboard layout https://msdn.microsoft.com/en-us/library/cc195107.aspx
The link hasu has posted is an US ANSI keyboard physical key layout with the logical PT-BR ABNT2 keys. The physical layout, as I usually says, is a modified version of ISO, including the JIS layout split right Shift for an extra 1u key. Wikipedia shows it: https://en.wikipedia.org/wiki/QWERTY#Brazil

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1119 on: Wed, 16 December 2015, 15:29:16 »
Sorry for posting so frequently appart, but there seems to be more and more errors popping up every time I solve one...

I was able to sort the last error out with your help, but now there's 4 new that I have no clue on how to solve.. Here's what the current ones says:

Code: [Select]
keymap_poker.c:3: error: static declaration of 'keymaps' follows non-static declaration
keymap_common.h:33: error: previous declaration of 'keymaps' was here
keymap_poker.c:22: error: static declaration of 'fn_actions' follows non-static declaration
keymap_common.h:34: error: previous declaration of 'fn_actions' was here
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1

I figure that they're connected between the 2 files, but since my coding knowledge is... limited... I have no clue on how to go about fixing this!

Here's my keymap_common.h file:
Code: [Select]
#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( \
    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, \
    K11, K12, K13, K14, K15, K16, K17, K18, K19, \
    K21, K22, K23, K24, K25, K26, K27, K28, \
    K33, K35, K36 \
) { \
    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09}, \
    { KC_NO, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19}, \
    { KC_NO, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_NO}, \
    { KC_NO, KC_NO, KC_NO, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_NO, KC_NO, KC_NO}, \
}

/* 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

And my keymap_poker.c file:
Code: [Select]
#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  /* 0: qwerty */
  KEYMAP(Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,  \
            A,   S,   D,   F,   G,   H,   J,   K,   L,    \
              Z,   X,   C,   V,   B,   N,   M, RSFT,      \
                        FN0,   SPC,    FN1),

  /* 1: FN 1 */
  KEYMAP(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,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: FN 2 */
  KEYMAP(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,  \
           TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     \
             TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,        \
                            TRNS,TRNS,TRNS),
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),
[1] = ACTION_LAYER_MOMENTARY(2)
};

As said; thankful for all the help I can get! Thank you so much for helping out! :)

Offline TalkingTree

  • Posts: 2376
  • Location: Italy (142)
    • My projects
Re: TMK keyboard firmware
« Reply #1120 on: Wed, 16 December 2015, 15:38:57 »
It compiled just fine here.
Maybe you're missing come gcc headers? Have you tried to update your system?
My opensource projects: GH80-3000, TOAD, XMMX.

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1121 on: Wed, 16 December 2015, 15:42:01 »
It compiled just fine here.
Maybe you're missing come gcc headers? Have you tried to update your system?

Sorry for my incompetence, but what is gcc headers? How would I go about updating the system? Also, how were you able to compile it without having the other files correct; I assume this hex file would not be useable on the keyboard as of now? Thanks for helping out; I'm new to this whole programming thing, haha! :)

Offline abjr

  • Posts: 171
  • Location: Connecticut
    • abjr.org
Re: TMK keyboard firmware
« Reply #1122 on: Wed, 16 December 2015, 15:45:06 »
It compiled just fine here.
Maybe you're missing come gcc headers? Have you tried to update your system?

It compiled fine here too. I would be careful about giving him that .hex file unless you know what his matrix.c looked like  ;)

@Zorberema, try a "make clean" and them compile again.
CM QFR | magicforce 68 (Gateron) | magicforce 68 (Outemu) | Acros 6311-K

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1123 on: Wed, 16 December 2015, 15:49:40 »
It compiled just fine here.
Maybe you're missing come gcc headers? Have you tried to update your system?

It compiled fine here too. I would be careful about giving him that .hex file unless you know what his matrix.c looked like  ;)

@Zorberema, try a "make clean" and them compile again.

 :thumb: Will try! Just gonna switch computer; updating in 5! :D

Offline TalkingTree

  • Posts: 2376
  • Location: Italy (142)
    • My projects
Re: TMK keyboard firmware
« Reply #1124 on: Wed, 16 December 2015, 15:51:19 »
but what is gcc headers? How would I go about updating the system?
I realise I was too vague, sorry for that.
I meant the C compiler. You should update it to the latest version available.

how were you able to compile it without having the other files correct;
I used GH60 files in TMK firmware and replaced the code you provided.

I assume this hex file would not be useable on the keyboard as of now?
Your FN layers are blank, so it will boot but won't be of much use.
Also, and most importantly, if your matrix.c is different it won't work at all.

Make sure you run "make -f Makefile clean" before "make -f Makefile".
Zip the whole folder and upload it here, I'll take a look.
My opensource projects: GH80-3000, TOAD, XMMX.

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1125 on: Wed, 16 December 2015, 15:57:31 »
but what is gcc headers? How would I go about updating the system?
I realise I was too vague, sorry for that.
I meant the C compiler. You should update it to the latest version available.

how were you able to compile it without having the other files correct;
I used GH60 files in TMK firmware and replaced the code you provided.

I assume this hex file would not be useable on the keyboard as of now?
Your FN layers are blank, so it will boot but won't be of much use.
Also, and most importantly, if your matrix.c is different it won't work at all.

Make sure you run "make -f Makefile clean" before "make -f Makefile".
Zip the whole folder and upload it here, I'll take a look.

Tried to clean, didn't work still... :/ The FN layers are blank on purpose, just to test things out! And yes, the matrix file is very different :P Here's the file anyways!

Offline TalkingTree

  • Posts: 2376
  • Location: Italy (142)
    • My projects
Re: TMK keyboard firmware
« Reply #1126 on: Wed, 16 December 2015, 16:08:15 »
Remove the word static before const from keymap_poker.c (occurs twice), clean and recompile.
My opensource projects: GH80-3000, TOAD, XMMX.

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1127 on: Wed, 16 December 2015, 16:16:24 »
Remove the word static before const from keymap_poker.c (occurs twice), clean and recompile.

Had to open several text editors and close down sublime text 2 times before I could see static written... It seemed to work now, but it made like 1000 different files; is that normal? I got a hex file in here, will try that out!

Offline TalkingTree

  • Posts: 2376
  • Location: Italy (142)
    • My projects
Re: TMK keyboard firmware
« Reply #1128 on: Wed, 16 December 2015, 16:20:30 »
it made like 1000 different files; is that normal?
1000 different files? No.
2 folders and 6 files (eep, elf, hex, lss, map and sym)? Yes.
And yes, .hex is what you need.
Please note that make clean will delete those files, so backup your last working .hex before editing and cleaning.
Enjoy your firmware.
My opensource projects: GH80-3000, TOAD, XMMX.

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1129 on: Wed, 16 December 2015, 16:28:41 »
it made like 1000 different files; is that normal?
1000 different files? No.
2 folders and 6 files (eep, elf, hex, lss, map and sym)? Yes.
And yes, .hex is what you need.
Please note that make clean will delete those files, so backup your last working .hex before editing and cleaning.
Enjoy your firmware.

That sounds correct! Sooooo, I got the firmware into the keyboard... And it is pretty messed up! Half the buttons work... But backwards(The right-most button is q, followed by w etc.). Where could this fault be? Anyways, thank you so-so-so much for the help; at least I know that it... kind of works now, haha! :D

Offline TalkingTree

  • Posts: 2376
  • Location: Italy (142)
    • My projects
Re: TMK keyboard firmware
« Reply #1130 on: Wed, 16 December 2015, 16:31:14 »
Half the buttons work... But backwards(The right-most button is q, followed by w etc.). Where could this fault be?
Most likely your matrix. Sounds like you defined it backwards and missed some entries. It could also be a hardwiring issue, or both things.
My opensource projects: GH80-3000, TOAD, XMMX.

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1131 on: Wed, 16 December 2015, 16:33:27 »
Half the buttons work... But backwards(The right-most button is q, followed by w etc.). Where could this fault be?
Most likely your matrix. Sounds like you defined it backwards and missed some entries. It could also be a hardwiring issue, or both things.
The second row don't work at all, haha! I guess that row is handwiring, and the backwards stuff is matrix... Maybe both! Anyways, I'm heading to bed now, I'll look further into this tomorrow! Thanks once again for the help, I really appreciate it!

Offline abjr

  • Posts: 171
  • Location: Connecticut
    • abjr.org
Re: TMK keyboard firmware
« Reply #1132 on: Wed, 16 December 2015, 16:35:46 »
Remove the word static before const from keymap_poker.c (occurs twice), clean and recompile.

Had to open several text editors and close down sublime text 2 times before I could see static written... It seemed to work now, but it made like 1000 different files; is that normal? I got a hex file in here, will try that out!

Weird. The code you pasted above didn't have static in keymap_poker.c, but the .zip file did. Were you editing one set of files and compiling another? :)
CM QFR | magicforce 68 (Gateron) | magicforce 68 (Outemu) | Acros 6311-K

Offline TalkingTree

  • Posts: 2376
  • Location: Italy (142)
    • My projects
Re: TMK keyboard firmware
« Reply #1133 on: Wed, 16 December 2015, 16:36:11 »
Thanks once again for the help, I really appreciate it!
Don't mention. And keep me posted, I'm intrigued.
My opensource projects: GH80-3000, TOAD, XMMX.

Offline Zorberema

  • * Maker
  • Posts: 174
  • Location: Sweden
  • IG: @ZorbCaps
Re: TMK keyboard firmware
« Reply #1134 on: Wed, 16 December 2015, 16:40:55 »
Remove the word static before const from keymap_poker.c (occurs twice), clean and recompile.

Had to open several text editors and close down sublime text 2 times before I could see static written... It seemed to work now, but it made like 1000 different files; is that normal? I got a hex file in here, will try that out!

Weird. The code you pasted above didn't have static in keymap_poker.c, but the .zip file did. Were you editing one set of files and compiling another? :)

That's the weird part; I couldn't see it myself, until he said it and I checked the zip. I am a 100% sure it was never there before as I've compared to matt3o's a lot. It popped up after saving and restarting my editor and going into notepad...

Offline hasu

  • Thread Starter
  • Posts: 3109
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #1135 on: Wed, 16 December 2015, 21:40:21 »
i took a look over my firmware and my device manager settings and i didnt see anything out of the ordinary.
my keyboard is still not waking my surface (either of them Pro2 or 3) from sleep. when it sleeps the keyboard stops responding until i unplug and plug it back in.

any thoughts?
Console feature has problems in some situations. Try disabling it if you have the build option in your makefile.

i disabled all the things i didnt think were necessary. seems to be working for the moment. i'll be doing ongoing testing. thanks for the tip Hasu

Great. If you can take time to narrow down which is exactly the cause of your problem, it would be appreciated.
Do you think the console is the cause or else?

After testing it appears the combo of Sleep LED Enable and Command Enable were the combined issue. after commenting both out all is well with the world.

Thanks for the report back. I added it to FAQ on github wiki.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline mrbishop

  • * Maker
  • Posts: 799
  • Location: South Carolina USA
  • Evil Genius
    • Bishop Computer Design web
Re: TMK keyboard firmware
« Reply #1136 on: Wed, 16 December 2015, 22:00:30 »
i took a look over my firmware and my device manager settings and i didnt see anything out of the ordinary.
my keyboard is still not waking my surface (either of them Pro2 or 3) from sleep. when it sleeps the keyboard stops responding until i unplug and plug it back in.

any thoughts?
Console feature has problems in some situations. Try disabling it if you have the build option in your makefile.

i disabled all the things i didnt think were necessary. seems to be working for the moment. i'll be doing ongoing testing. thanks for the tip Hasu

Great. If you can take time to narrow down which is exactly the cause of your problem, it would be appreciated.
Do you think the console is the cause or else?

After testing it appears the combo of Sleep LED Enable and Command Enable were the combined issue. after commenting both out all is well with the world.

Thanks for the report back. I added it to FAQ on github wiki.
Np thanks for all your help
Projects
Build to give back, 40% | Alps/Matias Removal ToolUltraHack 67% Hackdura  | ErgoDox case
                             
    

Offline Koren

  • Posts: 133
  • Location: France
Re: TMK keyboard firmware
« Reply #1137 on: Fri, 18 December 2015, 12:36:03 »
I'm pretty sure the question has been answered, but I don't find it, and Google don't help me :/

I wonder how exactly momentary switches of layers are handled... Can someone confirms me that it basically toggle the layer on press AND on release, and the release need that the key has the same meaning at release time? I've yet to take the time to read the relevant part of the code...

I guess it's the case, because if a key in layer 0 is KC_FN1 that momentarily activate layer 1, I'm stuck in layer 1 if the same key in layer 1 is translated to something else than KC_TRNS or KC_FN1.


Not a big deal in this case, but it can become tricky. Let's suppose I have a keyboard with two keys, and four layers :

Layer 0 : KC_F1     KC_F2
Layer 1 : KC_TRNS KC_F3
Layer 2 : KC_F3    KC_TRNS
Layer 3 : KC_TRNS KC_TRNS

where KC_Fi are momentary layer switch to layer i

When I try this, I can access layer 1 and 2 easily, and when I press both keys, I access layer 3.

Problems arise when I release the keys : if I release them in the opposite order I pressed them, no issue, I go back to layer 1 ; but if I release them in the same order (press K1, press K2, release K1, release K2), I end up stuck in layer 3 and (I think) layer 2 active underneath: pressing K1 make me reach layer 2, and K2 has no effect.

I'd say it works this way:
[layer 0] : KC_F1     KC_F2
press left key
[layers 0+1] : KC_F1     KC_F3
press right key
[layers 0+1+3] : KC_F1     KC_F3
release left key
[layers 0+3] : KC_F1     KC_F2
release right key
[layers 0+2+3] : KC_F3     KC_F2

So I'm not back on layer 0 only after releasing all keys in this order. Is my analysis correct?

Is there a trick to make this work beside duplicating the layer 3?

Offline hasu

  • Thread Starter
  • Posts: 3109
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #1138 on: Sun, 20 December 2015, 06:19:19 »
So I'm not back on layer 0 only after releasing all keys in this order. Is my analysis correct?

Is there a trick to make this work beside duplicating the layer 3?

I think you are correct, you can handle 5 layers with two keys at maximum. Yes, duplicating is one of solutions.

But this doesn't work for you? I may be wrong.

Quote

Layer 0 : L1   L2
Layer 1 : L1   L3
Layer 2 : L3   L2
Layer 3 : TRNS TRNS
Using KC_F* here is confusing, I used L* instead.


You can rewrite it more detail like the below. In TMK an action is comprised of press action and release action, in fact.  For example, ACTION_LAYER_MOMENTARY(1) acts as  +L1 on press and -L1 on release.
Quote

        KeyL                KeyR
Layer   press   release     press   release 
----------------------------------------------
0       +L1     x           +L2     x
1       x       -L1         +L3     -L3
2       +L3     -L3         x       -L2
3       TRNS    TRNS        TRNS    TRNS

where
x   : 'don't care',
+Ln : turn on Layer n
-Ln : turn off Layer n
=Ln : set Layer n only(other layers are disabled)


Or you can also use ACTION_LAYER_SET() probably.
Quote

        KeyL                KeyR
Layer   press   release     press   release 
----------------------------------------------
0       =L1     x           =L2     x
1       x       =L0         =L3     x
2       =L3     x           x       =L0
3       x       =L2         x       =L1


BTW, to handle 5 layers with two keys you will be able to define like this.
Quote

        KeyL                KeyR
Layer   press   release     press   release 
----------------------------------------------
0       +L1     x           +L2     x
1       x       -L1         +L3     x
2       +L4     x           x       -L2
3       x       -L1         x       -L3
4       x       -L4         x       -L2
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Koren

  • Posts: 133
  • Location: France
Re: TMK keyboard firmware
« Reply #1139 on: Mon, 21 December 2015, 13:59:56 »
First, many thanks for the detailed answer... and also for all your work on firmwares!
But this doesn't work for you? I may be wrong.
If I'm not mistaken, I've tried it, it works, but only if I release the keys in the correct order, which is not perfect... That being said, I should go on testing this (but I'm away from my avr-gcc compilation chain now)

For the moment, I settled for a different solution : use the user scan function to update the variable layer so that the bit for the layer 12 is the result of binary AND applied to both bits corresponding to layers 4 and 8. I thus don't use any layer switch to switch to layer 12 anymore, I just activate 4 and 8 which triggers 12. it's a bit crude, but it works.

Yes, it's not 1, 2 and 3 anymore, but 4, 8 and 12. That's because it's not the dirtiest thing I've done ^_^... If a layer 4*k (where k<4) is enabled, I activate the layer 4*k+1 if shift is pressed (and I've found nothing better than importing the matrix table to check this), 4*k+2 if the layer 31 (completely transparent) is active, and 4*k+3 if both are True.

The shift trick is because I don't want e.g. shift-comma to act as less for example (on QWERTY, it's not exactly my case), but still sending shift as soon as I press the key (so I can't really use a classic layer for shifted keys) and the second one because I want to be able to change a couple of keys depending on the task I'm doing.

What's great with programmable keyboards is that you can do nearly whatever you want, given some time... nearly, because I'm already at 99% full :/ I still want to fork your code, but I doubt I'll be able to do what I want (*) on a normal Ergodox (I need an Axios ^_^)

I've read half of the firmware last saturday (I left the hardware part for the moment). A lot of interesting stuff... It took me some time to figure how you exactly handled the tap feature, though. it shows that you spent a lot of time tweaking special cases!

Again, many many thanks for all your work, and the help you keeps providing.


(* what I want is, among other things, a double conversion, key to symbols, then symbols to keycodes so that I don't need to be able to change the layout in the computer... the problem is that I use a mix of french AZERTY and belgian AZERTY (closer to QWERTY) on my own computers, to ease access to coding symbols, but computer at work use plain french AZERTY and I can't change it. And I don't want to flash the keyboard each time I jump from one computer to another.

Quote
BTW, to handle 5 layers with two keys you will be able to define like this.
Interesting...

Offline McPwned

  • Posts: 39
Re: TMK keyboard firmware
« Reply #1140 on: Sun, 27 December 2015, 18:17:10 »
I'm having a bit of trouble using mouse keys in macros.  For example, when I just put WH_U in my keymap, it works fine.  However, when I have a macro like the following, nothing happens:

        case WHEEL_UP:
            return (record->event.pressed ?
                    MACRO( T(WH_U), END ) :
                    MACRO_NONE );

Are they any suggestions as to what I may be doing incorrectly?  I have got other macros to work fine.

Offline Koren

  • Posts: 133
  • Location: France
Re: TMK keyboard firmware
« Reply #1141 on: Mon, 28 December 2015, 11:00:53 »
I'm having a bit of trouble using mouse keys in macros.
I may be wrong (Hasu will correct me if I am), but I suspect you simply can't use mouse events in macro (at least in the firmware version I have).

I think keypresses call action_exec which calls process_action which can deal with mouse events, but macros directly use register_code which can't. I'd say macros can only send keyboard scancodes (up to KC_EXSEL / 0xA4). Media keys and power management keys probably don't work either in macros based on a quick survey of source code.

(again, at least on the version I have, but that would explain your problem)


From a more practical point of view, I confirm you I can't use mouse keys in macros either, so if you do something wrong, I've done it too ^_^

Offline McPwned

  • Posts: 39
Re: TMK keyboard firmware
« Reply #1142 on: Mon, 28 December 2015, 14:34:27 »
I may be wrong (Hasu will correct me if I am), but I suspect you simply can't use mouse events in macro (at least in the firmware version I have).

I think keypresses call action_exec which calls process_action which can deal with mouse events, but macros directly use register_code which can't. I'd say macros can only send keyboard scancodes (up to KC_EXSEL / 0xA4). Media keys and power management keys probably don't work either in macros based on a quick survey of source code.

(again, at least on the version I have, but that would explain your problem)


From a more practical point of view, I confirm you I can't use mouse keys in macros either, so if you do something wrong, I've done it too ^_^
I appreciate the information and your confirmation.  Thank you.

Offline hasu

  • Thread Starter
  • Posts: 3109
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #1143 on: Mon, 28 December 2015, 15:00:24 »
As Koren said, you cannot send mousekey with register_code(), but it seems like media key and system key can be sent.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/action.c#L419-L424

I think you can fix around here to send mouse keys.(or register_code() should be fixed?)
https://github.com/tmk/tmk_keyboard/blob/33714e55827d1cf52df1d3ff143f03fa34ad1f06/tmk_core/common/action_macro.c#L40-L59

And I originaly designed that macro can send keycodes only of 0x04-0x73 to save memory space. So I didn't think about sending mouse and media key events in macro much.
https://github.com/tmk/tmk_keyboard/blob/33714e55827d1cf52df1d3ff143f03fa34ad1f06/tmk_core/common/action_macro.h#L38-L55

This was filed and will be fixed some later(TM).
https://github.com/tmk/tmk_keyboard/issues/289
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline McPwned

  • Posts: 39
Re: TMK keyboard firmware
« Reply #1144 on: Mon, 28 December 2015, 17:41:47 »
As Koren said, you cannot send mousekey with register_code(), but it seems like media key and system key can be sent.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/action.c#L419-L424

I think you can fix around here to send mouse keys.(or register_code() should be fixed?)
https://github.com/tmk/tmk_keyboard/blob/33714e55827d1cf52df1d3ff143f03fa34ad1f06/tmk_core/common/action_macro.c#L40-L59

And I originaly designed that macro can send keycodes only of 0x04-0x73 to save memory space. So I didn't think about sending mouse and media key events in macro much.
https://github.com/tmk/tmk_keyboard/blob/33714e55827d1cf52df1d3ff143f03fa34ad1f06/tmk_core/common/action_macro.h#L38-L55

This was filed and will be fixed some later(TM).
https://github.com/tmk/tmk_keyboard/issues/289

Between both of your posts, I was able to fix it, I think.  My testing is far from extensive, but wheel up/down and left click work in a couple different macros for me.

In register_code() I added the following to the end:

    else if IS_MOUSEKEY(code) {
        mousekey_on(code);
        mousekey_send();
    }

And similarly I added the following to unregister_code():

    else if IS_MOUSEKEY(code) {
        mousekey_off(code);
        mousekey_send();
    }

Thanks.

Offline Koren

  • Posts: 133
  • Location: France
Re: TMK keyboard firmware
« Reply #1145 on: Mon, 28 December 2015, 18:33:49 »
As Koren said, you cannot send mousekey with register_code(), but it seems like media key and system key can be sent.
I stand corrected. I'm indeed missing those lines in my version, but I'm using a fork, and I'm not really sure when the sources parted.

or register_code() should be fixed?
You can indeed do some tricks in the user macro function since it won't clash with other keyboard functions, but a solution in the firmware core is probably more satisfying...

That being said, if there's mouse support in register_code(), it'll be a bit akward that process_action() is not using it... The same goes for media/power keys, though.


Out of curiosity, can you confirm that there's no way in mouse drivers to move to an absolute position, and that you can only do relative motions? Have you ever looked into "tablets" (Wacom-like) devices and would it be possible for the keyboard to also act as a tablet, to overcome this limitation?

I need something like this (I'm working on a electronic whiteboard), I thought about creating my own ATMega code for it, but if I can "patch" this firmware, it'll probably easier.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 3729
  • Location: England
Re: TMK keyboard firmware
« Reply #1146 on: Sat, 09 January 2016, 14:50:50 »
Can anyone explain how to make the LEDs work on a GH60 PCB?  If I've read right Caps, Esc, WASD and Poker Arrows should be wired up while the rest need an expansion module, but the only one mentioned in led.c is Caps and that doesn't work.  There's nothing about LEDs in the help files either, unless I'm missing something - feel free to link it :)
                               
Ducky Zero, MX Reds    JD40, Jailhouse Blues           GH60
Soarer controller

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #1147 on: Sun, 10 January 2016, 08:57:33 »
Can anyone explain how to make the LEDs work on a GH60 PCB?  If I've read right Caps, Esc, WASD and Poker Arrows should be wired up while the rest need an expansion module, but the only one mentioned in led.c is Caps and that doesn't work.  There's nothing about LEDs in the help files either, unless I'm missing something - feel free to link it :)
So, poker arrows LEDs are routed to PF4; WASD to PF7; Caps to PB2; Esc to PF6. All of them are active LOW. You'll need to solder in resistors for these (indicated on the PCB). It's up to you how will you use those (you can e.g. use the esc led for a layer indicator, etc...)

Offline suicidal_orange

  • * Global Moderator
  • Posts: 3729
  • Location: England
Re: TMK keyboard firmware
« Reply #1148 on: Sun, 10 January 2016, 11:12:17 »
Can anyone explain how to make the LEDs work on a GH60 PCB?  If I've read right Caps, Esc, WASD and Poker Arrows should be wired up while the rest need an expansion module, but the only one mentioned in led.c is Caps and that doesn't work.  There's nothing about LEDs in the help files either, unless I'm missing something - feel free to link it :)
So, poker arrows LEDs are routed to PF4; WASD to PF7; Caps to PB2; Esc to PF6. All of them are active LOW. You'll need to solder in resistors for these (indicated on the PCB). It's up to you how will you use those (you can e.g. use the esc led for a layer indicator, etc...)

Thanks, that's a great start.  Pretty sure Caps should have been working (I was touching an LED and resistor combo to the right pads) but now I can check the config and test the rest of them to see what's wrong :thumb:
                               
Ducky Zero, MX Reds    JD40, Jailhouse Blues           GH60
Soarer controller

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #1149 on: Sun, 10 January 2016, 11:50:07 »
Glad I could help. BTW I haven't actually put the LEDs into my GH60, I just traced the connections on the PCB with a multimeter.