Author Topic: TMK keyboard firmware  (Read 818557 times)

0 Members and 1 Guest are viewing this topic.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
TMK keyboard firmware
« on: Wed, 03 April 2013, 19:51:33 »
I hope that this thread become a place to get bug report, feedback and suggestion from the community.

Source code repository
https://github.com/tmk/tmk_keyboard


You are using QMK?
QMK has already great and helpful community and will help you. You can ask there.

- https://github.com/jackhumbert/qmk_firmware
- https://www.reddit.com/r/olkb/



NEED HELP?

Read wiki pages first.
https://github.com/tmk/tmk_keyboard/wiki


Use this if you have problem on building firmware.
https://github.com/tmk/tmk_keyboard/wiki/Build-firmware-on-VirtualBox


Your keyboard/converter doesn't work?
Frist, post schematics or pics of your hardware and wriring this really saves our time. Don't save your time by omitting this.

If you edit code
Post your code. Don't hesitate to show your dirty code!

And other infos you can provide
- Which OS are you using?



UPDATE
2013/07  NKRO on LUFA is supported
2014/03  FAQ and Keymap Editor are added
2014/12  updated USB to USB converter
2015/01  Added Infinity support(mbed based)
2015/03  Updated for Infinity 'production' model
2015/04  Changed location of core library to 'tmk_core' directory.
More
Update your Makefile to change variable name TOP_DIR to TMK_DIR and location of core library.
Code: [Select]
TMK_DIR = ../../tmk_core
https://github.com/tmk/tmk_keyboard#20150422

2015/09  NeXT converter LED control fix
2016/02  flabbergast's Chibios protocol was merged
2016/06  Added XT to USB converter. Thank you, @papodaca. https://github.com/tmk/tmk_keyboard/pull/355
2017/05  Fixed Modifier/Layer key stuck problem. https://github.com/tmk/tmk_keyboard/tree/master/tmk_core#20170530

README
https://github.com/tmk/tmk_keyboard/blob/master/README.md


Build
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/build.md


Customize Keymap
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/keymap.md


FAQ/WIKI
https://github.com/tmk/tmk_keyboard/wiki/FAQ
https://github.com/tmk/tmk_keyboard/wiki


Keymap Editor
http://tmk.github.io/tmk_keyboard/editor/index.html



TMK own projects
You can find under: https://github.com/tmk

Keyobard:
Alternative controller for HHKB
Alps64 - PCB for Alps SKCM/L
Happy Buckling Keyboard(Model M 60% mod)
PCB cut 60% mod(retired)
GH60(unofficial)
Infinity Ergodox(unofficial)
Infinity 60chibios mbed(unofficial)

