XT/AT/PS2/Terminal to USB Converter with NKRO

User avatar
Soarer

01 Feb 2013, 14:32

The way to find out what code you'll need to remap is to use hid_listen (see the Troubleshooting page in the docs for details) and press the key. The code you want will be prefixed by a '+'. Then you can find that in the Codes list, and add a remap for it in your config file. In this case, I think you want this in your remapblock...

Code: Select all

    EXTRA_BACKSLASH BACKSLASH

Hubbert

04 Feb 2013, 13:44

(thanks for the reply on GH about instantaneous KVM switch idea)

In my quest for an "arrowkeyless but numpad on the left" layout, I notice that the CM Storm QuickFire TK would give me all but the extra numpad on the left. But it advertises NKRO over USB 2.0 full speed ("Windows Only") 1000 Hz sampling rate. I would not use the built-in Fn key. It does have the ability to switch down to 6KRO for compatibility.

Does anyone know if their method of doing NKRO over USB is compatible with the converter?
Would this work under Linux if I run it through a Converter?

A PDF spec sheet and user guide are available.
http://www.cmstorm.com/en/products/keyb ... ickfiretk/

EDIT: About that 1000 Hz sampling rate: you wrote earlier about the delay of 13 ms or so on some controllers, IRRC? I'm going to ask them, but does anyone here have any data on Unicomp's sampling rates / latencies?

User avatar
Soarer

04 Feb 2013, 17:52

Not sure what you mean... QuickFire TK is a USB-only keyboard, so this converter can't convert it.

I don't know exactly how they do their NKRO. So although with USB 2.0 full speed it could be a good implementation, it seems unlikely since they felt the need to state that only the 6KRO mode will work on Macs. It should work on Linux fine anyway; it's usually only the Mac which has issues.

I've written various things about delays, and the breakdown of the total delay into the four components (scan, debounce, buffer, transmit). It was namenlos who actually measured some... he found total delays of more like 30 to 50 ms. I can't recall where 13ms came in, although it was perhaps an ideal, hypothetical scenario with 1ms scan, 10ms debounce, 1ms buffer and 1ms transmit. In existing keyboards, the debounce appears to take much longer than required, although the latest 1000Hz keyboards might have improved.

Hubbert

05 Feb 2013, 02:54

Soarer wrote:Not sure what you mean... QuickFire TK is a USB-only keyboard, so this converter can't convert it.
I was intending to put it through a USB->PS/2 converter first. My other USB keyboards are Scorpius and WASD...I have some extenuating circumstances which have slowed/prevented actual physical experimentation while still allowing me time to think and ask questions...but we discussed this in another thread:
http://deskthority.net/workshop-f7/is-r ... t2841.html

(My purpose in using the converter is strictly to get remapping and extra keys.)
Soarer wrote:
Hubbert wrote:Forgive me for being dense, but does this mean that the Soarer Converter will not work when connected to a typical USB keyboard connected through a simple USB to PS/2 adapter?
http://www.cyberguys.com/product-detail ... uctid=4202
My converter works just fine like that (as long as the keyboard supports PS/2). :D

This project's slow progress is mostly explained by its limited applicability. On the one hand most simple 6KRO USB keyboards also work fine over PS/2, so a PS/2 converter can be used instead. On the other, supporting fancier USB keyboards which have >6KRO (or even media keys etc) requires a lot of work. So this just fills a small niche, for now.
But now I see that Scorpius and WASD include an adapter, and WASD is very clear that USB is limited to 6KRO, and CM TK advertises >6KRO and says nothing about PS/2. I guess I had my suspicions for good reason. Thanks for saving me $200.
I don't know exactly how they do their NKRO. So although with USB 2.0 full speed it could be a good implementation, it seems unlikely since they felt the need to state that only the 6KRO mode will work on Macs. It should work on Linux fine anyway; it's usually only the Mac which has issues.
Thanks.
I've written various things about delays, and the breakdown of the total delay into the four components (scan, debounce, buffer, transmit). It was namenlos who actually measured some... he found total delays of more like 30 to 50 ms. I can't recall where 13ms came in, although it was perhaps an ideal, hypothetical scenario with 1ms scan, 10ms debounce, 1ms buffer and 1ms transmit. In existing keyboards, the debounce appears to take much longer than required, although the latest 1000Hz keyboards might have improved.
Sadly, namenlos' posting seems to have disappeared from GeekHack when it got, well, hacked. That's actually kind of disappointing, since 30 ms is only 400 wpm assuming 5 characters per word, which is less than 2x the TypeRacer record...which is an Internet site so that adds tons of latency too. Good thing I'm not a 250 wpm typist, I guess :)

