Author Topic: Announce: TMK firmware for ErgoDox  (Read 70036 times)

0 Members and 1 Guest are viewing this topic.

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Announce: TMK firmware for ErgoDox
« Reply #150 on: Wed, 21 January 2015, 21:39:58 »
Assuming that you have built firmware with correct keymap and build configuration, try one of these.

0) 'make clean' before build
1) change USB port, try other ports that you've never conected the keyboard.
2) remove all ErgoDox device entries in 'Device Manager'. You will see many entries under 'Human Interace Devices' in addition to 'Keyboards' and 'Mice and other pointing devices'.(in case Windows 7)
3) build with other USB VID or PID. you can change these in config.h.

When you change USB endpoint configuration(mouser key, nkro, console) you can have this kind of problem in Windows(at least in 7). Not sure but probably Windows caches driver setting somewhere using VID:PID as key so it cannot handle when seeing same VID:PID device with different endpoint configuration.

https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#edit-configuration-but-not-change

Offline GelatinousSlime

  • Posts: 2
Re: Announce: TMK firmware for ErgoDox
« Reply #151 on: Tue, 27 January 2015, 05:57:46 »
Thanks hasu, it was definitely windows caching the driver settings.

Offline Arvid

  • Posts: 32
  • Location: Sweden
Re: Announce: TMK firmware for ErgoDox
« Reply #152 on: Fri, 30 January 2015, 08:10:05 »
Are the media keys MNXT and  MPREV supposed to work on OSX?
Volume, mute and play are working but not those two.

Offline zarquon

  • Posts: 17
  • Location: Hungary
Re: Announce: TMK firmware for ErgoDox
« Reply #153 on: Tue, 17 February 2015, 17:06:07 »
Hi, today I successfully built a trackpoint module into the right side of my ergodox keyboard following the tutorial in this thread: https://geekhack.org/index.php?topic=55960.0
and I'm extremely happy with the result (as I know very little about hardware stuff and C).

I wonder is it possible to include another trackpoint module into the left side of the ergodox,to have one at each side. As I said I know very little about hardware, but I'm eager to learn.
Could somebody point me to the right direction where to start?

Any help is appreciated.
Thank you!:)

Offline plainbriny

  • Posts: 192
  • Location: Taiwan
Re: Announce: TMK firmware for ErgoDox
« Reply #154 on: Tue, 17 February 2015, 22:33:28 »
I think there are 4 ways to do what you want:

1. build a left hand version of ergodox, so you will essentially have two ergodox (and teensy), each for one hand. The problem is that
you lost coordination between the two halves, such as layers and others.

2. modify the firmware, add support for additional PS/2 mouse device, problem is the second trackpoint will communicate to teensy through I2C, make the task a bit complicate.

3. connect two trackpoint module to one trackpoint controller. Each trackpoint module are actually one controller board connected to the trackpoint using 4 wires. You can connect the other trackpoint using 4 wires, but there will be an additional cable between the two halves, and I am not sure whether this will work with long cables (more than a few centimeters).

4. build an independent trackpoint module (only teensy and trackpoint) and connect to PC independently (not through your ergodox), this should be the easiest, but you will have one more USB connection. You can also add a USB hub in ergodox, to simplify your connection from ergodox to PC.

« Last Edit: Tue, 17 February 2015, 22:36:27 by plainbriny »

Offline zarquon

  • Posts: 17
  • Location: Hungary
Re: Announce: TMK firmware for ErgoDox
« Reply #155 on: Wed, 18 February 2015, 03:27:52 »
I think there are 4 ways to do what you want:

1. build a left hand version of ergodox, so you will essentially have two ergodox (and teensy), each for one hand. The problem is that
you lost coordination between the two halves, such as layers and others.

2. modify the firmware, add support for additional PS/2 mouse device, problem is the second trackpoint will communicate to teensy through I2C, make the task a bit complicate.

3. connect two trackpoint module to one trackpoint controller. Each trackpoint module are actually one controller board connected to the trackpoint using 4 wires. You can connect the other trackpoint using 4 wires, but there will be an additional cable between the two halves, and I am not sure whether this will work with long cables (more than a few centimeters).

4. build an independent trackpoint module (only teensy and trackpoint) and connect to PC independently (not through your ergodox), this should be the easiest, but you will have one more USB connection. You can also add a USB hub in ergodox, to simplify your connection from ergodox to PC.

I'd like to aim for the second option: wire the second trackpoint module to the MCP23018 and communicate via the existing I2C connection. But I don't really know where to start.

Offline deadtree123

  • Posts: 2
Re: Announce: TMK firmware for ErgoDox
« Reply #156 on: Sun, 29 March 2015, 00:58:39 »
Hi,