Converter:
PS/2(Code Set 2)
ADB(Apple Desktop Bus)
M0110(Apple Machintosh 128K/512K/Plus)
NEWS(Sony workstation)
X68K(Sharp X68000)
IBM 4704
USB to USB
Sun(Sun Microsystems)
PC98(NEC)
NeXT(Non ADB) pic contribution from bcg(https://github.com/tmk/tmk_keyboard/pull/92)
XT(Code Set 1) contribution from papodaca(https://github.com/tmk/tmk_keyboard/pull/355)

TMK Products
HHKB Alt Controller
https://geekhack.org/index.php?topic=71517.0

TMK Converters
https://geekhack.org/index.php?topic=72052.0

Alps64
https://geekhack.org/index.php?topic=69740.0
« Last Edit: Tue, 30 May 2017, 20:40:19 by hasu »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #1 on: Wed, 03 April 2013, 19:51:47 »
« Last Edit: Mon, 03 March 2014, 17:47:53 by hasu »

Offline jdcarpe

  • * Curator
  • Posts: 8852
  • Location: Odessa, TX
  • Live long, and prosper.
TMK keyboard firmware
« Reply #2 on: Wed, 03 April 2013, 20:43:14 »
Do you have any instruction on how to make a Fn layer toggle on and off, rather than only switching layers while a Fn key is pressed?

I really like your FW!
KMAC :: LZ-GH :: WASD CODE :: WASD v2 :: GH60 :: Alps64 :: JD45 :: IBM Model M :: IBM 4704 "Pingmaster"

http://jd40.info :: http://jd45.info


in memoriam

"When I was a kid, I used to take things apart and never put them back together."

Offline nano

  • Posts: 8
  • Location: Germany
Re: TMK keyboard firmware
« Reply #3 on: Thu, 04 April 2013, 03:15:00 »
Do you have any instruction on how to make a Fn layer toggle on and off, rather than only switching layers while a Fn key is pressed?
Look at doc/keymap.md. All layer actions are documented there.

As I’ve said before in the gh60 thread, that code is plain awesome and understandable. I really like your how you implement the keymap and how easy it is to make it fit your own needs.

I’ve already forked your repo here and started toying around a bit ;D

Offline agodinhost

  • Posts: 767
  • Location: Brazil, RJ
  • Soylent green is people ...
    • Dr Ian O Xaman
Re: TMK keyboard firmware
« Reply #4 on: Thu, 04 April 2013, 09:27:52 »
Hi Hasu, thanks very much for this opportunity to learn more about your firmware
and thanks very much for sharing it!

Quote from: hasu date=2013-04-03
You'll have to write a 'host side protocol' module to add support for BT HID.
I didn't understood why we will need a "host" side module. It wouldn't be one simple slave? (according to what I saw at the Bluetooth HID Lite documentation).

Quote from: hasu date=2013-04-03
My firmware has a module using Bluegiga iWRAP4 for BT(and V-USB for USB), you can find this under protocol/iwrap/ directory. But it is very old code and not supported actively now. I don't know even whether it works with new updated firmware base. Though, I think it is still a good start point for BT module. Also LUFA 'host side protocol' module will be worth looking into. It is located on protocol/lufa/.
Yup I saw both of these folders there. I'll have to buy this BlueGiga module to test it further - just waiting for the best day of my credit card. I were already planning to get one of these and the RN-42 anyway.

-> Reference papers for those willing to touch Hasu's code:
    TMK keyboard firmware collection
         Hasu's deskthority previous topic.
    Bluetooth HID Lite
         HID Lite = HID Keyboard Boot mode, could it be one easier option to our GH60 Bluetooth keyboard?
    Human Interface Device Profile 1.1
         Official HID 1.1 profile documentation
    HID Profile, Bluetooth HID Tutorial
         Awesome tutorial

-> For discussion:
    LUFA BT HID not 100% done
         See the last message, by Dean Camera.
    "LUFA has bluetooth hid support" (unknow guy)
         "... you can port OSS host stack - maybe BlueZ(the linux stack) or lwBT (the latter designed for low memory usage for embedded systems)."
    Btstack AVR on google code
         Seems to be one Bluetooth HID stack but I'm not sure of it - it's complete? Too little code there.

-> Reference code:
    Dean Camera Bluetooth Explorer bot (LUFA based, with a partial HID/L2CAP/SDP layers)
         This project acts as a Bluetooth host receiving joystick movements and as a device, sending sensor data to one PC. This PC has one USB HID driver installed to parse the bot messages.

Gosh, too much stuff to read and learn!!!
« Last Edit: Thu, 04 April 2013, 13:22:33 by agodinhost »
Building one square I2C keyboard with those 1200 switches (thanks JDCarpe)
GH60 |GH60-Alps |GH60-BT |GHPad/GHPad Alps |GH60-Case |Alps TKL |EL Wire |OS Controller, Round 2 |My Custom Keyboard |WTT/WTB

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #5 on: Thu, 04 April 2013, 18:58:45 »
Do you have any instruction on how to make a Fn layer toggle on and off, rather than only switching layers while a Fn key is pressed?

I really like your FW!
Thanks! Updated keymap document and my fist post with hoping this helps you and other.
https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#32-toggle-switching



As I’ve said before in the gh60 thread, that code is plain awesome and understandable. I really like your how you implement the keymap and how easy it is to make it fit your own needs.

I’ve already forked your repo here and started toying around a bit ;D
Looks great. Impressive keymap :) I'll look into it later.
Happy to see someone forks my code and starts his own project!

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #6 on: Thu, 04 April 2013, 19:20:35 »
Hi agodinhost,
My terminology 'host side' may be a bit confusing because in my firmware keyboard and converter projects share same core base.
Keyboard projects have a USB protocol(host side) to communicate with host while converters have 'keyboard side' protocol such as PS/2, ADB, ... to hook up to target keyboard in addition to 'host side' protocol.

You are right. It is totally a slave or client, neither server nor host.
With this 'host side protocol' module l wanted to mean a client implementation of BT HID in keyboard firmware. Confusing :)
While 'keyboard side protocol' module means host side implementation of the keyboard protocol.

