Author Topic: TMK ADB to USB keyboard converter  (Read 673625 times)

0 Members and 1 Guest are viewing this topic.

Offline yomammary

  • Posts: 525
  • Location: Québec
Re: ADB to USB keyboard converter
« Reply #550 on: Mon, 16 November 2015, 07:38:29 »
Does anyone have one that he could sell me or will I have to make one? :'(

There's this: https://geekhack.org/index.php?topic=75213.msg1864261#msg1864261

Unsure of it's current state.

I cut an ADB cable so I had a connector and about 2inches of internal wires.  I then stripped those and soldered them and the 1K resistor to the teensy.
It's only three solder locations, give it a shot. :)
Yeah I think I will :)
RF 87u 55g | Leeku 1800

Offline tjweir

  • * Exquisite Elder
  • Posts: 1039
  • Location: Toronto
Re: ADB to USB keyboard converter
« Reply #551 on: Mon, 16 November 2015, 08:51:20 »
This may help, just ignore the gross soldering, could not find my fine tip, so I had to ham-fist it. :)


Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #552 on: Mon, 16 November 2015, 15:40:56 »
Does anyone have one that he could sell me or will I have to make one? :'(

You can buy an preassembled converter here.
https://geekhack.org/index.php?topic=72052.0

Offline yomammary

  • Posts: 525
  • Location: Québec
Re: ADB to USB keyboard converter
« Reply #553 on: Tue, 17 November 2015, 08:02:32 »
Does anyone have one that he could sell me or will I have to make one? :'(

You can buy an preassembled converter here.
https://geekhack.org/index.php?topic=72052.0
Thanks, I've bought a teensy 2.0 to try doing it myself. :confused:
RF 87u 55g | Leeku 1800

Offline superbia

  • Posts: 133
  • Location: Republique de Croatie
Re: ADB to USB keyboard converter
« Reply #554 on: Wed, 25 November 2015, 04:03:32 »
I see people paying 20$ for a teensy
while you can buy this converter for 30$ (made by hasu)


However you can use microcontrollers with same chip as teensy has that cost 6$ (pictured bellow)


I am just confused, if you want to DIY why don't you pay 6$ for the chip (it doesn't need to be a teensy),
or just pop 30$ for a pro grade converter (hassle free, it works, its tidy, it looks nice) and support the maker
Keebio Iris 2.8 (Alps) X Colemak Mod-DH

Offline yomammary

  • Posts: 525
  • Location: Québec
Re: ADB to USB keyboard converter
« Reply #555 on: Mon, 30 November 2015, 11:19:20 »
I see people paying 20$ for a teensy
while you can buy this converter for 30$ (made by hasu)
Show Image


However you can use microcontrollers with same chip as teensy has that cost 6$ (pictured bellow)
Show Image


I am just confused, if you want to DIY why don't you pay 6$ for the chip (it doesn't need to be a teensy),
or just pop 30$ for a pro grade converter (hassle free, it works, its tidy, it looks nice) and support the maker
I get it, it's just fun doing it myself. Money is no object ;)
RF 87u 55g | Leeku 1800

Offline yomammary

  • Posts: 525
  • Location: Québec
Re: ADB to USB keyboard converter
« Reply #556 on: Mon, 30 November 2015, 13:23:20 »
Here is my work so far, everything worked great. The soldering job is not that good mostly because I've soldered a couple of times before. You can also see that I've fixed some things in place with hot glue.
I used Windows + Cygwin for the generation of the Hex file.
Tested the keys (because I was unsure) with EK' switch hitter and it's working great.
The only this remaining is to clean the keycaps.





I'll post more pics when I'm done.
« Last Edit: Mon, 30 November 2015, 14:16:33 by yomammary »
RF 87u 55g | Leeku 1800

Offline asaturn

  • Posts: 3
Re: ADB to USB keyboard converter
« Reply #557 on: Sat, 05 December 2015, 05:24:04 »
can anyone help me out?

I have a teensy 2.0 wired to the board on an apple A9M 0330 keyboard

I know the teensy works (I can send the flashing light program and it works) but I get zero output when flashing the adb hex program.

do the pin numbers on the keyboard circuit correspond to the pin numbers assigned here to the ADB connection?

see photos





« Last Edit: Sat, 05 December 2015, 13:35:20 by asaturn »

Offline asaturn

  • Posts: 3
Re: ADB to USB keyboard converter
« Reply #558 on: Sat, 05 December 2015, 05:37:57 »
PS I originally read this site:

http://ifixit.org/blog/4468/hack-it-better-apple-extended-keyboard-ii/jhjgjhcxzczc

but then I found this forum and thread, so I made sure to use D0 instead of F0.

I ran "make" just like the site says... but I'm not sure if I have to change anything else? new to this stuff.

Offline asaturn

  • Posts: 3
Re: ADB to USB keyboard converter
« Reply #559 on: Sat, 05 December 2015, 14:03:50 »
so I don't know what I did wrong, but I deleted, resync'd, recompiled, and now it works! I do get the mouse going to the upper left, but that's known -- I'll throw the resistor on there.

THANKS!

Offline stoic-lemon

  • Posts: 970
  • Location: Saitama, Japan
Re: ADB to USB keyboard converter
« Reply #560 on: Mon, 07 December 2015, 11:27:05 »
Another noob to all this just dropping by to say thanks to everyone for sharing successes and failures. They are so helpful. I managed to get my M0116 up and running. Most difficult parts were setting up the software on Windows and getting round a few C based confusions. Being back on the command line has me feeling nostalgic for when I was Linux only.

Next things to do are to make it all look presentable. I think I will put the Teensy in the case and have a USB cable running out the side of the case.

Thanks again!

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #561 on: Thu, 17 December 2015, 21:38:19 »
REQUEST FOR HELP: Extended mouse protocol support
It is required for more buttons and movement resolution of mouse/trackball.
Do you have multiple button mouse? Implement it!
https://github.com/tmk/tmk_keyboard/issues/274

This converter currently supports only 'classic mouse protrocol' which allows only one or two buttons, while 'extended protocol' can support multiple-button devices up to eight buttons.

Thanks

Offline Stabilized

  • Posts: 93
  • Location: Edinburgh, UK
Re: ADB to USB keyboard converter
« Reply #562 on: Tue, 22 December 2015, 17:24:52 »
I was wondering if anyone could help me use a Pro Micro as the controller for this firmware.

I have read the post a couple of pages ago and also the post on Deskthority about using a Pro Micro instead of a Teensy.

I used both guides and soldered up my controller and successfully flashed it, but it doesn't work with either my Apple Extended keyboard or my Apple Adjustable keyboard and I can't work out what I have done wrong!

This is my first time using and flashing the TMK firmware, so I do assume that it is something to do with that. I have flashed soarer's converter on about 3 Pro Micros without any problem. Also when I look in my Mac's keyboard menu in the settings, the converter doesn't come up as a recognised keyboard, should it?

