Filco MiniLa + Teensy

User avatar
Soarer

18 May 2013, 21:30

Wiki page is a start, I guess! I just don't want to spend time telling you stuff you might already know, or could go and learn pretty quickly :)

Yup, the Phantom one, which seems to be fairly close to what you want already.

But this...

Code: Select all

static uint8_t read_rows(void)
{
    return (PINB&(1<<0) ? 0 : (1<<0)) |
           (PINB&(1<<1) ? 0 : (1<<1)) |
           (PINB&(1<<2) ? 0 : (1<<2)) |
           (PINB&(1<<3) ? 0 : (1<<3)) |
           (PINB&(1<<4) ? 0 : (1<<4)) |
           (PINB&(1<<5) ? 0 : (1<<5));
}
is surely the most needlessly long-winded way to get the same result as this...

Code: Select all

static uint8_t read_rows(void)
{
    return PINB & 0b00111111;
}
!!!

And in your case, since you want all 8 pins of port B, all you need is...

Code: Select all

static uint8_t read_rows(void)
{
    return PINB;
}
Initialisation is similarly simplified, since you are setting all the bits...

Code: Select all

static void init_rows(void)
{
    // Input with pull-up(DDR:0, PORT:1)
    DDRB  = 0;
    PORTB = 0xFF;
}
So that leaves the strobes, which will be a bit of a chore :(

alfa147x

18 May 2013, 23:56

Wow. Thanks for the help. I was just about to tackle that portion. How does this look?

Code: Select all

/* Column pin configuration
 * col: 0   1   2   3   4   5   6   7   8   9   10  11  12  13  14
 * pin: F7  F0  F1  D3  F4  F5  F6  F7  F0  D1  D2  F6  F0  D2  C6
 */
static void unselect_cols(void)
{
    // Hi-Z(DDR:0, PORT:0) to unselect
    DDRC  |= 0b01000000; // PC: 6
    PORTC |= 0b01000000;
    DDRD  |= 0b00001111; // PD: 3 2 1 0
    PORTD |= 0b00001111;
    DDRE  |= 0b00000000; // PE: 
    PORTE |= 0b00000000;
    DDRF  |= 0b11110011; // PF: 7 6 5 4 1 0
    PORTF |= 0b11110011;
}

Could you help me figure out what is going on in the 2nd part of this set of code? Where is starts with switch (col) ?

Code: Select all

/* Column pin configuration
 * col: 0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16
 * pin: D5  C7  C6  D4  D0  E6  F0  F1  F4  F5  F6  F7  D7  D6  D1  D2  D3
 */
static void unselect_cols(void)
{
    // Hi-Z(DDR:0, PORT:0) to unselect
    DDRC  |= 0b11000000; // PC: 7 6
    PORTC |= 0b11000000;
    DDRD  |= 0b11111111; // PD: 7 6 5 4 3 2 1 0
    PORTD |= 0b11111111;
    DDRE  |= 0b01000000; // PE: 6
    PORTE |= 0b01000000;
    DDRF  |= 0b11110011; // PF: 7 6 5 4 1 0
    PORTF |= 0b11110011;
}

static void select_col(uint8_t col)
{
    // Output low(DDR:1, PORT:0) to select
    switch (col) {
        case 0:
            DDRD  |= (1<<5);
            PORTD &= ~(1<<5);
            break;
        case 1:
            DDRC  |= (1<<7);
            PORTC &= ~(1<<7);
            break;
        case 2:
            DDRC  |= (1<<6);
            PORTC &= ~(1<<6);
            break;
        case 3:
            DDRD  |= (1<<4);
            PORTD &= ~(1<<4);
            break;
        case 4:
            DDRD  |= (1<<0);
            PORTD &= ~(1<<0);
            break;
        case 5:
            DDRE  |= (1<<6);
            PORTE &= ~(1<<6);
            break;
        case 6:
            DDRF  |= (1<<0);
            PORTF &= ~(1<<0);
            break;
        case 7:
            DDRF  |= (1<<1);
            PORTF &= ~(1<<1);
            break;
        case 8:
            DDRF  |= (1<<4);
            PORTF &= ~(1<<4);
            break;
        case 9:
            DDRF  |= (1<<5);
            PORTF &= ~(1<<5);
            break;
        case 10:
            DDRF  |= (1<<6);
            PORTF &= ~(1<<6);
            break;
        case 11:
            DDRF  |= (1<<7);
            PORTF &= ~(1<<7);
            break;
        case 12:
            DDRD  |= (1<<7);
            PORTD &= ~(1<<7);
            break;
        case 13:
            DDRD  |= (1<<6);
            PORTD &= ~(1<<6);
            break;
        case 14:
            DDRD  |= (1<<1);
            PORTD &= ~(1<<1);
            break;
        case 15:
            DDRD  |= (1<<2);
            PORTD &= ~(1<<2);
            break;
        case 16:
            DDRD  |= (1<<3);
            PORTD &= ~(1<<3);
            break;
    }
I don't understand why the shift and then the inverse is taken from the output?


Thanks again for all the help!

User avatar
Soarer

19 May 2013, 00:45

That unselect_cols looks wrong (as does the one in github). Certainly, the code doesn't match the comment!

(1<<n) is used to make a byte with a single bit set. So (1<<3) would set bit 3, giving 0b00001000.
THING |= (1<<n) sets (to 1) that bit in THING, without affecting other bits.
THING &= ~(1<<n) clears (to 0) that bit in THING, without affecting other bits (since e.g. ~(1<<3) == 0b11110111).

That's about all you need to know to adapt the select_col function - the code and comment match, and you want that pattern (i.e. to output low).

Now that unselect_cols again... I'd say you want to use 'input with pullup' to unselect, rather than the 'output high' that's in the code. So that's bits in a DDR register cleared, and corresponding bits in the corresponding PORT register set.

Code: Select all

    static void unselect_cols(void)
    {
        // Pullup (DDR:0, PORT:1) to unselect
        DDRC  &= ~0b01000000; // PC: 6
        PORTC |= 0b01000000;
        DDRD  &= ~0b00001111; // PD: 3 2 1 0
        PORTD |= 0b00001111;
        // DDRE  &= ~0b00000000; // PE:
        // PORTE |= 0b00000000;
        DDRF  &= ~0b11110011; // PF: 7 6 5 4 1 0
        PORTF |= 0b11110011;
    }
Another edit... the order of the statements in each case of the select_col switch statement should really be swapped as well. For example, from:

Code: Select all

            DDRD  |= (1<<0);
            PORTD &= ~(1<<0);
to:

Code: Select all

            PORTD &= ~(1<<0);
            DDRD  |= (1<<0);
The reason perhaps isn't obvious. Since it takes two statements to switch from the 'input with pullup' state to the 'output low' state, there's an intermediate state. It's safer to use 'input without pullup' as the intermediate state rather than 'output high'.

alfa147x

19 May 2013, 01:31

Thanks for the help. This is starting to make more sense. Now I'm laying out the keymap.c

This is what I have planned for now:

Code: Select all

       static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
        /* 0: Qwerty
         * ,-----------------------------------------------------------------.
         * |Esc|  1|  2|  3|  4|  5|  6|  7 |  8 |  9|  0|  - |  = | `  |Bac |
         * |-----------------------------------------------------------------|
         * |Tab  |  Q|  W|  E|  R|  T|  Y|  U |  I |  O |  P |  [ |  ] |  \  |
         * |-----------------------------------------------------------------|
         * |CAPS |  A |  S |  D |  F |  G |  H |  J|  K|  L| ; |  '| Enter   |
         * |-----------------------------------------------------------------|
         * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Shift | UP | DEL|
         * `-----------------------------------------------------------------'
         * | CTRL| ALT | GUI| FN1 |Space       | FN1 | ALT | LFT | DWN | RGHT|
         *       `------------------------------------------------------'
         */
        KEYMAP(ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL,GRV,BSPC, \
               TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS, \
               CAPS, A,   S,   D,   F,   G,   H,   J,   K,   L, SCLN, QUOT,ENT, \
               LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM, DOT, SLSH, RSFT, UP, DEL \
                    LCTL, LALT, LGUI, FN0,          SPC,                FN1, RGUI, RALT, LEFT, DOWN, RGHT),
       
        /* 1: 2nd Layer
         * ,-----------------------------------------------------------------.
         * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|   |  Backs  |
         * |-----------------------------------------------------------------|
         * |Sleep | Wake  |   |   |   |   |   |   |Psk |Slk|Pus|   |    |    |
         * |-------------------------------------------_---------------------|
         * |         |    |   |    |   |  *|  /|Ins|PgU|HME|Bac|    |  ENTER |
         * |---------------------------_-------------------------------------|
         * |Shift   |    |   |   |   |  + |  - |DEL |END |PgD|   |   |   |   |
         * `-----------------------------------------------------------------'
         * | CTRL| ALT | GUI| FN1 |Space       | FN1 | ALT | LFT | DWN | RGHT|
         *       `------------------------------------------------------'
         */
        KEYMAP(PWR, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, TRNS, BSPC, \
               SLEP, WAKE,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS, TRNS, TRNS, \
               TRNS,TRNS,TRNS,TRNS,TRNS,PAST,PSLS,INT,PGUP,HOME,BSPC, TRNS, ENT, \
               LSFT,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END,DELETE,PGDN,TRNS,TRNS,TRNS,TRNS, \
               LCTL, LALT, LGUI, FN0,          SPC,                FN1, RGUI, RALT, LEFT, DOWN, RGHT),
      
        /* 2: 3rd Layer
         * ,-----------------------------------------------------------------.
         * |   |   |   |   |   |   |   |   |   |   |  |  |  |     |          |
         * |-----------------------------------------------------------------|
         * |    |     |   |   |    |    |   |   |    |    |   |   |    |     |
         * |-----------------------------------------------------------------|
         * |         |    |   |    |   |   |   |   |   |   |   |    |        |
         * |-----------------------------------------------------------------|
         * |     |    |   |   |   |   |   |   |MPRV|MNXT|MSTP|MPLY| VoU  |   |
         * `-----------------------------------------------------------------'
         * | CTRL| ALT | GUI| FN1 |Space        | FN1 | ALT |     | VOD | MUT|
         *       `------------------------------------------------------'
         */
        KEYMAP(TRNS, TRNS,  TRNS,  TRNS,  TRNS,  TRNS,  TRNS,  TRNS,  TRNS,  TRNS,  TRNS, TRNS, TRNS, TRNS, TRNS, \
               TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS, TRNS, TRNS, \
               TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, VOLU, TRNS, \
               TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MPRV,MNXT,MSTP,MPLY,VOLU,TRNS, \
            LCTL, LALT, LGUI, FN0,          SPC,                FN1, RGUI, RALT, TRNS, VOLD, MUT),


User avatar
Soarer

19 May 2013, 02:04

Looks good!

But... I think this part needs adapting to the Minila first... looks tedious :(

Code: Select all

// Convert physical keyboard layout to matrix array.
// This is a macro to define keymap easily in keyboard layout form.
// Use this for 7bit layout.
#define KEYMAP( \
K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, \
K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2P, K2Q, K2R, \
K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, \
K0A, K0B, K0C, K0D, K0F, K0G, K0H, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
) { \
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ \
/* 0 */ { KC_##K0A, KC_##K0B, KC_##K0C, KC_##K5B, KC_##K0D, KC_##K0F, KC_##K5G, KC_##K0G, KC_##K0H, KC_NO, KC_##K0K, KC_##K0L, KC_##K0M, KC_##K0N, KC_##K0P, KC_##K0Q, KC_##K0R}, \
/* 1 */ { KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F, KC_##K1G, KC_##K1H, KC_##K1I, KC_##K1J, KC_##K1K, KC_##K1L, KC_##K1M, KC_##K1N, KC_##K1P, KC_##K1Q, KC_##K1R}, \
/* 2 */ { KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F, KC_##K2G, KC_##K2H, KC_##K2I, KC_##K2J, KC_##K2K, KC_##K2L, KC_##K2M, KC_##K2N, KC_##K2P, KC_##K2Q, KC_##K2R}, \
/* 3 */ { KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F, KC_##K3G, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K3L, KC_##K3M, KC_##K3N, KC_##K3P, KC_##K3Q, KC_##K3R}, \
/* 4 */ { KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F, KC_##K4G, KC_##K4H, KC_##K4I, KC_##K4J, KC_##K4K, KC_##K4L, KC_##K4M, KC_##K4N, KC_##K4O, KC_##K4P, KC_##K4Q, KC_##K4R}, \
/* 5 */ { KC_##K5A, KC_##K4A, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F, KC_##K5H, KC_##K5I, KC_##K5J, KC_##K5K, KC_##K5L, KC_##K5M, KC_##K5N, KC_##K5O, KC_##K5P, KC_##K5Q, KC_##K5R} \
}

alfa147x

19 May 2013, 02:15

Yeah I was just looking at that. About to tackle it now. Wish me luck :D

Edit:
Is there a list of those codes?

Edit found it:
https://github.com/tmk/tmk_keyboard/blo ... /keymap.md

Edit:
Hmmm That doesn't match up to what keymap.c has in it. :?

Any ideas?

User avatar
Soarer

19 May 2013, 03:22

Hmm... so, it's a mapping from the physical layout (as in, 6 rows of up to 18 keys each) to the matrix (6 rows and 17 columns). The macro parameters have names that indicate a key position, so leave most of it as is, but trim it to minila size (Remove K5... row, and trim other rows down to the correct number of keys).

You'll need to change the defines of MATRIX_ROWS and MATRIX_COLS to 8 and 11, if you haven't already.

edit: From here on, I'd flipped to looking at the HHKB version of keymap.c... it might be easiest to copy parts of that rather than edit the Phantom one, since it uses 8 rows in the matrix already.

The second part also needs to be trimmed down - just delete lines from 'L' to 'R', so you have 11 lines left in that section.

Then your matrix map comes in useful again... for each position on the matrix, see what the key is, and put it's physical position code into the matrix array there (replace just the part after KC_##). For positions that aren't used, I think you'd put KC_NO (replacing the whole entry).

alfa147x

19 May 2013, 09:08

Thank Soarer I've read your reply but got caught up doing other stuff. I'm going tackle the project again tomorrow.

alfa147x

20 May 2013, 04:54

Code: Select all

/*
 * Layout: 68key
 * ,-----------------------------------------------------------.
 * |Esc|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =| ` | BS|
 * |-----------------------------------------------------------|
 * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \  |
 * |-----------------------------------------------------------|
 * |CPSLck|  A|  S|  D|  F|  G|  H|  J|  K|  L| : |  '|Return  |
 * |-----------------------------------------------------------|
 * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .| ? |Sft|Up|Del|
 * |-----------------------------------------------------------|
 * |Ctrl|LGUI|Alt|FN1|     Space     |FN2|Alt|RGUI|lft|dwn|rght|
 * `-----------------------------------------------------------'
 *
 * Matrix: 11x8
 *    |       0 |       1 |       2 |       3 |       4 |       5 |       6 |       7|       8|       9|       A|
 * ---+---------+---------+---------+---------+---------+---------+---------+--------+--------+--------+---------+
 *  0 |     Q   |     W   |    E    |    R    |   U     |     I   |    O    |    P   |  R-FN  |   LGUI |         |
 *  1 |   Tab   |  CPSLck |         |    T    |   Y     |     }   |   lft   |    {   |        |  BSPC  |         |
 *  2 |     A   |    S    |    D    |    F    |   J     |     K   |    L    |    ;   |  L-FN  |    \   |  UP     |
 *  3 |    Esc  |         |         |    G    |   H     |   Spce  |         |    "   | L-ALT  |        |         |  
 *  4 |     Z   |    X    |    C    |    V    |   M     |     <   |     >   |        |        |  RTRN  |         |   
 *  5 |  rght   |         |         |    B    |   N     |    dwn  |   RSft  |   ?    | R-ALT  |  RGUI  |  Left   |
 *  6 |     ~   |         |         |    5    |   6     |     +   |   LCtrl |   -    |        |   DEL  |         |
 *  7 |     1   |    2    |    3    |    4    |   7     |     8   |    9    |   0    |        |        |         |
 */
#define KEYMAP( \
    K30, K70, K71, K72, K73, K63, K64, K74, K75, K76, K77, K67, K65, K19, \
    K10, K00, K01, K02, K03, K13, K14, K04, K05, K07, K17, K15, K29, \
    K11, K20, K21, K22, K23, K33, K34, K24, K25, K26, K27, K37, K49, \
    K56, K40, K41, K42, K43, K53, K54, K44, K45, K46, K57, K56, K2A, K69, \
    K66, K09, K38, K28,       K35,      K08, K58, K59, K16, K55, K50 \
) { \
    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_NO   }, \
    { KC_##K10, KC_##K11, KC_NO   , KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_NO   , KC_##K19, KC_NO   }, \
    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_NO   , KC_##K29, KC_##K2A}, \
    { KC_##K30, KC_NO   , KC_NO   , KC_##K33, KC_##K34, KC_##K35, KC_NO   , KC_##K37, KC_##K38, KC_NO   , KC_NO   }, \
    { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO   , KC_NO   , KC_##K49, KC_NO   }, \
    { KC_##K50, KC_NO   , KC_NO   , KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57, KC_##58, KC_##K59, KC_##K5A}, \
    { KC_##K60, KC_NO   , KC_NO   , KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67, KC_NO   , KC_##K69, KC_NO   }, \
    { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77, KC_NO   , KC_NO   , KC_NO   }, \
}

Okay finished that... Could you take a look how I used the "A" column? I can't tell if I used it correctly.

Thanks!

You can download that file here:
http://cl.ly/code/0M2M0h3B0031

User avatar
Soarer

20 May 2013, 20:57

Oh, I see, you've done it that way round :D

If left is K5A, shouldn't "K59, K16, K55" be "K59, K5A, K55" ?

You look about close enough now to compile it and then fix bugs as you find them!

alfa147x

20 May 2013, 22:18

Soarer wrote:Oh, I see, you've done it that way round :D

If left is K5A, shouldn't "K59, K16, K55" be "K59, K5A, K55" ?

You look about close enough now to compile it and then fix bugs as you find them!
What was the alternative route? And wow thanks for finding that! I was watching The Office's finale while working on it...

I still need to finish working on keymap.c since I haven't touched anything besides the stuff ^

I tried to compile it and it was not happy:

Code: Select all

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


mkdir -p obj_minila_pjrc
Compiling C: keymap.c
avr-gcc -c -mmcu=atmega32u4        -gdwarf-2 -DF_CPU=16000000UL -DPROTOCOL_PJRC -DBOOTMAGIC_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_minila_pjrc/keymap.lst -I. -I../.. -I../../protocol/pjrc -I../../common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_minila_pjrc_keymap.o.d  keymap.c -o obj_minila_pjrc/keymap.o 
In file included from ../../common/print.h:31:0,
                 from keymap.c:25:
../../common/xprintf.h:26:1: error: unknown type name 'prog_char'
../../common/xprintf.h:54:1: error: unknown type name 'prog_char'
../../common/xprintf.h:55:1: error: unknown type name 'prog_char'
../../common/xprintf.h:56:1: error: unknown type name 'prog_char'
keymap.c:61:60: error: duplicate macro parameter "K56"
keymap.c:116:5: warning: implicit declaration of function 'KEYMAP' [-Wimplicit-function-declaration]
keymap.c:116:12: error: 'ESC' undeclared here (not in a function)
keymap.c:116:67: error: 'MINS' undeclared here (not in a function)
keymap.c:116:72: error: 'EQL' undeclared here (not in a function)
keymap.c:116:77: error: 'BSLS' undeclared here (not in a function)
keymap.c:116:82: error: 'GRV' undeclared here (not in a function)
keymap.c:117:12: error: 'TAB' undeclared here (not in a function)
keymap.c:117:17: error: 'Q' undeclared here (not in a function)
keymap.c:117:22: error: 'W' undeclared here (not in a function)
keymap.c:117:27: error: 'E' undeclared here (not in a function)
keymap.c:117:32: error: 'R' undeclared here (not in a function)
keymap.c:117:37: error: 'T' undeclared here (not in a function)
keymap.c:117:42: error: 'Y' undeclared here (not in a function)
keymap.c:117:47: error: 'U' undeclared here (not in a function)
keymap.c:117:52: error: 'I' undeclared here (not in a function)
keymap.c:117:57: error: 'O' undeclared here (not in a function)
keymap.c:117:62: error: 'P' undeclared here (not in a function)
keymap.c:117:67: error: 'LBRC' undeclared here (not in a function)
keymap.c:117:72: error: 'RBRC' undeclared here (not in a function)
keymap.c:117:77: error: 'BSPC' undeclared here (not in a function)
keymap.c:118:12: error: 'LCTL' undeclared here (not in a function)
keymap.c:118:17: error: 'A' undeclared here (not in a function)
keymap.c:118:22: error: 'S' undeclared here (not in a function)
keymap.c:118:27: error: 'D' undeclared here (not in a function)
keymap.c:118:32: error: 'F' undeclared here (not in a function)
keymap.c:118:37: error: 'G' undeclared here (not in a function)
keymap.c:118:42: error: 'H' undeclared here (not in a function)
keymap.c:118:47: error: 'J' undeclared here (not in a function)
keymap.c:118:52: error: 'K' undeclared here (not in a function)
keymap.c:118:57: error: 'L' undeclared here (not in a function)
keymap.c:118:62: error: 'FN3' undeclared here (not in a function)
keymap.c:118:67: error: 'QUOT' undeclared here (not in a function)
keymap.c:118:72: error: 'ENT' undeclared here (not in a function)
keymap.c:119:12: error: 'LSFT' undeclared here (not in a function)
keymap.c:119:17: error: 'Z' undeclared here (not in a function)
keymap.c:119:22: error: 'X' undeclared here (not in a function)
keymap.c:119:27: error: 'C' undeclared here (not in a function)
keymap.c:119:32: error: 'V' undeclared here (not in a function)
keymap.c:119:37: error: 'B' undeclared here (not in a function)
keymap.c:119:42: error: 'N' undeclared here (not in a function)
keymap.c:119:47: error: 'M' undeclared here (not in a function)
keymap.c:119:52: error: 'COMM' undeclared here (not in a function)
keymap.c:119:57: error: 'DOT' undeclared here (not in a function)
keymap.c:119:62: error: 'FN2' undeclared here (not in a function)
keymap.c:119:67: error: 'FN1' undeclared here (not in a function)
keymap.c:120:12: error: 'LGUI' undeclared here (not in a function)
keymap.c:120:22: error: 'LALT' undeclared here (not in a function)
keymap.c:120:37: error: 'FN4' undeclared here (not in a function)
keymap.c:120:52: error: 'RALT' undeclared here (not in a function)
keymap.c:136:17: error: 'F1' undeclared here (not in a function)
keymap.c:136:22: error: 'F2' undeclared here (not in a function)
keymap.c:136:27: error: 'F3' undeclared here (not in a function)
keymap.c:136:32: error: 'F4' undeclared here (not in a function)
keymap.c:136:37: error: 'F5' undeclared here (not in a function)
keymap.c:136:42: error: 'F6' undeclared here (not in a function)
keymap.c:136:47: error: 'F7' undeclared here (not in a function)
keymap.c:136:52: error: 'F8' undeclared here (not in a function)
keymap.c:136:57: error: 'F9' undeclared here (not in a function)
keymap.c:136:62: error: 'F10' undeclared here (not in a function)
keymap.c:136:67: error: 'F11' undeclared here (not in a function)
keymap.c:136:72: error: 'F12' undeclared here (not in a function)
keymap.c:136:77: error: 'INS' undeclared here (not in a function)
keymap.c:136:82: error: 'DEL' undeclared here (not in a function)
keymap.c:137:12: error: 'CAPS' undeclared here (not in a function)
keymap.c:137:17: error: 'NO' undeclared here (not in a function)
keymap.c:137:52: error: 'PSCR' undeclared here (not in a function)
keymap.c:137:57: error: 'SLCK' undeclared here (not in a function)
keymap.c:137:62: error: 'BRK' undeclared here (not in a function)
keymap.c:137:67: error: 'UP' undeclared here (not in a function)
keymap.c:138:17: error: 'VOLD' undeclared here (not in a function)
keymap.c:138:22: error: 'VOLU' undeclared here (not in a function)
keymap.c:138:27: error: 'MUTE' undeclared here (not in a function)
keymap.c:138:42: error: 'PAST' undeclared here (not in a function)
keymap.c:138:47: error: 'PSLS' undeclared here (not in a function)
keymap.c:138:52: error: 'HOME' undeclared here (not in a function)
keymap.c:138:57: error: 'PGUP' undeclared here (not in a function)
keymap.c:138:62: error: 'LEFT' undeclared here (not in a function)
keymap.c:138:67: error: 'RGHT' undeclared here (not in a function)
keymap.c:139:42: error: 'PPLS' undeclared here (not in a function)
keymap.c:139:47: error: 'PMNS' undeclared here (not in a function)
keymap.c:139:57: error: 'PGDN' undeclared here (not in a function)
keymap.c:139:62: error: 'DOWN' undeclared here (not in a function)
keymap.c:140:37: error: 'SPC' undeclared here (not in a function)
keymap.c:159:67: error: 'RSFT' undeclared here (not in a function)
keymap.c:179:17: error: 'WH_L' undeclared here (not in a function)
keymap.c:179:22: error: 'WH_D' undeclared here (not in a function)
keymap.c:179:27: error: 'MS_U' undeclared here (not in a function)
keymap.c:179:32: error: 'WH_U' undeclared here (not in a function)
keymap.c:179:37: error: 'WH_R' undeclared here (not in a function)
keymap.c:180:22: error: 'MS_L' undeclared here (not in a function)
keymap.c:180:27: error: 'MS_D' undeclared here (not in a function)
keymap.c:180:32: error: 'MS_R' undeclared here (not in a function)
keymap.c:181:27: error: 'BTN1' undeclared here (not in a function)
keymap.c:181:32: error: 'BTN2' undeclared here (not in a function)
keymap.c:181:37: error: 'BTN3' undeclared here (not in a function)
keymap.c:200:17: error: 'SCLN' undeclared here (not in a function)
keymap.c:200:67: error: 'RCTL' undeclared here (not in a function)
keymap.c:201:17: error: 'SLSH' undeclared here (not in a function)
make: *** [obj_minila_pjrc/keymap.o] Error 1
I'm going to finish up the keymap file and then try to figure where things went wrong.

Thanks again!

User avatar
Soarer

20 May 2013, 23:31

Oh, just that it's 50:50 whether you use matrix poitions as the names, as you have, or physical positions as names, as the Phantom code did :D

Lots of compile errors, but hopefully only two things to fix: prog_char, and K56. For K56, you forgot to use a different code for each shift ;) I've no idea about prog_char... maybe a makefile option or similar - have you set the CPU etc? (I think that's covered somewhere in hasu's docs).

yeeeargh

21 May 2013, 00:35

concerning the prog_char it looks like it's already a known error: https://github.com/tmk/tmk_keyboard/issues/34

alfa147x

21 May 2013, 03:13

yeeeargh wrote:concerning the prog_char it looks like it's already a known error: https://github.com/tmk/tmk_keyboard/issues/34
Sweet. Downgraded and it's no longer giving me that issue.
Soarer wrote:Oh, just that it's 50:50 whether you use matrix poitions as the names, as you have, or physical positions as names, as the Phantom code did :D

Lots of compile errors, but hopefully only two things to fix: prog_char, and K56. For K56, you forgot to use a different code for each shift ;) I've no idea about prog_char... maybe a makefile option or similar - have you set the CPU etc? (I think that's covered somewhere in hasu's docs).
Thanks. I fixed the shift key issue.

Code: Select all

keymap.c:132: error: 'KC_K06' undeclared here (not in a function)
keymap.c:132: error: 'KC_58' undeclared here (not in a function)
keymap.c:132: error: 'KC_K60' undeclared here (not in a function)
keymap.c:152:70: error: macro "KEYMAP" passed 67 arguments, but takes just 65
keymap.c:148: error: 'KEYMAP' undeclared here (not in a function)
make: *** [obj_minila_pjrc/keymap.o] Error 1
So the the first 3 errors on line 132 are referring to a line that only contains comments. Any ideas?

Also if those errors are fixed it should clear up the rest.

http://cl.ly/code/2F3W2b2c3030

Thanks guys!

Edit just compiled it again and got this:

Code: Select all

keymap.c:121: error: 'KC_K06' undeclared here (not in a function)
keymap.c:121: error: 'KC_58' undeclared here (not in a function)
keymap.c:121: error: 'KC_K60' undeclared here (not in a function)
keymap.c:141:70: error: macro "KEYMAP" passed 67 arguments, but takes just 65
keymap.c:137: error: 'KEYMAP' undeclared here (not in a function)
make: *** [obj_minila_pjrc/keymap.o] Error 1

yeeeargh

21 May 2013, 12:13

alfa147x wrote:
yeeeargh wrote:concerning the prog_char it looks like it's already a known error: https://github.com/tmk/tmk_keyboard/issues/34
Sweet. Downgraded and it's no longer giving me that issue.
tmk already released a possible fix (an hour after you posted?). if you have the time you could check if the problem is solved and give him feedback.
https://github.com/tmk/tmk_keyboard/issues/34
https://github.com/tmk/tmk_keyboard/com ... 40eeac2d13

edit: took a quick look at you keymap.c and it looks like you are useing the old keymap format. (guess you used the keymap file from hbkb?) i think you should consider using the new one. most of the other projects are using it too (hid_liber, gh60, phantom, hhkb). if you really want to use the legacy layout you have to define a macro in your config.h. the documentation for the legacy keymap can be found here https://github.com/tmk/tmk_keyboard/blo ... acy-keymap.
also in line 69 it looks like you have a typing error, which might be at least one of your errors. also your ` and O key are missing. and some other possible errors. hope i found all errors in the KEYMAP. haven't looked into the rest of your keymap file. here's the KEYMAP with my corrections.

Code: Select all

#define KEYMAP( \
    K30, K70, K71, K72, K73, K63, K64, K74, K75, K76, K77, K67, K65, K60, K19, \
    K10, K00, K01, K02, K03, K13, K14, K04, K05, K06, K07, K17, K15, K29, \
    K11, K20, K21, K22, K23, K33, K34, K24, K25, K26, K27, K37, K49, \
    K16, K40, K41, K42, K43, K53, K54, K44, K45, K46, K57, K56, K2A, K69, \
    K66, K09, K38, K28,      K35,      K08, K58, K59, K5A, K55, K50 \
) { \
    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_NO   }, \
    { KC_##K10, KC_##K11, KC_NO   , KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_NO   , KC_##K19, KC_NO   }, \
    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A}, \
    { KC_##K30, KC_NO   , KC_NO   , KC_##K33, KC_##K34, KC_##K35, KC_NO   , KC_##K37, KC_##K38, KC_NO   , KC_NO   }, \
    { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO   , KC_NO   , KC_##K49, KC_NO   }, \
    { KC_##K50, KC_NO   , KC_NO   , KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57, KC_##K58, KC_##K59, KC_##K5A}, \
    { KC_##K60, KC_NO   , KC_NO   , KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67, KC_NO   , KC_##K69, KC_NO   }, \
    { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77, KC_NO   , KC_NO   , KC_NO   }, \
}

alfa147x

21 May 2013, 14:32

yeeeargh wrote:
alfa147x wrote:
yeeeargh wrote:concerning the prog_char it looks like it's already a known error: https://github.com/tmk/tmk_keyboard/issues/34
Sweet. Downgraded and it's no longer giving me that issue.
tmk already released a possible fix (an hour after you posted?). if you have the time you could check if the problem is solved and give him feedback.
https://github.com/tmk/tmk_keyboard/issues/34
https://github.com/tmk/tmk_keyboard/com ... 40eeac2d13

edit: took a quick look at you keymap.c and it looks like you are useing the old keymap format. (guess you used the keymap file from hbkb?) i think you should consider using the new one. most of the other projects are using it too (hid_liber, gh60, phantom, hhkb). if you really want to use the legacy layout you have to define a macro in your config.h. the documentation for the legacy keymap can be found here https://github.com/tmk/tmk_keyboard/blo ... acy-keymap.
also in line 69 it looks like you have a typing error, which might be at least one of your errors. also your ` and O key are missing. and some other possible errors. hope i found all errors in the KEYMAP. haven't looked into the rest of your keymap file. here's the KEYMAP with my corrections.

Code: Select all

#define KEYMAP( \
    K30, K70, K71, K72, K73, K63, K64, K74, K75, K76, K77, K67, K65, K60, K19, \
    K10, K00, K01, K02, K03, K13, K14, K04, K05, K06, K07, K17, K15, K29, \
    K11, K20, K21, K22, K23, K33, K34, K24, K25, K26, K27, K37, K49, \
    K16, K40, K41, K42, K43, K53, K54, K44, K45, K46, K57, K56, K2A, K69, \
    K66, K09, K38, K28,      K35,      K08, K58, K59, K5A, K55, K50 \
) { \
    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_NO   }, \
    { KC_##K10, KC_##K11, KC_NO   , KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_NO   , KC_##K19, KC_NO   }, \
    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A}, \
    { KC_##K30, KC_NO   , KC_NO   , KC_##K33, KC_##K34, KC_##K35, KC_NO   , KC_##K37, KC_##K38, KC_NO   , KC_NO   }, \
    { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO   , KC_NO   , KC_##K49, KC_NO   }, \
    { KC_##K50, KC_NO   , KC_NO   , KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57, KC_##K58, KC_##K59, KC_##K5A}, \
    { KC_##K60, KC_NO   , KC_NO   , KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67, KC_NO   , KC_##K69, KC_NO   }, \
    { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77, KC_NO   , KC_NO   , KC_NO   }, \
}

Wow. Thanks. I didn't realize tmk was still actively working on the firmware. Also yes I did use the HBKB instead of the HHKB I guess I got them mixed up at some point. I'll convert it to the new version. No point of using the legacy layout.

I'll install the updated version of CrossPack and give a try later tonight.

Thanks again for the help!

edit:
I'm not very familiar with Git and GitHub. Can I use it to "update" the files I have or should I redownload the files and "merge" my code with the new files? I do have GitHub for Mac installed.

yeeeargh

21 May 2013, 16:24

if you want to use git they provide quite nice tutorials on how to use it.

https://help.github.com/categories/31/articles
these are some articles on how to use GitHub for Mac

basicly you want to fork tmk's repository, clone it to your computer, make a branch for your new keyboard project and when everything works as expected send a pull request for your branch to tmk so it gets merged into tmk's repo.
https://help.github.com/articles/fork-a-repo

if you don't want to do this work right now (which is completely ok, I guess you have enough trouble with your project already) you can still just download the new files from tmk and overwrite the ones on your computer. your project files wouldn't be overwritten by that (I guess you have a own folder for them like ....tmk_keyboard/keyboard/minila+teensy/ or something).
alfa147x wrote:Wow. Thanks. I didn't realize tmk was still actively working on the firmware.
he even posted in this thread. it's hasu if i'm not mistaken

alfa147x

21 May 2013, 17:06

yeeeargh wrote:if you want to use git they provide quite nice tutorials on how to use it.

https://help.github.com/categories/31/articles
these are some articles on how to use GitHub for Mac

basicly you want to fork tmk's repository, clone it to your computer, make a branch for your new keyboard project and when everything works as expected send a pull request for your branch to tmk so it gets merged into tmk's repo.
https://help.github.com/articles/fork-a-repo

if you don't want to do this work right now (which is completely ok, I guess you have enough trouble with your project already) you can still just download the new files from tmk and overwrite the ones on your computer. your project files wouldn't be overwritten by that (I guess you have a own folder for them like ....tmk_keyboard/keyboard/minila+teensy/ or something).
alfa147x wrote:Wow. Thanks. I didn't realize tmk was still actively working on the firmware.
he even posted in this thread. it's hasu if i'm not mistaken
Thanks for the quick tutorial. I'll definitely send a pull request once everything is cleaned up. Also I plan on writing up a "how to" tutorial once I get my stuff rolling. Kinda like the other stuff i've done on hacksbyalfa.com
yeeeargh wrote:
alfa147x wrote:Wow. Thanks. I didn't realize tmk was still actively working on the firmware.
he even posted in this thread. it's hasu if i'm not mistaken
Oh wow! This is by far one of the most helpful and "noob" friendly forums I have ever been to. Thank you all so much for walking me through this!

alfa147x

22 May 2013, 00:41

Updated all the code and moved over to the new version of the keymap.c layout. Oh and updated CrossPack to the latest version.

I still get this.

Code: Select all

keymap.c:95:70: error: macro "KEYMAP" requires 67 arguments, but only 65 given
keymap.c:91:5: error: 'KEYMAP' undeclared here (not in a function)
make: *** [obj_minila_pjrc/keymap.o] Error 1
I'm going to count all the layouts in the code and see if I missed something but I've double and tripple checked that already. Any ideas?


Edit: I can't count. BUT my girlfriend can! I am an idiot :oops:

Code: Select all

Creating Extended Listing: minila_pjrc.lss
avr-objdump -h -S -z minila_pjrc.elf > minila_pjrc.lss

Creating Symbol Table: minila_pjrc.sym
avr-nm -n minila_pjrc.elf > minila_pjrc.sym

Size after:
   text	   data	    bss	    dec	    hex	filename
  15418	     16	    157	  15591	   3ce7	minila_pjrc.elf

-------- end --------

About to load up the Teensy :D

alfa147x

22 May 2013, 01:11

Image

That's what happens when I plug it in. Working on that currently

User avatar
Muirium
µ

22 May 2013, 01:16

Not bad. OS X is seeing it as a US layout Apple USB keyboard. The old style pre-aluminium one by the look of it. The help button is the give away, top left of the home / end etc. block.

Option is the culprit for all those crazy symbols.

alfa147x

22 May 2013, 01:25

Muirium wrote:Not bad. OS X is seeing it as a US layout Apple USB keyboard. The old style pre-aluminium one by the look of it. The help button is the give away, top left of the home / end etc. block.

Option is the culprit for all those crazy symbols.

I kinda figured out the problems. I don't have the LEDs wired up yet so I didn't touch the led.c file. Turns out it was using a few of my rows for the LEDs. For now I've assigned all the E ports to the LED. Since I know I won't be using that for now.

Took care of the weird symbols but now nothing shows up when I plug in the USB. I'm going to verify the pin headers between the breadboard and Teensy are actually connected.

Edit:
Yup that's where we have an problem :( I guess I'll break out the soldering iron. I just don't like making this kinda commitment so early on!

Edit 2:
Going to hold off on soldering the Teensy. I ordered some hardware from Mouser to allow me to manage all the wires between keyboard and Teensy and should work with what ever final solution I end up with. I'm going to wait till the stuff comes in from Mouser and ebay before picking this project back up.

Probably what will happen is that I'll break down and grab some stuff from Radio Shack

alfa147x

22 May 2013, 22:14

Ordered a ribbon cable from Mouser which according to it's data sheet and my digital caliper is the right size except it has two extra pins. I can then use it to breadboard and then I'll be able to solder it to the perf or stripboard (Can't decide which to go with). Which also will make it a lot easier to work with. I also ordered a dip switch and a accompanying diodes.

alfa147x

28 May 2013, 16:12

Got all the parts in. Everything was coming together till I realized I didn't order a connector for the ribbon cable. So close to getting this all put together!

resonator

01 Dec 2013, 19:37

Hi everyone,
I'm working on making my own Minila t.m.k. keyboard too. In the spirit of this thread here is my repo of where I'm at. https://github.com/jonhiggs/ml62. I've documented everything I've worked out so far so hopefully it'll be a good help for anyone else trying to do the same.

I'm sure later I'll have some questions but for now I'd just like to say thanks to everyone involved. This thread has been a huge help. I'm not finished yet, but I hope I will be very soon. :)

Cheers.

User avatar
Muirium
µ

01 Dec 2013, 21:07

Looking forward to it, and welcome to the keyboard hacking club.

User avatar
matt3o
-[°_°]-

01 Dec 2013, 21:10

oh jeez, this saved me a hell lot of work on my minila air :)

resonator

02 Dec 2013, 22:31

I'm struggling to set up a build environment for the Teensy 3.0.

When using any of the Arduino packages (1.0.5, 1.5.5 or nightly) I'm getting this error:
keymap_plain.c:1: error: MCU ‘mk20dx128’ supported for assembler only
And when using the Ubuntu 'arduino' package I'm getting:
avr-gcc: error: unrecognized argument in option ‘-mmcu=mk20dx128’
Any suggestions? I'm wondering if it might be worth ordering a Teensy 2 to save the headaches.

User avatar
Muirium
µ

02 Dec 2013, 23:25

I only ever use Teensies, for what it's worth. I'm no coder, I use Soarer's controller instead. Besides, they're 14 Euros each (with an account at Floris.cc which is cheapest including postage for me here in Scotland).

User avatar
Soarer

03 Dec 2013, 13:37

resonator wrote:Any suggestions? I'm wondering if it might be worth ordering a Teensy 2 to save the headaches.
Yes, it would. The 3.0 uses a completely different CPU, so the code would need quite a lot of modification to make it work, in all the hardware-related areas (IO pins, timers, USB, etc).

Post Reply

Return to “Workshop”