Hi Hasu, thanks very much for this opportunity to learn more about your firmware
and thanks very much for sharing it!

Quote from: hasu date=2013-04-03
You'll have to write a 'host side protocol' module to add support for BT HID.
I didn't understood why we will need a "host" side module. It wouldn't be one simple slave? (according to what I saw at the Bluetooth HID Lite documentation).

Quote from: hasu date=2013-04-03
My firmware has a module using Bluegiga iWRAP4 for BT(and V-USB for USB), you can find this under protocol/iwrap/ directory. But it is very old code and not supported actively now. I don't know even whether it works with new updated firmware base. Though, I think it is still a good start point for BT module. Also LUFA 'host side protocol' module will be worth looking into. It is located on protocol/lufa/.
Yup I saw both of these folders there. I'll have to buy this BlueGiga module to test it further - just waiting for the best day of my credit card. I were already planning to get one of these and the RN-42 anyway.

Offline Glissant

  • Posts: 1976
  • Location: Oslo, Norway
Re: TMK keyboard firmware
« Reply #7 on: Mon, 08 April 2013, 04:09:30 »
Hey, hasu. Excellent firmware, and I wanted to thank you for all the work that you have put into it. I am extremely impressed to see how easy it is to re-configure the layout.

I am having an issue understanding how to add keys to the layout though. I've tried to add keys by changing out NO with K31 and K3C respectively in keymap.c. Then I added a keystroke for each of the keys in keymap_poker.h .
Anyway, it's safe to say that I couldn't figure it out by myself, so I am asking for help =).

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #8 on: Mon, 08 April 2013, 06:05:45 »
Hi, Glissant.
I assume you are talking about GH60 keymap and you want to define KEYMAP_ISO() instead of KEYMAP_ANSI().

To define the macro you'll also need to add K31 and K3C in first part in addition to replace NO with those keys in second part.
Code: [Select]
#define KEYMAP_ISO( \
... first part ...(arguments)
} KEYMAP (\
... second part...(definition)
)

Or you can define all keys available on GH60 with KEYMAP() macro.

Offline Glissant

  • Posts: 1976
  • Location: Oslo, Norway
Re: TMK keyboard firmware
« Reply #9 on: Mon, 08 April 2013, 06:11:35 »
Hasu =),
I actually just want to turn my shift keys into two keys. But I'll look into it again after work =). Look at my latest gh60 pictures in the Post your GH60-thread to see the key setup.  I'll link it here if need be but it will have to be after work.

Edit http://geekhack.org/index.php?topic=39702.msg831294#msg831294


EDIT2:
I finally figured it out. I had to add my new keys to all of the KEYMAP() macros in keymap.h, which makes perfect sense.
This firmware is almost just too perfect. Thanks again!
« Last Edit: Mon, 08 April 2013, 18:10:09 by Glissant »

Offline metalliqaz

  • * Maker
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: TMK keyboard firmware
« Reply #10 on: Mon, 08 April 2013, 08:11:45 »
Good stuff.  Props for supporting 3 USB libraries!

Offline regack

  • Posts: 660
  • Location: Thessia
Re: TMK keyboard firmware
« Reply #11 on: Mon, 08 April 2013, 08:57:06 »
I just wanted to say thank you for all your hard work and making it availble to all of us.

Offline Tranquilite

  • Posts: 144
Re: TMK keyboard firmware
« Reply #12 on: Mon, 08 April 2013, 15:07:30 »
I've been using this firmware for my Phantom, and find it to be incredibly functional. I hacked in a few adjustments to mine such that one of my LEDs now shows the status of my "numpad" layer. I also have it set up to automatically turn on numlock when that layer is active. I also really like nkro over usb even though I have never needed more than 6kro :|
if I ever get around to opening my keyboard again I think I might replace my mx lock switch with a regular one because of the new(ish) layer toggle functionality.

