Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: Support for custom keymap for teensyduino

  1. #1
    Junior Member
    Join Date
    Feb 2015
    Posts
    7

    Support for custom keymap for teensyduino

    Hi,

    Currently, their is no support for french bepo layout inside teensyduino. I tried to find sources before sending a patch, but I have no ideas where the keymaps' sources are located. Since bepo is realy different to other keymap, theire are no "closest" layout I can send to pjrc. If you can tell me where is the source code of any layout, like us keymap, I will send you back the french bepo keymap

    You can found the complete keymap on the official website:
    http://bepo.fr/wiki/Accueil

    Sincerely.

  2. #2

  3. #3
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    Thanks. It's look like simple to add bepo layout, I'll make it as soon as I got time, and send a pull request when it's ready.

    I thinks that the ISO_8859_* name refers to windows style encoding system. If my computer is set us with utf8 encoding, will it work ?

    How the symbol are named ? In bepo, their are lots of symbols, and some are not present in other keymap (like greeks letters, currency, …). Can I use the same name than in /usr/include/X11/keysymdef.h, or unicode name, or do you have any others references ?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,027
    In keylayout.h, there are 96 #define for ascii (unicode U+0020 to U+007F) and 96 for ISO_8859_1 (unicode U+00A0 to U+00FF). These require only a single line, and less memory, because nearly all keyboards require these densely packed numbers.

    For higher numbers, unicode U+0100 to U+FFFF, you need to define a pair of names. See the Serbian keyboard example near the end of keylayouts.h for an example.

    When you add to keylayouts.h, the text you put in each #define is the keys that would be pressed on a US keyboard. For example, in the Serbian keyboard:

    Code:
    #define ASCII_59	KEY_Z + SHIFT_MASK // 89 Y
    This means when Keyboard.print() wants to send a keystroke for "Y" (unicode U+0059), it sends the key code for what would have been the Z key on a US layout keyboard.

    To create the layout for your keyboard, you need to compare your layout with a US keyboard layout. For every character that Keyboard.print() would need to type, you specify the key names for a US keyboard. The name "KEY_Z" isn't actually the character "Y" or "Z", it's the actual USB scan code for physical key that is labeled "Z" on US layout keyboards. Just repeat this process for all 96 ascii characters, and all the iso8859 characters your keyboard has, and any extra keys it has that are higher unicode numbers.

    If you get it working well, I'd be happy to include your definitions in future versions. Normally, I would put some work into making a first attempt. I might, but I can't look at this in any more detail until after Teensy-LC is officially released.

    Hopefully this explanation of keylayouts.h helps, if you want to try creating the mapping data.

  5. #5
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    Ok, thanks for your quick response.
    I have already known how the keyboard protocol works, so it make sense for me that you use the US keyboard as reference.

  6. #6
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    It works !
    I have already add the ascii character, and it works fine

  7. #7
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    I have another question. For the moment, I have modified the french layout (instead of creating a new one) because I don't know how to update the list of keymap in the gui of arduino (tools->layout). How can I add the bépo layout in that list ?

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,027
    Quote Originally Posted by robinm View Post
    How can I add the bépo layout in that list ?
    Edit boards.txt. It should be pretty easy to figure out from the ones already present, but do remember it needs to be edited separately for each board. If you want it to work on all boards, duplicate it to all of them.

  9. #9
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    ok, thanks.
    The bepo keymap has 10 deads keys. Some exist already (like grave dead key), but other don't (like greak dead key). Do you think it's easy to add them? I've not investigated for the moment.

    Adding dead keys can be also an improvement for other keymap, because (at least on linux) dead keys are shared for all keymap. Nevertheless, deads keys support are inequals among systems (azerty on linux has more advailable keys than on windows).

    If you think that adding more deads keys it easy, I will make it, if not, it's not a problem. Only least important keys are advailable with deads keys (bepo have ~250 symbols advailable!).

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,027
    Quote Originally Posted by robinm View Post
    Some exist already (like grave dead key), but other don't (like greak dead key). Do you think it's easy to add them?
    Well, this does require editing actual code, instead of just #define lines. But it's basically just duplicating code for the other dead keys, so I suppose it depends on whether you consider that "easy".

    Look in usb_keyboard.c and search for the place where all the other deadkeys are.

  11. #11
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    ok, I will look at it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •