geekhack

geekhack Projects => Making Stuff Together! => Topic started by: wolfv on Fri, 22 July 2016, 14:38:12

Title: keybrd firmware library for Arduino
Post by: wolfv on Fri, 22 July 2016, 14:38:12
This thread is for keybrd library: project guidance, technical support, and bug reports.
I hope to get questions and feedback from the keyboard community.

NEED HELP?
When asking a technical question, please provide enough information for us to help!
 * Complete sketch (copy & paste, attachment, or a link to the code)
 * Screenshot or the exact text of error messages
 * Describe the observed behavior and explain which behavior you expected
 * Which controller your using
 * Wiring details - how exactly have you connected the hardware (a photo's worth 1000 words)
 * Arduino IDE version number
 * keybrd library version number
 * Any other information needed to reproduce the problem...

RESOURCES
The keybrd library is freely available through GitHub (https://github.com/wolfv6/keybrd) and the Arduino Library Manager (https://www.arduino.cc/en/Guide/LibrariesArduino).

README (https://github.com/wolfv6/keybrd/blob/master/README.md)
tutorials (https://github.com/wolfv6/keybrd/tree/master/tutorials)
keybrd_library_user_guide (https://github.com/wolfv6/keybrd/blob/master/doc/keybrd_library_user_guide.md)
keybrd_library_developer_guide (https://github.com/wolfv6/keybrd/blob/master/doc/keybrd_library_developer_guide.md)
CONTRIBUTING.md (https://github.com/wolfv6/keybrd/blob/master/CONTRIBUTING.md)
    Improvement suggestions (https://github.com/wolfv6/keybrd/blob/master/CONTRIBUTING.md#improvement-suggestions)
    Bug reports (https://github.com/wolfv6/keybrd/blob/master/CONTRIBUTING.md#bug-reports)
    Code contributions (https://github.com/wolfv6/keybrd/blob/master/CONTRIBUTING.md#code-contributions)
    User contributions (https://github.com/wolfv6/keybrd/blob/master/CONTRIBUTING.md#user-contributions)
    Submitting a pull request (https://github.com/wolfv6/keybrd/blob/master/CONTRIBUTING.md#submitting-a-pull-request)
CHANGELOG (https://github.com/wolfv6/keybrd/blob/master/doc/CHANGELOG.md)
PLANNED_FEATURES (https://github.com/wolfv6/keybrd/blob/master/doc/PLANNED_FEATURES.md)
Title: New additions
Post by: wolfv on Fri, 22 July 2016, 14:38:40
NEW ADDITIONS
keybrd version 0.6.0 (2016-09-28)
 * Shift registers
 * I/O expander MCP23S17
 * tutorial_3cde_sublayer_keyboard
 * tutorial_4_connecting_split_keyboards
 * tutorial_4b_split_keyboard_with_shift_registers
 * tutorial_4c_split_keyboard_with_IOE
 * tutorial_5b_LED_on_IOE

Title: Re: keybrd firmware library
Post by: joey on Fri, 22 July 2016, 15:10:02
Interesting, you gave each 'action' a class.
I implemented the same thing in my firmware, but then threw it away for the 'encoding' style that TMK uses.

I had a few issues with it, one being related to static global objects and their constructors that weren't being removed when unused.
The class solution allows you to not compile code when it's not used by the keymap. You can emulate that with defines for the 'encoding' technique, but it's not so clean. Eventually I'll experiment and see if I can find a solution that works 'automagically' for the 'encoding' technique.

Title: Re: keybrd firmware library
Post by: wolfv on Fri, 22 July 2016, 15:35:33
Hi Joey.

What you mean by "action"?
Each key is an object, and each key has a press() and release() action.
Title: Re: keybrd firmware library
Post by: joey on Fri, 22 July 2016, 15:56:04
Hi Joey.

What you mean by "action"?
Each key is an object, and each key has a press() and release() action.
I meant the Code classes.
Title: Re: keybrd firmware library
Post by: wolfv on Fri, 22 July 2016, 16:22:29
Hi Joey.

What you mean by "action"?
Each key is an object, and each key has a press() and release() action.
I meant the Code classes.

Yup. The keybrd library has 14 types of Code.  Single-layer keyboards would only use Code_Sc.
The other 13 Codes are specialized for multi-layer keyboards.
Title: Re: keybrd firmware library for Arduino
Post by: energie on Sun, 12 March 2017, 13:53:06
Hi wolfv,

I'm fairly new at programming and stumbled upon your code. I'm interested in implementing a shift key with a toggle feature similar to caps-locks. Any idea on how to tackle this?
Title: Re: keybrd firmware library for Arduino
Post by: wolfv on Sun, 12 March 2017, 15:02:04
Welcome to the forum energie.

Just to make sure I understand your requirements:
Quote
Toggle MODIFIERKEY_LEFT_SHIFT between press and release by tapping a key named "toggle-shift".
To the user, the behavior appears similar to CapsLock, but it would shift all letters, numbers, keypad, and modifiers like ctrl+shift (CapsLock only effects letters).
Is that what you want?
Title: Re: keybrd firmware library for Arduino
Post by: energie on Wed, 15 March 2017, 02:33:01
Hi wolfv,

Thank you for the warm welcome!

Actually, I used the wrong word. The shift key isn't really a toggle but rather just remaining active for the next keystroke.

For example, after pressing the toggle-shift, the next keystroke (letter or number) will have the alternative character show on screen. Then the shift function is not active anymore for the next keystroke.

This is so that the user doesn't have to hold down the shift key to make the letter capitol or input a symbol.
Title: Re: keybrd firmware library for Arduino
Post by: wolfv on Wed, 15 March 2017, 10:06:28
The shift key isn't really a toggle but rather just remaining active for the next keystroke.

For example, after pressing the toggle-shift, the next keystroke (letter or number) will have the alternative character show on screen. Then the shift function is not active anymore for the next keystroke.

This is so that the user doesn't have to hold down the shift key to make the letter capitol or input a symbol.

That sounds like a "sticky key" feature.  https://en.wikipedia.org/wiki/Sticky_keys
Sticky keys can be activated on most operating systems.
A stickyKey class could also be added to the keybrd firmware library.

"sticky keys" is mentioned in https://github.com/wolfv6/keybrd/blob/master/src/Row.cpp
Sticky mouse buttons are implemented in keybrd_DH firmware https://github.com/wolfv6/keybrd_DH
A stickyKey class would be similar.
Title: Re: keybrd firmware library for Arduino
Post by: energie on Tue, 21 March 2017, 00:12:38
Thanks for the reply wolfv.

Sticky keys is a good solution. Thanks for pointing that out, I never knew what the function of sticky keys were.