Just wanted to say thank you to hasu and cub-uanic for all their contributions to the ergodox project. It changed my life!

Set up my ergodox in a way where I dont even need a mouse to do my work!

Love you guys! :thumb:

« Last Edit: Sun, 29 March 2015, 01:00:47 by deadtree123 »

Offline nomaded

  • Posts: 197
  • Location: Andover, MA
Re: Announce: TMK firmware for ErgoDox
« Reply #157 on: Sat, 08 August 2015, 02:35:29 »
I finally got around to playing with the ErgoDox port of the TMK firmware. I'm still working on finalizing my own layout, but I've created a Dvorak layout based on Ben Blazak's dvorak-kinesis-mod layout.

I've also added the ability to hit both shift keys to toggle capslock (most of the code starts at line 363), and it's part of the keymap_dvorak.h below. Once I figure out github, I'll send cub-uanic a pull request:

Code: [Select]
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    // ........................................................................
    // Layer0: default, dvorak in keyboard, qwerty in OS;
    //      Based on Ben Blazak's dvorak-kinesis-mod layout.
    //
    // left hand
    // ,--------------------------------------------------.
    // | = +    | 1 !  | 2 @  | 3 #  | 4 $  | 5 %  | Esc  |
    // |--------+------+------+------+------+-------------|
    // | Tab    | ' "  | , <  | . >  | p P  | y Y  | +L2  |
    // |--------+------+------+------+------+------|      |
    // | CapsLk | a A  | o O  | e E  | u U  | i I  |------|
    // |--------+------+------+------+------+------| ~L2  |
    // |LSft2Cap| ; :  | q Q  | j J  | k K  | x X  |      |
    // `--------+------+------+------+------+-------------'
    //   | LGui | ` ~  | \ |  | Left | Rght |
    //   `----------------------------------'
    //                                             ,-------------.
    //                                             | LCtl | LAlt |
    //                                      ,------|------|------|
    //                                      |      |      | Home |
    //                                      | BkSp | Del  |------|
    //                                      |      |      | End  |
    //                                      `--------------------'
    //
    // right hand
    //        ,--------------------------------------------------.
    //        | +L1  | 6 ^  | 7 &  | 8 *  | 9 (  | 0 )  |  - _   |
    //        |------+------+------+------+------+------+--------|
    //        | +L2  | f F  | g G  | c C  | r R  | l L  |  / ?   |
    //        |      |------+------+------+------+------+--------|
    //        |------| d D  | h H  | t T  | n N  | s S  |  \ |   |
    //        | ~L2  |------+------+------+------+------+--------|
    //        |      | b B  | m M  | w W  | v V  | z Z  |RSft2Cap|
    //        `-------------+------+------+------+------+--------'
    //                      | Up   | Down | [ {  |  ] } | RGui |
    //                      `----------------------------------'
    // ,-------------.
    // | RAlt | RCtl |
    // |------+------+------.
    // | PgUp |      |      |
    // |------| Entr | Spce |
    // | PgDn |      |      |
    // `--------------------'
    //
    KEYMAP( // Layer0: default, dvorak in keyboard, qwerty in OS;
            // Based on Ben Blazak's dvorak-kinesis-mod layout.
        // left hand
         EQL,    1,    2,    3,    4,    5,  ESC,
         TAB, QUOT, COMM,  DOT,    P,    Y,  FN2,
        CAPS,    A,    O,    E,    U,    I,
        FN29, SCLN,    Q,    J,    K,    X,  FN4,
        LGUI,  GRV, BSLS, LEFT, RGHT,
                                            LCTL, LALT,
                                                  HOME,
                                      BSPC,  DEL,  END,
        // right hand
               FN1,    6,    7,    8,    9,    0, MINS,
               FN2,    F,    G,    C,    R,    L, SLSH,
                       D,    H,    T,    N,    S, BSLS,
               FN4,    B,    M,    W,    V,    Z, FN30,
                            UP, DOWN, LBRC, RBRC, RGUI,
        RALT, RCTL,
        PGUP,
        PGDN,  ENT,  SPC
    ),
    // ........................................................................
    // Layer1: number pad;
    //      Based on Ben Blazak's dvorak-kinesis-mod layout.
    //
    // left hand
    // ,--------------------------------------------------.
    // | = +    | 1 !  | 2 @  | 3 #  | 4 $  | 5 %  | Esc  |
    // |--------+------+------+------+------+-------------|
    // | Tab    | ' "  | , <  | . >  | p P  | y Y  | +L2  |
    // |--------+------+------+------+------+------|      |
    // |        | a A  | o O  | e E  | u U  | i I  |------|
    // |--------+------+------+------+------+------| ~L2  |
    // |LSft2Cap| ; :  | q Q  | j J  | k K  | x X  |      |
    // `--------+------+------+------+------+-------------'
    //   | LGui | Ins  | \ |  | Left | Rght |
    //   `----------------------------------'
    //                                             ,-------------.
    //                                             | LCtl | LAlt |
    //                                      ,------|------|------|
    //                                      |      |      | Home |
    //                                      | BkSp | Del  |------|
    //                                      |      |      | End  |
    //                                      `--------------------'
    //
    // right hand
    //        ,--------------------------------------------------.
    //        | -L1  |      | NmLk | Kp / | Kp * | Kp - | ScrLk  |
    //        |------+------+------+------+------+------+--------|
    //        | +L2  |      | Kp 7 | Kp 8 | Kp 9 | Kp + | PrtScn |
    //        |      |------+------+------+------+------+--------|
    //        |------|      | Kp 4 | Kp 5 | Kp 6 | Kp + | Pause  |
    //        | ~L2  |------+------+------+------+------+--------|
    //        |      |      | Kp 1 | Kp 2 | Kp 3 | KEnt |RSft2Cap|
    //        `-------------+------+------+------+------+--------'
    //                      | Kp 0 | Kp 0 | Kp . | KEnt |      |
    //                      `----------------------------------'
    // ,-------------.
    // | RAlt | RCtl |
    // |------+------+------.
    // | PgUp |      |      |
    // |------| Entr | Spce |
    // | PgDn |      |      |
    // `--------------------'
    //
    KEYMAP( // Layer1: number pad;
            // Based on Ben Blazak's dvorak-kinesis-mod layout.
        // left hand
        TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
        TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
          NO, TRNS, TRNS, TRNS, TRNS, TRNS,
        TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
        TRNS,  INS, TRNS, TRNS, TRNS,
                                            TRNS, TRNS,
                                                  TRNS,
                                      TRNS, TRNS, TRNS,
        // right hand
              TRNS,   NO, NLCK, PSLS, PAST, PMNS, SLCK,
              TRNS,   NO,   P7,   P8,   P9, PPLS, PSCR,
                      NO,   P4,   P5,   P6, PPLS, PAUS,
              TRNS,   NO,   P1,   P2,   P3, PENT, TRNS,
                            P0,   P0, PDOT, PENT,   NO,
        TRNS, TRNS,
        TRNS,
        TRNS, TRNS, TRNS
    ),
    // ........................................................................
    // Layer2: symbols and function keys;
    //      Based on Ben Blazak's dvorak-kinesis-mod layout.
    //
    // left hand
    // ,--------------------------------------------------.
    // | = +    | F1   | F2   | F3   | F4   | F5   | F11  |
    // |--------+------+------+------+------+-------------|
    // | Tab    | {    | }    | [ {  | ] }  |      | -L2  |
    // |--------+------+------+------+------+------|      |
    // | CapsLk | ; :  | / ?  | - _  | 0 )  | :    |------|
    // |--------+------+------+------+------+------| ~L3  |
    // |LSft2Cap| 6 ^  | 7 &  | 8 *  | 9 (  | +    |      |
    // `--------+------+------+------+------+-------------'
    //   | LGui | ` ~  | \ |  | Left | Rght |
    //   `----------------------------------'
    //                                             ,-------------.
    //                                             | LCtl | LAlt |
    //                                      ,------|------|------|
    //                                      |      |      | Home |
    //                                      | BkSp | Del  |------|
    //                                      |      |      | End  |
    //                                      `--------------------'
    //
    // right hand
    //        ,--------------------------------------------------.
    //        | F12  | F6   | F7   | F8   | F9   | F0   | Power  |
    //        |------+------+------+------+------+------+--------|
    //        | +L2  |      | _    | <    | >    | $    | Vol Up |
    //        |      |------+------+------+------+------+--------|
    //        |------| \ |  | 1 !  | (    | )    | = +  | Vol Dn |
    //        | ~L3  |------+------+------+------+------+--------|
    //        |      | *    | 2 @  | 3 #  | 4 $  | 5 %  | Mute   |
    //        `-------------+------+------+------+------+--------'
    //                      | Up   | Down | [ {  |  ] } | RGui |
    //                      `----------------------------------'
    // ,-------------.
    // | RAlt | RCtl |
    // |------+------+------.
    // | PgUp |      |      |
    // |------| Entr | Spce |
    // | PgDn |      |      |
    // `--------------------'
    //
    KEYMAP( // Layer2: symbols and function keys;
            // Based on Ben Blazak's dvorak-kinesis-mod layout.
        // left hand
        TRNS,   F1,   F2,   F3,   F4,   F5,  F11,
        TRNS,  FN5,  FN6, LBRC, RBRC,   NO, TRNS,
        TRNS, SCLN, SLSH, MINS,    0,  FN7,
        TRNS,    6,    7,    8,    9,  FN8,  FN3,
        TRNS, TRNS, TRNS, TRNS, TRNS,
                                            TRNS, TRNS,
                                                  TRNS,
                                      TRNS, TRNS, TRNS,
        // right hand
               F12,   F6,   F7,   F8,   F9,  F10, POWER,
              TRNS,   NO,  FN9, FN10, FN11, FN12, _VOLUP,
                    BSLS,    1, FN13, FN14,  EQL, _VOLDOWN,
               FN3, FN15,    2,    3,    4,    5, _MUTE,
                          TRNS, TRNS, TRNS, TRNS, TRNS,
        TRNS, TRNS,
        TRNS,
        TRNS, TRNS, TRNS
    ),
    // ........................................................................
    // Layer3: keyboard functions
    //      Based on Ben Blazak's dvorak-kinesis-mod layout.
    //
    // left hand
    // ,--------------------------------------------------.
    // | Teensy |      |      |      |      |      |      |
    // |--------+------+------+------+------+-------------|
    // |        |      |      |      |      |      |      |
    // |--------+------+------+------+------+------|      |
    // |        |      |      |      |      |      |------|
    // |--------+------+------+------+------+------|      |
    // |        |      |      |      |      |      |      |
    // `--------+------+------+------+------+-------------'
    //   |      |      |      |      |      |
    //   `----------------------------------'
    //                                             ,-------------.
    //                                             |      |      |
    //                                      ,------|------|------|
    //                                      |      |      |      |
    //                                      |      |      |------|
    //                                      |      |      |      |
    //                                      `--------------------'
    //
    // right hand
    //        ,--------------------------------------------------.
    //        | +L0  |      |      |      |      |      |        |
    //        |------+------+------+------+------+------+--------|
    //        |      |      |      |      |      |      |        |
    //        |      |------+------+------+------+------+--------|
    //        |------|      |      |      |      |      |        |
    //        |      |------+------+------+------+------+--------|
    //        |      |      |      |      |      |      |        |
    //        `-------------+------+------+------+------+--------'
    //                      |      |      |      |      |      |
    //                      `----------------------------------'
    // ,-------------.
    // |      |      |
    // |------+------+------.
    // |      |      |      |
    // |------|      |      |
    // |      |      |      |
    // `--------------------'
    //
    KEYMAP( // Layer3: keyboard functions
            // Based on Ben Blazak's dvorak-kinesis-mod layout.
        // left hand
        FN31,   NO,   NO,   NO,   NO,   NO,   NO,
          NO,   NO,   NO,   NO,   NO,   NO,   NO,
          NO,   NO,   NO,   NO,   NO,   NO,
          NO,   NO,   NO,   NO,   NO,   NO,   NO,
          NO,   NO,   NO,   NO,   NO,
                                              NO,   NO,
                                                    NO,
                                        NO,   NO,   NO,
        // right hand
               FN0,   NO,   NO,   NO,   NO,   NO,   NO,
                NO,   NO,   NO,   NO,   NO,   NO,   NO,
                      NO,   NO,   NO,   NO,   NO,   NO,
                NO,   NO,   NO,   NO,   NO,   NO,   NO,
                            NO,   NO,   NO,   NO,   NO,
          NO,   NO,
          NO,
          NO,   NO,   NO
    ),