User avatar
Soarer

05 Feb 2013, 03:40

Hubbert wrote:Thanks for saving me $200.
You're welcome! There's nothing technical that prevents someone making a keyboard that supports both >6KRO USB and PS/2, but there's just not much commercial reason to. Even with standard 6KRO USB, the only reason PS/2 is still supported on many of them, is simply because they are still using pretty old chips!
Hubbert wrote:Sadly, namenlos' posting seems to have disappeared from GeekHack when it got, well, hacked. That's actually kind of disappointing, since 30 ms is only 400 wpm assuming 5 characters per word, which is less than 2x the TypeRacer record...which is an Internet site so that adds tons of latency too. Good thing I'm not a 250 wpm typist, I guess :)
Latency isn't directly related to bandwidth, since at least some of the time can overlap with other events. But even so, things must be getting pretty tight for those very fast typists... and I guess they're very fussy about their keyboards, too!

Hubbert

05 Feb 2013, 14:51

Soarer wrote: Latency isn't directly related to bandwidth, since at least some of the time can overlap with other events. But even so, things must be getting pretty tight for those very fast typists... and I guess they're very fussy about their keyboards, too!
Strangely, Sean Wrona admits to not being able to afford premium keyboards, and that his mother accidentally destroyed the Das that he won.

So we should probably encourage our children more strongly in other pursuits. That said, an economics professor told me that NFL Hall of Fame member Troy Aikman, who also turned down a contract with the New York Mets, won his state typing championship in high school (Oklahoma 1984, I believe), and publicly honored his typing teacher in later years.

Lost4468

16 Feb 2013, 17:49

Can I do this with an IBM Model M 1394308 made in 1989? Will all the buttons be reprogrammable? Do I just need a teensy++ 2.0 to do it? Thanks.

User avatar
Soarer

16 Feb 2013, 18:30

Lost4468 wrote:Can I do this with an IBM Model M 1394308 made in 1989? Will all the buttons be reprogrammable? Do I just need a teensy++ 2.0 to do it? Thanks.
Yes, yes, and either a Teensy++ 2.0 or the cheaper Teensy 2.0. You'll almost certainly be fine with the Teensy 2.0; I don't think anyone has actually needed the extra memory on the ++ yet!