Anyway here's a picture of my soldering job, I originally connected the Power SW line to PD1 because I wasn't thinking, but I don't think should effect the functionality right?



The resistor is 1.16K and I am using a short 4 pole s-video cable.

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #563 on: Tue, 22 December 2015, 18:59:21 »
Yes, it is recognized as keyboard once firmware runs on controller.
Right, Power switch line won't affect unless the wiring is mess.

Offline Stabilized

  • Posts: 93
  • Location: Edinburgh, UK
Re: ADB to USB keyboard converter
« Reply #564 on: Wed, 23 December 2015, 05:34:32 »
I think it is a problem with me building it, I tried with v1.12 soarer's converter using the same pro micro and that works without problems in Mac OS X (10.11).
For some reason when I flash the TMK ADB hex it doesn't come up in my device list on Mac OS.

I have tried different cables, building it multiple times, and I can't get it work! I follow all the build instructions over on this page, but it still isn't shown on either Mac OS or Windows 10.

Would really appreciate help or maybe a pre-compiled .hex file if you have one handy?

Offline merlin64

  • Posts: 1273
  • Location: Seattle, WA
    • MechMerlin
Re: ADB to USB keyboard converter for Teensy
« Reply #565 on: Sun, 10 January 2016, 22:20:05 »
The upper solution could solve almost multiple key stroke problem but not all.

By setting USB device as low speed device, this problem could be solved.(I didn't tried)

I made USB controller for Apple desktop bus keyboard(IIgs) with Teensy++2.0 and this multiple key stroke problem exists also. I tried in many ways but I couldn't find what is wrong but I could expect there is some timing issue between USB host and firmware. As a work around, by setting this controller as low speed device this problem has gone.

Here is my work picture
Show Image


Anyone know where Jeffrey got that mini usb connector? Been looking for one like it, but haven't been successful.

Offline MAR82

  • Posts: 494
  • Location: It says I'm in France
  • Keyboard Addict
Re: ADB to USB keyboard converter for Teensy
« Reply #566 on: Mon, 11 January 2016, 03:04:49 »
The upper solution could solve almost multiple key stroke problem but not all.

By setting USB device as low speed device, this problem could be solved.(I didn't tried)

I made USB controller for Apple desktop bus keyboard(IIgs) with Teensy++2.0 and this multiple key stroke problem exists also. I tried in many ways but I couldn't find what is wrong but I could expect there is some timing issue between USB host and firmware. As a work around, by setting this controller as low speed device this problem has gone.

Here is my work picture
Show Image


Anyone know where Jeffrey got that mini usb connector? Been looking for one like it, but haven't been successful.

Looking for something like this?
http://www.ebay.com/itm/10pcs-Mini-USB-Female-5Pin-180-Socket-Connector-vertical-Legs-HW-MU-5F-23-/170961675619?hash=item27ce1c2563:g:jhEAAMXQMmJRNBRi
Because it looks like Jeffrey used one, and then just hot glued it into the ADB port housing

Offline merlin64

  • Posts: 1273
  • Location: Seattle, WA
    • MechMerlin
Re: ADB to USB keyboard converter
« Reply #567 on: Mon, 11 January 2016, 10:18:47 »
I wish he was still active on the forum, It almost looks like he just soldered his teensy 2.0++ to some pins shared by the original microcontroller.

Offline mastermachetier

  • Posts: 59
Re: ADB to USB keyboard converter
« Reply #568 on: Mon, 11 January 2016, 17:43:49 »
Hey Guys,

I am copying my message from the tmk_keyboard main thread . I fell that it is more relevant here



Quote
Hey first of all thank you for the awesome firmware its beautiful. I am pretty new to the world of hardware and also coding. I have a apple standard keyboard M0116 that i converted from adb using the tmk firmware. It is working beautifully, the next step i would like to do is convert it to bluetooth. I saw the bluetooth protocol in the repo this is just if you are using serial. I have a bluefruit ez-link that supports serial , but i also have a bluefruit le spi that supports bluetooth hid. https://learn.adafruit.com/introducing-the-adafruit-bluefruit-spi-breakout/hidkeyboard  . So after all that my questions are

1. Is there an advantage to using the bluetooth hid instead of serial ? If so how hard would it be to implement and where would I begin.
2. How do I add the bluefruit protocol in the firmware to the makefile for the adb converter .

Thanks !

Offline mr.squishy

  • Posts: 215
  • I like beer and keebs
Re: ADB to USB keyboard converter
« Reply #569 on: Wed, 03 February 2016, 16:50:59 »
Ok so I'm trying to go through this whole process again because I have more time now, and i really could use ,y function layer, but I seem to be stuck on the very first step! I'm using a Teensy btw. So my problem is that when I open cygwin and type in:
cd tmk_keyboard/converter/adb_usb
nothing happens!
I downloaded the zip archive and made sure to extract it as well. My problem might be the Atmel AVR toolchain, I'm not really sure how that one works, but I downloaded it and all I got was a zip file, no executable or anything.
When I run the command in Cygwin, I get an output saying that there is no such file or directory. I'm at aloss here, any help would be appreciated.

Offline mastermachetier

  • Posts: 59
Re: ADB to USB keyboard converter
« Reply #570 on: Thu, 11 February 2016, 12:15:38 »
Hey guys and Hasu. I have been using this firmware for about a month now everyday on my m0116 as a matter of fact I am typing with it right now. I am having an issue though were If I do not use the keyboard for a little bit of time It stops responding until I unplug it both from the adbport on the keyboard and the usb from the teensy. The way i wired this was by getting a spare adb cable stripping the ends and soldering it directly to a teensy. I was wondering you could lead me in the correct direction of troubleshooting this issue.

Thank you,

Offline mr.squishy

  • Posts: 215
  • I like beer and keebs
Re: ADB to USB keyboard converter
« Reply #571 on: Thu, 11 February 2016, 13:34:27 »
Hey guys and Hasu. I have been using this firmware for about a month now everyday on my m0116 as a matter of fact I am typing with it right now. I am having an issue though were If I do not use the keyboard for a little bit of time It stops responding until I unplug it both from the adbport on the keyboard and the usb from the teensy. The way i wired this was by getting a spare adb cable stripping the ends and soldering it directly to a teensy. I was wondering you could lead me in the correct direction of troubleshooting this issue.

Thank you,
Weird,I've been using the code on an M0116 as well for about a year and I haven't ever had this issue. Do you have the stock configuration or did you add a function layer? I'm starting to get annoyed  by the lack of F keys

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #572 on: Thu, 11 February 2016, 15:38:37 »
Hey guys and Hasu. I have been using this firmware for about a month now everyday on my m0116 as a matter of fact I am typing with it right now. I am having an issue though were If I do not use the keyboard for a little bit of time It stops responding until I unplug it both from the adbport on the keyboard and the usb from the teensy. The way i wired this was by getting a spare adb cable stripping the ends and soldering it directly to a teensy. I was wondering you could lead me in the correct direction of troubleshooting this issue.

Thank you,

Check first post, again. In particular, "NEED HELP?" section.

Offline mastermachetier

  • Posts: 59
Re: ADB to USB keyboard converter
« Reply #573 on: Thu, 11 February 2016, 15:58:03 »
Hey guys and Hasu. I have been using this firmware for about a month now everyday on my m0116 as a matter of fact I am typing with it right now. I am having an issue though were If I do not use the keyboard for a little bit of time It stops responding until I unplug it both from the adbport on the keyboard and the usb from the teensy. The way i wired this was by getting a spare adb cable stripping the ends and soldering it directly to a teensy. I was wondering you could lead me in the correct direction of troubleshooting this issue.

Thank you,
Weird,I've been using the code on an M0116 as well for about a year and I haven't ever had this issue. Do you have the stock configuration or did you add a function layer? I'm starting to get annoyed  by the lack of F keys

I am using the default layout still i wrote a layout yesterday but missed something as it is not compiling but I have yet to go over it again .

Code: [Select]
#include "keymap_common.h"


const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
    * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
    * +-----------------------------------------------------+   | +---+---+---+---+
    * | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
    * +---------------------------------------------------------+ +-------+---|ent|
    * |fn0|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
    * +---------------------------------------------------------+ +-------+---+---+
    */
  KEYMAP_M0116_ANSI( \
                                     POWER,                                                          \
       ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,   NLCK,EQL, PSLS,PAST, \
       TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,        P7,  P8,  P9,  PMNS, \
       LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,    P4,  P5,  P6,  PPLS, \
       LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,   P1,  P2,  P3,        \
       FN0, LALT,LGUI,GRV,           SPC,      BSLS,LEFT,RGHT,DOWN,UP,          P0,       PDOT,PENT),

    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +----+----+--+-+---+
    * |esc| F1| F2| F3| F4| F5| F6| F7| F8| F9| F0| - | = | del | |    |    |    |   |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | |    |    |    | + |
    * +-----------------------------------------------------+   | +----+----+----+---+
    * | bks  | a | s | d | f | g | h | j | k | l | ; | ' |return| |    | UP |    | - |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | |Left|DOWN|RGHT|   |
    * +---------------------------------------------------------+ +---------+----|ent|
    * |   |opt|comnd| clr|                  | \ |lef|rig|dwn|up | |  DEL    |bks |   |
    * +---------------------------------------------------------+ +---------+----+---+
    */
  KEYMAP_M0116_ANSI( \
                                     TRNS,                                                            \
       TRNS,F1,  F2,  F3,  F4,  F5,  f6,  F7,  F8,  F9,  F0,  TRNS,TRNS, DEL,    NO  ,NO  ,NO  ,NO  , \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         NO  ,NO  ,NO  ,TRNS, \
       BSPC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,    NO  ,UP  ,NO  ,TRNS, \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,    LEFT,DOWN,RGHT,      \
       NO,  TRNS,TRNS,LCTL,          TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,         DEL ,     BSPC,TRNS),

};

const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),             
};     


