qmk-firmware/tmk_core
James Churchill 28929ad017 Simplify split_common Code significantly (#4772)
* Eliminate separate slave loop

Both master and slave run the standard keyboard_task main loop now.

* Refactor i2c/serial specific code

Simplify some of the preprocessor mess by using common function names.

* Fix missing #endif

* Move direct pin mapping support from miniaxe to split_common

For boards with more pins than sense--sorry, switches.

* Reordering and reformatting only

* Don't run matrix_scan_quantum on slave side

* Clean up the offset/slaveOffset calculations

* Cut undebounced matrix size in half

* Refactor debouncing

* Minor fixups

* Split split_common transport and debounce code into their own files

Can now be replaced with custom versions per keyboard using
CUSTOM_TRANSPORT = yes and CUSTOM_DEBOUNCE = yes

* Refactor debounce for non-split keyboards too

* Update handwired/xealous to build using new split_common

* Fix debounce breaking basic test

* Dodgy method to allow a split kb to only include one of i2c/serial

SPLIT_TRANSPORT = serial or SPLIT_TRANSPORT = i2c will include only
that driver code in the binary.

SPLIT_TRANSPORT = custom (or anything else) will include neither, the
keyboard must supply it's own code

if SPLIT_TRANSPORT is not defined then the original behaviour (include
both avr i2c and serial code) is maintained.

This could be better but it would require explicitly updating all the
existing split keyboards.

* Enable LTO to get lets_split/sockets under the line

* Add docs for SPLIT_TRANSPORT, CUSTOM_MATRIX, CUSTOM_DEBOUNCE

* Remove avr-specific sei() from split matrix_setup

Not needed now that slave doesn't have a separate main loop.
Both sides (on avr) call sei() in lufa's main() after exiting
keyboard_setup().

* Fix QUANTUM_LIB_SRC references and simplify SPLIT_TRANSPORT.

* Add comments and fix formatting.
2019-01-17 10:08:14 -08:00
..
common Simplify split_common Code significantly (#4772) 2019-01-17 10:08:14 -08:00
protocol Improved fix for __always_inline redefinition bug 2019-01-11 17:25:57 -08:00
tool/chibios Normalize line endings 2016-08-20 17:59:18 +03:00
.gitignore Merge commit 'a074364c3731d66b56d988c8a6c960a83ea0e0a1' as 'tmk_core' 2015-04-10 01:32:04 +09:00
.gitmodules Merge commit 'f6d56675f9f981c5464f0ca7a1fbb0162154e8c5' 2015-05-13 11:13:10 +09:00
arm_atsam.mk Massdrop keyboard updates for SEND_STRING, syscalls, stdio, debug prints, Auto Shift (#3973) 2018-09-28 21:32:15 -04:00
avr.mk Add left/right EEPROM flashing for DFU (#4560) 2018-12-14 18:39:54 -08:00
chibios.mk Add delayed flashing option for DFU Util (#4225) 2018-10-27 00:21:43 -04:00
common.mk Use a single endpoint for HID reports (#3951) 2018-11-15 22:22:05 -08:00
ldscript_keymap_avr5.x core: Add keymap section ldscript for ATMega32U2 2015-07-12 05:44:10 +09:00
ldscript_keymap_avr35.x core: Add keymap section ldscript for ATMega32U2 2015-07-12 05:44:10 +09:00
native.mk Fix bitfield problem when compiling in native mingw 2017-07-11 22:05:01 +03:00
protocol.mk Keyboard: Port of TMK XT USB Converter (#3619) 2018-10-22 12:37:03 -07:00
readme.md Fixed dead links (#2451) 2018-03-01 07:45:47 -08:00
ring_buffer.h Tidy up atomicity in timer.c and ring_buffer.h 2016-11-27 22:58:34 -08:00
rules.mk Refactor quantum/split_common/i2c.c, quantum/split_common/serial.c (#4522) 2018-12-14 21:31:56 -08:00

readme.md

TMK Keyboard Firmware Core Library

This is a keyboard firmware library with some useful features for Atmel AVR and Cortex-M.

Source code is available here: https://github.com/tmk/tmk_keyboard/tree/master/tmk_core

Updates

2016/02/10

flabbergast's Chibios protocol was merged from https://github.com/flabbergast/tmk_keyboard/tree/chibios. See protocol/chibios/README.md. Chibios protocol supports Cortex-M such as STM32 and Kinetis.

2015/04/22

separated with TMK Keyboard Firmware Collection

Features

These features can be used in your keyboard.

  • Multi-layer Keymap - Multiple keyboard layouts with layer switching
  • Mouse key - Mouse control with keyboard
  • System Control Key - Power Down, Sleep, Wake Up and USB Remote Wake up
  • Media Control Key - Volume Down/Up, Mute, Next/Prev track, Play, Stop and etc
  • USB NKRO - 248 keys(+ 8 modifiers) simultaneously
  • PS/2 mouse support - PS/2 mouse(TrackPoint) as composite device
  • Keyboard protocols - PS/2, ADB, M0110, Sun and other old keyboard protocols
  • User Function - Customizable function of key with writing code
  • Macro - Very primitive at this time
  • Keyboard Tricks - Oneshot modifier and modifier with tapping feature
  • Debug Console - Messages for debug and interaction with firmware
  • Virtual DIP Switch - Configurations stored EEPROM(Boot Magic)
  • Locking CapsLock - Mechanical switch support for CapsLock
  • Breathing Sleep LED - Sleep indicator with charm during USB suspend
  • Backlight - Control backlight levels

TMK Keyboard Firmware Collection

Complete firmwares for various keyboards and protocol converters.

https://github.com/tmk/tmk_keyboard

License

GPLv2 or later. Some protocol files are under Modified BSD License. LUFA, PJRC and V-USB stack have their own license respectively.

Build Firmware and Program Controller

See doc/build.md.

Start Your Own Project

TBD

Config.h Options

1. USB vendor/product ID and device description

#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0xBEEF
#define MANUFACTURER    t.m.k.
#define PRODUCT         Macway mod
#define DESCRIPTION     t.m.k. keyboard firmware for Macway mod

2. Keyboard matrix configuration

#define MATRIX_ROWS 8
#define MATRIX_COLS 8
#define MATRIX_HAS_GHOST

Architecture

Architecture Diagram
                           +---------------+---------------+-------------+
                           |    Host       |   Keyboard    | Matrix, LED |
   ___________             |-----------+-+ +-------------+ | +-----------|
  /          /| Keys/Mouse | Protocol  |d| | Action      | | | Protocol  |
 /__________/ |<-----------|  LUFA     |r| |  Layer, Tap | | |  Matrix   |
 |.--------.| |   LED      |  V-USB    |i| |-------------| | |  PS/2,IBM |             __________________
 ||        || |----------->|  PJRC     |v| | Keymap      | | |  ADB,M0110|  Keys      / /_/_/_/_/_/_/_/ /|
 ||  Host  || |  Console   |  iWRAP(BT)|e| | Mousekey    | | |  SUN/NEWS |<----------/ /_/_/_/_/_/_/_/ / /
 ||________||/.<-----------|  UART     |r| | Report      | | |  X68K/PC98| Control  / /_/_/_/_/_/_/_/ / /
 `_========_'/|            |---------------------------------------------|-------->/___ /_______/ ___/ /
 |_o______o_|/             | Sendchar, Print, Debug, Command, ...        |         |_________________|/
                           +---------------------------------------------+              Keyboard

Debugging

Use PJRC's hid_listen to see debug messages. You can use the tool for debug even if firmware use LUFA stack.

You can use xprintf() to display debug info on hid_listen, see common/xprintf.h.

Files and Directories

Top

  • common/ - common codes
  • protocol/ - keyboard protocol support
  • doc/ - documents
  • common.mk - Makefile for common
  • protocol.mk - Makefile for protocol
  • rules.mk - Makefile for build rules

Common

  • host.h
  • host_driver.h
  • keyboard.h
  • command.h
  • keymap.h
  • action.h
  • keycode.h
  • matrix.h
  • led.h
  • mousekey.h
  • report.h
  • debug.h
  • print.h
  • bootloader.h
  • sendchar.h
  • timer.h
  • util.h

Keyboard Protocols

  • lufa/ - LUFA USB stack
  • pjrc/ - PJRC USB stack
  • vusb/ - Objective Development V-USB
  • iwrap/ - Bluetooth HID for Bluegiga iWRAP
  • ps2.c - PS/2 protocol
  • adb.c - Apple Desktop Bus protocol
  • m0110.c - Macintosh 128K/512K/Plus keyboard protocol
  • news.c - Sony NEWS keyboard protocol
  • x68k.c - Sharp X68000 keyboard protocol
  • serial_soft.c - Asynchronous Serial protocol implemented by software

Coding Style

  • Doesn't use Tab to indent, use 4-spaces instead.