/*
    // templates to copy from

    KEYMAP( // LayerN: transparent on edges + hard-defined thumb keys,
            // all others are empty
        // left hand
        TRNS,   NO,   NO,   NO,   NO,   NO,   NO,
        TRNS,   NO,   NO,   NO,   NO,   NO, TRNS,
        TRNS,   NO,   NO,   NO,   NO,   NO,
        TRNS,   NO,   NO,   NO,   NO,   NO, TRNS,
        TRNS, TRNS, TRNS, LALT, LGUI,
                                            TRNS, TRNS,
                                                  TRNS,
                                      LCTL, LSFT, TRNS,
        // right hand
                NO,   NO,   NO,   NO,   NO,   NO, TRNS,
              TRNS,   NO,   NO,   NO,   NO,   NO, TRNS,
                      NO,   NO,   NO,   NO,   NO, TRNS,
              TRNS,   NO,   NO,   NO,   NO,   NO, TRNS,
                          RGUI, RALT, TRNS, TRNS, TRNS,
        TRNS, TRNS,
        TRNS,
        TRNS, RSFT, RCTL
    ),
    KEYMAP(  // LayerN: fully transparent
        // left hand
        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, TRNS, TRNS,
                                            TRNS, TRNS,
                                                  TRNS,
                                      TRNS, TRNS, TRNS,
        // right hand
              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, TRNS, TRNS,
        TRNS, TRNS,
        TRNS,
        TRNS, TRNS, TRNS
    ),
*/

};