error

Code: [Select]
make -f Makefile.teensy KEYMAP=raf                                                     
sh: dfu-programmer: command not found
sh: dfu-programmer: command not found

-------- begin --------
avr-gcc (GCC) 4.8.3
Copyright (C) 2013 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_adb_usb_lufa
Compiling C: keymap_raf.c
avr-gcc -c -mmcu=at90usb1286  -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=2048 -DADB_MOUSE_MAXACC=8 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DBOOTMAGIC_ENABLE -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DNKRO_ENABLE -DVERSION=5c89d73-dirty -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_adb_usb_lufa/keymap_raf.lst -I. -I../../tmk_core -I../../tmk_core/protocol/lufa -I../../tmk_core/protocol/lufa/LUFA-git -I../../tmk_core/protocol -I../../tmk_core/common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_adb_usb_lufa_keymap_raf.o.d  keymap_raf.c -o obj_adb_usb_lufa/keymap_raf.o
In file included from keymap_raf.c:1:0:
keymap_common.h:149:65: error: 'KC_f6' undeclared here (not in a function)
   { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
                                                                 ^
keymap_raf.c:47:3: note: in expansion of macro 'KEYMAP_M0116_ANSI'
   KEYMAP_M0116_ANSI( \
   ^
keymap_common.h:150:55: error: 'KC_F0' undeclared here (not in a function)
   { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
                                                       ^
keymap_raf.c:47:3: note: in expansion of macro 'KEYMAP_M0116_ANSI'
   KEYMAP_M0116_ANSI( \
   ^
make: *** [obj_adb_usb_lufa/keymap_raf.o] Error 1

Offline mastermachetier

  • Posts: 59
Re: ADB to USB keyboard converter
« Reply #574 on: Thu, 11 February 2016, 16:00:07 »
Hey guys and Hasu. I have been using this firmware for about a month now everyday on my m0116 as a matter of fact I am typing with it right now. I am having an issue though were If I do not use the keyboard for a little bit of time It stops responding until I unplug it both from the adbport on the keyboard and the usb from the teensy. The way i wired this was by getting a spare adb cable stripping the ends and soldering it directly to a teensy. I was wondering you could lead me in the correct direction of troubleshooting this issue.

Thank you,

Check first post, again. In particular, "NEED HELP?" section.


Wow sorry Hasu have read this thread through so many you would think I saw that. I will post with pictures when I have a chance to open up my "converter box". I am at work and don't have screw drivers here.

Thanks though !

Offline mr.squishy

  • Posts: 215
  • I like beer and keebs
Re: ADB to USB keyboard converter
« Reply #575 on: Thu, 18 February 2016, 07:20:16 »
Master, any updates on the layout you wrote?

Offline mastermachetier

  • Posts: 59
Re: ADB to USB keyboard converter
« Reply #576 on: Thu, 18 February 2016, 10:53:00 »
Master, any updates on the layout you wrote?

I got the code working after some tweaks turns out I forgot to put "F" before some of the function keys. I am using a basic setup right now to get function keys, but I plan on making a better keymap when I have some time. I also re-soldered my teensy internally and it seems to have resolve the issues I was having with they keyboard freezing. In the future I plan on using the locking key to change before colemak and qwerty and move the fn key to where GRV is using shift and FN to get ` ~ and access the fkeys using FN. 

Code: [Select]
#include "keymap_common.h"

/*
 * Mastermachetier
 */
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
    * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
    * +-----------------------------------------------------+   | +---+---+---+---+
    * | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
    * +---------------------------------------------------------+ +-------+---|ent|
    * |fn0|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
    * +---------------------------------------------------------+ +-------+---+---+
    */
  KEYMAP_M0116_ANSI( \
                                     POWER,                                                          \
       ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,   NLCK,EQL, PSLS,PAST, \
       TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,        P7,  P8,  P9,  PMNS, \
       LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,    P4,  P5,  P6,  PPLS, \
       LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,   P1,  P2,  P3,        \
       FN0, LALT,LGUI,GRV,           SPC,      BSLS,LEFT,RGHT,DOWN,UP,          P0,       PDOT,PENT),

    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +----+----+--+-+---+
    * |esc| F1| F2| F3| F4| F5| F6| F7| F8| F9| F0| - | = | del | |    |    |    |   |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | |    |    |    | + |
    * +-----------------------------------------------------+   | +----+----+----+---+
    * | bks  | a | s | d | f | g | h | j | k | l | ; | ' |return| |    | UP |    | - |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | |Left|DOWN|RGHT|   |
    * +---------------------------------------------------------+ +---------+----|ent|
    * |fn0|opt|comnd| clr|                  | \ |lef|rig|dwn|up | |  DEL    |bks |   |
    * +---------------------------------------------------------+ +---------+----+---+
    */
  KEYMAP_M0116_ANSI( \
                                     TRNS,                                                            \
       TRNS,F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10,  F11, F12, DEL,    NO  ,NO  ,NO  ,NO  , \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         NO  ,NO  ,NO  ,TRNS, \
       BSPC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,    NO  ,UP  ,NO  ,TRNS, \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,    LEFT,DOWN,RGHT,      \
       TRNS,TRNS,TRNS,TRNS,          TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,         DEL ,     BSPC,TRNS),

};

const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),             
};     

More
128695-0
128697-1
128699-2
128701-3
128703-4
128705-5
128707-6
128709-7

quick edit : has anyone figured out how to use bootmagic on adb ? Also can you access layers on the keyboard while in bios using function keys for the "F" keys ?
« Last Edit: Thu, 18 February 2016, 11:00:24 by mastermachetier »

Offline mr.squishy

  • Posts: 215
  • I like beer and keebs
Re: ADB to USB keyboard converter
« Reply #577 on: Thu, 18 February 2016, 23:05:16 »
Master, any updates on the layout you wrote?

I got the code working after some tweaks turns out I forgot to put "F" before some of the function keys. I am using a basic setup right now to get function keys, but I plan on making a better keymap when I have some time. I also re-soldered my teensy internally and it seems to have resolve the issues I was having with they keyboard freezing. In the future I plan on using the locking key to change before colemak and qwerty and move the fn key to where GRV is using shift and FN to get ` ~ and access the fkeys using FN. 

Code: [Select]
#include "keymap_common.h"

/*
 * Mastermachetier
 */
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
    * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
    * +-----------------------------------------------------+   | +---+---+---+---+
    * | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
    * +---------------------------------------------------------+ +-------+---|ent|
    * |fn0|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
    * +---------------------------------------------------------+ +-------+---+---+
    */
  KEYMAP_M0116_ANSI( \
                                     POWER,                                                          \
       ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,   NLCK,EQL, PSLS,PAST, \
       TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,        P7,  P8,  P9,  PMNS, \
       LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,    P4,  P5,  P6,  PPLS, \
       LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,   P1,  P2,  P3,        \
       FN0, LALT,LGUI,GRV,           SPC,      BSLS,LEFT,RGHT,DOWN,UP,          P0,       PDOT,PENT),

    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +----+----+--+-+---+
    * |esc| F1| F2| F3| F4| F5| F6| F7| F8| F9| F0| - | = | del | |    |    |    |   |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | |    |    |    | + |
    * +-----------------------------------------------------+   | +----+----+----+---+
    * | bks  | a | s | d | f | g | h | j | k | l | ; | ' |return| |    | UP |    | - |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | |Left|DOWN|RGHT|   |
    * +---------------------------------------------------------+ +---------+----|ent|
    * |fn0|opt|comnd| clr|                  | \ |lef|rig|dwn|up | |  DEL    |bks |   |
    * +---------------------------------------------------------+ +---------+----+---+
    */
  KEYMAP_M0116_ANSI( \
                                     TRNS,                                                            \
       TRNS,F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10,  F11, F12, DEL,    NO  ,NO  ,NO  ,NO  , \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         NO  ,NO  ,NO  ,TRNS, \
       BSPC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,    NO  ,UP  ,NO  ,TRNS, \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,    LEFT,DOWN,RGHT,      \
       TRNS,TRNS,TRNS,TRNS,          TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,         DEL ,     BSPC,TRNS),

};

const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),             
};     

More

quick edit : has anyone figured out how to use bootmagic on adb ? Also can you access layers on the keyboard while in bios using function keys for the "F" keys ?
No experience with bootmagic, but that looks like some solid code. I'd borrow it but I can't seem to get my compiler to work. Oh well.

Offline mastermachetier

  • Posts: 59
Re: ADB to USB keyboard converter
« Reply #578 on: Thu, 18 February 2016, 23:20:25 »
Master, any updates on the layout you wrote?

I got the code working after some tweaks turns out I forgot to put "F" before some of the function keys. I am using a basic setup right now to get function keys, but I plan on making a better keymap when I have some time. I also re-soldered my teensy internally and it seems to have resolve the issues I was having with they keyboard freezing. In the future I plan on using the locking key to change before colemak and qwerty and move the fn key to where GRV is using shift and FN to get ` ~ and access the fkeys using FN. 

Code: [Select]
#include "keymap_common.h"

/*
 * Mastermachetier
 */
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
    * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
    * +-----------------------------------------------------+   | +---+---+---+---+
    * | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
    * +---------------------------------------------------------+ +-------+---|ent|
    * |fn0|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
    * +---------------------------------------------------------+ +-------+---+---+
    */
  KEYMAP_M0116_ANSI( \
                                     POWER,                                                          \
       ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,   NLCK,EQL, PSLS,PAST, \
       TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,        P7,  P8,  P9,  PMNS, \
       LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,    P4,  P5,  P6,  PPLS, \
       LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,   P1,  P2,  P3,        \
       FN0, LALT,LGUI,GRV,           SPC,      BSLS,LEFT,RGHT,DOWN,UP,          P0,       PDOT,PENT),

    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +----+----+--+-+---+
    * |esc| F1| F2| F3| F4| F5| F6| F7| F8| F9| F0| - | = | del | |    |    |    |   |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | |    |    |    | + |
    * +-----------------------------------------------------+   | +----+----+----+---+
    * | bks  | a | s | d | f | g | h | j | k | l | ; | ' |return| |    | UP |    | - |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | |Left|DOWN|RGHT|   |
    * +---------------------------------------------------------+ +---------+----|ent|
    * |fn0|opt|comnd| clr|                  | \ |lef|rig|dwn|up | |  DEL    |bks |   |
    * +---------------------------------------------------------+ +---------+----+---+
    */
  KEYMAP_M0116_ANSI( \
                                     TRNS,                                                            \
       TRNS,F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10,  F11, F12, DEL,    NO  ,NO  ,NO  ,NO  , \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         NO  ,NO  ,NO  ,TRNS, \
       BSPC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,    NO  ,UP  ,NO  ,TRNS, \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,    LEFT,DOWN,RGHT,      \
       TRNS,TRNS,TRNS,TRNS,          TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,         DEL ,     BSPC,TRNS),

};

const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),             
};     

More

quick edit : has anyone figured out how to use bootmagic on adb ? Also can you access layers on the keyboard while in bios using function keys for the "F" keys ?
No experience with bootmagic, but that looks like some solid code. I'd borrow it but I can't seem to get my compiler to work. Oh well.


what errors are you getting ? What os are you trying to compile on ? Also what type of microcontroller?

Offline mr.squishy

  • Posts: 215
  • I like beer and keebs
Re: ADB to USB keyboard converter
« Reply #579 on: Fri, 19 February 2016, 00:31:19 »
I'm on windows 10 with a teensy 2.0, my error is that my compiler (cygwin) can't seem to figure out how to switch directories. I'm not sure why, but when I tell it to switch directories it tells me that the directory does not exist, no matter what i put in.

Additionally, I'm getting a missing libusb0.dll error when I attempt to use the dfu programmer, so that might be my issue
« Last Edit: Tue, 23 February 2016, 09:02:27 by mr.squishy »

Offline zhyiou

  • Posts: 4
Re: ADB to USB keyboard converter
« Reply #580 on: Thu, 07 April 2016, 08:00:10 »
Hello,

currently I scored an AEKII and am waiting for a pro micro clone from China. However, because I have to wait for such a long time I was already thinking a bit about what I wanted my keyboard to do.

I would like to make a layer in which I type greek symbols such as Δ δ and the like. However, there are no keycodes for this. From reading the documentation (I have absolutely zero experience with linux nor microcontrollers) it would seem that the keycodes are defined in common/keycode.h However, I do not quite understand how I would go about adding greek symbols to this list.

Could somebody explain this to me?

Regards,
Zhyiou

EDIT?:
I might try to use macros in the keymap_xxx.c file where a third layer has all keys substituted by e.g. FN12 keys like so:

const uint16_t PROGMEM fn_actions[] = {
    [12] = MACRO( I(0), D(ALT), T(2), T(2), T(5), U(ALT), END ) : MACRO_NONE ),
};

Would this code run a macro that types ALT+225 (which would result in ß)?

EDIT2?: Or perhaps this sequence?
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case FN12:
            return (record->event.pressed ?
                    MACRO( I(0), D(ALT), T(P2), T(P2), T(P5), U(ALT), END ) :
                    MACRO_NONE );
        case FN13:
            return (record->event.pressed ?
                    MACRO( I(0), D(ALT), T(P2), T(P2), T(P4), U(ALT), END ) :
                    MACRO_NONE );
        case LSHIFT_FN12:
        case RSHIFT_FN12:
            return (record->event.pressed ?
                    MACRO( I(0), D(ALT), T(P_), T(P_), T(P_), U(ALT), END ) :
                    return MACRO_NONE;
    }
    return MACRO_NONE;
}
« Last Edit: Fri, 08 April 2016, 04:08:01 by zhyiou »

Offline zhyiou

  • Posts: 4
Re: ADB to USB keyboard converter
« Reply #581 on: Sat, 09 April 2016, 07:26:59 »
And another question if anybody could help:

Currently I got a pretty decent idea for the macro, but I would like to change the behavior of the macro depending on the active layer (e.g. layer 1 is lower case, Fn0 temporary changes to layer 2, where the same key is now upper case). For this to work I got the following code:

Code: [Select]
enum macro_id {
    THETA, //first row FN1..

};

const uint16_t PROGMEM fn_actions[] = {
    [0] = ACTION_LAYER_MOMENTARY(2),                  // FN0, momentarily switch between layer 1 and 2 (greek lower and upper)

    [1] = ACTION_MACRO(THETA),                        // Macros for greek letters --> ALT+unicode

};

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt, uint8_t layer) //can you add 'uint8_t layer' to know what layer is active currently?
{
    switch (id) {
        case THETA:

            #if(layer==2)              //layer 2 is upper case
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P8), U(LALT), END ) :
                    MACRO_NONE );
            #else                      // only can get to layer 3 from 2 (temporary keyaction Fn0), so if not 2 then is 1 AKA lower case
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P8), U(LALT), END ) :
                    MACRO_NONE );
    }
    return MACRO_NONE;
}

Normally, the macro would be:
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)

but can I add a variable layer like so?
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt, uint8_t layer)

TY
« Last Edit: Sat, 09 April 2016, 07:31:48 by zhyiou »

Offline goflo

  • Posts: 69
  • Location: Germany
Re: ADB to USB keyboard converter
« Reply #582 on: Sat, 09 April 2016, 13:06:53 »
I got a ADB to USB Converter from Hasu directly and tried to get my Apple M0118 with a german layout running.



The standard programming of the adbtousb converter seems to fit the Apple AEK.
Has anyone got a layout file for the M0118? Or have I overlooked it in the files?

Thx
Flo
« Last Edit: Sat, 09 April 2016, 13:13:52 by goflo »
- Ergodox Classic/Browns/Grifiti Rests  | - IBM Model M Blue Label |  - Poker II MX Blue | - Ergodox Classic/Blues/Grifiti Rests

Offline zhyiou

  • Posts: 4
Re: ADB to USB keyboard converter
« Reply #583 on: Sat, 09 April 2016, 13:50:01 »
@ goflo

as far as I can tell M0116 and M0118 are either identical or very similar. This layout can be found in https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/keymap_common.h

Or in code format:
Code: [Select]
/* M0116 Apple Standard Keyboard ANSI
*                     +-------+
*                     | power |
*                     +-------+
* +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
* |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
* +---------------------------------------------------------+ +---+---+---+---+
* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
* +-----------------------------------------------------+   | +---+---+---+---+
* | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
* +---------------------------------------------------------+ +---+---+---+---+
* | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
* +---------------------------------------------------------+ +-------+---|ent|
* |cap|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
* +---------------------------------------------------------+ +-------+---+---+
*/
#define KEYMAP_M0116_ANSI( \
                           K7F,                                              \
   K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \
   K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,     K59,K5B,K5C,K45, \
   K36,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,    K24, K56,K57,K58,K4E, \
   K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,        K7B, K53,K54,K55,     \
   K39,K3A,K37,K32,        K31,        K2A,K3B,K3C,K3D,K3E, K52,    K41,K4C  \
) { \
  { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
  { KC_##K08, KC_##K09, KC_NO,    KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
  { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
  { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
  { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
  { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
  { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO,    KC_##K35, KC_##K36, KC_##K37 }, \
  { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO    }, \
  { KC_NO,    KC_##K41, KC_NO,    KC_##K43, KC_NO,    KC_##K45, KC_NO,    KC_##K47 }, \
  { KC_NO,    KC_NO,    KC_NO,    KC_##K4B, KC_##K4C, KC_NO,    KC_##K4E, KC_NO    }, \
  { KC_NO,    KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
  { KC_##K58, KC_##K59, KC_NO,    KC_##K5B, KC_##K5C, KC_NO,    KC_NO,    KC_NO    }, \
  { KC_NO,    KC_NO,    KC_NO,    KC_NO   , KC_NO,    KC_NO,    KC_NO,    KC_NO    }, \
  { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO    }, \
  { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO    }, \
  { KC_NO   , KC_NO,    KC_NO   , KC_##K7B, KC_NO,    KC_NO,    KC_NO,    KC_##K7F }  \
}

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #584 on: Sat, 09 April 2016, 20:52:56 »
zhyiou, you can know current layer state from uint32_t variables; layer_state and default_layer_state of common/action_layer.h. Note that each bit of the variables represent each layer state.
For example, you can know if layer 2 is enabled with
Code: [Select]
#include "action_layer.h"

if ((layer_state | default_layer_state) & (1<<2))


goflo, you can use ISO AEK layout without any acutal problem.

Offline zhyiou

  • Posts: 4
Re: ADB to USB keyboard converter
« Reply #585 on: Sun, 10 April 2016, 05:35:16 »
zhyiou, you can know current layer state from uint32_t variables; layer_state and default_layer_state of common/action_layer.h. Note that each bit of the variables represent each layer state.
For example, you can know if layer 2 is enabled with
Code: [Select]
#include "action_layer.h"

if ((layer_state | default_layer_state) & (1<<2))


goflo, you can use ISO AEK layout without any acutal problem.

Thank you so much! I know very little of programming, and nothing about either C or bitoperations. Fingers crossed that it will actually work!

For anyone perhaps interested in how I intend to add greek symbols (lower and upper case) to my keyboard, with Hasu's variable added it looks like so:
Code: [Select]
#include "keymap_common.h"
#include "action_layer.h"


const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0 Default Layer: plain keymap
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |   |
     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
     * ,-----------------------------------------------------------. ,-----------. ,---------------.
     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
     * |-----------------------------------------------------------| |-----------| |---------------|
     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]| Fn31| |Del|End|PgD| |  7|  8|  9|  -|
     * |-----------------------------------------------------------| `-----------' |---------------|
     * |CapsLo|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |               |  4|  5|  6|  +|
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |     |Up |     |  1|  2|  3|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
     * |Ctrl |Gui |Alt |         Space             |Alt |Gui |Ctrl | |Lef|Dow|Rig| |      0|  .|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */
    KEYMAP_EXT_ANSI(
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,FN31,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
    LCTL,LGUI,LALT,                 SPC,                        RGUI,RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
    ),

    /* 1 Default Layer: Greek lower
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |   |
     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
     * ,-----------------------------------------------------------. ,-----------. ,---------------.
     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
     * |-----------------------------------------------------------| |-----------| |---------------|
     * |Tab  |thta|omg|eps|xi|tau|psi|mu|iota|omc|rho|  [|  ]|    \| |Del|End|PgD| |  7|  8|  9|  -|
     * |-----------------------------------------------------------| `-----------' |---------------|
     * |CapsLo|alph|sig|del|ups|gam|pi|phi|kap|lmb|  ;|  '|Return  |               |  4|  5|  6|  +|
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Fn0     |zet|chi|   |nu|beta|eta|   |  ,|  ,|  /|Fn0       |     |Up |     |  1|  2|  3|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
     * |Ctrl |Gui |Alt |         Space             |Alt |Gui |Ctrl | |Lef|Dow|Rig| |      0|  .|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */
    KEYMAP_EXT_ANSI(
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
    TAB, FN1, FN2, FN3, FN4, FN5, FN6, FN7, FN8, FN9, FN10,LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
    LCAP,FN11,FN12,FN13,FN14,FN15,FN16,FN17,FN18,FN19,SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
    FN0, FN20,FN21,  NO,FN22,FN23,FN24,  NO,COMM,DOT, SLSH,          FN0,           UP,           P1,  P2,  P3,
    LCTL,LGUI,LALT,                 SPC,                        RGUI,RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
    ),

    /* 2 Default Layer: Greek upper
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |   |
     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
     * ,-----------------------------------------------------------. ,-----------. ,---------------.
     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
     * |-----------------------------------------------------------| |-----------| |---------------|
     * |Tab  |THTA|OMG|EPS|XI|TAU|PSI|MU|IOTA|OMC|RHO|  [|  ]|    \| |Del|End|PgD| |  7|  8|  9|  -|
     * |-----------------------------------------------------------| `-----------' |---------------|
     * |CapsLo|ALPH|SIG|DEL|UPS|GAM|PI|PHI|KAP|LMB|  ;|  '|Return  |               |  4|  5|  6|  +|
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Fn0     |ZET|CHI|   |NU|BETA|ETA|   |  ,|  ,|  /|Fn0       |     |Up |     |  1|  2|  3|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
     * |Ctrl |Gui |Alt |         Space             |Alt |Gui |Ctrl | |Lef|Dow|Rig| |      0|  .|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */
    KEYMAP_EXT_ANSI(
    TRNS, TRNS, 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, 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, TRNS, TRNS, TRNS,       TRNS,                        TRNS, TRNS, TRNS, TRNS,
    TRNS, TRNS, TRNS, NO,   TRNS, TRNS, TRNS, NO,   TRNS, TRNS, TRNS,             TRNS,           TRNS,        TRNS, TRNS, TRNS,
    TRNS, TRNS, TRNS,                       TRNS,                           TRNS, TRNS,     TRNS, TRNS, TRNS,  TRNS,       TRNS, TRNS
    ),

    /* 3 Default Layer: mouse and media keymap
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
     * |`  |   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |   |
     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
     * ,-----------------------------------------------------------. ,-----------. ,---------------.
     * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Delete | |Ins|Hom|PgU| |NmL|Mb1|Mb2|Mb3|
     * |-----------------------------------------------------------| |-----------| |---------------|
     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|PrS|ScL|Pau|Up |Ins| Fn31| |Del|End|PgD| |MwD|McU|MwU|MwD|
     * |-----------------------------------------------------------| `-----------' |---------------|
     * |CapsLo|VoD|VoU|Mut|  F|  G|  H|  J|Hom|PgU|Lef|Rig|Return  |               |McL|McD|McR|MwU|
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|End|PgD|Dow|Shift     |     |PgU|     |MwL|McD|MwR|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Mb3|
     * |Ctrl |Gui |Alt |         Space             |Alt |Gui |Ctrl | |Hom|PgD|End| |    Mb1|Mb2|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */
    KEYMAP_EXT_ANSI(
    GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,      INS, HOME,PGUP,    NLCK,BTN1,BTN2,BTN3,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   PSCR,SLCK,PAUS,UP,  INS, FN31,     DEL, END, PGDN,    WH_D,MS_U,WH_U,WH_D,
    LCAP,VOLD,VOLU,MUTE,F,   G,   H,   J,   HOME,PGUP,LEFT,RGHT,     ENT,                         MS_L,MS_D,MS_R,WH_U,
    LSFT,Z,   X,   C,   V,   B,   N,   M,   END, PGDN,DOWN,          RSFT,          PGUP,         WH_L,MS_D,WH_R,
    LCTL,LGUI,LALT,                 SPC,                        RGUI,RCTL,     HOME,PGDN,END,     BTN1,     BTN2,BTN3
    ),
};

enum macro_id {
    THETA, //first row FN1..
    OMEGA,
    EPSILON,
    XI,
    TAU,
    PSI,
    MU,
    IOTA,
    OMICRON,
    RHO,
    ALPHA, //second row
    SIGMA,
    DELTA,
    UPSILON,
    GAMMA,
    PI,
    PHI,
    KAPPA,
    LAMBDA,
    ZETA, //third row
    CHI,
    NU,
    BETA,
    ETA, // FN24
};

const uint16_t PROGMEM fn_actions[] = {
    [0] = ACTION_LAYER_MOMENTARY(2),                  // FN0, momentarily switch between layer 1 and 2 (greek lower and upper)

    [1] = ACTION_MACRO(THETA),                        // Macros for greek letters --> Unicode format
    [2] = ACTION_MACRO(OMEGA),
    [3] = ACTION_MACRO(EPSILON),
    [4] = ACTION_MACRO(XI),
    [5] = ACTION_MACRO(TAU),
    [6] = ACTION_MACRO(PSI),
    [7] = ACTION_MACRO(MU),
    [8] = ACTION_MACRO(IOTA),
    [9] = ACTION_MACRO(OMICRON),
    [10] = ACTION_MACRO(RHO),
    [11] = ACTION_MACRO(ALPHA),
    [12] = ACTION_MACRO(SIGMA),
    [13] = ACTION_MACRO(DELTA),
    [14] = ACTION_MACRO(UPSILON),
    [15] = ACTION_MACRO(GAMMA),
    [16] = ACTION_MACRO(PI),
    [17] = ACTION_MACRO(PHI),
    [18] = ACTION_MACRO(KAPPA),
    [19] = ACTION_MACRO(LAMBDA),
    [20] = ACTION_MACRO(ZETA),
    [21] = ACTION_MACRO(CHI),
    [22] = ACTION_MACRO(NU),
    [23] = ACTION_MACRO(BETA),
    [24] = ACTION_MACRO(ETA),

    [31] = ACTION_LAYER_TAP_KEY(3, KC_BSLS),          // FN31, switch to mouse and media keymap
};