(There are a number of alternatives to the Teensy 2.0, but it's one the best for size, price, and the easy-to-use loader).

Lost4468

16 Feb 2013, 19:11

Soarer wrote:
Lost4468 wrote:Can I do this with an IBM Model M 1394308 made in 1989? Will all the buttons be reprogrammable? Do I just need a teensy++ 2.0 to do it? Thanks.
Yes, yes, and either a Teensy++ 2.0 or the cheaper Teensy 2.0. You'll almost certainly be fine with the Teensy 2.0; I don't think anyone has actually needed the extra memory on the ++ yet!

(There are a number of alternatives to the Teensy 2.0, but it's one the best for size, price, and the easy-to-use loader).
Thanks, too what degree are the keys reprogrammable? Could I for instance map one to "Ctrl+K, Ctrl+C" all on a single key?

User avatar
Soarer

16 Feb 2013, 19:27

Lost4468 wrote: Thanks, too what degree are the keys reprogrammable? Could I for instance map one to "Ctrl+K, Ctrl+C" all on a single key?
You sure could, with a macro. Here I've put it on F24, but it could be any key with any modifiers that's used to trigger the macro...

Code: Select all

macroblock
  macro F24
    PUSH_META ASSIGN_META LCTRL
    PRESS k
    PRESS c
    POP_META
  endmacro
endblock

Lost4468

16 Feb 2013, 19:35

Soarer wrote:
Lost4468 wrote: Thanks, too what degree are the keys reprogrammable? Could I for instance map one to "Ctrl+K, Ctrl+C" all on a single key?
You sure could, with a macro. Here I've put it on F24, but it could be any key with any modifiers that's used to trigger the macro...

Code: Select all

macroblock
  macro F24
    PUSH_META ASSIGN_META LCTRL
    PRESS k
    PRESS c
    POP_META
  endmacro
endblock
Alright, thanks for the help. Think I'll have to go with a different board, doesn't seem to be any retailers which sell teensy here.

User avatar
Soarer

16 Feb 2013, 21:58

Lost4468 wrote:Alright, thanks for the help. Think I'll have to go with a different board, doesn't seem to be any retailers which sell teensy here.
Nobody sells them here either, so I get mine direct from PJRC - even with the postage it's still as cheap as anything I've seen here. Where is your 'here'? Oh, and welcome to the forum :D

Lost4468

17 Feb 2013, 05:32

Soarer wrote:
Lost4468 wrote:Alright, thanks for the help. Think I'll have to go with a different board, doesn't seem to be any retailers which sell teensy here.
Nobody sells them here either, so I get mine direct from PJRC - even with the postage it's still as cheap as anything I've seen here. Where is your 'here'? Oh, and welcome to the forum :D
The UK, PJRC wanted $72 for UPS postage or cheaper air mail at 1-3 weeks for only $10.

User avatar
Kurk

17 Feb 2013, 11:45


User avatar
Soarer

17 Feb 2013, 12:14

Ouch - it used to only be $7 for the airmail. It's marked cheap enough to skip past customs, so usually only takes about a week IIRC. But still...
$16 + $10 = £16.76
vs
€17 + €5 = £17.17
:?

bester42

23 Feb 2013, 21:56

Thanks for this great project.

I think, I need more than one, considering the usefullness of such a converter.

1.) My first intended use:
I got a "IBM Tastatur P/N 1394312 für Terminal 3477/3487" for 29€, which is cheap for a buckling spring with german layout.

2.) My second intendend use:
Conversion of an normal layout to NEO2 (its something like dvorak but adapted zu German language, programmers, mathematicans an engeneers).
While of course normely I would simply install the NEO-Keybord-Driver to do the remapping, this makes no sense so long as I have to use Standard-Layout in office.
In office I have no administration-rights, therefore I am stuck to standard-layout :-(
Learning a modern Keyboard Layout while using 3/4 of the time the old one seems impossible.
So I like to realise the conversion in hardware.
I think I have to use many macros, because many characters normaly can only be inserted by Alt+Numpad. In German not only the "Umlaute" (which arnt a problem) are special, but also the typographic qutation marks are special.
In germany many people dont use this on computer, as they dont know, they are possible there (in handwriting, germans use them).
In Word you have an option for german quotation marks - but with restricted rights this setting gets lost on the next restart, so anyone gave up to correct german writing.

I hope I am right that I can solve this problem with special character using macros, for example in layer1 "7" will start a macro sending "ALT pressed 0 1 3 2 Alt released" to create the german beginning quotation mark.

Doing this modification I will have many questions, I belive. NEO2 uses 6 layers and unusual modifiyer keys. But it will be a interesting project, I think.
As I read, the latest version support extra keys. If they are usable as modifyers, the project might work... I will report.


One fearture reqest I have (oh, on the first post - I know, I am a bad guy):
It would be an very interesting feature to have an output pin going up for a short moment every time a key is pressed.
Due to the low press force I prefer Cherry MX brown, even thinking about a even lower-force modification.
But I want acustic feedback...
I have seen a board comercial available with a buzzer build in. I consider it a great idea.
A buzzer-out, generating a click on every keystroke, activated and deactivated by macros, would be the perfect enhancement to your already gread converter.

User avatar
Soarer

23 Feb 2013, 23:45

Welcome! And hey, that's a pretty good first post for a bad guy!

Defining Neo in the converter would be a very big task; it would take quite a while to put together. A Teensy++ would probably needed for its extra memory. I wonder - can you run autohotkey? That, working along with the converter, might make the job easier.

I think there might be a couple of things I would need to add to the firmware. Some things I've been thinking about already are dead keys, extra modifiers, modifier taps etc. (Modifier taps would be pressing only a modifier key, and having something happen, like what happens with the Windows key). But I'm running out of codes to use, when only using 8-bit codes!

To send Alt+numpad codes reliably, I think maybe a test is needed for num-lock state. Otherwise, this should work for outputting those characters. Of course, key repeat would not work on them, but that's probably not an issue.

The auxiliary keys can be remapped to any code, but there are still the limits of 8 modifiers and 8 function layer keys. (And two of the modifiers are Windows' LGUI and RGUI, so it could be better not to use them). If I'm correct though, that is more than you need, since Mod3 and Mod4 are just layer keys.

Anyway, I can't say if it will all work or not! I had some discussion before regarding implementing bépo in this way, but I forget now if the conclusion was 'impossible' or 'insane' :lol:

The bleeper-out, on the other hand, well that would be easy :D

bester42

24 Feb 2013, 13:59

Soarer wrote: To send Alt+numpad codes reliably, I think maybe a test is needed for num-lock state.
Testing it, as it seems the Numlockstate is irrelevant. But many characters are not available this way, as the "alt"+"+"+<hexcode> do not work if the menu of the running program uses "alt"+character form menu access. So only numbers work, Hexcode containing a-f often result in a menu is popping out.

This mainly seem to be a problem for very special characters (Layer 4+5), esp. Greak characters for mathematicans. That would not be a problem at work.

Maybe a second mode will be interesting, not sending the character via alt+... but generating the html instead. So you type "£" but "&pound;" gets send.

As it is mainly for use NEO2 at work, I will concentrate on a subset first, supporting Layer 1+2 of the NEO Keybord (so I have als normal written Characters in the right place and get my beloved "Gänsefüßchen").

Soarer wrote:The bleeper-out, on the other hand, well that would be easy :D
I hoped so. I will make a test (but in two weeks as I have not much time now) with a simple Arduino setup, how to electrical connect a piezo-busser and place it in a keyboard to se if a simple on/off of a signal makes a noticable sound.
I will of course post the electrical sheme here if it works. Such a testing setup should be easy, a switch connected to a Pin of arduino and Busser connected via transistor to an output. I will report when testong is done.

User avatar
Soarer

24 Feb 2013, 15:07

Oh crap, that's frustrating :( So in general it's only possible to use that for OEM codes or Winodws codes but not Unicode - what a badly thought out feature! Maybe combining with autohotkey is a way round it... the converter could output an otherwise unused modifier combination such as lctrl+rctrl+{some_key}, which autohotkey would react to and output the desired character. If you pick the combination carefully, it could be so it has no effect unless autohotkey is loaded.

There's also nothing to stop an application from using some Alt+numpad key combo for itself, but thankfully not many do it!

The buzzer out could be a pin that just changes state each time, then passing that through a capacitor to a speaker to get clicks. Or a pulse of some width, although I might be using all the timers already which means it might be limited to being some whole number of ms (my main timebase is 1kHz).

bester42

24 Feb 2013, 21:34

Soarer wrote:Oh crap, that's frustrating :(
Full acknowledge. But to be realistic, I mostly have to write normal text in office, so a complete NEO2-Layout is not necassary. For example, diacryptic chars exept accut (which is in my middle name "André") are not used (ÄÖÜäöüß are directly supported).

The main neaded characters
» 0187
« 0171
– 0150 (hyphen)
— 0151 (break (I do not know if its the exact translation, in german "Gedankenstrich" wordly translated means — silly to translate wordly, so this is an example fore use — "thinkingline"))
„ 0132
“ 0147
‚ 0130
‘ 0145
… 0133
  0160 (no-break space )
• 0149
are no problem, it works fine with alt+code, independend of the aplication used.

Other caracters I want, like ≠←↑→↓↔≤ ≥ wont work this way.

On the other hand, this tend to be no problem,too. We are very restrictet in office, no other than the preinstalled programs, so no autokey, but on the other side, we are restrictet to Microsoft Word 2007 for textprocessing. So I can simply make all characters by "typing" the unicode and Alt+X afterwards (which would not work at home using libreoffice).

So for use with MS Word there would not be a problem to generate all characters.

My macroset should be mostly aplication independ, but of course alt+code and unicode alt+x are windowsspecific.

So the gool — a neo2-keyboardconverter for office use — will be reached; not universal, but for office use only.
Of course it should also work on any windows-pc with the normaly used functions (so when I set up a computer for someone else I am able to use limited neo2 - but a limitation not using "—" while setup is no real limitation :-).

Momentary I do not use linux very often (only to compile router firmware), so there is no problem too. If I use linux, I will be administrator of course, so I need no converter but only install the driver.

Keep in mind, my reason for using the converter in offce is only to learn consequently neo2 without changing back to qwertz all the time I hace no admin rights.

Soarer wrote:The buzzer out could be a pin that just changes state each time, then passing that through a capacitor to a speaker to get clicks. Or a pulse of some width, although I might be using all the timers already which means it might be limited to being some whole number of ms (my main timebase is 1kHz).
I think a on/off should do, so simply set pin and clear pin can follow right after another, a piezo will make a nice short click-clack. But maybe changeing every time as you sugest is a better solution, as a simple click (without clack) may fit the sound of a mx blue (als click and clack sound the same, tongle is a good idea)
This (the resulting sound) and the resonance of the keyboradhousing (enough loudness?) I want to test with arduino. By the way, I think I used incorectly the word "buzzer", strictly a buzzer have an oszilator in it. The correct element would be an piezo transductor, simply the piezo plate mounted in the keyboradhousing to generate clicks. I will simply use a arduino, a cherry mx brown and a piezo transductor mounted in a G80-3000 for testing. Shouldnt be hard.
As I have seen in Arduino books, a piezo transductor can easy be connected direct to GND and a output pin, as it do not use much current — typically 5 to 10 mA. That would be an extreme simple "wiring diagram" :-)


The first try will be a Teensy 2.0. As I said, first goal is to connect a 122key terminalkeyboard. If it works (I dont see why not) I will make first steps with keychanging and macros (for the function keys), learning how to use and configure the converter. The 122key terminalkeyboard is for use at home only (to loud for office) and will be my development board for bulding a neo2 config. I will see how far it goes. If I go to a hardwarelimit, I will order a ++ teensy as you suggested. The 2.0 will then be reset to the first steps config without neo changes, doing neo2 by software later.
Learning neo2 will begin as soon the converter project works with Layer 1-3 in all normaly used characters. Before this is done a will not even try to use neo2.
I hope I get fine with neo2, because doing this project and then not liking neo2 would be ironic…

User avatar
Soarer

24 Feb 2013, 23:24

OK, so with a few limitations, it sounds like it should work well enough :)