/* id for user defined functions & macros */
enum function_id {
    TEENSY_KEY,
//    CUSTOM_KEY,
    LSFT_2_CAP,
    RSFT_2_CAP,
};

/*
 * Fn action definition
 */
static const uint16_t PROGMEM fn_actions[] = {
    [0] =   ACTION_LAYER_SET(0, ON_PRESS),          // FN0 = Set Layer0
    [1] =   ACTION_LAYER_TOGGLE(1),                 // FN1 = Toggle Layer1
    [2] =   ACTION_LAYER_TOGGLE(2),                 // FN2 = Toggle Layer2
    [3] =   ACTION_LAYER_MOMENTARY(3),              // FN3 = Momentary Layer3
    [4] =   ACTION_LAYER_MOMENTARY(2),              // FN4 = Momentary Layer2

    [5] =   ACTION_MODS_KEY(MOD_LSFT, KC_LBRACKET), // FN5 = shift+[ -> {
    [6] =   ACTION_MODS_KEY(MOD_LSFT, KC_RBRACKET), // FN6 = shift+] -> }
    [7] =   ACTION_MODS_KEY(MOD_LSFT, KC_SCOLON),   // FN7 = shift+; -> :
    [8] =   ACTION_MODS_KEY(MOD_LSFT, KC_EQUAL),    // FN8 = shift+= -> +
    [9] =   ACTION_MODS_KEY(MOD_LSFT, KC_MINUS),    // FN9 = shift+- -> _
    [10] =  ACTION_MODS_KEY(MOD_LSFT, KC_COMMA),    // FN10 = shift+, -> <
    [11] =  ACTION_MODS_KEY(MOD_LSFT, KC_DOT),      // FN11 = shift+. -> >
    [12] =  ACTION_MODS_KEY(MOD_LSFT, KC_4),        // FN12 = shift+4 -> $
    [13] =  ACTION_MODS_KEY(MOD_LSFT, KC_9),        // FN13 = shift+9 -> (
    [14] =  ACTION_MODS_KEY(MOD_LSFT, KC_0),        // FN14 = shift+0 -> )
    [15] =  ACTION_MODS_KEY(MOD_LSFT, KC_8),        // FN15 = shift+8 -> *

    [29] =  ACTION_FUNCTION(LSFT_2_CAP),            // FN29 = Toggle CapsLock
                                                    //      if both Shifts hit
    [30] =  ACTION_FUNCTION(RSFT_2_CAP),            // FN30 = Toggle CapsLock
                                                    //      if both Shifts hit

    [31] =  ACTION_FUNCTION(TEENSY_KEY),            // FN31 = Teensy bootloader
};