// use unicodes to input non-standard characters: D(LALT), T(PPLS), T(P3), T(B), T(P8), U(LALT) = U+03B8 / x3B8 for lower case theta

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case THETA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P8), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P8), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case OMEGA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P9), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P9), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case EPSILON:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P5), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P5), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case XI:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(E), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(E), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case TAU:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P4), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P4), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case PSI:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P8), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P8), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case MU:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(C), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(C), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case IOTA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P9), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P9), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case OMICRON:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(F), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(F), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case RHO:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P1), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P1), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case ALPHA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P1), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P1), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case SIGMA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P3), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P3), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case DELTA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P4), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P4), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case UPSILON:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P5), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P5), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case GAMMA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P3), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P3), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case PI:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P0), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P0), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case PHI:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P6), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P6), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case KAPPA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(A), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(A), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case LAMBDA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(B), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(B), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case ZETA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P6), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P6), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case CHI:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P7), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P7), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case NU:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(D), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(D), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case BETA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P2), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P2), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case ETA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P7), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P7), U(LALT), END ) :
                    MACRO_NONE );
            #endif
    }
    return MACRO_NONE;
}


The code is based on Hasu's keymap, with a default layer (0), and a key to switch to a mouse/media layer, which I switched to layer 3 with FN31 instead of layer 1 with FN0.