Looking forward to putting this firmware on my GH60 when I get one.

Offline metalliqaz

  • * Maker
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: TMK keyboard firmware
« Reply #13 on: Mon, 08 April 2013, 15:55:22 »
What method does hasu use for supporting N-key rollover?  The multi-keyboard method or the generic HID method?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #14 on: Mon, 08 April 2013, 18:22:46 »
I use 'bitmap' method which assigns a bit per key. I'm not sure about HID terminology for this.
Using 16 byte report size it can send 128 keys at once in fact, it is enough number in most cases.

Multi-keyboard method isn't  used to support NKRO itself, but you'll see two keyboards/endpoints, one for normal 6KRO and other for NKRO to avoid compatibility issue.

Note that NKRO is supported only with PJRC stack at the moment.

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #15 on: Mon, 03 June 2013, 11:54:25 »
I have wired a alps keyboard following the lowpoly method and I want to use your firmware with my teensy 2.0 controller.

how to I attach my matrix to my teensy to work with your firmware?
Which pins get the rows and which get the columns?
I won't be using a capslock led or any led's in fact but a basic understanding of this would be very cool as well.

Sorry for the noob questions but I guess I have to start somewhere.


edit: the post editor is messing with me.
« Last Edit: Thu, 06 June 2013, 00:07:50 by domoaligato »

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
Re: TMK keyboard firmware
« Reply #16 on: Mon, 03 June 2013, 12:06:12 »
domo, Hasu's FW is very flexible in that regard since you can do matrix pin assignments as well as the keymap->matrix assignments on a per-KB basis.

The macway might be your best starting point.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #17 on: Mon, 03 June 2013, 12:35:13 »
ok so I am looking at https://github.com/tmk/tmk_keyboard/blob/master/keyboard/macway/config.h

it states

Code: [Select]
/* matrix size */
#define MATRIX_ROWS 9
#define MATRIX_COLS 8