void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    // print("action_function called\n");
    // print("id  = "); phex(id); print("\n");
    // print("opt = "); phex(opt); print("\n");

    if (id == TEENSY_KEY) {
        clear_keyboard();
        print("\n\nJump to bootloader... ");
        _delay_ms(50);
        bootloader_jump(); // should not return
        print("not supported.\n");
    }

    // Toggle capslock when pressing both left and right shift keys
    //
    if (id == LSFT_2_CAP || id == RSFT_2_CAP) {
        uint8_t curr_weak_mods = 0;

        // Set weak_mods value for each shift key
        //
        if (id == LSFT_2_CAP) {
            dprintf("->left shift: %u\n", id);
            curr_weak_mods = MOD_BIT(KC_LSHIFT);
        } else {
            dprintf("->right shift: %u\n", id);
            curr_weak_mods = MOD_BIT(KC_RSHIFT);
        }

        if (record->event.pressed) {
           
            // Get the previous weak_mods value
            //
            uint8_t prev_weak_mods = get_weak_mods();
            dprintf("-->prev_weak_mods: %u\n", prev_weak_mods);

            // When a shift key is pressed, check previous weak_mods value.
            // If 0, then no shift key is held down.
            // If not 0, then at least one shift key is held down.
            //
            if (prev_weak_mods != 0) {

                // Toggle capslock if more than one shift key is pressed.
                //
                dprintf("--->press, toggle capslock\n");
                add_key(KC_CAPSLOCK);
                send_keyboard_report();
                del_key(KC_CAPSLOCK);
                send_keyboard_report();
            } else {

                // Set the appropriate weak_mods value if just one shift
                // key is pressed.
                //
                dprintf("--->press, curr_weak_mods: %u\n", curr_weak_mods);
                add_weak_mods(curr_weak_mods);
                send_keyboard_report();
            }
        } else {

            // Unset the weak_mods value when shift key is released.
            //
            dprintf("--->release, curr_weak_mods: %u\n", curr_weak_mods);
            del_weak_mods(curr_weak_mods);
            send_keyboard_report();
        }
    }

    /*
     * just an example of custom key implementation
     * not really needed with custom keymap_fn_to_action(),
     * because it will allow you to have 32 FN** keys on EACH layer
     *
    keyevent_t event = record->event;

    if (id == CUSTOM_KEY) {
        uint8_t layer = biton32(layer_state);
        uint8_t col = event.key.col;
        uint8_t row = event.key.row;
        uint8_t handled = 0;

        if (event.pressed) {
            if (layer == XXX && col == XXX && row == XXX) {
                    action_macro_play(
                        MACRO(
                            ...........
                        END)
                    );
                    handled++;
                }
            }
        }

        if (!handled) {
            print("custom key not handled");
            print(": layer "); pdec(layer);
            print(", col "); pdec(col);
            print(", row "); pdec(row);
            print("\n");
        }
    }
    */
}

