geekhack Marketplace > TMK Keyboard Service

[TMK] USB-USB Converter

<< < (6/7) > >>

hasu:
I don't know about VIA much and how it works internally.

What if you build from QMK source?
USB-USB firmware requires quite a few flash memory room by default you will have to reduce some of uneeded features to enable one you need. I guess you can do this more on Makefile than VIA?

Disabling features is the first option to reduce firmware size.
But there are some useful compiler options for reducing size and also try GCC 7.3 if possible, the version would support its microcontroller AVR better.

https://p5r.uk/blog/2008/avr-gcc-optimisations.html

These options reduced firmware size more with TMK source code for reference.

--- Code: ---EXTRALDFLAGS += -Wl,--relax
EXTRALDFLAGS += -Wl,--gc-sections
EXTRALDFLAGS += -flto

EXTRACFLAGS += -flto
EXTRACFLAGS += -ffunction-sections
EXTRACFLAGS += -fdata-sections
EXTRACFLAGS += -fno-move-loop-invariants
EXTRACFLAGS += -fno-tree-scev-cprop
EXTRACFLAGS += -fno-inline-small-functions

EXTRACPPFLAGS += -flto
EXTRACPPFLAGS += -ffunction-sections
EXTRACPPFLAGS += -fdata-sections
EXTRACPPFLAGS += -fno-move-loop-invariants
EXTRACPPFLAGS += -fno-tree-scev-cprop
EXTRACPPFLAGS += -fno-inline-small-functions

--- End code ---

Hypersphere:
@hasu
@Draconian
I have been trying to get my Hasu USB-USB converter working with my HHKB Pro Hybrid Type-S. I have tried flashing the converter with my hex file both with Flip 3.4.7 and with the latest version of QMK Toolbox, but neither method yields the expected results. For example, although I have used the TMK online editor to configure the keyboard layout, and I have set the Backslash (\) key to Backspace, when I flash the converter, the key that is supposed to be Backspace is instead the Backtick (Grave) (`) key.

My main impetus for doing this is to be able to have an embedded numeric keypad in my HHKB Pro Hybrid. In addition to the normal keypad functions, I would like to be able to use Alt Codes; for example, Alt+019 for upper-case A-umlaut.

FYI, I have the DIP switches set to 2 and 3 = ON and all others = OFF (Mac mode with Del = Backspace).

Thank you for any suggestions you might have.

EDIT: I finally figured it out. It is probably not the most elegant solution, but it works. If anyone is interested, here is the short URL:

https://bit.ly/3yWi3xX

Another question: In order to go to Layer 2 for the embedded numeric keypad, I have sacrificed the Right-Alt (Right-Opt) key as the toggle. How could I use this key as the toggle and still have it available for other uses?

Thanks again.


hasu:

--- Quote from: Hypersphere on Tue, 21 March 2023, 12:57:02 ---https://bit.ly/3yWi3xX

Another question: In order to go to Layer 2 for the embedded numeric keypad, I have sacrificed the Right-Alt (Right-Opt) key as the toggle. How could I use this key as the toggle and still have it available for other uses?

--- End quote ---

In current implementation you can't assign the two functions(toggling layer for tapping and Alt for holding) to a key using keymap editor. It would be possible if you write your own custom action in your unimap(keymap) file.(I don't explain the detail here. Let me know if you are interested. See code below.)

See and try this kemap trick first, instead.
This is not a straight soltuion but it is a trick that retains Alt function somehow. With this configuration you need to press **both Alt keys** to toggle the Layer 2, but the two keys can be still used as Alt.
On Layer 0 both Alt keys have ACTION_LAYER_MODS() that enables Layer 3 momentarily and registers 'Alt' on computer at same time during holding. See Layer 3, the Alt keys are assigned 'Toggle Layer 2' action there. In the result, when you press one of Alt keys the other can toggle the Layer 2.
https://github.com/tmk/tmk_keyboard/wiki/Keymap#35-momentary-switching-with-modifiers

https://bit.ly/405mouQ



EDIT: This is example code of the custom action(in unimap.c).

--- Code: ---#include "unimap_trans.h"
#include "action_layer.h"


enum function_id {
    ALT_TOGGLE,
};

#define AC_FN0      ACTION_LAYER_MOMENTARY(1)
#define AC_ATGL     ACTION_FUNCTION_TAP(ALT_TOGGLE)


#ifdef KEYMAP_SECTION_ENABLE
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
#else
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
#endif
    UNIMAP(
              F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
    ESC,      F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,         VOLD,VOLU,MUTE,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, JYEN,BSPC,     INS, HOME,PGUP,    NLCK,PSLS,PAST,PMNS,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,     BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PPLS,
    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     NUHS,ENT,                         P4,  P5,  P6,  PCMM,
    LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RO,  RSFT,          UP,           P1,  P2,  P3,  PENT,
    LCTL,LGUI,LALT,MHEN,          SPC,           HENK,KANA,ATGL,RGUI,FN0, RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PEQL
    ),
    UNIMAP(
              TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
    GRV,      TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,TRNS,BTLD,         TRNS,TRNS,TRNS,
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL,      TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP,  INS,      TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,TRNS,TRNS,HOME,PGUP,LEFT,RGHT,     TRNS,TRNS,                        TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,END, PGDN,DOWN,     TRNS,TRNS,          PGUP,         TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,          TRNS,          TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     HOME,PGDN,END,     TRNS,     TRNS,TRNS
    ),
    UNIMAP(
              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,P7,  P8,  P9,  P0,  PMNS,PEQL,TRNS,TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,P4,  P5,  P6,  PENT,TRNS,NLCK,     TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,P1,  P2,  P3,  PPLS,PAST,     TRNS,PENT,                        TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,P0,  PCMM,PDOT,PSLS,     TRNS,TRNS,          TRNS,         TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,          TRNS,          TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,TRNS,TRNS,    TRNS,     TRNS,TRNS
    ),
};


void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case ALT_TOGGLE:
            if (record->event.pressed) {
                if (record->tap.count > 0 && !record->tap.interrupted) {
                } else {
                    register_mods(MOD_BIT(KC_RALT));
                }
            } else {
                if (record->tap.count > 0 && !(record->tap.interrupted)) {
                    layer_invert(2);
                } else {
                    unregister_mods(MOD_BIT(KC_RALT));
                }
            }
    }
}

--- End code ---

Hypersphere:
@hasu
Many thanks for your quick and helpful reply!

Another question: Should the short URL to my tmk editor page be persistent? I noticed when I tried the previous one this morning, I got an error saying that the URL could not be found. Now I have a new one after making some modifications to my keymap:

https://bit.ly/3LLqkfN

For the time being, I think that I will keep my keymap in which I "sacrifice" the Right-Alt as the toggle for Layer2. I have also sacrificed the Right-Gui as the Numlock (but perhaps a Numlock key is not necessary). If I later find that I need to preserve the Right-Alt key, I will try your kind suggestion.

Thank you again for creating the Hasu USB-USB converter and for your incredible willingness to help others to use it.

hasu:
I believe that bit.ly link is persistent once it is created successfully. Though, I've used bit.ly free plan(since google stopped their goo.gl serivce).  It is very limited, we can create only 10 links per month according to this page :-X https://bitly.com/pages/pricing

If 'URL Shortner' button fails due to the limit you have to use the very long 'Raw URL' instead.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version