How about dead keys? Does Neo use them?

bester42

24 Feb 2013, 23:37

Yes, Neo uses Deadkeys, more intensive than a normal german Layout (wich has ´` ^), on the main page of http://neo-layout.org you can see all the modifiers. Neo Keycap Layout takes a circle with the modifier on it. A lot of deadkeys. I think it would be very complicated to handle them without support by the OS (´`^ of course are supportet by the language preferences of windows). I think, to support the others in hardware I have to remember the modifer and depending on the following character send the unicode of the resulting character, or is there a easyier way?
But as I said, exept "´" aboth the e of my middlename, I nearly never use dead keys, so I do not have to programm them...

User avatar
Soarer

25 Feb 2013, 03:28

Ah good, no panic for that feature then :)

(I'd like to do it, but not rush it).

bester42

25 Feb 2013, 04:12

As I read on http://www.johndcook.com/blog/2008/08/1 ... n-windows/
"First create a registry key under HKEY_CURRENT_USER of type REG_SZ called EnableHexNumpad, set its value to 1, and reboot."
After some googling around, some people report it was set as standard, other had to manualy do it.
I will test it in office today. Maybe it is already activated. My computer at home hasnt it activated. After activating, a-f are no problem, after "alt"+"+" a-f dont open a menu any longer.
I dont understan microsofts politics in this...
So all depends how my computer at work is configurated. Wish me luck...
While it is not allowed by company policy to use other than official programs, not even by the local administrators in our location, a simple hexcode activation may be done by the local administrators if I talk niecly to them.
So I will concentrate to the alt+unicode translation.

As I read, the windows greek (phonetic) keylayout uses 33(!) dead keys. That should be all possible combinations I think.
This would be an helpful resource to get the table of substitutions. Of course only ;-) 30 dead keys would to be handled by the controler, as ´`^ are already implemented in the german keyboard layout (and there ist no need for neo if you dont write german)

bester42

03 Mar 2013, 04:29

This week I got my teensy and the Terminal keyboard.
Programming neo2 seem not to be as problematicly as I thought. Layer 1+2 are working (exept not used dead-keys).
Layer 3 I got file to big:

Code: Select all

scwr v1.10
scwr: looking for Soarer's Converter: found
scwr: reading file: 1030 bytes: ok
scwr: sending info request: ok
device: ok
protocol version check: converter=1.00, scwr=1.00: ok
settings version check: converter=1.01, file=1.01: ok
settings length check: max=1018, file=1028 bytes: failed
The first two rows of layer 3 worked, I got this problem in the macros of the third row.

So I think I have to get a Teensy ++ 2.0

Its correct, that the limitation is from EEPROM which is 1k on Teensy 2.0 but 4k on Teensy ++ 2.0?

Of course, even a Teensy 2.0++ maybe has not enough EEPROM for complete NEO2.

There is a second problem,too.
As I wrote, the state of numlock using ALT+Numpad to input charactercodes was irrelevant.
This was true, while hexinput via unicode was deactivated. After activating in the registry numlock became relevant.
Is there any way to force numpad on? As the adapter has his own outputs for LED, a command to force it on should not be a big problem, as the current state is known and all to do is to check the current state and send numlock keycode only if LED is off. Its not such a big problem now, as at office the registrycode is not set, just to be universal.

The third problem: As the same modifier function in NEO is on two keys (one right, one left) and lock is done by pressing both, I am not totaly sure how to progam this. Because of the low numer of modifiers I had to created the layers by this design:

layer 1: <no modifier>
layer 2: <left shift> (remapping the right shift key to left shift function also, so both shifts can be used, but the modifierfunction rshift got free)
layer 3: <right shift> (remapping caps_lock and EUROPE_1 keys to RIGHT_SHIFT)
layer 4: <AltGr> (mapped by AltGR and EUROPE_1)
layer 5: layer 2+3
layer 6: layer 3+4

LALT, LGUI, RGUI, LSTRG and RSTRG are used by windows-functions and have to keep original function, so I can not use them to swap layers.

As remapping is done before macrohandling, pressing both modifiers can not be detected by a macro (without remaping, I can start a macro pressing LSHIFT and RSHIFT, but after remapping there is no way, as both keys are reported as LSHIFT)

I think it would be nice to have virtual modifiers not reporting to the PC. Mody01 to Mody32 :-)
It would be also a solution for DEAD_KEYS. The Deadkey is calling a macro, locking the modifier, the following keystroke is handled by a macro creating the composed sign and resetting the modifier.

At last: As the program needs not all flash of the teensy an even in the ++2.0 the EEPROM is small, it would be nice to put the tables in the normal flash...

EDIT: I removed my functionkey-macros I tried first, so 3. layer fits. The functionkeys are based on Halvar's config for Terminal Model M (No 1394312, 122 keys, German, cable with RJ45 connector) but changing f1-12 and f 13-24 row.
The keymapping and layer 1-3 are working exept some dead_keys and locking a layer.
As Sum and pi are in advanced Layers I cannot support without Teensy++2.0, I put them on AltGr +s /+p.
This config should be enough for normal office work, so it make it possible to use NEO there if you can change keyboard/adapter (maybe simply telling your finger hurt after work, so you had to take a mechanical and optimised keyboard for medical reasons - which is basicly true)
Attachments
NEO2.zip
(3.85 KiB) Downloaded 184 times

User avatar
Soarer

03 Mar 2013, 16:37

bester42 wrote:Its correct, that the limitation is from EEPROM which is 1k on Teensy 2.0 but 4k on Teensy ++ 2.0?

Of course, even a Teensy 2.0++ maybe has not enough EEPROM for complete NEO2.

As the program needs not all flash of the teensy an even in the ++2.0 the EEPROM is small, it would be nice to put the tables in the normal flash...
Yes, that's the limitation at that stage. I think 4k should be enough - there are some ways to reduce the size of your macros already, but also I'm wondering about putting in macro commands for the Alt+... sequences (OEM, Windows, Unicode) which would save a lot. (Not the 'nnnn Alt-C' ones though, they're too specific).

For now though, the main saving would be to remove modifier changes that aren't needed. For examples, an initial:

Code: Select all

    PUSH_META CLEAR_META all
    MAKE LALT
would be 2 bytes shorter with:

Code: Select all

    PUSH_META ASSIGN_META LALT
And a final:

Code: Select all

    BREAK LALT
    POP_ALL_META
can save 2 bytes by removing the BREAK (more if you are ever breaking more than 1 modifier at the end).


Also, I don't know if you ever set two modifiers with MAKE, as in:

Code: Select all

    MAKE LSHIFT
    MAKE LALT
but that would also be 2 bytes smaller with:

Code: Select all

    SET_META LSHIFT LALT
(the same applies with replacing multiple BREAKs with CLEAR_META).

bester42 wrote:... numlock ...
Agreed. Macro triggers conditional on lock states would be a nice feature. (Maybe even in remapping... a lock could have the same effect as a Fn layer... just a thought I'll investigate further).

bester42 wrote:The third problem...: As the same modifier function in NEO is on two keys (one right, one left) and lock is done by pressing both, I am not totaly sure how to progam this. Because of the low numer of modifiers I had to created the layers by this design:
It might work using a Fn layer... it would need to remap to otherwise unused keys: EXECUTE to LOCKING_SCROLL_LOCK, ALTERNATE_ERASE to EXSEL, any of the non-standard codes such as EXTRA_F1 that have been already remapped elsewhere, etc. I think there's enough to cover the whole main block. Then the macros would trigger on those codes.

Of course, that would result in a very hard to read config! Producing it with a script would be wise, or maybe I could add a preprocessor to scas so you could alias the code names to something more readable.

bester42 wrote:I think it would be nice to have virtual modifiers not reporting to the PC. Mody01 to Mody32 :-)
It would be also a solution for DEAD_KEYS. The Deadkey is calling a macro, locking the modifier, the following keystroke is handled by a macro creating the composed sign and resetting the modifier.
I agree that these can be related somehow. I'm thinking of some scheme where perhaps Fn keys can be used for different purposes, but I haven't fully worked it out yet. If the macro trigger could test for them, they could be used for modifiers. If there was a way to tag them as 'sticky', they could be used for dead keys. Those two concepts seem to fit together fairly well, to allow the most configurations. It may then be worth increasing the number of Fn keys... but it won't be to 32!

bester42 wrote:EDIT: I removed my functionkey-macros I tried first, so 3. layer fits. The functionkeys are based on Halvar's config for Terminal Model M (No 1394312, 122 keys, German, cable with RJ45 connector) but changing f1-12 and f 13-24 row.
The keymapping and layer 1-3 are working exept some dead_keys and locking a layer.
As Sum and pi are in advanced Layers I cannot support without Teensy++2.0, I put them on AltGr +s /+p.
This config should be enough for normal office work, so it make it possible to use NEO there if you can change keyboard/adapter (maybe simply telling your finger hurt after work, so you had to take a mechanical and optimised keyboard for medical reasons - which is basicly true)
Cool! So somewhat successful then, even if it could be better :D I'm pretty sure that's the biggest config anyone has written so far!

Anyway... I've mentioned a few features which I could/might implement. None are certain! And I won't do them until I've got time to make a good design :ugeek:

User avatar
Soarer

03 Mar 2013, 17:12

Just spotted another case for simplification... replace:

Code: Select all

# $
macro 6 LSHIFT
    PUSH_META CLEAR_META all
    MAKE LSHIFT
    PRESS 4
    BREAK LSHIFT
endmacro
with:

Code: Select all

# $
macro 6 LSHIFT
    PRESS 4
endmacro
You might want to also consider what happens for, say, LShift+LAlt+6, and maybe add some '-' parts to the trigger, e.g. "-LALT", or even change it to "-all LSHIFT" (if that works). Extra stuff there takes no extra space, once modifiers are used in the trigger.

In a few places you've forgotten to match PUSH_META with a POP_META or POP_ALL_META at the end.

(Perhaps I should make it the default that macros are surrounded by a PUSH_META and POP_META, with a flag to disable it, which would save some more space).

bester42

03 Mar 2013, 19:24

Many thanks for the informations.
I will make a rework in two weeks as I have not many time till then.
It is a very interesting project, but complicated,too. As the PC is set to german keyboard layout, it is not easy to make the remapping. The keyboard uses scancodes named by us-layout, the converter first remaps them to other keys to change to neo, than the macros use the remaped codes and produce codes in us-layout that will be remapped again by the german keyboard-driver on the PC. So it is not easy readable and took a lot of thinking and try-and-error testing.
I found some errors in my mappings but their are a minor problem, so it basicly works.
I tested to remove the BREAK before POP_META and adding the missing POP_META, this spends about 80 bytes (which is a lot considering about 1015 bytes possible on Teensy 2.0)
Optimising using the other information you gave me may possible result in another lot of bytes.

I ordered a teensy ++2.0, so next tests will have 4kByte EEPROM available. I will consequently do a two step developement, first consequently wrap the macro by PUSH_META and POP_META and setting needed modifiers by MAKE and BREAK (which is not economic use of the resources). In second step (if everything workes out) I will do optimazion.

Maybe I will make some helpful documentation, as the multitranslation of codes is irretating. So I might draw a map of the keybord with original scancodes (us-layout), german standard-remap and neo-functions in one layer. I should have made this first...

User avatar
Soarer

04 Mar 2013, 02:42

You're welcome - I realize that my documentation of the config commands is rather minimal, although partly that's intentional! Perhaps it could use a few more explanations and examples... but such stuff is always the last thing I find time for :(

I can't do much about the scancode names - they are mostly as defined in the HID spec! Perhaps just make a table (in excel?), rather than a map, to get things planned out. As a programmer, I'd probably put together a script to help write such a config - anything repetetive looks like a job for a computer!

bester42

04 Mar 2013, 03:35

To make it in Excel seems to be a good idea, because I have used VBA in some projects before. So maybe I can (partly) generate the macros this way.

I think for understanding the logic, I simply make the map in Excel, using 8 colums and 4 rows per key (the 4 colums make it easy to place the Keys like its done on the keyboard). * means, that the character can be calculated by VBA ** can calculated by an table
1. row: scancode-name as delivered by the keyboard
2. row: Character in de-layout 2nd column: shift modified, 3th column: altgr modified, 4th column: specials (deadkey etc)
3. row: neoCharacter 1st layer 2nd column: *scancode to send 3th column: *modifier to send 4th column: **Charcode
4. row: neoCharacter 2nd layer ...
...
A VBAscript generates a table out of 1+2. row and calculating as much information for 3.-8. row.
Than the rest (where *scancode to send = n.a.) is completed manualy. 3-8. row 3nd. column (modifier to send) has to be set to Windowscode or Unicode or Word.
A second script should generate the remap and macros.

Such a .xls may be a help to programm alternative layouts also. I will think about it.

Post Reply

Return to “Workshop”