in what file to I actually map the pins to rows/columns ?

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #19 on: Mon, 03 June 2013, 12:48:31 »
for the 9 rows (I can't believe I missed this)
Code: [Select]
Line 176    // Output low(DDR:1, PORT:0) to select
Line 177    // row: 0    1    2    3    4    5    6    7    8
Line 178    // pin: PD0, PD5, PD7, PF6, PD6, PD1, PD2, PC6, PF7
Line 178-215

which lines have the cols?

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
Re: TMK keyboard firmware
« Reply #20 on: Mon, 03 June 2013, 12:51:21 »
near line 155+  all of Port B
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #21 on: Mon, 03 June 2013, 12:54:23 »
near line 155+  all of Port B

Thank you for being so patient with me!

what is portb ?
« Last Edit: Thu, 06 June 2013, 00:08:09 by domoaligato »

Offline kmiller8

  • Banned
  •  Post Reporting Timeout
  • Posts: 1589
  • Who is that kmiller8 guy?
Re: TMK keyboard firmware
« Reply #22 on: Mon, 03 June 2013, 12:57:23 »
what is portb ?

Every pin with "PBx" (Port, B, Pin#)

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #23 on: Mon, 03 June 2013, 13:04:14 »
what is portb ?

Every pin with "PBx" (Port, B, Pin#)

am I correct to assume that it col 1 = PB0 col2 = PB1 col3 = PB2 etc etc...?

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
Re: TMK keyboard firmware
« Reply #24 on: Mon, 03 June 2013, 13:06:24 »
columns 0-7, but yes.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #25 on: Mon, 03 June 2013, 13:13:30 »
lol yes of course :D matrix starts at 0 - derp @ me!

You guys rock! thanks again. I will post pictures of my project as soon as I get the 20 pin connectors I ordered from pjrc last week.
since they are in portland and I live in the seattle area it should arrive in the next couple days.

keep in mind that this omron/alps iso winkeyless project is a experiment to learn on. I bought the board from a used pc shop and it was very dirty. I have not really cleaned it. it is just to dev and play with :D
« Last Edit: Mon, 03 June 2013, 13:15:28 by domoaligato »

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #26 on: Mon, 03 June 2013, 17:46:40 »
Edit: This is information based on a teensy. I have a teensy 2.0 this is garbage for what I am doing.

I decided that the gh60 firmware was closer to what I needed then the macway device matrix.
based on that... below is the pinouts from the matrix.
would PC0-PC5 be unused pins that I could use for col:14 ?
I have one more column in my matrix then the gh60 due to the way that I hardwired it.


/* Column pin configuration
 * col: 0   1   2   3   4   5   6   7   8   9   10  11  12  13
 * pin: F0  F1  E6  C7  C6  B6  D4  B1  B0  B5  B4  D7  D6  B3
 */
 
 /* Row pin configuration
 * row: 0   1   2   3   4
 * pin: D0  D1  D2  D3  D5
 */
 
L = Left side of Teensy
R = Right Side of Teensy
* = I was unable to find if it is a used PIN.

#   L         #   wire    #   R   #   Wire
#   PB7   #   *           #   PB6   #   col5
#   PD0   #   row0   #   PB5   #   col9
#   PD1   #   row1   #   PB4   #   col10
#   PD2   #   row2   #   PB3   #   col13
#   PD3   #   row3   #   PB2   #   *
#   PD4   #   col6   #   PB1   #   col7
#   PD5   #   row4   #   PB0   #   col8
#   PD6   #   col12   #   PE7   #   *
#   PD7   #   col11   #   PE6   #   col2
#   PE0   #   *      #   GND   #   *
#   PE1   #   *      #   AREF   #   *
#   PC0   #   *      #   PF0   #   col0
#   PC1   #   *      #   PF1   #   col1
#   PC2   #   *      #   PF2   #   *
#   PC3   #   *      #   PF3   #   *
#   PC4   #   *      #   PF4   #   *
#   PC5   #   *      #   PF5   #   *
#   PC6   #   col4   #   PF6   #   *
#   PC7   #   col3   #   PF7   #   *

« Last Edit: Wed, 05 June 2013, 21:38:58 by domoaligato »

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
Re: TMK keyboard firmware
« Reply #27 on: Mon, 03 June 2013, 22:38:34 »
I only recommended macway as it directly uses the teensy :)
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #28 on: Tue, 04 June 2013, 00:15:39 »
What is your matrix size? 5x15? Pics'll be very helpful to know your configuration.

I think you can use PC0-5 safely.
Note that Teensy has LED on PD6, so you won't be able to use this pin for matrix scan.

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #29 on: Tue, 04 June 2013, 02:12:46 »
yeah it is 5x15 :(
here is some pics.

edit: please laugh :D
I am using this to learn.
if I need to rewire the matrix a little I am open to suggestions.

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #30 on: Tue, 04 June 2013, 09:26:51 »
after some sleep...  i can add some cols together...

Offline esoomenona

  • Gnillort?
  • Posts: 5323
Re: TMK keyboard firmware
« Reply #31 on: Tue, 04 June 2013, 21:03:00 »
That's pretty damn sexy! I only laugh at big ass enter. But it fits with the hipster Alps theme.

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #32 on: Wed, 05 June 2013, 00:39:54 »
it is not pretty but i am just using it to learn the firmware/layouts until i get the gh60

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #33 on: Wed, 05 June 2013, 21:28:42 »
What is your matrix size? 5x15? Pics'll be very helpful to know your configuration.

I think you can use PC0-5 safely.
Note that Teensy has LED on PD6, so you won't be able to use this pin for matrix scan.

I am using a teensy 2.0 sorry I should have said this in the beginning.
http://www.pjrc.com/teensy/card2a.pdf

I originally messed up my pinouts.
here is my new updated pinouts.
please let me know what you think.

Edit: I pasted the wrong revision.... here is the corrected version...

L   |   Wire   |   R   |   wire    #
GND   |   *   |   VCC   |   *
PB0   |   row0   |   PF0   |   col6
PB1   |   row1   |   PF1   |   col7
PB2   |   row2   |   PF4   |   col8
PB3   |   row3   |   PF5   |   col9
PB7   |   row4   |   PF6   |   col10
PD0   |   col0   |   PF7   |   col11
PD1   |   col1   |   PB6   |   col12
PD2   |   col2   |   PB5   |   *
PD3   |   col3   |   PB4   |   *
PC6   |   col4   |   PD7   |   *
PC7   |   col5   |   PD6   |   *



« Last Edit: Wed, 05 June 2013, 21:42:47 by domoaligato »

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #34 on: Wed, 05 June 2013, 23:58:42 »
ok I have edited the macway matrix.c
here is a pastebin.
http://paste.ubuntu.com/5737818/

can someone Please show me what I am doing wrong?
« Last Edit: Thu, 06 June 2013, 00:37:07 by domoaligato »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #35 on: Thu, 06 June 2013, 02:12:55 »
It looks read_cols() is good.

You need to edit unselecte_rows() to make row pins(PB0-3,7) Hi-Z state. To make a pin Hi-Z, you need to unset correstpond bits of both DDR and PORT register, in this case DDRB and PORTB.

And select_row() need to be fixed. Use correct register names.

Then, At line 64 in matrix init() you need to configure all column pins as Input with pull-up.



You can access documentation of the controller here: http://www.atmel.com/devices/atmega32u4.aspx?tab=documents
At least you must have this datasheet in hand: http://www.atmel.com/Images/doc7766.pdf

See chapter 10 of the datasheet for control of I/O port. I'll try explain how to use I/O port here, If you can't got this plz feel free to refer to datasheet or use google :)

AVR I/O port is comprised of 8 pins and controlled with some 8bit registers. Some ports have less than 8 pins depending pin configurations of the chip, like PortC and PortF in ATMega32U4.


Pin name convention:
First pin of PortB is named as PB0, second as PB1, ... eighth as PB7.


You can use an I/O pin as either input or output line, first you must configure state of the pin, input or output before use. In fact AVR I/O pin can take four states: Hi-Z, Input with pull-up, Output Lo and Output High. You can decide I/O state per pin, so one port can have input pins and output at same time.

Pin state:
Input(Hi-Z), Input with pull-up, Output Lo, Output Hi

To control pin state you can use DDR*, PORT*, PIN* registers which comprised of 8bit correspond to pin number, where * is port name such like B, D, C or F.

Say you want to make PB2 Hi-Z state, then you should configure correstponding bit of DDRB and PORTB.
                   
    DDRB  &= ~0b00000100;   // clear bit
    PORTB &= ~0b00000100;   // clear bit
                   
To make PB0-3 output lo and PB4-7 Hi-Z state
                   
    DDRB  = 0b00001111;
    PORTB = 0b00000000;
                   
To know PB5 line logic(hi/lo) you should configure it input(with pull-up) then read PINB.
                   
    DDRB  &= ~0b00100000;   // clear bit
    PORTB |=  0b00100000;   // clear bit
                   
    if (PINB & 0b00100000) ... // read corresponding bit of PINB
                   
                   
Pin state configure:       
State               DDR     PORT
---------------------------------
Input(Hi-Z)         0       0
Input pull-up       0       1
Output Lo           1       0
Output Hi           1       1

« Last Edit: Thu, 06 June 2013, 02:17:34 by hasu »

Offline damorgue

  • Posts: 1176
  • Location: Sweden
    • Personal portfolio
Re: TMK keyboard firmware
« Reply #36 on: Fri, 28 June 2013, 00:44:14 »
I didn't know until very recently that macro functionality had been added. Holy crap is it amazing. I think I have everything set up the way I want it now. Some examples of things I have done and inspiration of things which you could do too:

type out emails, addresses, names, phone numbers and other common things

type out username, tab, password, enter

type volume up key a couple of times in a row for other people who like me are annoyed by the 1% increase in volume per click normally

open your music player normalized, eg "shortcut to open program, volume down*100, volume up *30" to always have it start at volume 30, no matter what the volume is set to before


This firmware now has everything that I want from one. Thank you hasu, sincerely.
(if there was one thing I would still like, it would be that macros are aware of the caps lock state of the OS to not make it type out my email in capitals if I have caps lock on. Cherry's firmware has this. I would imagine a simple extra if statement where the macro is defined and it has two macros defined, one if caps lock is OFF and one if it is ON where I would add a simple T(CAPS) at the beginning and at the end)

Edit: If I can understand it enough to use it, then so can everyone else.

Offline Sifo

  • Alter
  • * Exquisite Elder
  • Posts: 7487
  • Location: #GOLDSPRINGS, #LEGITBALLIN
  • Illustrious
Re: TMK keyboard firmware
« Reply #37 on: Fri, 28 June 2013, 00:49:18 »
Yeah man hasu's firmware is the best :D
I love Elzy

Offline damorgue

  • Posts: 1176
  • Location: Sweden
    • Personal portfolio
Re: TMK keyboard firmware
« Reply #38 on: Fri, 28 June 2013, 01:27:02 »
For some reason, T(VOLU) refuses to register in macros. Is that because the media control keys are different and defined in a different way than the letters?

Edit: Also, you added LCAP to complement CAPS. Could you perhaps add LSLC to complement SLCK in the same way to support MX Lock there as well?
« Last Edit: Fri, 28 June 2013, 02:04:12 by damorgue »

Offline yeeeargh

  • Posts: 15
Re: TMK keyboard firmware
« Reply #39 on: Fri, 28 June 2013, 04:03:08 »
Quote from: hasu
OK. Now, I'd like to ask someone else to confirm whether the latest firmware(with my fix) works or not. Can someone check it?

I have a hid_liber built into my filco. not sure what the bug was and how it could be reproduced before the change of the debouncing algorithm but as far as I can tell, the new version works quite well. But I had no problems with debouncing even before the patch though. So if you explain the problem a bit further I can check that for you.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #40 on: Fri, 28 June 2013, 09:06:15 »
yeeeargh, thanks. Very helpful!

Great. Seems that my debouncing fix works. No need to check it further.

Previous algorithm could miss release event and cause a stuck key with typing a key very quickly in some situations.
So I recommend to stick with the latest firmware even if you had no problem so far.



damorgue,
OK. Ah, it liekly has a problem with that media keys. I'll check T(VOLU) later.
And I'll add 'mechanical locking switch support for ScrollLock and NumLock' to my TODO list.

Offline samwisekoi

  • MAWG since 1997
  • * Administrator
  • Posts: 2480
  • Location: Mt. View, California
  • Sorry, moving houses. Be back ASAP.
    • Tweet samwisekoi
Re: TMK keyboard firmware
« Reply #41 on: Fri, 28 June 2013, 09:20:30 »
I didn't know until very recently that macro functionality had been added. Holy crap is it amazing. I think I have everything set up the way I want it now. Some examples of things I have done and inspiration of things which you could do too:

type out emails, addresses, names, phone numbers and other common things

type out username, tab, password, enter

type volume up key a couple of times in a row for other people who like me are annoyed by the 1% increase in volume per click normally

open your music player normalized, eg "shortcut to open program, volume down*100, volume up *30" to always have it start at volume 30, no matter what the volume is set to before


This firmware now has everything that I want from one. Thank you hasu, sincerely.
(if there was one thing I would still like, it would be that macros are aware of the caps lock state of the OS to not make it type out my email in capitals if I have caps lock on. Cherry's firmware has this. I would imagine a simple extra if statement where the macro is defined and it has two macros defined, one if caps lock is OFF and one if it is ON where I would add a simple T(CAPS) at the beginning and at the end)

Edit: If I can understand it enough to use it, then so can everyone else.

Wow!  This will be awesome to use on the GH75 in its full 24-function-key glory!  Twelve normal function keys on the top and another twelve on the left:


Re: GH75 Extending the GH60 to 65% and 75%

 - Ron | samwisekoi
I like keyboards and case modding.  Everything about a computer should be silent -- except the KEYBOARD!

'85 IBM F-122/Soarer Keyboard |  Leopold FC200 TKL (Browns) + GH36 Keypad (Browns/Greens) | GH-122 (Whites/Greens) with Nuclear Data Green keycaps in a Unicomp case

Offline TD22057

  • Posts: 177
  • Location: Southern California
Re: TMK keyboard firmware
« Reply #42 on: Sun, 07 July 2013, 21:45:42 »
I'm building a teensy based keyboard (6x16 matrix) so I started from the macway directory as a base and I'm a little confused on how to define a few of my keys.  In my Fn layer (layer 1), I want to have keys that send normally shifted characters (/*{}-+:" etc).  I can define my KEYMAP ok for the default layer, but how add a shifted key to my Fn layer?  For example, I want to have the U key (normal qwerty) send a shifted left bracket { in the Fn layer.

Do I assign those as FN## keys in the KEYMAP and then do something like:

Code: [Select]
static const uint16_t PROGMEM fn_actions[] = {
   ...
   ACTION_MODS_KEY(MOD_LSFT, KC_LBRACKET),
   };

If that is the answer, I may end up running out of function keys...

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #43 on: Sun, 07 July 2013, 22:47:40 »
I'm building a teensy based keyboard (6x16 matrix) so I started from the macway directory as a base and I'm a little confused on how to define a few of my keys.  In my Fn layer (layer 1), I want to have keys that send normally shifted characters (/*{}-+:" etc).  I can define my KEYMAP ok for the default layer, but how add a shifted key to my Fn layer?  For example, I want to have the U key (normal qwerty) send a shifted left bracket { in the Fn layer.

Do I assign those as FN## keys in the KEYMAP and then do something like:

Code: [Select]
static const uint16_t PROGMEM fn_actions[] = {
   ...
   ACTION_MODS_KEY(MOD_LSFT, KC_LBRACKET),
   };

If that is the answer, I may end up running out of function keys...

You got right answer yourself unfortunately :( No easy way  to define those keymap such like atm. You must use many FN definitions while only 32 FN keys are available.

I thnk your problem shares the same root with this issue. Seems like there are some of demands for this and I should offer something of solution... I'll put this on my TODO list.
https://github.com/tmk/tmk_keyboard/issues/24

Offline TD22057

  • Posts: 177
  • Location: Southern California
Re: TMK keyboard firmware
« Reply #44 on: Mon, 08 July 2013, 00:02:06 »
Ok, thanks. I should be ok with 32 function keys for now.

Are there any examples of how to configure key maps with macro recording keys? I have didn't see any in the current keyboards....

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #45 on: Mon, 08 July 2013, 00:43:27 »
Macro feature is premature, still in development and not documented much. HHKB keymap and source code is only clue this moment.

Macro recording(on the fly) will not be implemented near future, you need to define macros in keymap code and compile it.

Offline TD22057

  • Posts: 177
  • Location: Southern California
Re: TMK keyboard firmware
« Reply #46 on: Wed, 10 July 2013, 20:30:24 »
One more question hasu - for now anyway :)

I'm making a split hand keyboard using a teensy and IO extender (similar to the ergodox).  I was thinking about using your source as a base which seems pretty straightforward.  The Arduino library includes a nice API for using I2C devices (http://arduino.cc/en/Reference/Wire) as well as nice API's for reading and writing the various pins.  Is there any reason not to use the Arduino code in my keyboard module?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #47 on: Wed, 10 July 2013, 21:23:58 »
Arduino libraries are supposed to well tested and engineered by wise people.
Reading them and understand I2C will be optimal for starting point. But I think it might not be easy to use the source with my firmware you should port some arduino core codes the library depends on. I had some hassles to use Arduino USB host library, bothered by name collisions, dependency and different build policy. You can see my struggle at protocol/usb_hid/ and converter/usb_usb/ :)

Try using the library but if you find some difficulty on it I'd recommend to write/rewrite it yourself for you purpose.
« Last Edit: Wed, 10 July 2013, 21:28:24 by hasu »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #48 on: Wed, 10 July 2013, 22:20:27 »
And this also discusses about I2C. It may help you.
https://github.com/tmk/tmk_keyboard/issues/27

Offline damorgue

  • Posts: 1176
  • Location: Sweden
    • Personal portfolio
Re: TMK keyboard firmware
« Reply #49 on: Thu, 11 July 2013, 07:41:36 »
Are there any numpad keys available?