I intend to switch to my greek symbols layout via Magic+1/F1 command so that it does not go by accident.
In the first layer (lower case greek symbols, layer 1) I switched out the RSHIFT and LSHIFT with Fn0, making this key temporarily switch to layer 2 - with all the keys the same (TRNS).

In my macro, I test if the current layer is 2 or not (thanks Hasu!) and depending on the answer, I make the macro input the unicode for either lower or upper case greek letter. Hopefully this works (should get my pro micro clones sometime next weekend to test), and if anybody wishes to use this feel free!
« Last Edit: Sun, 10 April 2016, 15:33:38 by zhyiou »

Offline goflo

  • Posts: 69
  • Location: Germany
Re: ADB to USB keyboard converter
« Reply #586 on: Tue, 12 April 2016, 10:04:39 »
I forgot the KEYMAP=iso, now it fits much better. I tweaked the iso mapping a bit (see below).
One key refuses to give me some output, the key right of the left shift key (> <) that is labeled "NUBS" in the layout.
But if I use xev and press the key I get the following output:

Code: [Select]
KeyPress event, serial 37, synthetic NO, window 0x4000001,
    root 0x1de, subw 0x0, time 3623194, (24,-59), root:(766,381),
    state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) ""
    XmbLookupString gives 1 bytes: (1b) ""
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4000001,
    root 0x1de, subw 0x0, time 3623314, (50,-47), root:(792,393),
    state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) ""
    XFilterEvent returns: Fals