/*
 * Translates Fn keycode to action.
 *
 * Allows for more than 32 Fn keycodes. This will provide up to 32 Fn
 * keycodes per layer.
 *
 * This overrides the keymap_fn_to_action() function found at the end of
 * keymap.c with an #if defined.
 *
static const uint16_t PROGMEM fn_actions_1[] = {
    [1] =   ACTION_LAYER_TOGGLE(1),                 // FN1 = Toggle Layer1
    [2] =   ACTION_LAYER_TOGGLE(2),                 // FN2 = Toggle Layer2
    [4] =   ACTION_LAYER_MOMENTARY(2),              // FN4 = Momentary Layer2

    [29] =  ACTION_FUNCTION(LSFT_2_CAP),            // FN29 = Toggle CapsLock
                                                    //      if both Shifts hit
    [30] =  ACTION_FUNCTION(RSFT_2_CAP),            // FN30 = Toggle CapsLock
                                                    //      if both Shifts hit
};

static const uint16_t PROGMEM fn_actions_2[] = {
    [2] =   ACTION_LAYER_TOGGLE(2),                 // FN2 = Toggle Layer2
    [3] =   ACTION_LAYER_MOMENTARY(3),              // FN3 = Momentary Layer3

    [5] =   ACTION_MODS_KEY(MOD_LSFT, KC_LBRACKET), // FN5 = shift+[ -> {
    [6] =   ACTION_MODS_KEY(MOD_LSFT, KC_RBRACKET), // FN6 = shift+] -> }
    [7] =   ACTION_MODS_KEY(MOD_LSFT, KC_SCOLON),   // FN7 = shift+; -> :
    [8] =   ACTION_MODS_KEY(MOD_LSFT, KC_EQUAL),    // FN8 = shift+= -> +
    [9] =   ACTION_MODS_KEY(MOD_LSFT, KC_MINUS),    // FN9 = shift+- -> _
    [10] =  ACTION_MODS_KEY(MOD_LSFT, KC_COMMA),    // FN10 = shift+, -> <
    [11] =  ACTION_MODS_KEY(MOD_LSFT, KC_DOT),      // FN11 = shift+. -> >
    [12] =  ACTION_MODS_KEY(MOD_LSFT, KC_4),        // FN12 = shift+4 -> $
    [13] =  ACTION_MODS_KEY(MOD_LSFT, KC_9),        // FN13 = shift+9 -> (
    [14] =  ACTION_MODS_KEY(MOD_LSFT, KC_0),        // FN14 = shift+0 -> )
    [15] =  ACTION_MODS_KEY(MOD_LSFT, KC_8),        // FN15 = shift+8 -> *

    [29] =  ACTION_FUNCTION(LSFT_2_CAP),            // FN29 = Toggle CapsLock
                                                    //      if both Shifts hit
    [30] =  ACTION_FUNCTION(RSFT_2_CAP),            // FN30 = Toggle CapsLock
                                                    //      if both Shifts hit
};

// Layer3: keyboard functions
// Based on Ben Blazak's dvorak-kinesis-mod layout.
static const uint16_t PROGMEM fn_actions_3[] = {
    [0] =   ACTION_LAYER_SET(0, ON_PRESS),          // FN0 = Set Layer0

    [31] =  ACTION_FUNCTION(TEENSY_KEY),            // FN31 = Teensy bootloader
};

#define FN_ACTIONS_SIZE     (sizeof(fn_actions)   / sizeof(fn_actions[0]))
#define FN_ACTIONS_1_SIZE   (sizeof(fn_actions_1) / sizeof(fn_actions_1[0]))
#define FN_ACTIONS_2_SIZE   (sizeof(fn_actions_2) / sizeof(fn_actions_2[0]))
#define FN_ACTIONS_3_SIZE   (sizeof(fn_actions_3) / sizeof(fn_actions_3[0]))

action_t keymap_fn_to_action(uint8_t keycode)
{
    uint8_t layer = biton32(layer_state);

    action_t action;
    action.code = ACTION_NO;

    if (layer == 1 && FN_INDEX(keycode) < FN_ACTIONS_1_SIZE) {
        action.code = pgm_read_word(&fn_actions_1[FN_INDEX(keycode)]);
    }

    if (layer == 2 && FN_INDEX(keycode) < FN_ACTIONS_2_SIZE) {
        action.code = pgm_read_word(&fn_actions_2[FN_INDEX(keycode)]);
    }

    if (layer == 3 && FN_INDEX(keycode) < FN_ACTIONS_3_SIZE) {
        action.code = pgm_read_word(&fn_actions_3[FN_INDEX(keycode)]);
    }

    // By default, use fn_actions from default layer 0.
    // This is needed to get mapping for same key, that was used switch
    // to some layer, to have possibility to switch layers back
    if (action.code == ACTION_NO && FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
        action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
    }

    return action;
}
*/
« Last Edit: Sat, 08 August 2015, 02:44:16 by nomaded »
Dvorak
ErgoDox fullhand (MX Clears) w/Nuclear Green Data SA || Infinity ErgoDox (Zealios 78g tactile) w/SA Retro || Atreus62 (MX Clears) w/Chocolatier || TECK 209 (MX Browns) || TouchStream ST
Kensington Slimblade Trackball || Logitech Cordless Optical Trackman || Apple Magic Trackpad
Current Dvorak-based ErgoDox layout || Current Dvorak-based TECK layout

Offline fatchoi

  • Posts: 218
  • Location: Hong Kong
Re: Announce: TMK firmware for ErgoDox
« Reply #158 on: Sat, 15 August 2015, 23:37:04 »
Just come across this thread, as the media keys in the original firmware did not work. I've made a simple Colemak/ QWERTY dual layer key map based on the source.
Next step I'll try to config the LED.  ^-^
Thanks for the great work cub  :thumb:

EDIT:
I just come across a weird situation, sometimes if I toggle my Colemak and QWERTY quickly, the toggle sometimes fail... Any thought please?
Or is it my fault of coding?

Code: [Select]
//
// jc: personalized Ergodox configuration
//

static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

    KEYMAP(  // Layer0: default Colemak layout
        // left hand
        ESC, 1   ,2   ,3   ,4   ,5   ,EQL ,
        TAB, Q   ,W   ,F   ,P   ,G   ,FN1 ,
        LSFT,A   ,R   ,S   ,T   ,D   ,
        LCTL,Z   ,X   ,C   ,V   ,B   ,LBRC,
        LALT,HOME,PGUP,PGDN,END ,
                                      LGUI,MUTE,
                                           VOLU,
                                 BSPC,DEL ,VOLD,
        // right hand
             MINS,   6,   7,   8,   9,   0, GRV,
             FN1 ,   J,   L,   U,   Y,SCLN,BSLS,
                     H,   N,   E,   I,   O,QUOT,
             RBRC,   K,   M,COMM, DOT,SLSH,RCTL,
                       LEFT,DOWN,  UP,RGHT,CAPS,
        MPLY,CALC,
        MPRV,
        MNXT,ENT , SPC
    ),

    KEYMAP(  // Layer1: QWERTY layer
        // left hand
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
        TRNS,Q   ,W   ,E   ,R   ,T   ,TRNS,
        TRNS,A   ,S   ,D   ,F   ,G   ,
        TRNS,Z   ,X   ,C   ,V   ,B   ,TRNS,
        TRNS,TRNS,TRNS,TRNS,TRNS,
                                      TRNS,TRNS,
                                           TRNS,
                                 TRNS,TRNS,TRNS,
        // right hand
             TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
             TRNS,   Y,   U,   I,   O,   P,TRNS,
                     H,   J,   K,   L,SCLN,TRNS,
             TRNS,   N,   M,TRNS,TRNS,TRNS,TRNS,
                       TRNS,TRNS,TRNS,TRNS,TRNS,
        TRNS,TRNS,
        TRNS,
        TRNS,TRNS,TRNS
    ),

    KEYMAP(  // Layer2: function key layer
        // left hand
        FN2 ,F1  ,F2  ,F3  ,F4  ,F5  ,F11 ,
        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,
                                      INS ,PSCR,
                                           PAUS,
                                 TRNS,TRNS,FN0 ,
        // right hand
              F12,  F6,  F7,  F8,  F9, F10,NLCK,
             TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
                  TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
             TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
                       TRNS,TRNS,TRNS,TRNS,SLCK,
        TRNS,TRNS,
        TRNS,
        TRNS,TRNS,TRNS
    ),

};