The layout used is this one:

Code: [Select]
#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* Layer 0: QWERTZ Layout */
    KEYMAP_EXT_ISO(
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,          PSCR,SLCK,PAUS,                   MUTE,
    ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,    INS, HOME,PGUP,    NLCK,PEQL,PSLS,PAST,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,ENT,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,NUHS,                            P4,  P5,  P6,  PPLS,
    LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RSFT,         UP,           P1,  P2,  P3,
    LCTL,LALT,FN0,          SPC,                               RALT,RALT,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
    ),
    /* Layer 1: */
    KEYMAP_EXT_ISO(
    TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         TRNS,TRNS,TRNS,                  TRNS,
    TRNS, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10,  F11,F12, DEL,     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, TRNS,TRNS,TRNS,                          TRNS,  TRNS,  TRNS,  TRNS,
    TRNS,RALT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,             VOLU,        TRNS,  TRNS,  TRNS,
    TRNS,TRNS,TRNS,          TRNS,                           TRNS,TRNS,        TRNS,VOLD,MUTE,   TRNS,    TRNS,TRNS
    ),
};

const uint16_t PROGMEM fn_actions[] = {
     /* QWERTZ Layout */
    [0] = ACTION_LAYER_MOMENTARY(1),  // to Fn over
};

Maybe someone has got an idea, why the keypress isn't recognized by the firmware.
All other keys are functional.