/* id for user defined functions */
enum function_id {
    TEENSY_KEY,
};

/*
 * Fn action definition
 */
static const uint16_t PROGMEM fn_actions[] = {
    // Teensy key
ACTION_FUNCTION(TEENSY_KEY),          // FN0  - Teensy key

    // Layers switching
    ACTION_LAYER_MOMENTARY(2),            // FN1 - temporarily switch to Layer2 keys (f keys)
    ACTION_LAYER_TOGGLE(1),               // FN2 - Toggle Layer1 switch between Colemak and QEWRTY layout

};

void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
{
    print("action_function called\n");
    print("id  = "); phex(id); print("\n");
    print("opt = "); phex(opt); print("\n");
    if (id == TEENSY_KEY) {
        clear_keyboard();
        print("\n\nJump to bootloader... ");
        _delay_ms(250);
        bootloader_jump(); // should not return
        print("not supported.\n");
    }
}

« Last Edit: Sun, 16 August 2015, 05:26:30 by fatchoi »

Offline torusJKL

  • Posts: 7
Re: Announce: TMK firmware for ErgoDox
« Reply #159 on: Wed, 30 September 2015, 00:27:37 »
I don't know if it is mandatory but what if you add the index on the left of your FN lines?
Code: [Select]
/*
 * Fn action definition
 */
static const uint16_t PROGMEM fn_actions[] = {
    // Teensy key
    [0] = ACTION_FUNCTION(TEENSY_KEY),          // FN0  - Teensy key

    // Layers switching
    [1] = ACTION_LAYER_MOMENTARY(2),            // FN1 - temporarily switch to Layer2 keys (f keys)
    [2] = ACTION_LAYER_TOGGLE(1),               // FN2 - Toggle Layer1 switch between Colemak and QEWRTY layout

};

Offline nomaded

  • Posts: 197
  • Location: Andover, MA
Re: Announce: TMK firmware for ErgoDox
« Reply #160 on: Fri, 02 October 2015, 02:01:57 »
(I deleted my post because I shouldn't be replying while tired.)
« Last Edit: Fri, 02 October 2015, 02:04:58 by nomaded »
Dvorak
ErgoDox fullhand (MX Clears) w/Nuclear Green Data SA || Infinity ErgoDox (Zealios 78g tactile) w/SA Retro || Atreus62 (MX Clears) w/Chocolatier || TECK 209 (MX Browns) || TouchStream ST
Kensington Slimblade Trackball || Logitech Cordless Optical Trackman || Apple Magic Trackpad
Current Dvorak-based ErgoDox layout || Current Dvorak-based TECK layout

Offline dorian

  • Posts: 5
Re: Announce: TMK firmware for ErgoDox
« Reply #161 on: Thu, 28 April 2016, 05:16:00 »
Can someone give me a hint on how to find out if this is compatible with the infinity ErgoDox?

Offline cub-uanic

  • Thread Starter
  • Posts: 72
  • Location: Ukraine, Kharkov
Re: Announce: TMK firmware for ErgoDox
« Reply #162 on: Thu, 28 April 2016, 05:59:48 »
Can someone give me a hint on how to find out if this is compatible with the infinity ErgoDox?
They are not compatible, Infinity uses different CPU.

ErgoDox Classic - Stock Clears
Teenesis - Kinesis Advantage powered by Teensy

Offline bogamo

  • Posts: 5
Re: Announce: TMK firmware for ErgoDox
« Reply #163 on: Thu, 07 July 2016, 07:49:06 »
Any chance of integrating the MCP23018 into the main TMK repo?  It looks like the fork is now missing a year or so of updates.

Offline MOZ

  • KING OF THE NEWBIES
  • * Maker
  • Posts: 3981
  • Location: Jo'burg
  • Busy making stuff
Re: Announce: TMK firmware for ErgoDox
« Reply #164 on: Thu, 07 July 2016, 07:59:55 »
Any chance of integrating the MCP23018 into the main TMK repo?  It looks like the fork is now missing a year or so of updates.

Why not use QMK?