- Ergodox Classic/Browns/Grifiti Rests  | - IBM Model M Blue Label |  - Poker II MX Blue | - Ergodox Classic/Blues/Grifiti Rests

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #587 on: Wed, 13 April 2016, 00:00:00 »
goflo,

Very old bug, seems I failed to fix that.
https://github.com/tmk/tmk_keyboard/issues/35

This is patch for this to swap K32 and K0A. I'll update repository soon.
Quote

diff --git a/converter/adb_usb/keymap_common.h b/converter/adb_usb/keymap_common.h
index bdca38e..c11a4b3 100644
--- a/converter/adb_usb/keymap_common.h
+++ b/converter/adb_usb/keymap_common.h
@@ -93,10 +93,10 @@ extern const uint16_t fn_actions[];
  */
 #define KEYMAP_EXT_ISO( \
     K35,  K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71,              K7F, \
-    K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74,  K47,K51,K4B,K43, \
+    K0A,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74,  K47,K51,K4B,K43, \
     K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K24, K75,K77,K79,  K59,K5B,K5C,K4E, \
     K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A,                   K56,K57,K58,K45, \
-    K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,    K7B,     K3E,      K53,K54,K55,     \
+    K38,K32,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,    K7B,     K3E,      K53,K54,K55,     \
     K36,K3A,K37,        K31,                        K7C,K7D, K3B,K3D,K3C,  K52,    K41,K4C  \
 ) { \
     { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \

EDIT: pushed this fix to github repository (and add untested M0118 keymap)
« Last Edit: Wed, 13 April 2016, 00:30:18 by hasu »

Offline goflo

  • Posts: 69
  • Location: Germany
Re: ADB to USB keyboard converter
« Reply #588 on: Wed, 13 April 2016, 11:06:28 »
Yes !!!!   Thanks alot.  :thumb:
M0118 German layout working fine now.
What a fine little keyboard  :D
- Ergodox Classic/Browns/Grifiti Rests  | - IBM Model M Blue Label |  - Poker II MX Blue | - Ergodox Classic/Blues/Grifiti Rests

Offline alh84001

  • Posts: 276
  • Location: EU-HR-ZG
Re: ADB to USB keyboard converter
« Reply #589 on: Wed, 04 May 2016, 04:08:06 »
I don't have a 1k resistor with me right now, but I have two 1.5k available. Would either of 1.5k or 750 pull-up work?

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #590 on: Wed, 04 May 2016, 04:46:24 »
Either of them will work. Just try it and report.

Offline alh84001

  • Posts: 276
  • Location: EU-HR-ZG
Re: ADB to USB keyboard converter
« Reply #591 on: Wed, 04 May 2016, 10:52:47 »
Yep. 1.5k resistor worked splendidly (I didn't try 750 setup). Thanks!

Offline guster11

  • Posts: 13
  • Location: Boston
Re: ADB to USB keyboard converter
« Reply #592 on: Wed, 04 May 2016, 12:39:18 »
Has anyone had any issues with dfu-programmer on windows? I have installed the drivers for libusb after it first wouldn't start due due to the lack of that. Now whenever I try to run the program, it opens and instantly closes. I can't make without it so I am sort of stuck at the moment.

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #593 on: Wed, 04 May 2016, 17:09:53 »
How do you run the program? I afraid you double click it :)

Offline guster11

  • Posts: 13
  • Location: Boston
Re: ADB to USB keyboard converter
« Reply #594 on: Wed, 04 May 2016, 18:14:10 »
How do you run the program? I afraid you double click it :)

I am trying to use the precompiled version that has an exe, so admittedly I had tried that.  :))

 I also tried running as an admin to no luck, should I be opening it through cygwin?

Offline need

  • Posts: 460
Re: ADB to USB keyboard converter
« Reply #595 on: Sun, 08 May 2016, 08:38:33 »
Will the same pre-made converter works with M0116 and AEKII ISO and AEKII ANSI at the same time (no need for changing the hex file if I keep swapping keyboards) ?

EDIT: also, can someone please let know how do I do this part :

To build firmware:

$ make -f Makefile clean
$ make -f Makefile

Is this a code to put in ? I'm so frustrated in trying to build my converter... :-\
« Last Edit: Sun, 08 May 2016, 12:25:19 by need »

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #596 on: Sun, 08 May 2016, 18:10:27 »
Yes, the converrter should work with all ADB keyboads, ISO keyboards have weird swap keys but it still works. You may want to use ISO keymap though.
https://github.com/tmk/tmk_keyboard/issues/35

The first of make comamnd removes compiled firmware files created by previous run and second one creates compiled firmware binary. You can flash the binary into your converter with your favorite tool.

$ mkae -f Makefile dfu

This will work for you if you installed dfu-programmer. Did you read the doc? :(
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/build.md#2-program-with-dfu-bootloader

Offline alh84001

  • Posts: 276
  • Location: EU-HR-ZG
Re: ADB to USB keyboard converter
« Reply #597 on: Mon, 09 May 2016, 00:47:56 »
Also, if you are using pro micro it has ATmega32u4, so use the rev1 makefile.

Code: [Select]
make -f Makefile.rev1
Took me some 15 minutes to figure out why nothing was happening when I ran make with vanilla file  :))

@hasu would editing vanilla Makefile to change the target make it work with Pro Micro or are there other differences?

Offline need

  • Posts: 460
Re: ADB to USB keyboard converter
« Reply #598 on: Mon, 09 May 2016, 07:26:23 »
Yes I'm using a pro micro, and now I tried the rev1 command, but it shows up this  :-\:
Does anyone know what's happening ? I got dfu programmer installed (flashes and closed when I try to open it).
« Last Edit: Sun, 15 May 2016, 16:36:09 by need »

Offline orihalcon

  • Posts: 95
Re: ADB to USB keyboard converter
« Reply #599 on: Fri, 20 May 2016, 19:33:16 »
Hello All,

I just started using Hasu's awesome ADB converter and it's an all around great project!

Does anyone know how to go about updating hex file after getting it into bootloader mode using the bootloader magic key?

I am using a Pro Micro.

I was able to get to the bootloader mode as evidenced by the output in HID listen when using Power Key + Pause, but then it just reboots after about 5 seconds.

During the short time  showing up while it is in the bootloader, so I can't program it with Arduino Builder since I don't see a new COM port show up.

Main reason for wanting to do this is for those that have their Arduinos mounted inside their case so that a manual reset doesn't need to be done each time you want to modify the firmware.

Anyone else have success with a Pro Micro and the bootloader magic key, and if so, how is it done?

Thanks in advance!