summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules8
-rw-r--r--Makefile6
-rw-r--r--docs/ChangeLog/20200530.md239
-rw-r--r--docs/_summary.md1
-rw-r--r--docs/breaking_changes.md45
-rw-r--r--docs/breaking_changes_instructions.md2
-rw-r--r--docs/custom_quantum_functions.md57
-rw-r--r--docs/feature_rgb_matrix.md3
-rw-r--r--docs/ja/custom_quantum_functions.md8
-rw-r--r--docs/tap_hold.md87
-rw-r--r--docs/zh-cn/custom_quantum_functions.md6
-rw-r--r--keyboards/at101_bh/at101_bh.c1
-rw-r--r--keyboards/at101_bh/at101_bh.h (renamed from keyboards/at101_blackheart/at101_blackheart.h)5
-rw-r--r--keyboards/at101_bh/config.h (renamed from keyboards/at101_blackheart/config.h)2
-rw-r--r--keyboards/at101_bh/info.json (renamed from keyboards/at101_blackheart/info.json)4
-rw-r--r--keyboards/at101_bh/keymaps/default/keymap.c (renamed from keyboards/at101_blackheart/keymaps/default/keymap.c)0
-rw-r--r--keyboards/at101_bh/readme.md (renamed from keyboards/at101_blackheart/readme.md)8
-rw-r--r--keyboards/at101_bh/rules.mk (renamed from keyboards/at101_blackheart/rules.mk)0
-rw-r--r--keyboards/at101_blackheart/at101_blackheart.c1
-rw-r--r--keyboards/atomic/keymaps/pvc/keymap.c6
-rw-r--r--keyboards/atreus62/keymaps/atreus52/keymap.c17
-rw-r--r--keyboards/bpiphany/pegasushoof/keymaps/blowrak/keymap.c8
-rwxr-xr-xkeyboards/ckeys/handwire_101/config.h6
-rwxr-xr-xkeyboards/ckeys/handwire_101/rules.mk2
-rw-r--r--keyboards/clueboard/card/keymaps/default/keymap.c3
-rw-r--r--keyboards/clueboard/card/keymaps/default/rules.mk2
-rw-r--r--keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c2
-rw-r--r--keyboards/converter/usb_usb/keymaps/coloneljesus/keymap.c6
-rw-r--r--keyboards/crkbd/keymaps/drashna/keymap.c2
-rw-r--r--keyboards/cu75/cu75.c2
-rw-r--r--keyboards/dm9records/ergoinu/config.h (renamed from keyboards/ergoinu/config.h)0
-rw-r--r--keyboards/dm9records/ergoinu/ergoinu.c (renamed from keyboards/ergoinu/ergoinu.c)0
-rw-r--r--keyboards/dm9records/ergoinu/ergoinu.h (renamed from keyboards/ergoinu/ergoinu.h)0
-rw-r--r--keyboards/dm9records/ergoinu/info.json (renamed from keyboards/ergoinu/info.json)2
-rw-r--r--keyboards/dm9records/ergoinu/keymaps/default/config.h (renamed from keyboards/ergoinu/keymaps/default/config.h)0
-rw-r--r--keyboards/dm9records/ergoinu/keymaps/default/keymap.c (renamed from keyboards/ergoinu/keymaps/default/keymap.c)0
-rw-r--r--keyboards/dm9records/ergoinu/keymaps/default/rules.mk (renamed from keyboards/ergoinu/keymaps/default/rules.mk)0
-rw-r--r--keyboards/dm9records/ergoinu/keymaps/default_jis/config.h (renamed from keyboards/ergoinu/keymaps/default_jis/config.h)0
-rw-r--r--keyboards/dm9records/ergoinu/keymaps/default_jis/keymap.c (renamed from keyboards/ergoinu/keymaps/default_jis/keymap.c)0
-rw-r--r--keyboards/dm9records/ergoinu/keymaps/default_jis/rules.mk (renamed from keyboards/ergoinu/keymaps/default_jis/rules.mk)0
-rw-r--r--keyboards/dm9records/ergoinu/matrix.c (renamed from keyboards/ergoinu/matrix.c)0
-rw-r--r--keyboards/dm9records/ergoinu/readme.md (renamed from keyboards/ergoinu/readme.md)4
-rw-r--r--keyboards/dm9records/ergoinu/rules.mk (renamed from keyboards/ergoinu/rules.mk)4
-rw-r--r--keyboards/dm9records/ergoinu/serial.c (renamed from keyboards/ergoinu/serial.c)0
-rw-r--r--keyboards/dm9records/ergoinu/serial.h (renamed from keyboards/ergoinu/serial.h)0
-rw-r--r--keyboards/dm9records/ergoinu/serial_config.h (renamed from keyboards/ergoinu/serial_config.h)0
-rw-r--r--keyboards/dm9records/ergoinu/split_util.c (renamed from keyboards/ergoinu/split_util.c)0
-rw-r--r--keyboards/dm9records/ergoinu/split_util.h (renamed from keyboards/ergoinu/split_util.h)0
-rw-r--r--keyboards/dm9records/plaid/config.h (renamed from keyboards/plaid/config.h)0
-rw-r--r--keyboards/dm9records/plaid/info.json (renamed from keyboards/plaid/info.json)4
-rw-r--r--keyboards/dm9records/plaid/keymaps/brickbots/config.h (renamed from keyboards/plaid/keymaps/brickbots/config.h)0
-rw-r--r--keyboards/dm9records/plaid/keymaps/brickbots/keymap.c (renamed from keyboards/plaid/keymaps/brickbots/keymap.c)0
-rw-r--r--keyboards/dm9records/plaid/keymaps/brickbots/readme.md (renamed from keyboards/plaid/keymaps/brickbots/readme.md)0
-rw-r--r--keyboards/dm9records/plaid/keymaps/default/config.h (renamed from keyboards/plaid/keymaps/default/config.h)0
-rw-r--r--keyboards/dm9records/plaid/keymaps/default/keymap.c (renamed from keyboards/plaid/keymaps/default/keymap.c)0
-rw-r--r--keyboards/dm9records/plaid/keymaps/default/readme.md (renamed from keyboards/plaid/keymaps/default/readme.md)0
-rw-r--r--keyboards/dm9records/plaid/keymaps/thehalfdeafchef/config.h (renamed from keyboards/plaid/keymaps/thehalfdeafchef/config.h)0
-rw-r--r--keyboards/dm9records/plaid/keymaps/thehalfdeafchef/keymap.c (renamed from keyboards/plaid/keymaps/thehalfdeafchef/keymap.c)0
-rw-r--r--keyboards/dm9records/plaid/keymaps/thehalfdeafchef/readme.md (renamed from keyboards/plaid/keymaps/thehalfdeafchef/readme.md)0
-rw-r--r--keyboards/dm9records/plaid/plaid.c (renamed from keyboards/plaid/plaid.c)0
-rw-r--r--keyboards/dm9records/plaid/plaid.h (renamed from keyboards/plaid/plaid.h)0
-rw-r--r--keyboards/dm9records/plaid/readme.md (renamed from keyboards/plaid/readme.md)4
-rw-r--r--keyboards/dm9records/plaid/rules.mk (renamed from keyboards/plaid/rules.mk)0
-rw-r--r--keyboards/dm9records/tartan/config.h (renamed from keyboards/tartan/config.h)0
-rw-r--r--keyboards/dm9records/tartan/info.json (renamed from keyboards/tartan/info.json)2
-rw-r--r--keyboards/dm9records/tartan/keymaps/default/keymap.c (renamed from keyboards/tartan/keymaps/default/keymap.c)0
-rw-r--r--keyboards/dm9records/tartan/keymaps/default/readme.md (renamed from keyboards/tartan/keymaps/default/readme.md)0
-rw-r--r--keyboards/dm9records/tartan/readme.md (renamed from keyboards/tartan/readme.md)4
-rw-r--r--keyboards/dm9records/tartan/rules.mk (renamed from keyboards/tartan/rules.mk)0
-rw-r--r--keyboards/dm9records/tartan/tartan.c (renamed from keyboards/tartan/tartan.c)0
-rw-r--r--keyboards/dm9records/tartan/tartan.h (renamed from keyboards/tartan/tartan.h)0
-rw-r--r--keyboards/eco/rules.mk2
-rw-r--r--keyboards/ergodox_stm32/keymaps/default/keymap.c4
-rw-r--r--keyboards/ergotravel/keymaps/ckofy/keymap.c23
-rw-r--r--keyboards/gh60/revc/keymaps/robotmaxtron/keymap.c6
-rw-r--r--keyboards/gh60/satan/keymaps/denolfe/keymap.c3
-rw-r--r--keyboards/handwired/ms_sculpt_mobile/keymaps/milestogo/keymap.c1
-rw-r--r--keyboards/hhkb/ansi/ansi.c1
-rw-r--r--keyboards/hhkb/ansi/ansi.h23
-rw-r--r--keyboards/hhkb/ansi/config.h (renamed from keyboards/hhkb/config.h)15
-rw-r--r--keyboards/hhkb/ansi/hhkb_avr.h157
-rw-r--r--keyboards/hhkb/ansi/info.json73
-rw-r--r--keyboards/hhkb/ansi/keymaps/blakedietz/README.md (renamed from keyboards/hhkb/keymaps/blakedietz/README.md)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/blakedietz/config.h (renamed from keyboards/hhkb/keymaps/blakedietz/config.h)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/blakedietz/keymap.c (renamed from keyboards/hhkb/keymaps/blakedietz/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/blakedietz/rules.mk (renamed from keyboards/hhkb/keymaps/blakedietz/rules.mk)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/brett/config.h (renamed from keyboards/hhkb/keymaps/brett/config.h)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/brett/keymap.c (renamed from keyboards/hhkb/keymaps/brett/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/brett/readme.md (renamed from keyboards/hhkb/keymaps/brett/readme.md)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/brett/rules.mk (renamed from keyboards/hhkb/keymaps/brett/rules.mk)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/cinaeco/README.md (renamed from keyboards/hhkb/keymaps/cinaeco/README.md)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/cinaeco/config.h (renamed from keyboards/hhkb/keymaps/cinaeco/config.h)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/cinaeco/keymap.c (renamed from keyboards/hhkb/keymaps/cinaeco/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/cinaeco/rules.mk (renamed from keyboards/hhkb/keymaps/cinaeco/rules.mk)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/dbroqua/keymap.c (renamed from keyboards/hhkb/keymaps/dbroqua/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/dbroqua/readme.md (renamed from keyboards/hhkb/keymaps/dbroqua/readme.md)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/default/keymap.c (renamed from keyboards/hhkb/keymaps/default/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/eric/keymap.c (renamed from keyboards/hhkb/keymaps/eric/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/krusli/config.h (renamed from keyboards/hhkb/keymaps/dhertz/config.h)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/krusli/keymap.c (renamed from keyboards/hhkb/keymaps/krusli/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/lxol/keymap.c (renamed from keyboards/hhkb/keymaps/lxol/keymap.c)16
-rw-r--r--keyboards/hhkb/ansi/keymaps/mjt/config.h (renamed from keyboards/hhkb/keymaps/mjt/config.h)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/mjt/keymap.c (renamed from keyboards/hhkb/keymaps/mjt/keymap.c)3
-rw-r--r--keyboards/hhkb/ansi/keymaps/mjt/readme.md (renamed from keyboards/hhkb/keymaps/mjt/readme.md)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/mjt/rules.mk1
-rw-r--r--keyboards/hhkb/ansi/keymaps/schaeferdev/README.md (renamed from keyboards/hhkb/keymaps/schaeferdev/README.md)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/schaeferdev/config.h (renamed from keyboards/hhkb/keymaps/schaeferdev/config.h)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/schaeferdev/keymap.c (renamed from keyboards/hhkb/keymaps/schaeferdev/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/schaeferdev/rules.mk (renamed from keyboards/hhkb/keymaps/schaeferdev/rules.mk)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.c (renamed from keyboards/hhkb/keymaps/shela/action_pseudo_lut.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.h (renamed from keyboards/hhkb/keymaps/shela/action_pseudo_lut.h)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/config.h (renamed from keyboards/hhkb/keymaps/shela/config.h)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/keymap.c (renamed from keyboards/hhkb/keymaps/shela/keymap.c)11
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/keymap_jis2us.h (renamed from keyboards/hhkb/keymaps/shela/keymap_jis2us.h)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/readme.md (renamed from keyboards/hhkb/keymaps/shela/readme.md)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/rules.mk (renamed from keyboards/hhkb/keymaps/shela/rules.mk)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/smt/keymap.c (renamed from keyboards/hhkb/keymaps/smt/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/tobiasvl_iso/keymap.c (renamed from keyboards/hhkb/keymaps/tobiasvl_iso/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/tobiasvl_iso/readme.md (renamed from keyboards/hhkb/keymaps/tobiasvl_iso/readme.md)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/tominabox1/.gitignore (renamed from keyboards/hhkb/keymaps/tominabox1/.gitignore)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/tominabox1/keymap.c (renamed from keyboards/hhkb/keymaps/tominabox1/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/keymaps/via/keymap.c68
-rw-r--r--keyboards/hhkb/ansi/keymaps/via/rules.mk1
-rw-r--r--keyboards/hhkb/ansi/keymaps/xyverz/keymap.c (renamed from keyboards/hhkb/keymaps/xyverz/keymap.c)0
-rw-r--r--keyboards/hhkb/ansi/matrix.c211
-rw-r--r--keyboards/hhkb/ansi/readme.md14
-rw-r--r--keyboards/hhkb/ansi/rules.mk (renamed from keyboards/hhkb/rules.mk)12
-rw-r--r--keyboards/hhkb/hhkb.c1
-rw-r--r--keyboards/hhkb/jp/config.h104
-rw-r--r--keyboards/hhkb/jp/hhkb_avr.h (renamed from keyboards/hhkb/hhkb_avr.h)13
-rw-r--r--keyboards/hhkb/jp/info.json (renamed from keyboards/hhkb/info.json)67
-rw-r--r--keyboards/hhkb/jp/jp.c1
-rw-r--r--keyboards/hhkb/jp/jp.h (renamed from keyboards/hhkb/hhkb.h)26
-rw-r--r--keyboards/hhkb/jp/keymaps/bakingpy/keymap.c (renamed from keyboards/hhkb/keymaps/bakingpy/keymap.c)0
-rw-r--r--keyboards/hhkb/jp/keymaps/bakingpy/rules.mk (renamed from keyboards/hhkb/keymaps/bakingpy/rules.mk)0
-rw-r--r--keyboards/hhkb/jp/keymaps/default/keymap.c (renamed from keyboards/hhkb/keymaps/jp/keymap.c)0
-rw-r--r--keyboards/hhkb/jp/keymaps/default/rules.mk (renamed from keyboards/hhkb/keymaps/halfqwerty_jp/rules.mk)0
-rw-r--r--keyboards/hhkb/jp/keymaps/default_mac/keymap.c (renamed from keyboards/hhkb/keymaps/jp_mac/keymap.c)0
-rw-r--r--keyboards/hhkb/jp/keymaps/default_mac/rules.mk (renamed from keyboards/hhkb/keymaps/jp/rules.mk)0
-rw-r--r--keyboards/hhkb/jp/keymaps/dhertz/config.h (renamed from keyboards/hhkb/keymaps/krusli/config.h)0
-rw-r--r--keyboards/hhkb/jp/keymaps/dhertz/keymap.c (renamed from keyboards/hhkb/keymaps/dhertz/keymap.c)0
-rw-r--r--keyboards/hhkb/jp/keymaps/dhertz/keymap.h (renamed from keyboards/hhkb/keymaps/dhertz/keymap.h)0
-rw-r--r--keyboards/hhkb/jp/keymaps/dhertz/rules.mk (renamed from keyboards/hhkb/keymaps/dhertz/rules.mk)0
-rw-r--r--keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c (renamed from keyboards/hhkb/keymaps/enoch_jp/keymap.c)0
-rw-r--r--keyboards/hhkb/jp/keymaps/enoch_jp/rules.mk (renamed from keyboards/hhkb/keymaps/enoch_jp/rules.mk)0
-rw-r--r--keyboards/hhkb/jp/keymaps/halfqwerty_jp/README.md (renamed from keyboards/hhkb/keymaps/halfqwerty_jp/README.md)0
-rw-r--r--keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c (renamed from keyboards/hhkb/keymaps/halfqwerty_jp/keymap.c)0
-rw-r--r--keyboards/hhkb/jp/keymaps/halfqwerty_jp/rules.mk (renamed from keyboards/hhkb/keymaps/jp_mac/rules.mk)0
-rw-r--r--keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c (renamed from keyboards/hhkb/keymaps/rdg_jp/keymap.c)0
-rw-r--r--keyboards/hhkb/jp/keymaps/rdg_jp/rules.mk (renamed from keyboards/hhkb/keymaps/rdg_jp/rules.mk)0
-rw-r--r--keyboards/hhkb/jp/keymaps/sh_jp/README.md (renamed from keyboards/hhkb/keymaps/sh_jp/README.md)0
-rw-r--r--keyboards/hhkb/jp/keymaps/sh_jp/keymap.c (renamed from keyboards/hhkb/keymaps/sh_jp/keymap.c)0
-rw-r--r--keyboards/hhkb/jp/keymaps/sh_jp/rules.mk (renamed from keyboards/hhkb/keymaps/sh_jp/rules.mk)0
-rw-r--r--keyboards/hhkb/jp/keymaps/via/config.h2
-rw-r--r--keyboards/hhkb/jp/keymaps/via/keymap.c58
-rw-r--r--keyboards/hhkb/jp/keymaps/via/rules.mk1
-rw-r--r--keyboards/hhkb/jp/matrix.c (renamed from keyboards/hhkb/matrix.c)5
-rw-r--r--keyboards/hhkb/jp/readme.md (renamed from keyboards/hhkb/readme.md)2
-rw-r--r--keyboards/hhkb/jp/rules.mk69
-rw-r--r--keyboards/infinity60/keymaps/jpetermans/keymap.c8
-rw-r--r--keyboards/jd45/keymaps/justin/keymap.c20
-rw-r--r--keyboards/jd45/keymaps/mjt6u/keymap.c4
-rw-r--r--keyboards/keebio/nyquist/keymaps/danielhklein/keymap.c13
-rw-r--r--keyboards/keebio/viterbi/keymaps/bakingpy/keymap.c6
-rw-r--r--keyboards/keebio/viterbi/keymaps/dwallace/keymap.c2
-rw-r--r--keyboards/keebio/viterbi/keymaps/mike808/keymap.c4
-rw-r--r--keyboards/keyboardio/model01/config.h (renamed from keyboards/model01/config.h)0
-rw-r--r--keyboards/keyboardio/model01/info.json (renamed from keyboards/model01/info.json)2
-rw-r--r--keyboards/keyboardio/model01/keymaps/default/config.h (renamed from keyboards/model01/keymaps/default/config.h)0
-rw-r--r--keyboards/keyboardio/model01/keymaps/default/keymap.c (renamed from keyboards/model01/keymaps/default/keymap.c)0
-rw-r--r--keyboards/keyboardio/model01/keymaps/default/readme.md (renamed from keyboards/model01/keymaps/default/readme.md)0
-rw-r--r--keyboards/keyboardio/model01/keymaps/dshields/config.h (renamed from keyboards/model01/keymaps/dshields/config.h)0
-rw-r--r--keyboards/keyboardio/model01/keymaps/dshields/keymap.c (renamed from keyboards/model01/keymaps/dshields/keymap.c)0
-rw-r--r--keyboards/keyboardio/model01/keymaps/dshields/readme.md (renamed from keyboards/model01/keymaps/dshields/readme.md)0
-rw-r--r--keyboards/keyboardio/model01/keymaps/tw1t611/config.h (renamed from keyboards/model01/keymaps/tw1t611/config.h)0
-rw-r--r--keyboards/keyboardio/model01/keymaps/tw1t611/keymap.c (renamed from keyboards/model01/keymaps/tw1t611/keymap.c)0
-rw-r--r--keyboards/keyboardio/model01/keymaps/tw1t611/readme.md (renamed from keyboards/model01/keymaps/tw1t611/readme.md)0
-rw-r--r--keyboards/keyboardio/model01/leds.c (renamed from keyboards/model01/leds.c)0
-rw-r--r--keyboards/keyboardio/model01/leds.h (renamed from keyboards/model01/leds.h)0
-rw-r--r--keyboards/keyboardio/model01/matrix.c (renamed from keyboards/model01/matrix.c)0
-rw-r--r--keyboards/keyboardio/model01/model01.c (renamed from keyboards/model01/model01.c)0
-rw-r--r--keyboards/keyboardio/model01/model01.h (renamed from keyboards/model01/model01.h)0
-rw-r--r--keyboards/keyboardio/model01/readme.md (renamed from keyboards/model01/readme.md)10
-rw-r--r--keyboards/keyboardio/model01/rules.mk (renamed from keyboards/model01/rules.mk)0
-rw-r--r--keyboards/keyboardio/model01/wire-protocol-constants.h (renamed from keyboards/model01/wire-protocol-constants.h)0
-rw-r--r--keyboards/keyboardio/readme.md18
-rw-r--r--keyboards/kinesis/keymaps/milestogo/keymap.c26
-rw-r--r--keyboards/lets_split/keymaps/mjt/keymap.c6
-rw-r--r--keyboards/lets_split/keymaps/piemod/keymap.c20
-rw-r--r--keyboards/lily58/config.h12
-rwxr-xr-xkeyboards/lily58/i2c.c162
-rwxr-xr-xkeyboards/lily58/i2c.h46
-rw-r--r--keyboards/lily58/keymaps/chuan/config.h64
-rw-r--r--keyboards/lily58/keymaps/chuan/keymap.c230
-rw-r--r--keyboards/lily58/keymaps/chuan/rules.mk11
-rw-r--r--keyboards/lily58/keymaps/default/config.h4
-rw-r--r--keyboards/lily58/keymaps/default/keymap.c58
-rw-r--r--keyboards/lily58/keymaps/default/rules.mk4
-rw-r--r--keyboards/lily58/keymaps/yuchi/keymap.c47
-rw-r--r--keyboards/lily58/keymaps/yuchi/rules.mk5
-rw-r--r--keyboards/lily58/lib/glcdfont_lily.c (renamed from keyboards/lily58/lib/glcdfont.c)1
-rw-r--r--keyboards/lily58/lib/host_led_state_reader.c9
-rw-r--r--keyboards/lily58/lib/keylogger.c1
-rw-r--r--keyboards/lily58/lib/layer_state_reader.c8
-rw-r--r--keyboards/lily58/lib/mode_icon_reader.c1
-rw-r--r--keyboards/lily58/lib/timelogger.c1
-rw-r--r--keyboards/lily58/lily58.c7
-rw-r--r--keyboards/lily58/rev1/config.h2
-rw-r--r--keyboards/lily58/rev1/rules.mk3
-rwxr-xr-xkeyboards/lily58/rev1/split_scomm.c91
-rwxr-xr-xkeyboards/lily58/rev1/split_scomm.h24
-rwxr-xr-xkeyboards/lily58/rev1/split_util.h19
-rw-r--r--keyboards/lily58/rules.mk16
-rwxr-xr-xkeyboards/lily58/serial.h84
-rw-r--r--keyboards/lily58/serial_config.h4
-rwxr-xr-xkeyboards/lily58/ssd1306.c344
-rwxr-xr-xkeyboards/lily58/ssd1306.h90
-rw-r--r--keyboards/meira/keymaps/default/keymap.c6
-rw-r--r--keyboards/meira/keymaps/grahampheath/keymap.c6
-rw-r--r--keyboards/meira/keymaps/takmiya/keymap.c2
-rw-r--r--keyboards/meishi/keymaps/default/keymap.c4
-rw-r--r--keyboards/navi10/rev3/rules.mk2
-rw-r--r--keyboards/nomu30/keymaps/center_sprit/keymap.c2
-rw-r--r--keyboards/nomu30/keymaps/like_jis/keymap.c2
-rw-r--r--keyboards/omnikey_bh/config.h (renamed from keyboards/omnikey_blackheart/config.h)0
-rw-r--r--keyboards/omnikey_bh/info.json (renamed from keyboards/omnikey_blackheart/info.json)2
-rw-r--r--keyboards/omnikey_bh/keymaps/default/keymap.c (renamed from keyboards/omnikey_blackheart/keymaps/default/keymap.c)0
-rw-r--r--keyboards/omnikey_bh/omnikey_bh.c1
-rw-r--r--keyboards/omnikey_bh/omnikey_bh.h (renamed from keyboards/omnikey_blackheart/omnikey_blackheart.h)5
-rw-r--r--keyboards/omnikey_bh/readme.md (renamed from keyboards/omnikey_blackheart/readme.md)6
-rw-r--r--keyboards/omnikey_bh/rules.mk (renamed from keyboards/omnikey_blackheart/rules.mk)0
-rw-r--r--keyboards/omnikey_blackheart/omnikey_blackheart.c1
-rw-r--r--keyboards/pancake/feather/readme.md1
-rw-r--r--keyboards/pancake/keymaps/default/readme.md1
-rw-r--r--keyboards/pancake/promicro/readme.md1
-rw-r--r--keyboards/planck/keymaps/ab/keymap.c22
-rw-r--r--keyboards/planck/keymaps/angerthosenear/keymap.c11
-rw-r--r--keyboards/planck/keymaps/austin/keymap.c13
-rw-r--r--keyboards/planck/keymaps/brandon/keymap.c10
-rw-r--r--keyboards/planck/keymaps/chance/keymap.c6
-rw-r--r--keyboards/planck/keymaps/charlie/keymap.c51
-rw-r--r--keyboards/planck/keymaps/circuit/keymap.c10
-rw-r--r--keyboards/planck/keymaps/david/keymap.c12
-rw-r--r--keyboards/planck/keymaps/dr_notsokind/keymap.c10
-rw-r--r--keyboards/planck/keymaps/dzobert/keymap.c10
-rw-r--r--keyboards/planck/keymaps/emilyh/keymap.c16
-rw-r--r--keyboards/planck/keymaps/espynn/keymap.c20
-rw-r--r--keyboards/planck/keymaps/ishtob/keymap.c20
-rw-r--r--keyboards/planck/keymaps/joe/keymap.c21
-rw-r--r--keyboards/planck/keymaps/kyle/keymap.c12
-rw-r--r--keyboards/planck/keymaps/lucas/keymap.c9
-rw-r--r--keyboards/planck/keymaps/matrixman/keymap.c7
-rw-r--r--keyboards/planck/keymaps/max/keymap.c10
-rw-r--r--keyboards/planck/keymaps/mollat/keymap.c4
-rw-r--r--keyboards/planck/keymaps/piemod/keymap.c46
-rw-r--r--keyboards/planck/keymaps/pvc/keymap.c6
-rw-r--r--keyboards/planck/keymaps/that_canadian/keymap.c8
-rwxr-xr-xkeyboards/planck/keymaps/zrichard/keymap.c6
-rw-r--r--keyboards/planck/rev6/config.h1
-rw-r--r--keyboards/planck/rev6/rules.mk2
-rw-r--r--keyboards/preonic/keymaps/that_canadian/keymap.c8
-rw-r--r--keyboards/preonic/rev1/rules.mk2
-rw-r--r--keyboards/preonic/rev2/rules.mk2
-rw-r--r--keyboards/preonic/rev3/config.h1
-rw-r--r--keyboards/preonic/rev3/rules.mk2
-rw-r--r--keyboards/rgbkb/zen/rev1/keymaps/default/keymap.c4
-rw-r--r--keyboards/rgbkb/zen/rev1/keymaps/jwlawrence/keymap.c4
-rw-r--r--keyboards/scarletbandana/rules.mk2
-rw-r--r--keyboards/sck/neiso/rules.mk2
-rw-r--r--keyboards/sentraq/s60_x/keymaps/ansi_qwertz/keymap.c14
-rw-r--r--keyboards/sentraq/s60_x/keymaps/hasu/keymap.c28
-rw-r--r--keyboards/sentraq/s60_x/keymaps/jpec/keymap.c15
-rw-r--r--keyboards/sentraq/s60_x/keymaps/poker/keymap.c34
-rw-r--r--keyboards/sentraq/s60_x/keymaps/poker_bit/keymap.c13
-rw-r--r--keyboards/sentraq/s60_x/keymaps/poker_set/keymap.c12
-rw-r--r--keyboards/sentraq/s60_x/keymaps/spacefn/keymap.c9
-rw-r--r--keyboards/sentraq/s65_x/keymaps/kelorean/keymap.c12
-rw-r--r--keyboards/sentraq/s65_x/keymaps/nall/keymap.c10
-rw-r--r--keyboards/spaceman/2_milk/2_milk.c (renamed from keyboards/2_milk/2_milk.c)0
-rw-r--r--keyboards/spaceman/2_milk/2_milk.h (renamed from keyboards/2_milk/2_milk.h)0
-rw-r--r--keyboards/spaceman/2_milk/config.h (renamed from keyboards/2_milk/config.h)2
-rw-r--r--keyboards/spaceman/2_milk/info.json (renamed from keyboards/2_milk/info.json)2
-rw-r--r--keyboards/spaceman/2_milk/keymaps/binary/keymap.c (renamed from keyboards/2_milk/keymaps/binary/keymap.c)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/binary/readme.md (renamed from keyboards/2_milk/keymaps/binary/readme.md)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/copypasta/keymap.c (renamed from keyboards/2_milk/keymaps/copypasta/keymap.c)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/copypasta/readme.md (renamed from keyboards/2_milk/keymaps/copypasta/readme.md)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/default/keymap.c (renamed from keyboards/2_milk/keymaps/default/keymap.c)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/default/readme.md (renamed from keyboards/2_milk/keymaps/default/readme.md)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/emoji/config.h (renamed from keyboards/2_milk/keymaps/emoji/config.h)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/emoji/keymap.c (renamed from keyboards/2_milk/keymaps/emoji/keymap.c)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/emoji/readme.md (renamed from keyboards/2_milk/keymaps/emoji/readme.md)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/emoji/rules.mk (renamed from keyboards/2_milk/keymaps/emoji/rules.mk)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/excessbread/keymap.c (renamed from keyboards/2_milk/keymaps/excessbread/keymap.c)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/excessbread/readme.md (renamed from keyboards/2_milk/keymaps/excessbread/readme.md)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/mikethetiger/keymap.c (renamed from keyboards/2_milk/keymaps/mikethetiger/keymap.c)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/mikethetiger/readme.md (renamed from keyboards/2_milk/keymaps/mikethetiger/readme.md)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/mikethetiger/rules.mk (renamed from keyboards/2_milk/keymaps/mikethetiger/rules.mk)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/mouse/keymap.c (renamed from keyboards/2_milk/keymaps/mouse/keymap.c)0
-rw-r--r--keyboards/spaceman/2_milk/keymaps/mouse/readme.md (renamed from keyboards/2_milk/keymaps/mouse/readme.md)0
-rw-r--r--keyboards/spaceman/2_milk/readme.md (renamed from keyboards/2_milk/readme.md)6
-rw-r--r--keyboards/spaceman/2_milk/rules.mk (renamed from keyboards/2_milk/rules.mk)0
-rw-r--r--keyboards/spaceman/pancake/config.h (renamed from keyboards/pancake/config.h)0
-rw-r--r--keyboards/spaceman/pancake/feather/config.h (renamed from keyboards/pancake/feather/config.h)0
-rw-r--r--keyboards/spaceman/pancake/feather/rules.mk (renamed from keyboards/pancake/feather/rules.mk)0
-rw-r--r--keyboards/spaceman/pancake/info.json (renamed from keyboards/pancake/info.json)2
-rw-r--r--keyboards/spaceman/pancake/keymaps/default/keymap.c (renamed from keyboards/pancake/keymaps/default/keymap.c)0
-rw-r--r--keyboards/spaceman/pancake/keymaps/default/readme.md3
-rw-r--r--keyboards/spaceman/pancake/pancake.c (renamed from keyboards/pancake/pancake.c)0
-rw-r--r--keyboards/spaceman/pancake/pancake.h (renamed from keyboards/pancake/pancake.h)0
-rw-r--r--keyboards/spaceman/pancake/promicro/config.h (renamed from keyboards/pancake/promicro/config.h)0
-rw-r--r--keyboards/spaceman/pancake/promicro/rules.mk (renamed from keyboards/pancake/promicro/rules.mk)0
-rw-r--r--keyboards/spaceman/pancake/readme.md (renamed from keyboards/pancake/readme.md)4
-rw-r--r--keyboards/subatomic/rules.mk2
-rw-r--r--keyboards/the_royal/liminal/keymaps/default/keymap.c4
-rw-r--r--keyboards/the_royal/liminal/keymaps/default_iso/keymap.c2
-rw-r--r--keyboards/thevankeyboards/minivan/keymaps/like_jis/keymap.c2
-rw-r--r--keyboards/thevankeyboards/minivan/keymaps/mjt/keymap.c12
-rw-r--r--keyboards/thevankeyboards/roadkit/keymaps/mjt/keymap.c6
-rw-r--r--keyboards/tkc1800/config.h5
-rw-r--r--keyboards/tkc1800/i2c.c166
-rw-r--r--keyboards/tkc1800/i2c.h49
-rw-r--r--keyboards/tkc1800/keymaps/default/config.h24
-rw-r--r--keyboards/tkc1800/keymaps/default/keymap.c99
-rw-r--r--keyboards/tkc1800/keymaps/smt/config.h24
-rw-r--r--keyboards/tkc1800/keymaps/smt/keymap.c95
-rw-r--r--keyboards/tkc1800/keymaps/via/keymap.c99
-rw-r--r--keyboards/tkc1800/keymaps/wkl/config.h24
-rw-r--r--keyboards/tkc1800/keymaps/wkl/keymap.c100
-rw-r--r--keyboards/tkc1800/keymaps/yanfali/config.h24
-rw-r--r--keyboards/tkc1800/keymaps/yanfali/keymap.c94
-rw-r--r--keyboards/tkc1800/rules.mk9
-rw-r--r--keyboards/tkc1800/tkc1800.c7
-rw-r--r--keyboards/treadstone32/keymaps/default/keymap.c2
-rw-r--r--keyboards/treadstone32/keymaps/like_jis/keymap.c2
-rw-r--r--keyboards/vision_division/keymaps/default/rules.mk1
-rw-r--r--keyboards/vision_division/rules.mk2
-rw-r--r--keyboards/xd60/keymaps/Jos/keymap.c7
-rw-r--r--keyboards/xd60/keymaps/cheese/keymap.c8
-rw-r--r--keyboards/z150_bh/config.h (renamed from keyboards/z150_blackheart/config.h)0
-rw-r--r--keyboards/z150_bh/info.json (renamed from keyboards/z150_blackheart/info.json)2
-rw-r--r--keyboards/z150_bh/keymaps/default/keymap.c (renamed from keyboards/z150_blackheart/keymaps/default/keymap.c)0
-rw-r--r--keyboards/z150_bh/keymaps/default_tkl/keymap.c (renamed from keyboards/z150_blackheart/keymaps/default_tkl/keymap.c)0
-rw-r--r--keyboards/z150_bh/readme.md (renamed from keyboards/z150_blackheart/readme.md)6
-rw-r--r--keyboards/z150_bh/rules.mk (renamed from keyboards/z150_blackheart/rules.mk)0
-rw-r--r--keyboards/z150_bh/z150_bh.c (renamed from keyboards/z150_blackheart/z150_blackheart.c)2
-rw-r--r--keyboards/z150_bh/z150_bh.h (renamed from keyboards/z150_blackheart/z150_blackheart.h)0
-rw-r--r--keyboards/zinc/config.h25
-rw-r--r--keyboards/zinc/i2c.c162
-rw-r--r--keyboards/zinc/i2c.h49
-rw-r--r--keyboards/zinc/keymaps/default/config.h2
-rw-r--r--keyboards/zinc/keymaps/default/keymap.c26
-rw-r--r--keyboards/zinc/keymaps/default/readme_en.md131
-rw-r--r--keyboards/zinc/keymaps/default/readme_jp.md48
-rw-r--r--keyboards/zinc/keymaps/default/rules.mk57
-rw-r--r--keyboards/zinc/keymaps/ginjake/config.h2
-rw-r--r--keyboards/zinc/keymaps/ginjake/rules.mk48
-rw-r--r--keyboards/zinc/keymaps/monks/config.h2
-rw-r--r--keyboards/zinc/keymaps/monks/keymap.c3
-rw-r--r--keyboards/zinc/keymaps/monks/readme_jp.md2
-rw-r--r--keyboards/zinc/keymaps/monks/rules.mk50
-rw-r--r--keyboards/zinc/keymaps/toshi0383/config.h2
-rw-r--r--keyboards/zinc/keymaps/toshi0383/rules.mk67
-rw-r--r--keyboards/zinc/readme.md6
-rw-r--r--keyboards/zinc/rev1/config.h61
-rw-r--r--keyboards/zinc/rev1/matrix.c357
-rw-r--r--keyboards/zinc/rev1/rev1.c1
-rw-r--r--keyboards/zinc/rev1/rev1.h15
-rw-r--r--keyboards/zinc/rev1/rules.mk5
-rw-r--r--keyboards/zinc/rev1/serial_config.h18
-rw-r--r--keyboards/zinc/rev1/serial_config_simpleapi.h8
-rw-r--r--keyboards/zinc/rev1/split_scomm.c95
-rw-r--r--keyboards/zinc/rev1/split_scomm.h24
-rw-r--r--keyboards/zinc/rev1/split_util.c70
-rw-r--r--keyboards/zinc/rev1/split_util.h19
-rw-r--r--keyboards/zinc/reva/config.h56
-rw-r--r--keyboards/zinc/reva/matrix.c357
-rw-r--r--keyboards/zinc/reva/reva.c1
-rw-r--r--keyboards/zinc/reva/reva.h15
-rw-r--r--keyboards/zinc/reva/rules.mk5
-rw-r--r--keyboards/zinc/reva/serial_config.h18
-rw-r--r--keyboards/zinc/reva/serial_config_simpleapi.h8
-rw-r--r--keyboards/zinc/reva/split_scomm.c95
-rw-r--r--keyboards/zinc/reva/split_scomm.h24
-rw-r--r--keyboards/zinc/reva/split_util.c70
-rw-r--r--keyboards/zinc/reva/split_util.h19
-rw-r--r--keyboards/zinc/rules.mk4
-rw-r--r--keyboards/zinc/serial.c589
-rw-r--r--keyboards/zinc/serial.h84
-rw-r--r--keyboards/zinc/zinc.h6
-rw-r--r--layouts/community/60_iso/unxmaal/keymap.c2
-rw-r--r--layouts/community/ergodox/algernon/keymap.c18
-rw-r--r--layouts/community/ergodox/colemak_osx_pc_no/keymap.c3
-rw-r--r--layouts/community/ergodox/drashna/keymap.c2
-rw-r--r--layouts/community/ergodox/guni/keymap.c19
-rw-r--r--layouts/community/ergodox/kastyle/keymap.c8
-rw-r--r--layouts/community/ergodox/mpiechotka/keymap.c10
-rw-r--r--layouts/community/ergodox/norwegian_programmer_osx_pc/keymap.c3
-rw-r--r--layouts/community/ergodox/norwegian_programmer_osx_pc_colemak/keymap.c3
-rw-r--r--layouts/community/ergodox/townk_osx/keymap.c13
m---------lib/printf0
m---------lib/vusb0
-rw-r--r--message.mk3
-rw-r--r--quantum/audio/audio.h3
-rw-r--r--quantum/audio/audio_avr.c5
-rw-r--r--quantum/rgb_matrix.c106
-rw-r--r--quantum/rgb_matrix.h8
-rw-r--r--quantum/rgb_matrix_animations/breathing_anim.h2
-rw-r--r--quantum/rgb_matrix_animations/digital_rain_anim.h24
-rw-r--r--quantum/rgb_matrix_animations/jellybean_raindrops_anim.h2
-rw-r--r--quantum/rgb_matrix_animations/raindrops_anim.h2
-rw-r--r--quantum/rgb_matrix_animations/typing_heatmap_anim.h28
-rw-r--r--quantum/rgb_matrix_runners/effect_runner_dx_dy.h2
-rw-r--r--quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h2
-rw-r--r--quantum/rgb_matrix_runners/effect_runner_i.h2
-rw-r--r--quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h2
-rw-r--r--quantum/rgb_matrix_types.h7
-rw-r--r--tmk_core/common.mk9
-rw-r--r--tmk_core/common/action.c4
-rw-r--r--tmk_core/common/action_tapping.c6
-rw-r--r--tmk_core/common/action_tapping.h2
-rw-r--r--tmk_core/common/chibios/printf.c233
-rw-r--r--tmk_core/common/chibios/printf.h110
-rw-r--r--tmk_core/common/command.c4
-rw-r--r--tmk_core/common/print.h5
-rw-r--r--tmk_core/protocol/arm_atsam/led_matrix.c2
-rw-r--r--tmk_core/protocol/chibios/main.c3
-rw-r--r--tmk_core/protocol/chibios/usb_main.c5
-rw-r--r--tmk_core/protocol/chibios/usb_main.h2
-rw-r--r--tmk_core/protocol/iwrap.mk18
-rw-r--r--tmk_core/protocol/iwrap/main.c2
-rw-r--r--tmk_core/protocol/vusb.mk16
-rw-r--r--tmk_core/protocol/vusb/main.c4
-rw-r--r--tmk_core/protocol/vusb/sendchar_usart.c2
-rw-r--r--tmk_core/protocol/vusb/usbdrv/Changelog.txt308
-rw-r--r--tmk_core/protocol/vusb/usbdrv/CommercialLicense.txt166
-rw-r--r--tmk_core/protocol/vusb/usbdrv/License.txt361
-rw-r--r--tmk_core/protocol/vusb/usbdrv/Readme.txt172
-rw-r--r--tmk_core/protocol/vusb/usbdrv/USB-ID-FAQ.txt149
-rw-r--r--tmk_core/protocol/vusb/usbdrv/USB-IDs-for-free.txt148
-rw-r--r--tmk_core/protocol/vusb/usbdrv/asmcommon.inc188
-rw-r--r--tmk_core/protocol/vusb/usbdrv/oddebug.c46
-rw-r--r--tmk_core/protocol/vusb/usbdrv/oddebug.h121
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbconfig-prototype.h376
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrv.c622
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrv.h730
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm.S393
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm.asm21
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc393
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm128.inc750
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc423
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm16.inc346
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm165.inc453
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm18-crc.inc707
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc360
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbportability.h146
-rw-r--r--tmk_core/protocol/vusb/vusb.c34
-rw-r--r--users/ericgebhart/ericgebhart.c5
-rw-r--r--users/ninjonas/ninjonas.c2
-rw-r--r--users/ridingqwerty/ridingqwerty.c2
-rw-r--r--users/tominabox1/tominabox1.c2
460 files changed, 2625 insertions, 12712 deletions
diff --git a/.gitmodules b/.gitmodules
index 6d8ab8b946..324ef790d3 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -12,7 +12,13 @@
12 branch = master 12 branch = master
13[submodule "lib/googletest"] 13[submodule "lib/googletest"]
14 path = lib/googletest 14 path = lib/googletest
15 url = https://github.com/google/googletest 15 url = https://github.com/qmk/googletest
16[submodule "lib/lufa"] 16[submodule "lib/lufa"]
17 path = lib/lufa 17 path = lib/lufa
18 url = https://github.com/qmk/lufa 18 url = https://github.com/qmk/lufa
19[submodule "lib/vusb"]
20 path = lib/vusb
21 url = https://github.com/qmk/v-usb
22[submodule "lib/printf"]
23 path = lib/printf
24 url = https://github.com/qmk/printf
diff --git a/Makefile b/Makefile
index 0e57a72a0b..c851e01e73 100644
--- a/Makefile
+++ b/Makefile
@@ -562,14 +562,16 @@ endef
562%: 562%:
563 # Check if we have the CMP tool installed 563 # Check if we have the CMP tool installed
564 cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi; 564 cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;
565 # Ensure that python3 is installed. This check can be removed after python is used in more places. 565 # Ensure that bin/qmk works. This will be a failing check after the next develop merge on 2020 Aug 29.
566 if ! python3 --version 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; fi 566 if ! bin/qmk hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; fi
567 # Check if the submodules are dirty, and display a warning if they are 567 # Check if the submodules are dirty, and display a warning if they are
568ifndef SKIP_GIT 568ifndef SKIP_GIT
569 if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi 569 if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi
570 if [ ! -e lib/chibios-contrib ]; then git submodule sync lib/chibios-contrib && git submodule update --depth 50 --init lib/chibios-contrib; fi 570 if [ ! -e lib/chibios-contrib ]; then git submodule sync lib/chibios-contrib && git submodule update --depth 50 --init lib/chibios-contrib; fi
571 if [ ! -e lib/ugfx ]; then git submodule sync lib/ugfx && git submodule update --depth 50 --init lib/ugfx; fi 571 if [ ! -e lib/ugfx ]; then git submodule sync lib/ugfx && git submodule update --depth 50 --init lib/ugfx; fi
572 if [ ! -e lib/lufa ]; then git submodule sync lib/lufa && git submodule update --depth 50 --init lib/lufa; fi 572 if [ ! -e lib/lufa ]; then git submodule sync lib/lufa && git submodule update --depth 50 --init lib/lufa; fi
573 if [ ! -e lib/vusb ]; then git submodule sync lib/vusb && git submodule update --depth 50 --init lib/vusb; fi
574 if [ ! -e lib/printf ]; then git submodule sync lib/printf && git submodule update --depth 50 --init lib/printf; fi
573 git submodule status --recursive 2>/dev/null | \ 575 git submodule status --recursive 2>/dev/null | \
574 while IFS= read -r x; do \ 576 while IFS= read -r x; do \
575 case "$$x" in \ 577 case "$$x" in \
diff --git a/docs/ChangeLog/20200530.md b/docs/ChangeLog/20200530.md
new file mode 100644
index 0000000000..9def9ae123
--- /dev/null
+++ b/docs/ChangeLog/20200530.md
@@ -0,0 +1,239 @@
1# QMK Breaking Change - 2020 May 30 Changelog
2
3Four times a year QMK runs a process for merging Breaking Changes. A Breaking Change is any change which modifies how QMK behaves in a way that is incompatible or potentially dangerous. We limit these changes to 4 times per year so that users can have confidence that updating their QMK tree will not break their keymaps.
4
5The list of changes follows.
6
7
8## Core Changes
9
10### Converting V-USB usbdrv to a submodule
11
12[#8321](https://github.com/qmk/qmk_firmware/pull/8321) and [qmk_compiler#62](https://github.com/qmk/qmk_compiler/pull/62).
13
14These PRs move the V-USB driver code out of the qmk_firmware repository and into a submodule pointed at https://github.com/obdev/v-usb. This will make it easier to update the codebase if needed, while applying any potential QMK-specific modifications by forking it to the QMK GitHub organization.
15
16### Unify Tap Hold functions and documentation
17
18[#8348](https://github.com/qmk/qmk_firmware/pull/8348)
19
20Updates all of the per key tap-hold functions to pass the `keyrecord_t` structure, and include documentation changes.
21
22Any remaining versions or code outside of the main repo will need to be converted:
23| Old function | New Function |
24|------------------------------------------------------|---------------------------------------------------------------------------|
25|`uint16_t get_tapping_term(uint16_t keycode)` |`uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record)` |
26|`bool get_ignore_mod_tap_interrupt(uint16_t keycode)` |`bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record)` |
27
28### Python Required In The Build Process
29
30[#9000](https://github.com/qmk/qmk_firmware/pull/9000)
31
32This is the last release of QMK that will work without having Python 3.6 (or later) installed. If your environment is not fully setup you will get a warning instructing you to set it up.
33
34After the next breaking change you will not be able to build if `bin/qmk hello` does not work.
35
36### Upgrade from tinyprintf to mpaland/printf
37
38[#8269](https://github.com/qmk/qmk_firmware/pull/8269)
39
40- Provides debug functionality on ChibiOS/ARM that is more compliant than previous integrations.
41- Less maintenence, fewer QMK customisations, and allows QMK to sidestep previous compile and runtime issues.
42- A `make git-submodule` may be required after pulling the latest QMK Firmware code to update to the new dependency.
43
44### Fixed RGB_DISABLE_AFTER_TIMEOUT to be seconds based & small internals cleanup
45
46[#6480](https://github.com/qmk/qmk_firmware/pull/6480)
47
48- Changes `RGB_DISABLE_AFTER_TIMEOUT` to be based on milliseconds instead of ticks.
49- Includes a code cleanup, resulting in a savings of 100 bytes, depending on features used.
50- Fixed issues with timeouts / suspending at the wrong time not turning off all LEDs in some cases.
51
52The `RGB_DISABLE_AFTER_TIMEOUT` definition is now deprecated, and has been superseded by `RGB_DISABLE_TIMEOUT`. To use the new definition, rename `RGB_DISABLE_AFTER_TIMEOUT` to `RGB_DISABLE_TIMEOUT` in your `config.h` file, and multiply the value set by 1200.
53
54Before: `#define RGB_DISABLE_AFTER_TIMEOUT 100`
55After: `#define RGB_DISABLE_TIMEOUT 120000`
56
57### Switch to qmk forks for everything
58
59[#9019](https://github.com/qmk/qmk_firmware/pull/9019)
60
61Fork all QMK submodules to protect against upstream repositories disappearing.
62
63### code cleanup regarding deprecated macro PLAY_NOTE_ARRAY by replacing it with PLAY_SONG
64
65[#8484](https://github.com/qmk/qmk_firmware/pull/8484)
66
67Removes the deprecated `PLAY_NOTE_ARRAY` macro. References to it are replaced with `PLAY_SONG`, which references the same function.
68
69### fixing wrong configuration of AUDIO feature
70
71[#8903](https://github.com/qmk/qmk_firmware/pull/8903) and [#8974](https://github.com/qmk/qmk_firmware/pull/8974)
72
73`audio_avr.c` does not default to any pin; there has to be a #define XX_AUDIO in config.h at some level for Audio to actually work. Otherwise, the Audio code ends up cluttering the firmware, possibly breaking builds because the maximum allowed firmware size is exceeded.
74
75These changes fix this by disabling Audio on keyboards that have the feature misconfigured, and therefore non-functional.
76
77Also, add a compile-time error to alert the user to a missing pin-configuration (on AVR boards) when `AUDIO_ENABLE = yes` is set.
78
79
80## Keyboard Refactors
81
82### Migrating Lily58 to use split_common
83
84[#6260](https://github.com/qmk/qmk_firmware/pull/6260)
85
86Modifies the default firmware for Lily58 to use the `split_common` library, instead of including and depending on its own set of libraries for the following functionality:
87
88- SSD1306 display
89- i2c for OLED
90- Serial Communication
91
92This allows current lily58 firmware to advance with updates to the `split_common` library, which is shared with many other split keyboards.
93
94#### To migrate existing Lily58 firmware:
95
96[Changes to `config.h`](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-445ac369c8717dcd6fc6fc3630836fc1):
97- Remove `#define SSD1306OLED` from config.h
98
99
100[Changes to `keymap.c`](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-20943ea59856e9bdf3d99ecb2eee40b7):
101- Find/Replace each instance of `#ifdef SSD1306OLED` with `#ifdef OLED_DRIVER_ENABLE`
102- The following changes are for compatibility with the OLED driver. If you don't use the OLED driver you may safely delete [this section](https://github.com/qmk/qmk_firmware/blob/e6b9980bd45c186f7360df68c24b6e05a80c10dc/keyboards/lily58/keymaps/default/keymap.c#L144-L190)
103- Alternatively, if you did not change the OLED code from that in `default`, you may find it easier to simply copy the [relevant section](https://github.com/qmk/qmk_firmware/blob/4ac310668501ae6786c711ecc8f01f62ddaa1c0b/keyboards/lily58/keymaps/default/keymap.c#L138-L172). Otherwise, the changes you need to make are as follows (sample change [here](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-20943ea59856e9bdf3d99ecb2eee40b7R138-R173))
104- [Remove](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-20943ea59856e9bdf3d99ecb2eee40b7L138-L141) the block
105```c
106#ifdef SSD1306OLED
107 iota_gfx_init(!has_usb()); // turns on the display
108#endif
109```
110- Within the block bounded by `#ifdef OLED_DRIVER_ENABLE` and `#endif // OLED_DRIVER_ENABLE`, add the following block to ensure that your two OLEDs are rotated correctly across the left and right sides:
111```c
112oled_rotation_t oled_init_user(oled_rotation_t rotation) {
113 if (!is_keyboard_master())
114 return OLED_ROTATION_180; // flips the display 180 degrees if offhand
115 return rotation;
116}
117```
118- Remove the functions `matrix_scan_user`, `matrix_update` and `iota_gfx_task_user`
119- Find/Replace `matrix_render_user(struct CharacterMatrix *matrix)` with `iota_gfx_task_user(void)`
120- Find/Replace `is_master` with `is_keyboard_master()`
121- For each instance of `matrix_write_ln(matrix, display_fn())`, rewrite it as `oled_write_ln(read_layer_state(), false);`
122- For each instance of `matrix_write(matrix, read_logo());`, replace with `oled_write(read_logo(), false);`
123
124### Refactor zinc to use split_common
125
126[#7114](https://github.com/qmk/qmk_firmware/pull/7114) and [#9171](https://github.com/qmk/qmk_firmware/pull/9171)
127
128* Refactor to use split_common and remove split codes under the zinc/revx/
129* Add - backlight RGB LED and/or underglow RGB LED option
130* Add - continuous RGB animations feature (between L and R halves)
131* Fix - keymap files to adapt to changes
132 * all authors of keymaps confirmed this PR
133* Update - documents and rules.mk
134
135### Refactor of TKC1800 to use common OLED code
136
137[#8472](https://github.com/qmk/qmk_firmware/pull/8472)
138
139Modifies the default firmware for TKC1800 to use the in-built I2C and OLED drivers, instead of including and depending on its own set of libraries for the following functionality:
140
141- SSD1306 display
142- i2c for OLED
143
144This allows current TKC1800 firmware to advance with updates to those drivers, which are shared with other keyboards.
145
146#### To migrate existing TKC1800 firmware:
147
148[Changes to `config.h`](https://github.com/qmk/qmk_firmware/pull/8472/files#diff-d10b26e676b4a55cbb00d71955116526):
149- Remove `#define SSD1306OLED` from config.h
150
151[Changes to `tkc1800.c`](https://github.com/qmk/qmk_firmware/pull/8472/files#diff-3b35bd30abe89c8110717c6972cd2cc5):
152- Add the following to avoid debug errors on HID_listen if the screen is not present
153```c
154void keyboard_pre_init_kb(void) {
155 setPinInputHigh(D0);
156 setPinInputHigh(D1);
157
158 keyboard_pre_init_user();
159}
160```
161
162[Changes to `keymap.c`](https://github.com/qmk/qmk_firmware/pull/8472/files#diff-05a2a344ce27e4d045fe68520ccd4771):
163- Find/Replace each instance of `#ifdef SSD1306OLED` with `#ifdef OLED_DRIVER_ENABLE`
164- The following changes are for compatibility with the OLED driver. If you don't use the OLED driver you may safely delete [this section](https://github.com/qmk/qmk_firmware/blob/e6b9980bd45c186f7360df68c24b6e05a80c10dc/keyboards/lily58/keymaps/default/keymap.c#L144-L190)
165- [Remove](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-20943ea59856e9bdf3d99ecb2eee40b7L91-L158) the block
166```c
167#ifdef SSD1306OLED
168 iota_gfx_init(!has_usb()); // turns on the display
169#endif
170```
171- Within the block bounded by `#ifdef OLED_DRIVER_ENABLE` and `#endif // OLED_DRIVER_ENABLE`, add the following block to ensure that your two OLEDs are rotated correctly across the left and right sides:
172```c
173oled_rotation_t oled_init_user(oled_rotation_t rotation) {
174 if (!is_keyboard_master())
175 return OLED_ROTATION_180; // flips the display 180 degrees if offhand
176 return rotation;
177}
178```
179- Remove the function `iota_gfx_task_user`
180
181### Split HHKB to ANSI and JP layouts and Add VIA support for each
182
183[#8582](https://github.com/qmk/qmk_firmware/pull/8582)
184
185- Splits the HHKB codebase into two separate folders `keyboards/hhkb/ansi` and `keyboards/hhkb/jp`.
186- Adds VIA Configurator support for both versions.
187
188#### Migrating existing HHKB keymaps
189
190- Remove any checks for the `HHKB_JP` definition
191 - All checks for this definition have been removed, and each version uses the source that is appropriate to that version.
192- Move the directory for your keymap into the appropriate `keymaps` directory
193 - `keyboards/hhkb/ansi/keymaps/` for ANSI HHKBs
194 - `keyboards/hhkb/jp/keymaps/` for HHKB JPs
195- Compile with the new keyboard names
196 - This PR changes the compilation instructions for the HHKB Alternate Controller. To compile firmware for this controller moving forward, use:
197 - `make hhkb/ansi` for ANSI-layout HHKBs
198 - `make hhkb/jp` for HHKB JP keyboards
199
200
201## Keyboard Moves
202
203- [#8412](https://github.com/qmk/qmk_firmware/pull/8412 "Changing board names to prevent confusion") by blindassassin111
204- [#8499](https://github.com/qmk/qmk_firmware/pull/8499 "Move the Keyboardio Model01 to a keyboardio/ subdir") by algernon
205- [#8830](https://github.com/qmk/qmk_firmware/pull/8830 "Move spaceman keyboards") by Spaceman (formerly known as Rionlion100)
206- [#8537](https://github.com/qmk/qmk_firmware/pull/8537 "Organizing my keyboards (plaid, tartan, ergoinu)") by hsgw
207
208Keyboards by Keyboardio, Spaceman, and hsgw move to vendor folders, while PCBs designed by blindassassin111 are renamed.
209
210Old Name | New Name
211:----------------- | :-----------------
2122_milk | spaceman/2_milk
213at101_blackheart | at101_bh
214ergoinu | dm9records/ergoinu
215model01 | keyboardio/model01
216omnikey_blackheart | omnikey_bh
217pancake | spaceman/pancake
218plaid | dm9records/plaid
219tartan | dm9records/tartan
220z150_blackheart | z150_bh
221
222If you own one of these PCBs, please use the new names to compile your firmware moving forward.
223
224
225## Keycode Migration PRs
226
227[#8954](https://github.com/qmk/qmk_firmware/pull/8954 "Migrate `ACTION_LAYER_TOGGLE` to `TG()`"), [#8957](https://github.com/qmk/qmk_firmware/pull/8957 "Migrate `ACTION_MODS_ONESHOT` to `OSM()`"), [#8958](https://github.com/qmk/qmk_firmware/pull/8958 "Migrate `ACTION_DEFAULT_LAYER_SET` to `DF()`"), [#8959](https://github.com/qmk/qmk_firmware/pull/8959 "Migrate `ACTION_LAYER_MODS` to `LM()`"), [#8968](https://github.com/qmk/qmk_firmware/pull/8968 "Migrate `ACTION_MODS_TAP_KEY` to `MT()`"), [#8977](https://github.com/qmk/qmk_firmware/pull/8977 "Migrate miscellaneous `fn_actions` entries"), and [#8979](https://github.com/qmk/qmk_firmware/pull/8979 "Migrate `ACTION_MODS_KEY` to chained mod keycodes")
228
229Authored by fauxpark, these pull requests remove references to deprecated TMK macros that have been superseded by native QMK keycodes.
230
231Old `fn_actions` action | New QMK keycode
232:---------------------- | :--------------
233`ACTION_DEFAULT_LAYER_SET(layer)` | `DF(layer)`
234`ACTION_LAYER_MODS(layer, mod)` | `LM(layer, mod)`
235`ACTION_LAYER_ONESHOT(mod)` | `OSL(mod)`
236`ACTION_LAYER_TOGGLE(layer)` | `TG(layer)`
237`ACTION_MODS_ONESHOT(mod)` | `OSM(mod)`
238`ACTION_MODS_TAP_KEY(mod, kc)` | `MT(mod, kc)`
239`ACTION_MODS_KEY(mod, kc)`<br>e.g. `ACTION_MODS_KEY(MOD_LCTL, KC_0)` | `MOD(kc)`<br>e.g. `LCTL(KC_0)`
diff --git a/docs/_summary.md b/docs/_summary.md
index b3553b4285..1b6ddc67ca 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -115,6 +115,7 @@
115 * [Overview](breaking_changes.md) 115 * [Overview](breaking_changes.md)
116 * [My Pull Request Was Flagged](breaking_changes_instructions.md) 116 * [My Pull Request Was Flagged](breaking_changes_instructions.md)
117 * History 117 * History
118 * [2020 May 30](ChangeLog/20200530.md)
118 * [2020 Feb 29](ChangeLog/20200229.md) 119 * [2020 Feb 29](ChangeLog/20200229.md)
119 * [2019 Aug 30](ChangeLog/20190830.md) 120 * [2019 Aug 30](ChangeLog/20190830.md)
120 121
diff --git a/docs/breaking_changes.md b/docs/breaking_changes.md
index 6c684970d8..154695ddac 100644
--- a/docs/breaking_changes.md
+++ b/docs/breaking_changes.md
@@ -6,27 +6,28 @@ The breaking change period is when we will merge PR's that change QMK in dangero
6 6
7## What has been included in past Breaking Changes? 7## What has been included in past Breaking Changes?
8 8
9* [2020 May 30](ChangeLog/20200530.md)
9* [2020 Feb 29](ChangeLog/20200229.md) 10* [2020 Feb 29](ChangeLog/20200229.md)
10* [2019 Aug 30](ChangeLog/20190830.md) 11* [2019 Aug 30](ChangeLog/20190830.md)
11 12
12## When is the next Breaking Change? 13## When is the next Breaking Change?
13 14
14The next Breaking Change is scheduled for May 30, 2020. 15The next Breaking Change is scheduled for Aug 29, 2020.
15 16
16### Important Dates 17### Important Dates
17 18
18* [x] 2020 Feb 29 - `future` is created. It will be rebased weekly. 19* [x] 2020 May 30 - `develop` is created. It will be rebased weekly.
19* [ ] 2020 May 2 - `future` closed to new PR's. 20* [ ] 2020 Aug 1 - `develop` closed to new PR's.
20* [ ] 2020 May 2 - Call for testers. 21* [ ] 2020 Aug 1 - Call for testers.
21* [ ] 2020 May 28 - `master` is locked, no PR's merged. 22* [ ] 2020 Aug 27 - `master` is locked, no PR's merged.
22* [ ] 2020 May 30 - Merge `future` to `master`. 23* [ ] 2020 Aug 29 - Merge `develop` to `master`.
23* [ ] 2020 May 30 - `master` is unlocked. PR's can be merged again. 24* [ ] 2020 Aug 29 - `master` is unlocked. PR's can be merged again.
24 25
25## What changes will be included? 26## What changes will be included?
26 27
27To see a list of breaking change candidates you can look at the [`breaking_change` label](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+label%3Abreaking_change+is%3Apr). New changes might be added between now and when `future` is closed, and a PR with that label applied is not guaranteed to be merged. 28To see a list of breaking change candidates you can look at the [`breaking_change` label](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+label%3Abreaking_change+is%3Apr). New changes might be added between now and when `develop` is closed, and a PR with that label applied is not guaranteed to be merged.
28 29
29If you want your breaking change to be included in this round you need to create a PR with the `breaking_change` label and have it accepted before `future` closes. After `future` closes no new breaking changes will be accepted. 30If you want your breaking change to be included in this round you need to create a PR with the `breaking_change` label and have it accepted before `develop` closes. After `develop` closes no new breaking changes will be accepted.
30 31
31Criteria for acceptance: 32Criteria for acceptance:
32 33
@@ -37,9 +38,9 @@ Criteria for acceptance:
37 38
38This section documents various processes we use when running the Breaking Changes process. 39This section documents various processes we use when running the Breaking Changes process.
39 40
40## Rebase `future` from `master` 41## Rebase `develop` from `master`
41 42
42This is run every Friday while `future` is open. 43This is run every Friday while `develop` is open.
43 44
44Process: 45Process:
45 46
@@ -47,31 +48,31 @@ Process:
47cd qmk_firmware 48cd qmk_firmware
48git checkout master 49git checkout master
49git pull --ff-only 50git pull --ff-only
50git checkout future 51git checkout develop
51git rebase master 52git rebase master
52git push --force 53git push --force
53``` 54```
54 55
55## Creating the `future` branch 56## Creating the `develop` branch
56 57
57This happens immediately after the previous `future` branch is merged. 58This happens immediately after the previous `develop` branch is merged.
58 59
59* `qmk_firmware` git commands 60* `qmk_firmware` git commands
60 * [ ] `git checkout master` 61 * [ ] `git checkout master`
61 * [ ] `git pull --ff-only` 62 * [ ] `git pull --ff-only`
62 * [ ] `git checkout -b future` 63 * [ ] `git checkout -b develop`
63 * [ ] Edit `readme.md` 64 * [ ] Edit `readme.md`
64 * [ ] Add a big notice at the top that this is a testing branch. 65 * [ ] Add a big notice at the top that this is a testing branch.
65 * [ ] Include a link to this document 66 * [ ] Include a link to this document
66 * [ ] `git commit -m 'Branch point for <DATE> Breaking Change'` 67 * [ ] `git commit -m 'Branch point for <DATE> Breaking Change'`
67 * [ ] `git tag breakpoint_<YYYY>_<MM>_<DD>` 68 * [ ] `git tag breakpoint_<YYYY>_<MM>_<DD>`
68 * [ ] `git tag <next_version>` # Prevent the breakpoint tag from confusing version incrementing 69 * [ ] `git tag <next_version>` # Prevent the breakpoint tag from confusing version incrementing
69 * [ ] `git push origin future` 70 * [ ] `git push origin develop`
70 * [ ] `git push --tags` 71 * [ ] `git push --tags`
71 72
72## 4 Weeks Before Merge 73## 4 Weeks Before Merge
73 74
74* `future` is now closed to new PR's, only fixes for current PR's may be merged 75* `develop` is now closed to new PR's, only fixes for current PR's may be merged
75* Post call for testers 76* Post call for testers
76 * [ ] Discord 77 * [ ] Discord
77 * [ ] GitHub PR 78 * [ ] GitHub PR
@@ -94,15 +95,15 @@ This happens immediately after the previous `future` branch is merged.
94## Day Of Merge 95## Day Of Merge
95 96
96* `qmk_firmware` git commands 97* `qmk_firmware` git commands
97 * [ ] `git checkout future` 98 * [ ] `git checkout develop`
98 * [ ] `git pull --ff-only` 99 * [ ] `git pull --ff-only`
99 * [ ] `git rebase origin/master` 100 * [ ] `git rebase origin/master`
100 * [ ] Edit `readme.md` 101 * [ ] Edit `readme.md`
101 * [ ] Remove the notes about `future` 102 * [ ] Remove the notes about `develop`
102 * [ ] Roll up the ChangeLog into one file. 103 * [ ] Roll up the ChangeLog into one file.
103 * [ ] `git commit -m 'Merge point for <DATE> Breaking Change'` 104 * [ ] `git commit -m 'Merge point for <DATE> Breaking Change'`
104 * [ ] `git push origin future` 105 * [ ] `git push origin develop`
105* GitHub Actions 106* GitHub Actions
106 * [ ] Create a PR for `future` 107 * [ ] Create a PR for `develop`
107 * [ ] Make sure travis comes back clean 108 * [ ] Make sure travis comes back clean
108 * [ ] Merge `future` PR 109 * [ ] Merge `develop` PR
diff --git a/docs/breaking_changes_instructions.md b/docs/breaking_changes_instructions.md
index 3f2f93834f..d835671556 100644
--- a/docs/breaking_changes_instructions.md
+++ b/docs/breaking_changes_instructions.md
@@ -27,7 +27,7 @@ If you are contributing core code, and the only reason it needs to go through br
27 27
28We require submissions that go through the Breaking Change process to include a changelog entry. The entry should be a short summary of the changes your pull request makes &ndash; [each section here started as a changelog](ChangeLog/20190830.md "n.b. This should link to the 2019 Aug 30 Breaking Changes doc - @noroadsleft"). 28We require submissions that go through the Breaking Change process to include a changelog entry. The entry should be a short summary of the changes your pull request makes &ndash; [each section here started as a changelog](ChangeLog/20190830.md "n.b. This should link to the 2019 Aug 30 Breaking Changes doc - @noroadsleft").
29 29
30Your changelog should be located at `docs/ChangeLog/YYYYMMDD/PR####.md`, where `YYYYMMDD` is the date on which QMK's breaking change branch &ndash; usually named `future` &ndash; will be merged into the `master` branch, and `####` is the number of your pull request. 30Your changelog should be located at `docs/ChangeLog/YYYYMMDD/PR####.md`, where `YYYYMMDD` is the date on which QMK's breaking change branch &ndash; usually named `develop` &ndash; will be merged into the `master` branch, and `####` is the number of your pull request.
31 31
32If your submission requires action on the part of users, your changelog should instruct users what action(s) must be taken, or link to a location that does so. 32If your submission requires action on the part of users, your changelog should instruct users what action(s) must be taken, or link to a location that does so.
33 33
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md
index 84ae589ed6..6eb144af76 100644
--- a/docs/custom_quantum_functions.md
+++ b/docs/custom_quantum_functions.md
@@ -57,7 +57,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
57 case KC_ENTER: 57 case KC_ENTER:
58 // Play a tone when enter is pressed 58 // Play a tone when enter is pressed
59 if (record->event.pressed) { 59 if (record->event.pressed) {
60 PLAY_NOTE_ARRAY(tone_qwerty); 60 PLAY_SONG(tone_qwerty);
61 } 61 }
62 return true; // Let QMK send the enter press/release events 62 return true; // Let QMK send the enter press/release events
63 default: 63 default:
@@ -438,7 +438,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
438 case KC_ENTER: 438 case KC_ENTER:
439 // Play a tone when enter is pressed 439 // Play a tone when enter is pressed
440 if (record->event.pressed) { 440 if (record->event.pressed) {
441 PLAY_NOTE_ARRAY(tone_qwerty); 441 PLAY_SONG(tone_qwerty);
442 } 442 }
443 return true; // Let QMK send the enter press/release events 443 return true; // Let QMK send the enter press/release events
444 case RGB_LYR: // This allows me to use underglow as layer indication, or as normal 444 case RGB_LYR: // This allows me to use underglow as layer indication, or as normal
@@ -486,56 +486,3 @@ And you're done. The RGB layer indication will only work if you want it to. And
486* Keymap: `void eeconfig_init_user(void)`, `uint32_t eeconfig_read_user(void)` and `void eeconfig_update_user(uint32_t val)` 486* Keymap: `void eeconfig_init_user(void)`, `uint32_t eeconfig_read_user(void)` and `void eeconfig_update_user(uint32_t val)`
487 487
488The `val` is the value of the data that you want to write to EEPROM. And the `eeconfig_read_*` function return a 32 bit (DWORD) value from the EEPROM. 488The `val` is the value of the data that you want to write to EEPROM. And the `eeconfig_read_*` function return a 32 bit (DWORD) value from the EEPROM.
489
490# Custom Tapping Term
491
492By default, the tapping term and related options (such as `IGNORE_MOD_TAP_INTERRUPT`) are defined globally, and are not configurable by key. For most users, this is perfectly fine. But in some cases, dual function keys would be greatly improved by different timeout behaviors than `LT` keys, or because some keys may be easier to hold than others. Instead of using custom key codes for each, this allows for per key configurable timeout behaviors.
493
494There are two configurable options to control per-key timeout behaviors:
495
496- `TAPPING_TERM_PER_KEY`
497- `IGNORE_MOD_TAP_INTERRUPT_PER_KEY`
498
499You need to add `#define` lines to your `config.h` for each feature you want.
500
501```
502#define TAPPING_TERM_PER_KEY
503#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY
504```
505
506
507## Example `get_tapping_term` Implementation
508
509To change the `TAPPING_TERM` based on the keycode, you'd want to add something like the following to your `keymap.c` file:
510
511```c
512uint16_t get_tapping_term(uint16_t keycode) {
513 switch (keycode) {
514 case SFT_T(KC_SPC):
515 return TAPPING_TERM + 1250;
516 case LT(1, KC_GRV):
517 return 130;
518 default:
519 return TAPPING_TERM;
520 }
521}
522```
523
524## Example `get_ignore_mod_tap_interrupt` Implementation
525
526To change the `IGNORE_MOD_TAP_INTERRUPT` value based on the keycode, you'd want to add something like the following to your `keymap.c` file:
527
528```c
529bool get_ignore_mod_tap_interrupt(uint16_t keycode) {
530 switch (keycode) {
531 case SFT_T(KC_SPC):
532 return true;
533 default:
534 return false;
535 }
536}
537```
538
539## `get_tapping_term` / `get_ignore_mod_tap_interrupt` Function Documentation
540
541Unlike many of the other functions here, there isn't a need (or even reason) to have a quantum or keyboard level function. Only user level functions are useful here, so no need to mark them as such.
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 15057827c8..a4f434cbd9 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -374,7 +374,8 @@ These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blo
374```c 374```c
375#define RGB_MATRIX_KEYPRESSES // reacts to keypresses 375#define RGB_MATRIX_KEYPRESSES // reacts to keypresses
376#define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) 376#define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
377#define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects 377#define RGB_DISABLE_TIMEOUT 0 // number of milliseconds to wait until rgb automatically turns off
378#define RGB_DISABLE_AFTER_TIMEOUT 0 // OBSOLETE: number of ticks to wait until disabling effects
378#define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended 379#define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended
379#define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) 380#define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
380#define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) 381#define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
diff --git a/docs/ja/custom_quantum_functions.md b/docs/ja/custom_quantum_functions.md
index 7e4fbd897e..1524717c8e 100644
--- a/docs/ja/custom_quantum_functions.md
+++ b/docs/ja/custom_quantum_functions.md
@@ -62,7 +62,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
62 case KC_ENTER: 62 case KC_ENTER:
63 // enter ãŒæŠ¼ã•ã‚ŒãŸæ™‚ã«éŸ³ã‚’å†ç”Ÿã—ã¾ã™ 63 // enter ãŒæŠ¼ã•ã‚ŒãŸæ™‚ã«éŸ³ã‚’å†ç”Ÿã—ã¾ã™
64 if (record->event.pressed) { 64 if (record->event.pressed) {
65 PLAY_NOTE_ARRAY(tone_qwerty); 65 PLAY_SONG(tone_qwerty);
66 } 66 }
67 return true; // QMK ã« enter ã®ãƒ—レスã¾ãŸã¯ãƒªãƒªãƒ¼ã‚¹ã‚¤ãƒ™ãƒ³ãƒˆã‚’é€ä¿¡ã•ã›ã¾ã™ 67 return true; // QMK ã« enter ã®ãƒ—レスã¾ãŸã¯ãƒªãƒªãƒ¼ã‚¹ã‚¤ãƒ™ãƒ³ãƒˆã‚’é€ä¿¡ã•ã›ã¾ã™
68 default: 68 default:
@@ -440,7 +440,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
440 case KC_ENTER: 440 case KC_ENTER:
441 // enter ãŒæŠ¼ã•ã‚ŒãŸæ™‚ã«éŸ³ã‚’å†ç”Ÿã—ã¾ã™ 441 // enter ãŒæŠ¼ã•ã‚ŒãŸæ™‚ã«éŸ³ã‚’å†ç”Ÿã—ã¾ã™
442 if (record->event.pressed) { 442 if (record->event.pressed) {
443 PLAY_NOTE_ARRAY(tone_qwerty); 443 PLAY_SONG(tone_qwerty);
444 } 444 }
445 return true; // QMK ã« enter ã®ãƒ—レスã¾ãŸã¯ãƒªãƒªãƒ¼ã‚¹ã‚¤ãƒ™ãƒ³ãƒˆã‚’é€ä¿¡ã•ã›ã¾ã™ 445 return true; // QMK ã« enter ã®ãƒ—レスã¾ãŸã¯ãƒªãƒªãƒ¼ã‚¹ã‚¤ãƒ™ãƒ³ãƒˆã‚’é€ä¿¡ã•ã›ã¾ã™
446 case RGB_LYR: // ã“れã«ã‚ˆã‚Šã€ã‚¢ãƒ³ãƒ€ãƒ¼ã‚°ãƒ­ãƒ¼ã‚’レイヤー表示ã¨ã—ã¦ã€ã‚ã‚‹ã„ã¯é€šå¸¸é€šã‚Šã«ä½¿ã†ã“ã¨ãŒã§ãã¾ã™ã€‚ 446 case RGB_LYR: // ã“れã«ã‚ˆã‚Šã€ã‚¢ãƒ³ãƒ€ãƒ¼ã‚°ãƒ­ãƒ¼ã‚’レイヤー表示ã¨ã—ã¦ã€ã‚ã‚‹ã„ã¯é€šå¸¸é€šã‚Šã«ä½¿ã†ã“ã¨ãŒã§ãã¾ã™ã€‚
@@ -511,7 +511,7 @@ void eeconfig_init_user(void) { // EEPROM ãŒãƒªã‚»ãƒƒãƒˆã•れã¾ã™ï¼
511キーコードã«åŸºã¥ã„㦠`TAPPING_TERM` を変更ã™ã‚‹ã«ã¯ã€æ¬¡ã®ã‚ˆã†ãªã‚‚ã®ã‚’ `keymap.c` ファイルã«è¿½åŠ ã—ã¾ã™: 511キーコードã«åŸºã¥ã„㦠`TAPPING_TERM` を変更ã™ã‚‹ã«ã¯ã€æ¬¡ã®ã‚ˆã†ãªã‚‚ã®ã‚’ `keymap.c` ファイルã«è¿½åŠ ã—ã¾ã™:
512 512
513```c 513```c
514uint16_t get_tapping_term(uint16_t keycode) { 514uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
515 switch (keycode) { 515 switch (keycode) {
516 case SFT_T(KC_SPC): 516 case SFT_T(KC_SPC):
517 return TAPPING_TERM + 1250; 517 return TAPPING_TERM + 1250;
@@ -528,7 +528,7 @@ uint16_t get_tapping_term(uint16_t keycode) {
528キーコードã«åŸºã¥ã„㦠`IGNORE_MOD_TAP_INTERRUPT` ã®å€¤ã‚’変更ã™ã‚‹ã«ã¯ã€æ¬¡ã®ã‚ˆã†ãªã‚‚ã®ã‚’ `keymap.c` ファイルã«è¿½åŠ ã—ã¾ã™: 528キーコードã«åŸºã¥ã„㦠`IGNORE_MOD_TAP_INTERRUPT` ã®å€¤ã‚’変更ã™ã‚‹ã«ã¯ã€æ¬¡ã®ã‚ˆã†ãªã‚‚ã®ã‚’ `keymap.c` ファイルã«è¿½åŠ ã—ã¾ã™:
529 529
530```c 530```c
531bool get_ignore_mod_tap_interrupt(uint16_t keycode) { 531bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
532 switch (keycode) { 532 switch (keycode) {
533 case SFT_T(KC_SPC): 533 case SFT_T(KC_SPC):
534 return true; 534 return true;
diff --git a/docs/tap_hold.md b/docs/tap_hold.md
index a0b648694b..2dc57f03c2 100644
--- a/docs/tap_hold.md
+++ b/docs/tap_hold.md
@@ -4,6 +4,38 @@ While Tap-Hold options are fantastic, they are not without their issues. We hav
4 4
5These options let you modify the behavior of the Tap-Hold keys. 5These options let you modify the behavior of the Tap-Hold keys.
6 6
7## Tapping Term
8
9The crux of all of the following features is the tapping term setting. This determines what is a tap and what is a hold. And the exact timing for this to feel natural can vary from keyboard to keyboard, from switch to switch, and from key to key.
10
11You can set the global time for this by adding the following setting to your `config.h`:
12
13```c
14#define TAPPING_TERM 200
15```
16
17This setting is defined in milliseconds, and does default to 200ms. This is a good average for a majority of people.
18
19For more granular control of this feature, you can add the following to your `config.h`:
20```c
21#define TAPPING_TERM_PER_KEY
22```
23
24You can then add the following function to your keymap:
25
26```c
27uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
28 switch (keycode) {
29 case SFT_T(KC_SPC):
30 return TAPPING_TERM + 1250;
31 case LT(1, KC_GRV):
32 return 130;
33 default:
34 return TAPPING_TERM;
35}
36```
37
38
7## Permissive Hold 39## Permissive Hold
8 40
9As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new `config.h` option: 41As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new `config.h` option:
@@ -27,6 +59,25 @@ Normally, if you do all this within the `TAPPING_TERM` (default: 200ms) this wil
27 59
28?> If you have `Ignore Mod Tap Interrupt` enabled, as well, this will modify how both work. The regular key has the modifier added if the first key is released first or if both keys are held longer than the `TAPPING_TERM`. 60?> If you have `Ignore Mod Tap Interrupt` enabled, as well, this will modify how both work. The regular key has the modifier added if the first key is released first or if both keys are held longer than the `TAPPING_TERM`.
29 61
62For more granular control of this feature, you can add the following to your `config.h`:
63
64```c
65#define PERMISSIVE_HOLD_PER_KEY
66```
67
68You can then add the following function to your keymap:
69
70```c
71bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) {
72 switch (keycode) {
73 case LT(1, KC_BSPC):
74 return true;
75 default:
76 return false;
77 }
78}
79```
80
30## Ignore Mod Tap Interrupt 81## Ignore Mod Tap Interrupt
31 82
32To enable this setting, add this to your `config.h`: 83To enable this setting, add this to your `config.h`:
@@ -62,13 +113,13 @@ For more granular control of this feature, you can add the following to your `co
62You can then add the following function to your keymap: 113You can then add the following function to your keymap:
63 114
64```c 115```c
65bool get_ignore_mod_tap_interrupt(uint16_t keycode) { 116bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
66 switch (keycode) { 117 switch (keycode) {
67 case SFT_T(KC_SPC): 118 case SFT_T(KC_SPC):
68 return true; 119 return true;
69 default: 120 default:
70 return false; 121 return false;
71 } 122 }
72} 123}
73``` 124```
74 125
@@ -106,12 +157,12 @@ You can then add the following function to your keymap:
106 157
107```c 158```c
108bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { 159bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) {
109 switch (keycode) { 160 switch (keycode) {
110 case LT(1, KC_BSPC): 161 case LT(1, KC_BSPC):
111 return true; 162 return true;
112 default: 163 default:
113 return false; 164 return false;
114 } 165 }
115} 166}
116``` 167```
117 168
@@ -126,3 +177,13 @@ To enable `retro tapping`, add the following to your `config.h`:
126Holding and releasing a dual function key without pressing another key will result in nothing happening. With retro tapping enabled, releasing the key without pressing another will send the original keycode even if it is outside the tapping term. 177Holding and releasing a dual function key without pressing another key will result in nothing happening. With retro tapping enabled, releasing the key without pressing another will send the original keycode even if it is outside the tapping term.
127 178
128For instance, holding and releasing `LT(2, KC_SPACE)` without hitting another key will result in nothing happening. With this enabled, it will send `KC_SPACE` instead. 179For instance, holding and releasing `LT(2, KC_SPACE)` without hitting another key will result in nothing happening. With this enabled, it will send `KC_SPACE` instead.
180
181## Why do we include the key record for the per key functions?
182
183One thing that you may notice is that we include the key record for all of the "per key" functions, and may be wondering why we do that.
184
185Well, it's simply really: customization. But specifically, it depends on how your keyboard is wired up. For instance, if each row is actually using a row in the keyboard's matrix, then it may be simpler to use `if (record->event.row == 3)` instead of checking a whole bunch of keycodes. Which is especially good for those people using the Tap Hold type keys on the home row. So you could fine tune those to not interfere with your normal typing.
186
187## Why is there no `*_kb` or `*_user` functions?!
188
189Unlike many of the other functions here, there isn't a need (or even reason) to have a quantum or keyboard level function. Only user level functions are useful here, so no need to mark them as such.
diff --git a/docs/zh-cn/custom_quantum_functions.md b/docs/zh-cn/custom_quantum_functions.md
index f2c6098dcb..95b2084dbf 100644
--- a/docs/zh-cn/custom_quantum_functions.md
+++ b/docs/zh-cn/custom_quantum_functions.md
@@ -57,7 +57,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
57 case KC_ENTER: 57 case KC_ENTER:
58 // 当按下回车时播放音符 58 // 当按下回车时播放音符
59 if (record->event.pressed) { 59 if (record->event.pressed) {
60 PLAY_NOTE_ARRAY(tone_qwerty); 60 PLAY_SONG(tone_qwerty);
61 } 61 }
62 return true; // 让QMK触å‘回车按下/释放事件 62 return true; // 让QMK触å‘回车按下/释放事件
63 default: 63 default:
@@ -413,7 +413,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
413 case KC_ENTER: 413 case KC_ENTER:
414 // 在按下回车时播放音符 414 // 在按下回车时播放音符
415 if (record->event.pressed) { 415 if (record->event.pressed) {
416 PLAY_NOTE_ARRAY(tone_qwerty); 416 PLAY_SONG(tone_qwerty);
417 } 417 }
418 return true; // 让QMK产生回车按下/释放事件 418 return true; // 让QMK产生回车按下/释放事件
419 case RGB_LYR: // 本å¥è®©underglow作为层指示,或正常使用。 419 case RGB_LYR: // 本å¥è®©underglow作为层指示,或正常使用。
@@ -473,7 +473,7 @@ void eeconfig_init_user(void) { // EEPROM正被é‡ç½®
473想è¦ä¿®æ”¹åŸºäºŽé”®ç çš„`TAPPING TERM`,ä½ è¦å‘`keymap.c`文件添加如下代ç : 473想è¦ä¿®æ”¹åŸºäºŽé”®ç çš„`TAPPING TERM`,ä½ è¦å‘`keymap.c`文件添加如下代ç :
474 474
475```c 475```c
476uint16_t get_tapping_term(uint16_t keycode) { 476uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
477 switch (keycode) { 477 switch (keycode) {
478 case SFT_T(KC_SPC): 478 case SFT_T(KC_SPC):
479 return TAPPING_TERM + 1250; 479 return TAPPING_TERM + 1250;
diff --git a/keyboards/at101_bh/at101_bh.c b/keyboards/at101_bh/at101_bh.c
new file mode 100644
index 0000000000..3b519373b0
--- /dev/null
+++ b/keyboards/at101_bh/at101_bh.c
@@ -0,0 +1 @@
#include "at101_bh.h"
diff --git a/keyboards/at101_blackheart/at101_blackheart.h b/keyboards/at101_bh/at101_bh.h
index 24ac1b7c54..54655cf60e 100644
--- a/keyboards/at101_blackheart/at101_blackheart.h
+++ b/keyboards/at101_bh/at101_bh.h
@@ -1,5 +1,4 @@
1#ifndef at101_blackheart_H 1#pragma once
2#define at101_blackheart_H
3 2
4#include "quantum.h" 3#include "quantum.h"
5 4
@@ -24,5 +23,3 @@
24 { K1000, K1001, KC_NO, KC_NO, KC_NO, K1005, K1006, K1007, K1008, K1009 }, \ 23 { K1000, K1001, KC_NO, KC_NO, KC_NO, K1005, K1006, K1007, K1008, K1009 }, \
25 { K1100, K1101, K1102, KC_NO, KC_NO, K1105, K1106, K1107, K1108, KC_NO } \ 24 { K1100, K1101, K1102, KC_NO, KC_NO, K1105, K1106, K1107, K1108, KC_NO } \
26} 25}
27
28#endif
diff --git a/keyboards/at101_blackheart/config.h b/keyboards/at101_bh/config.h
index 83814c6486..6928118b79 100644
--- a/keyboards/at101_blackheart/config.h
+++ b/keyboards/at101_bh/config.h
@@ -7,7 +7,7 @@
7#define PRODUCT_ID 0x6060 7#define PRODUCT_ID 0x6060
8#define DEVICE_VER 0x0001 8#define DEVICE_VER 0x0001
9#define MANUFACTURER blindassassin111 9#define MANUFACTURER blindassassin111
10#define PRODUCT AT101_Blackheart PCB 10#define PRODUCT AT101_BH PCB
11#define DESCRIPTION Replacement AT101 PCB 11#define DESCRIPTION Replacement AT101 PCB
12 12
13/* key matrix size */ 13/* key matrix size */
diff --git a/keyboards/at101_blackheart/info.json b/keyboards/at101_bh/info.json
index 4bef46712d..1d28dc230b 100644
--- a/keyboards/at101_blackheart/info.json
+++ b/keyboards/at101_bh/info.json
@@ -1,6 +1,6 @@
1{ 1{
2 "keyboard_name": "AT101 Blackheart PCB", 2 "keyboard_name": "AT101 BH PCB",
3 "keyboard_folder": "at101_blackheart", 3 "keyboard_folder": "at101_bh",
4 "url": "https://deskthority.net/group-buys-f50/programmable-vintage-board-pcbs-omnikey-at101-and-z-150-t19325.html", 4 "url": "https://deskthority.net/group-buys-f50/programmable-vintage-board-pcbs-omnikey-at101-and-z-150-t19325.html",
5 "maintainer": "qmk, blindassassin111", 5 "maintainer": "qmk, blindassassin111",
6 "width": 22.5, 6 "width": 22.5,
diff --git a/keyboards/at101_blackheart/keymaps/default/keymap.c b/keyboards/at101_bh/keymaps/default/keymap.c
index 086c25e1c7..086c25e1c7 100644
--- a/keyboards/at101_blackheart/keymaps/default/keymap.c
+++ b/keyboards/at101_bh/keymaps/default/keymap.c
diff --git a/keyboards/at101_blackheart/readme.md b/keyboards/at101_bh/readme.md
index d435d6955a..8a9ce2496f 100644
--- a/keyboards/at101_blackheart/readme.md
+++ b/keyboards/at101_bh/readme.md
@@ -1,15 +1,15 @@
1# AT101 Blackheart PCB 1# AT101 BH PCB
2 2
3![AT101 Blackheart PCB](https://deskthority.net/resources/image/48571) 3![AT101 BH PCB](https://deskthority.net/resources/image/48571)
4 4
5A replacement PCB for AT101 keyboards. 5A replacement PCB for AT101 keyboards.
6 6
7Keyboard Maintainer: QMK Community and blindassassin111 7Keyboard Maintainer: QMK Community and blindassassin111
8Hardware Supported: AT101 blackheart PCB 8Hardware Supported: AT101 BH PCB
9Hardware Availability: https://deskthority.net/group-buys-f50/programmable-vintage-board-pcbs-omnikey-at101-and-z-150-t19325.html 9Hardware Availability: https://deskthority.net/group-buys-f50/programmable-vintage-board-pcbs-omnikey-at101-and-z-150-t19325.html
10 10
11Make example for this keyboard (after setting up your build environment): 11Make example for this keyboard (after setting up your build environment):
12 12
13 make at101_blackheart:default 13 make at101_bh:default
14 14
15See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). 15See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/at101_blackheart/rules.mk b/keyboards/at101_bh/rules.mk
index 1930d9f27f..1930d9f27f 100644
--- a/keyboards/at101_blackheart/rules.mk
+++ b/keyboards/at101_bh/rules.mk
diff --git a/keyboards/at101_blackheart/at101_blackheart.c b/keyboards/at101_blackheart/at101_blackheart.c
deleted file mode 100644
index aa07a78643..0000000000
--- a/keyboards/at101_blackheart/at101_blackheart.c
+++ /dev/null
@@ -1 +0,0 @@
1#include "at101_blackheart.h"
diff --git a/keyboards/atomic/keymaps/pvc/keymap.c b/keyboards/atomic/keymaps/pvc/keymap.c
index 33b3a9d824..361d702c5b 100644
--- a/keyboards/atomic/keymaps/pvc/keymap.c
+++ b/keyboards/atomic/keymaps/pvc/keymap.c
@@ -102,7 +102,7 @@ enum keyboard_macros {
102#define SC_CCLS LCTL(KC_F4) 102#define SC_CCLS LCTL(KC_F4)
103 103
104#define TG_NKRO MAGIC_TOGGLE_NKRO 104#define TG_NKRO MAGIC_TOGGLE_NKRO
105#define OS_SHFT KC_FN0 105#define OS_SHFT OSM(MOD_LSFT)
106 106
107#define ________________ _______, _______ 107#define ________________ _______, _______
108#define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX 108#define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX
@@ -258,10 +258,6 @@ void persistent_default_layer_set(uint16_t default_layer) {
258 default_layer_set(default_layer); 258 default_layer_set(default_layer);
259} 259}
260 260
261const uint16_t PROGMEM fn_actions[] = {
262 [0] = ACTION_MODS_ONESHOT(MOD_LSFT),
263};
264
265const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { 261const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
266 262
267 // MACRODOWN only works in this function 263 // MACRODOWN only works in this function
diff --git a/keyboards/atreus62/keymaps/atreus52/keymap.c b/keyboards/atreus62/keymaps/atreus52/keymap.c
index c7dcb67653..31a01ccd87 100644
--- a/keyboards/atreus62/keymaps/atreus52/keymap.c
+++ b/keyboards/atreus62/keymaps/atreus52/keymap.c
@@ -10,6 +10,8 @@
10 10
11#define KC_RAIS MO(RAISE) 11#define KC_RAIS MO(RAISE)
12#define KC_LOWR MO(LOWER) 12#define KC_LOWR MO(LOWER)
13#define KC_TGBD TG(BDO)
14#define KC_TGRS TG(RESETL)
13 15
14const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 16const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
15 [DVORAK] = LAYOUT_kc( 17 [DVORAK] = LAYOUT_kc(
@@ -17,7 +19,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
17 NO, QUOT, COMM, DOT, P, Y, F, G, C, R, L, NO, \ 19 NO, QUOT, COMM, DOT, P, Y, F, G, C, R, L, NO, \
18 NO, A, O, E, U, I, D, H, T, N, S, NO, \ 20 NO, A, O, E, U, I, D, H, T, N, S, NO, \
19 NO, SCLN, Q, J, K, X, B, M, W, V, Z, NO, \ 21 NO, SCLN, Q, J, K, X, B, M, W, V, Z, NO, \
20 NO, FN2, LALT, LCTL, LOWR, LSFT, BSPC, ENT, SPC, RAIS, LGUI, LEFT, RGHT, NO 22 NO, TGBD, LALT, LCTL, LOWR, LSFT, BSPC, ENT, SPC, RAIS, LGUI, LEFT, RGHT, NO
21 ), 23 ),
22 24
23 [QWERTY] = LAYOUT_kc( 25 [QWERTY] = LAYOUT_kc(
@@ -25,7 +27,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
25 NO, Q, W, E, R, T, Y, U, I, O, P, NO, \ 27 NO, Q, W, E, R, T, Y, U, I, O, P, NO, \
26 NO, A, S, D, F, G, H, J, K, L, SCLN, NO, \ 28 NO, A, S, D, F, G, H, J, K, L, SCLN, NO, \
27 NO, Z, X, C, V, B, N, M, COMM, DOT, SLSH, NO, \ 29 NO, Z, X, C, V, B, N, M, COMM, DOT, SLSH, NO, \
28 NO, FN2, LALT, LCTL, LOWR, LSFT, BSPC, ENT, SPC, RAIS, LGUI, LEFT, RGHT, NO 30 NO, TGBD, LALT, LCTL, LOWR, LSFT, BSPC, ENT, SPC, RAIS, LGUI, LEFT, RGHT, NO
29 ), 31 ),
30 32
31 [RAISE] = LAYOUT_kc( 33 [RAISE] = LAYOUT_kc(
@@ -33,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
33 NO, TILD, GRV, LCBR, RCBR, DQUO, QUOT, EQL, PLUS, MINS, QUES, NO, \ 35 NO, TILD, GRV, LCBR, RCBR, DQUO, QUOT, EQL, PLUS, MINS, QUES, NO, \
34 NO, ESC, TAB, LPRN, RPRN, BSLS, SLSH, LEFT, DOWN, UP, RGHT, NO, \ 36 NO, ESC, TAB, LPRN, RPRN, BSLS, SLSH, LEFT, DOWN, UP, RGHT, NO, \
35 NO, TRNS, TRNS, LBRC, RBRC, TRNS, INS, PIPE, UNDS, TRNS, TRNS, NO, \ 37 NO, TRNS, TRNS, LBRC, RBRC, TRNS, INS, PIPE, UNDS, TRNS, TRNS, NO, \
36 NO, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN3, NO 38 NO, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TGRS, NO
37 ), 39 ),
38 40
39 [LOWER] = LAYOUT_kc( 41 [LOWER] = LAYOUT_kc(
@@ -49,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
49 NO, TAB, Q, W, E, R, 6, Y, I, O, P, NO, \ 51 NO, TAB, Q, W, E, R, 6, Y, I, O, P, NO, \
50 NO, LSFT, A, S, D, F, 7, G, H, J, K, NO, \ 52 NO, LSFT, A, S, D, F, 7, G, H, J, K, NO, \
51 NO, T, Z, X, C, V, 8, B, N, M, L, NO, \ 53 NO, T, Z, X, C, V, 8, B, N, M, L, NO, \
52 NO, LCTL, SPC, SPC, SPC, SPC, COMM, ENT, 9, NO, NO, NO, FN2, NO 54 NO, LCTL, SPC, SPC, SPC, SPC, COMM, ENT, 9, NO, NO, NO, TGBD, NO
53 ), 55 ),
54 56
55 [RESETL] = LAYOUT( 57 [RESETL] = LAYOUT(
@@ -57,15 +59,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
57 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ 59 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
58 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ 60 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
59 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ 61 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
60 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_FN3,KC_NO 62 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, TG(RESETL),KC_NO
61 ) 63 )
62}; 64};
63 65
64const uint16_t PROGMEM fn_actions[] = {
65 [2] = ACTION_LAYER_TOGGLE(BDO), // BDO layer
66 [3] = ACTION_LAYER_TOGGLE(RESETL) // RESET layer
67};
68
69const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { 66const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
70 // MACRODOWN only works in this function 67 // MACRODOWN only works in this function
71 switch (id) { 68 switch (id) {
diff --git a/keyboards/bpiphany/pegasushoof/keymaps/blowrak/keymap.c b/keyboards/bpiphany/pegasushoof/keymaps/blowrak/keymap.c
index aad2d643cd..f9234a7b2f 100644
--- a/keyboards/bpiphany/pegasushoof/keymaps/blowrak/keymap.c
+++ b/keyboards/bpiphany/pegasushoof/keymaps/blowrak/keymap.c
@@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
48 KC_TAB, SE_AO, SE_AE, SE_OE, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_COMM,SE_CIRC,SE_QUOT, KC_DEL, KC_END, KC_PGDN, \ 48 KC_TAB, SE_AO, SE_AE, SE_OE, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_COMM,SE_CIRC,SE_QUOT, KC_DEL, KC_END, KC_PGDN, \
49 KC_LCTRL,KC_A, KC_O, KC_E, KC_U, KC_I, KC_H, KC_D, KC_T, KC_N, KC_S, SE_MINS, KC_ENT, \ 49 KC_LCTRL,KC_A, KC_O, KC_E, KC_U, KC_I, KC_H, KC_D, KC_T, KC_N, KC_S, SE_MINS, KC_ENT, \
50 KC_LSFT, SE_LTGT,KC_DOT, KC_Q, KC_J, KC_K, KC_B, KC_X, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_UP, \ 50 KC_LSFT, SE_LTGT,KC_DOT, KC_Q, KC_J, KC_K, KC_B, KC_X, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_UP, \
51 MO(KM_MEDIA),KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_FN1, KC_LEFT,KC_DOWN,KC_RGHT), 51 MO(KM_MEDIA),KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,TG(KM_QWERTY), KC_LEFT,KC_DOWN,KC_RGHT),
52 /* Layer 1: Standard ISO layer */ 52 /* Layer 1: Standard ISO layer */
53 [KM_QWERTY] = LAYOUT( \ 53 [KM_QWERTY] = LAYOUT( \
54 KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK,KC_PAUS, \ 54 KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK,KC_PAUS, \
@@ -56,7 +56,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
56 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, SE_AO, SE_CIRC,SE_QUOT, KC_DEL, KC_END, KC_PGDN, \ 56 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, SE_AO, SE_CIRC,SE_QUOT, KC_DEL, KC_END, KC_PGDN, \
57 KC_LCTRL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, SE_OE, SE_AE, KC_ENT, \ 57 KC_LCTRL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, SE_OE, SE_AE, KC_ENT, \
58 KC_LSFT, SE_LTGT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, SE_MINS, KC_RSFT, KC_UP, \ 58 KC_LSFT, SE_LTGT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, SE_MINS, KC_RSFT, KC_UP, \
59 MO(KM_MEDIA),KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_FN1, KC_LEFT,KC_DOWN,KC_RGHT), 59 MO(KM_MEDIA),KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,TG(KM_QWERTY), KC_LEFT,KC_DOWN,KC_RGHT),
60 /* Layer 2: Media layer */ 60 /* Layer 2: Media layer */
61 [KM_MEDIA] = LAYOUT( \ 61 [KM_MEDIA] = LAYOUT( \
62 _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_WAKE,KC_PWR, KC_SLEP, \ 62 _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_WAKE,KC_PWR, KC_SLEP, \
@@ -75,10 +75,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
75 _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______), 75 _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______),
76}; 76};
77 77
78const uint16_t PROGMEM fn_actions[] = {
79 [1] = ACTION_LAYER_TOGGLE(KM_QWERTY)
80};
81
82void matrix_scan_user(void) 78void matrix_scan_user(void)
83{ 79{
84 uint8_t layer = biton32(layer_state); 80 uint8_t layer = biton32(layer_state);
diff --git a/keyboards/ckeys/handwire_101/config.h b/keyboards/ckeys/handwire_101/config.h
index 3dc99319ed..849f4f6077 100755
--- a/keyboards/ckeys/handwire_101/config.h
+++ b/keyboards/ckeys/handwire_101/config.h
@@ -158,12 +158,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
158//#define MAGIC_KEY_SLEEP_LED Z 158//#define MAGIC_KEY_SLEEP_LED Z
159 159
160// Audio Click 160// Audio Click
161#define AUDIO_CLICKY 161//#define AUDIO_CLICKY
162 162
163// Music Mode Polyphony 163// Music Mode Polyphony
164// NOTE: Must change polyphony_rate to a number higher than 0 in voices.c 164// NOTE: Must change polyphony_rate to a number higher than 0 in voices.c
165#define AUDIO_VOICES 165//#define AUDIO_VOICES
166#define PITCH_STANDARD_A 880.0f 166//#define PITCH_STANDARD_A 880.0f
167 167
168// Mouse keys 168// Mouse keys
169#define MOUSEKEY_DELAY 0 169#define MOUSEKEY_DELAY 0
diff --git a/keyboards/ckeys/handwire_101/rules.mk b/keyboards/ckeys/handwire_101/rules.mk
index 41a29b3537..83d55e0f70 100755
--- a/keyboards/ckeys/handwire_101/rules.mk
+++ b/keyboards/ckeys/handwire_101/rules.mk
@@ -28,5 +28,5 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by d
28#MIDI_ENABLE = yes # MIDI controls 28#MIDI_ENABLE = yes # MIDI controls
29UNICODE_ENABLE = no # Unicode 29UNICODE_ENABLE = no # Unicode
30BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 30BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
31AUDIO_ENABLE = yes # Audio output on port C6 31AUDIO_ENABLE = no # Audio output
32FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 32FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
diff --git a/keyboards/clueboard/card/keymaps/default/keymap.c b/keyboards/clueboard/card/keymaps/default/keymap.c
index 0fa1d9d989..0d94eb46c9 100644
--- a/keyboards/clueboard/card/keymaps/default/keymap.c
+++ b/keyboards/clueboard/card/keymaps/default/keymap.c
@@ -38,6 +38,7 @@ void matrix_scan_user(void) {
38 38
39bool process_record_user(uint16_t keycode, keyrecord_t *record) { 39bool process_record_user(uint16_t keycode, keyrecord_t *record) {
40 switch (keycode) { 40 switch (keycode) {
41#ifdef AUDIO_ENABLE
41 case SONG_SU: 42 case SONG_SU:
42 if (record->event.pressed) { 43 if (record->event.pressed) {
43 PLAY_SONG(tone_startup); 44 PLAY_SONG(tone_startup);
@@ -58,7 +59,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
58 } 59 }
59 60
60 return false; 61 return false;
61 62#endif
62 default: 63 default:
63 return true; 64 return true;
64 } 65 }
diff --git a/keyboards/clueboard/card/keymaps/default/rules.mk b/keyboards/clueboard/card/keymaps/default/rules.mk
index 998bb5e0eb..82ee482bed 100644
--- a/keyboards/clueboard/card/keymaps/default/rules.mk
+++ b/keyboards/clueboard/card/keymaps/default/rules.mk
@@ -10,7 +10,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
10NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 10NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
11BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 11BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
12MIDI_ENABLE = no # MIDI controls 12MIDI_ENABLE = no # MIDI controls
13AUDIO_ENABLE = yes # Audio output on port C6 13AUDIO_ENABLE = no # Audio output
14UNICODE_ENABLE = no # Unicode 14UNICODE_ENABLE = no # Unicode
15BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 15BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
16RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. 16RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
diff --git a/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c b/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c
index c472f78b7d..716ff19abd 100644
--- a/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c
+++ b/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c
@@ -175,7 +175,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
175// clang-format on 175// clang-format on
176 176
177// Configure ignore mod tap interrupt per key 177// Configure ignore mod tap interrupt per key
178bool get_ignore_mod_tap_interrupt(uint16_t keycode) { 178bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
179 switch (keycode) { 179 switch (keycode) {
180 // I don't like how mod tap interrupt feels with these keys specifically when I'm typing 180 // I don't like how mod tap interrupt feels with these keys specifically when I'm typing
181 case LCTL_T(KC_ESC): 181 case LCTL_T(KC_ESC):
diff --git a/keyboards/converter/usb_usb/keymaps/coloneljesus/keymap.c b/keyboards/converter/usb_usb/keymaps/coloneljesus/keymap.c
index 7e39908195..ce4876536f 100644
--- a/keyboards/converter/usb_usb/keymaps/coloneljesus/keymap.c
+++ b/keyboards/converter/usb_usb/keymaps/coloneljesus/keymap.c
@@ -283,13 +283,9 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
283 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, 283 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,
284 CAPS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS, INS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, 284 CAPS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS, INS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,
285 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, 285 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,
286 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, 286 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, TILD, TRNS,APP, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,
287 TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS 287 TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS
288 ), 288 ),
289}; 289};
290 290
291const action_t PROGMEM fn_actions[] = {
292 [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
293};
294
295#endif 291#endif
diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c
index 55d51eb08a..0769edf3b9 100644
--- a/keyboards/crkbd/keymaps/drashna/keymap.c
+++ b/keyboards/crkbd/keymaps/drashna/keymap.c
@@ -124,7 +124,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
124oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } 124oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; }
125#endif 125#endif
126 126
127uint16_t get_tapping_term(uint16_t keycode) { 127uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
128 switch (keycode) { 128 switch (keycode) {
129 case ALT_T(KC_A): 129 case ALT_T(KC_A):
130 return TAPPING_TERM + 100; 130 return TAPPING_TERM + 100;
diff --git a/keyboards/cu75/cu75.c b/keyboards/cu75/cu75.c
index 6dc2898454..60c92b708a 100644
--- a/keyboards/cu75/cu75.c
+++ b/keyboards/cu75/cu75.c
@@ -26,7 +26,7 @@ void matrix_init_kb(void)
26 26
27#ifdef AUDIO_ENABLE 27#ifdef AUDIO_ENABLE
28 audio_init(); 28 audio_init();
29 PLAY_NOTE_ARRAY(test_sound, false, STACCATO); 29 PLAY_SONG(test_sound);
30 // Fix port B5 30 // Fix port B5
31 cbi(DDRB, 5); 31 cbi(DDRB, 5);
32 sbi(PORTB, 5); 32 sbi(PORTB, 5);
diff --git a/keyboards/ergoinu/config.h b/keyboards/dm9records/ergoinu/config.h
index dfc8a52930..dfc8a52930 100644
--- a/keyboards/ergoinu/config.h
+++ b/keyboards/dm9records/ergoinu/config.h
diff --git a/keyboards/ergoinu/ergoinu.c b/keyboards/dm9records/ergoinu/ergoinu.c
index b43ab17c8b..b43ab17c8b 100644
--- a/keyboards/ergoinu/ergoinu.c
+++ b/keyboards/dm9records/ergoinu/ergoinu.c
diff --git a/keyboards/ergoinu/ergoinu.h b/keyboards/dm9records/ergoinu/ergoinu.h
index 43249a8440..43249a8440 100644
--- a/keyboards/ergoinu/ergoinu.h
+++ b/keyboards/dm9records/ergoinu/ergoinu.h
diff --git a/keyboards/ergoinu/info.json b/keyboards/dm9records/ergoinu/info.json
index 81f53fd255..3627049a5e 100644
--- a/keyboards/ergoinu/info.json
+++ b/keyboards/dm9records/ergoinu/info.json
@@ -1,7 +1,7 @@
1{ 1{
2 "keyboard_name": "Ergoinu", 2 "keyboard_name": "Ergoinu",
3 "url": "", 3 "url": "",
4 "maintainer": "hsgw", 4 "maintainer": "hsgw(Takuya Urakawa)",
5 "width": 18, 5 "width": 18,
6 "height": 5.4, 6 "height": 5.4,
7 "layouts": { 7 "layouts": {
diff --git a/keyboards/ergoinu/keymaps/default/config.h b/keyboards/dm9records/ergoinu/keymaps/default/config.h
index bb266f25e7..bb266f25e7 100644
--- a/keyboards/ergoinu/keymaps/default/config.h
+++ b/keyboards/dm9records/ergoinu/keymaps/default/config.h
diff --git a/keyboards/ergoinu/keymaps/default/keymap.c b/keyboards/dm9records/ergoinu/keymaps/default/keymap.c
index 7f1be4796c..7f1be4796c 100644
--- a/keyboards/ergoinu/keymaps/default/keymap.c
+++ b/keyboards/dm9records/ergoinu/keymaps/default/keymap.c
diff --git a/keyboards/ergoinu/keymaps/default/rules.mk b/keyboards/dm9records/ergoinu/keymaps/default/rules.mk
index b2eff12b04..b2eff12b04 100644
--- a/keyboards/ergoinu/keymaps/default/rules.mk
+++ b/keyboards/dm9records/ergoinu/keymaps/default/rules.mk
diff --git a/keyboards/ergoinu/keymaps/default_jis/config.h b/keyboards/dm9records/ergoinu/keymaps/default_jis/config.h
index bb266f25e7..bb266f25e7 100644
--- a/keyboards/ergoinu/keymaps/default_jis/config.h
+++ b/keyboards/dm9records/ergoinu/keymaps/default_jis/config.h
diff --git a/keyboards/ergoinu/keymaps/default_jis/keymap.c b/keyboards/dm9records/ergoinu/keymaps/default_jis/keymap.c
index 3a1a88f47c..3a1a88f47c 100644
--- a/keyboards/ergoinu/keymaps/default_jis/keymap.c
+++ b/keyboards/dm9records/ergoinu/keymaps/default_jis/keymap.c
diff --git a/keyboards/ergoinu/keymaps/default_jis/rules.mk b/keyboards/dm9records/ergoinu/keymaps/default_jis/rules.mk
index 92dde90ff1..92dde90ff1 100644
--- a/keyboards/ergoinu/keymaps/default_jis/rules.mk
+++ b/keyboards/dm9records/ergoinu/keymaps/default_jis/rules.mk
diff --git a/keyboards/ergoinu/matrix.c b/keyboards/dm9records/ergoinu/matrix.c
index 4a80cf9f24..4a80cf9f24 100644
--- a/keyboards/ergoinu/matrix.c
+++ b/keyboards/dm9records/ergoinu/matrix.c
diff --git a/keyboards/ergoinu/readme.md b/keyboards/dm9records/ergoinu/readme.md
index 06e0cf352e..de0a1c6c97 100644
--- a/keyboards/ergoinu/readme.md
+++ b/keyboards/dm9records/ergoinu/readme.md
@@ -11,11 +11,11 @@ Hardware Availability & Repository: [https://github.com/hsgw/ergoinu](https://gi
11 11
12Make example for this keyboard (after setting up your build environment): 12Make example for this keyboard (after setting up your build environment):
13 13
14 make ergoinu:default 14 make dm9records/ergoinu:default
15 15
16 (or) 16 (or)
17 17
18 make ergoinu:default_jis 18 make dm9records/ergoinu:default_jis
19 19
20 20
21See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. 21See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/ergoinu/rules.mk b/keyboards/dm9records/ergoinu/rules.mk
index 6f5debe00c..493046ffa4 100644
--- a/keyboards/ergoinu/rules.mk
+++ b/keyboards/dm9records/ergoinu/rules.mk
@@ -26,7 +26,7 @@ MIDI_ENABLE = no # MIDI controls
26AUDIO_ENABLE = no # Audio output on port C6 26AUDIO_ENABLE = no # Audio output on port C6
27UNICODE_ENABLE = no # Unicode 27UNICODE_ENABLE = no # Unicode
28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. 29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
30SUBPROJECT_rev1 = no 30SUBPROJECT_rev1 = no
31USE_I2C = no # i2c is not supported 31USE_I2C = no # i2c is not supported
32# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 32# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
@@ -35,8 +35,6 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
35CUSTOM_MATRIX = yes 35CUSTOM_MATRIX = yes
36SRC += matrix.c serial.c split_util.c 36SRC += matrix.c serial.c split_util.c
37 37
38DEFAULT_FOLDER = ergoinu
39
40# ergoinu configs 38# ergoinu configs
41DISABLE_PROMICRO_LEDs = yes 39DISABLE_PROMICRO_LEDs = yes
42 40
diff --git a/keyboards/ergoinu/serial.c b/keyboards/dm9records/ergoinu/serial.c
index 5919415877..5919415877 100644
--- a/keyboards/ergoinu/serial.c
+++ b/keyboards/dm9records/ergoinu/serial.c
diff --git a/keyboards/ergoinu/serial.h b/keyboards/dm9records/ergoinu/serial.h
index 67cf06ac6b..67cf06ac6b 100644
--- a/keyboards/ergoinu/serial.h
+++ b/keyboards/dm9records/ergoinu/serial.h
diff --git a/keyboards/ergoinu/serial_config.h b/keyboards/dm9records/ergoinu/serial_config.h
index a16db684ca..a16db684ca 100644
--- a/keyboards/ergoinu/serial_config.h
+++ b/keyboards/dm9records/ergoinu/serial_config.h
diff --git a/keyboards/ergoinu/split_util.c b/keyboards/dm9records/ergoinu/split_util.c
index 0cbc2c69c4..0cbc2c69c4 100644
--- a/keyboards/ergoinu/split_util.c
+++ b/keyboards/dm9records/ergoinu/split_util.c
diff --git a/keyboards/ergoinu/split_util.h b/keyboards/dm9records/ergoinu/split_util.h
index 11cfd5455a..11cfd5455a 100644
--- a/keyboards/ergoinu/split_util.h
+++ b/keyboards/dm9records/ergoinu/split_util.h
diff --git a/keyboards/plaid/config.h b/keyboards/dm9records/plaid/config.h
index 4d7bedee5f..4d7bedee5f 100644
--- a/keyboards/plaid/config.h
+++ b/keyboards/dm9records/plaid/config.h
diff --git a/keyboards/plaid/info.json b/keyboards/dm9records/plaid/info.json
index 13bd05c149..318154d7de 100644
--- a/keyboards/plaid/info.json
+++ b/keyboards/dm9records/plaid/info.json
@@ -1,8 +1,8 @@
1{ 1{
2 "keyboard_name": "Plaid // Through Hole", 2 "keyboard_name": "Plaid // Through Hole",
3 "keyboard_folder": "planid", 3 "keyboard_folder": "dm9records/plaid",
4 "url": "https://github.com/hsgw/plaid", 4 "url": "https://github.com/hsgw/plaid",
5 "maintainer": "hsgw", 5 "maintainer": "hsgw(Takuya Urakawa)",
6 "width": 12, 6 "width": 12,
7 "height": 4, 7 "height": 4,
8 "layouts": { 8 "layouts": {
diff --git a/keyboards/plaid/keymaps/brickbots/config.h b/keyboards/dm9records/plaid/keymaps/brickbots/config.h
index 5733b9e4b0..5733b9e4b0 100644
--- a/keyboards/plaid/keymaps/brickbots/config.h
+++ b/keyboards/dm9records/plaid/keymaps/brickbots/config.h
diff --git a/keyboards/plaid/keymaps/brickbots/keymap.c b/keyboards/dm9records/plaid/keymaps/brickbots/keymap.c
index 20b6eac682..20b6eac682 100644
--- a/keyboards/plaid/keymaps/brickbots/keymap.c
+++ b/keyboards/dm9records/plaid/keymaps/brickbots/keymap.c
diff --git a/keyboards/plaid/keymaps/brickbots/readme.md b/keyboards/dm9records/plaid/keymaps/brickbots/readme.md
index 48a12fa8bb..48a12fa8bb 100644
--- a/keyboards/plaid/keymaps/brickbots/readme.md
+++ b/keyboards/dm9records/plaid/keymaps/brickbots/readme.md
diff --git a/keyboards/plaid/keymaps/default/config.h b/keyboards/dm9records/plaid/keymaps/default/config.h
index 5733b9e4b0..5733b9e4b0 100644
--- a/keyboards/plaid/keymaps/default/config.h
+++ b/keyboards/dm9records/plaid/keymaps/default/config.h
diff --git a/keyboards/plaid/keymaps/default/keymap.c b/keyboards/dm9records/plaid/keymaps/default/keymap.c
index 6a858a4a73..6a858a4a73 100644
--- a/keyboards/plaid/keymaps/default/keymap.c
+++ b/keyboards/dm9records/plaid/keymaps/default/keymap.c
diff --git a/keyboards/plaid/keymaps/default/readme.md b/keyboards/dm9records/plaid/keymaps/default/readme.md
index 5a08a1fff3..5a08a1fff3 100644
--- a/keyboards/plaid/keymaps/default/readme.md
+++ b/keyboards/dm9records/plaid/keymaps/default/readme.md
diff --git a/keyboards/plaid/keymaps/thehalfdeafchef/config.h b/keyboards/dm9records/plaid/keymaps/thehalfdeafchef/config.h
index 4bcbc6f673..4bcbc6f673 100644
--- a/keyboards/plaid/keymaps/thehalfdeafchef/config.h
+++ b/keyboards/dm9records/plaid/keymaps/thehalfdeafchef/config.h
diff --git a/keyboards/plaid/keymaps/thehalfdeafchef/keymap.c b/keyboards/dm9records/plaid/keymaps/thehalfdeafchef/keymap.c
index bdf6c54c31..bdf6c54c31 100644
--- a/keyboards/plaid/keymaps/thehalfdeafchef/keymap.c
+++ b/keyboards/dm9records/plaid/keymaps/thehalfdeafchef/keymap.c
diff --git a/keyboards/plaid/keymaps/thehalfdeafchef/readme.md b/keyboards/dm9records/plaid/keymaps/thehalfdeafchef/readme.md
index bd09965b55..bd09965b55 100644
--- a/keyboards/plaid/keymaps/thehalfdeafchef/readme.md
+++ b/keyboards/dm9records/plaid/keymaps/thehalfdeafchef/readme.md
diff --git a/keyboards/plaid/plaid.c b/keyboards/dm9records/plaid/plaid.c
index 28f56d7f93..28f56d7f93 100644
--- a/keyboards/plaid/plaid.c
+++ b/keyboards/dm9records/plaid/plaid.c
diff --git a/keyboards/plaid/plaid.h b/keyboards/dm9records/plaid/plaid.h
index d791cf7c00..d791cf7c00 100644
--- a/keyboards/plaid/plaid.h
+++ b/keyboards/dm9records/plaid/plaid.h
diff --git a/keyboards/plaid/readme.md b/keyboards/dm9records/plaid/readme.md
index a491d05d3b..79621deec8 100644
--- a/keyboards/plaid/readme.md
+++ b/keyboards/dm9records/plaid/readme.md
@@ -9,11 +9,11 @@ Hardware Supported: ATMEGA328p with vusb [PCB](https://github.com/hsgw/plaid)
9Hardware Availability: Group buy in r/mk 9Hardware Availability: Group buy in r/mk
10 10
11Make example for this keyboard (after setting up your build environment): 11Make example for this keyboard (after setting up your build environment):
12 make plaid:default 12 make dm9records/plaid:default
13 13
14Flashing example for this keyboard: 14Flashing example for this keyboard:
15 15
16 make plaid:default:flash 16 make dm9records/plaid:default:flash
17 17
18## Bootloader 18## Bootloader
19use usbasploader in my repository. 19use usbasploader in my repository.
diff --git a/keyboards/plaid/rules.mk b/keyboards/dm9records/plaid/rules.mk
index 7c4112c9aa..7c4112c9aa 100644
--- a/keyboards/plaid/rules.mk
+++ b/keyboards/dm9records/plaid/rules.mk
diff --git a/keyboards/tartan/config.h b/keyboards/dm9records/tartan/config.h
index ee4393e53a..ee4393e53a 100644
--- a/keyboards/tartan/config.h
+++ b/keyboards/dm9records/tartan/config.h
diff --git a/keyboards/tartan/info.json b/keyboards/dm9records/tartan/info.json
index 72da8bd9d4..ff0ddfdf9d 100644
--- a/keyboards/tartan/info.json
+++ b/keyboards/dm9records/tartan/info.json
@@ -1,6 +1,6 @@
1{ 1{
2 "keyboard_name": "Tartan # Through Hole", 2 "keyboard_name": "Tartan # Through Hole",
3 "keyboard_folder": "tartan", 3 "keyboard_folder": "dm9records/tartan",
4 "url": "https://github.com/hsgw/tartan", 4 "url": "https://github.com/hsgw/tartan",
5 "maintainer": "hsgw(Takuya Urakawa)", 5 "maintainer": "hsgw(Takuya Urakawa)",
6 "width": 13, 6 "width": 13,
diff --git a/keyboards/tartan/keymaps/default/keymap.c b/keyboards/dm9records/tartan/keymaps/default/keymap.c
index 6224b4e615..6224b4e615 100644
--- a/keyboards/tartan/keymaps/default/keymap.c
+++ b/keyboards/dm9records/tartan/keymaps/default/keymap.c
diff --git a/keyboards/tartan/keymaps/default/readme.md b/keyboards/dm9records/tartan/keymaps/default/readme.md
index c829d53103..c829d53103 100644
--- a/keyboards/tartan/keymaps/default/readme.md
+++ b/keyboards/dm9records/tartan/keymaps/default/readme.md
diff --git a/keyboards/tartan/readme.md b/keyboards/dm9records/tartan/readme.md
index 83a3aebaea..b8439ed229 100644
--- a/keyboards/tartan/readme.md
+++ b/keyboards/dm9records/tartan/readme.md
@@ -10,12 +10,12 @@ A 60% keyboard with only through hole components.
10 10
11Make example for this keyboard (after setting up your build environment): 11Make example for this keyboard (after setting up your build environment):
12 12
13 make tartan:default 13 make dm9records/tartan:default
14 14
15Flash firmware: 15Flash firmware:
16 16
17 // In bootloader mode 17 // In bootloader mode
18 make tartan:default:flash 18 make dm9records/tartan:default:flash
19 19
20## Bootloader 20## Bootloader
21use usbasploader in my repository. 21use usbasploader in my repository.
diff --git a/keyboards/tartan/rules.mk b/keyboards/dm9records/tartan/rules.mk
index 8113001918..8113001918 100644
--- a/keyboards/tartan/rules.mk
+++ b/keyboards/dm9records/tartan/rules.mk
diff --git a/keyboards/tartan/tartan.c b/keyboards/dm9records/tartan/tartan.c
index b702633cc9..b702633cc9 100644
--- a/keyboards/tartan/tartan.c
+++ b/keyboards/dm9records/tartan/tartan.c
diff --git a/keyboards/tartan/tartan.h b/keyboards/dm9records/tartan/tartan.h
index e990088894..e990088894 100644
--- a/keyboards/tartan/tartan.h
+++ b/keyboards/dm9records/tartan/tartan.h
diff --git a/keyboards/eco/rules.mk b/keyboards/eco/rules.mk
index 7f7f20ed3b..078131da7c 100644
--- a/keyboards/eco/rules.mk
+++ b/keyboards/eco/rules.mk
@@ -23,7 +23,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
23NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 23NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
24BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 24BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
25MIDI_ENABLE = yes # MIDI controls 25MIDI_ENABLE = yes # MIDI controls
26AUDIO_ENABLE = yes # Audio output on port C6 26AUDIO_ENABLE = no # Audio output
27UNICODE_ENABLE = no # Unicode 27UNICODE_ENABLE = no # Unicode
28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. 29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
diff --git a/keyboards/ergodox_stm32/keymaps/default/keymap.c b/keyboards/ergodox_stm32/keymaps/default/keymap.c
index dcf8d15b7b..04a12962e3 100644
--- a/keyboards/ergodox_stm32/keymaps/default/keymap.c
+++ b/keyboards/ergodox_stm32/keymaps/default/keymap.c
@@ -9,10 +9,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
9 9
10}; 10};
11 11
12const uint16_t PROGMEM fn_actions[] = {
13 [1] = TT(1)
14};
15
16layer_state_t layer_state_set_user(layer_state_t state) { 12layer_state_t layer_state_set_user(layer_state_t state) {
17 13
18 uint8_t layer = get_highest_layer(state); 14 uint8_t layer = get_highest_layer(state);
diff --git a/keyboards/ergotravel/keymaps/ckofy/keymap.c b/keyboards/ergotravel/keymaps/ckofy/keymap.c
index 691d4aa943..b9a2c140d8 100644
--- a/keyboards/ergotravel/keymaps/ckofy/keymap.c
+++ b/keyboards/ergotravel/keymaps/ckofy/keymap.c
@@ -18,17 +18,6 @@ enum custom_keycodes {
18 ADJUST, 18 ADJUST,
19}; 19};
20 20
21/* Fn keys */
22
23enum {
24
25 F_SFT = 0,
26 F_ALT,
27 F_CTRL,
28 F_NUMPAD
29// F_LOWER,
30// F_RAISE,
31};
32 21
33#define KC_ KC_TRNS 22#define KC_ KC_TRNS
34#define KC_XXXX KC_NO 23#define KC_XXXX KC_NO
@@ -57,8 +46,8 @@ enum {
57#define KC_UDO LCTL(KC_Z) 46#define KC_UDO LCTL(KC_Z)
58#define KC_CUT LCTL(KC_X) 47#define KC_CUT LCTL(KC_X)
59#define KC_SVE LCTL(KC_S) 48#define KC_SVE LCTL(KC_S)
60#define KC_OSH F(F_SFT) 49#define KC_OSH OSM(MOD_LSFT)
61#define KC_OCTL F(F_CTRL) 50#define KC_OCTL OSM(MOD_LCTL)
62#define KC_NUMP TT(_NUMPAD) 51#define KC_NUMP TT(_NUMPAD)
63#define KC_SHESC MT(MOD_LSFT,KC_ESC) 52#define KC_SHESC MT(MOD_LSFT,KC_ESC)
64#define KC_SHENT MT(MOD_RSFT,KC_ENT) 53#define KC_SHENT MT(MOD_RSFT,KC_ENT)
@@ -142,14 +131,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
142 131
143}; 132};
144 133
145const uint16_t PROGMEM fn_actions[] = {
146 [F_SFT] = ACTION_MODS_ONESHOT (MOD_LSFT)
147 ,[F_ALT] = ACTION_MODS_ONESHOT (MOD_LALT)
148 ,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL)
149};
150
151
152
153bool process_record_user(uint16_t keycode, keyrecord_t *record) { 134bool process_record_user(uint16_t keycode, keyrecord_t *record) {
154 switch (keycode) { 135 switch (keycode) {
155 case COLEMAK: 136 case COLEMAK:
diff --git a/keyboards/gh60/revc/keymaps/robotmaxtron/keymap.c b/keyboards/gh60/revc/keymaps/robotmaxtron/keymap.c
index d7d8316c66..770fe723b5 100644
--- a/keyboards/gh60/revc/keymaps/robotmaxtron/keymap.c
+++ b/keyboards/gh60/revc/keymaps/robotmaxtron/keymap.c
@@ -65,9 +65,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
65 */ 65 */
66 [_FL] = LAYOUT( 66 [_FL] = LAYOUT(
67 KC_GRAVE,KC_F1,KC_F2,KC_F3,KC_F4,KC_F5,KC_F6,KC_F7,KC_F8,KC_F9,KC_F10,KC_F11,KC_F12,KC_DELETE, \ 67 KC_GRAVE,KC_F1,KC_F2,KC_F3,KC_F4,KC_F5,KC_F6,KC_F7,KC_F8,KC_F9,KC_F10,KC_F11,KC_F12,KC_DELETE, \
68 KC_TRNS,F(1),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_CALC,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR,KC_SLCK,KC_PAUS,KC_TRNS, \ 68 KC_TRNS,TG(1),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_CALC,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR,KC_SLCK,KC_PAUS,KC_TRNS, \
69 KC_TRNS,KC_MUTE,KC__VOLDOWN,KC__VOLUP,KC_TRNS,KC_TRNS,KC_HOME,KC_LEFT,KC_DOWN,KC_RGHT,KC_INS,KC_TRNS,KC_TRNS,KC_TRNS, \ 69 KC_TRNS,KC_MUTE,KC__VOLDOWN,KC__VOLUP,KC_TRNS,KC_TRNS,KC_HOME,KC_LEFT,KC_DOWN,KC_RGHT,KC_INS,KC_TRNS,KC_TRNS,KC_TRNS, \
70 KC_TRNS,KC_TRNS,F(3),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_END,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, \ 70 KC_TRNS,KC_TRNS,TG(3),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_END,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, \
71 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS), 71 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS),
72 72
73 /* 73 /*
@@ -106,8 +106,6 @@ enum function_id {
106}; 106};
107 107
108const uint16_t PROGMEM fn_actions[] = { 108const uint16_t PROGMEM fn_actions[] = {
109 [1] = ACTION_LAYER_TOGGLE(1), // Toggle Arrow Layer overlay
110 [3] = ACTION_LAYER_TOGGLE(3), // Toggle Underglow Layer overlay
111 [4] = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow 109 [4] = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow
112 [5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode 110 [5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode
113 [6] = ACTION_FUNCTION(RGBLED_INCREASE_HUE), 111 [6] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
diff --git a/keyboards/gh60/satan/keymaps/denolfe/keymap.c b/keyboards/gh60/satan/keymaps/denolfe/keymap.c
index 98fcd9b989..a70c409fe8 100644
--- a/keyboards/gh60/satan/keymaps/denolfe/keymap.c
+++ b/keyboards/gh60/satan/keymaps/denolfe/keymap.c
@@ -62,7 +62,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
62 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGDN, KC_PGUP, KC_TRNS, KC_END, KC_MPRV, KC_MNXT, KC_MPLY, \ 62 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGDN, KC_PGUP, KC_TRNS, KC_END, KC_MPRV, KC_MNXT, KC_MPLY, \
63 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, \ 63 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, \
64 KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_TOGG, BL_INC, KC_HOME, LCTL(KC_LEFT), LCTL(KC_END), LCTL(KC_RIGHT), KC_TRNS, RESET, \ 64 KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_TOGG, BL_INC, KC_HOME, LCTL(KC_LEFT), LCTL(KC_END), LCTL(KC_RIGHT), KC_TRNS, RESET, \
65 KC_TRNS, KC_TRNS, F(9), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 65 KC_TRNS, KC_TRNS, LM(2, MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
66 #endif 66 #endif
67 67
68[_SL] = LAYOUT_60_ansi( 68[_SL] = LAYOUT_60_ansi(
@@ -99,7 +99,6 @@ const uint16_t PROGMEM fn_actions[] = {
99 [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL), 99 [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
100 [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL), 100 [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
101 #endif 101 #endif
102 [9] = ACTION_LAYER_MODS(2, MOD_LSFT)
103}; 102};
104 103
105void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { 104void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
diff --git a/keyboards/handwired/ms_sculpt_mobile/keymaps/milestogo/keymap.c b/keyboards/handwired/ms_sculpt_mobile/keymaps/milestogo/keymap.c
index 602bdd157b..94d9289cdc 100644
--- a/keyboards/handwired/ms_sculpt_mobile/keymaps/milestogo/keymap.c
+++ b/keyboards/handwired/ms_sculpt_mobile/keymaps/milestogo/keymap.c
@@ -29,7 +29,6 @@ TRAN
29#define TT_SYM MO(_SYM) 29#define TT_SYM MO(_SYM)
30#define TT_MOV LT(_MOV,KC_BSPC) 30#define TT_MOV LT(_MOV,KC_BSPC)
31#define TT_NUM MO(_NUM) 31#define TT_NUM MO(_NUM)
32#define SSFT ACTION_MODS_ONESHOT(MOD_LSFT)
33 32
34enum macro_keycodes { 33enum macro_keycodes {
35DHPASTE=1, 34DHPASTE=1,
diff --git a/keyboards/hhkb/ansi/ansi.c b/keyboards/hhkb/ansi/ansi.c
new file mode 100644
index 0000000000..cefc4e0690
--- /dev/null
+++ b/keyboards/hhkb/ansi/ansi.c
@@ -0,0 +1 @@
#include "ansi.h" \ No newline at end of file
diff --git a/keyboards/hhkb/ansi/ansi.h b/keyboards/hhkb/ansi/ansi.h
new file mode 100644
index 0000000000..28e8d2fef8
--- /dev/null
+++ b/keyboards/hhkb/ansi/ansi.h
@@ -0,0 +1,23 @@
1#pragma once
2
3#include "quantum.h"
4
5#define LAYOUT( \
6 K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \
7 K32, K01, K02, K13, K12, K23, K22, K42, K43, K62, K63, K73, K72, K52, \
8 K33, K04, K03, K14, K15, K24, K25, K45, K44, K65, K64, K74, K53, \
9 K34, K05, K06, K07, K16, K17, K26, K46, K66, K76, K75, K55, K54, \
10 K35, K36, K37, K57, K56) \
11 \
12{ \
13 { K00, K01, K02, K03, K04, K05, K06, K07 }, \
14 { K10, K11, K12, K13, K14, K15, K16, K17 }, \
15 { K20, K21, K22, K23, K24, K25, K26, KC_NO }, \
16 { K30, K31, K32, K33, K34, K35, K36, K37 }, \
17 { K40, K41, K42, K43, K44, K45, K46, KC_NO }, \
18 { K50, K51, K52, K53, K54, K55, K56, K57 }, \
19 { K60, K61, K62, K63, K64, K65, K66, KC_NO }, \
20 { K70, K71, K72, K73, K74, K75, K76, KC_NO } \
21}
22
23#define LAYOUT_60_hhkb LAYOUT
diff --git a/keyboards/hhkb/config.h b/keyboards/hhkb/ansi/config.h
index fc747a6e94..689fd55681 100644
--- a/keyboards/hhkb/config.h
+++ b/keyboards/hhkb/ansi/config.h
@@ -15,25 +15,20 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#ifndef CONFIG_H 18#pragma once
19#define CONFIG_H
20 19
21#include "config_common.h" 20#include "config_common.h"
22 21
23/* USB Device descriptor parameter */ 22/* USB Device descriptor parameter */
24#define VENDOR_ID 0xFEED 23#define VENDOR_ID 0x4848 // HH = happy hacking
25#define PRODUCT_ID 0xCAFE 24#define PRODUCT_ID 0x0001 // ANSI HHKB
26#define DEVICE_VER 0x0104 25#define DEVICE_VER 0x0104
27#define MANUFACTURER q.m.k 26#define MANUFACTURER q.m.k
28#define PRODUCT HHKB mod 27#define PRODUCT HHKB mod
29#define DESCRIPTION q.m.k keyboard firmware for HHKB 28#define DESCRIPTION q.m.k keyboard firmware for HHKB
30 29
31/* key matrix size */ 30/* key matrix size */
32#ifdef HHKB_JP 31#define MATRIX_ROWS 8
33# define MATRIX_ROWS 16
34#else
35# define MATRIX_ROWS 8
36#endif
37#define MATRIX_COLS 8 32#define MATRIX_COLS 8
38 33
39#define TAPPING_TERM 200 34#define TAPPING_TERM 200
@@ -107,5 +102,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
107//#define NO_ACTION_ONESHOT 102//#define NO_ACTION_ONESHOT
108//#define NO_ACTION_MACRO 103//#define NO_ACTION_MACRO
109//#define NO_ACTION_FUNCTION 104//#define NO_ACTION_FUNCTION
110
111#endif
diff --git a/keyboards/hhkb/ansi/hhkb_avr.h b/keyboards/hhkb/ansi/hhkb_avr.h
new file mode 100644
index 0000000000..f9446deef7
--- /dev/null
+++ b/keyboards/hhkb/ansi/hhkb_avr.h
@@ -0,0 +1,157 @@
1#pragma once
2
3#include <stdint.h>
4#include <stdbool.h>
5#include <avr/io.h>
6#include <avr/interrupt.h>
7#include <util/delay.h>
8
9
10// Timer resolution check
11#if (1000000/TIMER_RAW_FREQ > 20)
12# error "Timer resolution(>20us) is not enough for HHKB matrix scan tweak on V-USB."
13#endif
14
15
16/*
17 * HHKB Matrix I/O
18 *
19 * row: HC4051[A,B,C] selects scan row0-7
20 * row-ext: [En0,En1] row extention for JP
21 * col: LS145[A,B,C,D] selects scan col0-7 and enable(D)
22 * key: on: 0/off: 1
23 * prev: hysteresis control: assert(1) when previous key state is on
24 */
25
26
27#if defined(__AVR_ATmega32U4__)
28/*
29 * For TMK HHKB alt controller(ATMega32U4)
30 *
31 * row: PB0-2
32 * col: PB3-5,6
33 * key: PD7(pull-uped)
34 * prev: PB7
35 * power: PD4(L:off/H:on)
36 * row-ext: PC6,7 for HHKB JP(active low)
37 */
38static inline void KEY_ENABLE(void) { (PORTB &= ~(1<<6)); }
39static inline void KEY_UNABLE(void) { (PORTB |= (1<<6)); }
40static inline bool KEY_STATE(void) { return (PIND & (1<<7)); }
41static inline void KEY_PREV_ON(void) { (PORTB |= (1<<7)); }
42static inline void KEY_PREV_OFF(void) { (PORTB &= ~(1<<7)); }
43#ifdef HHKB_POWER_SAVING
44static inline void KEY_POWER_ON(void) {
45 DDRB = 0xFF; PORTB = 0x40; // change pins output
46 DDRD |= (1<<4); PORTD |= (1<<4); // MOS FET switch on
47 /* Without this wait you will miss or get false key events. */
48 _delay_ms(5); // wait for powering up
49}
50static inline void KEY_POWER_OFF(void) {
51 /* input with pull-up consumes less than without it when pin is open. */
52 DDRB = 0x00; PORTB = 0xFF; // change pins input with pull-up
53 DDRD |= (1<<4); PORTD &= ~(1<<4); // MOS FET switch off
54}
55static inline bool KEY_POWER_STATE(void) { return PORTD & (1<<4); }
56#else
57static inline void KEY_POWER_ON(void) {}
58static inline void KEY_POWER_OFF(void) {}
59static inline bool KEY_POWER_STATE(void) { return true; }
60#endif
61static inline void KEY_INIT(void)
62{
63 /* row,col,prev: output */
64 DDRB = 0xFF;
65 PORTB = 0x40; // unable
66 /* key: input with pull-up */
67 DDRD &= ~0x80;
68 PORTD |= 0x80;
69
70 KEY_UNABLE();
71 KEY_PREV_OFF();
72
73 KEY_POWER_OFF();
74}
75static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
76{
77 PORTB = (PORTB & 0xC0) | (((COL) & 0x07)<<3) | ((ROW) & 0x07);
78
79}
80
81
82#elif defined(__AVR_AT90USB1286__)
83/*
84 * For Teensy++(AT90USB1286)
85 *
86 * HHKB pro HHKB pro2
87 * row: PB0-2 (6-8) (5-7)
88 * col: PB3-5,6 (9-12) (8-11)
89 * key: PE6(pull-uped) (4) (3)
90 * prev: PE7 (5) (4)
91 *
92 * TODO: convert into 'staitc inline' function
93 */
94#define KEY_INIT() do { \
95 DDRB |= 0x7F; \
96 DDRE |= (1<<7); \
97 DDRE &= ~(1<<6); \
98 PORTE |= (1<<6); \
99} while (0)
100#define KEY_SELECT(ROW, COL) (PORTB = (PORTB & 0xC0) | \
101 (((COL) & 0x07)<<3) | \
102 ((ROW) & 0x07))
103#define KEY_ENABLE() (PORTB &= ~(1<<6))
104#define KEY_UNABLE() (PORTB |= (1<<6))
105#define KEY_STATE() (PINE & (1<<6))
106#define KEY_PREV_ON() (PORTE |= (1<<7))
107#define KEY_PREV_OFF() (PORTE &= ~(1<<7))
108#define KEY_POWER_ON()
109#define KEY_POWER_OFF()
110#define KEY_POWER_STATE() true
111
112
113#else
114# error "define code for matrix scan"
115#endif
116
117
118#if 0
119// For ATMega328P with V-USB
120//
121// #elif defined(__AVR_ATmega328P__)
122// Ports for V-USB
123// key: PB0(pull-uped)
124// prev: PB1
125// row: PB2-4
126// col: PC0-2,3
127// power: PB5(Low:on/Hi-z:off)
128#define KEY_INIT() do { \
129 DDRB |= 0x3E; \
130 DDRB &= ~(1<<0); \
131 PORTB |= 1<<0; \
132 DDRC |= 0x0F; \
133 KEY_UNABLE(); \
134 KEY_PREV_OFF(); \
135} while (0)
136#define KEY_SELECT(ROW, COL) do { \
137 PORTB = (PORTB & 0xE3) | ((ROW) & 0x07)<<2; \
138 PORTC = (PORTC & 0xF8) | ((COL) & 0x07); \
139} while (0)
140#define KEY_ENABLE() (PORTC &= ~(1<<3))
141#define KEY_UNABLE() (PORTC |= (1<<3))
142#define KEY_STATE() (PINB & (1<<0))
143#define KEY_PREV_ON() (PORTB |= (1<<1))
144#define KEY_PREV_OFF() (PORTB &= ~(1<<1))
145// Power supply switching
146#define KEY_POWER_ON() do { \
147 KEY_INIT(); \
148 PORTB &= ~(1<<5); \
149 _delay_ms(1); \
150} while (0)
151#define KEY_POWER_OFF() do { \
152 DDRB &= ~0x3F; \
153 PORTB &= ~0x3F; \
154 DDRC &= ~0x0F; \
155 PORTC &= ~0x0F; \
156} while (0)
157#endif
diff --git a/keyboards/hhkb/ansi/info.json b/keyboards/hhkb/ansi/info.json
new file mode 100644
index 0000000000..a36f1d44c8
--- /dev/null
+++ b/keyboards/hhkb/ansi/info.json
@@ -0,0 +1,73 @@
1{
2 "keyboard_name": "HHKB",
3 "url": "",
4 "maintainer": "qmk",
5 "width": 15,
6 "height": 5,
7 "layouts": {
8 "LAYOUT": {
9 "layout": [
10 { "label": "Esc", "x": 0, "y": 0 },
11 { "label": "!", "x": 1, "y": 0 },
12 { "label": "@", "x": 2, "y": 0 },
13 { "label": "#", "x": 3, "y": 0 },
14 { "label": "$", "x": 4, "y": 0 },
15 { "label": "%", "x": 5, "y": 0 },
16 { "label": "^", "x": 6, "y": 0 },
17 { "label": "&", "x": 7, "y": 0 },
18 { "label": "*", "x": 8, "y": 0 },
19 { "label": "(", "x": 9, "y": 0 },
20 { "label": ")", "x": 10, "y": 0 },
21 { "label": "_", "x": 11, "y": 0 },
22 { "label": "+", "x": 12, "y": 0 },
23 { "label": "|", "x": 13, "y": 0 },
24 { "label": "~", "x": 14, "y": 0 },
25 { "label": "Tab", "x": 0, "y": 1, "w": 1.5 },
26 { "label": "Q", "x": 1.5, "y": 1 },
27 { "label": "W", "x": 2.5, "y": 1 },
28 { "label": "E", "x": 3.5, "y": 1 },
29 { "label": "R", "x": 4.5, "y": 1 },
30 { "label": "T", "x": 5.5, "y": 1 },
31 { "label": "Y", "x": 6.5, "y": 1 },
32 { "label": "U", "x": 7.5, "y": 1 },
33 { "label": "I", "x": 8.5, "y": 1 },
34 { "label": "O", "x": 9.5, "y": 1 },
35 { "label": "P", "x": 10.5, "y": 1 },
36 { "label": "{", "x": 11.5, "y": 1 },
37 { "label": "}", "x": 12.5, "y": 1 },
38 { "label": "Delete", "x": 13.5, "y": 1, "w": 1.5 },
39 { "label": "Control", "x": 0, "y": 2, "w": 1.75 },
40 { "label": "A", "x": 1.75, "y": 2 },
41 { "label": "S", "x": 2.75, "y": 2 },
42 { "label": "D", "x": 3.75, "y": 2 },
43 { "label": "F", "x": 4.75, "y": 2 },
44 { "label": "G", "x": 5.75, "y": 2 },
45 { "label": "H", "x": 6.75, "y": 2 },
46 { "label": "J", "x": 7.75, "y": 2 },
47 { "label": "K", "x": 8.75, "y": 2 },
48 { "label": "L", "x": 9.75, "y": 2 },
49 { "label": ":", "x": 10.75, "y": 2 },
50 { "label": "\"", "x": 11.75, "y": 2 },
51 { "label": "Return", "x": 12.75, "y": 2, "w": 2.25 },
52 { "label": "Shift", "x": 0, "y": 3, "w": 2.25 },
53 { "label": "Z", "x": 2.25, "y": 3 },
54 { "label": "X", "x": 3.25, "y": 3 },
55 { "label": "C", "x": 4.25, "y": 3 },
56 { "label": "V", "x": 5.25, "y": 3 },
57 { "label": "B", "x": 6.25, "y": 3 },
58 { "label": "N", "x": 7.25, "y": 3 },
59 { "label": "M", "x": 8.25, "y": 3 },
60 { "label": "<", "x": 9.25, "y": 3 },
61 { "label": ">", "x": 10.25, "y": 3 },
62 { "label": "?", "x": 11.25, "y": 3 },
63 { "label": "Shift", "x": 12.25, "y": 3, "w": 1.75 },
64 { "label": "Fn", "x": 14, "y": 3 },
65 { "label": "", "x": 1.5, "y": 4 },
66 { "label": "", "x": 2.5, "y": 4, "w": 1.5 },
67 { "x": 4, "y": 4, "w": 6 },
68 { "label": "", "x": 10, "y": 4, "w": 1.5 },
69 { "label": "", "x": 11.5, "y": 4 }
70 ]
71 }
72 }
73}
diff --git a/keyboards/hhkb/keymaps/blakedietz/README.md b/keyboards/hhkb/ansi/keymaps/blakedietz/README.md
index 4dff47a6e8..4dff47a6e8 100644
--- a/keyboards/hhkb/keymaps/blakedietz/README.md
+++ b/keyboards/hhkb/ansi/keymaps/blakedietz/README.md
diff --git a/keyboards/hhkb/keymaps/blakedietz/config.h b/keyboards/hhkb/ansi/keymaps/blakedietz/config.h
index e0d2bce0f1..e0d2bce0f1 100644
--- a/keyboards/hhkb/keymaps/blakedietz/config.h
+++ b/keyboards/hhkb/ansi/keymaps/blakedietz/config.h
diff --git a/keyboards/hhkb/keymaps/blakedietz/keymap.c b/keyboards/hhkb/ansi/keymaps/blakedietz/keymap.c
index a9146a4a08..a9146a4a08 100644
--- a/keyboards/hhkb/keymaps/blakedietz/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/blakedietz/keymap.c
diff --git a/keyboards/hhkb/keymaps/blakedietz/rules.mk b/keyboards/hhkb/ansi/keymaps/blakedietz/rules.mk
index 7d97e7a524..7d97e7a524 100644
--- a/keyboards/hhkb/keymaps/blakedietz/rules.mk
+++ b/keyboards/hhkb/ansi/keymaps/blakedietz/rules.mk
diff --git a/keyboards/hhkb/keymaps/brett/config.h b/keyboards/hhkb/ansi/keymaps/brett/config.h
index b9a61e10a7..b9a61e10a7 100644
--- a/keyboards/hhkb/keymaps/brett/config.h
+++ b/keyboards/hhkb/ansi/keymaps/brett/config.h
diff --git a/keyboards/hhkb/keymaps/brett/keymap.c b/keyboards/hhkb/ansi/keymaps/brett/keymap.c
index 1201146b00..1201146b00 100644
--- a/keyboards/hhkb/keymaps/brett/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/brett/keymap.c
diff --git a/keyboards/hhkb/keymaps/brett/readme.md b/keyboards/hhkb/ansi/keymaps/brett/readme.md
index fd07b155fb..fd07b155fb 100644
--- a/keyboards/hhkb/keymaps/brett/readme.md
+++ b/keyboards/hhkb/ansi/keymaps/brett/readme.md
diff --git a/keyboards/hhkb/keymaps/brett/rules.mk b/keyboards/hhkb/ansi/keymaps/brett/rules.mk
index 88f57515f1..88f57515f1 100644
--- a/keyboards/hhkb/keymaps/brett/rules.mk
+++ b/keyboards/hhkb/ansi/keymaps/brett/rules.mk
diff --git a/keyboards/hhkb/keymaps/cinaeco/README.md b/keyboards/hhkb/ansi/keymaps/cinaeco/README.md
index c1c48e6093..c1c48e6093 100644
--- a/keyboards/hhkb/keymaps/cinaeco/README.md
+++ b/keyboards/hhkb/ansi/keymaps/cinaeco/README.md
diff --git a/keyboards/hhkb/keymaps/cinaeco/config.h b/keyboards/hhkb/ansi/keymaps/cinaeco/config.h
index c7b4c784c0..c7b4c784c0 100644
--- a/keyboards/hhkb/keymaps/cinaeco/config.h
+++ b/keyboards/hhkb/ansi/keymaps/cinaeco/config.h
diff --git a/keyboards/hhkb/keymaps/cinaeco/keymap.c b/keyboards/hhkb/ansi/keymaps/cinaeco/keymap.c
index c27e37d8a0..c27e37d8a0 100644
--- a/keyboards/hhkb/keymaps/cinaeco/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/cinaeco/keymap.c
diff --git a/keyboards/hhkb/keymaps/cinaeco/rules.mk b/keyboards/hhkb/ansi/keymaps/cinaeco/rules.mk
index a85669aa2f..a85669aa2f 100644
--- a/keyboards/hhkb/keymaps/cinaeco/rules.mk
+++ b/keyboards/hhkb/ansi/keymaps/cinaeco/rules.mk
diff --git a/keyboards/hhkb/keymaps/dbroqua/keymap.c b/keyboards/hhkb/ansi/keymaps/dbroqua/keymap.c
index e230a87fb2..e230a87fb2 100644
--- a/keyboards/hhkb/keymaps/dbroqua/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/dbroqua/keymap.c
diff --git a/keyboards/hhkb/keymaps/dbroqua/readme.md b/keyboards/hhkb/ansi/keymaps/dbroqua/readme.md
index 3b8950fee0..3b8950fee0 100644
--- a/keyboards/hhkb/keymaps/dbroqua/readme.md
+++ b/keyboards/hhkb/ansi/keymaps/dbroqua/readme.md
diff --git a/keyboards/hhkb/keymaps/default/keymap.c b/keyboards/hhkb/ansi/keymaps/default/keymap.c
index c63ef6a579..c63ef6a579 100644
--- a/keyboards/hhkb/keymaps/default/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/default/keymap.c
diff --git a/keyboards/hhkb/keymaps/eric/keymap.c b/keyboards/hhkb/ansi/keymaps/eric/keymap.c
index bf788b2ffd..bf788b2ffd 100644
--- a/keyboards/hhkb/keymaps/eric/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/eric/keymap.c
diff --git a/keyboards/hhkb/keymaps/dhertz/config.h b/keyboards/hhkb/ansi/keymaps/krusli/config.h
index af2fb9d8a5..af2fb9d8a5 100644
--- a/keyboards/hhkb/keymaps/dhertz/config.h
+++ b/keyboards/hhkb/ansi/keymaps/krusli/config.h
diff --git a/keyboards/hhkb/keymaps/krusli/keymap.c b/keyboards/hhkb/ansi/keymaps/krusli/keymap.c
index af6102f108..af6102f108 100644
--- a/keyboards/hhkb/keymaps/krusli/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/krusli/keymap.c
diff --git a/keyboards/hhkb/keymaps/lxol/keymap.c b/keyboards/hhkb/ansi/keymaps/lxol/keymap.c
index 3e3b3d2ed0..462a980471 100644
--- a/keyboards/hhkb/keymaps/lxol/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/lxol/keymap.c
@@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
33 33
34 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, 34 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV,
35 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, 35 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC,
36 KC_LCTL, LT(LALTLEV, KC_A), LT(LGUILEV, KC_S), KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, LT(RGUILEV, KC_L), LT(RALTLEV, KC_SCLN), KC_QUOT, KC_FN0, 36 KC_LCTL, LT(LALTLEV, KC_A), LT(LGUILEV, KC_S), KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, LT(RGUILEV, KC_L), LT(RALTLEV, KC_SCLN), KC_QUOT, MT(MOD_RCTL, KC_ENT),
37 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(HHKB), 37 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(HHKB),
38 KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT), 38 KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT),
39 39
@@ -80,7 +80,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
80 80
81 RGUI(KC_ESC), RGUI(KC_1), RGUI(KC_2), RGUI(KC_3), RGUI(KC_4), RGUI(KC_5), RGUI(KC_6), RGUI(KC_7), RGUI(KC_8), RGUI(KC_9), RGUI(KC_0), RGUI(KC_MINS), RGUI(KC_EQL), RGUI(KC_BSLS), RGUI(KC_GRV), 81 RGUI(KC_ESC), RGUI(KC_1), RGUI(KC_2), RGUI(KC_3), RGUI(KC_4), RGUI(KC_5), RGUI(KC_6), RGUI(KC_7), RGUI(KC_8), RGUI(KC_9), RGUI(KC_0), RGUI(KC_MINS), RGUI(KC_EQL), RGUI(KC_BSLS), RGUI(KC_GRV),
82 RGUI(KC_TAB), RGUI(KC_Q), RGUI(KC_W), RGUI(KC_E), RGUI(KC_R), RGUI(KC_T), RGUI(KC_Y), RGUI(KC_U), RGUI(KC_I), RGUI(KC_O), RGUI(KC_P), RGUI(KC_LBRC), RGUI(KC_RBRC), RGUI(KC_BSPC), 82 RGUI(KC_TAB), RGUI(KC_Q), RGUI(KC_W), RGUI(KC_E), RGUI(KC_R), RGUI(KC_T), RGUI(KC_Y), RGUI(KC_U), RGUI(KC_I), RGUI(KC_O), RGUI(KC_P), RGUI(KC_LBRC), RGUI(KC_RBRC), RGUI(KC_BSPC),
83 RGUI(KC_LCTL), RGUI(KC_A), RGUI(KC_S), RGUI(KC_D), RGUI(KC_F), RGUI(KC_G), RGUI(KC_H), RGUI(KC_J), RGUI(KC_K), KC_TRNS, KC_TRNS, RGUI(KC_QUOT), KC_FN0, 83 RGUI(KC_LCTL), RGUI(KC_A), RGUI(KC_S), RGUI(KC_D), RGUI(KC_F), RGUI(KC_G), RGUI(KC_H), RGUI(KC_J), RGUI(KC_K), KC_TRNS, KC_TRNS, RGUI(KC_QUOT), MT(MOD_RCTL, KC_ENT),
84 RGUI(KC_LSFT), RGUI(KC_Z), RGUI(KC_X), RGUI(KC_C), RGUI(KC_V), RGUI(KC_B), RGUI(KC_N), RGUI(KC_M), RGUI(KC_COMM), RGUI(KC_DOT), RGUI(KC_SLSH), RGUI(KC_RSFT), KC_TRNS, 84 RGUI(KC_LSFT), RGUI(KC_Z), RGUI(KC_X), RGUI(KC_C), RGUI(KC_V), RGUI(KC_B), RGUI(KC_N), RGUI(KC_M), RGUI(KC_COMM), RGUI(KC_DOT), RGUI(KC_SLSH), RGUI(KC_RSFT), KC_TRNS,
85 KC_LALT, KC_LGUI, RGUI(KC_SPC), KC_RGUI, KC_RALT), 85 KC_LALT, KC_LGUI, RGUI(KC_SPC), KC_RGUI, KC_RALT),
86 86
@@ -104,7 +104,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
104 104
105 LGUI(KC_ESC), LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), LGUI(KC_4), LGUI(KC_5), LGUI(KC_6), LGUI(KC_7), LGUI(KC_8), LGUI(KC_9), LGUI(KC_0), LGUI(KC_MINS), LGUI(KC_EQL), LGUI(KC_BSLS), LGUI(KC_GRV), 105 LGUI(KC_ESC), LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), LGUI(KC_4), LGUI(KC_5), LGUI(KC_6), LGUI(KC_7), LGUI(KC_8), LGUI(KC_9), LGUI(KC_0), LGUI(KC_MINS), LGUI(KC_EQL), LGUI(KC_BSLS), LGUI(KC_GRV),
106 LGUI(KC_TAB), LGUI(KC_Q), LGUI(KC_W), LGUI(KC_E), LGUI(KC_R), LGUI(KC_T), LGUI(KC_Y), LGUI(KC_U), LGUI(KC_I), LGUI(KC_O), LGUI(KC_P), LGUI(KC_LBRC), LGUI(KC_RBRC), LGUI(KC_BSPC), 106 LGUI(KC_TAB), LGUI(KC_Q), LGUI(KC_W), LGUI(KC_E), LGUI(KC_R), LGUI(KC_T), LGUI(KC_Y), LGUI(KC_U), LGUI(KC_I), LGUI(KC_O), LGUI(KC_P), LGUI(KC_LBRC), LGUI(KC_RBRC), LGUI(KC_BSPC),
107 LGUI(KC_LCTL), KC_TRNS, KC_TRNS, LGUI(KC_D), LGUI(KC_F), LGUI(KC_G), LGUI(KC_H), LGUI(KC_J), LGUI(KC_K), LGUI(KC_L), LGUI(KC_SCLN), LGUI(KC_QUOT), KC_FN0, 107 LGUI(KC_LCTL), KC_TRNS, KC_TRNS, LGUI(KC_D), LGUI(KC_F), LGUI(KC_G), LGUI(KC_H), LGUI(KC_J), LGUI(KC_K), LGUI(KC_L), LGUI(KC_SCLN), LGUI(KC_QUOT), MT(MOD_RCTL, KC_ENT),
108 KC_LSFT, LGUI(KC_Z), LGUI(KC_X), LGUI(KC_C), LGUI(KC_V), LGUI(KC_B), LGUI(KC_N), LGUI(KC_M), LGUI(KC_COMM), LGUI(KC_DOT), LGUI(KC_SLSH), KC_RSFT, KC_TRNS, 108 KC_LSFT, LGUI(KC_Z), LGUI(KC_X), LGUI(KC_C), LGUI(KC_V), LGUI(KC_B), LGUI(KC_N), LGUI(KC_M), LGUI(KC_COMM), LGUI(KC_DOT), LGUI(KC_SLSH), KC_RSFT, KC_TRNS,
109 KC_LALT, KC_LGUI, LGUI(KC_SPC), KC_LGUI, KC_RALT), 109 KC_LALT, KC_LGUI, LGUI(KC_SPC), KC_LGUI, KC_RALT),
110 110
@@ -128,7 +128,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
128 128
129 RALT(KC_ESC), RALT(KC_1), RALT(KC_2), RALT(KC_3), RALT(KC_4), RALT(KC_5), RALT(KC_6), RALT(KC_7), RALT(KC_8), RALT(KC_9), RALT(KC_0), RALT(KC_MINS), RALT(KC_EQL), RALT(KC_BSLS), RALT(KC_GRV), 129 RALT(KC_ESC), RALT(KC_1), RALT(KC_2), RALT(KC_3), RALT(KC_4), RALT(KC_5), RALT(KC_6), RALT(KC_7), RALT(KC_8), RALT(KC_9), RALT(KC_0), RALT(KC_MINS), RALT(KC_EQL), RALT(KC_BSLS), RALT(KC_GRV),
130 RALT(KC_TAB), RALT(KC_Q), RALT(KC_W), RALT(KC_E), RALT(KC_R), RALT(KC_T), RALT(KC_Y), RALT(KC_U), RALT(KC_I), RALT(KC_O), RALT(KC_P), RALT(KC_LBRC), RALT(KC_RBRC), RALT(KC_BSPC), 130 RALT(KC_TAB), RALT(KC_Q), RALT(KC_W), RALT(KC_E), RALT(KC_R), RALT(KC_T), RALT(KC_Y), RALT(KC_U), RALT(KC_I), RALT(KC_O), RALT(KC_P), RALT(KC_LBRC), RALT(KC_RBRC), RALT(KC_BSPC),
131 RALT(KC_LCTL), RALT(KC_A), RALT(KC_S), RALT(KC_D), RALT(KC_F), RALT(KC_G), RALT(KC_H), RALT(KC_J), RALT(KC_K), KC_TRNS, KC_TRNS, RALT(KC_QUOT), KC_FN0, 131 RALT(KC_LCTL), RALT(KC_A), RALT(KC_S), RALT(KC_D), RALT(KC_F), RALT(KC_G), RALT(KC_H), RALT(KC_J), RALT(KC_K), KC_TRNS, KC_TRNS, RALT(KC_QUOT), MT(MOD_RCTL, KC_ENT),
132 RALT(KC_LSFT), RALT(KC_Z), RALT(KC_X), RALT(KC_C), RALT(KC_V), RALT(KC_B), RALT(KC_N), RALT(KC_M), RALT(KC_COMM), RALT(KC_DOT), RALT(KC_SLSH), RALT(KC_RSFT), KC_TRNS, 132 RALT(KC_LSFT), RALT(KC_Z), RALT(KC_X), RALT(KC_C), RALT(KC_V), RALT(KC_B), RALT(KC_N), RALT(KC_M), RALT(KC_COMM), RALT(KC_DOT), RALT(KC_SLSH), RALT(KC_RSFT), KC_TRNS,
133 KC_LALT, KC_LGUI, RALT(KC_SPC), KC_RGUI, KC_RALT), 133 KC_LALT, KC_LGUI, RALT(KC_SPC), KC_RGUI, KC_RALT),
134 134
@@ -152,7 +152,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
152 152
153 LALT(KC_ESC), LALT(KC_1), LALT(KC_2), LALT(KC_3), LALT(KC_4), LALT(KC_5), LALT(KC_6), LALT(KC_7), LALT(KC_8), LALT(KC_9), LALT(KC_0), LALT(KC_MINS), LALT(KC_EQL), LALT(KC_BSLS), LALT(KC_GRV), 153 LALT(KC_ESC), LALT(KC_1), LALT(KC_2), LALT(KC_3), LALT(KC_4), LALT(KC_5), LALT(KC_6), LALT(KC_7), LALT(KC_8), LALT(KC_9), LALT(KC_0), LALT(KC_MINS), LALT(KC_EQL), LALT(KC_BSLS), LALT(KC_GRV),
154 LALT(KC_TAB), LALT(KC_Q), LALT(KC_W), LALT(KC_E), LALT(KC_R), LALT(KC_T), LALT(KC_Y), LALT(KC_U), LALT(KC_I), LALT(KC_O), LALT(KC_P), LALT(KC_LBRC), LALT(KC_RBRC), LALT(KC_BSPC), 154 LALT(KC_TAB), LALT(KC_Q), LALT(KC_W), LALT(KC_E), LALT(KC_R), LALT(KC_T), LALT(KC_Y), LALT(KC_U), LALT(KC_I), LALT(KC_O), LALT(KC_P), LALT(KC_LBRC), LALT(KC_RBRC), LALT(KC_BSPC),
155 LALT(KC_LCTL), KC_TRNS, KC_TRNS, LALT(KC_D), LALT(KC_F), LALT(KC_G), LALT(KC_H), LALT(KC_J), LALT(KC_K), LALT(KC_L), LALT(KC_SCLN), LALT(KC_QUOT), KC_FN0, 155 LALT(KC_LCTL), KC_TRNS, KC_TRNS, LALT(KC_D), LALT(KC_F), LALT(KC_G), LALT(KC_H), LALT(KC_J), LALT(KC_K), LALT(KC_L), LALT(KC_SCLN), LALT(KC_QUOT), MT(MOD_RCTL, KC_ENT),
156 KC_LSFT, LALT(KC_Z), LALT(KC_X), LALT(KC_C), LALT(KC_V), LALT(KC_B), LALT(KC_N), LALT(KC_M), LALT(KC_COMM), LALT(KC_DOT), LALT(KC_SLSH), KC_RSFT, KC_TRNS, 156 KC_LSFT, LALT(KC_Z), LALT(KC_X), LALT(KC_C), LALT(KC_V), LALT(KC_B), LALT(KC_N), LALT(KC_M), LALT(KC_COMM), LALT(KC_DOT), LALT(KC_SLSH), KC_RSFT, KC_TRNS,
157 KC_LALT, KC_LGUI, LALT(KC_SPC), KC_LGUI, KC_RALT), 157 KC_LALT, KC_LGUI, LALT(KC_SPC), KC_LGUI, KC_RALT),
158 158
@@ -176,14 +176,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
176 176
177 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, 177 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV,
178 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, 178 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC,
179 KC_LCTL, LT(LGUILEV, KC_A), LT(LALTLEV, KC_S), KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, LT(RALTLEV, KC_L), LT(RGUILEV, KC_SCLN), KC_QUOT, KC_FN0, 179 KC_LCTL, LT(LGUILEV, KC_A), LT(LALTLEV, KC_S), KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, LT(RALTLEV, KC_L), LT(RGUILEV, KC_SCLN), KC_QUOT, MT(MOD_RCTL, KC_ENT),
180 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(HHKB), 180 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(HHKB),
181 KC_RGUI, KC_RALT, KC_SPC, KC_RALT, KC_RGUI)}; 181 KC_RGUI, KC_RALT, KC_SPC, KC_RALT, KC_RGUI)};
182 182
183const uint16_t PROGMEM fn_actions[] = {
184 [0] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT) // RControl with tap Enter*
185};
186
187const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 183const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
188{ 184{
189 // MACRODOWN only works in this function 185 // MACRODOWN only works in this function
diff --git a/keyboards/hhkb/keymaps/mjt/config.h b/keyboards/hhkb/ansi/keymaps/mjt/config.h
index 3b8f2e676c..3b8f2e676c 100644
--- a/keyboards/hhkb/keymaps/mjt/config.h
+++ b/keyboards/hhkb/ansi/keymaps/mjt/config.h
diff --git a/keyboards/hhkb/keymaps/mjt/keymap.c b/keyboards/hhkb/ansi/keymaps/mjt/keymap.c
index e51eb8bf92..b62676edd9 100644
--- a/keyboards/hhkb/keymaps/mjt/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/mjt/keymap.c
@@ -17,7 +17,6 @@ enum hhkb_keycodes
17 DYNAMIC_MACRO_RANGE, 17 DYNAMIC_MACRO_RANGE,
18}; 18};
19 19
20#include "dynamic_macro.h"
21 20
22const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
23 22
@@ -104,7 +103,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
104bool process_record_user(uint16_t keycode, keyrecord_t *record) 103bool process_record_user(uint16_t keycode, keyrecord_t *record)
105{ 104{
106 uint16_t macro_kc = (keycode == MO(DYN) ? DYN_REC_STOP : keycode); 105 uint16_t macro_kc = (keycode == MO(DYN) ? DYN_REC_STOP : keycode);
107 if (!process_record_dynamic_macro(macro_kc, record)) 106 if (!process_dynamic_macro(macro_kc, record))
108 { 107 {
109 return false; 108 return false;
110 } 109 }
diff --git a/keyboards/hhkb/keymaps/mjt/readme.md b/keyboards/hhkb/ansi/keymaps/mjt/readme.md
index ff575ce247..ff575ce247 100644
--- a/keyboards/hhkb/keymaps/mjt/readme.md
+++ b/keyboards/hhkb/ansi/keymaps/mjt/readme.md
diff --git a/keyboards/hhkb/ansi/keymaps/mjt/rules.mk b/keyboards/hhkb/ansi/keymaps/mjt/rules.mk
new file mode 100644
index 0000000000..9e6797ed30
--- /dev/null
+++ b/keyboards/hhkb/ansi/keymaps/mjt/rules.mk
@@ -0,0 +1 @@
DYNAMIC_MACRO_ENABLE = yes
diff --git a/keyboards/hhkb/keymaps/schaeferdev/README.md b/keyboards/hhkb/ansi/keymaps/schaeferdev/README.md
index 15b87c498d..15b87c498d 100644
--- a/keyboards/hhkb/keymaps/schaeferdev/README.md
+++ b/keyboards/hhkb/ansi/keymaps/schaeferdev/README.md
diff --git a/keyboards/hhkb/keymaps/schaeferdev/config.h b/keyboards/hhkb/ansi/keymaps/schaeferdev/config.h
index b3c799bb82..b3c799bb82 100644
--- a/keyboards/hhkb/keymaps/schaeferdev/config.h
+++ b/keyboards/hhkb/ansi/keymaps/schaeferdev/config.h
diff --git a/keyboards/hhkb/keymaps/schaeferdev/keymap.c b/keyboards/hhkb/ansi/keymaps/schaeferdev/keymap.c
index ea6da450cf..ea6da450cf 100644
--- a/keyboards/hhkb/keymaps/schaeferdev/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/schaeferdev/keymap.c
diff --git a/keyboards/hhkb/keymaps/schaeferdev/rules.mk b/keyboards/hhkb/ansi/keymaps/schaeferdev/rules.mk
index 35591533cc..35591533cc 100644
--- a/keyboards/hhkb/keymaps/schaeferdev/rules.mk
+++ b/keyboards/hhkb/ansi/keymaps/schaeferdev/rules.mk
diff --git a/keyboards/hhkb/keymaps/shela/action_pseudo_lut.c b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.c
index a15f5e5e0b..a15f5e5e0b 100644
--- a/keyboards/hhkb/keymaps/shela/action_pseudo_lut.c
+++ b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.c
diff --git a/keyboards/hhkb/keymaps/shela/action_pseudo_lut.h b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.h
index 681252440f..681252440f 100644
--- a/keyboards/hhkb/keymaps/shela/action_pseudo_lut.h
+++ b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.h
diff --git a/keyboards/hhkb/keymaps/shela/config.h b/keyboards/hhkb/ansi/keymaps/shela/config.h
index 08cc1fb46e..08cc1fb46e 100644
--- a/keyboards/hhkb/keymaps/shela/config.h
+++ b/keyboards/hhkb/ansi/keymaps/shela/config.h
diff --git a/keyboards/hhkb/keymaps/shela/keymap.c b/keyboards/hhkb/ansi/keymaps/shela/keymap.c
index 2d5f4c64ac..3971e8f945 100644
--- a/keyboards/hhkb/keymaps/shela/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/shela/keymap.c
@@ -56,7 +56,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
56 KC_TAB, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, 56 KC_TAB, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1,
57 KC_LCTL, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_ENT, 57 KC_LCTL, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_ENT,
58 KC_LSFT, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_RSFT, MO(HHKB), 58 KC_LSFT, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_RSFT, MO(HHKB),
59 KC_LGUI, KC_FN3, LT(SPACE_FN, KC_SPACE), KC_FN4, KC_RGUI), 59 KC_LGUI, MT(MOD_LALT, KC_MHEN), LT(SPACE_FN, KC_SPACE), MT(MOD_RALT, KC_KANA), KC_RGUI),
60 60
61 /* Layer 2: Dvorak Layer 61 /* Layer 2: Dvorak Layer
62 * ,-----------------------------------------------------------------------------------------. 62 * ,-----------------------------------------------------------------------------------------.
@@ -133,7 +133,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
133 */ 133 */
134 [HHKB] = 134 [HHKB] =
135 LAYOUT(KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, 135 LAYOUT(KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
136 KC_CAPS, KC_FN5, KC_FN6, KC_FN7, KC_FN8, KC_FN9, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC, 136 KC_CAPS, DF(BASE), DF(PSEUDO_US), DF(MOUSE), DF(TENKEY), DF(DVORAK), KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC,
137 KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT, 137 KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT,
138 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, 138 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS,
139 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 139 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
@@ -183,11 +183,4 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
183 */ 183 */
184const uint16_t PROGMEM fn_actions[] = { 184const uint16_t PROGMEM fn_actions[] = {
185 [1] = ACTION_FUNCTION(PSEUDO_US_FUNCTION), 185 [1] = ACTION_FUNCTION(PSEUDO_US_FUNCTION),
186 [3] = ACTION_MODS_TAP_KEY(MOD_LALT, KC_MHEN),
187 [4] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_KANA),
188 [5] = ACTION_DEFAULT_LAYER_SET(BASE),
189 [6] = ACTION_DEFAULT_LAYER_SET(PSEUDO_US),
190 [7] = ACTION_DEFAULT_LAYER_SET(MOUSE),
191 [8] = ACTION_DEFAULT_LAYER_SET(TENKEY),
192 [9] = ACTION_DEFAULT_LAYER_SET(DVORAK),
193}; 186};
diff --git a/keyboards/hhkb/keymaps/shela/keymap_jis2us.h b/keyboards/hhkb/ansi/keymaps/shela/keymap_jis2us.h
index edc1e6d869..edc1e6d869 100644
--- a/keyboards/hhkb/keymaps/shela/keymap_jis2us.h
+++ b/keyboards/hhkb/ansi/keymaps/shela/keymap_jis2us.h
diff --git a/keyboards/hhkb/keymaps/shela/readme.md b/keyboards/hhkb/ansi/keymaps/shela/readme.md
index 5a06a83632..5a06a83632 100644
--- a/keyboards/hhkb/keymaps/shela/readme.md
+++ b/keyboards/hhkb/ansi/keymaps/shela/readme.md
diff --git a/keyboards/hhkb/keymaps/shela/rules.mk b/keyboards/hhkb/ansi/keymaps/shela/rules.mk
index d0586bda68..d0586bda68 100644
--- a/keyboards/hhkb/keymaps/shela/rules.mk
+++ b/keyboards/hhkb/ansi/keymaps/shela/rules.mk
diff --git a/keyboards/hhkb/keymaps/smt/keymap.c b/keyboards/hhkb/ansi/keymaps/smt/keymap.c
index e1d8bae2e4..e1d8bae2e4 100644
--- a/keyboards/hhkb/keymaps/smt/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/smt/keymap.c
diff --git a/keyboards/hhkb/keymaps/tobiasvl_iso/keymap.c b/keyboards/hhkb/ansi/keymaps/tobiasvl_iso/keymap.c
index 68e23b45df..68e23b45df 100644
--- a/keyboards/hhkb/keymaps/tobiasvl_iso/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/tobiasvl_iso/keymap.c
diff --git a/keyboards/hhkb/keymaps/tobiasvl_iso/readme.md b/keyboards/hhkb/ansi/keymaps/tobiasvl_iso/readme.md
index 0da9d96ee4..0da9d96ee4 100644
--- a/keyboards/hhkb/keymaps/tobiasvl_iso/readme.md
+++ b/keyboards/hhkb/ansi/keymaps/tobiasvl_iso/readme.md
diff --git a/keyboards/hhkb/keymaps/tominabox1/.gitignore b/keyboards/hhkb/ansi/keymaps/tominabox1/.gitignore
index 4b8c99bfb8..4b8c99bfb8 100644
--- a/keyboards/hhkb/keymaps/tominabox1/.gitignore
+++ b/keyboards/hhkb/ansi/keymaps/tominabox1/.gitignore
diff --git a/keyboards/hhkb/keymaps/tominabox1/keymap.c b/keyboards/hhkb/ansi/keymaps/tominabox1/keymap.c
index d7aea97736..d7aea97736 100644
--- a/keyboards/hhkb/keymaps/tominabox1/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/tominabox1/keymap.c
diff --git a/keyboards/hhkb/ansi/keymaps/via/keymap.c b/keyboards/hhkb/ansi/keymaps/via/keymap.c
new file mode 100644
index 0000000000..bdbd32898a
--- /dev/null
+++ b/keyboards/hhkb/ansi/keymaps/via/keymap.c
@@ -0,0 +1,68 @@
1#include QMK_KEYBOARD_H
2
3
4const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5
6 /* BASE Level: Default Layer
7 |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
8 | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` |
9 |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
10 | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Backs | |
11 |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
12 | Cont | A | S | D | F | G | H | J | K | L | ; | ' | Ent | | |
13 |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
14 | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | Fn0 | | |
15 |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
16
17 |------+------+-----------------------+------+------|
18 | LAlt | LGUI | ******* Space ******* | RGUI | RAlt |
19 |------+------+-----------------------+------+------|
20 */
21
22 [0] = LAYOUT( // default layer
23 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV,
24 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC,
25 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
26 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1),
27 KC_LALT, KC_LGUI, /* */ KC_SPC, KC_RGUI, KC_RALT
28 ),
29
30 /* Layer HHKB: HHKB mode (HHKB Fn)
31 |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
32 | Pwr | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | Ins | Del |
33 |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
34 | Caps | | | | | | | | Psc | Slk | Pus | Up | | Backs | |
35 |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
36 | | VoD | VoU | Mut | | | * | / | Hom | PgU | Lef | Rig | Enter | | |
37 |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
38 | | | | | | | + | - | End | PgD | Dow | | | | |
39 |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
40
41 |------+------+----------------------+------+------+
42 | **** | **** | ******************** | **** | **** |
43 |------+------+----------------------+------+------+
44
45 */
46
47 [1] = LAYOUT(
48 KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
49 KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC,
50 KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT,
51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS,
52 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
53 ),
54 [2] = LAYOUT(
55 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
56 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
57 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
58 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
59 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
60 ),
61 [3] = LAYOUT(
62 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
63 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
64 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
65 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
66 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
67 )
68};
diff --git a/keyboards/hhkb/ansi/keymaps/via/rules.mk b/keyboards/hhkb/ansi/keymaps/via/rules.mk
new file mode 100644
index 0000000000..1e5b99807c
--- /dev/null
+++ b/keyboards/hhkb/ansi/keymaps/via/rules.mk
@@ -0,0 +1 @@
VIA_ENABLE = yes
diff --git a/keyboards/hhkb/keymaps/xyverz/keymap.c b/keyboards/hhkb/ansi/keymaps/xyverz/keymap.c
index eebaede979..eebaede979 100644
--- a/keyboards/hhkb/keymaps/xyverz/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/xyverz/keymap.c
diff --git a/keyboards/hhkb/ansi/matrix.c b/keyboards/hhkb/ansi/matrix.c
new file mode 100644
index 0000000000..f22e69f6b0
--- /dev/null
+++ b/keyboards/hhkb/ansi/matrix.c
@@ -0,0 +1,211 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/*
19 * scan matrix
20 */
21#include <stdint.h>
22#include <stdbool.h>
23#include <util/delay.h>
24#include "print.h"
25#include "debug.h"
26#include "util.h"
27#include "timer.h"
28#include "matrix.h"
29#include "hhkb_avr.h"
30#include <avr/wdt.h>
31#include "suspend.h"
32#include "lufa.h"
33
34
35// matrix power saving
36#define MATRIX_POWER_SAVE 10000
37static uint32_t matrix_last_modified = 0;
38
39// matrix state buffer(1:on, 0:off)
40static matrix_row_t *matrix;
41static matrix_row_t *matrix_prev;
42static matrix_row_t _matrix0[MATRIX_ROWS];
43static matrix_row_t _matrix1[MATRIX_ROWS];
44
45
46inline
47uint8_t matrix_rows(void)
48{
49 return MATRIX_ROWS;
50}
51
52inline
53uint8_t matrix_cols(void)
54{
55 return MATRIX_COLS;
56}
57
58void matrix_init(void)
59{
60#ifdef DEBUG
61 debug_enable = true;
62 debug_keyboard = true;
63#endif
64
65 KEY_INIT();
66
67 // initialize matrix state: all keys off
68 for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00;
69 for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix1[i] = 0x00;
70 matrix = _matrix0;
71 matrix_prev = _matrix1;
72}
73
74__attribute__ ((weak))
75void matrix_scan_user(void) {
76}
77
78void matrix_scan_kb(void) {
79 matrix_scan_user();
80}
81
82uint8_t matrix_scan(void)
83{
84 uint8_t *tmp;
85
86 tmp = matrix_prev;
87 matrix_prev = matrix;
88 matrix = tmp;
89
90 // power on
91 if (!KEY_POWER_STATE()) KEY_POWER_ON();
92 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
93 for (uint8_t col = 0; col < MATRIX_COLS; col++) {
94 KEY_SELECT(row, col);
95 _delay_us(5);
96
97 // Not sure this is needed. This just emulates HHKB controller's behaviour.
98 if (matrix_prev[row] & (1<<col)) {
99 KEY_PREV_ON();
100 }
101 _delay_us(10);
102
103 // NOTE: KEY_STATE is valid only in 20us after KEY_ENABLE.
104 // If V-USB interrupts in this section we could lose 40us or so
105 // and would read invalid value from KEY_STATE.
106 uint8_t last = TIMER_RAW;
107
108 KEY_ENABLE();
109
110 // Wait for KEY_STATE outputs its value.
111 // 1us was ok on one HHKB, but not worked on another.
112 // no wait doesn't work on Teensy++ with pro(1us works)
113 // no wait does work on tmk PCB(8MHz) with pro2
114 // 1us wait does work on both of above
115 // 1us wait doesn't work on tmk(16MHz)
116 // 5us wait does work on tmk(16MHz)
117 // 5us wait does work on tmk(16MHz/2)
118 // 5us wait does work on tmk(8MHz)
119 // 10us wait does work on Teensy++ with pro
120 // 10us wait does work on 328p+iwrap with pro
121 // 10us wait doesn't work on tmk PCB(8MHz) with pro2(very lagged scan)
122 _delay_us(5);
123
124 if (KEY_STATE()) {
125 matrix[row] &= ~(1<<col);
126 } else {
127 matrix[row] |= (1<<col);
128 }
129
130 // Ignore if this code region execution time elapses more than 20us.
131 // MEMO: 20[us] * (TIMER_RAW_FREQ / 1000000)[count per us]
132 // MEMO: then change above using this rule: a/(b/c) = a*1/(b/c) = a*(c/b)
133 if (TIMER_DIFF_RAW(TIMER_RAW, last) > 20/(1000000/TIMER_RAW_FREQ)) {
134 matrix[row] = matrix_prev[row];
135 }
136
137 _delay_us(5);
138 KEY_PREV_OFF();
139 KEY_UNABLE();
140
141 // NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE.
142 // This takes 25us or more to make sure KEY_STATE returns to idle state.
143
144 _delay_us(75);
145
146 }
147 if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32();
148 }
149 // power off
150 if (KEY_POWER_STATE() &&
151 (USB_DeviceState == DEVICE_STATE_Suspended ||
152 USB_DeviceState == DEVICE_STATE_Unattached ) &&
153 timer_elapsed32(matrix_last_modified) > MATRIX_POWER_SAVE) {
154 KEY_POWER_OFF();
155 suspend_power_down();
156 }
157
158 matrix_scan_quantum();
159
160 return 1;
161}
162
163bool matrix_is_modified(void)
164{
165 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
166 if (matrix[i] != matrix_prev[i])
167 return true;
168 }
169 return false;
170}
171
172inline
173bool matrix_has_ghost(void)
174{
175 return false;
176}
177
178inline
179bool matrix_is_on(uint8_t row, uint8_t col)
180{
181 return (matrix[row] & (1<<col));
182}
183
184inline
185matrix_row_t matrix_get_row(uint8_t row)
186{
187 return matrix[row];
188}
189
190void matrix_print(void)
191{
192 print("\nr/c 01234567\n");
193 for (uint8_t row = 0; row < matrix_rows(); row++) {
194 xprintf("%02X: %08b\n", row, bitrev(matrix_get_row(row)));
195 }
196}
197
198uint8_t matrix_key_count(void) {
199 uint8_t count = 0;
200 for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
201 count += bitpop16(matrix_get_row(r));
202 }
203 return count;
204}
205
206void matrix_power_up(void) {
207 KEY_POWER_ON();
208}
209void matrix_power_down(void) {
210 KEY_POWER_OFF();
211}
diff --git a/keyboards/hhkb/ansi/readme.md b/keyboards/hhkb/ansi/readme.md
new file mode 100644
index 0000000000..495aa4c3f7
--- /dev/null
+++ b/keyboards/hhkb/ansi/readme.md
@@ -0,0 +1,14 @@
1HHKB Alternate Controller
2===
3
4An alternative controler for the HHKB designed by hasu.
5
6Keyboard Maintainer: QMK Community
7Hardware Supported: HHKB Alternate Controller
8Hardware Availability: https://geekhack.org/index.php?topic=12047.0
9
10Make example for this keyboard (after setting up your build environment):
11
12 make hhkb/ansi:default
13
14See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/hhkb/rules.mk b/keyboards/hhkb/ansi/rules.mk
index 68fb51a30c..a367ef48d1 100644
--- a/keyboards/hhkb/rules.mk
+++ b/keyboards/hhkb/ansi/rules.mk
@@ -47,14 +47,14 @@ OPT_DEFS += -DHHKB_RN42_ENABLE
47 47
48# Support for the RN42 Bluetooth module. This is the BT module in Hasu's BT 48# Support for the RN42 Bluetooth module. This is the BT module in Hasu's BT
49# HHKB Alt controller. 49# HHKB Alt controller.
50RN42_DIR = rn42 50RN42_DIR = ../rn42
51 51
52SRC += serial_uart.c \ 52SRC += serial_uart.c \
53 rn42/suart.S \ 53 ../rn42/suart.S \
54 rn42/rn42.c \ 54 ../rn42/rn42.c \
55 rn42/rn42_task.c \ 55 ../rn42/rn42_task.c \
56 rn42/battery.c \ 56 ../rn42/battery.c \
57 rn42/main.c 57 ../rn42/main.c
58 58
59VPATH += $(RN42_DIR) 59VPATH += $(RN42_DIR)
60 60
diff --git a/keyboards/hhkb/hhkb.c b/keyboards/hhkb/hhkb.c
deleted file mode 100644
index a9d35123ff..0000000000
--- a/keyboards/hhkb/hhkb.c
+++ /dev/null
@@ -1 +0,0 @@
1#include "hhkb.h" \ No newline at end of file
diff --git a/keyboards/hhkb/jp/config.h b/keyboards/hhkb/jp/config.h
new file mode 100644
index 0000000000..01dab6d440
--- /dev/null
+++ b/keyboards/hhkb/jp/config.h
@@ -0,0 +1,104 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "config_common.h"
21
22/* USB Device descriptor parameter */
23#define VENDOR_ID 0x4848 // HH = happy hacking
24#define PRODUCT_ID 0x0002 // HHKB JP
25#define DEVICE_VER 0x0104
26#define MANUFACTURER q.m.k
27#define PRODUCT HHKB mod
28#define DESCRIPTION q.m.k keyboard firmware for HHKB
29
30/* key matrix size */
31#define MATRIX_ROWS 16
32#define MATRIX_COLS 8
33
34#define TAPPING_TERM 200
35
36/* number of backlight levels */
37#define BACKLIGHT_LEVELS 3
38
39/* Set 0 if debouncing isn't needed */
40#define DEBOUNCE 5
41
42/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
43//#define LOCKING_SUPPORT_ENABLE
44/* Locking resynchronize hack */
45//#define LOCKING_RESYNC_ENABLE
46
47#ifdef HHKB_RN42_ENABLE
48// rn42 support -- acquired from the tmk repo. This is almost certainly not
49// integrated with qmk in the correct way.
50
51#define SUART_OUT_PORT PORTD
52#define SUART_OUT_BIT 0
53#define SUART_IN_PIN PIND
54#define SUART_IN_BIT 1
55
56#ifdef __AVR_ATmega32U4__
57 /* iom32u4.h has no definition of UCSR1D. copy from iom32u2.h */
58 #define UCSR1D _SFR_MEM8(0xCB)
59 #define RTSEN 0
60 #define CTSEN 1
61
62 #define SERIAL_UART_BAUD 115200
63 #define SERIAL_UART_DATA UDR1
64 #define SERIAL_UART_UBRR ((F_CPU/(16.0*SERIAL_UART_BAUD)-1+0.5))
65 #define SERIAL_UART_RXD_VECT USART1_RX_vect
66 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
67 #define SERIAL_UART_INIT() do { \
68 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
69 UBRR1H = ((uint16_t)SERIAL_UART_UBRR>>8); /* baud rate */ \
70 UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
71 UCSR1B |= (0<<TXCIE1) | (1<<TXEN1); /* TX interrupt, TX: enable */ \
72 UCSR1C |= (0<<UPM11) | (0<<UPM10); /* parity: none(00), even(01), odd(11) */ \
73 UCSR1D |= (0<<RTSEN) | (0<<CTSEN); /* RTS, CTS(no flow control by hardware) */ \
74 DDRD |= (1<<5); PORTD &= ~(1<<5); /* RTS for flow control by firmware */ \
75 sei(); \
76 } while(0)
77 #define SERIAL_UART_RTS_LO() do { PORTD &= ~(1<<5); } while (0)
78 #define SERIAL_UART_RTS_HI() do { PORTD |= (1<<5); } while (0)
79#else
80 #error "USART configuration is needed."
81#endif
82
83/* power control of key switch board */
84#define HHKB_POWER_SAVING
85
86#endif
87
88/*
89 * Feature disable options
90 * These options are also useful to firmware size reduction.
91*/
92
93/* disable debug print */
94//#define NO_DEBUG
95
96/* disable print */
97//#define NO_PRINT
98
99/* disable action features */
100//#define NO_ACTION_LAYER
101//#define NO_ACTION_TAPPING
102//#define NO_ACTION_ONESHOT
103//#define NO_ACTION_MACRO
104//#define NO_ACTION_FUNCTION
diff --git a/keyboards/hhkb/hhkb_avr.h b/keyboards/hhkb/jp/hhkb_avr.h
index 7ea6322c73..a1f825cfb0 100644
--- a/keyboards/hhkb/hhkb_avr.h
+++ b/keyboards/hhkb/jp/hhkb_avr.h
@@ -1,5 +1,4 @@
1#ifndef HHKB_AVR_H 1#pragma once
2#define HHKB_AVR_H
3 2
4#include <stdint.h> 3#include <stdint.h>
5#include <stdbool.h> 4#include <stdbool.h>
@@ -67,11 +66,11 @@ static inline void KEY_INIT(void)
67 /* key: input with pull-up */ 66 /* key: input with pull-up */
68 DDRD &= ~0x80; 67 DDRD &= ~0x80;
69 PORTD |= 0x80; 68 PORTD |= 0x80;
70#ifdef HHKB_JP 69
71 /* row extention for HHKB JP */ 70 /* row extention for HHKB JP */
72 DDRC |= (1<<6|1<<7); 71 DDRC |= (1<<6|1<<7);
73 PORTC |= (1<<6|1<<7); 72 PORTC |= (1<<6|1<<7);
74#endif 73
75 KEY_UNABLE(); 74 KEY_UNABLE();
76 KEY_PREV_OFF(); 75 KEY_PREV_OFF();
77 76
@@ -80,10 +79,10 @@ static inline void KEY_INIT(void)
80static inline void KEY_SELECT(uint8_t ROW, uint8_t COL) 79static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
81{ 80{
82 PORTB = (PORTB & 0xC0) | (((COL) & 0x07)<<3) | ((ROW) & 0x07); 81 PORTB = (PORTB & 0xC0) | (((COL) & 0x07)<<3) | ((ROW) & 0x07);
83#ifdef HHKB_JP 82
84 if ((ROW) & 0x08) PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<6); 83 if ((ROW) & 0x08) PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<6);
85 else PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<7); 84 else PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<7);
86#endif 85
87} 86}
88 87
89 88
@@ -163,5 +162,3 @@ static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
163 PORTC &= ~0x0F; \ 162 PORTC &= ~0x0F; \
164} while (0) 163} while (0)
165#endif 164#endif
166
167#endif
diff --git a/keyboards/hhkb/info.json b/keyboards/hhkb/jp/info.json
index 3beaff83da..7594987d96 100644
--- a/keyboards/hhkb/info.json
+++ b/keyboards/hhkb/jp/info.json
@@ -1,75 +1,10 @@
1{ 1{
2 "keyboard_name": "hhkb", 2 "keyboard_name": "HHKB JP",
3 "url": "", 3 "url": "",
4 "maintainer": "qmk", 4 "maintainer": "qmk",
5 "width": 15, 5 "width": 15,
6 "height": 5, 6 "height": 5,
7 "layouts": { 7 "layouts": {
8 "LAYOUT": {
9 "layout": [
10 { "label": "Esc", "x": 0, "y": 0 },
11 { "label": "!", "x": 1, "y": 0 },
12 { "label": "@", "x": 2, "y": 0 },
13 { "label": "#", "x": 3, "y": 0 },
14 { "label": "$", "x": 4, "y": 0 },
15 { "label": "%", "x": 5, "y": 0 },
16 { "label": "^", "x": 6, "y": 0 },
17 { "label": "&", "x": 7, "y": 0 },
18 { "label": "*", "x": 8, "y": 0 },
19 { "label": "(", "x": 9, "y": 0 },
20 { "label": ")", "x": 10, "y": 0 },
21 { "label": "_", "x": 11, "y": 0 },
22 { "label": "+", "x": 12, "y": 0 },
23 { "label": "|", "x": 13, "y": 0 },
24 { "label": "~", "x": 14, "y": 0 },
25 { "label": "Tab", "x": 0, "y": 1, "w": 1.5 },
26 { "label": "Q", "x": 1.5, "y": 1 },
27 { "label": "W", "x": 2.5, "y": 1 },
28 { "label": "E", "x": 3.5, "y": 1 },
29 { "label": "R", "x": 4.5, "y": 1 },
30 { "label": "T", "x": 5.5, "y": 1 },
31 { "label": "Y", "x": 6.5, "y": 1 },
32 { "label": "U", "x": 7.5, "y": 1 },
33 { "label": "I", "x": 8.5, "y": 1 },
34 { "label": "O", "x": 9.5, "y": 1 },
35 { "label": "P", "x": 10.5, "y": 1 },
36 { "label": "{", "x": 11.5, "y": 1 },
37 { "label": "}", "x": 12.5, "y": 1 },
38 { "label": "Delete", "x": 13.5, "y": 1, "w": 1.5 },
39 { "label": "Control", "x": 0, "y": 2, "w": 1.75 },
40 { "label": "A", "x": 1.75, "y": 2 },
41 { "label": "S", "x": 2.75, "y": 2 },
42 { "label": "D", "x": 3.75, "y": 2 },
43 { "label": "F", "x": 4.75, "y": 2 },
44 { "label": "G", "x": 5.75, "y": 2 },
45 { "label": "H", "x": 6.75, "y": 2 },
46 { "label": "J", "x": 7.75, "y": 2 },
47 { "label": "K", "x": 8.75, "y": 2 },
48 { "label": "L", "x": 9.75, "y": 2 },
49 { "label": ":", "x": 10.75, "y": 2 },
50 { "label": "\"", "x": 11.75, "y": 2 },
51 { "label": "Return", "x": 12.75, "y": 2, "w": 2.25 },
52 { "label": "Shift", "x": 0, "y": 3, "w": 2.25 },
53 { "label": "Z", "x": 2.25, "y": 3 },
54 { "label": "X", "x": 3.25, "y": 3 },
55 { "label": "C", "x": 4.25, "y": 3 },
56 { "label": "V", "x": 5.25, "y": 3 },
57 { "label": "B", "x": 6.25, "y": 3 },
58 { "label": "N", "x": 7.25, "y": 3 },
59 { "label": "M", "x": 8.25, "y": 3 },
60 { "label": "<", "x": 9.25, "y": 3 },
61 { "label": ">", "x": 10.25, "y": 3 },
62 { "label": "?", "x": 11.25, "y": 3 },
63 { "label": "Shift", "x": 12.25, "y": 3, "w": 1.75 },
64 { "label": "Fn", "x": 14, "y": 3 },
65 { "label": "", "x": 1.5, "y": 4 },
66 { "label": "", "x": 2.5, "y": 4, "w": 1.5 },
67 { "x": 4, "y": 4, "w": 6 },
68 { "label": "", "x": 10, "y": 4, "w": 1.5 },
69 { "label": "", "x": 11.5, "y": 4 }
70 ]
71 },
72
73 "LAYOUT_JP": { 8 "LAYOUT_JP": {
74 "layout": [ 9 "layout": [
75 { "label": "Esc", "x": 0, "y": 0 }, 10 { "label": "Esc", "x": 0, "y": 0 },
diff --git a/keyboards/hhkb/jp/jp.c b/keyboards/hhkb/jp/jp.c
new file mode 100644
index 0000000000..f1f1388c77
--- /dev/null
+++ b/keyboards/hhkb/jp/jp.c
@@ -0,0 +1 @@
#include "jp.h" \ No newline at end of file
diff --git a/keyboards/hhkb/hhkb.h b/keyboards/hhkb/jp/jp.h
index 668f78eecc..a95796f25f 100644
--- a/keyboards/hhkb/hhkb.h
+++ b/keyboards/hhkb/jp/jp.h
@@ -1,28 +1,7 @@
1#ifndef HHKB_H 1#pragma once
2#define HHKB_H
3 2
4#include "quantum.h" 3#include "quantum.h"
5 4
6#define LAYOUT( \
7 K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \
8 K32, K01, K02, K13, K12, K23, K22, K42, K43, K62, K63, K73, K72, K52, \
9 K33, K04, K03, K14, K15, K24, K25, K45, K44, K65, K64, K74, K53, \
10 K34, K05, K06, K07, K16, K17, K26, K46, K66, K76, K75, K55, K54, \
11 K35, K36, K37, K57, K56) \
12 \
13{ \
14 { K00, K01, K02, K03, K04, K05, K06, K07 }, \
15 { K10, K11, K12, K13, K14, K15, K16, K17 }, \
16 { K20, K21, K22, K23, K24, K25, K26, KC_NO }, \
17 { K30, K31, K32, K33, K34, K35, K36, K37 }, \
18 { K40, K41, K42, K43, K44, K45, K46, KC_NO }, \
19 { K50, K51, K52, K53, K54, K55, K56, K57 }, \
20 { K60, K61, K62, K63, K64, K65, K66, KC_NO }, \
21 { K70, K71, K72, K73, K74, K75, K76, KC_NO } \
22}
23
24#define LAYOUT_60_hhkb LAYOUT
25
26#define LAYOUT_JP( \ 5#define LAYOUT_JP( \
27 K02, K32, K62, K22, K12, K52, K72, KA2, K92, K82, KB2, KE2, KF2, KD2, KC2, \ 6 K02, K32, K62, K22, K12, K52, K72, KA2, K92, K82, KB2, KE2, KF2, KD2, KC2, \
28 K03, K63, K23, K13, K53, K73, KA3, K93, K83, KB3, KE3, KF3, KD3, \ 7 K03, K63, K23, K13, K53, K73, KA3, K93, K83, KB3, KE3, KF3, KD3, \
@@ -47,6 +26,3 @@
47 { KC_NO, KC_NO, KE2, KE3, KE4, KE5, KE6, KC_NO }, \ 26 { KC_NO, KC_NO, KE2, KE3, KE4, KE5, KE6, KC_NO }, \
48 { KC_NO, KC_NO, KF2, KF3, KF4, KF5, KF6, KC_NO } \ 27 { KC_NO, KC_NO, KF2, KF3, KF4, KF5, KF6, KC_NO } \
49} 28}
50
51
52#endif
diff --git a/keyboards/hhkb/keymaps/bakingpy/keymap.c b/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c
index 04d79f9247..04d79f9247 100644
--- a/keyboards/hhkb/keymaps/bakingpy/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c
diff --git a/keyboards/hhkb/keymaps/bakingpy/rules.mk b/keyboards/hhkb/jp/keymaps/bakingpy/rules.mk
index a7f700f019..a7f700f019 100644
--- a/keyboards/hhkb/keymaps/bakingpy/rules.mk
+++ b/keyboards/hhkb/jp/keymaps/bakingpy/rules.mk
diff --git a/keyboards/hhkb/keymaps/jp/keymap.c b/keyboards/hhkb/jp/keymaps/default/keymap.c
index 6fd06638ce..6fd06638ce 100644
--- a/keyboards/hhkb/keymaps/jp/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/default/keymap.c
diff --git a/keyboards/hhkb/keymaps/halfqwerty_jp/rules.mk b/keyboards/hhkb/jp/keymaps/default/rules.mk
index a7f700f019..a7f700f019 100644
--- a/keyboards/hhkb/keymaps/halfqwerty_jp/rules.mk
+++ b/keyboards/hhkb/jp/keymaps/default/rules.mk
diff --git a/keyboards/hhkb/keymaps/jp_mac/keymap.c b/keyboards/hhkb/jp/keymaps/default_mac/keymap.c
index f3ef3d6af6..f3ef3d6af6 100644
--- a/keyboards/hhkb/keymaps/jp_mac/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/default_mac/keymap.c
diff --git a/keyboards/hhkb/keymaps/jp/rules.mk b/keyboards/hhkb/jp/keymaps/default_mac/rules.mk
index a7f700f019..a7f700f019 100644
--- a/keyboards/hhkb/keymaps/jp/rules.mk
+++ b/keyboards/hhkb/jp/keymaps/default_mac/rules.mk
diff --git a/keyboards/hhkb/keymaps/krusli/config.h b/keyboards/hhkb/jp/keymaps/dhertz/config.h
index af2fb9d8a5..af2fb9d8a5 100644
--- a/keyboards/hhkb/keymaps/krusli/config.h
+++ b/keyboards/hhkb/jp/keymaps/dhertz/config.h
diff --git a/keyboards/hhkb/keymaps/dhertz/keymap.c b/keyboards/hhkb/jp/keymaps/dhertz/keymap.c
index 951af069b0..951af069b0 100644
--- a/keyboards/hhkb/keymaps/dhertz/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/dhertz/keymap.c
diff --git a/keyboards/hhkb/keymaps/dhertz/keymap.h b/keyboards/hhkb/jp/keymaps/dhertz/keymap.h
index dbefc63800..dbefc63800 100644
--- a/keyboards/hhkb/keymaps/dhertz/keymap.h
+++ b/keyboards/hhkb/jp/keymaps/dhertz/keymap.h
diff --git a/keyboards/hhkb/keymaps/dhertz/rules.mk b/keyboards/hhkb/jp/keymaps/dhertz/rules.mk
index 5656057b43..5656057b43 100644
--- a/keyboards/hhkb/keymaps/dhertz/rules.mk
+++ b/keyboards/hhkb/jp/keymaps/dhertz/rules.mk
diff --git a/keyboards/hhkb/keymaps/enoch_jp/keymap.c b/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
index 15dc29773b..15dc29773b 100644
--- a/keyboards/hhkb/keymaps/enoch_jp/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
diff --git a/keyboards/hhkb/keymaps/enoch_jp/rules.mk b/keyboards/hhkb/jp/keymaps/enoch_jp/rules.mk
index d35c58b777..d35c58b777 100644
--- a/keyboards/hhkb/keymaps/enoch_jp/rules.mk
+++ b/keyboards/hhkb/jp/keymaps/enoch_jp/rules.mk
diff --git a/keyboards/hhkb/keymaps/halfqwerty_jp/README.md b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/README.md
index 222ad898ef..222ad898ef 100644
--- a/keyboards/hhkb/keymaps/halfqwerty_jp/README.md
+++ b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/README.md
diff --git a/keyboards/hhkb/keymaps/halfqwerty_jp/keymap.c b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c
index 0d4a24c60d..0d4a24c60d 100644
--- a/keyboards/hhkb/keymaps/halfqwerty_jp/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c
diff --git a/keyboards/hhkb/keymaps/jp_mac/rules.mk b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/rules.mk
index a7f700f019..a7f700f019 100644
--- a/keyboards/hhkb/keymaps/jp_mac/rules.mk
+++ b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/rules.mk
diff --git a/keyboards/hhkb/keymaps/rdg_jp/keymap.c b/keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c
index f40df74e87..f40df74e87 100644
--- a/keyboards/hhkb/keymaps/rdg_jp/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c
diff --git a/keyboards/hhkb/keymaps/rdg_jp/rules.mk b/keyboards/hhkb/jp/keymaps/rdg_jp/rules.mk
index a7f700f019..a7f700f019 100644
--- a/keyboards/hhkb/keymaps/rdg_jp/rules.mk
+++ b/keyboards/hhkb/jp/keymaps/rdg_jp/rules.mk
diff --git a/keyboards/hhkb/keymaps/sh_jp/README.md b/keyboards/hhkb/jp/keymaps/sh_jp/README.md
index 4f82f2f4e9..4f82f2f4e9 100644
--- a/keyboards/hhkb/keymaps/sh_jp/README.md
+++ b/keyboards/hhkb/jp/keymaps/sh_jp/README.md
diff --git a/keyboards/hhkb/keymaps/sh_jp/keymap.c b/keyboards/hhkb/jp/keymaps/sh_jp/keymap.c
index 79515c5a6e..79515c5a6e 100644
--- a/keyboards/hhkb/keymaps/sh_jp/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/sh_jp/keymap.c
diff --git a/keyboards/hhkb/keymaps/sh_jp/rules.mk b/keyboards/hhkb/jp/keymaps/sh_jp/rules.mk
index a7f700f019..a7f700f019 100644
--- a/keyboards/hhkb/keymaps/sh_jp/rules.mk
+++ b/keyboards/hhkb/jp/keymaps/sh_jp/rules.mk
diff --git a/keyboards/hhkb/jp/keymaps/via/config.h b/keyboards/hhkb/jp/keymaps/via/config.h
new file mode 100644
index 0000000000..96c85573df
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/via/config.h
@@ -0,0 +1,2 @@
1// 3 layers or else it will not fit in EEPROM
2#define DYNAMIC_KEYMAP_LAYER_COUNT 3
diff --git a/keyboards/hhkb/jp/keymaps/via/keymap.c b/keyboards/hhkb/jp/keymaps/via/keymap.c
new file mode 100644
index 0000000000..cb1ba76fb0
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/via/keymap.c
@@ -0,0 +1,58 @@
1#include QMK_KEYBOARD_H
2
3/* Layer 0: HHKB JP
4 * ,-----------------------------------------------------------.
5 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp|
6 * |-----------------------------------------------------------|
7 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
8 * |------------------------------------------------------` Ent|
9 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| |
10 * |-----------------------------------------------------------|
11 * |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft|
12 * |-----------------------------------------------------------|
13 * | ||Ctl|Alt|Cmd| | Spc |Bsp| | | ||Lft|Dwn|Rgh|
14 * `-----------------------------------------------------------'
15 */
16
17/* Layer 1: HHKB mode (HHKB Fn)
18 * ,-----------------------------------------------------------.
19 * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
20 * |-----------------------------------------------------------|
21 * |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
22 * |------------------------------------------------------` |
23 * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | |
24 * |-----------------------------------------------------------|
25 * | | | | | | | +| -|End|PgD|Dow| | | |
26 * |-----------------------------------------------------------|
27 * | || | | | | | | | | || | | |
28 * `-----------------------------------------------------------'
29 */
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32 [0] = LAYOUT_JP(
33 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_JYEN, KC_BSPC,
34 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
35 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT,
36 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_UP, KC_RSFT,
37 MO(1), KC_ZKHK, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC, KC_HENK, KC_KANA, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
38
39 [1] = LAYOUT_JP(
40 KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
41 KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
42 _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
43 _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
44 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
45 ),
46 [2] = LAYOUT_JP(
47 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
48 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
49 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
50 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
52 )
53};
54
55const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt)
56{
57 return MACRO_NONE;
58}
diff --git a/keyboards/hhkb/jp/keymaps/via/rules.mk b/keyboards/hhkb/jp/keymaps/via/rules.mk
new file mode 100644
index 0000000000..1e5b99807c
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/via/rules.mk
@@ -0,0 +1 @@
VIA_ENABLE = yes
diff --git a/keyboards/hhkb/matrix.c b/keyboards/hhkb/jp/matrix.c
index 666b6f595f..437356af6d 100644
--- a/keyboards/hhkb/matrix.c
+++ b/keyboards/hhkb/jp/matrix.c
@@ -140,13 +140,10 @@ uint8_t matrix_scan(void)
140 140
141 // NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE. 141 // NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE.
142 // This takes 25us or more to make sure KEY_STATE returns to idle state. 142 // This takes 25us or more to make sure KEY_STATE returns to idle state.
143#ifdef HHKB_JP 143
144 // Looks like JP needs faster scan due to its twice larger matrix 144 // Looks like JP needs faster scan due to its twice larger matrix
145 // or it can drop keys in fast key typing 145 // or it can drop keys in fast key typing
146 _delay_us(30); 146 _delay_us(30);
147#else
148 _delay_us(75);
149#endif
150 } 147 }
151 if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32(); 148 if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32();
152 } 149 }
diff --git a/keyboards/hhkb/readme.md b/keyboards/hhkb/jp/readme.md
index 57eb814391..41c1d2214e 100644
--- a/keyboards/hhkb/readme.md
+++ b/keyboards/hhkb/jp/readme.md
@@ -9,6 +9,6 @@ Hardware Availability: https://geekhack.org/index.php?topic=12047.0
9 9
10Make example for this keyboard (after setting up your build environment): 10Make example for this keyboard (after setting up your build environment):
11 11
12 make hhkb:default 12 make hhkb/jp:default
13 13
14See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. 14See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/hhkb/jp/rules.mk b/keyboards/hhkb/jp/rules.mk
new file mode 100644
index 0000000000..774b444c53
--- /dev/null
+++ b/keyboards/hhkb/jp/rules.mk
@@ -0,0 +1,69 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5# Teensy halfkay
6# Pro Micro caterina
7# Atmel DFU atmel-dfu
8# LUFA DFU lufa-dfu
9# QMK DFU qmk-dfu
10# ATmega32A bootloadHID
11# ATmega328P USBasp
12BOOTLOADER = atmel-dfu
13
14# Build Options
15# comment out to disable the options.
16#
17BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
18MOUSEKEY_ENABLE = yes # Mouse keys
19EXTRAKEY_ENABLE = yes # Audio control and System control
20CONSOLE_ENABLE = yes # Console for debug
21COMMAND_ENABLE = yes # Commands for debug and configuration
22CUSTOM_MATRIX = yes # Custom matrix file for the HHKB
23# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
24# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
25# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
26# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
27# MIDI_ENABLE = yes # MIDI controls
28# UNICODE_ENABLE = yes # Unicode
29# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
30
31
32# HHKB_RN42_ENABLE = yes # Enable support for hasu's BT alt controller -- code borrowed from tmk source tree.
33
34# Either uncomment the HHKB_RN42_ENABLE line above, or run make enabling the
35# feature. Be sure to clean any existing build before trying to enable rn42
36# support. For example:
37#
38# make hhkb-keymap-clean
39# make hhkb-keymap-dfu HHKB_RN42_ENABLE=yes
40
41# project specific files
42SRC = matrix.c
43
44ifeq ($(strip $(HHKB_RN42_ENABLE)), yes)
45
46OPT_DEFS += -DHHKB_RN42_ENABLE
47
48# Support for the RN42 Bluetooth module. This is the BT module in Hasu's BT
49# HHKB Alt controller.
50RN42_DIR = ../rn42
51
52SRC += serial_uart.c \
53 ../rn42/suart.S \
54 ../rn42/rn42.c \
55 ../rn42/rn42_task.c \
56 ../rn42/battery.c \
57 ../rn42/main.c
58
59VPATH += $(RN42_DIR)
60
61endif
62
63
64# debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION
65# debug-on: all
66
67# debug-off: EXTRAFLAGS += -DNO_DEBUG -DNO_PRINT
68# debug-off: OPT_DEFS := $(filter-out -DCONSOLE_ENABLE,$(OPT_DEFS))
69# debug-off: all
diff --git a/keyboards/infinity60/keymaps/jpetermans/keymap.c b/keyboards/infinity60/keymaps/jpetermans/keymap.c
index c99b05e4c5..a169d658f7 100644
--- a/keyboards/infinity60/keymaps/jpetermans/keymap.c
+++ b/keyboards/infinity60/keymaps/jpetermans/keymap.c
@@ -15,8 +15,6 @@ enum ic60_keycodes {
15 NUMPAD, 15 NUMPAD,
16 FNAV, 16 FNAV,
17 MEDIA, 17 MEDIA,
18 TILDE,
19 CTLALTDEL,
20 BACKLIGHT, 18 BACKLIGHT,
21 BRIGHT, 19 BRIGHT,
22 DIM, 20 DIM,
@@ -55,7 +53,7 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
55 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSLS,KC_NO,\ 53 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSLS,KC_NO,\
56 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSPC, \ 54 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSPC, \
57 TT(_FNAV), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_ENT, \ 55 TT(_FNAV), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_ENT, \
58 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,F(TILDE),KC_NO, \ 56 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,LM(_TILDE, MOD_LSFT),KC_NO, \
59 KC_LCTL, KC_LGUI,KC_LALT, LT(_FNAV, KC_SPC), KC_RALT,TG(_NUMPAD),MO(_MEDIA), KC_RCTL \ 57 KC_LCTL, KC_LGUI,KC_LALT, LT(_FNAV, KC_SPC), KC_RALT,TG(_NUMPAD),MO(_MEDIA), KC_RCTL \
60 ), 58 ),
61 59
@@ -74,7 +72,7 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
74 KC_CAPS,_______,_______,_______,_______,_______,_______,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR,_______,_______,KC_DEL, \ 72 KC_CAPS,_______,_______,_______,_______,_______,_______,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR,_______,_______,KC_DEL, \
75 _______,_______,KC_BTN2,_______,_______,_______,KC_HOME,KC_LEFT,KC_DOWN,KC_RGHT,KC_INS,_______,_______, \ 73 _______,_______,KC_BTN2,_______,_______,_______,KC_HOME,KC_LEFT,KC_DOWN,KC_RGHT,KC_INS,_______,_______, \
76 _______,KC_APP,KC_BTN1,KC_CALC,_______,_______,KC_END,_______,_______,_______,_______,_______,KC_NO, \ 74 _______,KC_APP,KC_BTN1,KC_CALC,_______,_______,KC_END,_______,_______,_______,_______,_______,KC_NO, \
77 _______,_______,_______, _______, F(CTLALTDEL),KC_NLCK,_______,_______ \ 75 _______,_______,_______, _______, C(A(KC_DEL)),KC_NLCK,_______,_______ \
78 ), 76 ),
79 77
80 /* media */ 78 /* media */
@@ -162,8 +160,6 @@ uint8_t led_game[5] = {
162 160
163//======== qmk functions ========= 161//======== qmk functions =========
164const uint16_t fn_actions[] = { 162const uint16_t fn_actions[] = {
165 [CTLALTDEL] = ACTION_KEY(LALT(LCTL(KC_DEL))),
166 [TILDE] = ACTION_LAYER_MODS(_TILDE, MOD_LSFT),
167 [ALL] = ACTION_FUNCTION(ACTION_LEDS_ALL), 163 [ALL] = ACTION_FUNCTION(ACTION_LEDS_ALL),
168 [GAME] = ACTION_FUNCTION(ACTION_LEDS_GAME), 164 [GAME] = ACTION_FUNCTION(ACTION_LEDS_GAME),
169 [BACKLIGHT] = ACTION_FUNCTION(ACTION_LEDS_BACKLIGHT), 165 [BACKLIGHT] = ACTION_FUNCTION(ACTION_LEDS_BACKLIGHT),
diff --git a/keyboards/jd45/keymaps/justin/keymap.c b/keyboards/jd45/keymaps/justin/keymap.c
index 1c0e780724..985ff19b88 100644
--- a/keyboards/jd45/keymaps/justin/keymap.c
+++ b/keyboards/jd45/keymaps/justin/keymap.c
@@ -3,15 +3,22 @@
3#define KC_MO1 MO(1) 3#define KC_MO1 MO(1)
4#define KC_MO2 MO(2) 4#define KC_MO2 MO(2)
5#define KC_MO3 MO(3) 5#define KC_MO3 MO(3)
6#define KC_LM4 LM(4, MOD_LSFT)
7
8#define KC_MTCM MT(MOD_LCTL, KC_MINS)
9#define KC_MTSG MT(MOD_LSFT, KC_GRV)
10#define KC_MTSW MT(MOD_RSFT, KC_RGUI)
11#define KC_MTSC MT(MOD_RSFT, KC_CAPS)
12#define KC_MTCT MT(MOD_LCTL, KC_TAB)
6 13
7#define KC_BLTG BL_TOGG 14#define KC_BLTG BL_TOGG
8 15
9const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 16const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
10 [0] = LAYOUT_kc( 17 [0] = LAYOUT_kc(
11 ESC, Q, W, F, P, G, J, L, U, Y, SCLN, QUOT, BSPC, 18 ESC, Q, W, F, P, G, J, L, U, Y, SCLN, QUOT, BSPC,
12 FN8, A, R, S, T, D, H, N, E, I, O, ENT, 19 MTCT, A, R, S, T, D, H, N, E, I, O, ENT,
13 LSFT, Z, X, C, V, B, K, M, COMM, DOT, SLSH, FN6, 20 LSFT, Z, X, C, V, B, K, M, COMM, DOT, SLSH, MTSC,
14 FN4, LGUI, FN7, MO2, MO1, SPC, FN5, RALT, MO3, FN0), 21 MTSG, LGUI, LM4, MO2, MO1, SPC, MTSW, RALT, MO3, MTCM),
15 [1] = LAYOUT_kc( 22 [1] = LAYOUT_kc(
16 TRNS, FN10, FN11, FN12, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, UP, DEL, 23 TRNS, FN10, FN11, FN12, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, UP, DEL,
17 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, HOME, PGUP, LEFT, RGHT, 24 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, HOME, PGUP, LEFT, RGHT,
@@ -42,13 +49,6 @@ enum macro_id
42}; 49};
43 50
44const uint16_t PROGMEM fn_actions[] = { 51const uint16_t PROGMEM fn_actions[] = {
45 [0] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_MINS),
46 [4] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_GRV),
47 [5] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_RGUI),
48 [6] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_CAPS),
49 [7] = ACTION_LAYER_MODS(4, MOD_LSFT), // FN4
50 [8] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_TAB),
51
52 [10] = ACTION_MACRO(PSWD1), 52 [10] = ACTION_MACRO(PSWD1),
53 [11] = ACTION_MACRO(PSWD2), 53 [11] = ACTION_MACRO(PSWD2),
54 [12] = ACTION_MACRO(PSWD3) 54 [12] = ACTION_MACRO(PSWD3)
diff --git a/keyboards/jd45/keymaps/mjt6u/keymap.c b/keyboards/jd45/keymaps/mjt6u/keymap.c
index 6fda6ac95f..dc7c3bb7e3 100644
--- a/keyboards/jd45/keymaps/mjt6u/keymap.c
+++ b/keyboards/jd45/keymaps/mjt6u/keymap.c
@@ -119,7 +119,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record)
119 { 119 {
120 persistent_default_layer_set(1UL << _QWERTY); 120 persistent_default_layer_set(1UL << _QWERTY);
121#ifdef AUDIO_ENABLE 121#ifdef AUDIO_ENABLE
122 PLAY_NOTE_ARRAY(tone_fnpc, false, 0); 122 PLAY_SONG(tone_fnpc);
123#endif 123#endif
124 print("Space-FN"); 124 print("Space-FN");
125 } 125 }
@@ -130,7 +130,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record)
130 { 130 {
131 persistent_default_layer_set(1UL << _QWERTYNUMMODS); 131 persistent_default_layer_set(1UL << _QWERTYNUMMODS);
132#ifdef AUDIO_ENABLE 132#ifdef AUDIO_ENABLE
133 PLAY_NOTE_ARRAY(tone_fnmac, false, 0); 133 PLAY_SONG(tone_fnmac);
134#endif 134#endif
135 print("Space-Numpad"); 135 print("Space-Numpad");
136 } 136 }
diff --git a/keyboards/keebio/nyquist/keymaps/danielhklein/keymap.c b/keyboards/keebio/nyquist/keymaps/danielhklein/keymap.c
index 14428812f2..00f0bb3ced 100644
--- a/keyboards/keebio/nyquist/keymaps/danielhklein/keymap.c
+++ b/keyboards/keebio/nyquist/keymaps/danielhklein/keymap.c
@@ -30,16 +30,9 @@ enum custom_keycodes {
30 ARROW 30 ARROW
31}; 31};
32 32
33 // Enable these functions using FUNC(n) macro. 33#define SPC_LWR LT(_LOWER, KC_SPC)
34 const uint16_t PROGMEM fn_actions[] = { 34#define BSP_RSE LT(_RAISE, KC_BSPC)
35 [0] = LT(_LOWER, KC_SPC), //Hold for momentary Lower layer, Tap for Backspace, 35#define ARW MO(_ARROW)
36 [1] = LT(_RAISE, KC_BSPC), //Hold for momentary Raise layer, Tap for Space,
37 [2] = MO(_ARROW), //Hold for momentary Arrow
38 };
39
40#define SPC_LWR FUNC(0)
41#define BSP_RSE FUNC(1)
42#define ARW FUNC(2)
43 36
44// Underglow setup 37// Underglow setup
45#define RGBLIGHT_SLEEP 38#define RGBLIGHT_SLEEP
diff --git a/keyboards/keebio/viterbi/keymaps/bakingpy/keymap.c b/keyboards/keebio/viterbi/keymaps/bakingpy/keymap.c
index f0122bef05..ab8cf2a9ae 100644
--- a/keyboards/keebio/viterbi/keymaps/bakingpy/keymap.c
+++ b/keyboards/keebio/viterbi/keymaps/bakingpy/keymap.c
@@ -158,7 +158,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
158 case QWERTY: 158 case QWERTY:
159 if (record->event.pressed) { 159 if (record->event.pressed) {
160 #ifdef AUDIO_ENABLE 160 #ifdef AUDIO_ENABLE
161 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 161 PLAY_SONG(tone_qwerty);
162 #endif 162 #endif
163 persistent_default_layer_set(1UL<<_QWERTY); 163 persistent_default_layer_set(1UL<<_QWERTY);
164 } 164 }
@@ -167,7 +167,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
167 case COLEMAK: 167 case COLEMAK:
168 if (record->event.pressed) { 168 if (record->event.pressed) {
169 #ifdef AUDIO_ENABLE 169 #ifdef AUDIO_ENABLE
170 PLAY_NOTE_ARRAY(tone_colemak, false, 0); 170 PLAY_SONG(tone_colemak);
171 #endif 171 #endif
172 persistent_default_layer_set(1UL<<_COLEMAK); 172 persistent_default_layer_set(1UL<<_COLEMAK);
173 } 173 }
@@ -176,7 +176,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
176 case DVORAK: 176 case DVORAK:
177 if (record->event.pressed) { 177 if (record->event.pressed) {
178 #ifdef AUDIO_ENABLE 178 #ifdef AUDIO_ENABLE
179 PLAY_NOTE_ARRAY(tone_dvorak, false, 0); 179 PLAY_SONG(tone_dvorak);
180 #endif 180 #endif
181 persistent_default_layer_set(1UL<<_DVORAK); 181 persistent_default_layer_set(1UL<<_DVORAK);
182 } 182 }
diff --git a/keyboards/keebio/viterbi/keymaps/dwallace/keymap.c b/keyboards/keebio/viterbi/keymaps/dwallace/keymap.c
index 5a797cb0bd..c03cf970fd 100644
--- a/keyboards/keebio/viterbi/keymaps/dwallace/keymap.c
+++ b/keyboards/keebio/viterbi/keymaps/dwallace/keymap.c
@@ -155,7 +155,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
155 case QWERTY: 155 case QWERTY:
156 if (record->event.pressed) { 156 if (record->event.pressed) {
157 #ifdef AUDIO_ENABLE 157 #ifdef AUDIO_ENABLE
158 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 158 PLAY_SONG(tone_qwerty);
159 #endif 159 #endif
160 persistent_default_layer_set(1UL<<_QWERTY); 160 persistent_default_layer_set(1UL<<_QWERTY);
161 } 161 }
diff --git a/keyboards/keebio/viterbi/keymaps/mike808/keymap.c b/keyboards/keebio/viterbi/keymaps/mike808/keymap.c
index e1dc91d2b2..9922f1a555 100644
--- a/keyboards/keebio/viterbi/keymaps/mike808/keymap.c
+++ b/keyboards/keebio/viterbi/keymaps/mike808/keymap.c
@@ -128,7 +128,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
128 case QWERTY: 128 case QWERTY:
129 if (record->event.pressed) { 129 if (record->event.pressed) {
130 #ifdef AUDIO_ENABLE 130 #ifdef AUDIO_ENABLE
131 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 131 PLAY_SONG(tone_qwerty);
132 #endif 132 #endif
133 persistent_default_layer_set(1UL << _QWERTY); 133 persistent_default_layer_set(1UL << _QWERTY);
134 } 134 }
@@ -137,7 +137,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
137 case DVORAK: 137 case DVORAK:
138 if (record->event.pressed) { 138 if (record->event.pressed) {
139 #ifdef AUDIO_ENABLE 139 #ifdef AUDIO_ENABLE
140 PLAY_NOTE_ARRAY(tone_dvorak, false, 0); 140 PLAY_SONG(tone_dvorak);
141 #endif 141 #endif
142 persistent_default_layer_set(1UL << _DVORAK); 142 persistent_default_layer_set(1UL << _DVORAK);
143 } 143 }
diff --git a/keyboards/model01/config.h b/keyboards/keyboardio/model01/config.h
index c2160979cd..c2160979cd 100644
--- a/keyboards/model01/config.h
+++ b/keyboards/keyboardio/model01/config.h
diff --git a/keyboards/model01/info.json b/keyboards/keyboardio/model01/info.json
index 60c914d5c0..66bea171d2 100644
--- a/keyboards/model01/info.json
+++ b/keyboards/keyboardio/model01/info.json
@@ -1,6 +1,6 @@
1{ 1{
2 "keyboard_name": "model01", 2 "keyboard_name": "model01",
3 "keyboard_folder": "model01", 3 "keyboard_folder": "keyboardio/model01",
4 "url": "https://keyboard.io", 4 "url": "https://keyboard.io",
5 "maintainer": "qmk", 5 "maintainer": "qmk",
6 "width": 18.5, 6 "width": 18.5,
diff --git a/keyboards/model01/keymaps/default/config.h b/keyboards/keyboardio/model01/keymaps/default/config.h
index 8ab9d8b025..8ab9d8b025 100644
--- a/keyboards/model01/keymaps/default/config.h
+++ b/keyboards/keyboardio/model01/keymaps/default/config.h
diff --git a/keyboards/model01/keymaps/default/keymap.c b/keyboards/keyboardio/model01/keymaps/default/keymap.c
index 5ee865972e..5ee865972e 100644
--- a/keyboards/model01/keymaps/default/keymap.c
+++ b/keyboards/keyboardio/model01/keymaps/default/keymap.c
diff --git a/keyboards/model01/keymaps/default/readme.md b/keyboards/keyboardio/model01/keymaps/default/readme.md
index 740515a268..740515a268 100644
--- a/keyboards/model01/keymaps/default/readme.md
+++ b/keyboards/keyboardio/model01/keymaps/default/readme.md
diff --git a/keyboards/model01/keymaps/dshields/config.h b/keyboards/keyboardio/model01/keymaps/dshields/config.h
index fdb23d46ba..fdb23d46ba 100644
--- a/keyboards/model01/keymaps/dshields/config.h
+++ b/keyboards/keyboardio/model01/keymaps/dshields/config.h
diff --git a/keyboards/model01/keymaps/dshields/keymap.c b/keyboards/keyboardio/model01/keymaps/dshields/keymap.c
index 04887124f9..04887124f9 100644
--- a/keyboards/model01/keymaps/dshields/keymap.c
+++ b/keyboards/keyboardio/model01/keymaps/dshields/keymap.c
diff --git a/keyboards/model01/keymaps/dshields/readme.md b/keyboards/keyboardio/model01/keymaps/dshields/readme.md
index ead1c1aad2..ead1c1aad2 100644
--- a/keyboards/model01/keymaps/dshields/readme.md
+++ b/keyboards/keyboardio/model01/keymaps/dshields/readme.md
diff --git a/keyboards/model01/keymaps/tw1t611/config.h b/keyboards/keyboardio/model01/keymaps/tw1t611/config.h
index 8ab9d8b025..8ab9d8b025 100644
--- a/keyboards/model01/keymaps/tw1t611/config.h
+++ b/keyboards/keyboardio/model01/keymaps/tw1t611/config.h
diff --git a/keyboards/model01/keymaps/tw1t611/keymap.c b/keyboards/keyboardio/model01/keymaps/tw1t611/keymap.c
index b4bd53e3fe..b4bd53e3fe 100644
--- a/keyboards/model01/keymaps/tw1t611/keymap.c
+++ b/keyboards/keyboardio/model01/keymaps/tw1t611/keymap.c
diff --git a/keyboards/model01/keymaps/tw1t611/readme.md b/keyboards/keyboardio/model01/keymaps/tw1t611/readme.md
index b9d728831c..b9d728831c 100644
--- a/keyboards/model01/keymaps/tw1t611/readme.md
+++ b/keyboards/keyboardio/model01/keymaps/tw1t611/readme.md
diff --git a/keyboards/model01/leds.c b/keyboards/keyboardio/model01/leds.c
index b21c1a5c8a..b21c1a5c8a 100644
--- a/keyboards/model01/leds.c
+++ b/keyboards/keyboardio/model01/leds.c
diff --git a/keyboards/model01/leds.h b/keyboards/keyboardio/model01/leds.h
index 405bdf328a..405bdf328a 100644
--- a/keyboards/model01/leds.h
+++ b/keyboards/keyboardio/model01/leds.h
diff --git a/keyboards/model01/matrix.c b/keyboards/keyboardio/model01/matrix.c
index f1f9024c7c..f1f9024c7c 100644
--- a/keyboards/model01/matrix.c
+++ b/keyboards/keyboardio/model01/matrix.c
diff --git a/keyboards/model01/model01.c b/keyboards/keyboardio/model01/model01.c
index 29615ca866..29615ca866 100644
--- a/keyboards/model01/model01.c
+++ b/keyboards/keyboardio/model01/model01.c
diff --git a/keyboards/model01/model01.h b/keyboards/keyboardio/model01/model01.h
index a83e33cd86..a83e33cd86 100644
--- a/keyboards/model01/model01.h
+++ b/keyboards/keyboardio/model01/model01.h
diff --git a/keyboards/model01/readme.md b/keyboards/keyboardio/model01/readme.md
index 34bd291e2e..5f55a88128 100644
--- a/keyboards/model01/readme.md
+++ b/keyboards/keyboardio/model01/readme.md
@@ -2,13 +2,13 @@
2 2
3A split keyboard. 3A split keyboard.
4 4
5Keyboard Maintainer: QMK Community 5* Keyboard Maintainer: QMK Community
6Hardware Supported: Keyboardio Model 01 6* Hardware Supported: Keyboardio Model 01
7Hardware Availability: [Keyboardio](https://shop.keyboard.io) 7* Hardware Availability: [Keyboardio](https://shop.keyboard.io)
8 8
9Make example for this keyboard (after setting up your build environment): 9Make example for this keyboard (after setting up your build environment):
10 10
11 make model01:default 11 make keyboardio/model01:default
12 12
13See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. 13See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
14Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). 14Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
@@ -17,7 +17,7 @@ Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/ne
17 17
18To program the keyboard, if you have avrdude installed: 18To program the keyboard, if you have avrdude installed:
19 19
20 make model01:default:avrdude 20 make keyboardio/model01:default:flash
21 21
22When prompted to reset your keyboard, press the prog key at upper left. If the 22When prompted to reset your keyboard, press the prog key at upper left. If the
23keyboard does not reset, you can hold the prog key while plugging it into your 23keyboard does not reset, you can hold the prog key while plugging it into your
diff --git a/keyboards/model01/rules.mk b/keyboards/keyboardio/model01/rules.mk
index 29c028ac85..29c028ac85 100644
--- a/keyboards/model01/rules.mk
+++ b/keyboards/keyboardio/model01/rules.mk
diff --git a/keyboards/model01/wire-protocol-constants.h b/keyboards/keyboardio/model01/wire-protocol-constants.h
index 90a528582a..90a528582a 100644
--- a/keyboards/model01/wire-protocol-constants.h
+++ b/keyboards/keyboardio/model01/wire-protocol-constants.h
diff --git a/keyboards/keyboardio/readme.md b/keyboards/keyboardio/readme.md
new file mode 100644
index 0000000000..d9ce48c236
--- /dev/null
+++ b/keyboards/keyboardio/readme.md
@@ -0,0 +1,18 @@
1# Keyboardio
2
3Keyboardio are an US-based Keyboard maker, known for their
4[Model01](https://shop.keyboard.io/collections/frontpage/products/model-01-keyboard),
5and more recently, the Keyboardio
6[Atreus](https://www.kickstarter.com/projects/keyboardio/atreus) keyboards.
7
8## Online Stores
9
10**Website:** https://shop.keyboard.io/
11
12## Social Media
13
14**Discord:** https://discord.gg/4az77sf
15**Forums:** https://community.keyboard.io/
16**Twitter:** https://twitter.com/keyboardio
17**Facebook:** https://facebook.com/keyboardio
18**Blog:** https://blog.keyboard.io/
diff --git a/keyboards/kinesis/keymaps/milestogo/keymap.c b/keyboards/kinesis/keymaps/milestogo/keymap.c
index 024df59127..8c01bcb83d 100644
--- a/keyboards/kinesis/keymaps/milestogo/keymap.c
+++ b/keyboards/kinesis/keymaps/milestogo/keymap.c
@@ -52,16 +52,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
52 KC_TAB, KC_Q ,KC_W ,KC_E ,KC_R ,KC_T , 52 KC_TAB, KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,
53 TT(_MOUSE) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G , 53 TT(_MOUSE) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G ,
54 KC_LSFT,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B , 54 KC_LSFT,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,
55 KC_GRAVE, KC_ESC, KC_FN4, LT(_SYMB, KC_RIGHT), 55 KC_GRAVE, KC_ESC, MT(MOD_LGUI,KC_LEFT), LT(_SYMB, KC_RIGHT),
56 KC_LCTL,KC_LALT, 56 KC_LCTL,KC_LALT,
57 KC_DEL, 57 KC_DEL,
58 KC_BSPC, KC_DEL ,TT(_MOUSE) , 58 KC_BSPC, KC_DEL ,TT(_MOUSE) ,
59 KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,TT(_MOUSE) ,KC_FN1 ,TT(_SYMB), KC_NO, RESET, 59 KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,TT(_MOUSE) ,TG(_MOUSE) ,TT(_SYMB), KC_NO, RESET,
60 KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS, 60 KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS,
61 KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS, 61 KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS,
62 KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT, 62 KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT,
63 KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_RSFT, 63 KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_RSFT,
64 LT(_SYMB, KC_UP), KC_FN7, KC_LBRC ,KC_RBRC, 64 LT(_SYMB, KC_UP), MT(MOD_LGUI,KC_DOWN), KC_LBRC ,KC_RBRC,
65 KC_RALT,KC_RGUI, 65 KC_RALT,KC_RGUI,
66 KC_PGUP, 66 KC_PGUP,
67 KC_PGDN,KC_ENTER ,KC_SPC 67 KC_PGDN,KC_ENTER ,KC_SPC
@@ -101,7 +101,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
101 _______, KC_CIRC, KC_LCBR, KC_RCBR, KC_AT, KC_PERC, 101 _______, KC_CIRC, KC_LCBR, KC_RCBR, KC_AT, KC_PERC,
102 _______, KC_EXLM, KC_HASH, KC_0, KC_EQL, KC_TILD, 102 _______, KC_EXLM, KC_HASH, KC_0, KC_EQL, KC_TILD,
103 _______, KC_6, KC_7, KC_8, KC_9, KC_PIPE, 103 _______, KC_6, KC_7, KC_8, KC_9, KC_PIPE,
104 _______, KC_COLON, KC_FN4, LT(_SYMB, KC_RIGHT), 104 _______, KC_COLON, MT(MOD_LGUI,KC_LEFT), LT(_SYMB, KC_RIGHT),
105 _______, _______, 105 _______, _______,
106 _______, 106 _______,
107 _______, _______, RESET, 107 _______, _______, RESET,
@@ -110,7 +110,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
110 KC_AMPR, KC_LBRC, KC_LPRN, KC_RPRN, KC_UNDS, _______, 110 KC_AMPR, KC_LBRC, KC_LPRN, KC_RPRN, KC_UNDS, _______,
111 KC_ASTR, KC_PLUS, KC_1, KC_MINS, KC_RBRC, KC_GRV, 111 KC_ASTR, KC_PLUS, KC_1, KC_MINS, KC_RBRC, KC_GRV,
112 KC_DLR, KC_2, KC_3, KC_4, KC_5, XXXXXXX, 112 KC_DLR, KC_2, KC_3, KC_4, KC_5, XXXXXXX,
113 LT(_SYMB, KC_UP), KC_FN7, KC_BSLS, XXXXXXX, 113 LT(_SYMB, KC_UP), MT(MOD_LGUI,KC_DOWN), KC_BSLS, XXXXXXX,
114 _______, _______, 114 _______, _______,
115 _______, 115 _______,
116 _______, _______, _______ 116 _______, _______, _______
@@ -149,7 +149,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
149 _______, KC_SLSH, RSFT(KC_COMM), RSFT(KC_DOT), _______, _______, 149 _______, KC_SLSH, RSFT(KC_COMM), RSFT(KC_DOT), _______, _______,
150 _______, _______, RSFT(KC_LBRC), RSFT(KC_RBRC), _______, _______, 150 _______, _______, RSFT(KC_LBRC), RSFT(KC_RBRC), _______, _______,
151 _______, KC_EQL, RSFT(KC_9), RSFT(KC_0), _______, _______, 151 _______, KC_EQL, RSFT(KC_9), RSFT(KC_0), _______, _______,
152 _______, _______, KC_FN4, LT(_SYMB, KC_RIGHT), 152 _______, _______, MT(MOD_LGUI,KC_LEFT), LT(_SYMB, KC_RIGHT),
153 _______, _______, 153 _______, _______,
154 _______, 154 _______,
155 _______, _______, RESET, 155 _______, _______, RESET,
@@ -158,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
158 _______, _______, KC_PLUS, KC_MINS, _______, _______, 158 _______, _______, KC_PLUS, KC_MINS, _______, _______,
159 _______, _______, KC_EQL, KC_PIPE, _______, _______, 159 _______, _______, KC_EQL, KC_PIPE, _______, _______,
160 _______, _______, _______, _______, _______, _______, 160 _______, _______, _______, _______, _______, _______,
161 LT(_SYMB, KC_UP), KC_FN7, _______, _______, 161 LT(_SYMB, KC_UP), MT(MOD_LGUI,KC_DOWN), _______, _______,
162 _______, _______, 162 _______, _______,
163 _______, 163 _______,
164 _______, _______, _______ 164 _______, _______, _______
@@ -192,7 +192,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
192 KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, 192 KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______,
193 _______, KC_EXLM ,KC_AT, KC_HASH, KC_DLR ,KC_PERC , 193 _______, KC_EXLM ,KC_AT, KC_HASH, KC_DLR ,KC_PERC ,
194 _______, KC_NO, KC_NO, KC_UP, KC_NO, KC_PGUP, 194 _______, KC_NO, KC_NO, KC_UP, KC_NO, KC_PGUP,
195 KC_FN1, LGUI(KC_Z),LGUI(KC_X),LGUI(KC_C),LGUI(KC_V), KC_NO, 195 TG(_MOUSE), LGUI(KC_Z),LGUI(KC_X),LGUI(KC_C),LGUI(KC_V), KC_NO,
196 _______, KC_NO, KC_NO, KC_UP, KC_NO, KC_PGDN, 196 _______, KC_NO, KC_NO, KC_UP, KC_NO, KC_PGDN,
197 _______, _______, KC_NO, KC_NO, 197 _______, _______, KC_NO, KC_NO,
198 _______, _______, 198 _______, _______,
@@ -261,16 +261,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
261 261
262}; 262};
263 263
264
265
266const uint16_t PROGMEM fn_actions[] = {
267 [1] = ACTION_LAYER_TOGGLE(_MOUSE) ,
268 [4]= ACTION_MODS_TAP_KEY(MOD_LGUI,KC_LEFT),
269 [7]= ACTION_MODS_TAP_KEY(MOD_LGUI,KC_DOWN),
270
271
272};
273
274const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 264const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
275{ 265{
276 // MACRODOWN only works in this function 266 // MACRODOWN only works in this function
diff --git a/keyboards/lets_split/keymaps/mjt/keymap.c b/keyboards/lets_split/keymaps/mjt/keymap.c
index b0394659cc..a7fa4f55d3 100644
--- a/keyboards/lets_split/keymaps/mjt/keymap.c
+++ b/keyboards/lets_split/keymaps/mjt/keymap.c
@@ -152,7 +152,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
152 case QWERTY: 152 case QWERTY:
153 if (record->event.pressed) { 153 if (record->event.pressed) {
154 #ifdef AUDIO_ENABLE 154 #ifdef AUDIO_ENABLE
155 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 155 PLAY_SONG(tone_qwerty);
156 #endif 156 #endif
157 persistent_default_layer_set(1UL<<_QWERTY); 157 persistent_default_layer_set(1UL<<_QWERTY);
158 } 158 }
@@ -161,7 +161,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
161 case COLEMAK: 161 case COLEMAK:
162 if (record->event.pressed) { 162 if (record->event.pressed) {
163 #ifdef AUDIO_ENABLE 163 #ifdef AUDIO_ENABLE
164 PLAY_NOTE_ARRAY(tone_colemak, false, 0); 164 PLAY_SONG(tone_colemak);
165 #endif 165 #endif
166 persistent_default_layer_set(1UL<<_COLEMAK); 166 persistent_default_layer_set(1UL<<_COLEMAK);
167 } 167 }
@@ -170,7 +170,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
170 case DVORAK: 170 case DVORAK:
171 if (record->event.pressed) { 171 if (record->event.pressed) {
172 #ifdef AUDIO_ENABLE 172 #ifdef AUDIO_ENABLE
173 PLAY_NOTE_ARRAY(tone_dvorak, false, 0); 173 PLAY_SONG(tone_dvorak);
174 #endif 174 #endif
175 persistent_default_layer_set(1UL<<_DVORAK); 175 persistent_default_layer_set(1UL<<_DVORAK);
176 } 176 }
diff --git a/keyboards/lets_split/keymaps/piemod/keymap.c b/keyboards/lets_split/keymaps/piemod/keymap.c
index d789b7a8be..68e7e0ba05 100644
--- a/keyboards/lets_split/keymaps/piemod/keymap.c
+++ b/keyboards/lets_split/keymaps/piemod/keymap.c
@@ -29,7 +29,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
29 KC_ESC, KC_QUOTE, LT(7, KC_COMMA), KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DELETE, \ 29 KC_ESC, KC_QUOTE, LT(7, KC_COMMA), KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DELETE, \
30 KC_TAB, LT(1, KC_A), LT(2, KC_O), LT(3, KC_E), LT(4, KC_U), KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENTER, \ 30 KC_TAB, LT(1, KC_A), LT(2, KC_O), LT(3, KC_E), LT(4, KC_U), KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENTER, \
31 KC_LSHIFT, KC_SCOLON, LT(5, KC_Q), KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_MINUS, \ 31 KC_LSHIFT, KC_SCOLON, LT(5, KC_Q), KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_MINUS, \
32 F(1), LT(6, KC_LCTRL), KC_MENU, KC_LALT, KC_LGUI, KC_BSPACE, KC_SPACE, KC_RCTRL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT \ 32 C(KC_LALT), LT(6, KC_LCTRL), KC_MENU, KC_LALT, KC_LGUI, KC_BSPACE, KC_SPACE, KC_RCTRL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT \
33), 33),
34 34
35[_ARROW] = LAYOUT( \ 35[_ARROW] = LAYOUT( \
@@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
41 41
42[_SYMBOL] = LAYOUT( \ 42[_SYMBOL] = LAYOUT( \
43 KC_TILD, KC_GRAVE, KC_NO, KC_EQUAL, KC_PLUS, KC_NO, KC_LBRACKET, KC_RBRACKET, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \ 43 KC_TILD, KC_GRAVE, KC_NO, KC_EQUAL, KC_PLUS, KC_NO, KC_LBRACKET, KC_RBRACKET, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \
44 KC_NO, KC_NO, KC_TRNS, KC_SCOLON, KC_COLN, KC_NO, KC_LCBR, KC_RCBR, KC_DLR, KC_PERC, KC_CIRC, F(2), \ 44 KC_NO, KC_NO, KC_TRNS, KC_SCOLON, KC_COLN, KC_NO, KC_LCBR, KC_RCBR, KC_DLR, KC_PERC, KC_CIRC, S(KC_SLSH), \
45 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLASH, KC_SLASH, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, \ 45 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLASH, KC_SLASH, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, \
46 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ASTR, KC_SLASH, KC_MINUS, KC_PLUS, KC_EQUAL \ 46 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ASTR, KC_SLASH, KC_MINUS, KC_PLUS, KC_EQUAL \
47), 47),
@@ -81,19 +81,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
81 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, KC_NO, KC_NO, KC_NO \ 81 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, KC_NO, KC_NO, KC_NO \
82) 82)
83}; 83};
84
85enum function_id {
86 TEENSY_KEY,
87 CUSTOM_KEY,
88 L_CTRL_ALT_ENT,
89 R_CTRL_ALT_ENT,
90};
91
92int CAPSLOCKED = 0;
93
94 const uint16_t PROGMEM fn_actions[] = {
95 // Special Keys
96 [1] = ACTION_MODS_KEY(KC_LCTRL, KC_LALT), // FN10 = Ctrl + Alt.
97 // Symbols
98 [2] = ACTION_MODS_KEY(MOD_LSFT, KC_SLASH), // FN21 = Question mark.
99 };
diff --git a/keyboards/lily58/config.h b/keyboards/lily58/config.h
index 50bf2beb32..0bdaa1f76e 100644
--- a/keyboards/lily58/config.h
+++ b/keyboards/lily58/config.h
@@ -19,10 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19#pragma once 19#pragma once
20 20
21#include "config_common.h" 21#include "config_common.h"
22#include <serial_config.h>
23 22
24#define USE_I2C 23#ifndef SOFT_SERIAL_PIN
25#define USE_SERIAL 24#define SOFT_SERIAL_PIN D2
25#define SERIAL_USE_MULTI_TRANSACTION
26#endif
26 27
27#if !defined(NO_ACTION_MACRO) 28#if !defined(NO_ACTION_MACRO)
28 #define NO_ACTION_MACRO 29 #define NO_ACTION_MACRO
@@ -30,3 +31,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
30#if !defined(NO_ACTION_FUNCTION) 31#if !defined(NO_ACTION_FUNCTION)
31 #define NO_ACTION_FUNCTION 32 #define NO_ACTION_FUNCTION
32#endif 33#endif
34
35#define DIODE_DIRECTION COL2ROW
36
37// Use the lily version to get the Lily58 logo instead of the qmk logo
38#define OLED_FONT_H "lib/glcdfont_lily.c"
diff --git a/keyboards/lily58/i2c.c b/keyboards/lily58/i2c.c
deleted file mode 100755
index 4bee5c6398..0000000000
--- a/keyboards/lily58/i2c.c
+++ /dev/null
@@ -1,162 +0,0 @@
1#include <util/twi.h>
2#include <avr/io.h>
3#include <stdlib.h>
4#include <avr/interrupt.h>
5#include <util/twi.h>
6#include <stdbool.h>
7#include "i2c.h"
8
9#ifdef USE_I2C
10
11// Limits the amount of we wait for any one i2c transaction.
12// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
13// 9 bits, a single transaction will take around 90μs to complete.
14//
15// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
16// poll loop takes at least 8 clock cycles to execute
17#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
18
19#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
20
21volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
22
23static volatile uint8_t slave_buffer_pos;
24static volatile bool slave_has_register_set = false;
25
26// Wait for an i2c operation to finish
27inline static
28void i2c_delay(void) {
29 uint16_t lim = 0;
30 while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
31 lim++;
32
33 // easier way, but will wait slightly longer
34 // _delay_us(100);
35}
36
37// Setup twi to run at 100kHz or 400kHz (see ./i2c.h SCL_CLOCK)
38void i2c_master_init(void) {
39 // no prescaler
40 TWSR = 0;
41 // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
42 // Check datasheets for more info.
43 TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
44}
45
46// Start a transaction with the given i2c slave address. The direction of the
47// transfer is set with I2C_READ and I2C_WRITE.
48// returns: 0 => success
49// 1 => error
50uint8_t i2c_master_start(uint8_t address) {
51 TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
52
53 i2c_delay();
54
55 // check that we started successfully
56 if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
57 return 1;
58
59 TWDR = address;
60 TWCR = (1<<TWINT) | (1<<TWEN);
61
62 i2c_delay();
63
64 if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
65 return 1; // slave did not acknowledge
66 else
67 return 0; // success
68}
69
70
71// Finish the i2c transaction.
72void i2c_master_stop(void) {
73 TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
74
75 uint16_t lim = 0;
76 while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
77 lim++;
78}
79
80// Write one byte to the i2c slave.
81// returns 0 => slave ACK
82// 1 => slave NACK
83uint8_t i2c_master_write(uint8_t data) {
84 TWDR = data;
85 TWCR = (1<<TWINT) | (1<<TWEN);
86
87 i2c_delay();
88
89 // check if the slave acknowledged us
90 return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
91}
92
93// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
94// if ack=0 the acknowledge bit is not set.
95// returns: byte read from i2c device
96uint8_t i2c_master_read(int ack) {
97 TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
98
99 i2c_delay();
100 return TWDR;
101}
102
103void i2c_reset_state(void) {
104 TWCR = 0;
105}
106
107void i2c_slave_init(uint8_t address) {
108 TWAR = address << 0; // slave i2c address
109 // TWEN - twi enable
110 // TWEA - enable address acknowledgement
111 // TWINT - twi interrupt flag
112 // TWIE - enable the twi interrupt
113 TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
114}
115
116ISR(TWI_vect);
117
118ISR(TWI_vect) {
119 uint8_t ack = 1;
120 switch(TW_STATUS) {
121 case TW_SR_SLA_ACK:
122 // this device has been addressed as a slave receiver
123 slave_has_register_set = false;
124 break;
125
126 case TW_SR_DATA_ACK:
127 // this device has received data as a slave receiver
128 // The first byte that we receive in this transaction sets the location
129 // of the read/write location of the slaves memory that it exposes over
130 // i2c. After that, bytes will be written at slave_buffer_pos, incrementing
131 // slave_buffer_pos after each write.
132 if(!slave_has_register_set) {
133 slave_buffer_pos = TWDR;
134 // don't acknowledge the master if this memory loctaion is out of bounds
135 if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
136 ack = 0;
137 slave_buffer_pos = 0;
138 }
139 slave_has_register_set = true;
140 } else {
141 i2c_slave_buffer[slave_buffer_pos] = TWDR;
142 BUFFER_POS_INC();
143 }
144 break;
145
146 case TW_ST_SLA_ACK:
147 case TW_ST_DATA_ACK:
148 // master has addressed this device as a slave transmitter and is
149 // requesting data.
150 TWDR = i2c_slave_buffer[slave_buffer_pos];
151 BUFFER_POS_INC();
152 break;
153
154 case TW_BUS_ERROR: // something went wrong, reset twi state
155 TWCR = 0;
156 default:
157 break;
158 }
159 // Reset everything, so we are ready for the next TWI interrupt
160 TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
161}
162#endif
diff --git a/keyboards/lily58/i2c.h b/keyboards/lily58/i2c.h
deleted file mode 100755
index 710662c7ab..0000000000
--- a/keyboards/lily58/i2c.h
+++ /dev/null
@@ -1,46 +0,0 @@
1#pragma once
2
3#include <stdint.h>
4
5#ifndef F_CPU
6#define F_CPU 16000000UL
7#endif
8
9#define I2C_READ 1
10#define I2C_WRITE 0
11
12#define I2C_ACK 1
13#define I2C_NACK 0
14
15#define SLAVE_BUFFER_SIZE 0x10
16
17// i2c SCL clock frequency 400kHz
18#define SCL_CLOCK 400000L
19
20extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
21
22void i2c_master_init(void);
23uint8_t i2c_master_start(uint8_t address);
24void i2c_master_stop(void);
25uint8_t i2c_master_write(uint8_t data);
26uint8_t i2c_master_read(int);
27void i2c_reset_state(void);
28void i2c_slave_init(uint8_t address);
29
30
31static inline unsigned char i2c_start_read(unsigned char addr) {
32 return i2c_master_start((addr << 1) | I2C_READ);
33}
34
35static inline unsigned char i2c_start_write(unsigned char addr) {
36 return i2c_master_start((addr << 1) | I2C_WRITE);
37}
38
39// from SSD1306 scrips
40extern unsigned char i2c_rep_start(unsigned char addr);
41extern void i2c_start_wait(unsigned char addr);
42extern unsigned char i2c_readAck(void);
43extern unsigned char i2c_readNak(void);
44extern unsigned char i2c_read(unsigned char ack);
45
46#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
diff --git a/keyboards/lily58/keymaps/chuan/config.h b/keyboards/lily58/keymaps/chuan/config.h
new file mode 100644
index 0000000000..fa93060db1
--- /dev/null
+++ b/keyboards/lily58/keymaps/chuan/config.h
@@ -0,0 +1,64 @@
1/*
2This is the c configuration file for the keymap
3
4Copyright 2012 Jun Wako <wakojun@gmail.com>
5Copyright 2015 Jack Humbert
6
7This program is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#pragma once
22
23// #define USE_MATRIX_I2C
24
25// #define USE_I2C
26
27/* Select hand configuration */
28
29#define MASTER_LEFT
30// #define MASTER_RIGHT
31// #define EE_HANDS
32
33// #define SSD1306OLED
34
35#define USE_SERIAL_PD2
36
37#define TAPPING_FORCE_HOLD
38
39/* define tapping term */
40#define TAPPING_TERM 200
41
42
43#undef RGBLED_NUM
44#define RGBLIGHT_ANIMATIONS
45#define RGBLED_NUM 27
46#define RGBLIGHT_LIMIT_VAL 120
47#define RGBLIGHT_HUE_STEP 10
48#define RGBLIGHT_SAT_STEP 17
49#define RGBLIGHT_VAL_STEP 17
50
51#define ENCODERS_PAD_A { F4 }
52#define ENCODERS_PAD_B { F5 }
53
54
55 /* Set 0 if debouncing isn't needed */
56#define DEBOUNCE 5
57
58// Underglow
59/*
60#undef RGBLED_NUM
61#define RGBLED_NUM 14 // Number of LEDs
62#define RGBLIGHT_ANIMATIONS
63#define RGBLIGHT_SLEEP
64*/
diff --git a/keyboards/lily58/keymaps/chuan/keymap.c b/keyboards/lily58/keymaps/chuan/keymap.c
new file mode 100644
index 0000000000..da49e67a0e
--- /dev/null
+++ b/keyboards/lily58/keymaps/chuan/keymap.c
@@ -0,0 +1,230 @@
1#include QMK_KEYBOARD_H
2
3#ifdef RGBLIGHT_ENABLE
4//Following line allows macro to read current RGB settings
5extern rgblight_config_t rgblight_config;
6#endif
7
8extern uint8_t is_master;
9
10#define _QWERTY 0
11#define _LOWER 1
12#define _RAISE 2
13#define _ADJUST 3
14
15enum custom_keycodes {
16 QWERTY = SAFE_RANGE,
17 LOWER,
18 RAISE,
19 ADJUST,
20};
21
22
23const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
24
25/* QWERTY
26 * ,-----------------------------------------. ,-----------------------------------------.
27 * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | ` |
28 * |------+------+------+------+------+------| |------+------+------+------+------+------|
29 * | Tab | Q | W | E | R | T | | Y | U | I | O | P | - |
30 * |------+------+------+------+------+------| |------+------+------+------+------+------|
31 * |HYPER | A | S | D | F | G |-------. ,-------| H | J | K | L | ; | ' |
32 * |------+------+------+------+------+------| - | | + |------+------+------+------+------+------|
33 * |LShift| Z | X | C | V | B |-------| |-------| N | M | , | . | / |RShift|
34 * `-----------------------------------------/ / \ \-----------------------------------------'
35 * | LCtl | LGUI |LALT | /Space / \Space \ |RAISE | [ | ] |
36 * | | | |/ LOWER / \ \ | ' | | |
37 * `----------------------------' '------''--------------------'
38 */
39
40 [_QWERTY] = LAYOUT(
41 KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
42 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, \
43 ALL_T(KC_GRV), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENTER, \
44 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MINS, MEH_T(KC_EQL), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \
45 KC_LCTRL, KC_LGUI, KC_LALT,LT(_LOWER, KC_SPC), KC_SPC, LT(2,KC_QUOT), KC_LBRC, KC_RBRC \
46),
47/* LOWER
48 * ,-----------------------------------------. ,-----------------------------------------.
49 * | | | | | | | | | | | | | |
50 * |------+------+------+------+------+------| |------+------+------+------+------+------|
51 * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |
52 * |------+------+------+------+------+------| |------+------+------+------+------+------|
53 * | ` | ! | @ | # | $ | % |-------. ,-------| ^ | & | * | ( | ) | - |
54 * |------+------+------+------+------+------| cmd spc| | |------+------+------+------+------+------|
55 * | | | |ctrl c| | |-------| |-------| | - | _ | [ | ] | | |
56 * `-----------------------------------------/ / \ \-----------------------------------------'
57 * | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE | { | } |
58 * | | | |/ / \ \ | | | |
59 * `----------------------------' '------''--------------------'
60 */
61[_LOWER] = LAYOUT(
62 KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_TILD, \
63 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
64 _______, _______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______,\
65 _______, _______, _______, C(KC_C), _______, _______, LGUI(KC_SPC), _______, _______, KC_MINS, KC_UNDS , KC_LBRC, KC_RBRC, KC_PIPE, \
66 _______, _______, _______, _______, _______, RAISE, KC_LCBR, KC_RCBR\
67),
68/* RAISE
69 * ,-----------------------------------------. ,-----------------------------------------.
70 * | | | | | | | | | | | | | |
71 * |------+------+------+------+------+------| |------+------+------+------+------+------|
72 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | |
73 * |------+------+------+------+------+------| |------+------+------+------+------+------|
74 * | F1 | F2 | F3 | F4 | F5 | F6 |-------. ,-------| | Left | Down | Up |Right | |
75 * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------|
76 * | F7 | F8 | F9 | F10 | F11 | F12 |-------| |-------| + | - | = | [ | ] | \ |
77 * `-----------------------------------------/ / \ \-----------------------------------------'
78 * | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE |BackSP| RGUI |
79 * | | | |/ / \ \ | | | |
80 * `----------------------------' '------''--------------------'
81 */
82
83[_RAISE] = LAYOUT(
84 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC_DEL, _______, \
85 KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_6, LCTL(LSFT(KC_TAB)),KC_UP,LCTL(KC_TAB), KC_0, _______, \
86 _______, _______, _______, _______, _______, _______, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, KC_RGHT, XXXXXXX, \
87 _______, _______, _______, _______, _______, _______, _______, TG(_ADJUST),KC_PLUS, KC_MUTE ,KC_VOLD ,KC_VOLU, _______, _______, \
88 _______, _______, _______, _______, _______, _______, _______, _______ \
89),
90/* ADJUST
91 * ,-----------------------------------------. ,-----------------------------------------.
92 * | | | | | | | | | 7 | 8 | 9 |RGB ON| HUE+ |
93 * |------+------+------+------+------+------| |------+------+------+------+------+------|
94 * | | | | | | | | | 4 | 5 | 6 | MODE | HUE- |
95 * |------+------+------+------+------+------| |------+------+------+------+------+------|
96 * | | | | | | |-------. ,-------| | 1 | 2 | 3 | SAT+ | VAL+ |
97 * |------+------+------+------+------+------| | |DEFAULT|------+------+------+------+------+------|
98 * | | | | | | |-------| |-------| | 0 | 0 | . | SAT- | VAL- |
99 * `-----------------------------------------/ / \ \-----------------------------------------'
100 * | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE |BackSP| RGUI |
101 * | | | |/ / \ \ | | | |
102 * `----------------------------' '------''--------------------'
103 */
104 [_ADJUST] = LAYOUT(
105 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_7 , KC_8 , KC_9 , RGB_TOG, RGB_HUI, \
106 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_4 , KC_5 , KC_6 , RGB_MOD, RGB_HUD, \
107 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_1 , KC_2 , KC_3 , RGB_SAI, RGB_VAI, \
108 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(_ADJUST), XXXXXXX, KC_0 , KC_0 , KC_DOT, RGB_SAD, RGB_VAD,\
109 _______, _______, _______, _______, _______, _______,KC_BSPC, _______ \
110 )
111};
112
113int RGB_current_mode;
114
115int counter = 0;
116int lastIndex = 9;
117
118// Setting ADJUST layer RGB back to default
119void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
120 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
121 layer_on(layer3);
122 } else {
123 layer_off(layer3);
124 }
125}
126
127void matrix_init_user(void) {
128 #ifdef RGBLIGHT_ENABLE
129 RGB_current_mode = rgblight_config.mode;
130 #endif
131}
132
133#ifdef OLED_DRIVER_ENABLE
134
135oled_rotation_t oled_init_user(oled_rotation_t rotation) {
136 if (!is_keyboard_master())
137 return OLED_ROTATION_180; // flips the display 180 degrees if offhand
138 return rotation;
139}
140
141// When add source files to SRC in rules.mk, you can use functions.
142const char *read_layer_state(void);
143const char *read_logo(void);
144void set_keylog(uint16_t keycode, keyrecord_t *record);
145const char *read_keylog(void);
146const char *read_keylogs(void);
147
148const char *read_mode_icon(bool swap);
149const char *read_host_led_state(void);
150void set_timelog(void);
151const char *read_timelog(void);
152
153char encoder_debug[24];
154
155void oled_task_user(void) {
156 // Host Keyboard Layer Status
157 snprintf(encoder_debug, sizeof(encoder_debug), "%i %i", counter, lastIndex );
158 if (is_keyboard_master()) {
159 // If you want to change the display of OLED, you need to change here
160 oled_write_ln(read_layer_state(), false);
161 // oled_write_ln(read_keylog(), false);
162 // oled_write_ln(read_keylogs(), false);
163 // oled_write_ln(read_mode_icon(keymap_config.swap_lalt_lgui), false);
164 oled_write_ln(read_host_led_state(), false);
165 oled_write_ln(encoder_debug, false);
166 // oled_write_ln(read_timelog(), false);
167 } else {
168 oled_write(read_logo(), false);
169 // oled_write_ln(encoder_debug, false);
170 }
171}
172#endif //OLED_DRIVER_ENABLE
173
174bool process_record_user(uint16_t keycode, keyrecord_t *record) {
175 if (record->event.pressed) {
176#ifdef SSD1306OLED
177 // set_keylog(keycode, record);
178#endif
179 // set_timelog();
180 }
181
182 switch (keycode) {
183 case QWERTY:
184 if (record->event.pressed) {
185 set_single_persistent_default_layer(_QWERTY);
186 }
187 return false;
188 break;
189 case LOWER:
190 if (record->event.pressed) {
191 layer_on(_LOWER);
192 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
193 } else {
194 layer_off(_LOWER);
195 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
196 }
197 return false;
198 break;
199 case RAISE:
200 if (record->event.pressed) {
201 layer_on(_RAISE);
202 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
203 } else {
204 layer_off(_RAISE);
205 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
206 }
207 return false;
208 break;
209 case ADJUST:
210 if (record->event.pressed) {
211 layer_on(_ADJUST);
212 } else {
213 layer_off(_ADJUST);
214 }
215 return false;
216 break;
217 }
218 return true;
219}
220
221void encoder_update_user(uint8_t index, bool clockwise) {
222 lastIndex = index;
223 if (clockwise) {
224 counter++;
225 tap_code(KC_PGDN);
226 } else {
227 counter--;
228 tap_code(KC_PGUP);
229 }
230}
diff --git a/keyboards/lily58/keymaps/chuan/rules.mk b/keyboards/lily58/keymaps/chuan/rules.mk
new file mode 100644
index 0000000000..3e05cb7d92
--- /dev/null
+++ b/keyboards/lily58/keymaps/chuan/rules.mk
@@ -0,0 +1,11 @@
1EXTRAKEY_ENABLE = yes
2NKRO_ENABLE = yes
3ENCODER_ENABLE = yes
4# If you want to change the display of OLED, you need to change here
5SRC += ./lib/rgb_state_reader.c \
6 ./lib/layer_state_reader.c \
7 ./lib/logo_reader.c \
8 ./lib/mode_icon_reader.c \
9 ./lib/host_led_state_reader.c \
10 ./lib/timelogger.c \
11 ./lib/keylogger.c \
diff --git a/keyboards/lily58/keymaps/default/config.h b/keyboards/lily58/keymaps/default/config.h
index 58bbdc5e9d..6b9e52c05e 100644
--- a/keyboards/lily58/keymaps/default/config.h
+++ b/keyboards/lily58/keymaps/default/config.h
@@ -28,8 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
28// #define MASTER_RIGHT 28// #define MASTER_RIGHT
29// #define EE_HANDS 29// #define EE_HANDS
30 30
31#define SSD1306OLED
32
33#define USE_SERIAL_PD2 31#define USE_SERIAL_PD2
34 32
35#define TAPPING_FORCE_HOLD 33#define TAPPING_FORCE_HOLD
@@ -49,4 +47,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
49#define RGBLED_NUM 14 // Number of LEDs 47#define RGBLED_NUM 14 // Number of LEDs
50#define RGBLIGHT_ANIMATIONS 48#define RGBLIGHT_ANIMATIONS
51#define RGBLIGHT_SLEEP 49#define RGBLIGHT_SLEEP
52*/ \ No newline at end of file 50*/
diff --git a/keyboards/lily58/keymaps/default/keymap.c b/keyboards/lily58/keymaps/default/keymap.c
index f36248e12d..f0fbaa8b0d 100644
--- a/keyboards/lily58/keymaps/default/keymap.c
+++ b/keyboards/lily58/keymaps/default/keymap.c
@@ -8,8 +8,6 @@
8 #include "ssd1306.h" 8 #include "ssd1306.h"
9#endif 9#endif
10 10
11
12
13#ifdef RGBLIGHT_ENABLE 11#ifdef RGBLIGHT_ENABLE
14//Following line allows macro to read current RGB settings 12//Following line allows macro to read current RGB settings
15extern rgblight_config_t rgblight_config; 13extern rgblight_config_t rgblight_config;
@@ -135,16 +133,18 @@ void matrix_init_user(void) {
135 #ifdef RGBLIGHT_ENABLE 133 #ifdef RGBLIGHT_ENABLE
136 RGB_current_mode = rgblight_config.mode; 134 RGB_current_mode = rgblight_config.mode;
137 #endif 135 #endif
138 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
139 #ifdef SSD1306OLED
140 iota_gfx_init(!has_usb()); // turns on the display
141 #endif
142} 136}
143 137
144//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h 138//SSD1306 OLED update loop, make sure to enable OLED_DRIVER_ENABLE=yes in rules.mk
145#ifdef SSD1306OLED 139#ifdef OLED_DRIVER_ENABLE
146 140
147// When add source files to SRC in rules.mk, you can use functions. 141oled_rotation_t oled_init_user(oled_rotation_t rotation) {
142 if (!is_keyboard_master())
143 return OLED_ROTATION_180; // flips the display 180 degrees if offhand
144 return rotation;
145}
146
147// When you add source files to SRC in rules.mk, you can use functions.
148const char *read_layer_state(void); 148const char *read_layer_state(void);
149const char *read_logo(void); 149const char *read_logo(void);
150void set_keylog(uint16_t keycode, keyrecord_t *record); 150void set_keylog(uint16_t keycode, keyrecord_t *record);
@@ -156,42 +156,24 @@ const char *read_keylogs(void);
156// void set_timelog(void); 156// void set_timelog(void);
157// const char *read_timelog(void); 157// const char *read_timelog(void);
158 158
159void matrix_scan_user(void) { 159void oled_task_user(void) {
160 iota_gfx_task(); 160 if (is_keyboard_master()) {
161}
162
163void matrix_render_user(struct CharacterMatrix *matrix) {
164 if (is_master) {
165 // If you want to change the display of OLED, you need to change here 161 // If you want to change the display of OLED, you need to change here
166 matrix_write_ln(matrix, read_layer_state()); 162 oled_write_ln(read_layer_state(), false);
167 matrix_write_ln(matrix, read_keylog()); 163 oled_write_ln(read_keylog(), false);
168 matrix_write_ln(matrix, read_keylogs()); 164 oled_write_ln(read_keylogs(), false);
169 //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui)); 165 //oled_write_ln(read_mode_icon(keymap_config.swap_lalt_lgui), false);
170 //matrix_write_ln(matrix, read_host_led_state()); 166 //oled_write_ln(read_host_led_state(), false);
171 //matrix_write_ln(matrix, read_timelog()); 167 //oled_write_ln(read_timelog(), false);
172 } else { 168 } else {
173 matrix_write(matrix, read_logo()); 169 oled_write(read_logo(), false);
174 }
175}
176
177void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
178 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
179 memcpy(dest->display, source->display, sizeof(dest->display));
180 dest->dirty = true;
181 } 170 }
182} 171}
183 172#endif // OLED_DRIVER_ENABLE
184void iota_gfx_task_user(void) {
185 struct CharacterMatrix matrix;
186 matrix_clear(&matrix);
187 matrix_render_user(&matrix);
188 matrix_update(&display, &matrix);
189}
190#endif//SSD1306OLED
191 173
192bool process_record_user(uint16_t keycode, keyrecord_t *record) { 174bool process_record_user(uint16_t keycode, keyrecord_t *record) {
193 if (record->event.pressed) { 175 if (record->event.pressed) {
194#ifdef SSD1306OLED 176#ifdef OLED_DRIVER_ENABLE
195 set_keylog(keycode, record); 177 set_keylog(keycode, record);
196#endif 178#endif
197 // set_timelog(); 179 // set_timelog();
diff --git a/keyboards/lily58/keymaps/default/rules.mk b/keyboards/lily58/keymaps/default/rules.mk
index b39305767b..a5b6303a1e 100644
--- a/keyboards/lily58/keymaps/default/rules.mk
+++ b/keyboards/lily58/keymaps/default/rules.mk
@@ -15,13 +15,13 @@ UNICODE_ENABLE = no # Unicode
15BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 15BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
16RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. 16RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
17SWAP_HANDS_ENABLE = no # Enable one-hand typing 17SWAP_HANDS_ENABLE = no # Enable one-hand typing
18OLED_DRIVER_ENABLE= yes # OLED display
18 19
19# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 20# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
20SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 21SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
21 22
22# If you want to change the display of OLED, you need to change here 23# If you want to change the display of OLED, you need to change here
23SRC += ./lib/glcdfont.c \ 24SRC += ./lib/rgb_state_reader.c \
24 ./lib/rgb_state_reader.c \
25 ./lib/layer_state_reader.c \ 25 ./lib/layer_state_reader.c \
26 ./lib/logo_reader.c \ 26 ./lib/logo_reader.c \
27 ./lib/keylogger.c \ 27 ./lib/keylogger.c \
diff --git a/keyboards/lily58/keymaps/yuchi/keymap.c b/keyboards/lily58/keymaps/yuchi/keymap.c
index 13b6cb1687..d258fbcbc0 100644
--- a/keyboards/lily58/keymaps/yuchi/keymap.c
+++ b/keyboards/lily58/keymaps/yuchi/keymap.c
@@ -112,7 +112,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
112 * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE | 112 * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE |
113 * | | | |/ / \ \ | | | | 113 * | | | |/ / \ \ | | | |
114 * `----------------------------' '------''--------------------' 114 * `----------------------------' '------''--------------------'
115 */ 115 */
116 [_ADJUST] = LAYOUT( \ 116 [_ADJUST] = LAYOUT( \
117 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ 117 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
118 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ 118 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
@@ -137,14 +137,16 @@ void matrix_init_user(void) {
137 #ifdef RGBLIGHT_ENABLE 137 #ifdef RGBLIGHT_ENABLE
138 RGB_current_mode = rgblight_config.mode; 138 RGB_current_mode = rgblight_config.mode;
139 #endif 139 #endif
140 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
141 #ifdef SSD1306OLED
142 iota_gfx_init(!has_usb()); // turns on the display
143 #endif
144} 140}
145 141
146//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h 142//SSD1306 OLED update loop, make sure to enable OLED_DRIVER_ENABLE=yes in rules.mk
147#ifdef SSD1306OLED 143#ifdef OLED_DRIVER_ENABLE
144
145oled_rotation_t oled_init_user(oled_rotation_t rotation) {
146 if (!is_keyboard_master())
147 return OLED_ROTATION_180; // flips the display 180 degrees if offhand
148 return rotation;
149}
148 150
149// When add source files to SRC in rules.mk, you can use functions. 151// When add source files to SRC in rules.mk, you can use functions.
150const char *read_layer_state(void); 152const char *read_layer_state(void);
@@ -165,35 +167,22 @@ void matrix_scan_user(void) {
165void matrix_render_user(struct CharacterMatrix *matrix) { 167void matrix_render_user(struct CharacterMatrix *matrix) {
166 if (is_master) { 168 if (is_master) {
167 // If you want to change the display of OLED, you need to change here 169 // If you want to change the display of OLED, you need to change here
168 matrix_write_ln(matrix, read_layer_state()); 170 oled_write_ln(read_layer_state(), false);
169 matrix_write_ln(matrix, read_keylog()); 171 oled_write_ln(read_keylog(), false);
170 matrix_write_ln(matrix, read_keylogs()); 172 oled_write_ln(read_keylogs(), false);
171 //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui)); 173 //oled_write_ln(read_mode_icon(keymap_config.swap_lalt_lgui), false);
172 //matrix_write_ln(matrix, read_host_led_state()); 174 //oled_write_ln(read_host_led_state(), false);
173 //matrix_write_ln(matrix, read_timelog()); 175 //oled_write_ln(read_timelog(), false);
174 } else { 176 } else {
175 matrix_write(matrix, read_logo()); 177 oled_write(read_logo(), false);
176 } 178 }
177} 179}
178 180
179void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
180 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
181 memcpy(dest->display, source->display, sizeof(dest->display));
182 dest->dirty = true;
183 }
184}
185
186void iota_gfx_task_user(void) {
187 struct CharacterMatrix matrix;
188 matrix_clear(&matrix);
189 matrix_render_user(&matrix);
190 matrix_update(&display, &matrix);
191}
192#endif//SSD1306OLED 181#endif//SSD1306OLED
193 182
194bool process_record_user(uint16_t keycode, keyrecord_t *record) { 183bool process_record_user(uint16_t keycode, keyrecord_t *record) {
195 if (record->event.pressed) { 184 if (record->event.pressed) {
196#ifdef SSD1306OLED 185#ifdef OLED_DRIVER_ENABLE
197 set_keylog(keycode, record); 186 set_keylog(keycode, record);
198#endif 187#endif
199 // set_timelog(); 188 // set_timelog();
@@ -236,4 +225,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
236 break; 225 break;
237 } 226 }
238 return true; 227 return true;
239} \ No newline at end of file 228}
diff --git a/keyboards/lily58/keymaps/yuchi/rules.mk b/keyboards/lily58/keymaps/yuchi/rules.mk
index 922fac6b69..0db9ac50fa 100644
--- a/keyboards/lily58/keymaps/yuchi/rules.mk
+++ b/keyboards/lily58/keymaps/yuchi/rules.mk
@@ -13,15 +13,14 @@ MIDI_ENABLE = no # MIDI controls
13AUDIO_ENABLE = no # Audio output on port C6 13AUDIO_ENABLE = no # Audio output on port C6
14UNICODE_ENABLE = no # Unicode 14UNICODE_ENABLE = no # Unicode
15BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 15BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
16RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. 16RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
17SWAP_HANDS_ENABLE = no # Enable one-hand typing 17SWAP_HANDS_ENABLE = no # Enable one-hand typing
18 18
19# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 19# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
20SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 20SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
21 21
22# If you want to change the display of OLED, you need to change here 22# If you want to change the display of OLED, you need to change here
23SRC += ./lib/glcdfont.c \ 23SRC += ./lib/rgb_state_reader.c \
24 ./lib/rgb_state_reader.c \
25 ./lib/layer_state_reader.c \ 24 ./lib/layer_state_reader.c \
26 ./lib/logo_reader.c \ 25 ./lib/logo_reader.c \
27 ./lib/keylogger.c \ 26 ./lib/keylogger.c \
diff --git a/keyboards/lily58/lib/glcdfont.c b/keyboards/lily58/lib/glcdfont_lily.c
index 94f026ba97..0aa69ea822 100644
--- a/keyboards/lily58/lib/glcdfont.c
+++ b/keyboards/lily58/lib/glcdfont_lily.c
@@ -1,6 +1,7 @@
1// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. 1// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0.
2// See gfxfont.h for newer custom bitmap font info. 2// See gfxfont.h for newer custom bitmap font info.
3 3
4// Modified to show the Lily58 logo instead of the qmk logo
4#include "progmem.h" 5#include "progmem.h"
5 6
6// Standard ASCII 5x7 font 7// Standard ASCII 5x7 font
diff --git a/keyboards/lily58/lib/host_led_state_reader.c b/keyboards/lily58/lib/host_led_state_reader.c
index 0e22173b1d..589dd6152e 100644
--- a/keyboards/lily58/lib/host_led_state_reader.c
+++ b/keyboards/lily58/lib/host_led_state_reader.c
@@ -1,15 +1,16 @@
1#include <stdio.h> 1#include <stdio.h>
2#include "led.h"
3#include "host.h"
2#include "lily58.h" 4#include "lily58.h"
3 5
4char host_led_state_str[24]; 6char host_led_state_str[24];
5 7
6const char *read_host_led_state(void) 8const char *read_host_led_state(void)
7{ 9{
8 uint8_t leds = host_keyboard_leds();
9 snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s", 10 snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
10 (leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ", 11 (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) ? "on" : "- ",
11 (leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ", 12 (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) ? "on" : "- ",
12 (leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- "); 13 (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) ? "on" : "- ");
13 14
14 return host_led_state_str; 15 return host_led_state_str;
15} 16}
diff --git a/keyboards/lily58/lib/keylogger.c b/keyboards/lily58/lib/keylogger.c
index a1bd476d20..2fc3e663ec 100644
--- a/keyboards/lily58/lib/keylogger.c
+++ b/keyboards/lily58/lib/keylogger.c
@@ -1,4 +1,5 @@
1#include <stdio.h> 1#include <stdio.h>
2#include "action.h"
2#include "lily58.h" 3#include "lily58.h"
3 4
4char keylog_str[24] = {}; 5char keylog_str[24] = {};
diff --git a/keyboards/lily58/lib/layer_state_reader.c b/keyboards/lily58/lib/layer_state_reader.c
index 48674b0673..0e9dd7039b 100644
--- a/keyboards/lily58/lib/layer_state_reader.c
+++ b/keyboards/lily58/lib/layer_state_reader.c
@@ -4,10 +4,10 @@
4#include "lily58.h" 4#include "lily58.h"
5 5
6#define L_BASE 0 6#define L_BASE 0
7#define L_LOWER 2 7#define L_LOWER (1 << 1)
8#define L_RAISE 4 8#define L_RAISE (1 << 2)
9#define L_ADJUST 8 9#define L_ADJUST (1 << 3)
10#define L_ADJUST_TRI 14 10#define L_ADJUST_TRI (L_ADJUST | L_RAISE | L_LOWER)
11 11
12char layer_state_str[24]; 12char layer_state_str[24];
13 13
diff --git a/keyboards/lily58/lib/mode_icon_reader.c b/keyboards/lily58/lib/mode_icon_reader.c
index 2bce4a71b0..27c6d92cd0 100644
--- a/keyboards/lily58/lib/mode_icon_reader.c
+++ b/keyboards/lily58/lib/mode_icon_reader.c
@@ -1,4 +1,5 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdbool.h>
2#include "lily58.h" 3#include "lily58.h"
3 4
4char mode_icon[24]; 5char mode_icon[24];
diff --git a/keyboards/lily58/lib/timelogger.c b/keyboards/lily58/lib/timelogger.c
index bfbfbe8a21..b00c13cb0a 100644
--- a/keyboards/lily58/lib/timelogger.c
+++ b/keyboards/lily58/lib/timelogger.c
@@ -1,4 +1,5 @@
1#include <stdio.h> 1#include <stdio.h>
2#include "timer.h"
2#include "lily58.h" 3#include "lily58.h"
3 4
4char timelog_str[24] = {}; 5char timelog_str[24] = {};
diff --git a/keyboards/lily58/lily58.c b/keyboards/lily58/lily58.c
index eacd90a82d..03975057f4 100644
--- a/keyboards/lily58/lily58.c
+++ b/keyboards/lily58/lily58.c
@@ -1,10 +1,5 @@
1#include "lily58.h" 1#include "lily58.h"
2#include "ssd1306.h"
3 2
4bool process_record_kb(uint16_t keycode, keyrecord_t *record) { 3bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
5#ifdef SSD1306OLED
6 return process_record_gfx(keycode,record) && process_record_user(keycode, record);
7#else
8 return process_record_user(keycode, record); 4 return process_record_user(keycode, record);
9#endif 5}
10} \ No newline at end of file
diff --git a/keyboards/lily58/rev1/config.h b/keyboards/lily58/rev1/config.h
index 4e8e3a7c9c..adcf11b52b 100644
--- a/keyboards/lily58/rev1/config.h
+++ b/keyboards/lily58/rev1/config.h
@@ -36,8 +36,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
36#define MATRIX_ROW_PINS { C6, D7, E6, B4, B5 } 36#define MATRIX_ROW_PINS { C6, D7, E6, B4, B5 }
37#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } 37#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
38 38
39/* define tapping term */
40#define TAPPING_TERM 100
41 39
42/* define if matrix has ghost */ 40/* define if matrix has ghost */
43//#define MATRIX_HAS_GHOST 41//#define MATRIX_HAS_GHOST
diff --git a/keyboards/lily58/rev1/rules.mk b/keyboards/lily58/rev1/rules.mk
index 6028b5a5b9..e69de29bb2 100644
--- a/keyboards/lily58/rev1/rules.mk
+++ b/keyboards/lily58/rev1/rules.mk
@@ -1,3 +0,0 @@
1SRC += rev1/matrix.c
2SRC += rev1/split_util.c
3SRC += rev1/split_scomm.c
diff --git a/keyboards/lily58/rev1/split_scomm.c b/keyboards/lily58/rev1/split_scomm.c
deleted file mode 100755
index a1fe6ba5b8..0000000000
--- a/keyboards/lily58/rev1/split_scomm.c
+++ /dev/null
@@ -1,91 +0,0 @@
1#ifdef USE_SERIAL
2#ifdef SERIAL_USE_MULTI_TRANSACTION
3/* --- USE flexible API (using multi-type transaction function) --- */
4
5#include <stdbool.h>
6#include <stdint.h>
7#include <stddef.h>
8#include <split_scomm.h>
9#include "serial.h"
10#ifdef CONSOLE_ENABLE
11 #include <print.h>
12#endif
13
14uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
15uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
16uint8_t volatile status_com = 0;
17uint8_t volatile status1 = 0;
18uint8_t slave_buffer_change_count = 0;
19uint8_t s_change_old = 0xff;
20uint8_t s_change_new = 0xff;
21
22SSTD_t transactions[] = {
23#define GET_SLAVE_STATUS 0
24 /* master buffer not changed, only recive slave_buffer_change_count */
25 { (uint8_t *)&status_com,
26 0, NULL,
27 sizeof(slave_buffer_change_count), &slave_buffer_change_count,
28 },
29#define PUT_MASTER_GET_SLAVE_STATUS 1
30 /* master buffer changed need send, and recive slave_buffer_change_count */
31 { (uint8_t *)&status_com,
32 sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
33 sizeof(slave_buffer_change_count), &slave_buffer_change_count,
34 },
35#define GET_SLAVE_BUFFER 2
36 /* recive serial_slave_buffer */
37 { (uint8_t *)&status1,
38 0, NULL,
39 sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
40 }
41};
42
43void serial_master_init(void)
44{
45 soft_serial_initiator_init(transactions, TID_LIMIT(transactions));
46}
47
48void serial_slave_init(void)
49{
50 soft_serial_target_init(transactions, TID_LIMIT(transactions));
51}
52
53// 0 => no error
54// 1 => slave did not respond
55// 2 => checksum error
56int serial_update_buffers(int master_update)
57{
58 int status, smatstatus;
59 static int need_retry = 0;
60
61 if( s_change_old != s_change_new ) {
62 smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER);
63 if( smatstatus == TRANSACTION_END ) {
64 s_change_old = s_change_new;
65#ifdef CONSOLE_ENABLE
66 uprintf("slave matrix = %b %b %b %b\n",
67 serial_slave_buffer[0], serial_slave_buffer[1],
68 serial_slave_buffer[2], serial_slave_buffer[3]);
69#endif
70 }
71 } else {
72 // serial_slave_buffer dosen't change
73 smatstatus = TRANSACTION_END; // dummy status
74 }
75
76 if( !master_update && !need_retry) {
77 status = soft_serial_transaction(GET_SLAVE_STATUS);
78 } else {
79 status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS);
80 }
81 if( status == TRANSACTION_END ) {
82 s_change_new = slave_buffer_change_count;
83 need_retry = 0;
84 } else {
85 need_retry = 1;
86 }
87 return smatstatus;
88}
89
90#endif // SERIAL_USE_MULTI_TRANSACTION
91#endif /* USE_SERIAL */
diff --git a/keyboards/lily58/rev1/split_scomm.h b/keyboards/lily58/rev1/split_scomm.h
deleted file mode 100755
index 873d8939d8..0000000000
--- a/keyboards/lily58/rev1/split_scomm.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef SPLIT_COMM_H
2#define SPLIT_COMM_H
3
4#ifndef SERIAL_USE_MULTI_TRANSACTION
5/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */
6#include "serial.h"
7
8#else
9/* --- USE flexible API (using multi-type transaction function) --- */
10// Buffers for master - slave communication
11#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
12#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
13
14extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
15extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
16extern uint8_t slave_buffer_change_count;
17
18void serial_master_init(void);
19void serial_slave_init(void);
20int serial_update_buffers(int master_changed);
21
22#endif
23
24#endif /* SPLIT_COMM_H */
diff --git a/keyboards/lily58/rev1/split_util.h b/keyboards/lily58/rev1/split_util.h
deleted file mode 100755
index 687ca19bd3..0000000000
--- a/keyboards/lily58/rev1/split_util.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef SPLIT_KEYBOARD_UTIL_H
2#define SPLIT_KEYBOARD_UTIL_H
3
4#include <stdbool.h>
5#include "eeconfig.h"
6
7#define SLAVE_I2C_ADDRESS 0x32
8
9extern volatile bool isLeftHand;
10
11// slave version of matix scan, defined in matrix.c
12void matrix_slave_scan(void);
13
14void split_keyboard_setup(void);
15bool has_usb(void);
16
17void matrix_master_OLED_init (void);
18
19#endif
diff --git a/keyboards/lily58/rules.mk b/keyboards/lily58/rules.mk
index d413510bac..34b512d59a 100644
--- a/keyboards/lily58/rules.mk
+++ b/keyboards/lily58/rules.mk
@@ -29,19 +29,7 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. 29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
30# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 30# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
31SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 31SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
32 32OLED_DRIVER_ENABLE = yes # OLED display
33CUSTOM_MATRIX = yes 33SPLIT_KEYBOARD = yes
34
35SRC += i2c.c
36SRC += serial.c
37SRC += ssd1306.c
38
39# A workaround until #7089 is merged.
40# serial.c must not be compiled with the -lto option.
41# The current LIB_SRC has a side effect with the -fno-lto option, so use it.
42LIB_SRC += serial.c
43
44# if firmware size over limit, try this option
45# CFLAGS += -flto
46 34
47DEFAULT_FOLDER = lily58/rev1 35DEFAULT_FOLDER = lily58/rev1
diff --git a/keyboards/lily58/serial.h b/keyboards/lily58/serial.h
deleted file mode 100755
index 7e0c0847a4..0000000000
--- a/keyboards/lily58/serial.h
+++ /dev/null
@@ -1,84 +0,0 @@
1#ifndef SOFT_SERIAL_H
2#define SOFT_SERIAL_H
3
4#include <stdbool.h>
5
6// /////////////////////////////////////////////////////////////////
7// Need Soft Serial defines in config.h
8// /////////////////////////////////////////////////////////////////
9// ex.
10// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
11// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5
12// // 1: about 137kbps (default)
13// // 2: about 75kbps
14// // 3: about 39kbps
15// // 4: about 26kbps
16// // 5: about 20kbps
17//
18// //// USE Simple API (OLD API, compatible with let's split serial.c)
19// ex.
20// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
21// #define SERIAL_MASTER_BUFFER_LENGTH 1
22//
23// //// USE flexible API (using multi-type transaction function)
24// #define SERIAL_USE_MULTI_TRANSACTION
25//
26// /////////////////////////////////////////////////////////////////
27
28
29#ifndef SERIAL_USE_MULTI_TRANSACTION
30/* --- USE Simple API (OLD API, compatible with let's split serial.c) */
31#if SERIAL_SLAVE_BUFFER_LENGTH > 0
32extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
33#endif
34#if SERIAL_MASTER_BUFFER_LENGTH > 0
35extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
36#endif
37
38void serial_master_init(void);
39void serial_slave_init(void);
40int serial_update_buffers(void);
41
42#endif // USE Simple API
43
44// Soft Serial Transaction Descriptor
45typedef struct _SSTD_t {
46 uint8_t *status;
47 uint8_t initiator2target_buffer_size;
48 uint8_t *initiator2target_buffer;
49 uint8_t target2initiator_buffer_size;
50 uint8_t *target2initiator_buffer;
51} SSTD_t;
52#define TID_LIMIT( table ) (sizeof(table) / sizeof(SSTD_t))
53
54// initiator is transaction start side
55void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size);
56// target is interrupt accept side
57void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size);
58
59// initiator resullt
60#define TRANSACTION_END 0
61#define TRANSACTION_NO_RESPONSE 0x1
62#define TRANSACTION_DATA_ERROR 0x2
63#define TRANSACTION_TYPE_ERROR 0x4
64#ifndef SERIAL_USE_MULTI_TRANSACTION
65int soft_serial_transaction(void);
66#else
67int soft_serial_transaction(int sstd_index);
68#endif
69
70// target status
71// *SSTD_t.status has
72// initiator:
73// TRANSACTION_END
74// or TRANSACTION_NO_RESPONSE
75// or TRANSACTION_DATA_ERROR
76// target:
77// TRANSACTION_DATA_ERROR
78// or TRANSACTION_ACCEPTED
79#define TRANSACTION_ACCEPTED 0x8
80#ifdef SERIAL_USE_MULTI_TRANSACTION
81int soft_serial_get_and_clean_status(int sstd_index);
82#endif
83
84#endif /* SOFT_SERIAL_H */
diff --git a/keyboards/lily58/serial_config.h b/keyboards/lily58/serial_config.h
deleted file mode 100644
index 4fab8e8ddf..0000000000
--- a/keyboards/lily58/serial_config.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef SOFT_SERIAL_PIN
2#define SOFT_SERIAL_PIN D2
3#define SERIAL_USE_MULTI_TRANSACTION
4#endif
diff --git a/keyboards/lily58/ssd1306.c b/keyboards/lily58/ssd1306.c
deleted file mode 100755
index 20c2738db7..0000000000
--- a/keyboards/lily58/ssd1306.c
+++ /dev/null
@@ -1,344 +0,0 @@
1#ifdef SSD1306OLED
2
3#include "ssd1306.h"
4#include "i2c.h"
5#include <string.h>
6#include "print.h"
7#ifdef ADAFRUIT_BLE_ENABLE
8#include "adafruit_ble.h"
9#endif
10#ifdef PROTOCOL_LUFA
11#include "lufa.h"
12#endif
13#include "sendchar.h"
14#include "timer.h"
15
16extern const unsigned char font[] PROGMEM;
17
18// Set this to 1 to help diagnose early startup problems
19// when testing power-on with ble. Turn it off otherwise,
20// as the latency of printing most of the debug info messes
21// with the matrix scan, causing keys to drop.
22#define DEBUG_TO_SCREEN 0
23
24//static uint16_t last_battery_update;
25//static uint32_t vbat;
26//#define BatteryUpdateInterval 10000 /* milliseconds */
27
28// 'last_flush' is declared as uint16_t,
29// so this must be less than 65535
30#define ScreenOffInterval 60000 /* milliseconds */
31#if DEBUG_TO_SCREEN
32static uint8_t displaying;
33#endif
34static uint16_t last_flush;
35
36static bool force_dirty = true;
37
38// Write command sequence.
39// Returns true on success.
40static inline bool _send_cmd1(uint8_t cmd) {
41 bool res = false;
42
43 if (i2c_start_write(SSD1306_ADDRESS)) {
44 xprintf("failed to start write to %d\n", SSD1306_ADDRESS);
45 goto done;
46 }
47
48 if (i2c_master_write(0x0 /* command byte follows */)) {
49 print("failed to write control byte\n");
50
51 goto done;
52 }
53
54 if (i2c_master_write(cmd)) {
55 xprintf("failed to write command %d\n", cmd);
56 goto done;
57 }
58 res = true;
59done:
60 i2c_master_stop();
61 return res;
62}
63
64// Write 2-byte command sequence.
65// Returns true on success
66static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) {
67 if (!_send_cmd1(cmd)) {
68 return false;
69 }
70 return _send_cmd1(opr);
71}
72
73// Write 3-byte command sequence.
74// Returns true on success
75static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) {
76 if (!_send_cmd1(cmd)) {
77 return false;
78 }
79 if (!_send_cmd1(opr1)) {
80 return false;
81 }
82 return _send_cmd1(opr2);
83}
84
85#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;}
86#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;}
87#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;}
88
89static void clear_display(void) {
90 matrix_clear(&display);
91
92 // Clear all of the display bits (there can be random noise
93 // in the RAM on startup)
94 send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1);
95 send_cmd3(ColumnAddr, 0, DisplayWidth - 1);
96
97 if (i2c_start_write(SSD1306_ADDRESS)) {
98 goto done;
99 }
100 if (i2c_master_write(0x40)) {
101 // Data mode
102 goto done;
103 }
104 for (uint8_t row = 0; row < MatrixRows; ++row) {
105 for (uint8_t col = 0; col < DisplayWidth; ++col) {
106 i2c_master_write(0);
107 }
108 }
109
110 display.dirty = false;
111
112done:
113 i2c_master_stop();
114}
115
116#if DEBUG_TO_SCREEN
117#undef sendchar
118static int8_t capture_sendchar(uint8_t c) {
119 sendchar(c);
120 iota_gfx_write_char(c);
121
122 if (!displaying) {
123 iota_gfx_flush();
124 }
125 return 0;
126}
127#endif
128
129bool iota_gfx_init(bool rotate) {
130 bool success = false;
131
132 i2c_master_init();
133 send_cmd1(DisplayOff);
134 send_cmd2(SetDisplayClockDiv, 0x80);
135 send_cmd2(SetMultiPlex, DisplayHeight - 1);
136
137 send_cmd2(SetDisplayOffset, 0);
138
139
140 send_cmd1(SetStartLine | 0x0);
141 send_cmd2(SetChargePump, 0x14 /* Enable */);
142 send_cmd2(SetMemoryMode, 0 /* horizontal addressing */);
143
144 if(rotate){
145 // the following Flip the display orientation 180 degrees
146 send_cmd1(SegRemap);
147 send_cmd1(ComScanInc);
148 }else{
149 // Flips the display orientation 0 degrees
150 send_cmd1(SegRemap | 0x1);
151 send_cmd1(ComScanDec);
152 }
153
154 send_cmd2(SetComPins, 0x2);
155 send_cmd2(SetContrast, 0x8f);
156 send_cmd2(SetPreCharge, 0xf1);
157 send_cmd2(SetVComDetect, 0x40);
158 send_cmd1(DisplayAllOnResume);
159 send_cmd1(NormalDisplay);
160 send_cmd1(DeActivateScroll);
161 send_cmd1(DisplayOn);
162
163 send_cmd2(SetContrast, 0); // Dim
164
165 clear_display();
166
167 success = true;
168
169 iota_gfx_flush();
170
171#if DEBUG_TO_SCREEN
172 print_set_sendchar(capture_sendchar);
173#endif
174
175done:
176 return success;
177}
178
179bool iota_gfx_off(void) {
180 bool success = false;
181
182 send_cmd1(DisplayOff);
183 success = true;
184
185done:
186 return success;
187}
188
189bool iota_gfx_on(void) {
190 bool success = false;
191
192 send_cmd1(DisplayOn);
193 success = true;
194
195done:
196 return success;
197}
198
199void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
200 *matrix->cursor = c;
201 ++matrix->cursor;
202
203 if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) {
204 // We went off the end; scroll the display upwards by one line
205 memmove(&matrix->display[0], &matrix->display[1],
206 MatrixCols * (MatrixRows - 1));
207 matrix->cursor = &matrix->display[MatrixRows - 1][0];
208 memset(matrix->cursor, ' ', MatrixCols);
209 }
210}
211
212void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
213 matrix->dirty = true;
214
215 if (c == '\n') {
216 // Clear to end of line from the cursor and then move to the
217 // start of the next line
218 uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols;
219
220 while (cursor_col++ < MatrixCols) {
221 matrix_write_char_inner(matrix, ' ');
222 }
223 return;
224 }
225
226 matrix_write_char_inner(matrix, c);
227}
228
229void iota_gfx_write_char(uint8_t c) {
230 matrix_write_char(&display, c);
231}
232
233void matrix_write(struct CharacterMatrix *matrix, const char *data) {
234 const char *end = data + strlen(data);
235 while (data < end) {
236 matrix_write_char(matrix, *data);
237 ++data;
238 }
239}
240
241void matrix_write_ln(struct CharacterMatrix *matrix, const char *data) {
242 char data_ln[strlen(data)+2];
243 snprintf(data_ln, sizeof(data_ln), "%s\n", data);
244 matrix_write(matrix, data_ln);
245}
246
247void iota_gfx_write(const char *data) {
248 matrix_write(&display, data);
249}
250
251void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
252 while (true) {
253 uint8_t c = pgm_read_byte(data);
254 if (c == 0) {
255 return;
256 }
257 matrix_write_char(matrix, c);
258 ++data;
259 }
260}
261
262void iota_gfx_write_P(const char *data) {
263 matrix_write_P(&display, data);
264}
265
266void matrix_clear(struct CharacterMatrix *matrix) {
267 memset(matrix->display, ' ', sizeof(matrix->display));
268 matrix->cursor = &matrix->display[0][0];
269 matrix->dirty = true;
270}
271
272void iota_gfx_clear_screen(void) {
273 matrix_clear(&display);
274}
275
276void matrix_render(struct CharacterMatrix *matrix) {
277 last_flush = timer_read();
278 iota_gfx_on();
279#if DEBUG_TO_SCREEN
280 ++displaying;
281#endif
282
283 // Move to the home position
284 send_cmd3(PageAddr, 0, MatrixRows - 1);
285 send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1);
286
287 if (i2c_start_write(SSD1306_ADDRESS)) {
288 goto done;
289 }
290 if (i2c_master_write(0x40)) {
291 // Data mode
292 goto done;
293 }
294
295 for (uint8_t row = 0; row < MatrixRows; ++row) {
296 for (uint8_t col = 0; col < MatrixCols; ++col) {
297 const uint8_t *glyph = font + (matrix->display[row][col] * FontWidth);
298
299 for (uint8_t glyphCol = 0; glyphCol < FontWidth; ++glyphCol) {
300 uint8_t colBits = pgm_read_byte(glyph + glyphCol);
301 i2c_master_write(colBits);
302 }
303
304 // 1 column of space between chars (it's not included in the glyph)
305 //i2c_master_write(0);
306 }
307 }
308
309 matrix->dirty = false;
310
311done:
312 i2c_master_stop();
313#if DEBUG_TO_SCREEN
314 --displaying;
315#endif
316}
317
318void iota_gfx_flush(void) {
319 matrix_render(&display);
320}
321
322__attribute__ ((weak))
323void iota_gfx_task_user(void) {
324}
325
326void iota_gfx_task(void) {
327 iota_gfx_task_user();
328
329 if (display.dirty|| force_dirty) {
330 iota_gfx_flush();
331 force_dirty = false;
332 }
333
334 if (timer_elapsed(last_flush) > ScreenOffInterval) {
335 iota_gfx_off();
336 }
337}
338
339bool process_record_gfx(uint16_t keycode, keyrecord_t *record) {
340 force_dirty = true;
341 return true;
342}
343
344#endif
diff --git a/keyboards/lily58/ssd1306.h b/keyboards/lily58/ssd1306.h
deleted file mode 100755
index 0ca093093a..0000000000
--- a/keyboards/lily58/ssd1306.h
+++ /dev/null
@@ -1,90 +0,0 @@
1#pragma once
2
3#include <stdbool.h>
4#include <stdio.h>
5#include "action.h"
6
7enum ssd1306_cmds {
8 DisplayOff = 0xAE,
9 DisplayOn = 0xAF,
10
11 SetContrast = 0x81,
12 DisplayAllOnResume = 0xA4,
13
14 DisplayAllOn = 0xA5,
15 NormalDisplay = 0xA6,
16 InvertDisplay = 0xA7,
17 SetDisplayOffset = 0xD3,
18 SetComPins = 0xda,
19 SetVComDetect = 0xdb,
20 SetDisplayClockDiv = 0xD5,
21 SetPreCharge = 0xd9,
22 SetMultiPlex = 0xa8,
23 SetLowColumn = 0x00,
24 SetHighColumn = 0x10,
25 SetStartLine = 0x40,
26
27 SetMemoryMode = 0x20,
28 ColumnAddr = 0x21,
29 PageAddr = 0x22,
30
31 ComScanInc = 0xc0,
32 ComScanDec = 0xc8,
33 SegRemap = 0xa0,
34 SetChargePump = 0x8d,
35 ExternalVcc = 0x01,
36 SwitchCapVcc = 0x02,
37
38 ActivateScroll = 0x2f,
39 DeActivateScroll = 0x2e,
40 SetVerticalScrollArea = 0xa3,
41 RightHorizontalScroll = 0x26,
42 LeftHorizontalScroll = 0x27,
43 VerticalAndRightHorizontalScroll = 0x29,
44 VerticalAndLeftHorizontalScroll = 0x2a,
45};
46
47// Controls the SSD1306 128x32 OLED display via i2c
48
49#ifndef SSD1306_ADDRESS
50#define SSD1306_ADDRESS 0x3C
51#endif
52
53#define DisplayHeight 32
54#define DisplayWidth 128
55
56#define FontHeight 8
57#define FontWidth 6
58
59#define MatrixRows (DisplayHeight / FontHeight)
60#define MatrixCols (DisplayWidth / FontWidth)
61
62struct CharacterMatrix {
63 uint8_t display[MatrixRows][MatrixCols];
64 uint8_t *cursor;
65 bool dirty;
66};
67
68struct CharacterMatrix display;
69
70bool iota_gfx_init(bool rotate);
71void iota_gfx_task(void);
72bool iota_gfx_off(void);
73bool iota_gfx_on(void);
74void iota_gfx_flush(void);
75void iota_gfx_write_char(uint8_t c);
76void iota_gfx_write(const char *data);
77void iota_gfx_write_P(const char *data);
78void iota_gfx_clear_screen(void);
79
80void iota_gfx_task_user(void);
81
82void matrix_clear(struct CharacterMatrix *matrix);
83void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c);
84void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c);
85void matrix_write(struct CharacterMatrix *matrix, const char *data);
86void matrix_write_ln(struct CharacterMatrix *matrix, const char *data);
87void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
88void matrix_render(struct CharacterMatrix *matrix);
89
90bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
diff --git a/keyboards/meira/keymaps/default/keymap.c b/keyboards/meira/keymaps/default/keymap.c
index 9bcd771c42..5c80df0f06 100644
--- a/keyboards/meira/keymaps/default/keymap.c
+++ b/keyboards/meira/keymaps/default/keymap.c
@@ -187,7 +187,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
187 case QWERTY: 187 case QWERTY:
188 if (record->event.pressed) { 188 if (record->event.pressed) {
189 #ifdef AUDIO_ENABLE 189 #ifdef AUDIO_ENABLE
190 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 190 PLAY_SONG(tone_qwerty);
191 #endif 191 #endif
192// persistent_default_layer_set(1UL<<_QWERTY); 192// persistent_default_layer_set(1UL<<_QWERTY);
193 } 193 }
@@ -196,7 +196,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
196 case COLEMAK: 196 case COLEMAK:
197 if (record->event.pressed) { 197 if (record->event.pressed) {
198 #ifdef AUDIO_ENABLE 198 #ifdef AUDIO_ENABLE
199 PLAY_NOTE_ARRAY(tone_colemak, false, 0); 199 PLAY_SONG(tone_colemak);
200 #endif 200 #endif
201// persistent_default_layer_set(1UL<<_COLEMAK); 201// persistent_default_layer_set(1UL<<_COLEMAK);
202 } 202 }
@@ -205,7 +205,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
205 case DVORAK: 205 case DVORAK:
206 if (record->event.pressed) { 206 if (record->event.pressed) {
207 #ifdef AUDIO_ENABLE 207 #ifdef AUDIO_ENABLE
208 PLAY_NOTE_ARRAY(tone_dvorak, false, 0); 208 PLAY_SONG(tone_dvorak);
209 #endif 209 #endif
210// persistent_default_layer_set(1UL<<_DVORAK); 210// persistent_default_layer_set(1UL<<_DVORAK);
211 } 211 }
diff --git a/keyboards/meira/keymaps/grahampheath/keymap.c b/keyboards/meira/keymaps/grahampheath/keymap.c
index cd02137877..ace172a2a4 100644
--- a/keyboards/meira/keymaps/grahampheath/keymap.c
+++ b/keyboards/meira/keymaps/grahampheath/keymap.c
@@ -243,7 +243,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
243 case QWERTY: 243 case QWERTY:
244 if (record->event.pressed) { 244 if (record->event.pressed) {
245 #ifdef AUDIO_ENABLE 245 #ifdef AUDIO_ENABLE
246 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 246 PLAY_SONG(tone_qwerty);
247 #endif 247 #endif
248 } 248 }
249 return false; 249 return false;
@@ -251,7 +251,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
251 case COLEMAK: 251 case COLEMAK:
252 if (record->event.pressed) { 252 if (record->event.pressed) {
253 #ifdef AUDIO_ENABLE 253 #ifdef AUDIO_ENABLE
254 PLAY_NOTE_ARRAY(tone_colemak, false, 0); 254 PLAY_SONG(tone_colemak);
255 #endif 255 #endif
256 } 256 }
257 return false; 257 return false;
@@ -259,7 +259,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
259 case DVORAK: 259 case DVORAK:
260 if (record->event.pressed) { 260 if (record->event.pressed) {
261 #ifdef AUDIO_ENABLE 261 #ifdef AUDIO_ENABLE
262 PLAY_NOTE_ARRAY(tone_dvorak, false, 0); 262 PLAY_SONG(tone_dvorak);
263 #endif 263 #endif
264 } 264 }
265 return false; 265 return false;
diff --git a/keyboards/meira/keymaps/takmiya/keymap.c b/keyboards/meira/keymaps/takmiya/keymap.c
index 12dad6d690..bf693d8ad2 100644
--- a/keyboards/meira/keymaps/takmiya/keymap.c
+++ b/keyboards/meira/keymaps/takmiya/keymap.c
@@ -153,7 +153,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
153 case QWERTY: 153 case QWERTY:
154 if (record->event.pressed) { 154 if (record->event.pressed) {
155 #ifdef AUDIO_ENABLE 155 #ifdef AUDIO_ENABLE
156 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 156 PLAY_SONG(tone_qwerty);
157 #endif 157 #endif
158// persistent_default_layer_set(1UL<<_QWERTY); 158// persistent_default_layer_set(1UL<<_QWERTY);
159 } 159 }
diff --git a/keyboards/meishi/keymaps/default/keymap.c b/keyboards/meishi/keymaps/default/keymap.c
index 528beb168b..ea6e42a961 100644
--- a/keyboards/meishi/keymaps/default/keymap.c
+++ b/keyboards/meishi/keymaps/default/keymap.c
@@ -21,10 +21,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
21), 21),
22}; 22};
23 23
24const uint16_t PROGMEM fn_actions[] = {
25
26};
27
28void matrix_init_user(void) { 24void matrix_init_user(void) {
29 25
30} 26}
diff --git a/keyboards/navi10/rev3/rules.mk b/keyboards/navi10/rev3/rules.mk
index b98e7eb2d6..d5a072f161 100644
--- a/keyboards/navi10/rev3/rules.mk
+++ b/keyboards/navi10/rev3/rules.mk
@@ -28,6 +28,6 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
28MIDI_ENABLE = no # MIDI support 28MIDI_ENABLE = no # MIDI support
29UNICODE_ENABLE = no # Unicode 29UNICODE_ENABLE = no # Unicode
30BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 30BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
31AUDIO_ENABLE = yes # Audio output on port C6 31AUDIO_ENABLE = no # Audio output
32FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 32FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
33HD44780_ENABLE = no # Enable support for HD44780 based LCDs 33HD44780_ENABLE = no # Enable support for HD44780 based LCDs
diff --git a/keyboards/nomu30/keymaps/center_sprit/keymap.c b/keyboards/nomu30/keymaps/center_sprit/keymap.c
index 8ef037f42b..cc540b891f 100644
--- a/keyboards/nomu30/keymaps/center_sprit/keymap.c
+++ b/keyboards/nomu30/keymaps/center_sprit/keymap.c
@@ -100,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
100 ) 100 )
101}; 101};
102 102
103uint16_t get_tapping_term(uint16_t keycode) { 103uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
104 switch (keycode) { 104 switch (keycode) {
105 case KC_BSLO: 105 case KC_BSLO:
106 return TAPPING_LAYER_TERM; 106 return TAPPING_LAYER_TERM;
diff --git a/keyboards/nomu30/keymaps/like_jis/keymap.c b/keyboards/nomu30/keymaps/like_jis/keymap.c
index 203d0a7a41..fc2d26ad7a 100644
--- a/keyboards/nomu30/keymaps/like_jis/keymap.c
+++ b/keyboards/nomu30/keymaps/like_jis/keymap.c
@@ -100,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
100 ) 100 )
101}; 101};
102 102
103uint16_t get_tapping_term(uint16_t keycode) { 103uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
104 switch (keycode) { 104 switch (keycode) {
105 case KC_BSLO: 105 case KC_BSLO:
106 return TAPPING_LAYER_TERM; 106 return TAPPING_LAYER_TERM;
diff --git a/keyboards/omnikey_blackheart/config.h b/keyboards/omnikey_bh/config.h
index 6c9be77b6b..6c9be77b6b 100644
--- a/keyboards/omnikey_blackheart/config.h
+++ b/keyboards/omnikey_bh/config.h
diff --git a/keyboards/omnikey_blackheart/info.json b/keyboards/omnikey_bh/info.json
index 138c954b77..50d64e143c 100644
--- a/keyboards/omnikey_blackheart/info.json
+++ b/keyboards/omnikey_bh/info.json
@@ -1,5 +1,5 @@
1{ 1{
2 "keyboard_name": "Omnikey Blackheart PCB", 2 "keyboard_name": "Omnikey BH PCB",
3 "url": "", 3 "url": "",
4 "maintainer": "qmk", 4 "maintainer": "qmk",
5 "width": 25.5, 5 "width": 25.5,
diff --git a/keyboards/omnikey_blackheart/keymaps/default/keymap.c b/keyboards/omnikey_bh/keymaps/default/keymap.c
index e4865adde3..e4865adde3 100644
--- a/keyboards/omnikey_blackheart/keymaps/default/keymap.c
+++ b/keyboards/omnikey_bh/keymaps/default/keymap.c
diff --git a/keyboards/omnikey_bh/omnikey_bh.c b/keyboards/omnikey_bh/omnikey_bh.c
new file mode 100644
index 0000000000..c2f52f30c3
--- /dev/null
+++ b/keyboards/omnikey_bh/omnikey_bh.c
@@ -0,0 +1 @@
#include "omnikey_bh.h"
diff --git a/keyboards/omnikey_blackheart/omnikey_blackheart.h b/keyboards/omnikey_bh/omnikey_bh.h
index 5d2d948c49..f36184f390 100644
--- a/keyboards/omnikey_blackheart/omnikey_blackheart.h
+++ b/keyboards/omnikey_bh/omnikey_bh.h
@@ -1,5 +1,4 @@
1#ifndef omnikey_blackheart 1#pragma once
2#define omnikey_blackheart
3 2
4#include "quantum.h" 3#include "quantum.h"
5 4
@@ -18,5 +17,3 @@
18 { K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414, K415, K416, K417, K418, K419, K420, K421, KC_NO }, \ 17 { K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414, K415, K416, K417, K418, K419, K420, K421, KC_NO }, \
19 { K500, K501, K502, K503, K504, KC_NO, KC_NO, K507, KC_NO, KC_NO, KC_NO, KC_NO, K512, K513, K514, K515, K516, K517, K518, K519, K520, KC_NO, KC_NO } \ 18 { K500, K501, K502, K503, K504, KC_NO, KC_NO, K507, KC_NO, KC_NO, KC_NO, KC_NO, K512, K513, K514, K515, K516, K517, K518, K519, K520, KC_NO, KC_NO } \
20} 19}
21
22#endif \ No newline at end of file
diff --git a/keyboards/omnikey_blackheart/readme.md b/keyboards/omnikey_bh/readme.md
index 04bb49818c..7de22f29a4 100644
--- a/keyboards/omnikey_blackheart/readme.md
+++ b/keyboards/omnikey_bh/readme.md
@@ -1,14 +1,14 @@
1Omnikey Blackheart PCB 1Omnikey BH PCB
2=== 2===
3 3
4A replacement PCB for Omnikey keyboards. Supports 101, 102, Plus, Ultra T, Ultra, Prime and Stellar, as well as customs. 4A replacement PCB for Omnikey keyboards. Supports 101, 102, Plus, Ultra T, Ultra, Prime and Stellar, as well as customs.
5 5
6Keyboard Maintainer: QMK Community and blindassassin111 6Keyboard Maintainer: QMK Community and blindassassin111
7Hardware Supported: Omnikey blackheart PCB 7Hardware Supported: Omnikey BH PCB
8Hardware Availability: https://deskthority.net/group-buys-f50/omnikey-replacement-pcb-t18276.html 8Hardware Availability: https://deskthority.net/group-buys-f50/omnikey-replacement-pcb-t18276.html
9 9
10Make example for this keyboard (after setting up your build environment): 10Make example for this keyboard (after setting up your build environment):
11 11
12 make omnikey_blackheart:default 12 make omnikey_bh:default
13 13
14See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. 14See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/omnikey_blackheart/rules.mk b/keyboards/omnikey_bh/rules.mk
index 59f163e2f4..59f163e2f4 100644
--- a/keyboards/omnikey_blackheart/rules.mk
+++ b/keyboards/omnikey_bh/rules.mk
diff --git a/keyboards/omnikey_blackheart/omnikey_blackheart.c b/keyboards/omnikey_blackheart/omnikey_blackheart.c
deleted file mode 100644
index e54047fa68..0000000000
--- a/keyboards/omnikey_blackheart/omnikey_blackheart.c
+++ /dev/null
@@ -1 +0,0 @@
1#include "omnikey_blackheart.h"
diff --git a/keyboards/pancake/feather/readme.md b/keyboards/pancake/feather/readme.md
deleted file mode 100644
index 8b13789179..0000000000
--- a/keyboards/pancake/feather/readme.md
+++ /dev/null
@@ -1 +0,0 @@
1
diff --git a/keyboards/pancake/keymaps/default/readme.md b/keyboards/pancake/keymaps/default/readme.md
deleted file mode 100644
index 8b13789179..0000000000
--- a/keyboards/pancake/keymaps/default/readme.md
+++ /dev/null
@@ -1 +0,0 @@
1
diff --git a/keyboards/pancake/promicro/readme.md b/keyboards/pancake/promicro/readme.md
deleted file mode 100644
index 8b13789179..0000000000
--- a/keyboards/pancake/promicro/readme.md
+++ /dev/null
@@ -1 +0,0 @@
1
diff --git a/keyboards/planck/keymaps/ab/keymap.c b/keyboards/planck/keymaps/ab/keymap.c
index c028e7949f..8835bfc87d 100644
--- a/keyboards/planck/keymaps/ab/keymap.c
+++ b/keyboards/planck/keymaps/ab/keymap.c
@@ -26,22 +26,12 @@ extern keymap_config_t keymap_config;
26// Func macro definitions. 26// Func macro definitions.
27#define LWR_PGDN LT(_LOWER, KC_PGDN) // Tap for PgDn, hold for LOWER 27#define LWR_PGDN LT(_LOWER, KC_PGDN) // Tap for PgDn, hold for LOWER
28#define RSE_PGUP LT(_RAISE, KC_PGUP) // Tap for PgUp, hold for RAISE 28#define RSE_PGUP LT(_RAISE, KC_PGUP) // Tap for PgUp, hold for RAISE
29#define CTL_CAPS FUNC(2) // Tap for Caps, hold for Ctrl (DOESN'T SEEM TO WORK) 29#define CTL_CAPS MT(MOD_LCTL, KC_CAPS) // Tap for Caps, hold for Ctrl (DOESN'T SEEM TO WORK)
30#define SFT_ENT FUNC(3) // Tap for Enter, hold for Shift 30#define SFT_ENT MT(MOD_RSFT, KC_ENT) // Tap for Enter, hold for Shift
31#define ZM_NRM FUNC(4) // Zoom normal 31#define ZM_NRM C(KC_0) // Zoom normal
32#define ZM_IN FUNC(5) // Zoom out 32#define ZM_IN C(KC_MINS) // Zoom out
33#define ZM_OUT FUNC(6) // Zoom in 33#define ZM_OUT C(KC_PLUS) // Zoom in
34#define EM_UNDO FUNC(7) // Emacs Undo 34#define EM_UNDO C(KC_UNDS) // Emacs Undo
35
36// Enable these functions using FUNC(n) macro.
37const uint16_t PROGMEM fn_actions[] = {
38 [2] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_CAPS),
39 [3] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT),
40 [4] = ACTION_MODS_KEY(MOD_LCTL, KC_0),
41 [5] = ACTION_MODS_KEY(MOD_LCTL, KC_MINS),
42 [6] = ACTION_MODS_KEY(MOD_LCTL, KC_PLUS),
43 [7] = ACTION_MODS_KEY(MOD_LCTL, KC_UNDS),
44 };
45 35
46// This config can be found at Keyboard layout editor site: http://goo.gl/zjXL2l 36// This config can be found at Keyboard layout editor site: http://goo.gl/zjXL2l
47const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 37const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
diff --git a/keyboards/planck/keymaps/angerthosenear/keymap.c b/keyboards/planck/keymaps/angerthosenear/keymap.c
index 6a497641e6..6e9c69333e 100644
--- a/keyboards/planck/keymaps/angerthosenear/keymap.c
+++ b/keyboards/planck/keymaps/angerthosenear/keymap.c
@@ -16,21 +16,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
16), 16),
17[2] = LAYOUT_planck_grid( /* RAISE */ 17[2] = LAYOUT_planck_grid( /* RAISE */
18 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS, 18 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
19 KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, 19 KC_TRNS, DF(0), DF(1), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
20 KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS, 20 KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS,
21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY 21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
22), 22),
23[3] = LAYOUT_planck_grid( /* LOWER */ 23[3] = LAYOUT_planck_grid( /* LOWER */
24 S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_DEL, 24 S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_DEL,
25 KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS), 25 KC_TRNS, DF(0), DF(1), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS),
26 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, 26 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS,
27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END 27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END
28) 28)
29}; 29};
30
31
32const uint16_t PROGMEM fn_actions[] = {
33 [3] = ACTION_DEFAULT_LAYER_SET(0),
34 [4] = ACTION_DEFAULT_LAYER_SET(1),
35
36};
diff --git a/keyboards/planck/keymaps/austin/keymap.c b/keyboards/planck/keymaps/austin/keymap.c
index 16bca79510..3461ca9551 100644
--- a/keyboards/planck/keymaps/austin/keymap.c
+++ b/keyboards/planck/keymaps/austin/keymap.c
@@ -12,25 +12,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
12 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, 12 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
13 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, 13 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
14 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, 14 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
15 KC_FN3, KC_LGUI, KC_LALT, KC_LCTL, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT 15 DF(0), KC_LGUI, KC_LALT, KC_LCTL, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
16), 16),
17[2] = LAYOUT_planck_grid( /* RAISE */ 17[2] = LAYOUT_planck_grid( /* RAISE */
18 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, 18 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
19 KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, 19 KC_TRNS, DF(0), DF(1), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
20 KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS, 20 KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS,
21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY 21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
22), 22),
23[3] = LAYOUT_planck_grid( /* LOWER */ 23[3] = LAYOUT_planck_grid( /* LOWER */
24 S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC, 24 S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC,
25 KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS), 25 KC_TRNS, DF(0), DF(1), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS),
26 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, 26 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS,
27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY 27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
28) 28)
29}; 29};
30
31
32const uint16_t PROGMEM fn_actions[] = {
33 [3] = ACTION_DEFAULT_LAYER_SET(0),
34 [4] = ACTION_DEFAULT_LAYER_SET(1),
35
36};
diff --git a/keyboards/planck/keymaps/brandon/keymap.c b/keyboards/planck/keymaps/brandon/keymap.c
index ade4ea30f0..66533e53a2 100644
--- a/keyboards/planck/keymaps/brandon/keymap.c
+++ b/keyboards/planck/keymaps/brandon/keymap.c
@@ -86,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
86 */ 86 */
87 [BASE_QWERTY_LAYER] = LAYOUT_planck_grid( 87 [BASE_QWERTY_LAYER] = LAYOUT_planck_grid(
88 TD(TD_ESC_GRV), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, 88 TD(TD_ESC_GRV), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT,
89 F(5), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT_NAVS, F(6), 89 MT(MOD_LCTL, KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT_NAVS, MT(MOD_RCTL, KC_ENT),
90 KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, 90 KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC,
91 LT_GUIL, ALL_T(KC_RBRC), M(LALT_BRACE), KC_LGUI, LOWER, KC_SPC, KC_BSPC, RAISE, KC_RGUI, M(RALT_BRACE), ALL_T(KC_LBRC), LT_GUIR 91 LT_GUIL, ALL_T(KC_RBRC), M(LALT_BRACE), KC_LGUI, LOWER, KC_SPC, KC_BSPC, RAISE, KC_RGUI, M(RALT_BRACE), ALL_T(KC_LBRC), LT_GUIR
92 ), 92 ),
@@ -140,7 +140,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
140 */ 140 */
141 [LOWER_LAYER] = LAYOUT_planck_grid( 141 [LOWER_LAYER] = LAYOUT_planck_grid(
142 LGUI(KC_GRV), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, S(KC_3), 142 LGUI(KC_GRV), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, S(KC_3),
143 F(5), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, F(6), 143 MT(MOD_LCTL, KC_TAB), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, MT(MOD_RCTL, KC_ENT),
144 KC_LSPO, KC_MINS, KC_EQL, KC_GRV, KC_BSLS, ___x___, KC_NDSH, KC_MDSH, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, 144 KC_LSPO, KC_MINS, KC_EQL, KC_GRV, KC_BSLS, ___x___, KC_NDSH, KC_MDSH, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC,
145 LT_GUIL, ALL_T(KC_LBRC), M(LALT_BRACE), KC_LGUI, LOWER, KC_BSPC, KC_BSPC, RAISE, KC_RGUI, M(RALT_BRACE), ALL_T(KC_RBRC), LT_GUIR 145 LT_GUIL, ALL_T(KC_LBRC), M(LALT_BRACE), KC_LGUI, LOWER, KC_BSPC, KC_BSPC, RAISE, KC_RGUI, M(RALT_BRACE), ALL_T(KC_RBRC), LT_GUIR
146 ), 146 ),
@@ -224,12 +224,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
224 ) 224 )
225}; 225};
226 226
227const uint16_t PROGMEM fn_actions[] = {
228 // Modifiers
229 [5] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_TAB),
230 [6] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT),
231};
232
233const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 227const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
234{ 228{
235 switch(id) { 229 switch(id) {
diff --git a/keyboards/planck/keymaps/chance/keymap.c b/keyboards/planck/keymaps/chance/keymap.c
index 23af2277bd..46d077ddc3 100644
--- a/keyboards/planck/keymaps/chance/keymap.c
+++ b/keyboards/planck/keymaps/chance/keymap.c
@@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
45[_QWERTY] = LAYOUT_planck_grid( 45[_QWERTY] = LAYOUT_planck_grid(
46 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, 46 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
47 KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, 47 KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
48 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, F(0) , 48 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, MT(MOD_RSFT, KC_ENT),
49 KC_LCTRL,KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT 49 KC_LCTRL,KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
50), 50),
51 51
@@ -179,10 +179,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
179 179
180}; 180};
181 181
182const uint16_t PROGMEM fn_actions[] = {
183 [0] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT),
184};
185
186const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 182const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
187{ 183{
188 // MACRODOWN only works in this function 184 // MACRODOWN only works in this function
diff --git a/keyboards/planck/keymaps/charlie/keymap.c b/keyboards/planck/keymaps/charlie/keymap.c
index 29d0502238..4a3adba513 100644
--- a/keyboards/planck/keymaps/charlie/keymap.c
+++ b/keyboards/planck/keymaps/charlie/keymap.c
@@ -2,52 +2,21 @@
2 2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4 [0] = LAYOUT_planck_grid( /* Native */ 4 [0] = LAYOUT_planck_grid( /* Native */
5 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, FUNC(2), 5 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, DF(1),
6 KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, 6 KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
7 KC_TAB, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, 7 KC_TAB, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
8 KC_DEL, KC_LCTL, KC_NO, KC_LSFT, KC_LALT, KC_SPC, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT 8 KC_DEL, KC_LCTL, KC_NO, KC_LSFT, KC_LALT, KC_SPC, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
9), 9),
10 [1] = LAYOUT_planck_grid( /* QWERTY->PHOTOSHOP */ 10 [1] = LAYOUT_planck_grid( /* QWERTY->PHOTOSHOP */
11 KC_DELETE, KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, FUNC(1), 11 KC_DELETE, KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, DF(0),
12 KC_O, KC_G, KC_S, KC_U, KC_T, FUNC(27), KC_F21, KC_F10, KC_F11, KC_F7, KC_F8, KC_F9, 12 KC_O, KC_G, KC_S, KC_U, KC_T, C(KC_R), KC_F21, KC_F10, KC_F11, KC_F7, KC_F8, KC_F9,
13 KC_TAB, FUNC(4), FUNC(5), FUNC(6), KC_F1, FUNC(7), KC_F18, KC_F19, KC_F23, KC_F20, KC_F22, FUNC(9), 13 KC_TAB, C(S(A(KC_F9))), C(S(KC_I)), S(KC_M), KC_F1, A(KC_BSPC), KC_F18, KC_F19, KC_F23, KC_F20, KC_F22, C(S(A(KC_F12))),
14 KC_COMM, KC_DOT, KC_R, FUNC(11), MO(2), KC_SPC, FUNC(12), KC_F2, FUNC(8), KC_F3, KC_F14 14 KC_COMM, KC_DOT, KC_R, C(KC_H), MO(2), KC_SPC, C(KC_S), KC_F2, C(S(A(KC_X))), KC_F3, KC_F14
15 ), 15 ),
16 [2] = LAYOUT_planck_grid( /* 2: FUNC(3 PHOTOSHOP */ 16 [2] = LAYOUT_planck_grid( /* PHOTOSHOP */
17 KC_ESC, FUNC(25), FUNC(26), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 17 KC_ESC, C(KC_Z), C(KC_Y), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
18 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, FUNC(19), FUNC(20), FUNC(21), 18 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, C(S(A(KC_F7))), C(S(A(KC_F8))), C(S(KC_X)),
19 KC_C, KC_NO, FUNC(22), FUNC(5), KC_NO, FUNC(23), KC_NO, KC_NO, KC_NO, KC_NO, FUNC(13), KC_NO, 19 KC_C, KC_NO, S(KC_MINS), C(S(KC_I)), KC_NO, C(S(KC_BSPC)), KC_NO, KC_NO, KC_NO, KC_NO, C(S(KC_F5)), KC_NO,
20 FUNC(14), FUNC(15), FUNC(16), FUNC(17), MO(2), KC_SPC, FUNC(18), KC_NO, KC_NO, KC_F24, KC_NO 20 C(KC_F2), C(S(KC_F2)), C(KC_0), C(S(KC_H)), MO(2), KC_SPC, C(S(KC_S)), KC_NO, KC_NO, KC_F24, KC_NO
21 ) 21 )
22}; 22};
23
24const uint16_t PROGMEM fn_actions[] = {
25 [1] = ACTION_DEFAULT_LAYER_SET(0), // set Qwerty layout
26 [2] = ACTION_DEFAULT_LAYER_SET(1), // set Photoshop presets
27
28 [4] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F9), // photo folder AHK
29 [5] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_I), // select inverse
30 [6] = ACTION_MODS_KEY(MOD_LSFT, KC_M), // marquee select
31 [7] = ACTION_MODS_KEY(MOD_LALT, KC_BSPC), // fill
32 [8] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_X), // warp
33 [9] = ACTION_MODS_KEY(MOD_LCTL | MOD_LALT | MOD_LSFT, KC_F12), // merge all new layer
34 [10] = ACTION_MODS_KEY(MOD_LCTL, KC_MINS), // zoom out
35 [11] = ACTION_MODS_KEY(MOD_LCTL, KC_H), // RBG sliders
36 [12] = ACTION_MODS_KEY(MOD_LCTL, KC_S), // save
37 [13] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_F5), // layer mask from transparancy
38 [14] = ACTION_MODS_KEY(MOD_LCTL, KC_F2), // stroke
39 [15] = ACTION_MODS_KEY(MOD_LCTL | MOD_LSFT, KC_F2), // stroke layer
40 [16] = ACTION_MODS_KEY(MOD_LCTL, KC_0), // zoom 0
41 [17] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_H), // HSV sliders
42 [18] = ACTION_MODS_KEY(MOD_LCTL | MOD_LSFT, KC_S), // save as
43 [19] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F7), // gaussian blur
44 [20] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F8), // motion blur
45 [21] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_X), // liquify filter
46 [22] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // prev layer blending
47 [23] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_BSPC), // KC_NOrmal layer blending
48 [24] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), // next layer blending
49 [25] = ACTION_MODS_KEY(MOD_LCTL, KC_Z), // step back
50 [26] = ACTION_MODS_KEY(MOD_LCTL, KC_Y), // step forward
51 [27] = ACTION_MODS_KEY(MOD_LCTL, KC_R), // rasterize
52
53};
diff --git a/keyboards/planck/keymaps/circuit/keymap.c b/keyboards/planck/keymaps/circuit/keymap.c
index 018cff4e54..805ebd7fd3 100644
--- a/keyboards/planck/keymaps/circuit/keymap.c
+++ b/keyboards/planck/keymaps/circuit/keymap.c
@@ -23,8 +23,8 @@ enum planck_keycodes {
23}; 23};
24 24
25// Key code names 25// Key code names
26#define SFT_ENT FUNC(0) // Tap for enter, hold for right shift 26#define SFT_ENT MT(MOD_RSFT, KC_ENT) // Tap for enter, hold for right shift
27#define LOCK FUNC(1) 27#define LOCK TG(_LOCKED)
28#define KC_PSTE KC_PASTE 28#define KC_PSTE KC_PASTE
29 29
30#ifdef TAP_DANCE_ENABLE 30#ifdef TAP_DANCE_ENABLE
@@ -41,12 +41,6 @@ qk_tap_dance_action_t tap_dance_actions[] = {
41}; 41};
42#endif 42#endif
43 43
44// Function definitions
45const uint16_t PROGMEM fn_actions[] = {
46 [0] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT),
47 [1] = ACTION_LAYER_TOGGLE(_LOCKED)
48};
49
50// Layout definitions 44// Layout definitions
51const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 45const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
52 46
diff --git a/keyboards/planck/keymaps/david/keymap.c b/keyboards/planck/keymaps/david/keymap.c
index 57aafed2a0..d093efe04a 100644
--- a/keyboards/planck/keymaps/david/keymap.c
+++ b/keyboards/planck/keymaps/david/keymap.c
@@ -12,24 +12,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
12 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, 12 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
13 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, 13 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
14 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, 14 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
15 KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT 15 DF(0), KC_LCTL, KC_LALT, KC_LGUI, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
16), 16),
17[2] = LAYOUT_planck_grid( /* RAISE */ 17[2] = LAYOUT_planck_grid( /* RAISE */
18 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, 18 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
19 KC_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, 19 KC_TRNS, DF(0), DF(1), RESET, M(0), M(1), M(2), KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
20 KC_TRNS, KC_F11, KC_F12, M(0), M(1), M(2), M(3), M(4), M(5), M(6), M(7), KC_TRNS, 20 KC_TRNS, KC_F11, KC_F12, M(0), M(1), M(2), M(3), M(4), M(5), M(6), M(7), KC_TRNS,
21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY 21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
22), 22),
23[3] = LAYOUT_planck_grid( /* LOWER */ 23[3] = LAYOUT_planck_grid( /* LOWER */
24 S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC, 24 S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC,
25 KC_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS), 25 KC_TRNS, DF(0), DF(1), RESET, M(0), M(1), M(2), S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS),
26 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, 26 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS,
27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY 27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
28) 28)
29}; 29};
30
31const uint16_t PROGMEM fn_actions[] = {
32 [3] = ACTION_DEFAULT_LAYER_SET(0),
33 [4] = ACTION_DEFAULT_LAYER_SET(1),
34
35};
diff --git a/keyboards/planck/keymaps/dr_notsokind/keymap.c b/keyboards/planck/keymaps/dr_notsokind/keymap.c
index a244da2e42..1055c754f0 100644
--- a/keyboards/planck/keymaps/dr_notsokind/keymap.c
+++ b/keyboards/planck/keymaps/dr_notsokind/keymap.c
@@ -34,8 +34,8 @@ enum planck_keycodes {
34#include "dynamic_macro.h" 34#include "dynamic_macro.h"
35 35
36// Key code names 36// Key code names
37#define SFT_ENT FUNC(0) // Tap for enter, hold for right shift 37#define SFT_ENT MT(MOD_RSFT, KC_ENT) // Tap for enter, hold for right shift
38#define LOCK FUNC(1) 38#define LOCK TG(_LOCKED)
39#define KC_PSTE KC_PASTE 39#define KC_PSTE KC_PASTE
40#define ZOOM_IN LCTL(KC_EQL) 40#define ZOOM_IN LCTL(KC_EQL)
41#define ZOOM_OUT LCTL(KC_MINS) 41#define ZOOM_OUT LCTL(KC_MINS)
@@ -55,12 +55,6 @@ qk_tap_dance_action_t tap_dance_actions[] = {
55}; 55};
56#endif 56#endif
57 57
58// Function definitions
59const uint16_t PROGMEM fn_actions[] = {
60 [0] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT),
61 [1] = ACTION_LAYER_TOGGLE(_LOCKED)
62};
63
64// Layout definitions 58// Layout definitions
65const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 59const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
66 60
diff --git a/keyboards/planck/keymaps/dzobert/keymap.c b/keyboards/planck/keymaps/dzobert/keymap.c
index 17b1bef019..6012c068a9 100644
--- a/keyboards/planck/keymaps/dzobert/keymap.c
+++ b/keyboards/planck/keymaps/dzobert/keymap.c
@@ -5,14 +5,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TAB, 5 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TAB,
6 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_BSPC, 6 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_BSPC,
7 KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, 7 KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
8 KC_FN4, KC_RSFT, KC_LGUI, KC_LSFT, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT 8 DF(1), KC_RSFT, KC_LGUI, KC_LSFT, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
9 // Space is repeated to accommadate for both spacebar wiring positions 9 // Space is repeated to accommadate for both spacebar wiring positions
10), 10),
11[1] = LAYOUT_planck_grid( /* Colemak */ 11[1] = LAYOUT_planck_grid( /* Colemak */
12 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TAB, 12 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TAB,
13 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_BSPC, 13 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_BSPC,
14 KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, 14 KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
15 KC_FN3, KC_RSFT, KC_LGUI, KC_LSFT, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT 15 DF(0), KC_RSFT, KC_LGUI, KC_LSFT, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
16), 16),
17[2] = LAYOUT_planck_grid( /* RAISE */ 17[2] = LAYOUT_planck_grid( /* RAISE */
18 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, 18 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
@@ -27,9 +27,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_0, KC_KP_DOT, KC_KP_ENTER, KC_KP_PLUS 27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_0, KC_KP_DOT, KC_KP_ENTER, KC_KP_PLUS
28) 28)
29}; 29};
30
31const uint16_t PROGMEM fn_actions[] = {
32 [3] = ACTION_DEFAULT_LAYER_SET(0),
33 [4] = ACTION_DEFAULT_LAYER_SET(1),
34
35};
diff --git a/keyboards/planck/keymaps/emilyh/keymap.c b/keyboards/planck/keymaps/emilyh/keymap.c
index 4a8a7d0c51..3beadd8e2d 100644
--- a/keyboards/planck/keymaps/emilyh/keymap.c
+++ b/keyboards/planck/keymaps/emilyh/keymap.c
@@ -187,7 +187,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
187 case QWERTY: 187 case QWERTY:
188 if (record->event.pressed) { 188 if (record->event.pressed) {
189 #ifdef AUDIO_ENABLE 189 #ifdef AUDIO_ENABLE
190 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 190 PLAY_SONG(tone_qwerty);
191 #endif 191 #endif
192 persistant_default_layer_set(1UL<<_QWERTY); 192 persistant_default_layer_set(1UL<<_QWERTY);
193 } 193 }
@@ -196,7 +196,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
196 case COLEMAK: 196 case COLEMAK:
197 if (record->event.pressed) { 197 if (record->event.pressed) {
198 #ifdef AUDIO_ENABLE 198 #ifdef AUDIO_ENABLE
199 PLAY_NOTE_ARRAY(tone_colemak, false, 0); 199 PLAY_SONG(tone_colemak);
200 #endif 200 #endif
201 persistant_default_layer_set(1UL<<_COLEMAK); 201 persistant_default_layer_set(1UL<<_COLEMAK);
202 } 202 }
@@ -205,7 +205,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
205 case DVORAK: 205 case DVORAK:
206 if (record->event.pressed) { 206 if (record->event.pressed) {
207 #ifdef AUDIO_ENABLE 207 #ifdef AUDIO_ENABLE
208 PLAY_NOTE_ARRAY(tone_dvorak, false, 0); 208 PLAY_SONG(tone_dvorak);
209 #endif 209 #endif
210 persistant_default_layer_set(1UL<<_DVORAK); 210 persistant_default_layer_set(1UL<<_DVORAK);
211 } 211 }
@@ -246,7 +246,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
246 if (record->event.pressed) { 246 if (record->event.pressed) {
247 #ifdef AUDIO_ENABLE 247 #ifdef AUDIO_ENABLE
248 stop_all_notes(); 248 stop_all_notes();
249 PLAY_NOTE_ARRAY(tone_plover, false, 0); 249 PLAY_SONG(tone_plover);
250 #endif 250 #endif
251 layer_off(_RAISE); 251 layer_off(_RAISE);
252 layer_off(_LOWER); 252 layer_off(_LOWER);
@@ -264,7 +264,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
264 case EXT_PLV: 264 case EXT_PLV:
265 if (record->event.pressed) { 265 if (record->event.pressed) {
266 #ifdef AUDIO_ENABLE 266 #ifdef AUDIO_ENABLE
267 PLAY_NOTE_ARRAY(tone_plover_gb, false, 0); 267 PLAY_SONG(tone_plover_gb);
268 #endif 268 #endif
269 layer_off(_PLOVER); 269 layer_off(_PLOVER);
270 } 270 }
@@ -285,12 +285,12 @@ void matrix_init_user(void) {
285void startup_user() 285void startup_user()
286{ 286{
287 _delay_ms(20); // gets rid of tick 287 _delay_ms(20); // gets rid of tick
288 PLAY_NOTE_ARRAY(tone_startup, false, 0); 288 PLAY_SONG(tone_startup);
289} 289}
290 290
291void shutdown_user() 291void shutdown_user()
292{ 292{
293 PLAY_NOTE_ARRAY(tone_goodbye, false, 0); 293 PLAY_SONG(tone_goodbye);
294 _delay_ms(150); 294 _delay_ms(150);
295 stop_all_notes(); 295 stop_all_notes();
296} 296}
@@ -302,7 +302,7 @@ void music_on_user(void)
302 302
303void music_scale_user(void) 303void music_scale_user(void)
304{ 304{
305 PLAY_NOTE_ARRAY(music_scale, false, 0); 305 PLAY_SONG(music_scale);
306} 306}
307 307
308#endif 308#endif
diff --git a/keyboards/planck/keymaps/espynn/keymap.c b/keyboards/planck/keymaps/espynn/keymap.c
index 924a8c35c6..305fb6e759 100644
--- a/keyboards/planck/keymaps/espynn/keymap.c
+++ b/keyboards/planck/keymaps/espynn/keymap.c
@@ -36,21 +36,11 @@ extern keymap_config_t keymap_config;
36// Func macro definitions. 36// Func macro definitions.
37#define LWR_PGDN LT(_LOWER, KC_PGDN) // Tap for PgDn, hold for LOWER 37#define LWR_PGDN LT(_LOWER, KC_PGDN) // Tap for PgDn, hold for LOWER
38#define RSE_PGUP LT(_RAISE, KC_PGUP) // Tap for PgUp, hold for RAISE 38#define RSE_PGUP LT(_RAISE, KC_PGUP) // Tap for PgUp, hold for RAISE
39#define CTL_CAPS FUNC(2) // Tap for Caps, hold for Ctrl (DOESN'T SEEM TO WORK) 39#define CTL_CAPS MT(MOD_LCTL, KC_CAPS) // Tap for Caps, hold for Ctrl (DOESN'T SEEM TO WORK)
40#define SFT_ENT FUNC(3) // Tap for Enter, hold for Shift 40#define SFT_ENT MT(MOD_RSFT, KC_ENT) // Tap for Enter, hold for Shift
41#define ZM_NRM FUNC(4) // Zoom normal 41#define ZM_NRM C(KC_0) // Zoom normal
42#define ZM_IN FUNC(5) // Zoom out 42#define ZM_IN C(KC_MINS) // Zoom out
43#define ZM_OUT FUNC(6) // Zoom in 43#define ZM_OUT C(KC_PLUS) // Zoom in
44
45// Enable these functions using FUNC(n) macro.
46const uint16_t PROGMEM fn_actions[] = {
47 [2] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_CAPS),
48 [3] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT),
49 [4] = ACTION_MODS_KEY(MOD_LCTL, KC_0),
50 [5] = ACTION_MODS_KEY(MOD_LCTL, KC_MINS),
51 [6] = ACTION_MODS_KEY(MOD_LCTL, KC_PLUS),
52 [7] = ACTION_MODS_KEY(MOD_LCTL, KC_UNDS),
53 };
54 44
55// This config can be found at Keyboard layout editor site: https://goo.gl/cF7uIO 45// This config can be found at Keyboard layout editor site: https://goo.gl/cF7uIO
56const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 46const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
diff --git a/keyboards/planck/keymaps/ishtob/keymap.c b/keyboards/planck/keymaps/ishtob/keymap.c
index e036d8a5a3..aeb36b3687 100644
--- a/keyboards/planck/keymaps/ishtob/keymap.c
+++ b/keyboards/planck/keymaps/ishtob/keymap.c
@@ -198,10 +198,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
198 198
199}; 199};
200 200
201const uint16_t PROGMEM fn_actions[] = {
202 ACTION_SWAP_HANDS_TAP_KEY(KC_SPC),
203};
204
205#ifdef AUDIO_ENABLE 201#ifdef AUDIO_ENABLE
206 202
207float tone_startup[][2] = SONG(STARTUP_SOUND); 203float tone_startup[][2] = SONG(STARTUP_SOUND);
@@ -230,7 +226,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
230 case QWERTY: 226 case QWERTY:
231 if (record->event.pressed) { 227 if (record->event.pressed) {
232 #ifdef AUDIO_ENABLE 228 #ifdef AUDIO_ENABLE
233 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 229 PLAY_SONG(tone_qwerty);
234 #endif 230 #endif
235 persistant_default_layer_set(1UL<<_QWERTY); 231 persistant_default_layer_set(1UL<<_QWERTY);
236 } 232 }
@@ -239,7 +235,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
239 case COLEMAK: 235 case COLEMAK:
240 if (record->event.pressed) { 236 if (record->event.pressed) {
241 #ifdef AUDIO_ENABLE 237 #ifdef AUDIO_ENABLE
242 PLAY_NOTE_ARRAY(tone_colemak, false, 0); 238 PLAY_SONG(tone_colemak);
243 #endif 239 #endif
244 persistant_default_layer_set(1UL<<_COLEMAK); 240 persistant_default_layer_set(1UL<<_COLEMAK);
245 } 241 }
@@ -248,7 +244,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
248 case DVORAK: 244 case DVORAK:
249 if (record->event.pressed) { 245 if (record->event.pressed) {
250 #ifdef AUDIO_ENABLE 246 #ifdef AUDIO_ENABLE
251 PLAY_NOTE_ARRAY(tone_dvorak, false, 0); 247 PLAY_SONG(tone_dvorak);
252 #endif 248 #endif
253 persistant_default_layer_set(1UL<<_DVORAK); 249 persistant_default_layer_set(1UL<<_DVORAK);
254 } 250 }
@@ -289,7 +285,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
289 if (record->event.pressed) { 285 if (record->event.pressed) {
290 #ifdef AUDIO_ENABLE 286 #ifdef AUDIO_ENABLE
291 stop_all_notes(); 287 stop_all_notes();
292 PLAY_NOTE_ARRAY(tone_plover, false, 0); 288 PLAY_SONG(tone_plover);
293 #endif 289 #endif
294 layer_off(_RAISE); 290 layer_off(_RAISE);
295 layer_off(_LOWER); 291 layer_off(_LOWER);
@@ -307,7 +303,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
307 case EXT_PLV: 303 case EXT_PLV:
308 if (record->event.pressed) { 304 if (record->event.pressed) {
309 #ifdef AUDIO_ENABLE 305 #ifdef AUDIO_ENABLE
310 PLAY_NOTE_ARRAY(tone_plover_gb, false, 0); 306 PLAY_SONG(tone_plover_gb);
311 #endif 307 #endif
312 layer_off(_PLOVER); 308 layer_off(_PLOVER);
313 } 309 }
@@ -331,12 +327,12 @@ void startup_user()
331 rgblight_mode(RGB_MATRIX_CYCLE_ALL); 327 rgblight_mode(RGB_MATRIX_CYCLE_ALL);
332 #endif //RGB_matrix 328 #endif //RGB_matrix
333 wait_ms(20); // gets rid of tick 329 wait_ms(20); // gets rid of tick
334 PLAY_NOTE_ARRAY(tone_startup, false, 0); 330 PLAY_SONG(tone_startup);
335} 331}
336 332
337void shutdown_user() 333void shutdown_user()
338{ 334{
339 PLAY_NOTE_ARRAY(tone_goodbye, false, 0); 335 PLAY_SONG(tone_goodbye);
340 wait_ms(150); 336 wait_ms(150);
341 stop_all_notes(); 337 stop_all_notes();
342} 338}
@@ -348,7 +344,7 @@ void music_on_user(void)
348 344
349void music_scale_user(void) 345void music_scale_user(void)
350{ 346{
351 PLAY_NOTE_ARRAY(music_scale, false, 0); 347 PLAY_SONG(music_scale);
352} 348}
353 349
354#endif 350#endif
diff --git a/keyboards/planck/keymaps/joe/keymap.c b/keyboards/planck/keymaps/joe/keymap.c
index b759a86cea..49b2948e65 100644
--- a/keyboards/planck/keymaps/joe/keymap.c
+++ b/keyboards/planck/keymaps/joe/keymap.c
@@ -7,25 +7,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7 [0] = LAYOUT_planck_grid( /* Joe colemak */ 7 [0] = LAYOUT_planck_grid( /* Joe colemak */
8 FN3_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS, 8 FN3_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS,
9 KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT , 9 KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT ,
10 F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_UP, KC_QUOT, 10 MT(MOD_LSFT, KC_TAB), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_UP, KC_QUOT,
11 KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4),KC_SPC, KC_SPC, MO(5),KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT 11 KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4),KC_SPC, KC_SPC, MO(5),KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT
12 ), 12 ),
13 [1] = LAYOUT_planck_grid( /* Joe soft Colemak */ 13 [1] = LAYOUT_planck_grid( /* Joe soft Colemak */
14 FN3_ESC, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_MINS, 14 FN3_ESC, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_MINS,
15 KC_BSPC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_ENT , 15 KC_BSPC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_ENT ,
16 F(15), CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, KC_COMM, KC_DOT, KC_UP, KC_QUOT, 16 MT(MOD_LSFT, KC_TAB), CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, KC_COMM, KC_DOT, KC_UP, KC_QUOT,
17 KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4),KC_SPC, KC_SPC, MO(5),KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT 17 KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4),KC_SPC, KC_SPC, MO(5),KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT
18 ), 18 ),
19 [2] = LAYOUT_planck_grid( /* Joe NUMPAD */ 19 [2] = LAYOUT_planck_grid( /* Joe NUMPAD */
20 FN3_ESC, KC_NO, KC_UP, KC_NO, KC_NO, KC_NO, LSFT(KC_9), LSFT(KC_0), KC_PSLS, KC_P7, KC_P8, KC_P9 , 20 FN3_ESC, KC_NO, KC_UP, KC_NO, KC_NO, KC_NO, LSFT(KC_9), LSFT(KC_0), KC_PSLS, KC_P7, KC_P8, KC_P9 ,
21 KC_BSPC, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, KC_NO, LSFT(KC_5), KC_PEQL, KC_PAST, KC_P4, KC_P5, KC_P6 , 21 KC_BSPC, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, KC_NO, LSFT(KC_5), KC_PEQL, KC_PAST, KC_P4, KC_P5, KC_P6 ,
22 F(15), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PCMM, KC_PMNS, KC_P1, KC_P2, KC_P3 , 22 MT(MOD_LSFT, KC_TAB), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PCMM, KC_PMNS, KC_P1, KC_P2, KC_P3 ,
23 KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4), KC_TRNS, KC_TRNS, MO(5), KC_PPLS, KC_P0, KC_PDOT, KC_PENT 23 KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4), KC_TRNS, KC_TRNS, MO(5), KC_PPLS, KC_P0, KC_PDOT, KC_PENT
24 ), 24 ),
25 [3] = LAYOUT_planck_grid( /* Joe 1337 haxOr5*/ 25 [3] = LAYOUT_planck_grid( /* Joe 1337 haxOr5*/
26 FN3_ESC, KC_Q, KC_W, KC_F, KC_P, KC_6, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS, 26 FN3_ESC, KC_Q, KC_W, KC_F, KC_P, KC_6, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS,
27 KC_BSPC, KC_4, KC_R, KC_5, KC_7, KC_D, KC_H, KC_N, KC_3, KC_1, KC_0, KC_ENT , 27 KC_BSPC, KC_4, KC_R, KC_5, KC_7, KC_D, KC_H, KC_N, KC_3, KC_1, KC_0, KC_ENT ,
28 F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_UP, KC_QUOT, 28 MT(MOD_LSFT, KC_TAB), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_UP, KC_QUOT,
29 KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4),KC_SPC, KC_SPC, MO(5),KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT 29 KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4),KC_SPC, KC_SPC, MO(5),KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT
30 ), 30 ),
31 [4] = LAYOUT_planck_grid( /* Joe LOWER fn1 */ 31 [4] = LAYOUT_planck_grid( /* Joe LOWER fn1 */
@@ -44,21 +44,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
44 KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO , 44 KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO ,
45 KC_NO, KC_MPLY, KC_MPRV, KC_MNXT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RESET , 45 KC_NO, KC_MPLY, KC_MPRV, KC_MNXT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RESET ,
46 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO , 46 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO ,
47 F(6), F(7), F(8), F(9), MO(4), KC_TRNS, KC_TRNS, MO(5), KC_POWER, KC_WAKE, KC_SLEP, LCTL(LALT(KC_L)) 47 DF(0), DF(1), DF(2), DF(3), MO(4), KC_TRNS, KC_TRNS, MO(5), KC_POWER, KC_WAKE, KC_SLEP, LCTL(LALT(KC_L))
48 ) 48 )
49}; 49};
50 50
51const uint16_t PROGMEM fn_actions[] = {
52 /* toggle layers */
53 [6] = ACTION_DEFAULT_LAYER_SET(0),
54 [7] = ACTION_DEFAULT_LAYER_SET(1),
55 [8] = ACTION_DEFAULT_LAYER_SET(2),
56 [9] = ACTION_DEFAULT_LAYER_SET(3),
57
58 /* tab on tap, shift on hold */
59 [15] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_TAB),
60};
61
62const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 51const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
63{ 52{
64 switch (id) { 53 switch (id) {
diff --git a/keyboards/planck/keymaps/kyle/keymap.c b/keyboards/planck/keymaps/kyle/keymap.c
index a788aa859f..896dfe9397 100644
--- a/keyboards/planck/keymaps/kyle/keymap.c
+++ b/keyboards/planck/keymaps/kyle/keymap.c
@@ -12,24 +12,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
12 KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, 12 KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
13 KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, 13 KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
14 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, 14 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
15 KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT 15 DF(0), KC_LCTL, KC_LALT, KC_LGUI, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
16), 16),
17[2] = LAYOUT_planck_grid( /* RAISE */ 17[2] = LAYOUT_planck_grid( /* RAISE */
18 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, 18 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
19 KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, 19 KC_TRNS, DF(0), DF(1), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
20 KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS, 20 KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS,
21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY 21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
22), 22),
23[3] = LAYOUT_planck_grid( /* LOWER */ 23[3] = LAYOUT_planck_grid( /* LOWER */
24 S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC, 24 S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC,
25 KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), LSFT(RSFT(KC_D)), KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS), 25 KC_TRNS, DF(0), DF(1), LSFT(RSFT(KC_PAUSE)), LSFT(RSFT(KC_D)), KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS),
26 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, 26 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS,
27 BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY 27 BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
28) 28)
29}; 29};
30
31const uint16_t PROGMEM fn_actions[] = {
32 [3] = ACTION_DEFAULT_LAYER_SET(0),
33 [4] = ACTION_DEFAULT_LAYER_SET(1),
34
35};
diff --git a/keyboards/planck/keymaps/lucas/keymap.c b/keyboards/planck/keymaps/lucas/keymap.c
index 9bd4b7a60b..26ca6a5505 100644
--- a/keyboards/planck/keymaps/lucas/keymap.c
+++ b/keyboards/planck/keymaps/lucas/keymap.c
@@ -57,7 +57,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
57 * |LCTL |LGUI | Tab |LALT |Lower| Space | |Mute |Vol- |Vol+ | P/P | 57 * |LCTL |LGUI | Tab |LALT |Lower| Space | |Mute |Vol- |Vol+ | P/P |
58 * `-----------------------------------------------------------------------' 58 * `-----------------------------------------------------------------------'
59 */ 59 */
60 KC_NO, S(DE_AE), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, S(DE_UE), S(DE_OE), KC_NO, F(4), 60 KC_NO, S(DE_AE), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, S(DE_UE), S(DE_OE), KC_NO, TG(5),
61 KC_DEL, DE_AE, KC_NO, DE_SS, KC_NO, KC_NO, KC_NO, KC_NO, DE_UE, DE_OE, KC_NO, RALT(KC_F12), 61 KC_DEL, DE_AE, KC_NO, DE_SS, KC_NO, KC_NO, KC_NO, KC_NO, DE_UE, DE_OE, KC_NO, RALT(KC_F12),
62 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MSTP, KC_MPRV, KC_MNXT, RALT(KC_F11), 62 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MSTP, KC_MPRV, KC_MNXT, RALT(KC_F11),
63 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY 63 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY
@@ -105,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
105 * | | | Tab | ALT | | Space |CrJmp| GUI |Left |Down |Right| 105 * | | | Tab | ALT | | Space |CrJmp| GUI |Left |Down |Right|
106 * `-----------------------------------------------------------------------' 106 * `-----------------------------------------------------------------------'
107 */ 107 */
108 MO(6), KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, F(4), 108 MO(6), KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, TG(5),
109 KC_ENT, KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, DE_SCLN, 109 KC_ENT, KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, DE_SCLN,
110 KC_LCTL, KC_LSFT, KC_Y, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, DE_DOT, KC_UP, DE_SLSH, 110 KC_LCTL, KC_LSFT, KC_Y, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, DE_DOT, KC_UP, DE_SLSH,
111 KC_NO, KC_NO, KC_TAB, KC_LALT, KC_NO, KC_SPC, KC_SPC, LCTL(KC_SPC), KC_LGUI, KC_LEFT, KC_DOWN, KC_RGHT 111 KC_NO, KC_NO, KC_TAB, KC_LALT, KC_NO, KC_SPC, KC_SPC, LCTL(KC_SPC), KC_LGUI, KC_LEFT, KC_DOWN, KC_RGHT
@@ -129,11 +129,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
129), 129),
130}; 130};
131 131
132const uint16_t PROGMEM fn_actions[] = {
133 [4] = ACTION_LAYER_TOGGLE(5), // toggle Gaming
134 [5] = ACTION_MODS_TAP_KEY(KC_LSFT, KC_CAPS), //Shift on press, Caps on tap
135};
136
137const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 132const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
138{ 133{
139 switch(id) { 134 switch(id) {
diff --git a/keyboards/planck/keymaps/matrixman/keymap.c b/keyboards/planck/keymaps/matrixman/keymap.c
index 20982a24ea..7525e345bb 100644
--- a/keyboards/planck/keymaps/matrixman/keymap.c
+++ b/keyboards/planck/keymaps/matrixman/keymap.c
@@ -14,7 +14,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
14 LT(_NAV_L,KC_Q), KC_W, KC_E, KC_R, KC_T, KC_DELETE, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, LT(_NAV_R,KC_P) 14 LT(_NAV_L,KC_Q), KC_W, KC_E, KC_R, KC_T, KC_DELETE, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, LT(_NAV_R,KC_P)
15 ,KC_A, KC_S, KC_D, KC_F, KC_G, CTL_T(KC_ESC), CTL_T(KC_SCLN), KC_H, KC_J, KC_K, KC_L, KC_QUOT 15 ,KC_A, KC_S, KC_D, KC_F, KC_G, CTL_T(KC_ESC), CTL_T(KC_SCLN), KC_H, KC_J, KC_K, KC_L, KC_QUOT
16 ,SFT_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALT_T(KC_TAB), ALT_T(KC_INS), KC_N, KC_M, KC_COMM, KC_DOT, SFT_T(KC_SLSH) 16 ,SFT_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALT_T(KC_TAB), ALT_T(KC_INS), KC_N, KC_M, KC_COMM, KC_DOT, SFT_T(KC_SLSH)
17 ,KC_LCTRL, KC_LGUI, KC_FN0, KC_TAB, LT(_SYMB_L, KC_ESC), KC_LSFT, KC_LSFT, LT(_SYMB_R,KC_SPC), KC_BSPC, KC_FN0, KC_RCTRL, KC_ENT 17 ,KC_LCTRL, KC_LGUI, LM(_NAV_ALT, MOD_LALT), KC_TAB, LT(_SYMB_L, KC_ESC), KC_LSFT, KC_LSFT, LT(_SYMB_R,KC_SPC), KC_BSPC, LM(_NAV_ALT, MOD_LALT), KC_RCTRL, KC_ENT
18), 18),
19 // accessed via the left symb-layer key, includes a semicolon where the right symb-layer key was 19 // accessed via the left symb-layer key, includes a semicolon where the right symb-layer key was
20[_SYMB_L] = LAYOUT_planck_grid( 20[_SYMB_L] = LAYOUT_planck_grid(
@@ -53,11 +53,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
53) 53)
54}; 54};
55 55
56const uint16_t PROGMEM fn_actions[] = {
57 [0] = ACTION_LAYER_MODS(_NAV_ALT, MOD_LALT)
58
59};
60
61const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 56const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
62{ 57{
63 // MACRODOWN only works in this function 58 // MACRODOWN only works in this function
diff --git a/keyboards/planck/keymaps/max/keymap.c b/keyboards/planck/keymaps/max/keymap.c
index 1e5d6a61c2..b84404e1e5 100644
--- a/keyboards/planck/keymaps/max/keymap.c
+++ b/keyboards/planck/keymaps/max/keymap.c
@@ -16,20 +16,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
16), 16),
17[2] = LAYOUT_planck_grid( /* RAISE */ 17[2] = LAYOUT_planck_grid( /* RAISE */
18 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, 18 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
19 KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS, 19 KC_TRNS, DF(0), DF(1), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS,
20 KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_BSLS, 20 KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_BSLS,
21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY 21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
22), 22),
23[3] = LAYOUT_planck_grid( /* LOWER */ 23[3] = LAYOUT_planck_grid( /* LOWER */
24 S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC, 24 S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC,
25 KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), KC_TRNS, 25 KC_TRNS, DF(0), DF(1), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), KC_TRNS,
26 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, S(KC_BSLS), 26 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, S(KC_BSLS),
27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY 27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
28) 28)
29}; 29};
30
31const uint16_t PROGMEM fn_actions[] = {
32 [3] = ACTION_DEFAULT_LAYER_SET(0),
33 [4] = ACTION_DEFAULT_LAYER_SET(1),
34
35};
diff --git a/keyboards/planck/keymaps/mollat/keymap.c b/keyboards/planck/keymaps/mollat/keymap.c
index 2952a0ca8f..f993d299b6 100644
--- a/keyboards/planck/keymaps/mollat/keymap.c
+++ b/keyboards/planck/keymaps/mollat/keymap.c
@@ -82,10 +82,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
82) 82)
83}; 83};
84 84
85const uint16_t PROGMEM fn_actions[] = {
86 [_LCTL] = ACTION_MODS_TAP_KEY(KC_LCTL, M(12)), // does not work
87};
88
89const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 85const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
90{ 86{
91 switch(id) { 87 switch(id) {
diff --git a/keyboards/planck/keymaps/piemod/keymap.c b/keyboards/planck/keymaps/piemod/keymap.c
index 57002cc386..d75b8bf53b 100644
--- a/keyboards/planck/keymaps/piemod/keymap.c
+++ b/keyboards/planck/keymaps/piemod/keymap.c
@@ -1,13 +1,13 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2 2
3#define DVORAK 0 3#define DVORAK 0
4#define ARROW 1 //F(1) 4#define ARROW 1
5#define SYMBOL 2 // F(2) 5#define SYMBOL 2
6#define NUMBER 3 // F(3) 6#define NUMBER 3
7#define FUNCTION 4 // F(4) 7#define FUNCTION 4
8#define EMACS 5 // F(5) 8#define EMACS 5
9#define CUSTOM_MACROS 6 // F(6) 9#define CUSTOM_MACROS 6
10#define MOUSE 7 // F(7) 10#define MOUSE 7
11 11
12#define LT_1A LT(1, KC_A) 12#define LT_1A LT(1, KC_A)
13#define LT_2O LT(2, KC_O) 13#define LT_2O LT(2, KC_O)
@@ -22,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
22 KC_ESC, KC_QUOTE, LT_7COM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DELETE, 22 KC_ESC, KC_QUOTE, LT_7COM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DELETE,
23 KC_TAB, LT_1A, LT_2O, LT_3E, LT_4U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENTER, 23 KC_TAB, LT_1A, LT_2O, LT_3E, LT_4U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENTER,
24 KC_LSHIFT, KC_SCOLON, LT_5Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_MINUS, 24 KC_LSHIFT, KC_SCOLON, LT_5Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_MINUS,
25 F(10), LT_6CTL, KC_MENU, KC_LALT, KC_LGUI, KC_BSPACE, KC_SPACE, KC_RCTRL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT 25 C(KC_LALT), LT_6CTL, KC_MENU, KC_LALT, KC_LGUI, KC_BSPACE, KC_SPACE, KC_RCTRL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT
26 ), 26 ),
27 27
28 [ARROW] = LAYOUT_planck_grid( 28 [ARROW] = LAYOUT_planck_grid(
@@ -34,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
34 34
35 [SYMBOL] = LAYOUT_planck_grid( 35 [SYMBOL] = LAYOUT_planck_grid(
36 KC_TILD, KC_GRAVE, KC_NO, KC_EQUAL, KC_PLUS, KC_NO, KC_LBRACKET, KC_RBRACKET, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, 36 KC_TILD, KC_GRAVE, KC_NO, KC_EQUAL, KC_PLUS, KC_NO, KC_LBRACKET, KC_RBRACKET, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN,
37 KC_NO, KC_NO, KC_TRNS, KC_SCOLON, KC_COLN, KC_NO, KC_LCBR, KC_RCBR, KC_DLR, KC_PERC, KC_CIRC, F(21), 37 KC_NO, KC_NO, KC_TRNS, KC_SCOLON, KC_COLN, KC_NO, KC_LCBR, KC_RCBR, KC_DLR, KC_PERC, KC_CIRC, S(KC_SLSH),
38 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLASH, KC_SLASH, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, 38 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLASH, KC_SLASH, KC_EXLM, KC_AT, KC_HASH, KC_PIPE,
39 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ASTR, KC_SLASH, KC_MINUS, KC_PLUS, KC_EQUAL 39 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ASTR, KC_SLASH, KC_MINUS, KC_PLUS, KC_EQUAL
40 ), 40 ),
@@ -75,31 +75,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
75 ), 75 ),
76 76
77 }; 77 };
78
79 enum function_id {
80 TEENSY_KEY,
81 CUSTOM_KEY,
82 L_CTRL_ALT_ENT,
83 R_CTRL_ALT_ENT,
84 };
85
86 int CAPSLOCKED = 0;
87
88 const uint16_t PROGMEM fn_actions[] = {
89
90 // DVORAK 0
91 // ARROW 1, F(1)
92 // SYMBOL 2, F(2)
93 // NUMBER 3, F(3)
94 // FUNCTION 4, F(4)
95 // EMACS 5, F(5)
96 // MACROS 6, F(6)
97 // MOUSE 7, F(7)
98
99 // Special Keys
100 [10] = ACTION_MODS_KEY(KC_LCTRL, KC_LALT), // FN10 = Ctrl + Alt.
101
102 // Symbols
103 [21] = ACTION_MODS_KEY(MOD_LSFT, KC_SLASH), // FN21 = Question mark.
104
105 };
diff --git a/keyboards/planck/keymaps/pvc/keymap.c b/keyboards/planck/keymaps/pvc/keymap.c
index 78123c44ce..8428c2335f 100644
--- a/keyboards/planck/keymaps/pvc/keymap.c
+++ b/keyboards/planck/keymaps/pvc/keymap.c
@@ -99,7 +99,7 @@ enum keyboard_macros {
99#define SC_CCLS LCTL(KC_F4) 99#define SC_CCLS LCTL(KC_F4)
100 100
101#define TG_NKRO MAGIC_TOGGLE_NKRO 101#define TG_NKRO MAGIC_TOGGLE_NKRO
102#define OS_SHFT KC_FN0 102#define OS_SHFT OSM(MOD_RSFT)
103 103
104#define ________________ _______, _______ 104#define ________________ _______, _______
105#define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX 105#define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX
@@ -234,10 +234,6 @@ void persistent_default_layer_set(uint16_t default_layer)
234 default_layer_set(default_layer); 234 default_layer_set(default_layer);
235} 235}
236 236
237const uint16_t PROGMEM fn_actions[] = {
238 [0] = ACTION_MODS_ONESHOT(MOD_RSFT),
239};
240
241const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 237const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
242{ 238{
243 239
diff --git a/keyboards/planck/keymaps/that_canadian/keymap.c b/keyboards/planck/keymaps/that_canadian/keymap.c
index 178422cd8b..8974555fb9 100644
--- a/keyboards/planck/keymaps/that_canadian/keymap.c
+++ b/keyboards/planck/keymaps/that_canadian/keymap.c
@@ -144,7 +144,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
144 case QWERTY: 144 case QWERTY:
145 if (record->event.pressed) { 145 if (record->event.pressed) {
146 #ifdef AUDIO_ENABLE 146 #ifdef AUDIO_ENABLE
147 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 147 PLAY_SONG(tone_qwerty);
148 #endif 148 #endif
149 persistant_default_layer_set(1UL<<_QWERTY); 149 persistant_default_layer_set(1UL<<_QWERTY);
150 } 150 }
@@ -185,12 +185,12 @@ void matrix_init_user(void) {
185void startup_user() 185void startup_user()
186{ 186{
187 _delay_ms(20); // gets rid of tick 187 _delay_ms(20); // gets rid of tick
188 PLAY_NOTE_ARRAY(tone_startup, false, 0); 188 PLAY_SONG(tone_startup);
189} 189}
190 190
191void shutdown_user() 191void shutdown_user()
192{ 192{
193 PLAY_NOTE_ARRAY(tone_goodbye, false, 0); 193 PLAY_SONG(tone_goodbye);
194 _delay_ms(150); 194 _delay_ms(150);
195 stop_all_notes(); 195 stop_all_notes();
196} 196}
@@ -202,7 +202,7 @@ void music_on_user(void)
202 202
203void music_scale_user(void) 203void music_scale_user(void)
204{ 204{
205 PLAY_NOTE_ARRAY(music_scale, false, 0); 205 PLAY_SONG(music_scale);
206} 206}
207 207
208#endif 208#endif
diff --git a/keyboards/planck/keymaps/zrichard/keymap.c b/keyboards/planck/keymaps/zrichard/keymap.c
index 550117d000..f3f60b7d1d 100755
--- a/keyboards/planck/keymaps/zrichard/keymap.c
+++ b/keyboards/planck/keymaps/zrichard/keymap.c
@@ -107,7 +107,7 @@ enum {
107#define SC_CCLS LCTL(KC_F4) 107#define SC_CCLS LCTL(KC_F4)
108 108
109#define TG_NKRO MAGIC_TOGGLE_NKRO 109#define TG_NKRO MAGIC_TOGGLE_NKRO
110#define OS_SHFT KC_FN0 110#define OS_SHFT OSM(MOD_RSFT)
111 111
112#define ________________ _______, _______ 112#define ________________ _______, _______
113#define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX 113#define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX
@@ -243,10 +243,6 @@ void persistant_default_layer_set(uint16_t default_layer)
243 default_layer_set(default_layer); 243 default_layer_set(default_layer);
244} 244}
245 245
246const uint16_t PROGMEM fn_actions[] = {
247 [0] = ACTION_MODS_ONESHOT(MOD_RSFT),
248};
249
250const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 246const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
251{ 247{
252 248
diff --git a/keyboards/planck/rev6/config.h b/keyboards/planck/rev6/config.h
index 3cea2e721e..3fbbae0278 100644
--- a/keyboards/planck/rev6/config.h
+++ b/keyboards/planck/rev6/config.h
@@ -53,6 +53,7 @@
53 53
54#define MUSIC_MAP 54#define MUSIC_MAP
55#undef AUDIO_VOICES 55#undef AUDIO_VOICES
56// Note: following undef isn't really necessary on STM32, C6_AUDIO is AVR related
56#undef C6_AUDIO 57#undef C6_AUDIO
57 58
58/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ 59/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
diff --git a/keyboards/planck/rev6/rules.mk b/keyboards/planck/rev6/rules.mk
index 49f6088c37..d101f36d65 100644
--- a/keyboards/planck/rev6/rules.mk
+++ b/keyboards/planck/rev6/rules.mk
@@ -14,7 +14,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
14NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 14NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
15BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality 15BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
16MIDI_ENABLE = no # MIDI controls 16MIDI_ENABLE = no # MIDI controls
17AUDIO_ENABLE = yes # Audio output on port C6 17AUDIO_ENABLE = yes # Audio output
18UNICODE_ENABLE = no # Unicode 18UNICODE_ENABLE = no # Unicode
19BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 19BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
20RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. 20RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
diff --git a/keyboards/preonic/keymaps/that_canadian/keymap.c b/keyboards/preonic/keymaps/that_canadian/keymap.c
index bf9e89e1f2..d1d274f293 100644
--- a/keyboards/preonic/keymaps/that_canadian/keymap.c
+++ b/keyboards/preonic/keymaps/that_canadian/keymap.c
@@ -161,7 +161,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
161 case QWERTY: 161 case QWERTY:
162 if (record->event.pressed) { 162 if (record->event.pressed) {
163 #ifdef AUDIO_ENABLE 163 #ifdef AUDIO_ENABLE
164 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 164 PLAY_SONG(tone_qwerty);
165 #endif 165 #endif
166 persistant_default_layer_set(1UL<<_QWERTY); 166 persistant_default_layer_set(1UL<<_QWERTY);
167 } 167 }
@@ -213,12 +213,12 @@ void matrix_init_user(void) {
213void startup_user() 213void startup_user()
214{ 214{
215 _delay_ms(20); // gets rid of tick 215 _delay_ms(20); // gets rid of tick
216 PLAY_NOTE_ARRAY(tone_startup, false, 0); 216 PLAY_SONG(tone_startup);
217} 217}
218 218
219void shutdown_user() 219void shutdown_user()
220{ 220{
221 PLAY_NOTE_ARRAY(tone_goodbye, false, 0); 221 PLAY_SONG(tone_goodbye);
222 _delay_ms(150); 222 _delay_ms(150);
223 stop_all_notes(); 223 stop_all_notes();
224} 224}
@@ -230,7 +230,7 @@ void music_on_user(void)
230 230
231void music_scale_user(void) 231void music_scale_user(void)
232{ 232{
233 PLAY_NOTE_ARRAY(music_scale, false, 0); 233 PLAY_SONG(music_scale);
234} 234}
235 235
236#endif 236#endif
diff --git a/keyboards/preonic/rev1/rules.mk b/keyboards/preonic/rev1/rules.mk
index 9be496ce79..45edfa0b0f 100644
--- a/keyboards/preonic/rev1/rules.mk
+++ b/keyboards/preonic/rev1/rules.mk
@@ -23,7 +23,7 @@ COMMAND_ENABLE = no # Commands for debug and configuration
23NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 23NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
24BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 24BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
25MIDI_ENABLE = no # MIDI controls 25MIDI_ENABLE = no # MIDI controls
26AUDIO_ENABLE = yes # Audio output on port C6 26AUDIO_ENABLE = yes # Audio output
27UNICODE_ENABLE = no # Unicode 27UNICODE_ENABLE = no # Unicode
28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. 29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
diff --git a/keyboards/preonic/rev2/rules.mk b/keyboards/preonic/rev2/rules.mk
index b98f9b52c8..f24c6a49b7 100644
--- a/keyboards/preonic/rev2/rules.mk
+++ b/keyboards/preonic/rev2/rules.mk
@@ -23,7 +23,7 @@ COMMAND_ENABLE = no # Commands for debug and configuration
23NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 23NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
24BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 24BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
25MIDI_ENABLE = no # MIDI controls 25MIDI_ENABLE = no # MIDI controls
26AUDIO_ENABLE = yes # Audio output on port C6 26AUDIO_ENABLE = yes # Audio output
27UNICODE_ENABLE = no # Unicode 27UNICODE_ENABLE = no # Unicode
28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. 29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
diff --git a/keyboards/preonic/rev3/config.h b/keyboards/preonic/rev3/config.h
index b5b2ced5a7..b7429f757a 100644
--- a/keyboards/preonic/rev3/config.h
+++ b/keyboards/preonic/rev3/config.h
@@ -40,6 +40,7 @@
40 40
41#define MUSIC_MAP 41#define MUSIC_MAP
42#undef AUDIO_VOICES 42#undef AUDIO_VOICES
43// Note: following undef isn't really necessary on STM32, C6_AUDIO is AVR related
43#undef C6_AUDIO 44#undef C6_AUDIO
44 45
45/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ 46/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
diff --git a/keyboards/preonic/rev3/rules.mk b/keyboards/preonic/rev3/rules.mk
index 4c5d2f2ffe..a5fc16a2e5 100644
--- a/keyboards/preonic/rev3/rules.mk
+++ b/keyboards/preonic/rev3/rules.mk
@@ -14,7 +14,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
14NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 14NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
15BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality 15BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
16MIDI_ENABLE = no # MIDI controls 16MIDI_ENABLE = no # MIDI controls
17AUDIO_ENABLE = yes # Audio output on port C6 17AUDIO_ENABLE = yes # Audio output
18UNICODE_ENABLE = no # Unicode 18UNICODE_ENABLE = no # Unicode
19BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 19BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
20RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. 20RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
diff --git a/keyboards/rgbkb/zen/rev1/keymaps/default/keymap.c b/keyboards/rgbkb/zen/rev1/keymaps/default/keymap.c
index 23c4168f2b..4516f62e8d 100644
--- a/keyboards/rgbkb/zen/rev1/keymaps/default/keymap.c
+++ b/keyboards/rgbkb/zen/rev1/keymaps/default/keymap.c
@@ -78,7 +78,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
78 case QWERTY: 78 case QWERTY:
79 if (record->event.pressed) { 79 if (record->event.pressed) {
80 #ifdef AUDIO_ENABLE 80 #ifdef AUDIO_ENABLE
81 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 81 PLAY_SONG(tone_qwerty);
82 #endif 82 #endif
83 persistant_default_layer_set(1UL<<_QWERTY); 83 persistant_default_layer_set(1UL<<_QWERTY);
84 } 84 }
@@ -87,7 +87,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
87 //case COLEMAK: 87 //case COLEMAK:
88 //if (record->event.pressed) { 88 //if (record->event.pressed) {
89 //#ifdef AUDIO_ENABLE 89 //#ifdef AUDIO_ENABLE
90 //PLAY_NOTE_ARRAY(tone_colemak, false, 0); 90 //PLAY_SONG(tone_colemak);
91 //#endif 91 //#endif
92 //persistant_default_layer_set(1UL<<_COLEMAK); 92 //persistant_default_layer_set(1UL<<_COLEMAK);
93 //} 93 //}
diff --git a/keyboards/rgbkb/zen/rev1/keymaps/jwlawrence/keymap.c b/keyboards/rgbkb/zen/rev1/keymaps/jwlawrence/keymap.c
index 13edd0db8d..bca4684dc5 100644
--- a/keyboards/rgbkb/zen/rev1/keymaps/jwlawrence/keymap.c
+++ b/keyboards/rgbkb/zen/rev1/keymaps/jwlawrence/keymap.c
@@ -77,7 +77,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
77 case QWERTY: 77 case QWERTY:
78 if (record->event.pressed) { 78 if (record->event.pressed) {
79 #ifdef AUDIO_ENABLE 79 #ifdef AUDIO_ENABLE
80 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 80 PLAY_SONG(tone_qwerty);
81 #endif 81 #endif
82 persistant_default_layer_set(1UL<<_QWERTY); 82 persistant_default_layer_set(1UL<<_QWERTY);
83 } 83 }
@@ -86,7 +86,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
86 //case COLEMAK: 86 //case COLEMAK:
87 //if (record->event.pressed) { 87 //if (record->event.pressed) {
88 //#ifdef AUDIO_ENABLE 88 //#ifdef AUDIO_ENABLE
89 //PLAY_NOTE_ARRAY(tone_colemak, false, 0); 89 //PLAY_SONG(tone_colemak);
90 //#endif 90 //#endif
91 //persistant_default_layer_set(1UL<<_COLEMAK); 91 //persistant_default_layer_set(1UL<<_COLEMAK);
92 //} 92 //}
diff --git a/keyboards/scarletbandana/rules.mk b/keyboards/scarletbandana/rules.mk
index ff2b9a258c..32ff3a078b 100644
--- a/keyboards/scarletbandana/rules.mk
+++ b/keyboards/scarletbandana/rules.mk
@@ -26,7 +26,7 @@ NKRO_ENABLE = no # USB Nkey Rollover
26MIDI_ENABLE = no # MIDI support 26MIDI_ENABLE = no # MIDI support
27UNICODE_ENABLE = no # Unicode 27UNICODE_ENABLE = no # Unicode
28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
29AUDIO_ENABLE = yes # Audio output on port C6 29AUDIO_ENABLE = yes # Audio output
30RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. 30RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
31FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 31FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
32BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality, also set ISSI_ENABLE below for Miera 32BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality, also set ISSI_ENABLE below for Miera
diff --git a/keyboards/sck/neiso/rules.mk b/keyboards/sck/neiso/rules.mk
index 221054879c..990edc9df2 100644
--- a/keyboards/sck/neiso/rules.mk
+++ b/keyboards/sck/neiso/rules.mk
@@ -28,6 +28,6 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
28MIDI_ENABLE = no # MIDI support 28MIDI_ENABLE = no # MIDI support
29UNICODE_ENABLE = no # Unicode 29UNICODE_ENABLE = no # Unicode
30BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 30BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
31AUDIO_ENABLE = yes # Audio output on port C6 31AUDIO_ENABLE = no # Audio output
32FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 32FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
33HD44780_ENABLE = no # Enable support for HD44780 based LCDs 33HD44780_ENABLE = no # Enable support for HD44780 based LCDs
diff --git a/keyboards/sentraq/s60_x/keymaps/ansi_qwertz/keymap.c b/keyboards/sentraq/s60_x/keymaps/ansi_qwertz/keymap.c
index cfeda0a245..2bfe82977c 100644
--- a/keyboards/sentraq/s60_x/keymaps/ansi_qwertz/keymap.c
+++ b/keyboards/sentraq/s60_x/keymaps/ansi_qwertz/keymap.c
@@ -29,14 +29,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
29//Function 29//Function
30//Mute microphone 30//Mute microphone
31#define KC_SPACEFN LT(2, KC_SPACE) 31#define KC_SPACEFN LT(2, KC_SPACE)
32#define KC_OSLS KC_FN3 32#define KC_OSLS OSM(MOD_LSFT)
33#define KC_GMLK KC_FN1 33#define KC_GMLK TG(1)
34#define KC_FUNC MO(2) 34#define KC_FUNC MO(2)
35#define MICMUTE RCTL(KC_LCTL) 35#define MICMUTE RCTL(KC_LCTL)
36 36
37enum function_codes { 37enum function_codes {
38 F_OSLS = 3,
39 F_GMLK = 1,
40}; 38};
41 39
42enum layer_names { 40enum layer_names {
@@ -146,14 +144,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
146 ), 144 ),
147}; 145};
148 146
149/*
150* Fn action definition
151*/
152const uint16_t PROGMEM fn_actions[] = {
153 [F_GMLK] = ACTION_LAYER_TOGGLE(1), // Disable SpaceFn and Oneshot Shift
154 [F_OSLS] = ACTION_MODS_ONESHOT(MOD_LSFT) // Oneshot Leftshift
155};
156
157void matrix_init_user(void) { 147void matrix_init_user(void) {
158 148
159} 149}
diff --git a/keyboards/sentraq/s60_x/keymaps/hasu/keymap.c b/keyboards/sentraq/s60_x/keymaps/hasu/keymap.c
index c72c37d9d3..cba307ba49 100644
--- a/keyboards/sentraq/s60_x/keymaps/hasu/keymap.c
+++ b/keyboards/sentraq/s60_x/keymaps/hasu/keymap.c
@@ -7,6 +7,13 @@
7#define KC_LT5 LT(5, KC_SLSH) 7#define KC_LT5 LT(5, KC_SLSH)
8#define KC_LT6 LT(6, KC_SCLN) 8#define KC_LT6 LT(6, KC_SCLN)
9 9
10#define KC_MTRS MT(MOD_RSFT, KC_GRV)
11
12#define KC_DF0 DF(0)
13#define KC_DF1 DF(1)
14#define KC_DF2 DF(2)
15#define KC_DF3 DF(3)
16
10/* 17/*
11 * Hasu 18 * Hasu
12 */ 19 */
@@ -28,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
28 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, NO, BSPC, \ 35 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, NO, BSPC, \
29 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, \ 36 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, \
30 CAPS, A, S, D, F, G, H, J, K, L, LT6, QUOT, NO, ENT, \ 37 CAPS, A, S, D, F, G, H, J, K, L, LT6, QUOT, NO, ENT, \
31 LSFT, NO, Z, X, C, V, B, N, M, COMM, DOT, LT5, NO, FN9, NO, \ 38 LSFT, NO, Z, X, C, V, B, N, M, COMM, DOT, LT5, NO, MTRS, NO, \
32 LCTL, LGUI, LALT, SPC, RALT, MO6, MO6, MO4), 39 LCTL, LGUI, LALT, SPC, RALT, MO6, MO6, MO4),
33 /* Keymap 1: colemak 40 /* Keymap 1: colemak
34┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┠41┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────â”
@@ -165,20 +172,9 @@ Lw: set Workman layout
165 172
166 */ 173 */
167 LAYOUT_kc( 174 LAYOUT_kc(
168 FN5, FN6, FN7, FN8, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ 175 DF0, DF1, DF2, DF3, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
169 TRNS, FN5, FN8, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ 176 TRNS, DF0, DF3, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
170 TRNS, TRNS, TRNS, FN7, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ 177 TRNS, TRNS, TRNS, DF2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
171 TRNS, TRNS, TRNS, TRNS, FN6, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ 178 TRNS, TRNS, TRNS, TRNS, DF1, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
172 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), 179 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS),
173}; 180};
174
175/*
176 * Fn action definition
177 */
178const uint16_t PROGMEM fn_actions[] = {
179 [5] = ACTION_DEFAULT_LAYER_SET(0), // set qwerty layout
180 [6] = ACTION_DEFAULT_LAYER_SET(1), // set colemak layout
181 [7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout
182 [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout
183 [9] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRV),
184};
diff --git a/keyboards/sentraq/s60_x/keymaps/jpec/keymap.c b/keyboards/sentraq/s60_x/keymaps/jpec/keymap.c
index 0145540198..24182ad20a 100644
--- a/keyboards/sentraq/s60_x/keymaps/jpec/keymap.c
+++ b/keyboards/sentraq/s60_x/keymaps/jpec/keymap.c
@@ -18,6 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18 18
19#define KC_MO1 MO(1) 19#define KC_MO1 MO(1)
20#define KC_SPFN LT(1, KC_SPC) 20#define KC_SPFN LT(1, KC_SPC)
21#define KC_SDEL S(KC_DEL)
22#define KC_CINS C(KC_INS)
23#define KC_SINS S(KC_INS)
21 24
22const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 25const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
23 /* Layout 0: Default Layer 26 /* Layout 0: Default Layer
@@ -57,20 +60,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
57 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, DEL, \ 60 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, DEL, \
58 TRNS, MPRV, MPLY, MNXT, MSTP, TRNS, TRNS, PGUP, UP, PGDN, TRNS, SLCK, PAUS, INS, \ 61 TRNS, MPRV, MPLY, MNXT, MSTP, TRNS, TRNS, PGUP, UP, PGDN, TRNS, SLCK, PAUS, INS, \
59 TRNS, VOLD, MUTE, VOLU, TRNS, TRNS, HOME, LEFT, DOWN, RGHT, END, TRNS, TRNS, PENT, \ 62 TRNS, VOLD, MUTE, VOLU, TRNS, TRNS, HOME, LEFT, DOWN, RGHT, END, TRNS, TRNS, PENT, \
60 TRNS, TRNS, PSCR, FN2, FN3, FN4, CALC, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CAPS, TRNS, \ 63 TRNS, TRNS, PSCR, SDEL, CINS, SINS, CALC, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CAPS, TRNS, \
61 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), 64 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS),
62}; 65};
63 66
64/*
65* Fn action definition
66*/
67const uint16_t PROGMEM fn_actions[] = {
68 [2] = ACTION_MODS_KEY(MOD_LSFT, KC_DEL), /* Cut */
69 [3] = ACTION_MODS_KEY(MOD_LCTL, KC_INS), /* Copy */
70 [4] = ACTION_MODS_KEY(MOD_LSFT, KC_INS), /* Paste */
71};
72
73
74void matrix_init_user(void) { 67void matrix_init_user(void) {
75 68
76} 69}
diff --git a/keyboards/sentraq/s60_x/keymaps/poker/keymap.c b/keyboards/sentraq/s60_x/keymaps/poker/keymap.c
index 3b38ed501b..6286f24371 100644
--- a/keyboards/sentraq/s60_x/keymaps/poker/keymap.c
+++ b/keyboards/sentraq/s60_x/keymaps/poker/keymap.c
@@ -3,6 +3,16 @@
3#define KC_MO6 MO(6) 3#define KC_MO6 MO(6)
4#define KC_MO7 MO(7) 4#define KC_MO7 MO(7)
5 5
6#define KC_DF0 DF(0)
7#define KC_DF1 DF(1)
8#define KC_DF2 DF(2)
9#define KC_DF3 DF(3)
10
11#define KC_TG4 TG(4)
12#define KC_TG5 TG(5)
13
14#define KC_CSES C(S(KC_ESC))
15
6const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 16const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7 /* 0: qwerty 17 /* 0: qwerty
8┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┠18┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────â”
@@ -139,10 +149,10 @@ FnS: toggle Arrow overlay
139 */ 149 */
140 LAYOUT_kc( 150 LAYOUT_kc(
141 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ 151 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \
142 TRNS, FN2, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, MO7, \ 152 TRNS, TG5, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, MO7, \
143 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN3, END, TRNS, TRNS, \ 153 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \
144 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \ 154 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \
145 TRNS, TRNS, TRNS, FN1, TRNS, TRNS, TRNS, TRNS), 155 TRNS, TRNS, TRNS, TG4, TRNS, TRNS, TRNS, TRNS),
146 /* 7: Layout selector 156 /* 7: Layout selector
147┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┠157┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────â”
148│ Lq │ Lc │ Ld │ Lw │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ 158│ Lq │ Lc │ Ld │ Lw │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │
@@ -163,19 +173,9 @@ Lw: set Workman layout
163 173
164 */ 174 */
165 LAYOUT_kc( 175 LAYOUT_kc(
166 FN5, FN6, FN7, FN8, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ 176 DF0, DF1, DF2, DF3, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
167 TRNS, FN5, FN8, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ 177 TRNS, DF0, DF3, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
168 TRNS, TRNS, TRNS, FN7, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ 178 TRNS, TRNS, TRNS, DF2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
169 TRNS, TRNS, TRNS, TRNS, FN6, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ 179 TRNS, TRNS, TRNS, TRNS, DF1, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
170 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), 180 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS),
171}; 181};
172const uint16_t PROGMEM fn_actions[] = {
173 /* Poker Layout */
174 [1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay
175 [2] = ACTION_LAYER_TOGGLE(5), // toggle Esc overlay
176 [3] = ACTION_MODS_KEY(MOD_RCTL|MOD_RSFT, KC_ESC), // Task(RControl,RShift+Esc)
177 [5] = ACTION_DEFAULT_LAYER_SET(0), // set qwerty layout
178 [6] = ACTION_DEFAULT_LAYER_SET(1), // set colemak layout
179 [7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout
180 [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout
181};
diff --git a/keyboards/sentraq/s60_x/keymaps/poker_bit/keymap.c b/keyboards/sentraq/s60_x/keymaps/poker_bit/keymap.c
index d66cc93c3a..a4ab412ee2 100644
--- a/keyboards/sentraq/s60_x/keymaps/poker_bit/keymap.c
+++ b/keyboards/sentraq/s60_x/keymaps/poker_bit/keymap.c
@@ -1,5 +1,9 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2 2
3#define KC_TG5 TG(5)
4#define KC_TG6 TG(6)
5#define KC_CSES C(S(KC_ESC))
6
3// Poker fix with toggle and bit operation 7// Poker fix with toggle and bit operation
4// Fn + Esc = ` 8// Fn + Esc = `
5// Fn + {left, down, up, right} = {home, pgdown, pgup, end} 9// Fn + {left, down, up, right} = {home, pgdown, pgup, end}
@@ -38,10 +42,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 */ 42 */
39 [4] = LAYOUT_kc( 43 [4] = LAYOUT_kc(
40 TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ 44 TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \
41 CAPS, FN2, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ 45 CAPS, TG6, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \
42 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN4, END, TRNS, TRNS, \ 46 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \
43 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \ 47 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \
44 TRNS, TRNS, TRNS, FN1, TRNS, TRNS, TRNS, TRNS), 48 TRNS, TRNS, TRNS, TG5, TRNS, TRNS, TRNS, TRNS),
45 /* 5: Poker with Arrow 49 /* 5: Poker with Arrow
46┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┠50┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────â”
47│ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ 51│ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │
@@ -103,8 +107,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
103const uint16_t PROGMEM fn_actions[] = { 107const uint16_t PROGMEM fn_actions[] = {
104 /* Poker Layout */ 108 /* Poker Layout */
105 [0] = ACTION_LAYER_BIT_XOR(1, 0b0101, ON_BOTH), // Poker Fn(with fix for Esc) 109 [0] = ACTION_LAYER_BIT_XOR(1, 0b0101, ON_BOTH), // Poker Fn(with fix for Esc)
106 [1] = ACTION_LAYER_TOGGLE(5), // Poker Arrow toggle
107 [2] = ACTION_LAYER_TOGGLE(6), // Poker Esc toggle
108 [3] = ACTION_LAYER_BIT_XOR(1, 0b1101, ON_BOTH), // Poker Fn(with fix for Arrow) 110 [3] = ACTION_LAYER_BIT_XOR(1, 0b1101, ON_BOTH), // Poker Fn(with fix for Arrow)
109 [4] = ACTION_MODS_KEY(MOD_RCTL|MOD_RSFT, KC_ESC), // FN3 Task(RControl,RShift+Esc)
110}; 111};
diff --git a/keyboards/sentraq/s60_x/keymaps/poker_set/keymap.c b/keyboards/sentraq/s60_x/keymaps/poker_set/keymap.c
index 3f63924679..64678cd56c 100644
--- a/keyboards/sentraq/s60_x/keymaps/poker_set/keymap.c
+++ b/keyboards/sentraq/s60_x/keymaps/poker_set/keymap.c
@@ -1,5 +1,7 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2 2
3#define KC_CSES C(S(KC_ESC))
4
3// Poker fix with set(state transition) 5// Poker fix with set(state transition)
4// Fn + Esc = ` 6// Fn + Esc = `
5// Fn + {left, down, up, right} = {home, pgdown, pgup, end} 7// Fn + {left, down, up, right} = {home, pgdown, pgup, end}
@@ -96,7 +98,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
96 LAYOUT_kc( 98 LAYOUT_kc(
97 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ 99 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \
98 TRNS, FN6, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ 100 TRNS, FN6, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \
99 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN8, END, TRNS, TRNS, \ 101 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \
100 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \ 102 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \
101 TRNS, TRNS, TRNS, FN5, FN4, TRNS, TRNS, TRNS), 103 TRNS, TRNS, TRNS, FN5, FN4, TRNS, TRNS, TRNS),
102 /* 5: Poker Fn'd arrow 104 /* 5: Poker Fn'd arrow
@@ -115,7 +117,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
115 LAYOUT_kc( 117 LAYOUT_kc(
116 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ 118 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \
117 TRNS, FN7, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ 119 TRNS, FN7, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \
118 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN8, END, TRNS, TRNS, \ 120 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \
119 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, PGUP, TRNS, \ 121 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, PGUP, TRNS, \
120 TRNS, TRNS, TRNS, FN4, FN5, HOME, PGDN, END), 122 TRNS, TRNS, TRNS, FN4, FN5, HOME, PGDN, END),
121 /* 6: Poker Fn'd Esc 123 /* 6: Poker Fn'd Esc
@@ -134,7 +136,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
134 LAYOUT_kc( 136 LAYOUT_kc(
135 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ 137 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \
136 TRNS, FN4, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ 138 TRNS, FN4, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \
137 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN8, END, TRNS, TRNS, \ 139 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \
138 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \ 140 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \
139 TRNS, TRNS, TRNS, FN7, FN6, TRNS, TRNS, TRNS), 141 TRNS, TRNS, TRNS, FN7, FN6, TRNS, TRNS, TRNS),
140 /* 7: Poker Fn'd Arrow + Esc 142 /* 7: Poker Fn'd Arrow + Esc
@@ -153,7 +155,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
153 LAYOUT_kc( 155 LAYOUT_kc(
154 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ 156 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \
155 TRNS, FN5, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ 157 TRNS, FN5, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \
156 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN8, END, TRNS, TRNS, \ 158 TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \
157 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, PGUP, TRNS, \ 159 TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, PGUP, TRNS, \
158 TRNS, TRNS, TRNS, FN6, FN7, HOME, PGDN, END), 160 TRNS, TRNS, TRNS, FN6, FN7, HOME, PGDN, END),
159}; 161};
@@ -173,6 +175,4 @@ const uint16_t PROGMEM fn_actions[] = {
173 [5] = ACTION_LAYER_SET(1, ON_RELEASE), // FN5 move to arrow when release 175 [5] = ACTION_LAYER_SET(1, ON_RELEASE), // FN5 move to arrow when release
174 [6] = ACTION_LAYER_SET(2, ON_RELEASE), // FN6 move to Esc when release 176 [6] = ACTION_LAYER_SET(2, ON_RELEASE), // FN6 move to Esc when release
175 [7] = ACTION_LAYER_SET(3, ON_RELEASE), // FN7 move to arrow + Esc when release 177 [7] = ACTION_LAYER_SET(3, ON_RELEASE), // FN7 move to arrow + Esc when release
176
177 [8] = ACTION_MODS_KEY(MOD_RCTL|MOD_RSFT, KC_ESC), // FN8 Task(RControl,RShift+Esc)
178}; 178};
diff --git a/keyboards/sentraq/s60_x/keymaps/spacefn/keymap.c b/keyboards/sentraq/s60_x/keymaps/spacefn/keymap.c
index ee7ec6cd68..6ef273d1e3 100644
--- a/keyboards/sentraq/s60_x/keymaps/spacefn/keymap.c
+++ b/keyboards/sentraq/s60_x/keymaps/spacefn/keymap.c
@@ -44,13 +44,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
44 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, DEL, \ 44 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, DEL, \
45 TRNS, TRNS, TRNS, ESC, TRNS, TRNS, TRNS, HOME, UP, END, PSCR, SLCK, PAUS, INS, \ 45 TRNS, TRNS, TRNS, ESC, TRNS, TRNS, TRNS, HOME, UP, END, PSCR, SLCK, PAUS, INS, \
46 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, PGUP, LEFT, DOWN, RGHT, TRNS, TRNS, TRNS, TRNS, \ 46 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, PGUP, LEFT, DOWN, RGHT, TRNS, TRNS, TRNS, TRNS, \
47 TRNS, TRNS, TRNS, TRNS, TRNS, SPC, PGDN, GRV, FN1, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ 47 TRNS, TRNS, TRNS, TRNS, TRNS, SPC, PGDN, GRV, TILD, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
48 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), 48 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS),
49}; 49};
50
51/*
52 * Fn action definition
53 */
54const uint16_t PROGMEM fn_actions[] = {
55 [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
56};
diff --git a/keyboards/sentraq/s65_x/keymaps/kelorean/keymap.c b/keyboards/sentraq/s65_x/keymaps/kelorean/keymap.c
index d5b4937aa5..8e1496bc9c 100644
--- a/keyboards/sentraq/s65_x/keymaps/kelorean/keymap.c
+++ b/keyboards/sentraq/s65_x/keymaps/kelorean/keymap.c
@@ -112,9 +112,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
112 112
113 [_FL] = LAYOUT_65_ansi( 113 [_FL] = LAYOUT_65_ansi(
114 KC_GRAVE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, \ 114 KC_GRAVE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, \
115 _______, F(3), KC_UP, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, \ 115 _______, TG(_AL), KC_UP, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, \
116 _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______, _______, _______, \ 116 _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______, _______, _______, \
117 _______, F(5), _______, F(1), F(2), _______, _______, _______, KC_HOME, KC_END, _______, _______, KC_VOLU, _______, \ 117 _______, TG(_UL), _______, TG(_CM), TG(_DV), _______, _______, _______, KC_HOME, KC_END, _______, _______, KC_VOLU, _______, \
118 _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_MPLY), 118 _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_MPLY),
119 119
120 /* 5: Locking layer for controlling the underglow 120 /* 5: Locking layer for controlling the underglow
@@ -138,11 +138,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
138 _______, _______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, _______, \ 138 _______, _______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, _______, \
139 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), 139 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
140}; 140};
141
142const uint16_t PROGMEM fn_actions[] = {
143 [1] = ACTION_LAYER_TOGGLE(_CM), //Toggle Colemak Layer overlay
144 [2] = ACTION_LAYER_TOGGLE(_DV), // Toggle Dvorak Layer overlay
145 [3] = ACTION_LAYER_TOGGLE(_AL), // Toggle Arrow Layer overlay
146 [5] = ACTION_LAYER_TOGGLE(_UL), // Toggle Underglow Layer overlay
147
148};
diff --git a/keyboards/sentraq/s65_x/keymaps/nall/keymap.c b/keyboards/sentraq/s65_x/keymaps/nall/keymap.c
index 093070cb4b..8589a797fe 100644
--- a/keyboards/sentraq/s65_x/keymaps/nall/keymap.c
+++ b/keyboards/sentraq/s65_x/keymaps/nall/keymap.c
@@ -66,9 +66,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
66 66
67 [_FL] = LAYOUT_65_ansi( 67 [_FL] = LAYOUT_65_ansi(
68 KC_GRAVE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, \ 68 KC_GRAVE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, \
69 KC_TRNS, F(1), KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS, \ 69 KC_TRNS, TG(_AL), KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS, \
70 KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ 70 KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
71 KC_TRNS, F(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_END, KC_TRNS, KC_TRNS, KC_VOLU, KC_TRNS, \ 71 KC_TRNS, TG(_UL), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_END, KC_TRNS, KC_TRNS, KC_VOLU, KC_TRNS, \
72 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_MPLY), 72 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_MPLY),
73 73
74 /* 3: Locking layer for controlling the underglow 74 /* 3: Locking layer for controlling the underglow
@@ -92,9 +92,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
92 KC_TRNS, KC_TRNS, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ 92 KC_TRNS, KC_TRNS, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
93 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 93 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
94}; 94};
95
96const uint16_t PROGMEM fn_actions[] = {
97 [1] = ACTION_LAYER_TOGGLE(_AL), // Toggle Arrow Layer overlay
98 [3] = ACTION_LAYER_TOGGLE(_UL), // Toggle Underglow Layer overlay
99};
100
diff --git a/keyboards/2_milk/2_milk.c b/keyboards/spaceman/2_milk/2_milk.c
index 96071c2ad5..96071c2ad5 100644
--- a/keyboards/2_milk/2_milk.c
+++ b/keyboards/spaceman/2_milk/2_milk.c
diff --git a/keyboards/2_milk/2_milk.h b/keyboards/spaceman/2_milk/2_milk.h
index 7d90d2064f..7d90d2064f 100644
--- a/keyboards/2_milk/2_milk.h
+++ b/keyboards/spaceman/2_milk/2_milk.h
diff --git a/keyboards/2_milk/config.h b/keyboards/spaceman/2_milk/config.h
index e9a104117b..49211535d0 100644
--- a/keyboards/2_milk/config.h
+++ b/keyboards/spaceman/2_milk/config.h
@@ -20,7 +20,7 @@
20#define VENDOR_ID 0xFEED 20#define VENDOR_ID 0xFEED
21#define PRODUCT_ID 0xB195 21#define PRODUCT_ID 0xB195
22#define DEVICE_VER 0x0001 22#define DEVICE_VER 0x0001
23#define MANUFACTURER rionlion100 23#define MANUFACTURER Spaceman
24#define PRODUCT 2% Milk 24#define PRODUCT 2% Milk
25#define DESCRIPTION A milk themed 2% Keyboard 25#define DESCRIPTION A milk themed 2% Keyboard
26 26
diff --git a/keyboards/2_milk/info.json b/keyboards/spaceman/2_milk/info.json
index 6dc4eeaf8b..6c2bd78b28 100644
--- a/keyboards/2_milk/info.json
+++ b/keyboards/spaceman/2_milk/info.json
@@ -2,7 +2,7 @@
2 "keyboard_name": "2% Milk", 2 "keyboard_name": "2% Milk",
3 "keyboard_folder": "2_milk", 3 "keyboard_folder": "2_milk",
4 "url": "", 4 "url": "",
5 "maintainer": "rionlion100 (Spaceman)", 5 "maintainer": "Spaceman",
6 "width": 1, 6 "width": 1,
7 "height": 2, 7 "height": 2,
8 "layouts": { 8 "layouts": {
diff --git a/keyboards/2_milk/keymaps/binary/keymap.c b/keyboards/spaceman/2_milk/keymaps/binary/keymap.c
index c8df8e9ff0..c8df8e9ff0 100644
--- a/keyboards/2_milk/keymaps/binary/keymap.c
+++ b/keyboards/spaceman/2_milk/keymaps/binary/keymap.c
diff --git a/keyboards/2_milk/keymaps/binary/readme.md b/keyboards/spaceman/2_milk/keymaps/binary/readme.md
index 5ebcbd3e58..5ebcbd3e58 100644
--- a/keyboards/2_milk/keymaps/binary/readme.md
+++ b/keyboards/spaceman/2_milk/keymaps/binary/readme.md
diff --git a/keyboards/2_milk/keymaps/copypasta/keymap.c b/keyboards/spaceman/2_milk/keymaps/copypasta/keymap.c
index c82a6ff216..c82a6ff216 100644
--- a/keyboards/2_milk/keymaps/copypasta/keymap.c
+++ b/keyboards/spaceman/2_milk/keymaps/copypasta/keymap.c
diff --git a/keyboards/2_milk/keymaps/copypasta/readme.md b/keyboards/spaceman/2_milk/keymaps/copypasta/readme.md
index 6c2f4e8fbf..6c2f4e8fbf 100644
--- a/keyboards/2_milk/keymaps/copypasta/readme.md
+++ b/keyboards/spaceman/2_milk/keymaps/copypasta/readme.md
diff --git a/keyboards/2_milk/keymaps/default/keymap.c b/keyboards/spaceman/2_milk/keymaps/default/keymap.c
index 1f327eee9a..1f327eee9a 100644
--- a/keyboards/2_milk/keymaps/default/keymap.c
+++ b/keyboards/spaceman/2_milk/keymaps/default/keymap.c
diff --git a/keyboards/2_milk/keymaps/default/readme.md b/keyboards/spaceman/2_milk/keymaps/default/readme.md
index 4482bce34a..4482bce34a 100644
--- a/keyboards/2_milk/keymaps/default/readme.md
+++ b/keyboards/spaceman/2_milk/keymaps/default/readme.md
diff --git a/keyboards/2_milk/keymaps/emoji/config.h b/keyboards/spaceman/2_milk/keymaps/emoji/config.h
index 90e4d63102..90e4d63102 100644
--- a/keyboards/2_milk/keymaps/emoji/config.h
+++ b/keyboards/spaceman/2_milk/keymaps/emoji/config.h
diff --git a/keyboards/2_milk/keymaps/emoji/keymap.c b/keyboards/spaceman/2_milk/keymaps/emoji/keymap.c
index 024a6a054b..024a6a054b 100644
--- a/keyboards/2_milk/keymaps/emoji/keymap.c
+++ b/keyboards/spaceman/2_milk/keymaps/emoji/keymap.c
diff --git a/keyboards/2_milk/keymaps/emoji/readme.md b/keyboards/spaceman/2_milk/keymaps/emoji/readme.md
index 1d5a08730d..1d5a08730d 100644
--- a/keyboards/2_milk/keymaps/emoji/readme.md
+++ b/keyboards/spaceman/2_milk/keymaps/emoji/readme.md
diff --git a/keyboards/2_milk/keymaps/emoji/rules.mk b/keyboards/spaceman/2_milk/keymaps/emoji/rules.mk
index 7a64eb9023..7a64eb9023 100644
--- a/keyboards/2_milk/keymaps/emoji/rules.mk
+++ b/keyboards/spaceman/2_milk/keymaps/emoji/rules.mk
diff --git a/keyboards/2_milk/keymaps/excessbread/keymap.c b/keyboards/spaceman/2_milk/keymaps/excessbread/keymap.c
index a01b47f271..a01b47f271 100644
--- a/keyboards/2_milk/keymaps/excessbread/keymap.c
+++ b/keyboards/spaceman/2_milk/keymaps/excessbread/keymap.c
diff --git a/keyboards/2_milk/keymaps/excessbread/readme.md b/keyboards/spaceman/2_milk/keymaps/excessbread/readme.md
index a6535e62cf..a6535e62cf 100644
--- a/keyboards/2_milk/keymaps/excessbread/readme.md
+++ b/keyboards/spaceman/2_milk/keymaps/excessbread/readme.md
diff --git a/keyboards/2_milk/keymaps/mikethetiger/keymap.c b/keyboards/spaceman/2_milk/keymaps/mikethetiger/keymap.c
index 20e2292f08..20e2292f08 100644
--- a/keyboards/2_milk/keymaps/mikethetiger/keymap.c
+++ b/keyboards/spaceman/2_milk/keymaps/mikethetiger/keymap.c
diff --git a/keyboards/2_milk/keymaps/mikethetiger/readme.md b/keyboards/spaceman/2_milk/keymaps/mikethetiger/readme.md
index 677732b057..677732b057 100644
--- a/keyboards/2_milk/keymaps/mikethetiger/readme.md
+++ b/keyboards/spaceman/2_milk/keymaps/mikethetiger/readme.md
diff --git a/keyboards/2_milk/keymaps/mikethetiger/rules.mk b/keyboards/spaceman/2_milk/keymaps/mikethetiger/rules.mk
index b5f038ef23..b5f038ef23 100644
--- a/keyboards/2_milk/keymaps/mikethetiger/rules.mk
+++ b/keyboards/spaceman/2_milk/keymaps/mikethetiger/rules.mk
diff --git a/keyboards/2_milk/keymaps/mouse/keymap.c b/keyboards/spaceman/2_milk/keymaps/mouse/keymap.c
index a8ba44fb46..a8ba44fb46 100644
--- a/keyboards/2_milk/keymaps/mouse/keymap.c
+++ b/keyboards/spaceman/2_milk/keymaps/mouse/keymap.c
diff --git a/keyboards/2_milk/keymaps/mouse/readme.md b/keyboards/spaceman/2_milk/keymaps/mouse/readme.md
index 8ecb99eddb..8ecb99eddb 100644
--- a/keyboards/2_milk/keymaps/mouse/readme.md
+++ b/keyboards/spaceman/2_milk/keymaps/mouse/readme.md
diff --git a/keyboards/2_milk/readme.md b/keyboards/spaceman/2_milk/readme.md
index f3a85458ce..6745aa65c8 100644
--- a/keyboards/2_milk/readme.md
+++ b/keyboards/spaceman/2_milk/readme.md
@@ -4,12 +4,12 @@
4 4
5A 2% Meme board themed around a milk carton 5A 2% Meme board themed around a milk carton
6 6
7Keyboard Maintainer: Spaceman AKA:[Rionlion100](https://github.com/rionlion100) 7Keyboard Maintainer: [Spaceman](https://github.com/Spaceman)
8Hardware Availability: [Open Source](https://github.com/Rionlion100/Spaceboards/tree/master/Keyboards/2%25%20Milk) 8Hardware Availability: [Open Source](https://github.com/Spaceman/Spaceboards/tree/master/Keyboards/2%25%20Milk)
9 9
10Make example for this keyboard (after setting up your build environment): 10Make example for this keyboard (after setting up your build environment):
11 11
12 make 2_milk:default 12 make spaceman/2_milk:default
13 13
14See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). 14See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
15 15
diff --git a/keyboards/2_milk/rules.mk b/keyboards/spaceman/2_milk/rules.mk
index 4e6c5f7039..4e6c5f7039 100644
--- a/keyboards/2_milk/rules.mk
+++ b/keyboards/spaceman/2_milk/rules.mk
diff --git a/keyboards/pancake/config.h b/keyboards/spaceman/pancake/config.h
index 5a01a572e4..5a01a572e4 100644
--- a/keyboards/pancake/config.h
+++ b/keyboards/spaceman/pancake/config.h
diff --git a/keyboards/pancake/feather/config.h b/keyboards/spaceman/pancake/feather/config.h
index eac91a5ada..eac91a5ada 100644
--- a/keyboards/pancake/feather/config.h
+++ b/keyboards/spaceman/pancake/feather/config.h
diff --git a/keyboards/pancake/feather/rules.mk b/keyboards/spaceman/pancake/feather/rules.mk
index c54fbf06e0..c54fbf06e0 100644
--- a/keyboards/pancake/feather/rules.mk
+++ b/keyboards/spaceman/pancake/feather/rules.mk
diff --git a/keyboards/pancake/info.json b/keyboards/spaceman/pancake/info.json
index 6d2b2a9bb4..9a21f09e18 100644
--- a/keyboards/pancake/info.json
+++ b/keyboards/spaceman/pancake/info.json
@@ -2,7 +2,7 @@
2 "keyboard_name": "Pancake", 2 "keyboard_name": "Pancake",
3 "keyboard_folder": "Pancake", 3 "keyboard_folder": "Pancake",
4 "url": "", 4 "url": "",
5 "maintainer": "rionlion100 (Spaceman)", 5 "maintainer": "Spaceman",
6 "width": 12, 6 "width": 12,
7 "height": 4, 7 "height": 4,
8 "layouts": { 8 "layouts": {
diff --git a/keyboards/pancake/keymaps/default/keymap.c b/keyboards/spaceman/pancake/keymaps/default/keymap.c
index cebc6fccba..cebc6fccba 100644
--- a/keyboards/pancake/keymaps/default/keymap.c
+++ b/keyboards/spaceman/pancake/keymaps/default/keymap.c
diff --git a/keyboards/spaceman/pancake/keymaps/default/readme.md b/keyboards/spaceman/pancake/keymaps/default/readme.md
new file mode 100644
index 0000000000..7eb8cc6d8d
--- /dev/null
+++ b/keyboards/spaceman/pancake/keymaps/default/readme.md
@@ -0,0 +1,3 @@
1# Default keymap for Pancake
2
3designed by: Spaceman
diff --git a/keyboards/pancake/pancake.c b/keyboards/spaceman/pancake/pancake.c
index d77dbfbe01..d77dbfbe01 100644
--- a/keyboards/pancake/pancake.c
+++ b/keyboards/spaceman/pancake/pancake.c
diff --git a/keyboards/pancake/pancake.h b/keyboards/spaceman/pancake/pancake.h
index 312d789b42..312d789b42 100644
--- a/keyboards/pancake/pancake.h
+++ b/keyboards/spaceman/pancake/pancake.h
diff --git a/keyboards/pancake/promicro/config.h b/keyboards/spaceman/pancake/promicro/config.h
index ee02bff2b8..ee02bff2b8 100644
--- a/keyboards/pancake/promicro/config.h
+++ b/keyboards/spaceman/pancake/promicro/config.h
diff --git a/keyboards/pancake/promicro/rules.mk b/keyboards/spaceman/pancake/promicro/rules.mk
index 6ed9e88e99..6ed9e88e99 100644
--- a/keyboards/pancake/promicro/rules.mk
+++ b/keyboards/spaceman/pancake/promicro/rules.mk
diff --git a/keyboards/pancake/readme.md b/keyboards/spaceman/pancake/readme.md
index 3e3125f4d7..34cf6382bc 100644
--- a/keyboards/pancake/readme.md
+++ b/keyboards/spaceman/pancake/readme.md
@@ -2,11 +2,11 @@
2 2
3Ortho 40% Ortho Keyboard with an option for the adafruit feather 3Ortho 40% Ortho Keyboard with an option for the adafruit feather
4 4
5Keyboard Maintainer: Spaceman AKA:[Rionlion100](https://github.com/rionlion100) 5Keyboard Maintainer: [Spaceman](https://github.com/Spaceman)
6Hardware Availability: [GB](https://geekhack.org/index.php?topic=101371.0) 6Hardware Availability: [GB](https://geekhack.org/index.php?topic=101371.0)
7 7
8Make example for this keyboard (after setting up your build environment): 8Make example for this keyboard (after setting up your build environment):
9 9
10 make pancake:default 10 make spaceman/pancake:default
11 11
12See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). 12See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/subatomic/rules.mk b/keyboards/subatomic/rules.mk
index abff350ea0..0d77351f32 100644
--- a/keyboards/subatomic/rules.mk
+++ b/keyboards/subatomic/rules.mk
@@ -23,7 +23,7 @@ COMMAND_ENABLE = no # Commands for debug and configuration
23NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 23NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
24BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 24BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
25MIDI_ENABLE = yes # MIDI controls 25MIDI_ENABLE = yes # MIDI controls
26AUDIO_ENABLE = yes # Audio output on port C6 26AUDIO_ENABLE = no # Audio output
27UNICODE_ENABLE = no # Unicode 27UNICODE_ENABLE = no # Unicode
28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. 29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
diff --git a/keyboards/the_royal/liminal/keymaps/default/keymap.c b/keyboards/the_royal/liminal/keymaps/default/keymap.c
index d9d9497453..dd98661011 100644
--- a/keyboards/the_royal/liminal/keymaps/default/keymap.c
+++ b/keyboards/the_royal/liminal/keymaps/default/keymap.c
@@ -127,7 +127,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
127 ) 127 )
128}; 128};
129 129
130uint16_t get_tapping_term(uint16_t keycode) { 130uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
131 switch (keycode) { 131 switch (keycode) {
132 case LT(_LOWER, KC_SPACE): 132 case LT(_LOWER, KC_SPACE):
133 return 160; 133 return 160;
@@ -136,7 +136,7 @@ uint16_t get_tapping_term(uint16_t keycode) {
136 default: 136 default:
137#ifndef TAPPING_TERM 137#ifndef TAPPING_TERM
138 return 200; 138 return 200;
139#else 139#else
140 return TAPPING_TERM; 140 return TAPPING_TERM;
141#endif 141#endif
142 } 142 }
diff --git a/keyboards/the_royal/liminal/keymaps/default_iso/keymap.c b/keyboards/the_royal/liminal/keymaps/default_iso/keymap.c
index 3d8debee3d..62ff2b6a5d 100644
--- a/keyboards/the_royal/liminal/keymaps/default_iso/keymap.c
+++ b/keyboards/the_royal/liminal/keymaps/default_iso/keymap.c
@@ -128,7 +128,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
128 128
129}; 129};
130 130
131uint16_t get_tapping_term(uint16_t keycode) { 131uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
132 switch (keycode) { 132 switch (keycode) {
133 case LT(_LOWER, KC_SPACE): 133 case LT(_LOWER, KC_SPACE):
134 return 160; 134 return 160;
diff --git a/keyboards/thevankeyboards/minivan/keymaps/like_jis/keymap.c b/keyboards/thevankeyboards/minivan/keymaps/like_jis/keymap.c
index 3d282e182b..509b497802 100644
--- a/keyboards/thevankeyboards/minivan/keymaps/like_jis/keymap.c
+++ b/keyboards/thevankeyboards/minivan/keymaps/like_jis/keymap.c
@@ -114,7 +114,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
114}; 114};
115 115
116#define TAPPING_LAYER_TERM 150 // Custom LT Tapping term 116#define TAPPING_LAYER_TERM 150 // Custom LT Tapping term
117uint16_t get_tapping_term(uint16_t keycode) { 117uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
118 switch (keycode) { 118 switch (keycode) {
119 case KC_BSLO: 119 case KC_BSLO:
120 return TAPPING_LAYER_TERM; 120 return TAPPING_LAYER_TERM;
diff --git a/keyboards/thevankeyboards/minivan/keymaps/mjt/keymap.c b/keyboards/thevankeyboards/minivan/keymaps/mjt/keymap.c
index 6e22e9e23a..a9d3a802dc 100644
--- a/keyboards/thevankeyboards/minivan/keymaps/mjt/keymap.c
+++ b/keyboards/thevankeyboards/minivan/keymaps/mjt/keymap.c
@@ -99,7 +99,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
99 if (record->event.pressed) { 99 if (record->event.pressed) {
100 #ifdef AUDIO_ENABLE 100 #ifdef AUDIO_ENABLE
101 stop_all_notes(); 101 stop_all_notes();
102 PLAY_NOTE_ARRAY(tone_plover, false, 0); 102 PLAY_SONG(tone_plover);
103 #endif 103 #endif
104 layer_off(_NUMSYM); 104 layer_off(_NUMSYM);
105 layer_off(_FKEYS); 105 layer_off(_FKEYS);
@@ -110,7 +110,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
110 case 7: // LAYERRESET 110 case 7: // LAYERRESET
111 if (record->event.pressed) { 111 if (record->event.pressed) {
112 #ifdef AUDIO_ENABLE 112 #ifdef AUDIO_ENABLE
113 PLAY_NOTE_ARRAY(tone_qwerty, false, 0); 113 PLAY_SONG(tone_qwerty);
114 #endif 114 #endif
115 layer_off(_NUMSYM); 115 layer_off(_NUMSYM);
116 layer_off(_FKEYS); 116 layer_off(_FKEYS);
@@ -132,7 +132,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
132 if(record->event.pressed) { 132 if(record->event.pressed) {
133 #ifdef AUDIO_ENABLE 133 #ifdef AUDIO_ENABLE
134 stop_all_notes(); 134 stop_all_notes();
135 PLAY_NOTE_ARRAY(tone_adjust, false, 0); 135 PLAY_SONG(tone_adjust);
136 #endif 136 #endif
137 layer_off(_NUMSYM); 137 layer_off(_NUMSYM);
138 layer_off(_FKEYS); 138 layer_off(_FKEYS);
@@ -166,12 +166,12 @@ void matrix_init_user(void) {
166void startup_user() 166void startup_user()
167{ 167{
168 _delay_ms(20); // gets rid of tick 168 _delay_ms(20); // gets rid of tick
169 PLAY_NOTE_ARRAY(tone_startup, false, 0); 169 PLAY_SONG(tone_startup);
170} 170}
171 171
172void shutdown_user() 172void shutdown_user()
173{ 173{
174 PLAY_NOTE_ARRAY(tone_goodbye, false, 0); 174 PLAY_SONG(tone_goodbye);
175 _delay_ms(150); 175 _delay_ms(150);
176 stop_all_notes(); 176 stop_all_notes();
177} 177}
@@ -183,6 +183,6 @@ void music_on_user(void)
183 183
184void music_scale_user(void) 184void music_scale_user(void)
185{ 185{
186 PLAY_NOTE_ARRAY(music_scale, false, 0); 186 PLAY_SONG(music_scale);
187} 187}
188#endif 188#endif
diff --git a/keyboards/thevankeyboards/roadkit/keymaps/mjt/keymap.c b/keyboards/thevankeyboards/roadkit/keymaps/mjt/keymap.c
index 18454d5649..db5f6c37c8 100644
--- a/keyboards/thevankeyboards/roadkit/keymaps/mjt/keymap.c
+++ b/keyboards/thevankeyboards/roadkit/keymaps/mjt/keymap.c
@@ -145,7 +145,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
145 case NUMPAD_LOCK: 145 case NUMPAD_LOCK:
146 if (record->event.pressed) { 146 if (record->event.pressed) {
147 #ifdef AUDIO_ENABLE 147 #ifdef AUDIO_ENABLE
148 PLAY_NOTE_ARRAY(tone_numpad, false, 0); 148 PLAY_SONG(tone_numpad);
149 #endif 149 #endif
150 persistant_default_layer_set(1UL<<_NUMPAD); 150 persistant_default_layer_set(1UL<<_NUMPAD);
151 } 151 }
@@ -154,7 +154,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
154 case NAVIGATION_LOCK: 154 case NAVIGATION_LOCK:
155 if (record->event.pressed) { 155 if (record->event.pressed) {
156 #ifdef AUDIO_ENABLE 156 #ifdef AUDIO_ENABLE
157 PLAY_NOTE_ARRAY(tone_navigation, false, 0); 157 PLAY_SONG(tone_navigation);
158 #endif 158 #endif
159 persistant_default_layer_set(1UL<<_NAVIGATION); 159 persistant_default_layer_set(1UL<<_NAVIGATION);
160 } 160 }
@@ -163,7 +163,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
163 case EXCEL_LOCK: 163 case EXCEL_LOCK:
164 if (record->event.pressed) { 164 if (record->event.pressed) {
165 #ifdef AUDIO_ENABLE 165 #ifdef AUDIO_ENABLE
166 PLAY_NOTE_ARRAY(tone_excel, false, 0); 166 PLAY_SONG(tone_excel);
167 #endif 167 #endif
168 persistant_default_layer_set(1UL<<_EXCEL); 168 persistant_default_layer_set(1UL<<_EXCEL);
169 } 169 }
diff --git a/keyboards/tkc1800/config.h b/keyboards/tkc1800/config.h
index 5ba40bb35c..9c35699c92 100644
--- a/keyboards/tkc1800/config.h
+++ b/keyboards/tkc1800/config.h
@@ -67,6 +67,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
67/* Locking resynchronize hack */ 67/* Locking resynchronize hack */
68#define LOCKING_RESYNC_ENABLE 68#define LOCKING_RESYNC_ENABLE
69 69
70#define QMK_ESC_OUTPUT A0 // usually COL
71#define QMK_ESC_INPUT F4 // usually ROW
72#define QMK_LED D2 // NumLock on TKC1800
73//#define QMK_SPEAKER C6
74
70/* 75/*
71 * Force NKRO 76 * Force NKRO
72 * 77 *
diff --git a/keyboards/tkc1800/i2c.c b/keyboards/tkc1800/i2c.c
deleted file mode 100644
index cd2b835d50..0000000000
--- a/keyboards/tkc1800/i2c.c
+++ /dev/null
@@ -1,166 +0,0 @@
1#include <util/twi.h>
2#include <avr/io.h>
3#include <stdlib.h>
4#include <avr/interrupt.h>
5#include <util/twi.h>
6#include <stdbool.h>
7#include "i2c.h"
8
9#ifdef USE_I2C
10
11// Limits the amount of we wait for any one i2c transaction.
12// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
13// 9 bits, a single transaction will take around 90μs to complete.
14//
15// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
16// poll loop takes at least 8 clock cycles to execute
17#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
18
19#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
20
21volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
22
23static volatile uint8_t slave_buffer_pos;
24static volatile bool slave_has_register_set = false;
25
26// Wait for an i2c operation to finish
27inline static
28void i2c_delay(void) {
29 uint16_t lim = 0;
30 while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
31 lim++;
32
33 // easier way, but will wait slightly longer
34 // _delay_us(100);
35}
36
37// Setup twi to run at 100kHz
38void i2c_master_init(void) {
39 // no prescaler
40 TWSR = 0;
41 // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
42 // Check datasheets for more info.
43 TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
44}
45
46// Start a transaction with the given i2c slave address. The direction of the
47// transfer is set with I2C_READ and I2C_WRITE.
48// returns: 0 => success
49// 1 => error
50uint8_t i2c_master_start(uint8_t address) {
51 TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
52
53 i2c_delay();
54
55 // check that we started successfully
56 if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
57 return 1;
58
59 // send device address
60 TWDR = address;
61 TWCR = (1<<TWINT) | (1<<TWEN);
62
63 i2c_delay();
64
65 if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
66 return 1; // slave did not acknowledge
67 else
68 return 0; // success
69}
70
71
72// Finish the i2c transaction.
73void i2c_master_stop(void) {
74 TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
75
76 uint16_t lim = 0;
77 while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
78 lim++;
79}
80
81// Write one byte to the i2c slave.
82// returns 0 => slave ACK
83// 1 => slave NACK
84uint8_t i2c_master_write(uint8_t data) {
85 TWDR = data;
86 TWCR = (1<<TWINT) | (1<<TWEN);
87
88 i2c_delay();
89
90 // check if the slave acknowledged us
91 return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
92}
93
94// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
95// if ack=0 the acknowledge bit is not set.
96// returns: byte read from i2c device
97uint8_t i2c_master_read(int ack) {
98 TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
99
100 i2c_delay();
101 return TWDR;
102}
103
104void i2c_reset_state(void) {
105 TWCR = 0;
106}
107
108void i2c_slave_init(uint8_t address) {
109 TWAR = address << 0; // slave i2c address
110 // TWEN - twi enable
111 // TWEA - enable address acknowledgement
112 // TWINT - twi interrupt flag
113 // TWIE - enable the twi interrupt
114 TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
115}
116
117ISR(TWI_vect);
118
119ISR(TWI_vect) {
120 uint8_t ack = 1;
121 switch(TW_STATUS) {
122 case TW_SR_SLA_ACK:
123 // this device has been addressed as a slave receiver
124 slave_has_register_set = false;
125 break;
126
127 case TW_SR_DATA_ACK:
128 // this device has received data as a slave receiver
129 // The first byte that we receive in this transaction sets the location
130 // of the read/write location of the slaves memory that it exposes over
131 // i2c. After that, bytes will be written at slave_buffer_pos, incrementing
132 // slave_buffer_pos after each write.
133 if(!slave_has_register_set) {
134 slave_buffer_pos = TWDR;
135 // don't acknowledge the master if this memory loctaion is out of bounds
136 if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
137 ack = 0;
138 slave_buffer_pos = 0;
139 }
140 slave_has_register_set = true;
141 } else {
142 i2c_slave_buffer[slave_buffer_pos] = TWDR;
143 BUFFER_POS_INC();
144 }
145 break;
146
147 case TW_ST_SLA_ACK:
148 case TW_ST_DATA_ACK:
149 // master has addressed this device as a slave transmitter and is
150 // requesting data.
151 TWDR = i2c_slave_buffer[slave_buffer_pos];
152 BUFFER_POS_INC();
153 break;
154
155 case TW_BUS_ERROR: // something went wrong, reset twi state
156 TWCR = 0;
157 default:
158 break;
159 }
160 // Reset everything, so we are ready for the next TWI interrupt
161 TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
162}
163
164
165
166#endif
diff --git a/keyboards/tkc1800/i2c.h b/keyboards/tkc1800/i2c.h
deleted file mode 100644
index 2bd7f40968..0000000000
--- a/keyboards/tkc1800/i2c.h
+++ /dev/null
@@ -1,49 +0,0 @@
1#ifndef I2C_H
2#define I2C_H
3
4#include <stdint.h>
5
6#ifndef F_CPU
7#define F_CPU 16000000UL
8#endif
9
10#define I2C_READ 1
11#define I2C_WRITE 0
12
13#define I2C_ACK 1
14#define I2C_NACK 0
15
16#define SLAVE_BUFFER_SIZE 0x10
17
18// i2c SCL clock frequency
19#define SCL_CLOCK 800000L
20
21extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
22
23void i2c_master_init(void);
24uint8_t i2c_master_start(uint8_t address);
25void i2c_master_stop(void);
26uint8_t i2c_master_write(uint8_t data);
27uint8_t i2c_master_read(int);
28void i2c_reset_state(void);
29void i2c_slave_init(uint8_t address);
30
31
32static inline unsigned char i2c_start_read(unsigned char addr) {
33 return i2c_master_start((addr << 1) | I2C_READ);
34}
35
36static inline unsigned char i2c_start_write(unsigned char addr) {
37 return i2c_master_start((addr << 1) | I2C_WRITE);
38}
39
40// from SSD1306 scrips
41extern unsigned char i2c_rep_start(unsigned char addr);
42extern void i2c_start_wait(unsigned char addr);
43extern unsigned char i2c_readAck(void);
44extern unsigned char i2c_readNak(void);
45extern unsigned char i2c_read(unsigned char ack);
46
47#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
48
49#endif
diff --git a/keyboards/tkc1800/keymaps/default/config.h b/keyboards/tkc1800/keymaps/default/config.h
deleted file mode 100644
index ee142927f3..0000000000
--- a/keyboards/tkc1800/keymaps/default/config.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* Copyright 2017 Mathias Andersson <wraul@dbox.se>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#define USE_I2C
20#define SSD1306OLED
21//#define OLED_ROTATE180
22#define SSD1306_ADDRESS 0x3C
23
24// place overrides here
diff --git a/keyboards/tkc1800/keymaps/default/keymap.c b/keyboards/tkc1800/keymaps/default/keymap.c
index 5455934a30..4f4c7f8e9c 100644
--- a/keyboards/tkc1800/keymaps/default/keymap.c
+++ b/keyboards/tkc1800/keymaps/default/keymap.c
@@ -13,11 +13,8 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16
16#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
17#include "LUFA/Drivers/Peripheral/TWI.h"
18#include "i2c.h"
19#include "ssd1306.h"
20
21 18
22//Layers 19//Layers
23 20
@@ -26,13 +23,6 @@ enum {
26 FUNCTION, 23 FUNCTION,
27}; 24};
28 25
29bool screenWorks = 0;
30
31//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user()
32static char layer_lookup[][14] = {"Base","Function"};
33
34
35
36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 26const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 /* Keymap BASE: (Base Layer) Default Layer 27 /* Keymap BASE: (Base Layer) Default Layer
38 * ,-------------------------------------------------------. ,-------------------. 28 * ,-------------------------------------------------------. ,-------------------.
@@ -88,72 +78,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
88 ), 78 ),
89}; 79};
90 80
91bool process_record_user(uint16_t keycode, keyrecord_t *record) {
92 return true;
93}
94
95void led_set_user(uint8_t usb_led) {
96 81
97} 82#ifdef OLED_DRIVER_ENABLE
98 83void oled_task_user(void) {
99void matrix_init_user(void) { 84 oled_write_P(PSTR("TKC1800\n"),false);
100 #ifdef USE_I2C 85 // Host Keyboard Layer Status
101 i2c_master_init(); 86 oled_write_P(PSTR("Layer: "), false);
102 #ifdef SSD1306OLED 87
103 // calls code for the SSD1306 OLED 88 switch (get_highest_layer(layer_state)) {
104 _delay_ms(400); 89 case BASE:
105 TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); 90 oled_write_P(PSTR("Base\n"), false);
106 if ( iota_gfx_init() ) { // turns on the display 91 break;
107 screenWorks = 1; 92 case FUNCTION:
108 } 93 oled_write_P(PSTR("Function\n"), false);
109 #endif 94 break;
110 #endif 95 default:
111 #ifdef AUDIO_ENABLE 96 // Or use the write_ln shortcut over adding '\n' to the end of your string
112 startup_user(); 97 oled_write_ln_P(PSTR("Undefined"), false);
113 #endif
114}
115
116void matrix_scan_user(void) {
117 #ifdef SSD1306OLED
118 if ( screenWorks ) {
119 iota_gfx_task(); // this is what updates the display continuously
120 };
121 #endif
122}
123
124void matrix_update(struct CharacterMatrix *dest,
125 const struct CharacterMatrix *source) {
126 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
127 memcpy(dest->display, source->display, sizeof(dest->display));
128 dest->dirty = true;
129 }
130}
131
132void iota_gfx_task_user(void) {
133 #if DEBUG_TO_SCREEN
134 if (debug_enable) {
135 return;
136 } 98 }
137 #endif
138
139 struct CharacterMatrix matrix;
140
141 matrix_clear(&matrix);
142 matrix_write_P(&matrix, PSTR("TKC1800"));
143
144 uint8_t layer = biton32(layer_state);
145
146 char buf[40];
147 snprintf(buf,sizeof(buf), "Undef-%d", layer);
148 matrix_write_P(&matrix, PSTR("\nLayer: "));
149 matrix_write(&matrix, layer_lookup[layer]);
150 99
151 // Host Keyboard LED Status 100 // Host Keyboard LED Status
152 char led[40]; 101 led_t led_state = host_keyboard_led_state();
153 snprintf(led, sizeof(led), "\n\n%s %s %s", 102 oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
154 (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", 103 oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
155 (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", 104 oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
156 (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
157 matrix_write(&matrix, led);
158 matrix_update(&display, &matrix);
159} 105}
106#endif \ No newline at end of file
diff --git a/keyboards/tkc1800/keymaps/smt/config.h b/keyboards/tkc1800/keymaps/smt/config.h
deleted file mode 100644
index ee142927f3..0000000000
--- a/keyboards/tkc1800/keymaps/smt/config.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* Copyright 2017 Mathias Andersson <wraul@dbox.se>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#define USE_I2C
20#define SSD1306OLED
21//#define OLED_ROTATE180
22#define SSD1306_ADDRESS 0x3C
23
24// place overrides here
diff --git a/keyboards/tkc1800/keymaps/smt/keymap.c b/keyboards/tkc1800/keymaps/smt/keymap.c
index 9f506b443b..9b6ad80d3a 100644
--- a/keyboards/tkc1800/keymaps/smt/keymap.c
+++ b/keyboards/tkc1800/keymaps/smt/keymap.c
@@ -13,10 +13,8 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16
16#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
17#include "LUFA/Drivers/Peripheral/TWI.h"
18#include "i2c.h"
19#include "ssd1306.h"
20 18
21// Custom macros 19// Custom macros
22#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl 20#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl
@@ -32,11 +30,6 @@ enum {
32 FUNCTION, 30 FUNCTION,
33}; 31};
34 32
35//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user()
36static char layer_lookup[][14] = {"Qwerty","Dvorak","Function"};
37
38
39
40const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 33const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
41 /* Keymap QWERTY: (Qwerty Layer) Default Layer 34 /* Keymap QWERTY: (Qwerty Layer) Default Layer
42 * ,-------------------------------------------------------. ,-------------------. 35 * ,-------------------------------------------------------. ,-------------------.
@@ -151,64 +144,34 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
151 return true; 144 return true;
152} 145}
153 146
154void led_set_user(uint8_t usb_led) { 147#ifdef OLED_DRIVER_ENABLE
155 148void oled_task_user(void) {
156} 149 oled_write_P(PSTR("TKC1800\n"),false);
157 150 // Host Keyboard Layer Status
158void matrix_init_user(void) { 151 oled_write_P(PSTR("Layer: "), false);
159 #ifdef USE_I2C 152
160 i2c_master_init(); 153 switch (get_highest_layer(layer_state)) {
161 #ifdef SSD1306OLED 154 case QWERTY:
162 // calls code for the SSD1306 OLED 155 oled_write_P(PSTR("Base\n"), false);
163 _delay_ms(400); 156 break;
164 TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); 157 case COLEMAK:
165 iota_gfx_init(); // turns on the display 158 oled_write_P(PSTR("Colemak\n"), false);
166 #endif 159 break;
167 #endif 160 case DVORAK:
168 #ifdef AUDIO_ENABLE 161 oled_write_P(PSTR("Dvorak\n"), false);
169 startup_user(); 162 break;
170 #endif 163 case FUNCTION:
171} 164 oled_write_P(PSTR("Function\n"), false);
172 165 break;
173void matrix_scan_user(void) { 166 default:
174 #ifdef SSD1306OLED 167 // Or use the write_ln shortcut over adding '\n' to the end of your string
175 iota_gfx_task(); // this is what updates the display continuously 168 oled_write_ln_P(PSTR("Undefined"), false);
176 #endif
177}
178
179void matrix_update(struct CharacterMatrix *dest,
180 const struct CharacterMatrix *source) {
181 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
182 memcpy(dest->display, source->display, sizeof(dest->display));
183 dest->dirty = true;
184 }
185}
186
187void iota_gfx_task_user(void) {
188 #if DEBUG_TO_SCREEN
189 if (debug_enable) {
190 return;
191 } 169 }
192 #endif
193
194 struct CharacterMatrix matrix;
195
196 matrix_clear(&matrix);
197 matrix_write_P(&matrix, PSTR("TKC1800"));
198
199 uint8_t layer = biton32(layer_state);
200
201 char buf[40];
202 snprintf(buf,sizeof(buf), "Undef-%d", layer);
203 matrix_write_P(&matrix, PSTR("\nLayer: "));
204 matrix_write(&matrix, layer_lookup[layer]);
205 170
206 // Host Keyboard LED Status 171 // Host Keyboard LED Status
207 char led[40]; 172 led_t led_state = host_keyboard_led_state();
208 snprintf(led, sizeof(led), "\n\n%s %s %s", 173 oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
209 (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", 174 oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
210 (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", 175 oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
211 (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
212 matrix_write(&matrix, led);
213 matrix_update(&display, &matrix);
214} 176}
177#endif \ No newline at end of file
diff --git a/keyboards/tkc1800/keymaps/via/keymap.c b/keyboards/tkc1800/keymaps/via/keymap.c
index 5455934a30..76fdf05406 100644
--- a/keyboards/tkc1800/keymaps/via/keymap.c
+++ b/keyboards/tkc1800/keymaps/via/keymap.c
@@ -14,10 +14,6 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include QMK_KEYBOARD_H 16#include QMK_KEYBOARD_H
17#include "LUFA/Drivers/Peripheral/TWI.h"
18#include "i2c.h"
19#include "ssd1306.h"
20
21 17
22//Layers 18//Layers
23 19
@@ -26,13 +22,6 @@ enum {
26 FUNCTION, 22 FUNCTION,
27}; 23};
28 24
29bool screenWorks = 0;
30
31//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user()
32static char layer_lookup[][14] = {"Base","Function"};
33
34
35
36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 25const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 /* Keymap BASE: (Base Layer) Default Layer 26 /* Keymap BASE: (Base Layer) Default Layer
38 * ,-------------------------------------------------------. ,-------------------. 27 * ,-------------------------------------------------------. ,-------------------.
@@ -88,72 +77,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
88 ), 77 ),
89}; 78};
90 79
91bool process_record_user(uint16_t keycode, keyrecord_t *record) { 80#ifdef OLED_DRIVER_ENABLE
92 return true; 81void oled_task_user(void) {
93} 82 oled_write_P(PSTR("TKC1800\n"),false);
94 83 // Host Keyboard Layer Status
95void led_set_user(uint8_t usb_led) { 84 oled_write_P(PSTR("Layer: "), false);
96 85
97} 86 switch (get_highest_layer(layer_state)) {
98 87 case BASE:
99void matrix_init_user(void) { 88 oled_write_P(PSTR("Base\n"), false);
100 #ifdef USE_I2C 89 break;
101 i2c_master_init(); 90 case FUNCTION:
102 #ifdef SSD1306OLED 91 oled_write_P(PSTR("Function\n"), false);
103 // calls code for the SSD1306 OLED 92 break;
104 _delay_ms(400); 93 default:
105 TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); 94 // Or use the write_ln shortcut over adding '\n' to the end of your string
106 if ( iota_gfx_init() ) { // turns on the display 95 oled_write_ln_P(PSTR("Undefined"), false);
107 screenWorks = 1;
108 }
109 #endif
110 #endif
111 #ifdef AUDIO_ENABLE
112 startup_user();
113 #endif
114}
115
116void matrix_scan_user(void) {
117 #ifdef SSD1306OLED
118 if ( screenWorks ) {
119 iota_gfx_task(); // this is what updates the display continuously
120 };
121 #endif
122}
123
124void matrix_update(struct CharacterMatrix *dest,
125 const struct CharacterMatrix *source) {
126 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
127 memcpy(dest->display, source->display, sizeof(dest->display));
128 dest->dirty = true;
129 }
130}
131
132void iota_gfx_task_user(void) {
133 #if DEBUG_TO_SCREEN
134 if (debug_enable) {
135 return;
136 } 96 }
137 #endif
138
139 struct CharacterMatrix matrix;
140
141 matrix_clear(&matrix);
142 matrix_write_P(&matrix, PSTR("TKC1800"));
143
144 uint8_t layer = biton32(layer_state);
145
146 char buf[40];
147 snprintf(buf,sizeof(buf), "Undef-%d", layer);
148 matrix_write_P(&matrix, PSTR("\nLayer: "));
149 matrix_write(&matrix, layer_lookup[layer]);
150 97
151 // Host Keyboard LED Status 98 // Host Keyboard LED Status
152 char led[40]; 99 led_t led_state = host_keyboard_led_state();
153 snprintf(led, sizeof(led), "\n\n%s %s %s", 100 oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
154 (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", 101 oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
155 (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", 102 oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
156 (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
157 matrix_write(&matrix, led);
158 matrix_update(&display, &matrix);
159} 103}
104#endif \ No newline at end of file
diff --git a/keyboards/tkc1800/keymaps/wkl/config.h b/keyboards/tkc1800/keymaps/wkl/config.h
deleted file mode 100644
index ee142927f3..0000000000
--- a/keyboards/tkc1800/keymaps/wkl/config.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* Copyright 2017 Mathias Andersson <wraul@dbox.se>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#define USE_I2C
20#define SSD1306OLED
21//#define OLED_ROTATE180
22#define SSD1306_ADDRESS 0x3C
23
24// place overrides here
diff --git a/keyboards/tkc1800/keymaps/wkl/keymap.c b/keyboards/tkc1800/keymaps/wkl/keymap.c
index 6f331c61cc..3c65b61d11 100644
--- a/keyboards/tkc1800/keymaps/wkl/keymap.c
+++ b/keyboards/tkc1800/keymaps/wkl/keymap.c
@@ -13,11 +13,8 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16
16#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
17#include "LUFA/Drivers/Peripheral/TWI.h"
18#include "i2c.h"
19#include "ssd1306.h"
20
21 18
22//Layers 19//Layers
23 20
@@ -26,13 +23,6 @@ enum {
26 FUNCTION, 23 FUNCTION,
27}; 24};
28 25
29bool screenWorks = 0;
30
31//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user()
32static char layer_lookup[][14] = {"Base","Function"};
33
34
35
36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 26const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 /* Keymap BASE: (Base Layer) Default Layer 27 /* Keymap BASE: (Base Layer) Default Layer
38 * ,-------------------------------------------------------. ,-------------------. 28 * ,-------------------------------------------------------. ,-------------------.
@@ -71,72 +61,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
71 ), 61 ),
72}; 62};
73 63
74bool process_record_user(uint16_t keycode, keyrecord_t *record) { 64#ifdef OLED_DRIVER_ENABLE
75 return true; 65void oled_task_user(void) {
76} 66 oled_write_P(PSTR("TKC1800\n"),false);
77 67 // Host Keyboard Layer Status
78void led_set_user(uint8_t usb_led) { 68 oled_write_P(PSTR("Layer: "), false);
79 69
80} 70 switch (get_highest_layer(layer_state)) {
81 71 case BASE:
82void matrix_init_user(void) { 72 oled_write_P(PSTR("Base\n"), false);
83 #ifdef USE_I2C 73 break;
84 i2c_master_init(); 74 case FUNCTION:
85 #ifdef SSD1306OLED 75 oled_write_P(PSTR("Function\n"), false);
86 // calls code for the SSD1306 OLED 76 break;
87 _delay_ms(400); 77 default:
88 TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); 78 // Or use the write_ln shortcut over adding '\n' to the end of your string
89 if ( iota_gfx_init() ) { // turns on the display 79 oled_write_ln_P(PSTR("Undefined"), false);
90 screenWorks = 1;
91 }
92 #endif
93 #endif
94 #ifdef AUDIO_ENABLE
95 startup_user();
96 #endif
97}
98
99void matrix_scan_user(void) {
100 #ifdef SSD1306OLED
101 if ( screenWorks ) {
102 iota_gfx_task(); // this is what updates the display continuously
103 };
104 #endif
105}
106
107void matrix_update(struct CharacterMatrix *dest,
108 const struct CharacterMatrix *source) {
109 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
110 memcpy(dest->display, source->display, sizeof(dest->display));
111 dest->dirty = true;
112 }
113}
114
115void iota_gfx_task_user(void) {
116 #if DEBUG_TO_SCREEN
117 if (debug_enable) {
118 return;
119 } 80 }
120 #endif
121
122 struct CharacterMatrix matrix;
123
124 matrix_clear(&matrix);
125 matrix_write_P(&matrix, PSTR("TKC1800"));
126
127 uint8_t layer = biton32(layer_state);
128
129 char buf[40];
130 snprintf(buf,sizeof(buf), "Undef-%d", layer);
131 matrix_write_P(&matrix, PSTR("\nLayer: "));
132 matrix_write(&matrix, layer_lookup[layer]);
133 81
134 // Host Keyboard LED Status 82 // Host Keyboard LED Status
135 char led[40]; 83 led_t led_state = host_keyboard_led_state();
136 snprintf(led, sizeof(led), "\n\n%s %s %s", 84 oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
137 (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", 85 oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
138 (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", 86 oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
139 (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
140 matrix_write(&matrix, led);
141 matrix_update(&display, &matrix);
142} 87}
88#endif \ No newline at end of file
diff --git a/keyboards/tkc1800/keymaps/yanfali/config.h b/keyboards/tkc1800/keymaps/yanfali/config.h
deleted file mode 100644
index f1390cb03f..0000000000
--- a/keyboards/tkc1800/keymaps/yanfali/config.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* Copyright 2017 Mathias Andersson <wraul@dbox.se>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19//#define USE_I2C
20//#define SSD1306OLED
21//#define OLED_ROTATE180
22#define SSD1306_ADDRESS 0x3C
23
24// place overrides here
diff --git a/keyboards/tkc1800/keymaps/yanfali/keymap.c b/keyboards/tkc1800/keymaps/yanfali/keymap.c
index 8dad3446de..bbffc2d20b 100644
--- a/keyboards/tkc1800/keymaps/yanfali/keymap.c
+++ b/keyboards/tkc1800/keymaps/yanfali/keymap.c
@@ -13,11 +13,8 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16
16#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
17#include "LUFA/Drivers/Peripheral/TWI.h"
18#include "i2c.h"
19#include "ssd1306.h"
20
21 18
22//Layers 19//Layers
23 20
@@ -26,11 +23,6 @@ enum {
26 FUNCTION, 23 FUNCTION,
27}; 24};
28 25
29//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user()
30static char layer_lookup[][14] = {"Base","Function"};
31
32
33
34const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 26const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
35 /* Keymap BASE: (Base Layer) Default Layer 27 /* Keymap BASE: (Base Layer) Default Layer
36 * ,-------------------------------------------------------. ,-------------------. 28 * ,-------------------------------------------------------. ,-------------------.
@@ -69,68 +61,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
69 ), 61 ),
70}; 62};
71 63
72bool process_record_user(uint16_t keycode, keyrecord_t *record) { 64#ifdef OLED_DRIVER_ENABLE
73 return true; 65void oled_task_user(void) {
74} 66 oled_write_P(PSTR("TKC1800\n"),false);
75 67 // Host Keyboard Layer Status
76void led_set_user(uint8_t usb_led) { 68 oled_write_P(PSTR("Layer: "), false);
77 69
78} 70 switch (get_highest_layer(layer_state)) {
79 71 case BASE:
80void matrix_init_user(void) { 72 oled_write_P(PSTR("Base\n"), false);
81 #ifdef USE_I2C 73 break;
82 i2c_master_init(); 74 case FUNCTION:
83 #ifdef SSD1306OLED 75 oled_write_P(PSTR("Function\n"), false);
84 // calls code for the SSD1306 OLED 76 break;
85 _delay_ms(400); 77 default:
86 TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); 78 // Or use the write_ln shortcut over adding '\n' to the end of your string
87 iota_gfx_init(); // turns on the display 79 oled_write_ln_P(PSTR("Undefined"), false);
88 #endif
89 #endif
90 #ifdef AUDIO_ENABLE
91 startup_user();
92 #endif
93}
94
95void matrix_scan_user(void) {
96 #ifdef SSD1306OLED
97 iota_gfx_task(); // this is what updates the display continuously
98 #endif
99}
100
101void matrix_update(struct CharacterMatrix *dest,
102 const struct CharacterMatrix *source) {
103 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
104 memcpy(dest->display, source->display, sizeof(dest->display));
105 dest->dirty = true;
106 }
107}
108
109void iota_gfx_task_user(void) {
110 #if DEBUG_TO_SCREEN
111 if (debug_enable) {
112 return;
113 } 80 }
114 #endif
115
116 struct CharacterMatrix matrix;
117
118 matrix_clear(&matrix);
119 matrix_write_P(&matrix, PSTR("TKC1800"));
120
121 uint8_t layer = biton32(layer_state);
122
123 char buf[40];
124 snprintf(buf,sizeof(buf), "Undef-%d", layer);
125 matrix_write_P(&matrix, PSTR("\nLayer: "));
126 matrix_write(&matrix, layer_lookup[layer]);
127 81
128 // Host Keyboard LED Status 82 // Host Keyboard LED Status
129 char led[40]; 83 led_t led_state = host_keyboard_led_state();
130 snprintf(led, sizeof(led), "\n\n%s %s %s", 84 oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
131 (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", 85 oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
132 (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", 86 oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
133 (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
134 matrix_write(&matrix, led);
135 matrix_update(&display, &matrix);
136} 87}
88#endif \ No newline at end of file
diff --git a/keyboards/tkc1800/rules.mk b/keyboards/tkc1800/rules.mk
index 7cc3bbe20b..fa90e99807 100644
--- a/keyboards/tkc1800/rules.mk
+++ b/keyboards/tkc1800/rules.mk
@@ -9,12 +9,13 @@ MCU = at90usb1286
9# QMK DFU qmk-dfu 9# QMK DFU qmk-dfu
10# ATmega32A bootloadHID 10# ATmega32A bootloadHID
11# ATmega328P USBasp 11# ATmega328P USBasp
12BOOTLOADER = atmel-dfu 12BOOTLOADER = qmk-dfu
13 13
14# Build Options 14# Build Options
15# change yes to no to disable 15# change yes to no to disable
16# 16#
17BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration 17
18BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
18MOUSEKEY_ENABLE = yes # Mouse keys 19MOUSEKEY_ENABLE = yes # Mouse keys
19EXTRAKEY_ENABLE = yes # Audio control and System control 20EXTRAKEY_ENABLE = yes # Audio control and System control
20CONSOLE_ENABLE = no # Console for debug 21CONSOLE_ENABLE = no # Console for debug
@@ -29,6 +30,4 @@ MIDI_ENABLE = no # MIDI controls
29UNICODE_ENABLE = no # Unicode 30UNICODE_ENABLE = no # Unicode
30BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 31BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
31AUDIO_ENABLE = no # Audio output on port C6 32AUDIO_ENABLE = no # Audio output on port C6
32 33OLED_DRIVER_ENABLE = yes \ No newline at end of file
33SRC = i2c.c \
34 ssd1306.c
diff --git a/keyboards/tkc1800/tkc1800.c b/keyboards/tkc1800/tkc1800.c
index bc6676846d..4232c97d54 100644
--- a/keyboards/tkc1800/tkc1800.c
+++ b/keyboards/tkc1800/tkc1800.c
@@ -16,6 +16,13 @@
16#include "tkc1800.h" 16#include "tkc1800.h"
17#include "led.h" 17#include "led.h"
18 18
19void keyboard_pre_init_kb(void) {
20 setPinInputHigh(D0);
21 setPinInputHigh(D1);
22
23 keyboard_pre_init_user();
24}
25
19void matrix_init_kb(void) { 26void matrix_init_kb(void) {
20 // put your keyboard start-up code here 27 // put your keyboard start-up code here
21 // runs once when the firmware starts up 28 // runs once when the firmware starts up
diff --git a/keyboards/treadstone32/keymaps/default/keymap.c b/keyboards/treadstone32/keymaps/default/keymap.c
index 7ca797fcc0..791fed059b 100644
--- a/keyboards/treadstone32/keymaps/default/keymap.c
+++ b/keyboards/treadstone32/keymaps/default/keymap.c
@@ -110,7 +110,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
110 ) 110 )
111}; 111};
112 112
113uint16_t get_tapping_term(uint16_t keycode) { 113uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
114 switch (keycode) { 114 switch (keycode) {
115 case KC_BSLO: 115 case KC_BSLO:
116 return TAPPING_LAYER_TERM; 116 return TAPPING_LAYER_TERM;
diff --git a/keyboards/treadstone32/keymaps/like_jis/keymap.c b/keyboards/treadstone32/keymaps/like_jis/keymap.c
index a738226d99..92518b11a7 100644
--- a/keyboards/treadstone32/keymaps/like_jis/keymap.c
+++ b/keyboards/treadstone32/keymaps/like_jis/keymap.c
@@ -111,7 +111,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
111 ) 111 )
112}; 112};
113 113
114uint16_t get_tapping_term(uint16_t keycode) { 114uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
115 switch (keycode) { 115 switch (keycode) {
116 case KC_BSLO: 116 case KC_BSLO:
117 return TAPPING_LAYER_TERM; 117 return TAPPING_LAYER_TERM;
diff --git a/keyboards/vision_division/keymaps/default/rules.mk b/keyboards/vision_division/keymaps/default/rules.mk
deleted file mode 100644
index ef72559a0c..0000000000
--- a/keyboards/vision_division/keymaps/default/rules.mk
+++ /dev/null
@@ -1 +0,0 @@
1AUDIO_ENABLE = yes
diff --git a/keyboards/vision_division/rules.mk b/keyboards/vision_division/rules.mk
index 5d9d515f7a..789ff97c79 100644
--- a/keyboards/vision_division/rules.mk
+++ b/keyboards/vision_division/rules.mk
@@ -27,4 +27,4 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by d
27MIDI_ENABLE = no # MIDI controls 27MIDI_ENABLE = no # MIDI controls
28UNICODE_ENABLE = no # Unicode 28UNICODE_ENABLE = no # Unicode
29BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 29BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
30AUDIO_ENABLE = no # Audio output on port C6 30AUDIO_ENABLE = no # Audio output
diff --git a/keyboards/xd60/keymaps/Jos/keymap.c b/keyboards/xd60/keymaps/Jos/keymap.c
index f272d6fd18..250becf74e 100644
--- a/keyboards/xd60/keymaps/Jos/keymap.c
+++ b/keyboards/xd60/keymaps/Jos/keymap.c
@@ -46,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
46 RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PAUS, KC_PSCR, \ 46 RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PAUS, KC_PSCR, \
47 KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ 47 KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
48 KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT, KC_MSTP, KC_TRNS, KC_NO, KC_TRNS, \ 48 KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT, KC_MSTP, KC_TRNS, KC_NO, KC_TRNS, \
49 KC_TRNS, F(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, KC_PGUP, KC_TRNS, \ 49 KC_TRNS, TG(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, KC_PGUP, KC_TRNS, \
50 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDOWN, KC_END), 50 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDOWN, KC_END),
51 51
52 // 2: GUI/Function 2 Layer 52 // 2: GUI/Function 2 Layer
@@ -74,11 +74,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
74/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), */ 74/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), */
75}; 75};
76 76
77// Custom Actions
78const uint16_t PROGMEM fn_actions[] = {
79 [2] = ACTION_LAYER_TOGGLE(3), // to Fn3/Num toggle layer
80};
81
82// Macros 77// Macros
83const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { 78const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
84 79
diff --git a/keyboards/xd60/keymaps/cheese/keymap.c b/keyboards/xd60/keymaps/cheese/keymap.c
index 3c418c5dc0..2ffd3bb5c3 100644
--- a/keyboards/xd60/keymaps/cheese/keymap.c
+++ b/keyboards/xd60/keymaps/cheese/keymap.c
@@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
31 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, \ 31 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, \
32 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ 32 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
33 MO(_FL), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \ 33 MO(_FL), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \
34 F(0), KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, F(1), F(1), F(1), \ 34 LM(_LS, MOD_LSFT), KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, LM(_RS, MOD_RSFT), LM(_RS, MOD_RSFT), LM(_RS, MOD_RSFT), \
35 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FL), KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT), 35 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FL), KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT),
36 36
37// Function Layer 37// Function Layer
@@ -59,9 +59,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
59 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 59 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
60 60
61}; 61};
62
63// Custom Actions
64const uint16_t PROGMEM fn_actions[] = {
65 [0] = ACTION_LAYER_MODS(_LS, MOD_LSFT),
66 [1] = ACTION_LAYER_MODS(_RS, MOD_RSFT),
67};
diff --git a/keyboards/z150_blackheart/config.h b/keyboards/z150_bh/config.h
index fc33021ffc..fc33021ffc 100644
--- a/keyboards/z150_blackheart/config.h
+++ b/keyboards/z150_bh/config.h
diff --git a/keyboards/z150_blackheart/info.json b/keyboards/z150_bh/info.json
index 016641254c..6e5c121f6a 100644
--- a/keyboards/z150_blackheart/info.json
+++ b/keyboards/z150_bh/info.json
@@ -1,5 +1,5 @@
1{ 1{
2 "keyboard_name": "Z-150 Blackheart", 2 "keyboard_name": "Z-150 BH",
3 "url": "", 3 "url": "",
4 "maintainer": "qmk, blindassassin111", 4 "maintainer": "qmk, blindassassin111",
5 "width": 21.25, 5 "width": 21.25,
diff --git a/keyboards/z150_blackheart/keymaps/default/keymap.c b/keyboards/z150_bh/keymaps/default/keymap.c
index ff4f6f7f9d..ff4f6f7f9d 100644
--- a/keyboards/z150_blackheart/keymaps/default/keymap.c
+++ b/keyboards/z150_bh/keymaps/default/keymap.c
diff --git a/keyboards/z150_blackheart/keymaps/default_tkl/keymap.c b/keyboards/z150_bh/keymaps/default_tkl/keymap.c
index f1a24b8dda..f1a24b8dda 100644
--- a/keyboards/z150_blackheart/keymaps/default_tkl/keymap.c
+++ b/keyboards/z150_bh/keymaps/default_tkl/keymap.c
diff --git a/keyboards/z150_blackheart/readme.md b/keyboards/z150_bh/readme.md
index 331f85694e..a1d4845808 100644
--- a/keyboards/z150_blackheart/readme.md
+++ b/keyboards/z150_bh/readme.md
@@ -1,14 +1,14 @@
1Z-150 Blackheart PCB 1Z-150 BH PCB
2=== 2===
3 3
4A replacement PCB for Zenith Z-150 keyboards. 4A replacement PCB for Zenith Z-150 keyboards.
5 5
6Keyboard Maintainer: QMK Community and blindassassin111 6Keyboard Maintainer: QMK Community and blindassassin111
7Hardware Supported: Z-150 blackheart PCB 7Hardware Supported: Z-150 BH PCB
8Hardware Availability: [Deskthority Group Buy](https://deskthority.net/group-buys-f50/programmable-vintage-board-pcbs-omnikey-at101-and-z-150-t19325.html) 8Hardware Availability: [Deskthority Group Buy](https://deskthority.net/group-buys-f50/programmable-vintage-board-pcbs-omnikey-at101-and-z-150-t19325.html)
9 9
10Make example for this keyboard (after setting up your build environment): 10Make example for this keyboard (after setting up your build environment):
11 11
12 make z150_blackheart:default 12 make z150_bh:default
13 13
14See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). 14See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/z150_blackheart/rules.mk b/keyboards/z150_bh/rules.mk
index 739bea3932..739bea3932 100644
--- a/keyboards/z150_blackheart/rules.mk
+++ b/keyboards/z150_bh/rules.mk
diff --git a/keyboards/z150_blackheart/z150_blackheart.c b/keyboards/z150_bh/z150_bh.c
index b754c64a12..6db784b56e 100644
--- a/keyboards/z150_blackheart/z150_blackheart.c
+++ b/keyboards/z150_bh/z150_bh.c
@@ -1,4 +1,4 @@
1#include "z150_blackheart.h" 1#include "z150_bh.h"
2 2
3void matrix_init_kb(void) { 3void matrix_init_kb(void) {
4 setPinOutput(B0); 4 setPinOutput(B0);
diff --git a/keyboards/z150_blackheart/z150_blackheart.h b/keyboards/z150_bh/z150_bh.h
index f97ac1c035..f97ac1c035 100644
--- a/keyboards/z150_blackheart/z150_blackheart.h
+++ b/keyboards/z150_bh/z150_bh.h
diff --git a/keyboards/zinc/config.h b/keyboards/zinc/config.h
index 712db0ac6d..cfb6bf4ffc 100644
--- a/keyboards/zinc/config.h
+++ b/keyboards/zinc/config.h
@@ -17,30 +17,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#pragma once 19#pragma once
20//#ifndef CONFIG_H
21//#define CONFIG_H
22 20
23#include "config_common.h" 21#include "config_common.h"
24
25// GCC include 'config.h" sequence in qmk_firmware/keyboards/zinc/
26// -include keyboards/zinc/config.h
27// -include keyboards/zinc/rev?/config.h
28// -include keyboards/zinc/rev?/keymaps/MAPNAME/config.h
29// XXXX.c
30
31#include <serial_config.h>
32
33// GCC include search path in qmk_firmare/keyboards/zinc/
34// #include "..." search starts here:
35// #include <...> search starts here:
36// keyboards/zinc/rev?/keymaps/MAPNAME
37// keyboards/zinc
38// keyboards/zinc/rev?
39// .
40// ./tmk_core
41// ......
42
43#define NO_ACTION_MACRO
44#define NO_ACTION_FUNCTION
45
46//#endif /* CONFIG_H */
diff --git a/keyboards/zinc/i2c.c b/keyboards/zinc/i2c.c
deleted file mode 100644
index 4bee5c6398..0000000000
--- a/keyboards/zinc/i2c.c
+++ /dev/null
@@ -1,162 +0,0 @@
1#include <util/twi.h>
2#include <avr/io.h>
3#include <stdlib.h>
4#include <avr/interrupt.h>
5#include <util/twi.h>
6#include <stdbool.h>
7#include "i2c.h"
8
9#ifdef USE_I2C
10
11// Limits the amount of we wait for any one i2c transaction.
12// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
13// 9 bits, a single transaction will take around 90μs to complete.
14//
15// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
16// poll loop takes at least 8 clock cycles to execute
17#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
18
19#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
20
21volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
22
23static volatile uint8_t slave_buffer_pos;
24static volatile bool slave_has_register_set = false;
25
26// Wait for an i2c operation to finish
27inline static
28void i2c_delay(void) {
29 uint16_t lim = 0;
30 while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
31 lim++;
32
33 // easier way, but will wait slightly longer
34 // _delay_us(100);
35}
36
37// Setup twi to run at 100kHz or 400kHz (see ./i2c.h SCL_CLOCK)
38void i2c_master_init(void) {
39 // no prescaler
40 TWSR = 0;
41 // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
42 // Check datasheets for more info.
43 TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
44}
45
46// Start a transaction with the given i2c slave address. The direction of the
47// transfer is set with I2C_READ and I2C_WRITE.
48// returns: 0 => success
49// 1 => error
50uint8_t i2c_master_start(uint8_t address) {
51 TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
52
53 i2c_delay();
54
55 // check that we started successfully
56 if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
57 return 1;
58
59 TWDR = address;
60 TWCR = (1<<TWINT) | (1<<TWEN);
61
62 i2c_delay();
63
64 if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
65 return 1; // slave did not acknowledge
66 else
67 return 0; // success
68}
69
70
71// Finish the i2c transaction.
72void i2c_master_stop(void) {
73 TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
74
75 uint16_t lim = 0;
76 while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
77 lim++;
78}
79
80// Write one byte to the i2c slave.
81// returns 0 => slave ACK
82// 1 => slave NACK
83uint8_t i2c_master_write(uint8_t data) {
84 TWDR = data;
85 TWCR = (1<<TWINT) | (1<<TWEN);
86
87 i2c_delay();
88
89 // check if the slave acknowledged us
90 return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
91}
92
93// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
94// if ack=0 the acknowledge bit is not set.
95// returns: byte read from i2c device
96uint8_t i2c_master_read(int ack) {
97 TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
98
99 i2c_delay();
100 return TWDR;
101}
102
103void i2c_reset_state(void) {
104 TWCR = 0;
105}
106
107void i2c_slave_init(uint8_t address) {
108 TWAR = address << 0; // slave i2c address
109 // TWEN - twi enable
110 // TWEA - enable address acknowledgement
111 // TWINT - twi interrupt flag
112 // TWIE - enable the twi interrupt
113 TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
114}
115
116ISR(TWI_vect);
117
118ISR(TWI_vect) {
119 uint8_t ack = 1;
120 switch(TW_STATUS) {
121 case TW_SR_SLA_ACK:
122 // this device has been addressed as a slave receiver
123 slave_has_register_set = false;
124 break;
125
126 case TW_SR_DATA_ACK:
127 // this device has received data as a slave receiver
128 // The first byte that we receive in this transaction sets the location
129 // of the read/write location of the slaves memory that it exposes over
130 // i2c. After that, bytes will be written at slave_buffer_pos, incrementing
131 // slave_buffer_pos after each write.
132 if(!slave_has_register_set) {
133 slave_buffer_pos = TWDR;
134 // don't acknowledge the master if this memory loctaion is out of bounds
135 if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
136 ack = 0;
137 slave_buffer_pos = 0;
138 }
139 slave_has_register_set = true;
140 } else {
141 i2c_slave_buffer[slave_buffer_pos] = TWDR;
142 BUFFER_POS_INC();
143 }
144 break;
145
146 case TW_ST_SLA_ACK:
147 case TW_ST_DATA_ACK:
148 // master has addressed this device as a slave transmitter and is
149 // requesting data.
150 TWDR = i2c_slave_buffer[slave_buffer_pos];
151 BUFFER_POS_INC();
152 break;
153
154 case TW_BUS_ERROR: // something went wrong, reset twi state
155 TWCR = 0;
156 default:
157 break;
158 }
159 // Reset everything, so we are ready for the next TWI interrupt
160 TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
161}
162#endif
diff --git a/keyboards/zinc/i2c.h b/keyboards/zinc/i2c.h
deleted file mode 100644
index 47cf6bd1b2..0000000000
--- a/keyboards/zinc/i2c.h
+++ /dev/null
@@ -1,49 +0,0 @@
1#ifndef I2C_H
2#define I2C_H
3
4#include <stdint.h>
5
6#ifndef F_CPU
7#define F_CPU 16000000UL
8#endif
9
10#define I2C_READ 1
11#define I2C_WRITE 0
12
13#define I2C_ACK 1
14#define I2C_NACK 0
15
16#define SLAVE_BUFFER_SIZE 0x10
17
18// i2c SCL clock frequency 400kHz
19#define SCL_CLOCK 400000L
20
21extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
22
23void i2c_master_init(void);
24uint8_t i2c_master_start(uint8_t address);
25void i2c_master_stop(void);
26uint8_t i2c_master_write(uint8_t data);
27uint8_t i2c_master_read(int);
28void i2c_reset_state(void);
29void i2c_slave_init(uint8_t address);
30
31
32static inline unsigned char i2c_start_read(unsigned char addr) {
33 return i2c_master_start((addr << 1) | I2C_READ);
34}
35
36static inline unsigned char i2c_start_write(unsigned char addr) {
37 return i2c_master_start((addr << 1) | I2C_WRITE);
38}
39
40// from SSD1306 scrips
41extern unsigned char i2c_rep_start(unsigned char addr);
42extern void i2c_start_wait(unsigned char addr);
43extern unsigned char i2c_readAck(void);
44extern unsigned char i2c_readNak(void);
45extern unsigned char i2c_read(unsigned char ack);
46
47#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
48
49#endif
diff --git a/keyboards/zinc/keymaps/default/config.h b/keyboards/zinc/keymaps/default/config.h
index 4dcb0724ff..2185dc9ebe 100644
--- a/keyboards/zinc/keymaps/default/config.h
+++ b/keyboards/zinc/keymaps/default/config.h
@@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20*/ 20*/
21 21
22#pragma once 22#pragma once
23// if you need more program area, try uncomment follow line
24#include "serial_config_simpleapi.h"
25 23
26// place overrides here 24// place overrides here
27// Selection of RGBLIGHT MODE to use. 25// Selection of RGBLIGHT MODE to use.
diff --git a/keyboards/zinc/keymaps/default/keymap.c b/keyboards/zinc/keymaps/default/keymap.c
index 0f08d21ee7..cd1bf0328b 100644
--- a/keyboards/zinc/keymaps/default/keymap.c
+++ b/keyboards/zinc/keymaps/default/keymap.c
@@ -139,7 +139,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { \
139 * |------+------+------+------+------+------| |------+------+------+------+------+------| 139 * |------+------+------+------+------+------| |------+------+------+------+------+------|
140 * | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause | 140 * | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause |
141 * |------+------+------+------+------+------| |------+------+------+------+------+------| 141 * |------+------+------+------+------+------| |------+------+------+------+------+------|
142 * | | MODE | HUE- | SAT- | VAL- | | | | | | | | | 142 * |MODE R| MODE | HUE- | SAT- | VAL- | | | | | | |PageUp| |
143 * |------+------+------+------+------+------| |------+------+------+------+------+------| 143 * |------+------+------+------+------+------| |------+------+------+------+------+------|
144 * | | | | EISU | EISU | EISU | | KANA | KANA | Home |PageDn|PageUp| End | 144 * | | | | EISU | EISU | EISU | | KANA | KANA | Home |PageDn|PageUp| End |
145 * `-----------------------------------------' `-----------------------------------------' 145 * `-----------------------------------------' `-----------------------------------------'
@@ -147,13 +147,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { \
147 [_ADJUST] = LAYOUT_ortho_4x12( \ 147 [_ADJUST] = LAYOUT_ortho_4x12( \
148 _______, RESET, RGBRST, _______, _______, _______, _______, QWERTY, COLEMAK, DVORAK, _______, KC_INS, \ 148 _______, RESET, RGBRST, _______, _______, _______, _______, QWERTY, COLEMAK, DVORAK, _______, KC_INS, \
149 _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, AG_NORM, AG_SWAP, KC_MINS, KC_EQL, KC_PSCR, KC_SLCK, KC_PAUS,\ 149 _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, AG_NORM, AG_SWAP, KC_MINS, KC_EQL, KC_PSCR, KC_SLCK, KC_PAUS,\
150 _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, _______, _______,\ 150 RGB_RMOD,RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, KC_PGUP, _______,\
151 _______, _______, _______, EISU, EISU, EISU, KANA, KANA, KC_HOME, KC_PGDN, KC_PGUP, KC_END\ 151 _______, _______, _______, EISU, EISU, EISU, KANA, KANA, KANA, KC_HOME, KC_PGDN, KC_END\
152 ) 152 )
153}; 153};
154 154
155// define variables for reactive RGB 155// define variables for reactive RGB
156bool TOG_STATUS = false; 156bool TOG_STATUS = false;
157 157
158// Setting ADJUST layer RGB back to default 158// Setting ADJUST layer RGB back to default
159void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { 159void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
@@ -211,7 +211,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
211 } 211 }
212 return false; 212 return false;
213 break; 213 break;
214 214
215 case RAISE: 215 case RAISE:
216 if (record->event.pressed) { 216 if (record->event.pressed) {
217 //not sure how to have keyboard check mode and set it to a variable, so my work around 217 //not sure how to have keyboard check mode and set it to a variable, so my work around
@@ -244,16 +244,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
244 } 244 }
245 return false; 245 return false;
246 break; 246 break;
247
247 //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released 248 //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
249 case RGB_RMOD:
250 #if defined(RGBLIGHT_ENABLE)
251 if (record->event.pressed) {
252 rgblight_mode_noeeprom(RGB_current_config.mode);
253 rgblight_step_reverse();
254 RGB_current_config.mode = rgblight_config.mode;
255 }
256 return false;
257 #endif
258 break;
259
248 case RGB_MOD: 260 case RGB_MOD:
249 #ifdef RGBLIGHT_ENABLE 261 #if defined(RGBLIGHT_ENABLE)
250 if (record->event.pressed) { 262 if (record->event.pressed) {
251 rgblight_mode_noeeprom(RGB_current_config.mode); 263 rgblight_mode_noeeprom(RGB_current_config.mode);
252 rgblight_step(); 264 rgblight_step();
253 RGB_current_config.mode = rgblight_config.mode; 265 RGB_current_config.mode = rgblight_config.mode;
254 } 266 }
255 #endif
256 return false; 267 return false;
268 #endif
257 break; 269 break;
258 270
259 case EISU: 271 case EISU:
diff --git a/keyboards/zinc/keymaps/default/readme_en.md b/keyboards/zinc/keymaps/default/readme_en.md
new file mode 100644
index 0000000000..6447e96ed4
--- /dev/null
+++ b/keyboards/zinc/keymaps/default/readme_en.md
@@ -0,0 +1,131 @@
1# The Default Zinc Layout
2## layout
3
4### Qwerty
5
6```
7 ,-----------------------------------------. ,-----------------------------------------.
8 | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp |
9 |------+------+------+------+------+------| |------+------+------+------+------+------|
10 | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' |
11 |------+------+------+------+------+------| |------+------+------+------+------+------|
12 | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter |
13 |------+------+------+------+------+------| |------+------+------+------+------+------|
14 | Esc | Fn | Alt | Win |Lower |Space | | Space| Raise| Left | Down | Up | Right|
15 `------------------------------------------ ------------------------------------------'
16```
17
18### Colemak
19
20```
21 ,-----------------------------------------. ,-----------------------------------------.
22 | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp |
23 |------+------+------+------+------+------| |------+------+------+------+------+------|
24 | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' |
25 |------+------+------+------+------+------| |------+------+------+------+------+------|
26 | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter |
27 |------+------+------+------+------+------| |------+------+------+------+------+------|
28 | Esc |ADJUST| Alt | Win |LOWER |Space | | Space| RAISE| Left | Down | Up | Right|
29 `------------------------------------------ ------------------------------------------'
30```
31
32### Dvorak
33
34```
35 ,-----------------------------------------. ,-----------------------------------------.
36 | Tab | ' | , | . | P | Y | | F | G | C | R | L | Del |
37 |------+------+------+------+------+------| |------+------+------+------+------+------|
38 | Ctrl | A | O | E | U | I | | D | H | T | N | S | / |
39 |------+------+------+------+------+------| |------+------+------+------+------+------|
40 | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter |
41 |------+------+------+------+------+------| |------+------+------+------+------+------|
42 | Esc |ADJUST| Alt | Win |LOWER |Space | | Space| RAISE| Left | Down | Up | Right|
43 `-----------------------------------------' `-----------------------------------------'
44```
45
46### Lower
47```
48 ,-----------------------------------------. ,-----------------------------------------.
49 | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | |
50 |------+------+------+------+------+------| |------+------+------+------+------+------|
51 | | | | | | | | - | _ | + | { | } | | |
52 |------+------+------+------+------+------| |------+------+------+------+------+------|
53 | | | | | | | | | | | Home | End | |
54 |------+------+------+------+------+------| |------+------+------+------+------+------|
55 | | | | | | | | | | Next | Vol- | Vol+ | Play |
56 `-----------------------------------------' `-----------------------------------------'
57```
58
59### RAISE
60```
61 ,-----------------------------------------. ,-----------------------------------------.
62 | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
63 |------+------+------+------+------+------| |------+------+------+------+------+------|
64 | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ |
65 |------+------+------+------+------+------| |------+------+------+------+------+------|
66 | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | |
67 |------+------+------+------+------+------| |------+------+------+------+------+------|
68 | | | | | | | | | | Next | Vol- | Vol+ | Play |
69 `-----------------------------------------' `-----------------------------------------'
70```
71
72### Adjust (Lower + Raise)
73```
74 ,-----------------------------------------. ,-----------------------------------------.
75 | | Reset|RGBRST|Aud on|Audoff| | | |Qwerty|Colemk|Dvorak| | Ins |
76 |------+------+------+------+------+------| |------+------+------+------+------+------|
77 | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause |
78 |------+------+------+------+------+------| |------+------+------+------+------+------|
79 |MODE R|RGBMOD| HUE- | SAT- | VAL- | | | | | | |PageUp| |
80 |------+------+------+------+------+------| |------+------+------+------+------+------|
81 | | | | EISU | EISU | EISU | | KANA | KANA | KANA | Home |PageDn| End |
82 `-----------------------------------------' `-----------------------------------------'
83```
84
85## Compile
86
87go to qmk top directory.
88
89```
90$ cd qmk_firmware
91```
92make with `zinc:<keymap_name>`
93
94```
95$ make zinc:default
96```
97
98To make and flash with `:flash`
99
100```
101$ make zinc:default:flash
102```
103
104
105## Customize
106
107You can customize from the command line.
108
109```
110# Zinc keyboard 'default' keymap: convenient command line option
111make ZINC=<options> zinc:defualt
112# option= back | under | both | cont | na | ios
113# ex.
114# make ZINC=under zinc:defualt
115# make ZINC=under,ios zinc:defualt
116# make ZINC=back zinc:default
117# make ZINC=back,na zinc:default
118# make ZINC=back,ios zinc:default
119```
120
121Or edit `qmk_firmware/keyboards/zinc/rev1/keymaps/~/rules.mk` directly.
122
123```
124# Zinc keyboard customize
125LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight)
126LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight)
127LED_BOTH_ENABLE = no # LED backlight and underglow
128LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc
129LED_ANIMATIONS = yes # LED animations
130IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
131```
diff --git a/keyboards/zinc/keymaps/default/readme_jp.md b/keyboards/zinc/keymaps/default/readme_jp.md
index dfedb37c15..8132f5036e 100644
--- a/keyboards/zinc/keymaps/default/readme_jp.md
+++ b/keyboards/zinc/keymaps/default/readme_jp.md
@@ -43,6 +43,44 @@
43 `-----------------------------------------' `-----------------------------------------' 43 `-----------------------------------------' `-----------------------------------------'
44``` 44```
45 45
46 ### Lower
47```
48 ,-----------------------------------------. ,-----------------------------------------.
49 | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | |
50 |------+------+------+------+------+------| |------+------+------+------+------+------|
51 | | | | | | | | - | _ | + | { | } | | |
52 |------+------+------+------+------+------| |------+------+------+------+------+------|
53 | | | | | | | | | | | Home | End | |
54 |------+------+------+------+------+------| |------+------+------+------+------+------|
55 | | | | | | | | | | Next | Vol- | Vol+ | Play |
56 `-----------------------------------------' `-----------------------------------------'
57```
58
59### RAISE
60```
61 ,-----------------------------------------. ,-----------------------------------------.
62 | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
63 |------+------+------+------+------+------| |------+------+------+------+------+------|
64 | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ |
65 |------+------+------+------+------+------| |------+------+------+------+------+------|
66 | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | |
67 |------+------+------+------+------+------| |------+------+------+------+------+------|
68 | | | | | | | | | | Next | Vol- | Vol+ | Play |
69 `-----------------------------------------' `-----------------------------------------'
70```
71
72### Adjust (Lower + Raise)
73```
74 ,-----------------------------------------. ,-----------------------------------------.
75 | | Reset|RGBRST|Aud on|Audoff| | | |Qwerty|Colemk|Dvorak| | Ins |
76 |------+------+------+------+------+------| |------+------+------+------+------+------|
77 | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause |
78 |------+------+------+------+------+------| |------+------+------+------+------+------|
79 |MODE R|RGBMOD| HUE- | SAT- | VAL- | | | | | | |PageUp| |
80 |------+------+------+------+------+------| |------+------+------+------+------+------|
81 | | | | EISU | EISU | EISU | | KANA | KANA | KANA | Home |PageDn| End |
82 `-----------------------------------------' `-----------------------------------------'
83```
46 84
47## コンパイルã®ä»•æ–¹ 85## コンパイルã®ä»•æ–¹
48 86
@@ -76,7 +114,7 @@ $ make zinc:default:clean
76``` 114```
77# Zinc keyboard 'default' keymap: convenient command line option 115# Zinc keyboard 'default' keymap: convenient command line option
78make ZINC=<options> zinc:defualt 116make ZINC=<options> zinc:defualt
79# option= back | under | na | ios 117# option= back | under | both | cont | na | ios
80# ex. 118# ex.
81# make ZINC=under zinc:defualt 119# make ZINC=under zinc:defualt
82# make ZINC=under,ios zinc:defualt 120# make ZINC=under,ios zinc:defualt
@@ -85,16 +123,16 @@ make ZINC=<options> zinc:defualt
85# make ZINC=back,ios zinc:default 123# make ZINC=back,ios zinc:default
86``` 124```
87 125
88ã‚ã‚‹ã„ã¯`qmk_firmware/keyboards/zinc/rev1/keymaps/default/rules.mk` ã®ä»¥ä¸‹ã®éƒ¨åˆ†ã‚’直接編集ã—ã¦æ©Ÿèƒ½ã‚’有効化ã—ã¦ãã ã•ã„。 126ã‚ã‚‹ã„ã¯`qmk_firmware/keyboards/zinc/rev1/keymaps/~/rules.mk` ã®ä»¥ä¸‹ã®éƒ¨åˆ†ã‚’直接編集ã—ã¦æ©Ÿèƒ½ã‚’有効化ã—ã¦ãã ã•ã„。
89 127
90``` 128```
91# Zinc keyboard customize 129# Zinc keyboard customize
92LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) 130LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight)
93LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) 131LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight)
132LED_BOTH_ENABLE = no # LED backlight and underglow
133LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc
94LED_ANIMATIONS = yes # LED animations 134LED_ANIMATIONS = yes # LED animations
95IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) 135IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
96
97
98``` 136```
99 137
100## RGB backlight を有効ã«ã™ã‚‹ 138## RGB backlight を有効ã«ã™ã‚‹
@@ -120,4 +158,4 @@ RBG Underglow ã‚„ RGBãƒãƒƒã‚¯ãƒ©ã‚¤ãƒˆã®è¼åº¦ã‚’抑ãˆã¦ã€iPad, iPhone ã«ã
120 158
121``` 159```
122IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) 160IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
123``` \ No newline at end of file 161```
diff --git a/keyboards/zinc/keymaps/default/rules.mk b/keyboards/zinc/keymaps/default/rules.mk
index c980f7d00b..32e0f21610 100644
--- a/keyboards/zinc/keymaps/default/rules.mk
+++ b/keyboards/zinc/keymaps/default/rules.mk
@@ -20,6 +20,9 @@ define ZINC_CUSTOMISE_MSG
20 $(info Zinc customize) 20 $(info Zinc customize)
21 $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE)) 21 $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE))
22 $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE)) 22 $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE))
23 $(info - LED_BOTH_ENABLE=$(LED_BOTH_ENABLE))
24 $(info - LED_RGB_CONT=$(LED_RGB_CONT))
25 $(info - RGB_MATRIX=$(RGB_MATRIX))
23 $(info - LED_ANIMATION=$(LED_ANIMATIONS)) 26 $(info - LED_ANIMATION=$(LED_ANIMATIONS))
24 $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE)) 27 $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE))
25endef 28endef
@@ -27,6 +30,10 @@ endef
27# Zinc keyboard customize 30# Zinc keyboard customize
28LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) 31LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight)
29LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) 32LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight)
33LED_BOTH_ENABLE = no # LED backlight and underglow
34LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc
35RGB_MATRIX = no # RGB LED Matrix
36RGB_MATRIX_SPLIT_RIGHT = no # RGB Matrix for RIGHT Hand
30LED_ANIMATIONS = yes # LED animations 37LED_ANIMATIONS = yes # LED animations
31IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) 38IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
32Link_Time_Optimization = no # if firmware size over limit, try this option 39Link_Time_Optimization = no # if firmware size over limit, try this option
@@ -36,7 +43,7 @@ Link_Time_Optimization = no # if firmware size over limit, try this option
36 43
37### Zinc keyboard 'default' keymap: convenient command line option 44### Zinc keyboard 'default' keymap: convenient command line option
38## make ZINC=<options> zinc:defualt 45## make ZINC=<options> zinc:defualt
39## option= back | under | na | ios 46## option= back | under | both | cont | matrix | na | ios
40## ex. 47## ex.
41## make ZINC=under zinc:defualt 48## make ZINC=under zinc:defualt
42## make ZINC=under,ios zinc:defualt 49## make ZINC=under,ios zinc:defualt
@@ -47,9 +54,22 @@ Link_Time_Optimization = no # if firmware size over limit, try this option
47ifneq ($(strip $(ZINC)),) 54ifneq ($(strip $(ZINC)),)
48 ifeq ($(findstring back,$(ZINC)), back) 55 ifeq ($(findstring back,$(ZINC)), back)
49 LED_BACK_ENABLE = yes 56 LED_BACK_ENABLE = yes
50 else ifeq ($(findstring under,$(ZINC)), under) 57 endif
58 ifeq ($(findstring under,$(ZINC)), under)
51 LED_UNDERGLOW_ENABLE = yes 59 LED_UNDERGLOW_ENABLE = yes
52 endif 60 endif
61 ifeq ($(findstring both,$(ZINC)), both)
62 LED_BOTH_ENABLE = yes
63 endif
64 ifeq ($(findstring cont,$(ZINC)), cont)
65 LED_RGB_CONT = yes
66 endif
67 ifeq ($(findstring matrix,$(ZINC)), matrix)
68 RGB_MATRIX = yes
69 endif
70 ifeq ($(findstring right,$(ZINC)), right)
71 RGB_MATRIX_SPLIT_RIGHT = yes
72 endif
53 ifeq ($(findstring na,$(ZINC)), na) 73 ifeq ($(findstring na,$(ZINC)), na)
54 LED_ANIMATIONS = no 74 LED_ANIMATIONS = no
55 endif 75 endif
@@ -62,10 +82,11 @@ endif
62 82
63ifeq ($(strip $(LED_BACK_ENABLE)), yes) 83ifeq ($(strip $(LED_BACK_ENABLE)), yes)
64 RGBLIGHT_ENABLE = yes 84 RGBLIGHT_ENABLE = yes
65 OPT_DEFS += -DRGBLED_BACK
66 ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) 85 ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
67 $(eval $(call ZINC_CUSTOMISE_MSG)) 86 OPT_DEFS += -DRGBLED_BOTH
68 $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') 87 $(info LED_BOTH_ENABLE option is enabled instead of LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE)
88 else
89 OPT_DEFS += -DRGBLED_BACK
69 endif 90 endif
70else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) 91else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
71 RGBLIGHT_ENABLE = yes 92 RGBLIGHT_ENABLE = yes
@@ -73,18 +94,36 @@ else
73 RGBLIGHT_ENABLE = no 94 RGBLIGHT_ENABLE = no
74endif 95endif
75 96
97ifeq ($(strip $(LED_BOTH_ENABLE)), yes)
98 RGBLIGHT_ENABLE = yes
99 OPT_DEFS += -DRGBLED_BOTH
100endif
101
102ifeq ($(strip $(LED_RGB_CONT)), yes)
103 OPT_DEFS += -DRGBLED_CONT
104endif
105
106ifeq ($(strip $(RGB_MATRIX)), yes)
107 RGBLIGHT_ENABLE = no
108 RGB_MATRIX_ENABLE = WS2812
109endif
110
76ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) 111ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes)
77 OPT_DEFS += -DIOS_DEVICE_ENABLE 112 OPT_DEFS += -DIOS_DEVICE_ENABLE
78endif 113endif
79 114
80ifeq ($(strip $(LED_ANIMATIONS)), yes) 115ifeq ($(strip $(LED_ANIMATIONS)), yes)
81# OPT_DEFS += -DRGBLIGHT_ANIMATIONS 116# OPT_DEFS += -DRGBLIGHT_ANIMATIONS
82 OPT_DEFS += -DLED_ANIMATIONS 117 OPT_DEFS += -DLED_ANIMATIONS
118
119endif
83 120
121ifeq ($(strip $(RGB_MATRIX_SPLIT_RIGHT)), yes)
122 OPT_DEFS += -DRGB_MATRIX_SPLIT_RIGHT
84endif 123endif
85 124
86ifeq ($(strip $(Link_Time_Optimization)),yes) 125ifeq ($(strip $(Link_Time_Optimization)),yes)
87 EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization 126 EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization
88endif 127endif
89 128
90# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 129# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
diff --git a/keyboards/zinc/keymaps/ginjake/config.h b/keyboards/zinc/keymaps/ginjake/config.h
index 4dcb0724ff..2185dc9ebe 100644
--- a/keyboards/zinc/keymaps/ginjake/config.h
+++ b/keyboards/zinc/keymaps/ginjake/config.h
@@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20*/ 20*/
21 21
22#pragma once 22#pragma once
23// if you need more program area, try uncomment follow line
24#include "serial_config_simpleapi.h"
25 23
26// place overrides here 24// place overrides here
27// Selection of RGBLIGHT MODE to use. 25// Selection of RGBLIGHT MODE to use.
diff --git a/keyboards/zinc/keymaps/ginjake/rules.mk b/keyboards/zinc/keymaps/ginjake/rules.mk
index 2dcefc0016..2cb59fe8b8 100644
--- a/keyboards/zinc/keymaps/ginjake/rules.mk
+++ b/keyboards/zinc/keymaps/ginjake/rules.mk
@@ -1,12 +1,11 @@
1
2# Build Options 1# Build Options
3# change to "no" to disable the options, or define them in the Makefile in 2# change to "no" to disable the options, or define them in the Makefile in
4# the appropriate keymap folder that will get included automatically 3# the appropriate keymap folder that will get included automatically
5# 4#
6BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 5BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
7MOUSEKEY_ENABLE = no # Mouse keys(+4700) 6MOUSEKEY_ENABLE = no # Mouse keys
8EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 7EXTRAKEY_ENABLE = yes # Audio control and System control
9CONSOLE_ENABLE = no # Console for debug(+400) 8CONSOLE_ENABLE = no # Console for debug
10COMMAND_ENABLE = no # Commands for debug and configuration 9COMMAND_ENABLE = no # Commands for debug and configuration
11NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 10NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
12BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality 11BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
@@ -21,6 +20,8 @@ define ZINC_CUSTOMISE_MSG
21 $(info Zinc customize) 20 $(info Zinc customize)
22 $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE)) 21 $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE))
23 $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE)) 22 $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE))
23 $(info - LED_BOTH_ENABLE=$(LED_BOTH_ENABLE))
24 $(info - LED_RGB_CONT=$(LED_RGB_CONT))
24 $(info - LED_ANIMATION=$(LED_ANIMATIONS)) 25 $(info - LED_ANIMATION=$(LED_ANIMATIONS))
25 $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE)) 26 $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE))
26endef 27endef
@@ -28,6 +29,8 @@ endef
28# Zinc keyboard customize 29# Zinc keyboard customize
29LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) 30LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight)
30LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) 31LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight)
32LED_BOTH_ENABLE = no # LED backlight and underglow
33LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc
31LED_ANIMATIONS = yes # LED animations 34LED_ANIMATIONS = yes # LED animations
32IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) 35IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
33Link_Time_Optimization = no # if firmware size over limit, try this option 36Link_Time_Optimization = no # if firmware size over limit, try this option
@@ -37,7 +40,7 @@ Link_Time_Optimization = no # if firmware size over limit, try this option
37 40
38### Zinc keyboard 'default' keymap: convenient command line option 41### Zinc keyboard 'default' keymap: convenient command line option
39## make ZINC=<options> zinc:defualt 42## make ZINC=<options> zinc:defualt
40## option= back | under | na | ios 43## option= back | under | both | cont | na | ios
41## ex. 44## ex.
42## make ZINC=under zinc:defualt 45## make ZINC=under zinc:defualt
43## make ZINC=under,ios zinc:defualt 46## make ZINC=under,ios zinc:defualt
@@ -48,9 +51,16 @@ Link_Time_Optimization = no # if firmware size over limit, try this option
48ifneq ($(strip $(ZINC)),) 51ifneq ($(strip $(ZINC)),)
49 ifeq ($(findstring back,$(ZINC)), back) 52 ifeq ($(findstring back,$(ZINC)), back)
50 LED_BACK_ENABLE = yes 53 LED_BACK_ENABLE = yes
51 else ifeq ($(findstring under,$(ZINC)), under) 54 endif
55 ifeq ($(findstring under,$(ZINC)), under)
52 LED_UNDERGLOW_ENABLE = yes 56 LED_UNDERGLOW_ENABLE = yes
53 endif 57 endif
58 ifeq ($(findstring both,$(ZINC)), both)
59 LED_BOTH_ENABLE = yes
60 endif
61 ifeq ($(findstring cont,$(ZINC)), cont)
62 LED_RGB_CONT = yes
63 endif
54 ifeq ($(findstring na,$(ZINC)), na) 64 ifeq ($(findstring na,$(ZINC)), na)
55 LED_ANIMATIONS = no 65 LED_ANIMATIONS = no
56 endif 66 endif
@@ -63,10 +73,11 @@ endif
63 73
64ifeq ($(strip $(LED_BACK_ENABLE)), yes) 74ifeq ($(strip $(LED_BACK_ENABLE)), yes)
65 RGBLIGHT_ENABLE = yes 75 RGBLIGHT_ENABLE = yes
66 OPT_DEFS += -DRGBLED_BACK
67 ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) 76 ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
68 $(eval $(call ZINC_CUSTOMISE_MSG)) 77 OPT_DEFS += -DRGBLED_BOTH
69 $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') 78 $(info LED_BOTH_ENABLE option is enabled instead of LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE)
79 else
80 OPT_DEFS += -DRGBLED_BACK
70 endif 81 endif
71else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) 82else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
72 RGBLIGHT_ENABLE = yes 83 RGBLIGHT_ENABLE = yes
@@ -74,18 +85,27 @@ else
74 RGBLIGHT_ENABLE = no 85 RGBLIGHT_ENABLE = no
75endif 86endif
76 87
88ifeq ($(strip $(LED_BOTH_ENABLE)), yes)
89 RGBLIGHT_ENABLE = yes
90 OPT_DEFS += -DRGBLED_BOTH
91endif
92
93ifeq ($(strip $(LED_RGB_CONT)), yes)
94 OPT_DEFS += -DRGBLED_CONT
95endif
96
77ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) 97ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes)
78 OPT_DEFS += -DIOS_DEVICE_ENABLE 98 OPT_DEFS += -DIOS_DEVICE_ENABLE
79endif 99endif
80 100
81ifeq ($(strip $(LED_ANIMATIONS)), yes) 101ifeq ($(strip $(LED_ANIMATIONS)), yes)
82# OPT_DEFS += -DRGBLIGHT_ANIMATIONS 102# OPT_DEFS += -DRGBLIGHT_ANIMATIONS
83 OPT_DEFS += -DLED_ANIMATIONS 103 OPT_DEFS += -DLED_ANIMATIONS
84 104
85endif 105endif
86 106
87ifeq ($(strip $(Link_Time_Optimization)),yes) 107ifeq ($(strip $(Link_Time_Optimization)),yes)
88 EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization 108 EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization
89endif 109endif
90 110
91# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 111# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
diff --git a/keyboards/zinc/keymaps/monks/config.h b/keyboards/zinc/keymaps/monks/config.h
index 4dcb0724ff..2185dc9ebe 100644
--- a/keyboards/zinc/keymaps/monks/config.h
+++ b/keyboards/zinc/keymaps/monks/config.h
@@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20*/ 20*/
21 21
22#pragma once 22#pragma once
23// if you need more program area, try uncomment follow line
24#include "serial_config_simpleapi.h"
25 23
26// place overrides here 24// place overrides here
27// Selection of RGBLIGHT MODE to use. 25// Selection of RGBLIGHT MODE to use.
diff --git a/keyboards/zinc/keymaps/monks/keymap.c b/keyboards/zinc/keymaps/monks/keymap.c
index 5fd7c6aa85..a30e8ac5fc 100644
--- a/keyboards/zinc/keymaps/monks/keymap.c
+++ b/keyboards/zinc/keymaps/monks/keymap.c
@@ -119,6 +119,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { \
119// define variables for reactive RGB 119// define variables for reactive RGB
120bool TOG_STATUS = false; 120bool TOG_STATUS = false;
121 121
122
122// Setting ADJUST layer RGB back to default 123// Setting ADJUST layer RGB back to default
123void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { 124void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
124 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { 125 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
@@ -163,7 +164,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
163 } 164 }
164 return false; 165 return false;
165 break; 166 break;
166 167
167 case RAISE: 168 case RAISE:
168 if (record->event.pressed) { 169 if (record->event.pressed) {
169 //not sure how to have keyboard check mode and set it to a variable, so my work around 170 //not sure how to have keyboard check mode and set it to a variable, so my work around
diff --git a/keyboards/zinc/keymaps/monks/readme_jp.md b/keyboards/zinc/keymaps/monks/readme_jp.md
index f1495af4c8..e518eb7696 100644
--- a/keyboards/zinc/keymaps/monks/readme_jp.md
+++ b/keyboards/zinc/keymaps/monks/readme_jp.md
@@ -100,4 +100,4 @@ RBG Underglow ã‚„ RGBãƒãƒƒã‚¯ãƒ©ã‚¤ãƒˆã®è¼åº¦ã‚’抑ãˆã¦ã€iPad, iPhone ã«ã
100 100
101``` 101```
102IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) 102IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
103``` \ No newline at end of file 103```
diff --git a/keyboards/zinc/keymaps/monks/rules.mk b/keyboards/zinc/keymaps/monks/rules.mk
index eeabc004c3..c1b98deada 100644
--- a/keyboards/zinc/keymaps/monks/rules.mk
+++ b/keyboards/zinc/keymaps/monks/rules.mk
@@ -1,12 +1,11 @@
1
2# Build Options 1# Build Options
3# change to "no" to disable the options, or define them in the Makefile in 2# change to "no" to disable the options, or define them in the Makefile in
4# the appropriate keymap folder that will get included automatically 3# the appropriate keymap folder that will get included automatically
5# 4#
6BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 5BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
7MOUSEKEY_ENABLE = no # Mouse keys(+4700) 6MOUSEKEY_ENABLE = no # Mouse keys
8EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 7EXTRAKEY_ENABLE = yes # Audio control and System control
9CONSOLE_ENABLE = no # Console for debug(+400) 8CONSOLE_ENABLE = no # Console for debug
10COMMAND_ENABLE = no # Commands for debug and configuration 9COMMAND_ENABLE = no # Commands for debug and configuration
11NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 10NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
12BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality 11BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
@@ -21,6 +20,8 @@ define ZINC_CUSTOMISE_MSG
21 $(info Zinc customize) 20 $(info Zinc customize)
22 $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE)) 21 $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE))
23 $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE)) 22 $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE))
23 $(info - LED_BOTH_ENABLE=$(LED_BOTH_ENABLE))
24 $(info - LED_RGB_CONT=$(LED_RGB_CONT))
24 $(info - LED_ANIMATION=$(LED_ANIMATIONS)) 25 $(info - LED_ANIMATION=$(LED_ANIMATIONS))
25 $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE)) 26 $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE))
26endef 27endef
@@ -28,6 +29,8 @@ endef
28# Zinc keyboard customize 29# Zinc keyboard customize
29LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) 30LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight)
30LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) 31LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight)
32LED_BOTH_ENABLE = no # LED backlight and underglow
33LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc
31LED_ANIMATIONS = yes # LED animations 34LED_ANIMATIONS = yes # LED animations
32IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) 35IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
33Link_Time_Optimization = no # if firmware size over limit, try this option 36Link_Time_Optimization = no # if firmware size over limit, try this option
@@ -37,7 +40,7 @@ Link_Time_Optimization = no # if firmware size over limit, try this option
37 40
38### Zinc keyboard 'default' keymap: convenient command line option 41### Zinc keyboard 'default' keymap: convenient command line option
39## make ZINC=<options> zinc:defualt 42## make ZINC=<options> zinc:defualt
40## option= back | under | na | ios 43## option= back | under | both | cont | na | ios
41## ex. 44## ex.
42## make ZINC=under zinc:defualt 45## make ZINC=under zinc:defualt
43## make ZINC=under,ios zinc:defualt 46## make ZINC=under,ios zinc:defualt
@@ -48,9 +51,16 @@ Link_Time_Optimization = no # if firmware size over limit, try this option
48ifneq ($(strip $(ZINC)),) 51ifneq ($(strip $(ZINC)),)
49 ifeq ($(findstring back,$(ZINC)), back) 52 ifeq ($(findstring back,$(ZINC)), back)
50 LED_BACK_ENABLE = yes 53 LED_BACK_ENABLE = yes
51 else ifeq ($(findstring under,$(ZINC)), under) 54 endif
55 ifeq ($(findstring under,$(ZINC)), under)
52 LED_UNDERGLOW_ENABLE = yes 56 LED_UNDERGLOW_ENABLE = yes
53 endif 57 endif
58 ifeq ($(findstring both,$(ZINC)), both)
59 LED_BOTH_ENABLE = yes
60 endif
61 ifeq ($(findstring cont,$(ZINC)), cont)
62 LED_RGB_CONT = yes
63 endif
54 ifeq ($(findstring na,$(ZINC)), na) 64 ifeq ($(findstring na,$(ZINC)), na)
55 LED_ANIMATIONS = no 65 LED_ANIMATIONS = no
56 endif 66 endif
@@ -63,10 +73,11 @@ endif
63 73
64ifeq ($(strip $(LED_BACK_ENABLE)), yes) 74ifeq ($(strip $(LED_BACK_ENABLE)), yes)
65 RGBLIGHT_ENABLE = yes 75 RGBLIGHT_ENABLE = yes
66 OPT_DEFS += -DRGBLED_BACK
67 ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) 76 ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
68 $(eval $(call ZINC_CUSTOMISE_MSG)) 77 OPT_DEFS += -DRGBLED_BOTH
69 $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') 78 $(info LED_BOTH_ENABLE option is enabled instead of LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE)
79 else
80 OPT_DEFS += -DRGBLED_BACK
70 endif 81 endif
71else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) 82else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
72 RGBLIGHT_ENABLE = yes 83 RGBLIGHT_ENABLE = yes
@@ -74,17 +85,27 @@ else
74 RGBLIGHT_ENABLE = no 85 RGBLIGHT_ENABLE = no
75endif 86endif
76 87
88ifeq ($(strip $(LED_BOTH_ENABLE)), yes)
89 RGBLIGHT_ENABLE = yes
90 OPT_DEFS += -DRGBLED_BOTH
91endif
92
93ifeq ($(strip $(LED_RGB_CONT)), yes)
94 OPT_DEFS += -DRGBLED_CONT
95endif
96
77ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) 97ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes)
78 OPT_DEFS += -DIOS_DEVICE_ENABLE 98 OPT_DEFS += -DIOS_DEVICE_ENABLE
79endif 99endif
80 100
81ifeq ($(strip $(LED_ANIMATIONS)), yes) 101ifeq ($(strip $(LED_ANIMATIONS)), yes)
82# OPT_DEFS += -DRGBLIGHT_ANIMATIONS 102# OPT_DEFS += -DRGBLIGHT_ANIMATIONS
83 OPT_DEFS += -DLED_ANIMATIONS 103 OPT_DEFS += -DLED_ANIMATIONS
104
84endif 105endif
85 106
86ifeq ($(strip $(Link_Time_Optimization)),yes) 107ifeq ($(strip $(Link_Time_Optimization)),yes)
87 EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization 108 EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization
88endif 109endif
89 110
90# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 111# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
@@ -94,4 +115,3 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
94# $(info -- RGBLIGHT_ENABLE=$(RGBLIGHT_ENABLE)) 115# $(info -- RGBLIGHT_ENABLE=$(RGBLIGHT_ENABLE))
95# $(info -- OPT_DEFS=$(OPT_DEFS)) 116# $(info -- OPT_DEFS=$(OPT_DEFS))
96# $(info ) 117# $(info )
97
diff --git a/keyboards/zinc/keymaps/toshi0383/config.h b/keyboards/zinc/keymaps/toshi0383/config.h
index 33108a29e6..0d53d44247 100644
--- a/keyboards/zinc/keymaps/toshi0383/config.h
+++ b/keyboards/zinc/keymaps/toshi0383/config.h
@@ -21,8 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
21*/ 21*/
22 22
23#pragma once 23#pragma once
24// if you need more program area, try uncomment follow line
25#include "serial_config_simpleapi.h"
26 24
27// place overrides here 25// place overrides here
28// Selection of RGBLIGHT MODE to use. 26// Selection of RGBLIGHT MODE to use.
diff --git a/keyboards/zinc/keymaps/toshi0383/rules.mk b/keyboards/zinc/keymaps/toshi0383/rules.mk
index dca9aa7ff8..26ac02f3a0 100644
--- a/keyboards/zinc/keymaps/toshi0383/rules.mk
+++ b/keyboards/zinc/keymaps/toshi0383/rules.mk
@@ -1,11 +1,12 @@
1# Build Options 1# Build Options
2# change yes to no to disable 2# change to "no" to disable the options, or define them in the Makefile in
3# the appropriate keymap folder that will get included automatically
3# 4#
4BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration 5BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
5MOUSEKEY_ENABLE = no # Mouse keys 6MOUSEKEY_ENABLE = no # Mouse keys
6EXTRAKEY_ENABLE = yes # Audio control and System control 7EXTRAKEY_ENABLE = yes # Audio control and System control
7CONSOLE_ENABLE = no # Console for debug 8CONSOLE_ENABLE = no # Console for debug
8COMMAND_ENABLE = no # Commands for debug and configuration 9COMMAND_ENABLE = no # Commands for debug and configuration
9NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 10NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
10BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality 11BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
11MIDI_ENABLE = no # MIDI controls 12MIDI_ENABLE = no # MIDI controls
@@ -19,6 +20,9 @@ define ZINC_CUSTOMISE_MSG
19 $(info Zinc customize) 20 $(info Zinc customize)
20 $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE)) 21 $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE))
21 $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE)) 22 $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE))
23 $(info - LED_BOTH_ENABLE=$(LED_BOTH_ENABLE))
24 $(info - LED_RGB_CONT=$(LED_RGB_CONT))
25 $(info - RGB_MATRIX=$(RGB_MATRIX))
22 $(info - LED_ANIMATION=$(LED_ANIMATIONS)) 26 $(info - LED_ANIMATION=$(LED_ANIMATIONS))
23 $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE)) 27 $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE))
24endef 28endef
@@ -26,6 +30,10 @@ endef
26# Zinc keyboard customize 30# Zinc keyboard customize
27LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) 31LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight)
28LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) 32LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight)
33LED_BOTH_ENABLE = no # LED backlight and underglow
34LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc
35RGB_MATRIX = no # RGB LED Matrix
36RGB_MATRIX_SPLIT_RIGHT = no # RGB Matrix for RIGHT Hand
29LED_ANIMATIONS = yes # LED animations 37LED_ANIMATIONS = yes # LED animations
30IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) 38IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
31Link_Time_Optimization = no # if firmware size over limit, try this option 39Link_Time_Optimization = no # if firmware size over limit, try this option
@@ -35,7 +43,7 @@ Link_Time_Optimization = no # if firmware size over limit, try this option
35 43
36### Zinc keyboard 'default' keymap: convenient command line option 44### Zinc keyboard 'default' keymap: convenient command line option
37## make ZINC=<options> zinc:defualt 45## make ZINC=<options> zinc:defualt
38## option= back | under | na | ios 46## option= back | under | both | cont | matrix | na | ios
39## ex. 47## ex.
40## make ZINC=under zinc:defualt 48## make ZINC=under zinc:defualt
41## make ZINC=under,ios zinc:defualt 49## make ZINC=under,ios zinc:defualt
@@ -46,9 +54,22 @@ Link_Time_Optimization = no # if firmware size over limit, try this option
46ifneq ($(strip $(ZINC)),) 54ifneq ($(strip $(ZINC)),)
47 ifeq ($(findstring back,$(ZINC)), back) 55 ifeq ($(findstring back,$(ZINC)), back)
48 LED_BACK_ENABLE = yes 56 LED_BACK_ENABLE = yes
49 else ifeq ($(findstring under,$(ZINC)), under) 57 endif
58 ifeq ($(findstring under,$(ZINC)), under)
50 LED_UNDERGLOW_ENABLE = yes 59 LED_UNDERGLOW_ENABLE = yes
51 endif 60 endif
61 ifeq ($(findstring both,$(ZINC)), both)
62 LED_BOTH_ENABLE = yes
63 endif
64 ifeq ($(findstring cont,$(ZINC)), cont)
65 LED_RGB_CONT = yes
66 endif
67 ifeq ($(findstring matrix,$(ZINC)), matrix)
68 RGB_MATRIX = yes
69 endif
70 ifeq ($(findstring right,$(ZINC)), right)
71 RGB_MATRIX_SPLIT_RIGHT = yes
72 endif
52 ifeq ($(findstring na,$(ZINC)), na) 73 ifeq ($(findstring na,$(ZINC)), na)
53 LED_ANIMATIONS = no 74 LED_ANIMATIONS = no
54 endif 75 endif
@@ -61,10 +82,11 @@ endif
61 82
62ifeq ($(strip $(LED_BACK_ENABLE)), yes) 83ifeq ($(strip $(LED_BACK_ENABLE)), yes)
63 RGBLIGHT_ENABLE = yes 84 RGBLIGHT_ENABLE = yes
64 OPT_DEFS += -DRGBLED_BACK
65 ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) 85 ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
66 $(eval $(call ZINC_CUSTOMISE_MSG)) 86 OPT_DEFS += -DRGBLED_BOTH
67 $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') 87 $(info LED_BOTH_ENABLE option is enabled instead of LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE)
88 else
89 OPT_DEFS += -DRGBLED_BACK
68 endif 90 endif
69else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) 91else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
70 RGBLIGHT_ENABLE = yes 92 RGBLIGHT_ENABLE = yes
@@ -72,24 +94,43 @@ else
72 RGBLIGHT_ENABLE = no 94 RGBLIGHT_ENABLE = no
73endif 95endif
74 96
97ifeq ($(strip $(LED_BOTH_ENABLE)), yes)
98 RGBLIGHT_ENABLE = yes
99 OPT_DEFS += -DRGBLED_BOTH
100endif
101
102ifeq ($(strip $(LED_RGB_CONT)), yes)
103 OPT_DEFS += -DRGBLED_CONT
104endif
105
106ifeq ($(strip $(RGB_MATRIX)), yes)
107 RGBLIGHT_ENABLE = no
108 RGB_MATRIX_ENABLE = WS2812
109endif
110
75ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) 111ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes)
76 OPT_DEFS += -DIOS_DEVICE_ENABLE 112 OPT_DEFS += -DIOS_DEVICE_ENABLE
77endif 113endif
78 114
79ifeq ($(strip $(LED_ANIMATIONS)), yes) 115ifeq ($(strip $(LED_ANIMATIONS)), yes)
80# OPT_DEFS += -DRGBLIGHT_ANIMATIONS 116# OPT_DEFS += -DRGBLIGHT_ANIMATIONS
81 OPT_DEFS += -DLED_ANIMATIONS 117 OPT_DEFS += -DLED_ANIMATIONS
118
119endif
120
121ifeq ($(strip $(RGB_MATRIX_SPLIT_RIGHT)), yes)
122 OPT_DEFS += -DRGB_MATRIX_SPLIT_RIGHT
82endif 123endif
83 124
84ifeq ($(strip $(Link_Time_Optimization)),yes) 125ifeq ($(strip $(Link_Time_Optimization)),yes)
85 EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization 126 EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization
86endif 127endif
87 128
88# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 129# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
89SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 130SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
90 131
132
91# Uncomment these for debugging 133# Uncomment these for debugging
92# $(info -- RGBLIGHT_ENABLE=$(RGBLIGHT_ENABLE)) 134# $(info -- RGBLIGHT_ENABLE=$(RGBLIGHT_ENABLE))
93# $(info -- OPT_DEFS=$(OPT_DEFS)) 135# $(info -- OPT_DEFS=$(OPT_DEFS))
94# $(info ) 136# $(info )
95
diff --git a/keyboards/zinc/readme.md b/keyboards/zinc/readme.md
index 3b4ce105c8..0e8d6cd65d 100644
--- a/keyboards/zinc/readme.md
+++ b/keyboards/zinc/readme.md
@@ -5,9 +5,9 @@ Zinc
5 5
640% row-staggered split keyboard. 640% row-staggered split keyboard.
7 7
8Keyboard Maintainer: [monksoffunk](https://github.com/monksoffunk/) [@monksoffunkJP](https://twitter.com/monksoffunkJP) 8* Keyboard Maintainer: [monksoffunk](https://github.com/monksoffunk/) [@monksoffunkJP](https://twitter.com/monksoffunkJP)
9Hardware Supported: Zinc PCB 9* Hardware Supported: Zinc PCB
10Hardware Availability: (https://twitter.com/monksoffunkJP) 10* Hardware Availability: (https://twitter.com/monksoffunkJP)
11 11
12Make example for this keyboard (after setting up your build environment): 12Make example for this keyboard (after setting up your build environment):
13 13
diff --git a/keyboards/zinc/rev1/config.h b/keyboards/zinc/rev1/config.h
index 6713b3098a..1eb63df5bc 100644
--- a/keyboards/zinc/rev1/config.h
+++ b/keyboards/zinc/rev1/config.h
@@ -18,9 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18 18
19#pragma once 19#pragma once
20 20
21//#ifndef REV1_CONFIG_H
22//#define REV1_CONFIG_H
23
24/* USB Device descriptor parameter */ 21/* USB Device descriptor parameter */
25#define VENDOR_ID 0xFEED 22#define VENDOR_ID 0xFEED
26#define PRODUCT_ID 0x9991 23#define PRODUCT_ID 0x9991
@@ -33,9 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
33#define TAPPING_TERM 100 30#define TAPPING_TERM 100
34 31
35/* Use I2C or Serial */ 32/* Use I2C or Serial */
36//#define USE_I2C
37#define USE_SERIAL 33#define USE_SERIAL
38//#define USE_MATRIX_I2C 34#define SOFT_SERIAL_PIN D2
39 35
40/* Select hand configuration */ 36/* Select hand configuration */
41#define MASTER_LEFT 37#define MASTER_LEFT
@@ -44,18 +40,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
44 40
45/* key matrix size */ 41/* key matrix size */
46// Rows are doubled-up 42// Rows are doubled-up
47 #define MATRIX_ROWS 8 43#define MATRIX_ROWS 8
48 #define MATRIX_ROW_PINS { F6, F7, B1, B3 } 44#define MATRIX_ROW_PINS { F6, F7, B1, B3 }
49 45
50// wiring of each half 46// wiring of each half
51#define MATRIX_COLS 6 47#define MATRIX_COLS 6
52#define MATRIX_COL_PINS { F4, D4, C6, D7, E6, B4 } 48#define MATRIX_COL_PINS { F4, D4, C6, D7, E6, B4 }
53 49
54/* define if matrix has ghost */ 50#define DIODE_DIRECTION COL2ROW
55//#define MATRIX_HAS_GHOST
56
57/* number of backlight levels */
58// #define BACKLIGHT_LEVELS 3
59 51
60/* Set 0 if debouncing isn't needed */ 52/* Set 0 if debouncing isn't needed */
61#define DEBOUNCE 5 53#define DEBOUNCE 5
@@ -67,25 +59,44 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
67 59
68/* ws2812 RGB LED */ 60/* ws2812 RGB LED */
69#define RGB_DI_PIN D3 61#define RGB_DI_PIN D3
70#define RGBLIGHT_TIMER
71//#define RGBLED_NUM 12 // Number of LEDs. see ./keymaps/default/config.h
72#define ws2812_PORTREG PORTD
73#define ws2812_DDRREG DDRD
74 62
75// RGB LED support 63// RGB LED support
76//#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no 64//#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no
77// see ./rules.mk: LED_BACK_ENABLE or LED_UNDERGLOW_ENABLE set yes 65// see ./rules.mk: LED_BACK_ENABLE or LED_UNDERGLOW_ENABLE set yes
78#ifdef RGBLED_BACK 66#ifdef RGBLIGHT_ENABLE
79 #define RGBLED_NUM 24 67 #define RGBLIGHT_SPLIT
80#else 68 #ifdef RGBLED_BACK
81 #define RGBLED_NUM 6 69 #ifdef RGBLED_CONT
70 #define RGBLED_NUM 48
71 #define RGBLED_SPLIT { 24, 24 }
72 #else
73 #define RGBLED_NUM 24
74 #endif
75 #else
76 #ifdef RGBLED_BOTH
77 #ifdef RGBLED_CONT
78 #define RGBLED_NUM 60
79 #define RGBLED_SPLIT { 30, 30 }
80// #define RGBLIGHT_LED_MAP {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29}
81 #else
82 #define RGBLED_NUM 30
83 #endif
84 #else
85 #ifdef RGBLED_CONT
86 #define RGBLED_NUM 12
87 #define RGBLED_SPLIT { 6, 6 }
88 #else
89 #define RGBLED_NUM 6
90 #endif
91 #endif
92 #endif
82#endif 93#endif
83 94
84#ifndef IOS_DEVICE_ENABLE 95#ifndef IOS_DEVICE_ENABLE
85 #if RGBLED_NUM <= 6 96 #if (RGBLED_NUM <= 6) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 12))
86 #define RGBLIGHT_LIMIT_VAL 255 97 #define RGBLIGHT_LIMIT_VAL 255
87 #else 98 #else
88 #if RGBLED_NUM <= 16 99 #if (RGBLED_NUM <= 16) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 32))
89 #define RGBLIGHT_LIMIT_VAL 130 100 #define RGBLIGHT_LIMIT_VAL 130
90 #else 101 #else
91 #define RGBLIGHT_LIMIT_VAL 120 102 #define RGBLIGHT_LIMIT_VAL 120
@@ -93,10 +104,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
93 #endif 104 #endif
94 #define RGBLIGHT_VAL_STEP 17 105 #define RGBLIGHT_VAL_STEP 17
95#else 106#else
96 #if RGBLED_NUM <= 6 107 #if (RGBLED_NUM <= 6) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 12))
97 #define RGBLIGHT_LIMIT_VAL 90 108 #define RGBLIGHT_LIMIT_VAL 90
98 #else 109 #else
99 #if RGBLED_NUM <= 16 110 #if (RGBLED_NUM <= 16) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 32))
100 #define RGBLIGHT_LIMIT_VAL 45 111 #define RGBLIGHT_LIMIT_VAL 45
101 #else 112 #else
102 #define RGBLIGHT_LIMIT_VAL 35 113 #define RGBLIGHT_LIMIT_VAL 35
@@ -136,5 +147,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
136//#define NO_ACTION_ONESHOT 147//#define NO_ACTION_ONESHOT
137//#define NO_ACTION_MACRO 148//#define NO_ACTION_MACRO
138//#define NO_ACTION_FUNCTION 149//#define NO_ACTION_FUNCTION
139
140//#endif
diff --git a/keyboards/zinc/rev1/matrix.c b/keyboards/zinc/rev1/matrix.c
deleted file mode 100644
index df674ce143..0000000000
--- a/keyboards/zinc/rev1/matrix.c
+++ /dev/null
@@ -1,357 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/*
19 * scan matrix
20 */
21#include <stdint.h>
22#include <stdbool.h>
23#include <string.h>
24#include <avr/io.h>
25#include <avr/wdt.h>
26#include <avr/interrupt.h>
27#include <util/delay.h>
28#include "print.h"
29#include "debug.h"
30#include "util.h"
31#include "matrix.h"
32#include "split_util.h"
33#include "quantum.h"
34
35#ifdef USE_MATRIX_I2C
36# include "i2c.h"
37#else // USE_SERIAL
38# include "split_scomm.h"
39#endif
40
41#ifndef DEBOUNCE
42# define DEBOUNCE 5
43#endif
44
45#define ERROR_DISCONNECT_COUNT 5
46
47static uint8_t debouncing = DEBOUNCE;
48static const int ROWS_PER_HAND = MATRIX_ROWS/2;
49static uint8_t error_count = 0;
50uint8_t is_master = 0 ;
51
52static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
53static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
54
55/* matrix state(1:on, 0:off) */
56static matrix_row_t matrix[MATRIX_ROWS];
57static matrix_row_t matrix_debouncing[MATRIX_ROWS];
58
59static matrix_row_t read_cols(void);
60static void init_cols(void);
61static void unselect_rows(void);
62static void select_row(uint8_t row);
63static uint8_t matrix_master_scan(void);
64
65
66__attribute__ ((weak))
67void matrix_init_kb(void) {
68 matrix_init_user();
69}
70
71__attribute__ ((weak))
72void matrix_scan_kb(void) {
73 matrix_scan_user();
74}
75
76__attribute__ ((weak))
77void matrix_init_user(void) {
78}
79
80__attribute__ ((weak))
81void matrix_scan_user(void) {
82}
83
84inline
85uint8_t matrix_rows(void)
86{
87 return MATRIX_ROWS;
88}
89
90inline
91uint8_t matrix_cols(void)
92{
93 return MATRIX_COLS;
94}
95
96void matrix_init(void)
97{
98 debug_enable = true;
99 debug_matrix = true;
100 debug_mouse = true;
101 // initialize row and col
102 unselect_rows();
103 init_cols();
104
105 setPinOutput(B0);
106 setPinOutput(D5);
107 writePinHigh(D5);
108 writePinHigh(B0);
109
110 // initialize matrix state: all keys off
111 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
112 matrix[i] = 0;
113 matrix_debouncing[i] = 0;
114 }
115
116 is_master = has_usb();
117
118 matrix_init_quantum();
119}
120
121uint8_t _matrix_scan(void)
122{
123 // Right hand is stored after the left in the matirx so, we need to offset it
124 int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
125
126 for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
127 select_row(i);
128 _delay_us(30); // without this wait read unstable value.
129 matrix_row_t cols = read_cols();
130 if (matrix_debouncing[i+offset] != cols) {
131 matrix_debouncing[i+offset] = cols;
132 debouncing = DEBOUNCE;
133 }
134 unselect_rows();
135 }
136
137 if (debouncing) {
138 if (--debouncing) {
139 _delay_ms(1);
140 } else {
141 for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
142 matrix[i+offset] = matrix_debouncing[i+offset];
143 }
144 }
145 }
146
147 return 1;
148}
149
150#ifdef USE_MATRIX_I2C
151
152// Get rows from other half over i2c
153int i2c_transaction(void) {
154 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
155
156 int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
157 if (err) goto i2c_error;
158
159 // start of matrix stored at 0x00
160 err = i2c_master_write(0x00);
161 if (err) goto i2c_error;
162
163 // Start read
164 err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
165 if (err) goto i2c_error;
166
167 if (!err) {
168 int i;
169 for (i = 0; i < ROWS_PER_HAND-1; ++i) {
170 matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
171 }
172 matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
173 i2c_master_stop();
174 } else {
175i2c_error: // the cable is disconnceted, or something else went wrong
176 i2c_reset_state();
177 return err;
178 }
179
180 return 0;
181}
182
183#else // USE_SERIAL
184
185int serial_transaction(int master_changed) {
186 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
187#ifdef SERIAL_USE_MULTI_TRANSACTION
188 int ret=serial_update_buffers(master_changed);
189#else
190 int ret=serial_update_buffers();
191#endif
192 if (ret ) {
193 if(ret==2) writePinLow(B0);
194 return 1;
195 }
196 writePinHigh(B0);
197 memcpy(&matrix[slaveOffset],
198 (void *)serial_slave_buffer, sizeof(serial_slave_buffer));
199 return 0;
200}
201#endif
202
203uint8_t matrix_scan(void)
204{
205 if (is_master) {
206 matrix_master_scan();
207 }else{
208 matrix_slave_scan();
209 int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
210 memcpy(&matrix[offset],
211 (void *)serial_master_buffer, sizeof(serial_master_buffer));
212 matrix_scan_quantum();
213 }
214 return 1;
215}
216
217
218uint8_t matrix_master_scan(void) {
219
220 int ret = _matrix_scan();
221 int mchanged = 1;
222 int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
223
224#ifdef USE_MATRIX_I2C
225// for (int i = 0; i < ROWS_PER_HAND; ++i) {
226 /* i2c_slave_buffer[i] = matrix[offset+i]; */
227// i2c_slave_buffer[i] = matrix[offset+i];
228// }
229#else // USE_SERIAL
230 #ifdef SERIAL_USE_MULTI_TRANSACTION
231 mchanged = memcmp((void *)serial_master_buffer,
232 &matrix[offset], sizeof(serial_master_buffer));
233 #endif
234 memcpy((void *)serial_master_buffer,
235 &matrix[offset], sizeof(serial_master_buffer));
236#endif
237
238#ifdef USE_MATRIX_I2C
239 if( i2c_transaction() ) {
240#else // USE_SERIAL
241 if( serial_transaction(mchanged) ) {
242#endif
243 // turn on the indicator led when halves are disconnected
244 writePinLow(D5);
245
246 error_count++;
247
248 if (error_count > ERROR_DISCONNECT_COUNT) {
249 // reset other half if disconnected
250 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
251 for (int i = 0; i < ROWS_PER_HAND; ++i) {
252 matrix[slaveOffset+i] = 0;
253 }
254 }
255 } else {
256 // turn off the indicator led on no error
257 writePinHigh(D5);
258 error_count = 0;
259 }
260 matrix_scan_quantum();
261 return ret;
262}
263
264void matrix_slave_scan(void) {
265 _matrix_scan();
266
267 int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
268
269#ifdef USE_MATRIX_I2C
270 for (int i = 0; i < ROWS_PER_HAND; ++i) {
271 /* i2c_slave_buffer[i] = matrix[offset+i]; */
272 i2c_slave_buffer[i] = matrix[offset+i];
273 }
274#else // USE_SERIAL
275 #ifdef SERIAL_USE_MULTI_TRANSACTION
276 int change = 0;
277 #endif
278 for (int i = 0; i < ROWS_PER_HAND; ++i) {
279 #ifdef SERIAL_USE_MULTI_TRANSACTION
280 if( serial_slave_buffer[i] != matrix[offset+i] )
281 change = 1;
282 #endif
283 serial_slave_buffer[i] = matrix[offset+i];
284 }
285 #ifdef SERIAL_USE_MULTI_TRANSACTION
286 slave_buffer_change_count += change;
287 #endif
288#endif
289}
290
291bool matrix_is_modified(void)
292{
293 if (debouncing) return false;
294 return true;
295}
296
297inline
298bool matrix_is_on(uint8_t row, uint8_t col)
299{
300 return (matrix[row] & ((matrix_row_t)1<<col));
301}
302
303inline
304matrix_row_t matrix_get_row(uint8_t row)
305{
306 return matrix[row];
307}
308
309void matrix_print(void)
310{
311 print("\nr/c 0123456789ABCDEF\n");
312 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
313 phex(row); print(": ");
314 pbin_reverse16(matrix_get_row(row));
315 print("\n");
316 }
317}
318
319uint8_t matrix_key_count(void)
320{
321 uint8_t count = 0;
322 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
323 count += bitpop16(matrix[i]);
324 }
325 return count;
326}
327
328static void init_cols(void)
329{
330 for(int x = 0; x < MATRIX_COLS; x++) {
331 _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
332 _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
333 }
334}
335
336static matrix_row_t read_cols(void)
337{
338 matrix_row_t result = 0;
339 for(int x = 0; x < MATRIX_COLS; x++) {
340 result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
341 }
342 return result;
343}
344
345static void unselect_rows(void)
346{
347 for(int x = 0; x < ROWS_PER_HAND; x++) {
348 _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
349 _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
350 }
351}
352
353static void select_row(uint8_t row)
354{
355 _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
356 _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
357}
diff --git a/keyboards/zinc/rev1/rev1.c b/keyboards/zinc/rev1/rev1.c
index 2ce08a07c4..a9c2cfdbac 100644
--- a/keyboards/zinc/rev1/rev1.c
+++ b/keyboards/zinc/rev1/rev1.c
@@ -3,4 +3,3 @@
3void matrix_init_kb(void) { 3void matrix_init_kb(void) {
4 matrix_init_user(); 4 matrix_init_user();
5}; 5};
6
diff --git a/keyboards/zinc/rev1/rev1.h b/keyboards/zinc/rev1/rev1.h
index aa1c408b0b..1bf2c565ae 100644
--- a/keyboards/zinc/rev1/rev1.h
+++ b/keyboards/zinc/rev1/rev1.h
@@ -1,22 +1,7 @@
1#pragma once 1#pragma once
2 2
3#include "../zinc.h"
4
5#include "quantum.h" 3#include "quantum.h"
6 4
7#ifdef RGBLIGHT_ENABLE
8//rgb led driver
9#include "ws2812.h"
10#endif
11
12#ifdef USE_I2C
13#include <stddef.h>
14#ifdef __AVR__
15 #include <avr/io.h>
16 #include <avr/interrupt.h>
17#endif
18#endif
19
20// Standard Keymap 5// Standard Keymap
21// (TRRS jack on both halves are to the left side) 6// (TRRS jack on both halves are to the left side)
22#define LAYOUT( \ 7#define LAYOUT( \
diff --git a/keyboards/zinc/rev1/rules.mk b/keyboards/zinc/rev1/rules.mk
index e78b9258d7..d38a618090 100644
--- a/keyboards/zinc/rev1/rules.mk
+++ b/keyboards/zinc/rev1/rules.mk
@@ -1,4 +1 @@
1SRC += rev1/matrix.c SPLIT_KEYBOARD = yes
2SRC += rev1/split_util.c
3SRC += rev1/split_scomm.c
4SRC += ws2812.c
diff --git a/keyboards/zinc/rev1/serial_config.h b/keyboards/zinc/rev1/serial_config.h
deleted file mode 100644
index 9fb5dfc671..0000000000
--- a/keyboards/zinc/rev1/serial_config.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef SOFT_SERIAL_CONFIG_H
2#define SOFT_SERIAL_CONFIG_H
3
4#ifndef SOFT_SERIAL_PIN
5/* Soft Serial defines */
6#define SOFT_SERIAL_PIN D2
7// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5
8// // 1: about 137kbps (default)
9// // 2: about 75kbps
10// // 3: about 39kbps
11// // 4: about 26kbps
12// // 5: about 20kbps
13#endif
14
15//// USE flexible API (using multi-type transaction function)
16#define SERIAL_USE_MULTI_TRANSACTION
17
18#endif /* SOFT_SERIAL_CONFIG_H */
diff --git a/keyboards/zinc/rev1/serial_config_simpleapi.h b/keyboards/zinc/rev1/serial_config_simpleapi.h
deleted file mode 100644
index e2d22a41e7..0000000000
--- a/keyboards/zinc/rev1/serial_config_simpleapi.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef SERIAL_CONFIG_SIMPLEAPI_H
2#define SERIAL_CONFIG_SIMPLEAPI_H
3
4#undef SERIAL_USE_MULTI_TRANSACTION
5#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
6#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
7
8#endif // SERIAL_CONFIG_SIMPLEAPI_H
diff --git a/keyboards/zinc/rev1/split_scomm.c b/keyboards/zinc/rev1/split_scomm.c
deleted file mode 100644
index 50d233ce9a..0000000000
--- a/keyboards/zinc/rev1/split_scomm.c
+++ /dev/null
@@ -1,95 +0,0 @@
1#ifdef USE_SERIAL
2#ifdef SERIAL_USE_MULTI_TRANSACTION
3/* --- USE flexible API (using multi-type transaction function) --- */
4
5#include <stdbool.h>
6#include <stdint.h>
7#include <stddef.h>
8#include <split_scomm.h>
9#include "serial.h"
10#ifdef SERIAL_DEBUG_MODE
11#include <avr/io.h>
12#endif
13#ifdef CONSOLE_ENABLE
14 #include <print.h>
15#endif
16
17uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
18uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
19uint8_t volatile status_com = 0;
20uint8_t volatile status1 = 0;
21uint8_t slave_buffer_change_count = 0;
22uint8_t s_change_old = 0xff;
23uint8_t s_change_new = 0xff;
24
25SSTD_t transactions[] = {
26#define GET_SLAVE_STATUS 0
27 /* master buffer not changed, only recive slave_buffer_change_count */
28 { (uint8_t *)&status_com,
29 0, NULL,
30 sizeof(slave_buffer_change_count), &slave_buffer_change_count,
31 },
32#define PUT_MASTER_GET_SLAVE_STATUS 1
33 /* master buffer changed need send, and recive slave_buffer_change_count */
34 { (uint8_t *)&status_com,
35 sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
36 sizeof(slave_buffer_change_count), &slave_buffer_change_count,
37 },
38#define GET_SLAVE_BUFFER 2
39 /* recive serial_slave_buffer */
40 { (uint8_t *)&status1,
41 0, NULL,
42 sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
43 }
44};
45
46void serial_master_init(void)
47{
48 soft_serial_initiator_init(transactions, TID_LIMIT(transactions));
49}
50
51void serial_slave_init(void)
52{
53 soft_serial_target_init(transactions, TID_LIMIT(transactions));
54}
55
56// 0 => no error
57// 1 => slave did not respond
58// 2 => checksum error
59int serial_update_buffers(int master_update)
60{
61 int status, smatstatus;
62 static int need_retry = 0;
63
64 if( s_change_old != s_change_new ) {
65 smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER);
66 if( smatstatus == TRANSACTION_END ) {
67 s_change_old = s_change_new;
68#ifdef CONSOLE_ENABLE
69 uprintf("slave matrix = %b %b %b %b %b\n",
70 serial_slave_buffer[0], serial_slave_buffer[1],
71 serial_slave_buffer[2], serial_slave_buffer[3],
72 serial_slave_buffer[4] );
73#endif
74 }
75 } else {
76 // serial_slave_buffer dosen't change
77 smatstatus = TRANSACTION_END; // dummy status
78 }
79
80 if( !master_update && !need_retry) {
81 status = soft_serial_transaction(GET_SLAVE_STATUS);
82 } else {
83 status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS);
84 }
85 if( status == TRANSACTION_END ) {
86 s_change_new = slave_buffer_change_count;
87 need_retry = 0;
88 } else {
89 need_retry = 1;
90 }
91 return smatstatus;
92}
93
94#endif // SERIAL_USE_MULTI_TRANSACTION
95#endif /* USE_SERIAL */
diff --git a/keyboards/zinc/rev1/split_scomm.h b/keyboards/zinc/rev1/split_scomm.h
deleted file mode 100644
index 873d8939d8..0000000000
--- a/keyboards/zinc/rev1/split_scomm.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef SPLIT_COMM_H
2#define SPLIT_COMM_H
3
4#ifndef SERIAL_USE_MULTI_TRANSACTION
5/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */
6#include "serial.h"
7
8#else
9/* --- USE flexible API (using multi-type transaction function) --- */
10// Buffers for master - slave communication
11#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
12#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
13
14extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
15extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
16extern uint8_t slave_buffer_change_count;
17
18void serial_master_init(void);
19void serial_slave_init(void);
20int serial_update_buffers(int master_changed);
21
22#endif
23
24#endif /* SPLIT_COMM_H */
diff --git a/keyboards/zinc/rev1/split_util.c b/keyboards/zinc/rev1/split_util.c
deleted file mode 100644
index e1ff8b4379..0000000000
--- a/keyboards/zinc/rev1/split_util.c
+++ /dev/null
@@ -1,70 +0,0 @@
1#include <avr/io.h>
2#include <avr/wdt.h>
3#include <avr/power.h>
4#include <avr/interrupt.h>
5#include <util/delay.h>
6#include <avr/eeprom.h>
7#include "split_util.h"
8#include "matrix.h"
9#include "keyboard.h"
10
11#ifdef USE_MATRIX_I2C
12# include "i2c.h"
13#else
14# include "split_scomm.h"
15#endif
16
17volatile bool isLeftHand = true;
18
19static void setup_handedness(void) {
20 #ifdef EE_HANDS
21 isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
22 #else
23 // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
24 #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
25 isLeftHand = !has_usb();
26 #else
27 isLeftHand = has_usb();
28 #endif
29 #endif
30}
31
32static void keyboard_master_setup(void) {
33
34#ifdef USE_MATRIX_I2C
35 i2c_master_init();
36#else
37 serial_master_init();
38#endif
39}
40
41static void keyboard_slave_setup(void) {
42
43#ifdef USE_MATRIX_I2C
44 i2c_slave_init(SLAVE_I2C_ADDRESS);
45#else
46 serial_slave_init();
47#endif
48}
49
50bool has_usb(void) {
51 USBCON |= (1 << OTGPADE); //enables VBUS pad
52 _delay_us(5);
53 return (USBSTA & (1<<VBUS)); //checks state of VBUS
54}
55
56void split_keyboard_setup(void) {
57 setup_handedness();
58
59 if (has_usb()) {
60 keyboard_master_setup();
61 } else {
62 keyboard_slave_setup();
63 }
64 sei();
65}
66
67// this code runs before the usb and keyboard is initialized
68void matrix_setup(void) {
69 split_keyboard_setup();
70}
diff --git a/keyboards/zinc/rev1/split_util.h b/keyboards/zinc/rev1/split_util.h
deleted file mode 100644
index 687ca19bd3..0000000000
--- a/keyboards/zinc/rev1/split_util.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef SPLIT_KEYBOARD_UTIL_H
2#define SPLIT_KEYBOARD_UTIL_H
3
4#include <stdbool.h>
5#include "eeconfig.h"
6
7#define SLAVE_I2C_ADDRESS 0x32
8
9extern volatile bool isLeftHand;
10
11// slave version of matix scan, defined in matrix.c
12void matrix_slave_scan(void);
13
14void split_keyboard_setup(void);
15bool has_usb(void);
16
17void matrix_master_OLED_init (void);
18
19#endif
diff --git a/keyboards/zinc/reva/config.h b/keyboards/zinc/reva/config.h
index 8eeb154acc..e94ffb7c65 100644
--- a/keyboards/zinc/reva/config.h
+++ b/keyboards/zinc/reva/config.h
@@ -30,9 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
30#define TAPPING_TERM 100 30#define TAPPING_TERM 100
31 31
32/* Use I2C or Serial */ 32/* Use I2C or Serial */
33//#define USE_I2C
34#define USE_SERIAL 33#define USE_SERIAL
35//#define USE_MATRIX_I2C 34#define SOFT_SERIAL_PIN D2
36 35
37/* Select hand configuration */ 36/* Select hand configuration */
38#define MASTER_LEFT 37#define MASTER_LEFT
@@ -41,18 +40,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
41 40
42/* key matrix size */ 41/* key matrix size */
43// Rows are doubled-up 42// Rows are doubled-up
44 #define MATRIX_ROWS 8 43#define MATRIX_ROWS 8
45 #define MATRIX_ROW_PINS { D4, C6, D7, E6 } 44#define MATRIX_ROW_PINS { D4, C6, D7, E6 }
46 45
47// wiring of each half 46// wiring of each half
48#define MATRIX_COLS 6 47#define MATRIX_COLS 6
49#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3} 48#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3}
50 49
51/* define if matrix has ghost */ 50#define DIODE_DIRECTION COL2ROW
52//#define MATRIX_HAS_GHOST
53
54/* number of backlight levels */
55// #define BACKLIGHT_LEVELS 3
56 51
57/* Set 0 if debouncing isn't needed */ 52/* Set 0 if debouncing isn't needed */
58#define DEBOUNCE 5 53#define DEBOUNCE 5
@@ -64,25 +59,44 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
64 59
65/* ws2812 RGB LED */ 60/* ws2812 RGB LED */
66#define RGB_DI_PIN D3 61#define RGB_DI_PIN D3
67#define RGBLIGHT_TIMER
68//#define RGBLED_NUM 24 // Number of LEDs. see ./keymaps/default/config.h
69#define ws2812_PORTREG PORTD
70#define ws2812_DDRREG DDRD
71 62
72// RGB LED support 63// RGB LED support
73//#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no 64//#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no
74// see ./rules.mk: LED_BACK_ENABLE or LED_UNDERGLOW_ENABLE set yes 65// see ./rules.mk: LED_BACK_ENABLE or LED_UNDERGLOW_ENABLE set yes
75#ifdef RGBLED_BACK 66#ifdef RGBLIGHT_ENABLE
76 #define RGBLED_NUM 24 67 #define RGBLIGHT_SPLIT
77#else 68 #ifdef RGBLED_BACK
78 #define RGBLED_NUM 6 69 #ifdef RGBLED_CONT
70 #define RGBLED_NUM 48
71 #define RGBLED_SPLIT { 24, 24 }
72 #else
73 #define RGBLED_NUM 24
74 #endif
75 #else
76 #ifdef RGBLED_BOTH
77 #ifdef RGBLED_CONT
78 #define RGBLED_NUM 60
79 #define RGBLED_SPLIT { 30, 30 }
80// #define RGBLIGHT_LED_MAP {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29}
81 #else
82 #define RGBLED_NUM 30
83 #endif
84 #else
85 #ifdef RGBLED_CONT
86 #define RGBLED_NUM 12
87 #define RGBLED_SPLIT { 6, 6 }
88 #else
89 #define RGBLED_NUM 6
90 #endif
91 #endif
92 #endif
79#endif 93#endif
80 94
81#ifndef IOS_DEVICE_ENABLE 95#ifndef IOS_DEVICE_ENABLE
82 #if RGBLED_NUM <= 6 96 #if (RGBLED_NUM <= 6) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 12))
83 #define RGBLIGHT_LIMIT_VAL 255 97 #define RGBLIGHT_LIMIT_VAL 255
84 #else 98 #else
85 #if RGBLED_NUM <= 16 99 #if (RGBLED_NUM <= 16) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 32))
86 #define RGBLIGHT_LIMIT_VAL 130 100 #define RGBLIGHT_LIMIT_VAL 130
87 #else 101 #else
88 #define RGBLIGHT_LIMIT_VAL 120 102 #define RGBLIGHT_LIMIT_VAL 120
@@ -90,10 +104,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
90 #endif 104 #endif
91 #define RGBLIGHT_VAL_STEP 17 105 #define RGBLIGHT_VAL_STEP 17
92#else 106#else
93 #if RGBLED_NUM <= 6 107 #if (RGBLED_NUM <= 6) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 12))
94 #define RGBLIGHT_LIMIT_VAL 90 108 #define RGBLIGHT_LIMIT_VAL 90
95 #else 109 #else
96 #if RGBLED_NUM <= 16 110 #if (RGBLED_NUM <= 16) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 32))
97 #define RGBLIGHT_LIMIT_VAL 45 111 #define RGBLIGHT_LIMIT_VAL 45
98 #else 112 #else
99 #define RGBLIGHT_LIMIT_VAL 35 113 #define RGBLIGHT_LIMIT_VAL 35
diff --git a/keyboards/zinc/reva/matrix.c b/keyboards/zinc/reva/matrix.c
deleted file mode 100644
index 5b58500db8..0000000000
--- a/keyboards/zinc/reva/matrix.c
+++ /dev/null
@@ -1,357 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/*
19 * scan matrix
20 */
21#include <stdint.h>
22#include <stdbool.h>
23#include <string.h>
24#include <avr/io.h>
25#include <avr/wdt.h>
26#include <avr/interrupt.h>
27#include <util/delay.h>
28#include "print.h"
29#include "debug.h"
30#include "util.h"
31#include "matrix.h"
32#include "split_util.h"
33#include "quantum.h"
34
35#ifdef USE_MATRIX_I2C
36# include "i2c.h"
37#else // USE_SERIAL
38# include "split_scomm.h"
39#endif
40
41#ifndef DEBOUNCE
42# define DEBOUNCE 5
43#endif
44
45#define ERROR_DISCONNECT_COUNT 5
46
47static uint8_t debouncing = DEBOUNCE;
48static const int ROWS_PER_HAND = MATRIX_ROWS/2;
49static uint8_t error_count = 0;
50uint8_t is_master = 0 ;
51
52static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
53static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
54
55/* matrix state(1:on, 0:off) */
56static matrix_row_t matrix[MATRIX_ROWS];
57static matrix_row_t matrix_debouncing[MATRIX_ROWS];
58
59static matrix_row_t read_cols(void);
60static void init_cols(void);
61static void unselect_rows(void);
62static void select_row(uint8_t row);
63static uint8_t matrix_master_scan(void);
64
65
66__attribute__ ((weak))
67void matrix_init_kb(void) {
68 matrix_init_user();
69}
70
71__attribute__ ((weak))
72void matrix_scan_kb(void) {
73 matrix_scan_user();
74}
75
76__attribute__ ((weak))
77void matrix_init_user(void) {
78}
79
80__attribute__ ((weak))
81void matrix_scan_user(void) {
82}
83
84inline
85uint8_t matrix_rows(void)
86{
87 return MATRIX_ROWS;
88}
89
90inline
91uint8_t matrix_cols(void)
92{
93 return MATRIX_COLS;
94}
95
96void matrix_init(void)
97{
98 debug_enable = true;
99 debug_matrix = true;
100 debug_mouse = true;
101 // initialize row and col
102 unselect_rows();
103 init_cols();
104
105 setPinOutput(B0);
106 setPinOutput(D5);
107 writePinHigh(B0);
108 writePinHigh(D5);
109
110 // initialize matrix state: all keys off
111 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
112 matrix[i] = 0;
113 matrix_debouncing[i] = 0;
114 }
115
116 is_master = has_usb();
117
118 matrix_init_quantum();
119}
120
121uint8_t _matrix_scan(void)
122{
123 // Right hand is stored after the left in the matirx so, we need to offset it
124 int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
125
126 for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
127 select_row(i);
128 _delay_us(30); // without this wait read unstable value.
129 matrix_row_t cols = read_cols();
130 if (matrix_debouncing[i+offset] != cols) {
131 matrix_debouncing[i+offset] = cols;
132 debouncing = DEBOUNCE;
133 }
134 unselect_rows();
135 }
136
137 if (debouncing) {
138 if (--debouncing) {
139 _delay_ms(1);
140 } else {
141 for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
142 matrix[i+offset] = matrix_debouncing[i+offset];
143 }
144 }
145 }
146
147 return 1;
148}
149
150#ifdef USE_MATRIX_I2C
151
152// Get rows from other half over i2c
153int i2c_transaction(void) {
154 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
155
156 int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
157 if (err) goto i2c_error;
158
159 // start of matrix stored at 0x00
160 err = i2c_master_write(0x00);
161 if (err) goto i2c_error;
162
163 // Start read
164 err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
165 if (err) goto i2c_error;
166
167 if (!err) {
168 int i;
169 for (i = 0; i < ROWS_PER_HAND-1; ++i) {
170 matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
171 }
172 matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
173 i2c_master_stop();
174 } else {
175i2c_error: // the cable is disconnceted, or something else went wrong
176 i2c_reset_state();
177 return err;
178 }
179
180 return 0;
181}
182
183#else // USE_SERIAL
184
185int serial_transaction(int master_changed) {
186 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
187#ifdef SERIAL_USE_MULTI_TRANSACTION
188 int ret=serial_update_buffers(master_changed);
189#else
190 int ret=serial_update_buffers();
191#endif
192 if (ret ) {
193 if(ret==2) writePinLow(B0);
194 return 1;
195 }
196 writePinHigh(B0);
197 memcpy(&matrix[slaveOffset],
198 (void *)serial_slave_buffer, sizeof(serial_slave_buffer));
199 return 0;
200}
201#endif
202
203uint8_t matrix_scan(void)
204{
205 if (is_master) {
206 matrix_master_scan();
207 }else{
208 matrix_slave_scan();
209 int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
210 memcpy(&matrix[offset],
211 (void *)serial_master_buffer, sizeof(serial_master_buffer));
212 matrix_scan_quantum();
213 }
214 return 1;
215}
216
217
218uint8_t matrix_master_scan(void) {
219
220 int ret = _matrix_scan();
221 int mchanged = 1;
222 int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
223
224#ifdef USE_MATRIX_I2C
225// for (int i = 0; i < ROWS_PER_HAND; ++i) {
226 /* i2c_slave_buffer[i] = matrix[offset+i]; */
227// i2c_slave_buffer[i] = matrix[offset+i];
228// }
229#else // USE_SERIAL
230 #ifdef SERIAL_USE_MULTI_TRANSACTION
231 mchanged = memcmp((void *)serial_master_buffer,
232 &matrix[offset], sizeof(serial_master_buffer));
233 #endif
234 memcpy((void *)serial_master_buffer,
235 &matrix[offset], sizeof(serial_master_buffer));
236#endif
237
238#ifdef USE_MATRIX_I2C
239 if( i2c_transaction() ) {
240#else // USE_SERIAL
241 if( serial_transaction(mchanged) ) {
242#endif
243 // turn on the indicator led when halves are disconnected
244 writePinLow(D5);
245
246 error_count++;
247
248 if (error_count > ERROR_DISCONNECT_COUNT) {
249 // reset other half if disconnected
250 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
251 for (int i = 0; i < ROWS_PER_HAND; ++i) {
252 matrix[slaveOffset+i] = 0;
253 }
254 }
255 } else {
256 // turn off the indicator led on no error
257 writePinHigh(D5);
258 error_count = 0;
259 }
260 matrix_scan_quantum();
261 return ret;
262}
263
264void matrix_slave_scan(void) {
265 _matrix_scan();
266
267 int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
268
269#ifdef USE_MATRIX_I2C
270 for (int i = 0; i < ROWS_PER_HAND; ++i) {
271 /* i2c_slave_buffer[i] = matrix[offset+i]; */
272 i2c_slave_buffer[i] = matrix[offset+i];
273 }
274#else // USE_SERIAL
275 #ifdef SERIAL_USE_MULTI_TRANSACTION
276 int change = 0;
277 #endif
278 for (int i = 0; i < ROWS_PER_HAND; ++i) {
279 #ifdef SERIAL_USE_MULTI_TRANSACTION
280 if( serial_slave_buffer[i] != matrix[offset+i] )
281 change = 1;
282 #endif
283 serial_slave_buffer[i] = matrix[offset+i];
284 }
285 #ifdef SERIAL_USE_MULTI_TRANSACTION
286 slave_buffer_change_count += change;
287 #endif
288#endif
289}
290
291bool matrix_is_modified(void)
292{
293 if (debouncing) return false;
294 return true;
295}
296
297inline
298bool matrix_is_on(uint8_t row, uint8_t col)
299{
300 return (matrix[row] & ((matrix_row_t)1<<col));
301}
302
303inline
304matrix_row_t matrix_get_row(uint8_t row)
305{
306 return matrix[row];
307}
308
309void matrix_print(void)
310{
311 print("\nr/c 0123456789ABCDEF\n");
312 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
313 phex(row); print(": ");
314 pbin_reverse16(matrix_get_row(row));
315 print("\n");
316 }
317}
318
319uint8_t matrix_key_count(void)
320{
321 uint8_t count = 0;
322 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
323 count += bitpop16(matrix[i]);
324 }
325 return count;
326}
327
328static void init_cols(void)
329{
330 for(int x = 0; x < MATRIX_COLS; x++) {
331 _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
332 _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
333 }
334}
335
336static matrix_row_t read_cols(void)
337{
338 matrix_row_t result = 0;
339 for(int x = 0; x < MATRIX_COLS; x++) {
340 result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
341 }
342 return result;
343}
344
345static void unselect_rows(void)
346{
347 for(int x = 0; x < ROWS_PER_HAND; x++) {
348 _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
349 _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
350 }
351}
352
353static void select_row(uint8_t row)
354{
355 _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
356 _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
357}
diff --git a/keyboards/zinc/reva/reva.c b/keyboards/zinc/reva/reva.c
index 2ce08a07c4..a9c2cfdbac 100644
--- a/keyboards/zinc/reva/reva.c
+++ b/keyboards/zinc/reva/reva.c
@@ -3,4 +3,3 @@
3void matrix_init_kb(void) { 3void matrix_init_kb(void) {
4 matrix_init_user(); 4 matrix_init_user();
5}; 5};
6
diff --git a/keyboards/zinc/reva/reva.h b/keyboards/zinc/reva/reva.h
index aa1c408b0b..1bf2c565ae 100644
--- a/keyboards/zinc/reva/reva.h
+++ b/keyboards/zinc/reva/reva.h
@@ -1,22 +1,7 @@
1#pragma once 1#pragma once
2 2
3#include "../zinc.h"
4
5#include "quantum.h" 3#include "quantum.h"
6 4
7#ifdef RGBLIGHT_ENABLE
8//rgb led driver
9#include "ws2812.h"
10#endif
11
12#ifdef USE_I2C
13#include <stddef.h>
14#ifdef __AVR__
15 #include <avr/io.h>
16 #include <avr/interrupt.h>
17#endif
18#endif
19
20// Standard Keymap 5// Standard Keymap
21// (TRRS jack on both halves are to the left side) 6// (TRRS jack on both halves are to the left side)
22#define LAYOUT( \ 7#define LAYOUT( \
diff --git a/keyboards/zinc/reva/rules.mk b/keyboards/zinc/reva/rules.mk
index 3ea61267a2..83895bdcb8 100644
--- a/keyboards/zinc/reva/rules.mk
+++ b/keyboards/zinc/reva/rules.mk
@@ -1,4 +1 @@
1SRC += reva/matrix.c SPLIT_KEYBOARD = yes \ No newline at end of file
2SRC += reva/split_util.c
3SRC += reva/split_scomm.c
4SRC += ws2812.c
diff --git a/keyboards/zinc/reva/serial_config.h b/keyboards/zinc/reva/serial_config.h
deleted file mode 100644
index 9fb5dfc671..0000000000
--- a/keyboards/zinc/reva/serial_config.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef SOFT_SERIAL_CONFIG_H
2#define SOFT_SERIAL_CONFIG_H
3
4#ifndef SOFT_SERIAL_PIN
5/* Soft Serial defines */
6#define SOFT_SERIAL_PIN D2
7// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5
8// // 1: about 137kbps (default)
9// // 2: about 75kbps
10// // 3: about 39kbps
11// // 4: about 26kbps
12// // 5: about 20kbps
13#endif
14
15//// USE flexible API (using multi-type transaction function)
16#define SERIAL_USE_MULTI_TRANSACTION
17
18#endif /* SOFT_SERIAL_CONFIG_H */
diff --git a/keyboards/zinc/reva/serial_config_simpleapi.h b/keyboards/zinc/reva/serial_config_simpleapi.h
deleted file mode 100644
index e2d22a41e7..0000000000
--- a/keyboards/zinc/reva/serial_config_simpleapi.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef SERIAL_CONFIG_SIMPLEAPI_H
2#define SERIAL_CONFIG_SIMPLEAPI_H
3
4#undef SERIAL_USE_MULTI_TRANSACTION
5#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
6#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
7
8#endif // SERIAL_CONFIG_SIMPLEAPI_H
diff --git a/keyboards/zinc/reva/split_scomm.c b/keyboards/zinc/reva/split_scomm.c
deleted file mode 100644
index 50d233ce9a..0000000000
--- a/keyboards/zinc/reva/split_scomm.c
+++ /dev/null
@@ -1,95 +0,0 @@
1#ifdef USE_SERIAL
2#ifdef SERIAL_USE_MULTI_TRANSACTION
3/* --- USE flexible API (using multi-type transaction function) --- */
4
5#include <stdbool.h>
6#include <stdint.h>
7#include <stddef.h>
8#include <split_scomm.h>
9#include "serial.h"
10#ifdef SERIAL_DEBUG_MODE
11#include <avr/io.h>
12#endif
13#ifdef CONSOLE_ENABLE
14 #include <print.h>
15#endif
16
17uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
18uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
19uint8_t volatile status_com = 0;
20uint8_t volatile status1 = 0;
21uint8_t slave_buffer_change_count = 0;
22uint8_t s_change_old = 0xff;
23uint8_t s_change_new = 0xff;
24
25SSTD_t transactions[] = {
26#define GET_SLAVE_STATUS 0
27 /* master buffer not changed, only recive slave_buffer_change_count */
28 { (uint8_t *)&status_com,
29 0, NULL,
30 sizeof(slave_buffer_change_count), &slave_buffer_change_count,
31 },
32#define PUT_MASTER_GET_SLAVE_STATUS 1
33 /* master buffer changed need send, and recive slave_buffer_change_count */
34 { (uint8_t *)&status_com,
35 sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
36 sizeof(slave_buffer_change_count), &slave_buffer_change_count,
37 },
38#define GET_SLAVE_BUFFER 2
39 /* recive serial_slave_buffer */
40 { (uint8_t *)&status1,
41 0, NULL,
42 sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
43 }
44};
45
46void serial_master_init(void)
47{
48 soft_serial_initiator_init(transactions, TID_LIMIT(transactions));
49}
50
51void serial_slave_init(void)
52{
53 soft_serial_target_init(transactions, TID_LIMIT(transactions));
54}
55
56// 0 => no error
57// 1 => slave did not respond
58// 2 => checksum error
59int serial_update_buffers(int master_update)
60{
61 int status, smatstatus;
62 static int need_retry = 0;
63
64 if( s_change_old != s_change_new ) {
65 smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER);
66 if( smatstatus == TRANSACTION_END ) {
67 s_change_old = s_change_new;
68#ifdef CONSOLE_ENABLE
69 uprintf("slave matrix = %b %b %b %b %b\n",
70 serial_slave_buffer[0], serial_slave_buffer[1],
71 serial_slave_buffer[2], serial_slave_buffer[3],
72 serial_slave_buffer[4] );
73#endif
74 }
75 } else {
76 // serial_slave_buffer dosen't change
77 smatstatus = TRANSACTION_END; // dummy status
78 }
79
80 if( !master_update && !need_retry) {
81 status = soft_serial_transaction(GET_SLAVE_STATUS);
82 } else {
83 status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS);
84 }
85 if( status == TRANSACTION_END ) {
86 s_change_new = slave_buffer_change_count;
87 need_retry = 0;
88 } else {
89 need_retry = 1;
90 }
91 return smatstatus;
92}
93
94#endif // SERIAL_USE_MULTI_TRANSACTION
95#endif /* USE_SERIAL */
diff --git a/keyboards/zinc/reva/split_scomm.h b/keyboards/zinc/reva/split_scomm.h
deleted file mode 100644
index 873d8939d8..0000000000
--- a/keyboards/zinc/reva/split_scomm.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef SPLIT_COMM_H
2#define SPLIT_COMM_H
3
4#ifndef SERIAL_USE_MULTI_TRANSACTION
5/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */
6#include "serial.h"
7
8#else
9/* --- USE flexible API (using multi-type transaction function) --- */
10// Buffers for master - slave communication
11#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
12#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
13
14extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
15extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
16extern uint8_t slave_buffer_change_count;
17
18void serial_master_init(void);
19void serial_slave_init(void);
20int serial_update_buffers(int master_changed);
21
22#endif
23
24#endif /* SPLIT_COMM_H */
diff --git a/keyboards/zinc/reva/split_util.c b/keyboards/zinc/reva/split_util.c
deleted file mode 100644
index e1ff8b4379..0000000000
--- a/keyboards/zinc/reva/split_util.c
+++ /dev/null
@@ -1,70 +0,0 @@
1#include <avr/io.h>
2#include <avr/wdt.h>
3#include <avr/power.h>
4#include <avr/interrupt.h>
5#include <util/delay.h>
6#include <avr/eeprom.h>
7#include "split_util.h"
8#include "matrix.h"
9#include "keyboard.h"
10
11#ifdef USE_MATRIX_I2C
12# include "i2c.h"
13#else
14# include "split_scomm.h"
15#endif
16
17volatile bool isLeftHand = true;
18
19static void setup_handedness(void) {
20 #ifdef EE_HANDS
21 isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
22 #else
23 // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
24 #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
25 isLeftHand = !has_usb();
26 #else
27 isLeftHand = has_usb();
28 #endif
29 #endif
30}
31
32static void keyboard_master_setup(void) {
33
34#ifdef USE_MATRIX_I2C
35 i2c_master_init();
36#else
37 serial_master_init();
38#endif
39}
40
41static void keyboard_slave_setup(void) {
42
43#ifdef USE_MATRIX_I2C
44 i2c_slave_init(SLAVE_I2C_ADDRESS);
45#else
46 serial_slave_init();
47#endif
48}
49
50bool has_usb(void) {
51 USBCON |= (1 << OTGPADE); //enables VBUS pad
52 _delay_us(5);
53 return (USBSTA & (1<<VBUS)); //checks state of VBUS
54}
55
56void split_keyboard_setup(void) {
57 setup_handedness();
58
59 if (has_usb()) {
60 keyboard_master_setup();
61 } else {
62 keyboard_slave_setup();
63 }
64 sei();
65}
66
67// this code runs before the usb and keyboard is initialized
68void matrix_setup(void) {
69 split_keyboard_setup();
70}
diff --git a/keyboards/zinc/reva/split_util.h b/keyboards/zinc/reva/split_util.h
deleted file mode 100644
index 687ca19bd3..0000000000
--- a/keyboards/zinc/reva/split_util.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef SPLIT_KEYBOARD_UTIL_H
2#define SPLIT_KEYBOARD_UTIL_H
3
4#include <stdbool.h>
5#include "eeconfig.h"
6
7#define SLAVE_I2C_ADDRESS 0x32
8
9extern volatile bool isLeftHand;
10
11// slave version of matix scan, defined in matrix.c
12void matrix_slave_scan(void);
13
14void split_keyboard_setup(void);
15bool has_usb(void);
16
17void matrix_master_OLED_init (void);
18
19#endif
diff --git a/keyboards/zinc/rules.mk b/keyboards/zinc/rules.mk
index 63a8cc8fc3..36e717d60a 100644
--- a/keyboards/zinc/rules.mk
+++ b/keyboards/zinc/rules.mk
@@ -27,12 +27,8 @@ AUDIO_ENABLE = no # Audio output on port C6
27UNICODE_ENABLE = no # Unicode 27UNICODE_ENABLE = no # Unicode
28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. 29RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
30SUBPROJECT_rev1 = no
31USE_I2C = yes
32# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
33SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 30SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
34 31
35CUSTOM_MATRIX = yes
36 32
37DEFAULT_FOLDER = zinc/rev1 33DEFAULT_FOLDER = zinc/rev1
38 34
diff --git a/keyboards/zinc/serial.c b/keyboards/zinc/serial.c
deleted file mode 100644
index f6293c3dc2..0000000000
--- a/keyboards/zinc/serial.c
+++ /dev/null
@@ -1,589 +0,0 @@
1/*
2 * WARNING: be careful changing this code, it is very timing dependent
3 *
4 * 2018-10-28 checked
5 * avr-gcc 4.9.2
6 * avr-gcc 5.4.0
7 * avr-gcc 7.3.0
8 */
9
10#ifndef F_CPU
11#define F_CPU 16000000
12#endif
13
14#include <avr/io.h>
15#include <avr/interrupt.h>
16#include <util/delay.h>
17#include <stddef.h>
18#include <stdbool.h>
19#include "serial.h"
20
21#ifdef SOFT_SERIAL_PIN
22
23#ifdef __AVR_ATmega32U4__
24 // if using ATmega32U4 I2C, can not use PD0 and PD1 in soft serial.
25 #ifdef USE_I2C
26 #if SOFT_SERIAL_PIN == D0 || SOFT_SERIAL_PIN == D1
27 #error Using ATmega32U4 I2C, so can not use PD0, PD1
28 #endif
29 #endif
30
31 #if SOFT_SERIAL_PIN >= D0 && SOFT_SERIAL_PIN <= D3
32 #define SERIAL_PIN_DDR DDRD
33 #define SERIAL_PIN_PORT PORTD
34 #define SERIAL_PIN_INPUT PIND
35 #if SOFT_SERIAL_PIN == D0
36 #define SERIAL_PIN_MASK _BV(PD0)
37 #define EIMSK_BIT _BV(INT0)
38 #define EICRx_BIT (~(_BV(ISC00) | _BV(ISC01)))
39 #define SERIAL_PIN_INTERRUPT INT0_vect
40 #elif SOFT_SERIAL_PIN == D1
41 #define SERIAL_PIN_MASK _BV(PD1)
42 #define EIMSK_BIT _BV(INT1)
43 #define EICRx_BIT (~(_BV(ISC10) | _BV(ISC11)))
44 #define SERIAL_PIN_INTERRUPT INT1_vect
45 #elif SOFT_SERIAL_PIN == D2
46 #define SERIAL_PIN_MASK _BV(PD2)
47 #define EIMSK_BIT _BV(INT2)
48 #define EICRx_BIT (~(_BV(ISC20) | _BV(ISC21)))
49 #define SERIAL_PIN_INTERRUPT INT2_vect
50 #elif SOFT_SERIAL_PIN == D3
51 #define SERIAL_PIN_MASK _BV(PD3)
52 #define EIMSK_BIT _BV(INT3)
53 #define EICRx_BIT (~(_BV(ISC30) | _BV(ISC31)))
54 #define SERIAL_PIN_INTERRUPT INT3_vect
55 #endif
56 #elif SOFT_SERIAL_PIN == E6
57 #define SERIAL_PIN_DDR DDRE
58 #define SERIAL_PIN_PORT PORTE
59 #define SERIAL_PIN_INPUT PINE
60 #define SERIAL_PIN_MASK _BV(PE6)
61 #define EIMSK_BIT _BV(INT6)
62 #define EICRx_BIT (~(_BV(ISC60) | _BV(ISC61)))
63 #define SERIAL_PIN_INTERRUPT INT6_vect
64 #else
65 #error invalid SOFT_SERIAL_PIN value
66 #endif
67
68#else
69 #error serial.c now support ATmega32U4 only
70#endif
71
72//////////////// for backward compatibility ////////////////////////////////
73#ifndef SERIAL_USE_MULTI_TRANSACTION
74/* --- USE Simple API (OLD API, compatible with let's split serial.c) */
75 #if SERIAL_SLAVE_BUFFER_LENGTH > 0
76 uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
77 #endif
78 #if SERIAL_MASTER_BUFFER_LENGTH > 0
79 uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
80 #endif
81 uint8_t volatile status0 = 0;
82
83SSTD_t transactions[] = {
84 { (uint8_t *)&status0,
85 #if SERIAL_MASTER_BUFFER_LENGTH > 0
86 sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
87 #else
88 0, (uint8_t *)NULL,
89 #endif
90 #if SERIAL_SLAVE_BUFFER_LENGTH > 0
91 sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
92 #else
93 0, (uint8_t *)NULL,
94 #endif
95 }
96};
97
98void serial_master_init(void)
99{ soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); }
100
101void serial_slave_init(void)
102{ soft_serial_target_init(transactions, TID_LIMIT(transactions)); }
103
104// 0 => no error
105// 1 => slave did not respond
106// 2 => checksum error
107int serial_update_buffers()
108{
109 int result;
110 result = soft_serial_transaction();
111 return result;
112}
113
114#endif // end of Simple API (OLD API, compatible with let's split serial.c)
115////////////////////////////////////////////////////////////////////////////
116
117#define ALWAYS_INLINE __attribute__((always_inline))
118#define NO_INLINE __attribute__((noinline))
119#define _delay_sub_us(x) __builtin_avr_delay_cycles(x)
120
121// parity check
122#define ODD_PARITY 1
123#define EVEN_PARITY 0
124#define PARITY EVEN_PARITY
125
126#ifdef SERIAL_DELAY
127 // custom setup in config.h
128 // #define TID_SEND_ADJUST 2
129 // #define SERIAL_DELAY 6 // micro sec
130 // #define READ_WRITE_START_ADJUST 30 // cycles
131 // #define READ_WRITE_WIDTH_ADJUST 8 // cycles
132#else
133// ============ Standard setups ============
134
135#ifndef SELECT_SOFT_SERIAL_SPEED
136#define SELECT_SOFT_SERIAL_SPEED 1
137// 0: about 189kbps
138// 1: about 137kbps (default)
139// 2: about 75kbps
140// 3: about 39kbps
141// 4: about 26kbps
142// 5: about 20kbps
143#endif
144
145#if __GNUC__ < 6
146 #define TID_SEND_ADJUST 14
147#else
148 #define TID_SEND_ADJUST 2
149#endif
150
151#if SELECT_SOFT_SERIAL_SPEED == 0
152 // Very High speed
153 #define SERIAL_DELAY 4 // micro sec
154 #if __GNUC__ < 6
155 #define READ_WRITE_START_ADJUST 33 // cycles
156 #define READ_WRITE_WIDTH_ADJUST 3 // cycles
157 #else
158 #define READ_WRITE_START_ADJUST 34 // cycles
159 #define READ_WRITE_WIDTH_ADJUST 7 // cycles
160 #endif
161#elif SELECT_SOFT_SERIAL_SPEED == 1
162 // High speed
163 #define SERIAL_DELAY 6 // micro sec
164 #if __GNUC__ < 6
165 #define READ_WRITE_START_ADJUST 30 // cycles
166 #define READ_WRITE_WIDTH_ADJUST 3 // cycles
167 #else
168 #define READ_WRITE_START_ADJUST 33 // cycles
169 #define READ_WRITE_WIDTH_ADJUST 7 // cycles
170 #endif
171#elif SELECT_SOFT_SERIAL_SPEED == 2
172 // Middle speed
173 #define SERIAL_DELAY 12 // micro sec
174 #define READ_WRITE_START_ADJUST 30 // cycles
175 #if __GNUC__ < 6
176 #define READ_WRITE_WIDTH_ADJUST 3 // cycles
177 #else
178 #define READ_WRITE_WIDTH_ADJUST 7 // cycles
179 #endif
180#elif SELECT_SOFT_SERIAL_SPEED == 3
181 // Low speed
182 #define SERIAL_DELAY 24 // micro sec
183 #define READ_WRITE_START_ADJUST 30 // cycles
184 #if __GNUC__ < 6
185 #define READ_WRITE_WIDTH_ADJUST 3 // cycles
186 #else
187 #define READ_WRITE_WIDTH_ADJUST 7 // cycles
188 #endif
189#elif SELECT_SOFT_SERIAL_SPEED == 4
190 // Very Low speed
191 #define SERIAL_DELAY 36 // micro sec
192 #define READ_WRITE_START_ADJUST 30 // cycles
193 #if __GNUC__ < 6
194 #define READ_WRITE_WIDTH_ADJUST 3 // cycles
195 #else
196 #define READ_WRITE_WIDTH_ADJUST 7 // cycles
197 #endif
198#elif SELECT_SOFT_SERIAL_SPEED == 5
199 // Ultra Low speed
200 #define SERIAL_DELAY 48 // micro sec
201 #define READ_WRITE_START_ADJUST 30 // cycles
202 #if __GNUC__ < 6
203 #define READ_WRITE_WIDTH_ADJUST 3 // cycles
204 #else
205 #define READ_WRITE_WIDTH_ADJUST 7 // cycles
206 #endif
207#else
208#error invalid SELECT_SOFT_SERIAL_SPEED value
209#endif /* SELECT_SOFT_SERIAL_SPEED */
210#endif /* SERIAL_DELAY */
211
212#define SERIAL_DELAY_HALF1 (SERIAL_DELAY/2)
213#define SERIAL_DELAY_HALF2 (SERIAL_DELAY - SERIAL_DELAY/2)
214
215#define SLAVE_INT_WIDTH_US 1
216#ifndef SERIAL_USE_MULTI_TRANSACTION
217 #define SLAVE_INT_RESPONSE_TIME SERIAL_DELAY
218#else
219 #define SLAVE_INT_ACK_WIDTH_UNIT 2
220 #define SLAVE_INT_ACK_WIDTH 4
221#endif
222
223static SSTD_t *Transaction_table = NULL;
224static uint8_t Transaction_table_size = 0;
225
226inline static void serial_delay(void) ALWAYS_INLINE;
227inline static
228void serial_delay(void) {
229 _delay_us(SERIAL_DELAY);
230}
231
232inline static void serial_delay_half1(void) ALWAYS_INLINE;
233inline static
234void serial_delay_half1(void) {
235 _delay_us(SERIAL_DELAY_HALF1);
236}
237
238inline static void serial_delay_half2(void) ALWAYS_INLINE;
239inline static
240void serial_delay_half2(void) {
241 _delay_us(SERIAL_DELAY_HALF2);
242}
243
244inline static void serial_output(void) ALWAYS_INLINE;
245inline static
246void serial_output(void) {
247 SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
248}
249
250// make the serial pin an input with pull-up resistor
251inline static void serial_input_with_pullup(void) ALWAYS_INLINE;
252inline static
253void serial_input_with_pullup(void) {
254 SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
255 SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
256}
257
258inline static uint8_t serial_read_pin(void) ALWAYS_INLINE;
259inline static
260uint8_t serial_read_pin(void) {
261 return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
262}
263
264inline static void serial_low(void) ALWAYS_INLINE;
265inline static
266void serial_low(void) {
267 SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
268}
269
270inline static void serial_high(void) ALWAYS_INLINE;
271inline static
272void serial_high(void) {
273 SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
274}
275
276void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size)
277{
278 Transaction_table = sstd_table;
279 Transaction_table_size = (uint8_t)sstd_table_size;
280 serial_output();
281 serial_high();
282}
283
284void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size)
285{
286 Transaction_table = sstd_table;
287 Transaction_table_size = (uint8_t)sstd_table_size;
288 serial_input_with_pullup();
289
290 // Enable INT0-INT3,INT6
291 EIMSK |= EIMSK_BIT;
292#if SERIAL_PIN_MASK == _BV(PE6)
293 // Trigger on falling edge of INT6
294 EICRB &= EICRx_BIT;
295#else
296 // Trigger on falling edge of INT0-INT3
297 EICRA &= EICRx_BIT;
298#endif
299}
300
301// Used by the sender to synchronize timing with the reciver.
302static void sync_recv(void) NO_INLINE;
303static
304void sync_recv(void) {
305 for (uint8_t i = 0; i < SERIAL_DELAY*5 && serial_read_pin(); i++ ) {
306 }
307 // This shouldn't hang if the target disconnects because the
308 // serial line will float to high if the target does disconnect.
309 while (!serial_read_pin());
310}
311
312// Used by the reciver to send a synchronization signal to the sender.
313static void sync_send(void) NO_INLINE;
314static
315void sync_send(void) {
316 serial_low();
317 serial_delay();
318 serial_high();
319}
320
321// Reads a byte from the serial line
322static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) NO_INLINE;
323static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) {
324 uint8_t byte, i, p, pb;
325
326 _delay_sub_us(READ_WRITE_START_ADJUST);
327 for( i = 0, byte = 0, p = PARITY; i < bit; i++ ) {
328 serial_delay_half1(); // read the middle of pulses
329 if( serial_read_pin() ) {
330 byte = (byte << 1) | 1; p ^= 1;
331 } else {
332 byte = (byte << 1) | 0; p ^= 0;
333 }
334 _delay_sub_us(READ_WRITE_WIDTH_ADJUST);
335 serial_delay_half2();
336 }
337 /* recive parity bit */
338 serial_delay_half1(); // read the middle of pulses
339 pb = serial_read_pin();
340 _delay_sub_us(READ_WRITE_WIDTH_ADJUST);
341 serial_delay_half2();
342
343 *pterrcount += (p != pb)? 1 : 0;
344
345 return byte;
346}
347
348// Sends a byte with MSB ordering
349void serial_write_chunk(uint8_t data, uint8_t bit) NO_INLINE;
350void serial_write_chunk(uint8_t data, uint8_t bit) {
351 uint8_t b, p;
352 for( p = PARITY, b = 1<<(bit-1); b ; b >>= 1) {
353 if(data & b) {
354 serial_high(); p ^= 1;
355 } else {
356 serial_low(); p ^= 0;
357 }
358 serial_delay();
359 }
360 /* send parity bit */
361 if(p & 1) { serial_high(); }
362 else { serial_low(); }
363 serial_delay();
364
365 serial_low(); // sync_send() / senc_recv() need raise edge
366}
367
368static void serial_send_packet(uint8_t *buffer, uint8_t size) NO_INLINE;
369static
370void serial_send_packet(uint8_t *buffer, uint8_t size) {
371 for (uint8_t i = 0; i < size; ++i) {
372 uint8_t data;
373 data = buffer[i];
374 sync_send();
375 serial_write_chunk(data,8);
376 }
377}
378
379static uint8_t serial_recive_packet(uint8_t *buffer, uint8_t size) NO_INLINE;
380static
381uint8_t serial_recive_packet(uint8_t *buffer, uint8_t size) {
382 uint8_t pecount = 0;
383 for (uint8_t i = 0; i < size; ++i) {
384 uint8_t data;
385 sync_recv();
386 data = serial_read_chunk(&pecount, 8);
387 buffer[i] = data;
388 }
389 return pecount == 0;
390}
391
392inline static
393void change_sender2reciver(void) {
394 sync_send(); //0
395 serial_delay_half1(); //1
396 serial_low(); //2
397 serial_input_with_pullup(); //2
398 serial_delay_half1(); //3
399}
400
401inline static
402void change_reciver2sender(void) {
403 sync_recv(); //0
404 serial_delay(); //1
405 serial_low(); //3
406 serial_output(); //3
407 serial_delay_half1(); //4
408}
409
410static inline uint8_t nibble_bits_count(uint8_t bits)
411{
412 bits = (bits & 0x5) + (bits >> 1 & 0x5);
413 bits = (bits & 0x3) + (bits >> 2 & 0x3);
414 return bits;
415}
416
417// interrupt handle to be used by the target device
418ISR(SERIAL_PIN_INTERRUPT) {
419
420#ifndef SERIAL_USE_MULTI_TRANSACTION
421 serial_low();
422 serial_output();
423 SSTD_t *trans = Transaction_table;
424#else
425 // recive transaction table index
426 uint8_t tid, bits;
427 uint8_t pecount = 0;
428 sync_recv();
429 bits = serial_read_chunk(&pecount,7);
430 tid = bits>>3;
431 bits = (bits&7) != nibble_bits_count(tid);
432 if( bits || pecount> 0 || tid > Transaction_table_size ) {
433 return;
434 }
435 serial_delay_half1();
436
437 serial_high(); // response step1 low->high
438 serial_output();
439 _delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT*SLAVE_INT_ACK_WIDTH);
440 SSTD_t *trans = &Transaction_table[tid];
441 serial_low(); // response step2 ack high->low
442#endif
443
444 // target send phase
445 if( trans->target2initiator_buffer_size > 0 )
446 serial_send_packet((uint8_t *)trans->target2initiator_buffer,
447 trans->target2initiator_buffer_size);
448 // target switch to input
449 change_sender2reciver();
450
451 // target recive phase
452 if( trans->initiator2target_buffer_size > 0 ) {
453 if (serial_recive_packet((uint8_t *)trans->initiator2target_buffer,
454 trans->initiator2target_buffer_size) ) {
455 *trans->status = TRANSACTION_ACCEPTED;
456 } else {
457 *trans->status = TRANSACTION_DATA_ERROR;
458 }
459 } else {
460 *trans->status = TRANSACTION_ACCEPTED;
461 }
462
463 sync_recv(); //weit initiator output to high
464}
465
466/////////
467// start transaction by initiator
468//
469// int soft_serial_transaction(int sstd_index)
470//
471// Returns:
472// TRANSACTION_END
473// TRANSACTION_NO_RESPONSE
474// TRANSACTION_DATA_ERROR
475// this code is very time dependent, so we need to disable interrupts
476#ifndef SERIAL_USE_MULTI_TRANSACTION
477int soft_serial_transaction(void) {
478 SSTD_t *trans = Transaction_table;
479#else
480int soft_serial_transaction(int sstd_index) {
481 if( sstd_index > Transaction_table_size )
482 return TRANSACTION_TYPE_ERROR;
483 SSTD_t *trans = &Transaction_table[sstd_index];
484#endif
485 cli();
486
487 // signal to the target that we want to start a transaction
488 serial_output();
489 serial_low();
490 _delay_us(SLAVE_INT_WIDTH_US);
491
492#ifndef SERIAL_USE_MULTI_TRANSACTION
493 // wait for the target response
494 serial_input_with_pullup();
495 _delay_us(SLAVE_INT_RESPONSE_TIME);
496
497 // check if the target is present
498 if (serial_read_pin()) {
499 // target failed to pull the line low, assume not present
500 serial_output();
501 serial_high();
502 *trans->status = TRANSACTION_NO_RESPONSE;
503 sei();
504 return TRANSACTION_NO_RESPONSE;
505 }
506
507#else
508 // send transaction table index
509 int tid = (sstd_index<<3) | (7 & nibble_bits_count(sstd_index));
510 sync_send();
511 _delay_sub_us(TID_SEND_ADJUST);
512 serial_write_chunk(tid, 7);
513 serial_delay_half1();
514
515 // wait for the target response (step1 low->high)
516 serial_input_with_pullup();
517 while( !serial_read_pin() ) {
518 _delay_sub_us(2);
519 }
520
521 // check if the target is present (step2 high->low)
522 for( int i = 0; serial_read_pin(); i++ ) {
523 if (i > SLAVE_INT_ACK_WIDTH + 1) {
524 // slave failed to pull the line low, assume not present
525 serial_output();
526 serial_high();
527 *trans->status = TRANSACTION_NO_RESPONSE;
528 sei();
529 return TRANSACTION_NO_RESPONSE;
530 }
531 _delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT);
532 }
533#endif
534
535 // initiator recive phase
536 // if the target is present syncronize with it
537 if( trans->target2initiator_buffer_size > 0 ) {
538 if (!serial_recive_packet((uint8_t *)trans->target2initiator_buffer,
539 trans->target2initiator_buffer_size) ) {
540 serial_output();
541 serial_high();
542 *trans->status = TRANSACTION_DATA_ERROR;
543 sei();
544 return TRANSACTION_DATA_ERROR;
545 }
546 }
547
548 // initiator switch to output
549 change_reciver2sender();
550
551 // initiator send phase
552 if( trans->initiator2target_buffer_size > 0 ) {
553 serial_send_packet((uint8_t *)trans->initiator2target_buffer,
554 trans->initiator2target_buffer_size);
555 }
556
557 // always, release the line when not in use
558 sync_send();
559
560 *trans->status = TRANSACTION_END;
561 sei();
562 return TRANSACTION_END;
563}
564
565#ifdef SERIAL_USE_MULTI_TRANSACTION
566int soft_serial_get_and_clean_status(int sstd_index) {
567 SSTD_t *trans = &Transaction_table[sstd_index];
568 cli();
569 int retval = *trans->status;
570 *trans->status = 0;;
571 sei();
572 return retval;
573}
574#endif
575
576#endif
577
578// Helix serial.c history
579// 2018-1-29 fork from let's split and add PD2, modify sync_recv() (#2308, bceffdefc)
580// 2018-6-28 bug fix master to slave comm and speed up (#3255, 1038bbef4)
581// (adjusted with avr-gcc 4.9.2)
582// 2018-7-13 remove USE_SERIAL_PD2 macro (#3374, f30d6dd78)
583// (adjusted with avr-gcc 4.9.2)
584// 2018-8-11 add support multi-type transaction (#3608, feb5e4aae)
585// (adjusted with avr-gcc 4.9.2)
586// 2018-10-21 fix serial and RGB animation conflict (#4191, 4665e4fff)
587// (adjusted with avr-gcc 7.3.0)
588// 2018-10-28 re-adjust compiler depend value of delay (#4269, 8517f8a66)
589// (adjusted with avr-gcc 5.4.0, 7.3.0)
diff --git a/keyboards/zinc/serial.h b/keyboards/zinc/serial.h
deleted file mode 100644
index 7e0c0847a4..0000000000
--- a/keyboards/zinc/serial.h
+++ /dev/null
@@ -1,84 +0,0 @@
1#ifndef SOFT_SERIAL_H
2#define SOFT_SERIAL_H
3
4#include <stdbool.h>
5
6// /////////////////////////////////////////////////////////////////
7// Need Soft Serial defines in config.h
8// /////////////////////////////////////////////////////////////////
9// ex.
10// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
11// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5
12// // 1: about 137kbps (default)
13// // 2: about 75kbps
14// // 3: about 39kbps
15// // 4: about 26kbps
16// // 5: about 20kbps
17//
18// //// USE Simple API (OLD API, compatible with let's split serial.c)
19// ex.
20// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
21// #define SERIAL_MASTER_BUFFER_LENGTH 1
22//
23// //// USE flexible API (using multi-type transaction function)
24// #define SERIAL_USE_MULTI_TRANSACTION
25//
26// /////////////////////////////////////////////////////////////////
27
28
29#ifndef SERIAL_USE_MULTI_TRANSACTION
30/* --- USE Simple API (OLD API, compatible with let's split serial.c) */
31#if SERIAL_SLAVE_BUFFER_LENGTH > 0
32extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
33#endif
34#if SERIAL_MASTER_BUFFER_LENGTH > 0
35extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
36#endif
37
38void serial_master_init(void);
39void serial_slave_init(void);
40int serial_update_buffers(void);
41
42#endif // USE Simple API
43
44// Soft Serial Transaction Descriptor
45typedef struct _SSTD_t {
46 uint8_t *status;
47 uint8_t initiator2target_buffer_size;
48 uint8_t *initiator2target_buffer;
49 uint8_t target2initiator_buffer_size;
50 uint8_t *target2initiator_buffer;
51} SSTD_t;
52#define TID_LIMIT( table ) (sizeof(table) / sizeof(SSTD_t))
53
54// initiator is transaction start side
55void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size);
56// target is interrupt accept side
57void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size);
58
59// initiator resullt
60#define TRANSACTION_END 0
61#define TRANSACTION_NO_RESPONSE 0x1
62#define TRANSACTION_DATA_ERROR 0x2
63#define TRANSACTION_TYPE_ERROR 0x4
64#ifndef SERIAL_USE_MULTI_TRANSACTION
65int soft_serial_transaction(void);
66#else
67int soft_serial_transaction(int sstd_index);
68#endif
69
70// target status
71// *SSTD_t.status has
72// initiator:
73// TRANSACTION_END
74// or TRANSACTION_NO_RESPONSE
75// or TRANSACTION_DATA_ERROR
76// target:
77// TRANSACTION_DATA_ERROR
78// or TRANSACTION_ACCEPTED
79#define TRANSACTION_ACCEPTED 0x8
80#ifdef SERIAL_USE_MULTI_TRANSACTION
81int soft_serial_get_and_clean_status(int sstd_index);
82#endif
83
84#endif /* SOFT_SERIAL_H */
diff --git a/keyboards/zinc/zinc.h b/keyboards/zinc/zinc.h
index 87d889da03..dedc9253b0 100644
--- a/keyboards/zinc/zinc.h
+++ b/keyboards/zinc/zinc.h
@@ -1,5 +1,4 @@
1#ifndef ZINC_H 1#pragma once
2#define ZINC_H
3 2
4#ifdef KEYBOARD_zinc_reva 3#ifdef KEYBOARD_zinc_reva
5 #include "reva.h" 4 #include "reva.h"
@@ -8,7 +7,4 @@
8 #include "rev1.h" 7 #include "rev1.h"
9#endif 8#endif
10 9
11
12#include "quantum.h" 10#include "quantum.h"
13
14#endif
diff --git a/layouts/community/60_iso/unxmaal/keymap.c b/layouts/community/60_iso/unxmaal/keymap.c
index 455d969f47..9441997b4b 100644
--- a/layouts/community/60_iso/unxmaal/keymap.c
+++ b/layouts/community/60_iso/unxmaal/keymap.c
@@ -108,8 +108,6 @@ enum function_id {
108}; 108};
109 109
110const uint16_t PROGMEM fn_actions[] = { 110const uint16_t PROGMEM fn_actions[] = {
111 [1] = ACTION_LAYER_TOGGLE(1), // Toggle Arrow Layer overlay
112 [3] = ACTION_LAYER_TOGGLE(3), // Toggle Underglow Layer overlay
113 [4] = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow 111 [4] = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow
114 [5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode 112 [5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode
115 [6] = ACTION_FUNCTION(RGBLED_INCREASE_HUE), 113 [6] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
diff --git a/layouts/community/ergodox/algernon/keymap.c b/layouts/community/ergodox/algernon/keymap.c
index fb6de1b721..e6e9bdaf7f 100644
--- a/layouts/community/ergodox/algernon/keymap.c
+++ b/layouts/community/ergodox/algernon/keymap.c
@@ -79,9 +79,6 @@ enum {
79 F_BSE = 0, 79 F_BSE = 0,
80 F_HUN, 80 F_HUN,
81 F_GUI, 81 F_GUI,
82 F_SFT,
83 F_ALT,
84 F_CTRL
85}; 82};
86 83
87/* Custom keycodes */ 84/* Custom keycodes */
@@ -146,9 +143,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
146,KC_MPLY ,KC_SLSH ,KC_Q ,KC_J ,KC_K ,KC_X ,TD(CT_TMUX) 143,KC_MPLY ,KC_SLSH ,KC_Q ,KC_J ,KC_K ,KC_X ,TD(CT_TMUX)
147,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN) 144,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
148 145
149 ,F(F_ALT),F(F_GUI) 146 ,OSM(MOD_LALT),F(F_GUI)
150 ,F(F_CTRL) 147 ,OSM(MOD_LCTL)
151 ,KC_BSPC,F(F_SFT),KC_ESC 148 ,KC_BSPC,OSM(MOD_LSFT),KC_ESC
152 149
153 // right hand 150 // right hand
154 ,M(Fx) ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR) 151 ,M(Fx) ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR)
@@ -191,9 +188,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
191,KC_NO ,KC_Z ,KC_Q ,KC_QUOT ,KC_COMM ,KC_DOT ,TD(CT_TMUX) 188,KC_NO ,KC_Z ,KC_Q ,KC_QUOT ,KC_COMM ,KC_DOT ,TD(CT_TMUX)
192,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN) 189,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
193 190
194 ,F(F_ALT),F(F_GUI) 191 ,OSM(MOD_LALT),F(F_GUI)
195 ,F(F_CTRL) 192 ,OSM(MOD_LCTL)
196 ,KC_BSPC,F(F_SFT),KC_ESC 193 ,KC_BSPC,OSM(F_LSFT),KC_ESC
197 194
198 // right hand 195 // right hand
199 ,M(Fx) ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR) 196 ,M(Fx) ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR)
@@ -440,9 +437,6 @@ const uint16_t PROGMEM fn_actions[] = {
440 [F_BSE] = ACTION_LAYER_CLEAR(ON_PRESS) 437 [F_BSE] = ACTION_LAYER_CLEAR(ON_PRESS)
441 ,[F_HUN] = ACTION_LAYER_INVERT(HUN, ON_PRESS) 438 ,[F_HUN] = ACTION_LAYER_INVERT(HUN, ON_PRESS)
442 ,[F_GUI] = ACTION_MACRO_TAP(A_GUI) 439 ,[F_GUI] = ACTION_MACRO_TAP(A_GUI)
443 ,[F_SFT] = ACTION_MODS_ONESHOT (MOD_LSFT)
444 ,[F_ALT] = ACTION_MODS_ONESHOT (MOD_LALT)
445 ,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL)
446}; 440};
447 441
448static void toggle_steno(int pressed) 442static void toggle_steno(int pressed)
diff --git a/layouts/community/ergodox/colemak_osx_pc_no/keymap.c b/layouts/community/ergodox/colemak_osx_pc_no/keymap.c
index 189ff5c43d..a4a4533494 100644
--- a/layouts/community/ergodox/colemak_osx_pc_no/keymap.c
+++ b/layouts/community/ergodox/colemak_osx_pc_no/keymap.c
@@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
41 MO(4), KC_BTN1, KC_BTN2, KC_TAB,GUI_T(KC_COMMA), 41 MO(4), KC_BTN1, KC_BTN2, KC_TAB,GUI_T(KC_COMMA),
42 NO_AMPR, NO_PIPE, 42 NO_AMPR, NO_PIPE,
43 NO_PLUS, 43 NO_PLUS,
44 KC_FN1,CTL_T(KC_DOT),ALT_T(NO_MINS), 44 OSM(MOD_LSFT),CTL_T(KC_DOT),ALT_T(NO_MINS),
45 // right hand 45 // right hand
46 KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT, 46 KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT,
47 NO_APOS, KC_J, KC_L, KC_U, KC_Y, NO_AA, NO_AE , 47 NO_APOS, KC_J, KC_L, KC_U, KC_Y, NO_AA, NO_AE ,
@@ -222,7 +222,6 @@ enum macro_id {
222}; 222};
223 223
224const uint16_t PROGMEM fn_actions[] = { 224const uint16_t PROGMEM fn_actions[] = {
225 [1] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift.
226 [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed. 225 [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed.
227 [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first. 226 [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first.
228 [4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first. 227 [4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first.
diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c
index 69066a47cc..cb256e5e57 100644
--- a/layouts/community/ergodox/drashna/keymap.c
+++ b/layouts/community/ergodox/drashna/keymap.c
@@ -457,7 +457,7 @@ void rgb_matrix_indicators_user(void) {
457 457
458#endif // RGB_MATRIX_INIT 458#endif // RGB_MATRIX_INIT
459 459
460uint16_t get_tapping_term(uint16_t keycode) { 460uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
461 if (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) { 461 if (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) {
462 if (mod_config(keycode & 0xf) & MOD_MASK_ALT) { 462 if (mod_config(keycode & 0xf) & MOD_MASK_ALT) {
463 return (2 * TAPPING_TERM); 463 return (2 * TAPPING_TERM);
diff --git a/layouts/community/ergodox/guni/keymap.c b/layouts/community/ergodox/guni/keymap.c
index 14d6f8d3ad..ff1dd72eb0 100644
--- a/layouts/community/ergodox/guni/keymap.c
+++ b/layouts/community/ergodox/guni/keymap.c
@@ -7,7 +7,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7 LAYOUT_ergodox( // layer 0 : default 7 LAYOUT_ergodox( // layer 0 : default
8 // left hand 8 // left hand
9 KC_EQL , KC_1, KC_2, KC_3, KC_4, KC_5, KC_LBRC, 9 KC_EQL , KC_1, KC_2, KC_3, KC_4, KC_5, KC_LBRC,
10 KC_FN25 , KC_Q, KC_W, KC_E, KC_R, KC_T, KC_HOME, 10 MT(MOD_LCTL, KC_TAB) , KC_Q, KC_W, KC_E, KC_R, KC_T, KC_HOME,
11 LT(1, KC_CAPS) , KC_A, KC_S, KC_D, KC_F, KC_G, 11 LT(1, KC_CAPS) , KC_A, KC_S, KC_D, KC_F, KC_G,
12 KC_LSFT , KC_Z, KC_X, KC_C, KC_V, KC_B, KC_PGUP, 12 KC_LSFT , KC_Z, KC_X, KC_C, KC_V, KC_B, KC_PGUP,
13 KC_LGUI , KC_GRV,KC_LEFT,KC_RGHT,KC_LALT, 13 KC_LGUI , KC_GRV,KC_LEFT,KC_RGHT,KC_LALT,
@@ -16,13 +16,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
16 KC_BSPC,KC_DEL ,KC_FN23, 16 KC_BSPC,KC_DEL ,KC_FN23,
17 // right hand 17 // right hand
18 KC_RBRC , KC_6, KC_7 , KC_8, KC_9, KC_0, KC_MINS, 18 KC_RBRC , KC_6, KC_7 , KC_8, KC_9, KC_0, KC_MINS,
19 KC_END , KC_Y, KC_U , KC_I, KC_O, KC_P, KC_FN28, 19 KC_END , KC_Y, KC_U , KC_I, KC_O, KC_P, MT(MOD_RCTL, KC_BSLS),
20 KC_H , KC_J, KC_K , KC_L, KC_SCLN,LT(1, KC_QUOT), 20 KC_H , KC_J, KC_K , KC_L, KC_SCLN,LT(1, KC_QUOT),
21 KC_PGDN , KC_N, KC_M , KC_COMM,KC_DOT, KC_SLSH,KC_FN29, 21 KC_PGDN , KC_N, KC_M , KC_COMM,KC_DOT, KC_SLSH,MT(MOD_RSFT, KC_ESC),
22 KC_RALT , KC_DOWN,KC_UP, KC_NO ,KC_RGUI, 22 KC_RALT , KC_DOWN,KC_UP, KC_NO ,KC_RGUI,
23 KC_NO , KC_NO, 23 KC_NO , KC_NO,
24 KC_NO , 24 KC_NO ,
25 KC_FN29,KC_ENT ,KC_SPC 25 MT(MOD_RSFT, KC_ESC),KC_ENT ,KC_SPC
26 ), 26 ),
27 27
28 LAYOUT_ergodox( // layer 1 : function and symbol keys 28 LAYOUT_ergodox( // layer 1 : function and symbol keys
@@ -122,20 +122,9 @@ enum function_id {
122const uint16_t PROGMEM fn_actions[] = { 122const uint16_t PROGMEM fn_actions[] = {
123 [0] = ACTION_FUNCTION(TEENSY_KEY), // FN0 - Teensy key 123 [0] = ACTION_FUNCTION(TEENSY_KEY), // FN0 - Teensy key
124 [1] = ACTION_LAYER_SET(0, ON_PRESS), 124 [1] = ACTION_LAYER_SET(0, ON_PRESS),
125 //[11] = ACTION_MODS_KEY(MOD_LSFT, KC_COMM),
126 //[12] = ACTION_MODS_KEY(MOD_LSFT, KC_DOT),
127
128 //[14] = ACTION_MODS_KEY(MOD_LSFT, KC_SLSH),
129 //[17] = ACTION_MODS_KEY(MOD_LSFT, KC_SCLN),
130 //[20] = ACTION_MODS_KEY(MOD_LSFT, KC_5),
131 //[21] = ACTION_MODS_KEY(MOD_LSFT, KC_QUOT),
132 [23] = ACTION_LAYER_SET(3, ON_PRESS), 125 [23] = ACTION_LAYER_SET(3, ON_PRESS),
133 [24] = ACTION_LAYER_SET(2, ON_PRESS), 126 [24] = ACTION_LAYER_SET(2, ON_PRESS),
134 [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_TAB),
135 [26] = ACTION_LAYER_SET(1, ON_PRESS), 127 [26] = ACTION_LAYER_SET(1, ON_PRESS),
136 [28] = ACTION_MODS_TAP_KEY(MOD_RCTL,KC_BSLS),
137 //[29] = ACTION_LAYER_TOGGLE(4),
138 [29] = ACTION_MODS_TAP_KEY(MOD_RSFT,KC_ESC),
139}; 128};
140 129
141 130
diff --git a/layouts/community/ergodox/kastyle/keymap.c b/layouts/community/ergodox/kastyle/keymap.c
index 923715477b..32eec96f50 100644
--- a/layouts/community/ergodox/kastyle/keymap.c
+++ b/layouts/community/ergodox/kastyle/keymap.c
@@ -39,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(1), 39 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(1),
40 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, 40 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G,
41 KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), 41 KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
42 KC_FN1, KC_BSLS, LALT(KC_LSFT), KC_LEFT, KC_RGHT, 42 SH_T(KC_GRV), KC_BSLS, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
43 KC_LGUI, ALT_T(KC_ESC), 43 KC_LGUI, ALT_T(KC_ESC),
44 KC_HOME, 44 KC_HOME,
45 KC_BSPC, KC_DEL, KC_END, 45 KC_BSPC, KC_DEL, KC_END,
@@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
48 TG(1), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, 48 TG(1), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
49 KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), KC_QUOT, 49 KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), KC_QUOT,
50 MEH_T(KC_NO), KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLSH), KC_RSFT, 50 MEH_T(KC_NO), KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
51 KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, KC_FN1, 51 KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, SH_T(KC_GRV),
52 ALT_T(KC_ESC), KC_RGUI, 52 ALT_T(KC_ESC), KC_RGUI,
53 KC_PGUP, 53 KC_PGUP,
54 KC_PGDN, KC_ENT, KC_SPC 54 KC_PGDN, KC_ENT, KC_SPC
@@ -155,10 +155,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
155 return MACRO_NONE; 155 return MACRO_NONE;
156}; 156};
157 157
158const uint16_t PROGMEM fn_actions[] = {
159 [1] = ACTION_SWAP_HANDS_TAP_KEY(KC_GRV) // FN1 - Tap = Grave/Tilde - Hold Momentary swap hands
160};
161
162// Runs just one time when the keyboard initializes. 158// Runs just one time when the keyboard initializes.
163void matrix_init_user(void) { 159void matrix_init_user(void) {
164 160
diff --git a/layouts/community/ergodox/mpiechotka/keymap.c b/layouts/community/ergodox/mpiechotka/keymap.c
index a673d0bd8a..6a89e38a32 100644
--- a/layouts/community/ergodox/mpiechotka/keymap.c
+++ b/layouts/community/ergodox/mpiechotka/keymap.c
@@ -15,9 +15,7 @@ enum {
15 PC1, 15 PC1,
16 PC2, 16 PC2,
17 PC3, 17 PC3,
18 PC4, 18 PC4
19 DL_BASE,
20 DL_BASE_CM,
21}; 19};
22 20
23const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -175,7 +173,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
175// MACROS 173// MACROS
176[MACR] = LAYOUT_ergodox( 174[MACR] = LAYOUT_ergodox(
177 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 175 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
178 KC_NO, F(DL_BASE),F(DL_BASE_CM),KC_NO, KC_NO, KC_NO, KC_NO, 176 KC_NO, DF(BASE), DF(BASE_CM), KC_NO, KC_NO, KC_NO, KC_NO,
179 KC_NO, F(PC1), F(PC2), F(PC3), F(PC4), KC_NO, 177 KC_NO, F(PC1), F(PC2), F(PC3), F(PC4), KC_NO,
180 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 178 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
181 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 179 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
@@ -199,9 +197,7 @@ const uint16_t PROGMEM fn_actions[] = {
199 [PC1] = ACTION_MACRO(PC1), 197 [PC1] = ACTION_MACRO(PC1),
200 [PC2] = ACTION_MACRO(PC2), 198 [PC2] = ACTION_MACRO(PC2),
201 [PC3] = ACTION_MACRO(PC3), 199 [PC3] = ACTION_MACRO(PC3),
202 [PC4] = ACTION_MACRO(PC4), 200 [PC4] = ACTION_MACRO(PC4)
203 [DL_BASE] = ACTION_DEFAULT_LAYER_SET(BASE),
204 [DL_BASE_CM] = ACTION_DEFAULT_LAYER_SET(BASE_CM)
205}; 201};
206 202
207const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 203const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
diff --git a/layouts/community/ergodox/norwegian_programmer_osx_pc/keymap.c b/layouts/community/ergodox/norwegian_programmer_osx_pc/keymap.c
index 63fea6e1c1..ee9a9d1802 100644
--- a/layouts/community/ergodox/norwegian_programmer_osx_pc/keymap.c
+++ b/layouts/community/ergodox/norwegian_programmer_osx_pc/keymap.c
@@ -39,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB, 39 ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB,
40 KC_HASH, KC_FN7, 40 KC_HASH, KC_FN7,
41 KC_FN6, 41 KC_FN6,
42 KC_FN1,CTL_T(KC_DOT),GUI_T(KC_COMMA), 42 OSM(MOD_LSFT),CTL_T(KC_DOT),GUI_T(KC_COMMA),
43 // right hand 43 // right hand
44 KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT, 44 KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT,
45 NO_APOS, KC_Y, KC_U, KC_I, KC_O, KC_P, NO_AA , 45 NO_APOS, KC_Y, KC_U, KC_I, KC_O, KC_P, NO_AA ,
@@ -138,7 +138,6 @@ enum macro_id {
138}; 138};
139 139
140const uint16_t PROGMEM fn_actions[] = { 140const uint16_t PROGMEM fn_actions[] = {
141 [1] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift.
142 [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed. 141 [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed.
143 [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first. 142 [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first.
144 [4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first. 143 [4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first.
diff --git a/layouts/community/ergodox/norwegian_programmer_osx_pc_colemak/keymap.c b/layouts/community/ergodox/norwegian_programmer_osx_pc_colemak/keymap.c
index cb61ce59cb..af1d268bd9 100644
--- a/layouts/community/ergodox/norwegian_programmer_osx_pc_colemak/keymap.c
+++ b/layouts/community/ergodox/norwegian_programmer_osx_pc_colemak/keymap.c
@@ -39,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB, 39 ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB,
40 KC_HASH, KC_FN7, 40 KC_HASH, KC_FN7,
41 KC_FN6, 41 KC_FN6,
42 KC_FN1,CTL_T(KC_DOT),GUI_T(KC_COMMA), 42 OSM(MOD_LSFT),CTL_T(KC_DOT),GUI_T(KC_COMMA),
43 // right hand 43 // right hand
44 KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT, 44 KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT,
45 NO_APOS, KC_J, KC_L, KC_U, KC_Y, NO_AA, NO_AE , 45 NO_APOS, KC_J, KC_L, KC_U, KC_Y, NO_AA, NO_AE ,
@@ -138,7 +138,6 @@ enum macro_id {
138}; 138};
139 139
140const uint16_t PROGMEM fn_actions[] = { 140const uint16_t PROGMEM fn_actions[] = {
141 [1] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift.
142 [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed. 141 [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed.
143 [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first. 142 [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first.
144 [4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first. 143 [4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first.
diff --git a/layouts/community/ergodox/townk_osx/keymap.c b/layouts/community/ergodox/townk_osx/keymap.c
index 55394fab21..6799ad7460 100644
--- a/layouts/community/ergodox/townk_osx/keymap.c
+++ b/layouts/community/ergodox/townk_osx/keymap.c
@@ -97,8 +97,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
97 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, 97 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC,
98 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, MEH_T(KC_F16), 98 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, MEH_T(KC_F16),
99 CTL_T(KC_BSLS), KC_A, KC_S, KC_D, KC_F, KC_G, 99 CTL_T(KC_BSLS), KC_A, KC_S, KC_D, KC_F, KC_G,
100 KC_FN2, KC_Z, KC_X, KC_C, KC_V, KC_B, ALL_T(KC_F18), 100 OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, ALL_T(KC_F18),
101 KC_FN1, TG(KEYPAD), KC_LCTRL, KC_LALT, KC_LGUI, 101 OSL(FN), TG(KEYPAD), KC_LCTRL, KC_LALT, KC_LGUI,
102 M_TESC, M_TPASTE, 102 M_TESC, M_TPASTE,
103 KC_HOME, 103 KC_HOME,
104 KC_BSPC, KC_DEL, KC_END, 104 KC_BSPC, KC_DEL, KC_END,
@@ -106,8 +106,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
106 KC_POWER, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, 106 KC_POWER, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
107 MEH_T(KC_F17), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_EQL, 107 MEH_T(KC_F17), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_EQL,
108 KC_H, KC_J, KC_K, KC_L, KC_SCLN, CTL_T(KC_QUOT), 108 KC_H, KC_J, KC_K, KC_L, KC_SCLN, CTL_T(KC_QUOT),
109 ALL_T(KC_F19), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_FN2, 109 ALL_T(KC_F19), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, OSM(MOD_LSFT),
110 KC_RGUI, KC_RALT, CTL_T(KC_LBRC), LT(KEYPAD, KC_RBRC), KC_FN1, 110 KC_RGUI, KC_RALT, CTL_T(KC_LBRC), LT(KEYPAD, KC_RBRC), OSL(FN),
111 M_OSXCPY, M_OSXPST, 111 M_OSXCPY, M_OSXPST,
112 KC_PGUP, 112 KC_PGUP,
113 KC_PGDN, KC_ENT, KC_SPC), 113 KC_PGDN, KC_ENT, KC_SPC),
@@ -194,11 +194,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
194 KC_NO, 194 KC_NO,
195 KC_NO, KC_NO, KC_NO)}; 195 KC_NO, KC_NO, KC_NO)};
196 196
197const uint16_t PROGMEM fn_actions[] = {
198 [1] = ACTION_LAYER_ONESHOT(FN),
199 [2] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift.
200};
201
202const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { 197const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
203 // MACRODOWN only works in this function 198 // MACRODOWN only works in this function
204 switch(id) { 199 switch(id) {
diff --git a/lib/printf b/lib/printf
new file mode 160000
Subproject d3b984684bb8a8bdc48cc7a1abecb93ce59bbe3
diff --git a/lib/vusb b/lib/vusb
new file mode 160000
Subproject 9a42d205eb60faca494ff4eabce8d59f0ec0fc7
diff --git a/message.mk b/message.mk
index c8da7df0bb..be04fa9b81 100644
--- a/message.mk
+++ b/message.mk
@@ -84,8 +84,7 @@ MSG_FILE_TOO_SMALL = The firmware is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n
84MSG_FILE_JUST_RIGHT = The firmware size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n 84MSG_FILE_JUST_RIGHT = The firmware size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n
85MSG_FILE_NEAR_LIMIT = The firmware size is approaching the maximum - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n 85MSG_FILE_NEAR_LIMIT = The firmware size is approaching the maximum - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n
86MSG_PYTHON_MISSING = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \ 86MSG_PYTHON_MISSING = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \
87 Python 3 is not installed. It will be required by a future version\n\ 87 Can not run bin/qmk! This tool will be required when the develop branch is merged on 2020 Aug 29.\n\n\
88 of qmk_firmware.\n\n\
89 Please run $(BOLD)util/qmk_install.sh$(NO_COLOR) to install all the dependencies QMK requires.\n\n 88 Please run $(BOLD)util/qmk_install.sh$(NO_COLOR) to install all the dependencies QMK requires.\n\n
90MSG_FLASH_BOOTLOADER = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's bootloader is not specified or is not supported by the \":flash\" target at this time.\n\n 89MSG_FLASH_BOOTLOADER = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's bootloader is not specified or is not supported by the \":flash\" target at this time.\n\n
91MSG_FLASH_ARCH = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's architecture is not supported by the \":flash\" target at this time.\n\n 90MSG_FLASH_ARCH = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's architecture is not supported by the \":flash\" target at this time.\n\n
diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h
index 2bcc27b4a1..805cb4f7ab 100644
--- a/quantum/audio/audio.h
+++ b/quantum/audio/audio.h
@@ -99,9 +99,6 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat);
99// length. This works around the limitation of C's sizeof operation on pointers. 99// length. This works around the limitation of C's sizeof operation on pointers.
100// The global float array for the song must be used here. 100// The global float array for the song must be used here.
101#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0])))) 101#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0]))))
102#define PLAY_NOTE_ARRAY(note_array, note_repeat, deprecated_arg) \
103 play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat)); \
104 _Pragma("message \"'PLAY_NOTE_ARRAY' macro is deprecated\"")
105#define PLAY_SONG(note_array) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), false) 102#define PLAY_SONG(note_array) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), false)
106#define PLAY_LOOP(note_array) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), true) 103#define PLAY_LOOP(note_array) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), true)
107 104
diff --git a/quantum/audio/audio_avr.c b/quantum/audio/audio_avr.c
index 781378788c..5a96bf6439 100644
--- a/quantum/audio/audio_avr.c
+++ b/quantum/audio/audio_avr.c
@@ -110,6 +110,11 @@
110# define TIMER_1_DUTY_CYCLE OCR1C 110# define TIMER_1_DUTY_CYCLE OCR1C
111# define TIMER1_AUDIO_vect TIMER1_COMPC_vect 111# define TIMER1_AUDIO_vect TIMER1_COMPC_vect
112#endif 112#endif
113
114#if !defined(BPIN_AUDIO) && !defined(CPIN_AUDIO)
115# error "Audio feature enabled, but no suitable pin selected - see docs/feature_audio.md under the AVR settings for available options."
116#endif
117
113// ----------------------------------------------------------------------------- 118// -----------------------------------------------------------------------------
114 119
115int voices = 0; 120int voices = 0;
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index 91032b6564..f3da0ab0f7 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -57,8 +57,12 @@ const point_t k_rgb_matrix_center = RGB_MATRIX_CENTER;
57// -----End rgb effect includes macros------- 57// -----End rgb effect includes macros-------
58// ------------------------------------------ 58// ------------------------------------------
59 59
60#ifndef RGB_DISABLE_AFTER_TIMEOUT 60#if defined(RGB_DISABLE_AFTER_TIMEOUT) && !defined(RGB_DISABLE_TIMEOUT)
61# define RGB_DISABLE_AFTER_TIMEOUT 0 61# define RGB_DISABLE_TIMEOUT (RGB_DISABLE_AFTER_TIMEOUT * 1200)
62#endif
63
64#ifndef RGB_DISABLE_TIMEOUT
65# define RGB_DISABLE_TIMEOUT 0
62#endif 66#endif
63 67
64#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED 68#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED
@@ -111,19 +115,29 @@ const point_t k_rgb_matrix_center = RGB_MATRIX_CENTER;
111# define RGB_MATRIX_STARTUP_SPD UINT8_MAX / 2 115# define RGB_MATRIX_STARTUP_SPD UINT8_MAX / 2
112#endif 116#endif
113 117
114bool g_suspend_state = false; 118// globals
115 119bool g_suspend_state = false;
116rgb_config_t rgb_matrix_config; 120rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
117 121uint32_t g_rgb_timer;
118rgb_counters_t g_rgb_counters;
119static uint32_t rgb_counters_buffer;
120
121#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS 122#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
122uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}}; 123uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}};
123#endif 124#endif // RGB_MATRIX_FRAMEBUFFER_EFFECTS
125#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
126last_hit_t g_last_hit_tracker;
127#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
124 128
129// internals
130static uint8_t rgb_last_enable = UINT8_MAX;
131static uint8_t rgb_last_effect = UINT8_MAX;
132static effect_params_t rgb_effect_params = {0, 0xFF};
133static rgb_task_states rgb_task_state = SYNCING;
134#if RGB_DISABLE_TIMEOUT > 0
135static uint32_t rgb_anykey_timer;
136#endif // RGB_DISABLE_TIMEOUT > 0
137
138// double buffers
139static uint32_t rgb_timer_buffer;
125#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED 140#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
126last_hit_t g_last_hit_tracker;
127static last_hit_t last_hit_buffer; 141static last_hit_t last_hit_buffer;
128#endif // RGB_MATRIX_KEYREACTIVE_ENABLED 142#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
129 143
@@ -169,21 +183,24 @@ void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
169void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color_all(red, green, blue); } 183void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color_all(red, green, blue); }
170 184
171bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { 185bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
186#if RGB_DISABLE_TIMEOUT > 0
187 if (record->event.pressed) {
188 rgb_anykey_timer = 0;
189 }
190#endif // RGB_DISABLE_TIMEOUT > 0
191
172#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED 192#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
173 uint8_t led[LED_HITS_TO_REMEMBER]; 193 uint8_t led[LED_HITS_TO_REMEMBER];
174 uint8_t led_count = 0; 194 uint8_t led_count = 0;
175 195
176# if defined(RGB_MATRIX_KEYRELEASES) 196# if defined(RGB_MATRIX_KEYRELEASES)
177 if (!record->event.pressed) { 197 if (!record->event.pressed)
178 led_count = rgb_matrix_map_row_column_to_led(record->event.key.row, record->event.key.col, led);
179 g_rgb_counters.any_key_hit = 0;
180 }
181# elif defined(RGB_MATRIX_KEYPRESSES) 198# elif defined(RGB_MATRIX_KEYPRESSES)
182 if (record->event.pressed) { 199 if (record->event.pressed)
183 led_count = rgb_matrix_map_row_column_to_led(record->event.key.row, record->event.key.col, led);
184 g_rgb_counters.any_key_hit = 0;
185 }
186# endif // defined(RGB_MATRIX_KEYRELEASES) 200# endif // defined(RGB_MATRIX_KEYRELEASES)
201 {
202 led_count = rgb_matrix_map_row_column_to_led(record->event.key.row, record->event.key.col, led);
203 }
187 204
188 if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) { 205 if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) {
189 memcpy(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count); 206 memcpy(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count);
@@ -216,7 +233,7 @@ void rgb_matrix_test(void) {
216 // Mask out bits 4 and 5 233 // Mask out bits 4 and 5
217 // Increase the factor to make the test animation slower (and reduce to make it faster) 234 // Increase the factor to make the test animation slower (and reduce to make it faster)
218 uint8_t factor = 10; 235 uint8_t factor = 10;
219 switch ((g_rgb_counters.tick & (0b11 << factor)) >> factor) { 236 switch ((g_rgb_timer & (0b11 << factor)) >> factor) {
220 case 0: { 237 case 0: {
221 rgb_matrix_set_color_all(20, 0, 0); 238 rgb_matrix_set_color_all(20, 0, 0);
222 break; 239 break;
@@ -241,29 +258,26 @@ static bool rgb_matrix_none(effect_params_t *params) {
241 return false; 258 return false;
242 } 259 }
243 260
244 RGB_MATRIX_USE_LIMITS(led_min, led_max); 261 rgb_matrix_set_color_all(0, 0, 0);
245 for (uint8_t i = led_min; i < led_max; i++) { 262 return false;
246 rgb_matrix_set_color(i, 0, 0, 0);
247 }
248 return led_max < DRIVER_LED_TOTAL;
249} 263}
250 264
251static uint8_t rgb_last_enable = UINT8_MAX;
252static uint8_t rgb_last_effect = UINT8_MAX;
253static effect_params_t rgb_effect_params = {0, 0xFF};
254static rgb_task_states rgb_task_state = SYNCING;
255
256static void rgb_task_timers(void) { 265static void rgb_task_timers(void) {
266#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
267 uint32_t deltaTime = timer_elapsed32(rgb_timer_buffer);
268#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
269 rgb_timer_buffer = timer_read32();
270
257 // Update double buffer timers 271 // Update double buffer timers
258 uint16_t deltaTime = timer_elapsed32(rgb_counters_buffer); 272#if RGB_DISABLE_TIMEOUT > 0
259 rgb_counters_buffer = timer_read32(); 273 if (rgb_anykey_timer < UINT32_MAX) {
260 if (g_rgb_counters.any_key_hit < UINT32_MAX) { 274 if (UINT32_MAX - deltaTime < rgb_anykey_timer) {
261 if (UINT32_MAX - deltaTime < g_rgb_counters.any_key_hit) { 275 rgb_anykey_timer = UINT32_MAX;
262 g_rgb_counters.any_key_hit = UINT32_MAX;
263 } else { 276 } else {
264 g_rgb_counters.any_key_hit += deltaTime; 277 rgb_anykey_timer += deltaTime;
265 } 278 }
266 } 279 }
280#endif // RGB_DISABLE_TIMEOUT > 0
267 281
268 // Update double buffer last hit timers 282 // Update double buffer last hit timers
269#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED 283#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
@@ -280,7 +294,7 @@ static void rgb_task_timers(void) {
280 294
281static void rgb_task_sync(void) { 295static void rgb_task_sync(void) {
282 // next task 296 // next task
283 if (timer_elapsed32(g_rgb_counters.tick) >= RGB_MATRIX_LED_FLUSH_LIMIT) rgb_task_state = STARTING; 297 if (timer_elapsed32(g_rgb_timer) >= RGB_MATRIX_LED_FLUSH_LIMIT) rgb_task_state = STARTING;
284} 298}
285 299
286static void rgb_task_start(void) { 300static void rgb_task_start(void) {
@@ -288,7 +302,7 @@ static void rgb_task_start(void) {
288 rgb_effect_params.iter = 0; 302 rgb_effect_params.iter = 0;
289 303
290 // update double buffers 304 // update double buffers
291 g_rgb_counters.tick = rgb_counters_buffer; 305 g_rgb_timer = rgb_timer_buffer;
292#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED 306#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
293 g_last_hit_tracker = last_hit_buffer; 307 g_last_hit_tracker = last_hit_buffer;
294#endif // RGB_MATRIX_KEYREACTIVE_ENABLED 308#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
@@ -370,8 +384,16 @@ void rgb_matrix_task(void) {
370 384
371 // Ideally we would also stop sending zeros to the LED driver PWM buffers 385 // Ideally we would also stop sending zeros to the LED driver PWM buffers
372 // while suspended and just do a software shutdown. This is a cheap hack for now. 386 // while suspended and just do a software shutdown. This is a cheap hack for now.
373 bool suspend_backlight = ((g_suspend_state && RGB_DISABLE_WHEN_USB_SUSPENDED) || (RGB_DISABLE_AFTER_TIMEOUT > 0 && g_rgb_counters.any_key_hit > RGB_DISABLE_AFTER_TIMEOUT * 60 * 20)); 387 bool suspend_backlight =
374 uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode; 388#if RGB_DISABLE_WHEN_USB_SUSPENDED == true
389 g_suspend_state ||
390#endif // RGB_DISABLE_WHEN_USB_SUSPENDED == true
391#if RGB_DISABLE_TIMEOUT > 0
392 (rgb_anykey_timer > (uint32_t)RGB_DISABLE_TIMEOUT) ||
393#endif // RGB_DISABLE_TIMEOUT > 0
394 false;
395
396 uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode;
375 397
376 switch (rgb_task_state) { 398 switch (rgb_task_state) {
377 case STARTING: 399 case STARTING:
@@ -405,8 +427,6 @@ __attribute__((weak)) void rgb_matrix_indicators_user(void) {}
405void rgb_matrix_init(void) { 427void rgb_matrix_init(void) {
406 rgb_matrix_driver.init(); 428 rgb_matrix_driver.init();
407 429
408 // TODO: put the 1 second startup delay here?
409
410#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED 430#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
411 g_last_hit_tracker.count = 0; 431 g_last_hit_tracker.count = 0;
412 for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) { 432 for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) {
diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h
index 7c37311b4e..d9ce391068 100644
--- a/quantum/rgb_matrix.h
+++ b/quantum/rgb_matrix.h
@@ -178,14 +178,14 @@ extern const rgb_matrix_driver_t rgb_matrix_driver;
178 178
179extern rgb_config_t rgb_matrix_config; 179extern rgb_config_t rgb_matrix_config;
180 180
181extern bool g_suspend_state; 181extern bool g_suspend_state;
182extern rgb_counters_t g_rgb_counters; 182extern uint32_t g_rgb_timer;
183extern led_config_t g_led_config; 183extern led_config_t g_led_config;
184#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED 184#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
185extern last_hit_t g_last_hit_tracker; 185extern last_hit_t g_last_hit_tracker;
186#endif 186#endif
187#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS 187#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
188extern uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS]; 188extern uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
189#endif 189#endif
190 190
191#endif 191#endif
diff --git a/quantum/rgb_matrix_animations/breathing_anim.h b/quantum/rgb_matrix_animations/breathing_anim.h
index 92431555e7..887425f9da 100644
--- a/quantum/rgb_matrix_animations/breathing_anim.h
+++ b/quantum/rgb_matrix_animations/breathing_anim.h
@@ -6,7 +6,7 @@ bool BREATHING(effect_params_t* params) {
6 RGB_MATRIX_USE_LIMITS(led_min, led_max); 6 RGB_MATRIX_USE_LIMITS(led_min, led_max);
7 7
8 HSV hsv = rgb_matrix_config.hsv; 8 HSV hsv = rgb_matrix_config.hsv;
9 uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 8); 9 uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8);
10 hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); 10 hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
11 RGB rgb = hsv_to_rgb(hsv); 11 RGB rgb = hsv_to_rgb(hsv);
12 for (uint8_t i = led_min; i < led_max; i++) { 12 for (uint8_t i = led_min; i < led_max; i++) {
diff --git a/quantum/rgb_matrix_animations/digital_rain_anim.h b/quantum/rgb_matrix_animations/digital_rain_anim.h
index 7a4a52db1b..1de45f8e8d 100644
--- a/quantum/rgb_matrix_animations/digital_rain_anim.h
+++ b/quantum/rgb_matrix_animations/digital_rain_anim.h
@@ -18,7 +18,7 @@ bool DIGITAL_RAIN(effect_params_t* params) {
18 18
19 if (params->init) { 19 if (params->init) {
20 rgb_matrix_set_color_all(0, 0, 0); 20 rgb_matrix_set_color_all(0, 0, 0);
21 memset(rgb_frame_buffer, 0, sizeof(rgb_frame_buffer)); 21 memset(g_rgb_frame_buffer, 0, sizeof(g_rgb_frame_buffer));
22 drop = 0; 22 drop = 0;
23 } 23 }
24 24
@@ -27,10 +27,10 @@ bool DIGITAL_RAIN(effect_params_t* params) {
27 if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) { 27 if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) {
28 // top row, pixels have just fallen and we're 28 // top row, pixels have just fallen and we're
29 // making a new rain drop in this column 29 // making a new rain drop in this column
30 rgb_frame_buffer[row][col] = max_intensity; 30 g_rgb_frame_buffer[row][col] = max_intensity;
31 } else if (rgb_frame_buffer[row][col] > 0 && rgb_frame_buffer[row][col] < max_intensity) { 31 } else if (g_rgb_frame_buffer[row][col] > 0 && g_rgb_frame_buffer[row][col] < max_intensity) {
32 // neither fully bright nor dark, decay it 32 // neither fully bright nor dark, decay it
33 rgb_frame_buffer[row][col]--; 33 g_rgb_frame_buffer[row][col]--;
34 } 34 }
35 // set the pixel colour 35 // set the pixel colour
36 uint8_t led[LED_HITS_TO_REMEMBER]; 36 uint8_t led[LED_HITS_TO_REMEMBER];
@@ -38,11 +38,11 @@ bool DIGITAL_RAIN(effect_params_t* params) {
38 38
39 // TODO: multiple leds are supported mapped to the same row/column 39 // TODO: multiple leds are supported mapped to the same row/column
40 if (led_count > 0) { 40 if (led_count > 0) {
41 if (rgb_frame_buffer[row][col] > pure_green_intensity) { 41 if (g_rgb_frame_buffer[row][col] > pure_green_intensity) {
42 const uint8_t boost = (uint8_t)((uint16_t)max_brightness_boost * (rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity)); 42 const uint8_t boost = (uint8_t)((uint16_t)max_brightness_boost * (g_rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity));
43 rgb_matrix_set_color(led[0], boost, max_intensity, boost); 43 rgb_matrix_set_color(led[0], boost, max_intensity, boost);
44 } else { 44 } else {
45 const uint8_t green = (uint8_t)((uint16_t)max_intensity * rgb_frame_buffer[row][col] / pure_green_intensity); 45 const uint8_t green = (uint8_t)((uint16_t)max_intensity * g_rgb_frame_buffer[row][col] / pure_green_intensity);
46 rgb_matrix_set_color(led[0], 0, green, 0); 46 rgb_matrix_set_color(led[0], 0, green, 0);
47 } 47 }
48 } 48 }
@@ -55,15 +55,15 @@ bool DIGITAL_RAIN(effect_params_t* params) {
55 for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) { 55 for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) {
56 for (uint8_t col = 0; col < MATRIX_COLS; col++) { 56 for (uint8_t col = 0; col < MATRIX_COLS; col++) {
57 // if ths is on the bottom row and bright allow decay 57 // if ths is on the bottom row and bright allow decay
58 if (row == MATRIX_ROWS - 1 && rgb_frame_buffer[row][col] == max_intensity) { 58 if (row == MATRIX_ROWS - 1 && g_rgb_frame_buffer[row][col] == max_intensity) {
59 rgb_frame_buffer[row][col]--; 59 g_rgb_frame_buffer[row][col]--;
60 } 60 }
61 // check if the pixel above is bright 61 // check if the pixel above is bright
62 if (rgb_frame_buffer[row - 1][col] == max_intensity) { 62 if (g_rgb_frame_buffer[row - 1][col] == max_intensity) {
63 // allow old bright pixel to decay 63 // allow old bright pixel to decay
64 rgb_frame_buffer[row - 1][col]--; 64 g_rgb_frame_buffer[row - 1][col]--;
65 // make this pixel bright 65 // make this pixel bright
66 rgb_frame_buffer[row][col] = max_intensity; 66 g_rgb_frame_buffer[row][col] = max_intensity;
67 } 67 }
68 } 68 }
69 } 69 }
diff --git a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h
index 5596146a38..ef2d1500b0 100644
--- a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h
+++ b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h
@@ -12,7 +12,7 @@ static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
12bool JELLYBEAN_RAINDROPS(effect_params_t* params) { 12bool JELLYBEAN_RAINDROPS(effect_params_t* params) {
13 if (!params->init) { 13 if (!params->init) {
14 // Change one LED every tick, make sure speed is not 0 14 // Change one LED every tick, make sure speed is not 0
15 if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) { 15 if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
16 jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params); 16 jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
17 } 17 }
18 return false; 18 return false;
diff --git a/quantum/rgb_matrix_animations/raindrops_anim.h b/quantum/rgb_matrix_animations/raindrops_anim.h
index 9f839a1bce..6e1b5acb0d 100644
--- a/quantum/rgb_matrix_animations/raindrops_anim.h
+++ b/quantum/rgb_matrix_animations/raindrops_anim.h
@@ -22,7 +22,7 @@ static void raindrops_set_color(int i, effect_params_t* params) {
22bool RAINDROPS(effect_params_t* params) { 22bool RAINDROPS(effect_params_t* params) {
23 if (!params->init) { 23 if (!params->init) {
24 // Change one LED every tick, make sure speed is not 0 24 // Change one LED every tick, make sure speed is not 0
25 if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) { 25 if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
26 raindrops_set_color(rand() % DRIVER_LED_TOTAL, params); 26 raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
27 } 27 }
28 return false; 28 return false;
diff --git a/quantum/rgb_matrix_animations/typing_heatmap_anim.h b/quantum/rgb_matrix_animations/typing_heatmap_anim.h
index dd313f16a5..e82c1b49ee 100644
--- a/quantum/rgb_matrix_animations/typing_heatmap_anim.h
+++ b/quantum/rgb_matrix_animations/typing_heatmap_anim.h
@@ -10,20 +10,20 @@ void process_rgb_matrix_typing_heatmap(keyrecord_t* record) {
10 uint8_t m_col = col - 1; 10 uint8_t m_col = col - 1;
11 uint8_t p_col = col + 1; 11 uint8_t p_col = col + 1;
12 12
13 if (m_col < col) rgb_frame_buffer[row][m_col] = qadd8(rgb_frame_buffer[row][m_col], 16); 13 if (m_col < col) g_rgb_frame_buffer[row][m_col] = qadd8(g_rgb_frame_buffer[row][m_col], 16);
14 rgb_frame_buffer[row][col] = qadd8(rgb_frame_buffer[row][col], 32); 14 g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32);
15 if (p_col < MATRIX_COLS) rgb_frame_buffer[row][p_col] = qadd8(rgb_frame_buffer[row][p_col], 16); 15 if (p_col < MATRIX_COLS) g_rgb_frame_buffer[row][p_col] = qadd8(g_rgb_frame_buffer[row][p_col], 16);
16 16
17 if (p_row < MATRIX_ROWS) { 17 if (p_row < MATRIX_ROWS) {
18 if (m_col < col) rgb_frame_buffer[p_row][m_col] = qadd8(rgb_frame_buffer[p_row][m_col], 13); 18 if (m_col < col) g_rgb_frame_buffer[p_row][m_col] = qadd8(g_rgb_frame_buffer[p_row][m_col], 13);
19 rgb_frame_buffer[p_row][col] = qadd8(rgb_frame_buffer[p_row][col], 16); 19 g_rgb_frame_buffer[p_row][col] = qadd8(g_rgb_frame_buffer[p_row][col], 16);
20 if (p_col < MATRIX_COLS) rgb_frame_buffer[p_row][p_col] = qadd8(rgb_frame_buffer[p_row][p_col], 13); 20 if (p_col < MATRIX_COLS) g_rgb_frame_buffer[p_row][p_col] = qadd8(g_rgb_frame_buffer[p_row][p_col], 13);
21 } 21 }
22 22
23 if (m_row < row) { 23 if (m_row < row) {
24 if (m_col < col) rgb_frame_buffer[m_row][m_col] = qadd8(rgb_frame_buffer[m_row][m_col], 13); 24 if (m_col < col) g_rgb_frame_buffer[m_row][m_col] = qadd8(g_rgb_frame_buffer[m_row][m_col], 13);
25 rgb_frame_buffer[m_row][col] = qadd8(rgb_frame_buffer[m_row][col], 16); 25 g_rgb_frame_buffer[m_row][col] = qadd8(g_rgb_frame_buffer[m_row][col], 16);
26 if (p_col < MATRIX_COLS) rgb_frame_buffer[m_row][p_col] = qadd8(rgb_frame_buffer[m_row][p_col], 13); 26 if (p_col < MATRIX_COLS) g_rgb_frame_buffer[m_row][p_col] = qadd8(g_rgb_frame_buffer[m_row][p_col], 13);
27 } 27 }
28} 28}
29 29
@@ -31,18 +31,18 @@ bool TYPING_HEATMAP(effect_params_t* params) {
31 // Modified version of RGB_MATRIX_USE_LIMITS to work off of matrix row / col size 31 // Modified version of RGB_MATRIX_USE_LIMITS to work off of matrix row / col size
32 uint8_t led_min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; 32 uint8_t led_min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter;
33 uint8_t led_max = led_min + RGB_MATRIX_LED_PROCESS_LIMIT; 33 uint8_t led_max = led_min + RGB_MATRIX_LED_PROCESS_LIMIT;
34 if (led_max > sizeof(rgb_frame_buffer)) led_max = sizeof(rgb_frame_buffer); 34 if (led_max > sizeof(g_rgb_frame_buffer)) led_max = sizeof(g_rgb_frame_buffer);
35 35
36 if (params->init) { 36 if (params->init) {
37 rgb_matrix_set_color_all(0, 0, 0); 37 rgb_matrix_set_color_all(0, 0, 0);
38 memset(rgb_frame_buffer, 0, sizeof rgb_frame_buffer); 38 memset(g_rgb_frame_buffer, 0, sizeof g_rgb_frame_buffer);
39 } 39 }
40 40
41 // Render heatmap & decrease 41 // Render heatmap & decrease
42 for (int i = led_min; i < led_max; i++) { 42 for (int i = led_min; i < led_max; i++) {
43 uint8_t row = i % MATRIX_ROWS; 43 uint8_t row = i % MATRIX_ROWS;
44 uint8_t col = i / MATRIX_ROWS; 44 uint8_t col = i / MATRIX_ROWS;
45 uint8_t val = rgb_frame_buffer[row][col]; 45 uint8_t val = g_rgb_frame_buffer[row][col];
46 46
47 // set the pixel colour 47 // set the pixel colour
48 uint8_t led[LED_HITS_TO_REMEMBER]; 48 uint8_t led[LED_HITS_TO_REMEMBER];
@@ -55,10 +55,10 @@ bool TYPING_HEATMAP(effect_params_t* params) {
55 rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b); 55 rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b);
56 } 56 }
57 57
58 rgb_frame_buffer[row][col] = qsub8(val, 1); 58 g_rgb_frame_buffer[row][col] = qsub8(val, 1);
59 } 59 }
60 60
61 return led_max < sizeof(rgb_frame_buffer); 61 return led_max < sizeof(g_rgb_frame_buffer);
62} 62}
63 63
64# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS 64# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix_runners/effect_runner_dx_dy.h b/quantum/rgb_matrix_runners/effect_runner_dx_dy.h
index 3d312190a5..9d0c9fab19 100644
--- a/quantum/rgb_matrix_runners/effect_runner_dx_dy.h
+++ b/quantum/rgb_matrix_runners/effect_runner_dx_dy.h
@@ -5,7 +5,7 @@ typedef HSV (*dx_dy_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t time);
5bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) { 5bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) {
6 RGB_MATRIX_USE_LIMITS(led_min, led_max); 6 RGB_MATRIX_USE_LIMITS(led_min, led_max);
7 7
8 uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2); 8 uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2);
9 for (uint8_t i = led_min; i < led_max; i++) { 9 for (uint8_t i = led_min; i < led_max; i++) {
10 RGB_MATRIX_TEST_LED_FLAGS(); 10 RGB_MATRIX_TEST_LED_FLAGS();
11 int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; 11 int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
diff --git a/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h b/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h
index 1f4767e321..2824c82527 100644
--- a/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h
+++ b/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h
@@ -5,7 +5,7 @@ typedef HSV (*dx_dy_dist_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8
5bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) { 5bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) {
6 RGB_MATRIX_USE_LIMITS(led_min, led_max); 6 RGB_MATRIX_USE_LIMITS(led_min, led_max);
7 7
8 uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2); 8 uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2);
9 for (uint8_t i = led_min; i < led_max; i++) { 9 for (uint8_t i = led_min; i < led_max; i++) {
10 RGB_MATRIX_TEST_LED_FLAGS(); 10 RGB_MATRIX_TEST_LED_FLAGS();
11 int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; 11 int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
diff --git a/quantum/rgb_matrix_runners/effect_runner_i.h b/quantum/rgb_matrix_runners/effect_runner_i.h
index eebfb78c02..5e6bf5daaf 100644
--- a/quantum/rgb_matrix_runners/effect_runner_i.h
+++ b/quantum/rgb_matrix_runners/effect_runner_i.h
@@ -5,7 +5,7 @@ typedef HSV (*i_f)(HSV hsv, uint8_t i, uint8_t time);
5bool effect_runner_i(effect_params_t* params, i_f effect_func) { 5bool effect_runner_i(effect_params_t* params, i_f effect_func) {
6 RGB_MATRIX_USE_LIMITS(led_min, led_max); 6 RGB_MATRIX_USE_LIMITS(led_min, led_max);
7 7
8 uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); 8 uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4);
9 for (uint8_t i = led_min; i < led_max; i++) { 9 for (uint8_t i = led_min; i < led_max; i++) {
10 RGB_MATRIX_TEST_LED_FLAGS(); 10 RGB_MATRIX_TEST_LED_FLAGS();
11 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); 11 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time));
diff --git a/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h b/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h
index c02352b86d..3fb7d48051 100644
--- a/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h
+++ b/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h
@@ -5,7 +5,7 @@ typedef HSV (*sin_cos_i_f)(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t t
5bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) { 5bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) {
6 RGB_MATRIX_USE_LIMITS(led_min, led_max); 6 RGB_MATRIX_USE_LIMITS(led_min, led_max);
7 7
8 uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); 8 uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4);
9 int8_t cos_value = cos8(time) - 128; 9 int8_t cos_value = cos8(time) - 128;
10 int8_t sin_value = sin8(time) - 128; 10 int8_t sin_value = sin8(time) - 128;
11 for (uint8_t i = led_min; i < led_max; i++) { 11 for (uint8_t i = led_min; i < led_max; i++) {
diff --git a/quantum/rgb_matrix_types.h b/quantum/rgb_matrix_types.h
index fc23f55d0e..f447ac9c56 100644
--- a/quantum/rgb_matrix_types.h
+++ b/quantum/rgb_matrix_types.h
@@ -44,13 +44,6 @@ typedef struct PACKED {
44} effect_params_t; 44} effect_params_t;
45 45
46typedef struct PACKED { 46typedef struct PACKED {
47 // Global tick at 20 Hz
48 uint32_t tick;
49 // Ticks since this key was last hit.
50 uint32_t any_key_hit;
51} rgb_counters_t;
52
53typedef struct PACKED {
54 uint8_t x; 47 uint8_t x;
55 uint8_t y; 48 uint8_t y;
56} point_t; 49} point_t;
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index aa8a0eb7ad..63de7c7ede 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -1,3 +1,5 @@
1PRINTF_PATH = $(LIB_PATH)/printf
2
1COMMON_DIR = common 3COMMON_DIR = common
2PLATFORM_COMMON_DIR = $(COMMON_DIR)/$(PLATFORM_KEY) 4PLATFORM_COMMON_DIR = $(COMMON_DIR)/$(PLATFORM_KEY)
3 5
@@ -21,7 +23,12 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \
21ifeq ($(PLATFORM),AVR) 23ifeq ($(PLATFORM),AVR)
22 TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/xprintf.S 24 TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/xprintf.S
23else ifeq ($(PLATFORM),CHIBIOS) 25else ifeq ($(PLATFORM),CHIBIOS)
24 TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/printf.c 26 TMK_COMMON_SRC += $(PRINTF_PATH)/printf.c
27 TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_FLOAT
28 TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_EXPONENTIAL
29 TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_LONG_LONG
30 TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T
31 VPATH += $(PRINTF_PATH)
25else ifeq ($(PLATFORM),ARM_ATSAM) 32else ifeq ($(PLATFORM),ARM_ATSAM)
26 TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/printf.c 33 TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/printf.c
27endif 34endif
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 3b1268dc94..7a53e08ed3 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -48,7 +48,7 @@ int retro_tapping_counter = 0;
48#endif 48#endif
49 49
50#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY 50#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
51__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode) { return false; } 51__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { return false; }
52#endif 52#endif
53 53
54#ifndef TAP_CODE_DELAY 54#ifndef TAP_CODE_DELAY
@@ -335,7 +335,7 @@ void process_action(keyrecord_t *record, action_t action) {
335# if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY) 335# if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY)
336 if ( 336 if (
337# ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY 337# ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
338 !get_ignore_mod_tap_interrupt(get_event_keycode(record->event, false)) && 338 !get_ignore_mod_tap_interrupt(get_event_keycode(record->event, false), &record) &&
339# endif 339# endif
340 record->tap.interrupted) { 340 record->tap.interrupted) {
341 dprint("mods_tap: tap: cancel: add_mods\n"); 341 dprint("mods_tap: tap: cancel: add_mods\n");
diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c
index 34f08d8904..fe545c79a0 100644
--- a/tmk_core/common/action_tapping.c
+++ b/tmk_core/common/action_tapping.c
@@ -19,10 +19,10 @@
19# define IS_TAPPING_RELEASED() (IS_TAPPING() && !tapping_key.event.pressed) 19# define IS_TAPPING_RELEASED() (IS_TAPPING() && !tapping_key.event.pressed)
20# define IS_TAPPING_KEY(k) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (k))) 20# define IS_TAPPING_KEY(k) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (k)))
21 21
22__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode) { return TAPPING_TERM; } 22__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; }
23 23
24# ifdef TAPPING_TERM_PER_KEY 24# ifdef TAPPING_TERM_PER_KEY
25# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_event_keycode(tapping_key.event, false))) 25# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_event_keycode(tapping_key.event, false), &tapping_key))
26# else 26# else
27# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < TAPPING_TERM) 27# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < TAPPING_TERM)
28# endif 28# endif
@@ -122,7 +122,7 @@ bool process_tapping(keyrecord_t *keyp) {
122# if defined(TAPPING_TERM_PER_KEY) || (TAPPING_TERM >= 500) || defined(PERMISSIVE_HOLD) || defined(PERMISSIVE_HOLD_PER_KEY) 122# if defined(TAPPING_TERM_PER_KEY) || (TAPPING_TERM >= 500) || defined(PERMISSIVE_HOLD) || defined(PERMISSIVE_HOLD_PER_KEY)
123 else if ( 123 else if (
124# ifdef TAPPING_TERM_PER_KEY 124# ifdef TAPPING_TERM_PER_KEY
125 (get_tapping_term(get_event_keycode(tapping_key.event, false)) >= 500) && 125 (get_tapping_term(get_event_keycode(tapping_key.event, false), keyp) >= 500) &&
126# endif 126# endif
127# ifdef PERMISSIVE_HOLD_PER_KEY 127# ifdef PERMISSIVE_HOLD_PER_KEY
128 !get_permissive_hold(get_event_keycode(tapping_key.event, false), keyp) && 128 !get_permissive_hold(get_event_keycode(tapping_key.event, false), keyp) &&
diff --git a/tmk_core/common/action_tapping.h b/tmk_core/common/action_tapping.h
index 5eaef1c5f0..7015ce7612 100644
--- a/tmk_core/common/action_tapping.h
+++ b/tmk_core/common/action_tapping.h
@@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
33 33
34#ifndef NO_ACTION_TAPPING 34#ifndef NO_ACTION_TAPPING
35uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache); 35uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache);
36uint16_t get_tapping_term(uint16_t keycode); 36uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record);
37void action_tapping_process(keyrecord_t record); 37void action_tapping_process(keyrecord_t record);
38#endif 38#endif
39 39
diff --git a/tmk_core/common/chibios/printf.c b/tmk_core/common/chibios/printf.c
deleted file mode 100644
index a99752bb3d..0000000000
--- a/tmk_core/common/chibios/printf.c
+++ /dev/null
@@ -1,233 +0,0 @@
1/*
2 * found at: http://www.sparetimelabs.com/tinyprintf/tinyprintf.php
3 * and: http://www.sparetimelabs.com/printfrevisited/printfrevisited.php
4 */
5
6/*
7File: printf.c
8
9Copyright (C) 2004 Kustaa Nyholm
10
11This library is free software; you can redistribute it and/or
12modify it under the terms of the GNU Lesser General Public
13License as published by the Free Software Foundation; either
14version 2.1 of the License, or (at your option) any later version.
15
16This library is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19Lesser General Public License for more details.
20
21You should have received a copy of the GNU Lesser General Public
22License along with this library; if not, write to the Free Software
23Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
25*/
26
27#include "printf.h"
28
29typedef void (*putcf)(void*, char);
30static putcf stdout_putf;
31static void* stdout_putp;
32
33// this adds cca 400 bytes
34#define PRINTF_LONG_SUPPORT
35
36#ifdef PRINTF_LONG_SUPPORT
37
38static void uli2a(unsigned long int num, unsigned int base, int uc, char* bf) {
39 int n = 0;
40 unsigned int d = 1;
41 while (num / d >= base) d *= base;
42 while (d != 0) {
43 int dgt = num / d;
44 num %= d;
45 d /= base;
46 if (n || dgt > 0 || d == 0) {
47 *bf++ = dgt + (dgt < 10 ? '0' : (uc ? 'A' : 'a') - 10);
48 ++n;
49 }
50 }
51 *bf = 0;
52}
53
54static void li2a(long num, char* bf) {
55 if (num < 0) {
56 num = -num;
57 *bf++ = '-';
58 }
59 uli2a(num, 10, 0, bf);
60}
61
62#endif
63
64static void ui2a(unsigned int num, unsigned int base, int uc, char* bf) {
65 int n = 0;
66 unsigned int d = 1;
67 while (num / d >= base) d *= base;
68 while (d != 0) {
69 int dgt = num / d;
70 num %= d;
71 d /= base;
72 if (n || dgt > 0 || d == 0) {
73 *bf++ = dgt + (dgt < 10 ? '0' : (uc ? 'A' : 'a') - 10);
74 ++n;
75 }
76 }
77 *bf = 0;
78}
79
80static void i2a(int num, char* bf) {
81 if (num < 0) {
82 num = -num;
83 *bf++ = '-';
84 }
85 ui2a(num, 10, 0, bf);
86}
87
88static int a2d(char ch) {
89 if (ch >= '0' && ch <= '9')
90 return ch - '0';
91 else if (ch >= 'a' && ch <= 'f')
92 return ch - 'a' + 10;
93 else if (ch >= 'A' && ch <= 'F')
94 return ch - 'A' + 10;
95 else
96 return -1;
97}
98
99static char a2i(char ch, const char** src, int base, int* nump) {
100 const char* p = *src;
101 int num = 0;
102 int digit;
103 while ((digit = a2d(ch)) >= 0) {
104 if (digit > base) break;
105 num = num * base + digit;
106 ch = *p++;
107 }
108 *src = p;
109 *nump = num;
110 return ch;
111}
112
113static void putchw(void* putp, putcf putf, int n, char z, char* bf) {
114 char fc = z ? '0' : ' ';
115 char ch;
116 char* p = bf;
117 while (*p++ && n > 0) n--;
118 while (n-- > 0) putf(putp, fc);
119 while ((ch = *bf++)) putf(putp, ch);
120}
121
122void tfp_format(void* putp, putcf putf, const char* fmt, va_list va) {
123 // This used to handle max of 12, but binary support jumps this to at least 32
124 char bf[36];
125
126 char ch;
127
128 while ((ch = *(fmt++))) {
129 if (ch != '%')
130 putf(putp, ch);
131 else {
132 char lz = 0;
133#ifdef PRINTF_LONG_SUPPORT
134 char lng = 0;
135#endif
136 int w = 0;
137 ch = *(fmt++);
138 if (ch == '0') {
139 ch = *(fmt++);
140 lz = 1;
141 }
142 if (ch >= '0' && ch <= '9') {
143 ch = a2i(ch, &fmt, 10, &w);
144 }
145#ifdef PRINTF_LONG_SUPPORT
146 if (ch == 'l') {
147 ch = *(fmt++);
148 lng = 1;
149 }
150#endif
151 switch (ch) {
152 case 0:
153 goto abort;
154 case 'u': {
155#ifdef PRINTF_LONG_SUPPORT
156 if (lng)
157 uli2a(va_arg(va, unsigned long int), 10, 0, bf);
158 else
159#endif
160 ui2a(va_arg(va, unsigned int), 10, 0, bf);
161 putchw(putp, putf, w, lz, bf);
162 break;
163 }
164 case 'd': {
165#ifdef PRINTF_LONG_SUPPORT
166 if (lng)
167 li2a(va_arg(va, unsigned long int), bf);
168 else
169#endif
170 i2a(va_arg(va, int), bf);
171 putchw(putp, putf, w, lz, bf);
172 break;
173 }
174 case 'x':
175 case 'X':
176#ifdef PRINTF_LONG_SUPPORT
177 if (lng)
178 uli2a(va_arg(va, unsigned long int), 16, (ch == 'X'), bf);
179 else
180#endif
181 ui2a(va_arg(va, unsigned int), 16, (ch == 'X'), bf);
182 putchw(putp, putf, w, lz, bf);
183 break;
184 case 'c':
185 putf(putp, (char)(va_arg(va, int)));
186 break;
187 case 's':
188 putchw(putp, putf, w, 0, va_arg(va, char*));
189 break;
190 case 'b':
191#ifdef PRINTF_LONG_SUPPORT
192 if (lng)
193 uli2a(va_arg(va, unsigned long int), 2, 0, bf);
194 else
195#endif
196 ui2a(va_arg(va, unsigned int), 2, 0, bf);
197 putchw(putp, putf, w, lz, bf);
198 break;
199 case '%':
200 putf(putp, ch);
201 default:
202 break;
203 }
204 }
205 }
206abort:;
207}
208
209void init_printf(void* putp, void (*putf)(void*, char)) {
210 stdout_putf = putf;
211 stdout_putp = putp;
212}
213
214int tfp_printf(const char* fmt, ...) {
215 va_list va;
216 va_start(va, fmt);
217 tfp_format(stdout_putp, stdout_putf, fmt, va);
218 va_end(va);
219
220 return 1;
221}
222
223static void putcp(void* p, char c) { *(*((char**)p))++ = c; }
224
225int tfp_sprintf(char* s, const char* fmt, ...) {
226 va_list va;
227 va_start(va, fmt);
228 tfp_format(&s, putcp, fmt, va);
229 putcp(&s, 0);
230 va_end(va);
231
232 return 1;
233}
diff --git a/tmk_core/common/chibios/printf.h b/tmk_core/common/chibios/printf.h
deleted file mode 100644
index 775459e1e8..0000000000
--- a/tmk_core/common/chibios/printf.h
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * found at: http://www.sparetimelabs.com/tinyprintf/tinyprintf.php
3 * and: http://www.sparetimelabs.com/printfrevisited/printfrevisited.php
4 */
5
6/*
7File: printf.h
8
9Copyright (C) 2004 Kustaa Nyholm
10
11This library is free software; you can redistribute it and/or
12modify it under the terms of the GNU Lesser General Public
13License as published by the Free Software Foundation; either
14version 2.1 of the License, or (at your option) any later version.
15
16This library is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19See the GNU Lesser General Public License for more details.
20
21You should have received a copy of the GNU Lesser General Public
22License along with this library; if not, write to the Free Software
23Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
25This library is realy just two files: 'printf.h' and 'printf.c'.
26
27They provide a simple and small (+200 loc) printf functionality to
28be used in embedded systems.
29
30I've found them so usefull in debugging that I do not bother with a
31debugger at all.
32
33They are distributed in source form, so to use them, just compile them
34into your project.
35
36Two printf variants are provided: printf and sprintf.
37
38The formats supported by this implementation are: 'd' 'u' 'c' 's' 'x' 'X'.
39
40Zero padding and field width are also supported.
41
42If the library is compiled with 'PRINTF_SUPPORT_LONG' defined then the
43long specifier is also
44supported. Note that this will pull in some long math routines (pun intended!)
45and thus make your executable noticably longer.
46
47The memory foot print of course depends on the target cpu, compiler and
48compiler options, but a rough guestimate (based on a H8S target) is about
491.4 kB for code and some twenty 'int's and 'char's, say 60 bytes of stack space.
50Not too bad. Your milage may vary. By hacking the source code you can
51get rid of some hunred bytes, I'm sure, but personally I feel the balance of
52functionality and flexibility versus code size is close to optimal for
53many embedded systems.
54
55To use the printf you need to supply your own character output function,
56something like :
57
58 void putc ( void* p, char c)
59 {
60 while (!SERIAL_PORT_EMPTY) ;
61 SERIAL_PORT_TX_REGISTER = c;
62 }
63
64Before you can call printf you need to initialize it to use your
65character output function with something like:
66
67 init_printf(NULL,putc);
68
69Notice the 'NULL' in 'init_printf' and the parameter 'void* p' in 'putc',
70the NULL (or any pointer) you pass into the 'init_printf' will eventually be
71passed to your 'putc' routine. This allows you to pass some storage space (or
72anything realy) to the character output function, if necessary.
73This is not often needed but it was implemented like that because it made
74implementing the sprintf function so neat (look at the source code).
75
76The code is re-entrant, except for the 'init_printf' function, so it
77is safe to call it from interupts too, although this may result in mixed output.
78If you rely on re-entrancy, take care that your 'putc' function is re-entrant!
79
80The printf and sprintf functions are actually macros that translate to
81'tfp_printf' and 'tfp_sprintf'. This makes it possible
82to use them along with 'stdio.h' printf's in a single source file.
83You just need to undef the names before you include the 'stdio.h'.
84Note that these are not function like macros, so if you have variables
85or struct members with these names, things will explode in your face.
86Without variadic macros this is the best we can do to wrap these
87fucnction. If it is a problem just give up the macros and use the
88functions directly or rename them.
89
90For further details see source code.
91
92regs Kusti, 23.10.2004
93*/
94
95#ifndef __TFP_PRINTF__
96#define __TFP_PRINTF__
97
98#include <stdarg.h>
99
100void init_printf(void* putp, void (*putf)(void*, char));
101
102int tfp_printf(const char* fmt, ...);
103int tfp_sprintf(char* s, const char* fmt, ...);
104
105void tfp_format(void* putp, void (*putf)(void*, char), const char* fmt, va_list va);
106
107#define printf tfp_printf
108#define sprintf tfp_sprintf
109
110#endif
diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c
index ee3188646c..3cfcba3058 100644
--- a/tmk_core/common/command.c
+++ b/tmk_core/common/command.c
@@ -43,10 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
43# include "mousekey.h" 43# include "mousekey.h"
44#endif 44#endif
45 45
46#ifdef PROTOCOL_VUSB
47# include "usbdrv.h"
48#endif
49
50#ifdef AUDIO_ENABLE 46#ifdef AUDIO_ENABLE
51# include "audio.h" 47# include "audio.h"
52#endif /* AUDIO_ENABLE */ 48#endif /* AUDIO_ENABLE */
diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h
index 04ca558109..1c77236212 100644
--- a/tmk_core/common/print.h
+++ b/tmk_core/common/print.h
@@ -72,9 +72,7 @@ extern "C"
72 72
73# elif defined(PROTOCOL_CHIBIOS) /* PROTOCOL_CHIBIOS */ 73# elif defined(PROTOCOL_CHIBIOS) /* PROTOCOL_CHIBIOS */
74 74
75# ifndef TERMINAL_ENABLE 75# include "printf.h" // lib/printf/printf.h
76# include "chibios/printf.h"
77# endif
78 76
79# ifdef USER_PRINT /* USER_PRINT */ 77# ifdef USER_PRINT /* USER_PRINT */
80 78
@@ -89,7 +87,6 @@ extern "C"
89# define uprintf printf 87# define uprintf printf
90 88
91# else /* NORMAL PRINT */ 89# else /* NORMAL PRINT */
92
93// Create user & normal print defines 90// Create user & normal print defines
94# define print(s) printf(s) 91# define print(s) printf(s)
95# define println(s) printf(s "\r\n") 92# define println(s) printf(s "\r\n")
diff --git a/tmk_core/protocol/arm_atsam/led_matrix.c b/tmk_core/protocol/arm_atsam/led_matrix.c
index 24eab25067..4b8cc7c5e1 100644
--- a/tmk_core/protocol/arm_atsam/led_matrix.c
+++ b/tmk_core/protocol/arm_atsam/led_matrix.c
@@ -270,7 +270,7 @@ void flush(void) {
270 } 270 }
271 271
272 // This should only be performed once per frame 272 // This should only be performed once per frame
273 pomod = (float)((g_rgb_counters.tick / 10) % (uint32_t)(1000.0f / led_animation_speed)) / 10.0f * led_animation_speed; 273 pomod = (float)((g_rgb_timer / 10) % (uint32_t)(1000.0f / led_animation_speed)) / 10.0f * led_animation_speed;
274 pomod *= 100.0f; 274 pomod *= 100.0f;
275 pomod = (uint32_t)pomod % 10000; 275 pomod = (uint32_t)pomod % 10000;
276 pomod /= 100.0f; 276 pomod /= 100.0f;
diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c
index 61665eb6f4..7d32c16ed8 100644
--- a/tmk_core/protocol/chibios/main.c
+++ b/tmk_core/protocol/chibios/main.c
@@ -158,9 +158,6 @@ int main(void) {
158 /* Init USB */ 158 /* Init USB */
159 init_usb_driver(&USB_DRIVER); 159 init_usb_driver(&USB_DRIVER);
160 160
161 /* init printf */
162 init_printf(NULL, sendchar_pf);
163
164#ifdef MIDI_ENABLE 161#ifdef MIDI_ENABLE
165 setup_midi(); 162 setup_midi();
166#endif 163#endif
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index ecc83d9ecc..65bd291bec 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -796,9 +796,8 @@ int8_t sendchar(uint8_t c) {
796} 796}
797#endif /* CONSOLE_ENABLE */ 797#endif /* CONSOLE_ENABLE */
798 798
799void sendchar_pf(void *p, char c) { 799void _putchar(char character) {
800 (void)p; 800 sendchar(character);
801 sendchar((uint8_t)c);
802} 801}
803 802
804#ifdef RAW_ENABLE 803#ifdef RAW_ENABLE
diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h
index 17041b4f2f..94baf9b35e 100644
--- a/tmk_core/protocol/chibios/usb_main.h
+++ b/tmk_core/protocol/chibios/usb_main.h
@@ -87,6 +87,4 @@ void console_flush_output(void);
87 87
88#endif /* CONSOLE_ENABLE */ 88#endif /* CONSOLE_ENABLE */
89 89
90void sendchar_pf(void *p, char c);
91
92#endif /* _USB_MAIN_H_ */ 90#endif /* _USB_MAIN_H_ */
diff --git a/tmk_core/protocol/iwrap.mk b/tmk_core/protocol/iwrap.mk
index eeedd83af2..934235bd81 100644
--- a/tmk_core/protocol/iwrap.mk
+++ b/tmk_core/protocol/iwrap.mk
@@ -16,11 +16,17 @@ VPATH += $(TMK_DIR)/protocol/iwrap
16# V-USB 16# V-USB
17# 17#
18VUSB_DIR = protocol/vusb 18VUSB_DIR = protocol/vusb
19OPT_DEFS += -DPROTOCOL_VUSB
20SRC += $(VUSB_DIR)/vusb.c \
21 $(VUSB_DIR)/usbdrv/usbdrv.c \
22 $(VUSB_DIR)/usbdrv/usbdrvasm.S \
23 $(VUSB_DIR)/usbdrv/oddebug.c
24VPATH += $(TMK_DIR)/protocol/vusb:$(TMK_DIR)/protocol/vusb/usbdrv
25 19
20# Path to the V-USB library
21VUSB_PATH = $(LIB_PATH)/vusb
22
23SRC += $(VUSB_DIR)/vusb.c \
24 $(VUSB_PATH)/usbdrv/usbdrv.c \
25 $(VUSB_PATH)/usbdrv/usbdrvasm.S \
26 $(VUSB_PATH)/usbdrv/oddebug.c
26 27
28# Search Path
29VPATH += $(TMK_PATH)/$(VUSB_DIR)
30VPATH += $(VUSB_PATH)
31
32OPT_DEFS += -DPROTOCOL_VUSB
diff --git a/tmk_core/protocol/iwrap/main.c b/tmk_core/protocol/iwrap/main.c
index 6e9b5455b1..4048a9791d 100644
--- a/tmk_core/protocol/iwrap/main.c
+++ b/tmk_core/protocol/iwrap/main.c
@@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
29#include "iwrap.h" 29#include "iwrap.h"
30#ifdef PROTOCOL_VUSB 30#ifdef PROTOCOL_VUSB
31# include "vusb.h" 31# include "vusb.h"
32# include "usbdrv.h" 32# include <usbdrv/usbdrv.h>
33#endif 33#endif
34#include "uart.h" 34#include "uart.h"
35#include "suart.h" 35#include "suart.h"
diff --git a/tmk_core/protocol/vusb.mk b/tmk_core/protocol/vusb.mk
index 6df0d0d339..5e564f7480 100644
--- a/tmk_core/protocol/vusb.mk
+++ b/tmk_core/protocol/vusb.mk
@@ -1,13 +1,13 @@
1VUSB_DIR = protocol/vusb 1VUSB_DIR = protocol/vusb
2 2
3OPT_DEFS += -DPROTOCOL_VUSB 3# Path to the V-USB library
4VUSB_PATH = $(LIB_PATH)/vusb
4 5
5SRC += $(VUSB_DIR)/main.c \ 6SRC += $(VUSB_DIR)/main.c \
6 $(VUSB_DIR)/vusb.c \ 7 $(VUSB_DIR)/vusb.c \
7 $(VUSB_DIR)/usbdrv/usbdrv.c \ 8 $(VUSB_PATH)/usbdrv/usbdrv.c \
8 $(VUSB_DIR)/usbdrv/usbdrvasm.S \ 9 $(VUSB_PATH)/usbdrv/usbdrvasm.S \
9 $(VUSB_DIR)/usbdrv/oddebug.c 10 $(VUSB_PATH)/usbdrv/oddebug.c
10
11 11
12ifneq ($(strip $(CONSOLE_ENABLE)), yes) 12ifneq ($(strip $(CONSOLE_ENABLE)), yes)
13ifndef NO_UART 13ifndef NO_UART
@@ -18,4 +18,6 @@ endif
18 18
19# Search Path 19# Search Path
20VPATH += $(TMK_PATH)/$(VUSB_DIR) 20VPATH += $(TMK_PATH)/$(VUSB_DIR)
21VPATH += $(TMK_PATH)/$(VUSB_DIR)/usbdrv 21VPATH += $(VUSB_PATH)
22
23OPT_DEFS += -DPROTOCOL_VUSB
diff --git a/tmk_core/protocol/vusb/main.c b/tmk_core/protocol/vusb/main.c
index 7dc16926d2..b4063273da 100644
--- a/tmk_core/protocol/vusb/main.c
+++ b/tmk_core/protocol/vusb/main.c
@@ -12,8 +12,8 @@
12#include <avr/wdt.h> 12#include <avr/wdt.h>
13#include <avr/sleep.h> 13#include <avr/sleep.h>
14#include <util/delay.h> 14#include <util/delay.h>
15#include "usbdrv.h" 15#include <usbdrv/usbdrv.h>
16#include "oddebug.h" 16#include <usbdrv/oddebug.h>
17#include "vusb.h" 17#include "vusb.h"
18#include "keyboard.h" 18#include "keyboard.h"
19#include "host.h" 19#include "host.h"
diff --git a/tmk_core/protocol/vusb/sendchar_usart.c b/tmk_core/protocol/vusb/sendchar_usart.c
index 42bd9ee363..a920a9a536 100644
--- a/tmk_core/protocol/vusb/sendchar_usart.c
+++ b/tmk_core/protocol/vusb/sendchar_usart.c
@@ -3,7 +3,7 @@
3 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 3 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
4 */ 4 */
5#include <stdint.h> 5#include <stdint.h>
6#include "oddebug.h" 6#include <usbdrv/oddebug.h>
7#include "sendchar.h" 7#include "sendchar.h"
8 8
9#if DEBUG_LEVEL > 0 9#if DEBUG_LEVEL > 0
diff --git a/tmk_core/protocol/vusb/usbdrv/Changelog.txt b/tmk_core/protocol/vusb/usbdrv/Changelog.txt
deleted file mode 100644
index 1e74180a9e..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/Changelog.txt
+++ /dev/null
@@ -1,308 +0,0 @@
1This file documents changes in the firmware-only USB driver for atmel's AVR
2microcontrollers. New entries are always appended to the end of the file.
3Scroll down to the bottom to see the most recent changes.
4
52005-04-01:
6 - Implemented endpoint 1 as interrupt-in endpoint.
7 - Moved all configuration options to usbconfig.h which is not part of the
8 driver.
9 - Changed interface for usbVendorSetup().
10 - Fixed compatibility with ATMega8 device.
11 - Various minor optimizations.
12
132005-04-11:
14 - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead()
15 and usbFunctionWrite() now. Added configuration options to choose which
16 of these functions to compile in.
17 - Assembler module delivers receive data non-inverted now.
18 - Made register and bit names compatible with more AVR devices.
19
202005-05-03:
21 - Allow address of usbRxBuf on any memory page as long as the buffer does
22 not cross 256 byte page boundaries.
23 - Better device compatibility: works with Mega88 now.
24 - Code optimization in debugging module.
25 - Documentation updates.
26
272006-01-02:
28 - Added (free) default Vendor- and Product-IDs bought from voti.nl.
29 - Added USBID-License.txt file which defines the rules for using the free
30 shared VID/PID pair.
31 - Added readme.txt to the usbdrv directory which clarifies administrative
32 issues.
33
342006-01-25:
35 - Added "configured state" to become more standards compliant.
36 - Added "HALT" state for interrupt endpoint.
37 - Driver passes the "USB Command Verifier" test from usb.org now.
38 - Made "serial number" a configuration option.
39 - Minor optimizations, we now recommend compiler option "-Os" for best
40 results.
41 - Added a version number to usbdrv.h
42
432006-02-03:
44 - New configuration variable USB_BUFFER_SECTION for the memory section where
45 the USB rx buffer will go. This defaults to ".bss" if not defined. Since
46 this buffer MUST NOT cross 256 byte pages (not even touch a page at the
47 end), the user may want to pass a linker option similar to
48 "-Wl,--section-start=.mybuffer=0x800060".
49 - Provide structure for usbRequest_t.
50 - New defines for USB constants.
51 - Prepared for HID implementations.
52 - Increased data size limit for interrupt transfers to 8 bytes.
53 - New macro usbInterruptIsReady() to query interrupt buffer state.
54
552006-02-18:
56 - Ensure that the data token which is sent as an ack to an OUT transfer is
57 always zero sized. This fixes a bug where the host reports an error after
58 sending an out transfer to the device, although all data arrived at the
59 device.
60 - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite().
61
62* Release 2006-02-20
63
64 - Give a compiler warning when compiling with debugging turned on.
65 - Added Oleg Semyonov's changes for IAR-cc compatibility.
66 - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect()
67 (also thanks to Oleg!).
68 - Rearranged tests in usbPoll() to save a couple of instructions in the most
69 likely case that no actions are pending.
70 - We need a delay between the SET ADDRESS request until the new address
71 becomes active. This delay was handled in usbPoll() until now. Since the
72 spec says that the delay must not exceed 2ms, previous versions required
73 aggressive polling during the enumeration phase. We have now moved the
74 handling of the delay into the interrupt routine.
75 - We must not reply with NAK to a SETUP transaction. We can only achieve this
76 by making sure that the rx buffer is empty when SETUP tokens are expected.
77 We therefore don't pass zero sized data packets from the status phase of
78 a transfer to usbPoll(). This change MAY cause troubles if you rely on
79 receiving a less than 8 bytes long packet in usbFunctionWrite() to
80 identify the end of a transfer. usbFunctionWrite() will NEVER be called
81 with a zero length.
82
83* Release 2006-03-14
84
85 - Improved IAR C support: tiny memory model, more devices
86 - Added template usbconfig.h file under the name usbconfig-prototype.h
87
88* Release 2006-03-26
89
90 - Added provision for one more interrupt-in endpoint (endpoint 3).
91 - Added provision for one interrupt-out endpoint (endpoint 1).
92 - Added flowcontrol macros for USB.
93 - Added provision for custom configuration descriptor.
94 - Allow ANY two port bits for D+ and D-.
95 - Merged (optional) receive endpoint number into global usbRxToken variable.
96 - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the
97 variable name from the single port letter instead of computing the address
98 of related ports from the output-port address.
99
100* Release 2006-06-26
101
102 - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the
103 new features.
104 - Removed "#warning" directives because IAR does not understand them. Use
105 unused static variables instead to generate a warning.
106 - Do not include <avr/io.h> when compiling with IAR.
107 - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each
108 USB descriptor should be handled. It is now possible to provide descriptor
109 data in Flash, RAM or dynamically at runtime.
110 - STALL is now a status in usbTxLen* instead of a message. We can now conform
111 to the spec and leave the stall status pending until it is cleared.
112 - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the
113 application code to reset data toggling on interrupt pipes.
114
115* Release 2006-07-18
116
117 - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes
118 an assembler error.
119 - usbDeviceDisconnect() takes pull-up resistor to high impedance now.
120
121* Release 2007-02-01
122
123 - Merged in some code size improvements from usbtiny (thanks to Dick
124 Streefland for these optimizations!)
125 - Special alignment requirement for usbRxBuf not required any more. Thanks
126 again to Dick Streefland for this hint!
127 - Reverted to "#warning" instead of unused static variables -- new versions
128 of IAR CC should handle this directive.
129 - Changed Open Source license to GNU GPL v2 in order to make linking against
130 other free libraries easier. We no longer require publication of the
131 circuit diagrams, but we STRONGLY encourage it. If you improve the driver
132 itself, PLEASE grant us a royalty free license to your changes for our
133 commercial license.
134
135* Release 2007-03-29
136
137 - New configuration option "USB_PUBLIC" in usbconfig.h.
138 - Set USB version number to 1.10 instead of 1.01.
139 - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and
140 USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences
141 to USB_CFG_DESCR_PROPS_STRING_PRODUCT.
142 - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver
143 code.
144 - New assembler module for 16 MHz crystal.
145 - usbdrvasm.S contains common code only, clock-specific parts have been moved
146 to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively.
147
148* Release 2007-06-25
149
150 - 16 MHz module: Do SE0 check in stuffed bits as well.
151
152* Release 2007-07-07
153
154 - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary
155 for negative values.
156 - Added 15 MHz module contributed by V. Bosch.
157 - Interrupt vector name can now be configured. This is useful if somebody
158 wants to use a different hardware interrupt than INT0.
159
160* Release 2007-08-07
161
162 - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is
163 not exceeded.
164 - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN,
165 USB_COUNT_SOF
166 - USB_INTR_PENDING can now be a memory address, not just I/O
167
168* Release 2007-09-19
169
170 - Split out common parts of assembler modules into separate include file
171 - Made endpoint numbers configurable so that given interface definitions
172 can be matched. See USB_CFG_EP3_NUMBER in usbconfig-prototype.h.
173 - Store endpoint number for interrupt/bulk-out so that usbFunctionWriteOut()
174 can handle any number of endpoints.
175 - Define usbDeviceConnect() and usbDeviceDisconnect() even if no
176 USB_CFG_PULLUP_IOPORTNAME is defined. Directly set D+ and D- to 0 in this
177 case.
178
179* Release 2007-12-01
180
181 - Optimize usbDeviceConnect() and usbDeviceDisconnect() for less code size
182 when USB_CFG_PULLUP_IOPORTNAME is not defined.
183
184* Release 2007-12-13
185
186 - Renamed all include-only assembler modules from *.S to *.inc so that
187 people don't add them to their project sources.
188 - Distribute leap bits in tx loop more evenly for 16 MHz module.
189 - Use "macro" and "endm" instead of ".macro" and ".endm" for IAR
190 - Avoid compiler warnings for constant expr range by casting some values in
191 USB descriptors.
192
193* Release 2008-01-21
194
195 - Fixed bug in 15 and 16 MHz module where the new address set with
196 SET_ADDRESS was already accepted at the next NAK or ACK we send, not at
197 the next data packet we send. This caused problems when the host polled
198 too fast. Thanks to Alexander Neumann for his help and patience debugging
199 this issue!
200
201* Release 2008-02-05
202
203 - Fixed bug in 16.5 MHz module where a register was used in the interrupt
204 handler before it was pushed. This bug was introduced with version
205 2007-09-19 when common parts were moved to a separate file.
206 - Optimized CRC routine (thanks to Reimar Doeffinger).
207
208* Release 2008-02-16
209
210 - Removed outdated IAR compatibility stuff (code sections).
211 - Added hook macros for USB_RESET_HOOK() and USB_SET_ADDRESS_HOOK().
212 - Added optional routine usbMeasureFrameLength() for calibration of the
213 internal RC oscillator.
214
215* Release 2008-02-28
216
217 - USB_INITIAL_DATATOKEN defaults to USBPID_DATA1 now, which means that we
218 start with sending USBPID_DATA0.
219 - Changed defaults in usbconfig-prototype.h
220 - Added free USB VID/PID pair for MIDI class devices
221 - Restructured AVR-USB as separate package, not part of PowerSwitch any more.
222
223* Release 2008-04-18
224
225 - Restructured usbdrv.c so that it is easier to read and understand.
226 - Better code optimization with gcc 4.
227 - If a second interrupt in endpoint is enabled, also add it to config
228 descriptor.
229 - Added config option for long transfers (above 254 bytes), see
230 USB_CFG_LONG_TRANSFERS in usbconfig.h.
231 - Added 20 MHz module contributed by Jeroen Benschop.
232
233* Release 2008-05-13
234
235 - Fixed bug in libs-host/hiddata.c function usbhidGetReport(): length
236 was not incremented, pointer to length was incremented instead.
237 - Added code to command line tool(s) which claims an interface. This code
238 is disabled by default, but may be necessary on newer Linux kernels.
239 - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING".
240 - New header "usbportability.h" prepares ports to other development
241 environments.
242 - Long transfers (above 254 bytes) did not work when usbFunctionRead() was
243 used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!]
244 - In hiddata.c (example code for sending/receiving data over HID), use
245 USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so
246 that we need not claim the interface.
247 - in usbPoll() loop 20 times polling for RESET state instead of 10 times.
248 This accounts for the higher clock rates we now support.
249 - Added a module for 12.8 MHz RC oscillator with PLL in receiver loop.
250 - Added hook to SOF code so that oscillator can be tuned to USB frame clock.
251 - Added timeout to waitForJ loop. Helps preventing unexpected hangs.
252 - Added example code for oscillator tuning to libs-device (thanks to
253 Henrik Haftmann for the idea to this routine).
254 - Implemented option USB_CFG_SUPPRESS_INTR_CODE.
255
256* Release 2008-10-22
257
258 - Fixed libs-device/osctune.h: OSCCAL is memory address on ATMega88 and
259 similar, not offset of 0x20 needs to be added.
260 - Allow distribution under GPLv3 for those who have to link against other
261 code distributed under GPLv3.
262
263* Release 2008-11-26
264
265 - Removed libusb-win32 dependency for hid-data example in Makefile.windows.
266 It was never required and confused many people.
267 - Added extern uchar usbRxToken to usbdrv.h.
268 - Integrated a module with CRC checks at 18 MHz by Lukas Schrittwieser.
269
270* Release 2009-03-23
271
272 - Hid-mouse example used settings from hid-data example, fixed that.
273 - Renamed project to V-USB due to a trademark issue with Atmel(r).
274 - Changed CommercialLicense.txt and USBID-License.txt to make the
275 background of USB ID registration clearer.
276
277* Release 2009-04-15
278
279 - Changed CommercialLicense.txt to reflect the new range of PIDs from
280 Jason Kotzin.
281 - Removed USBID-License.txt in favor of USB-IDs-for-free.txt and
282 USB-ID-FAQ.txt
283 - Fixed a bug in the 12.8 MHz module: End Of Packet decection was made in
284 the center between bit 0 and 1 of each byte. This is where the data lines
285 are expected to change and the sampled data may therefore be nonsense.
286 We therefore check EOP ONLY if bits 0 AND 1 have both been read as 0 on D-.
287 - Fixed a bitstuffing problem in the 16 MHz module: If bit 6 was stuffed,
288 the unstuffing code in the receiver routine was 1 cycle too long. If
289 multiple bytes had the unstuffing in bit 6, the error summed up until the
290 receiver was out of sync.
291 - Included option for faster CRC routine.
292 Thanks to Slawomir Fras (BoskiDialer) for this code!
293 - Updated bits in Configuration Descriptor's bmAttributes according to
294 USB 1.1 (in particular bit 7, it is a must-be-set bit now).
295
296* Release 2009-08-22
297
298 - Moved first DBG1() after odDebugInit() in all examples.
299 - Use vector INT0_vect instead of SIG_INTERRUPT0 if defined. This makes
300 V-USB compatible with the new "p" suffix devices (e.g. ATMega328p).
301 - USB_CFG_CLOCK_KHZ setting is now required in usbconfig.h (no default any
302 more).
303 - New option USB_CFG_DRIVER_FLASH_PAGE allows boot loaders on devices with
304 more than 64 kB flash.
305 - Built-in configuration descriptor allows custom definition for second
306 endpoint now.
307
308* Release 2010-07-15
diff --git a/tmk_core/protocol/vusb/usbdrv/CommercialLicense.txt b/tmk_core/protocol/vusb/usbdrv/CommercialLicense.txt
deleted file mode 100644
index 11d07d9df0..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/CommercialLicense.txt
+++ /dev/null
@@ -1,166 +0,0 @@
1V-USB Driver Software License Agreement
2Version 2009-08-03
3
4THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN
5ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING
6THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT.
7
8
91 DEFINITIONS
10
111.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH,
12Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA.
13
141.2 "You" shall mean the Licensee.
15
161.3 "V-USB" shall mean all files included in the package distributed under
17the name "vusb" by OBJECTIVE DEVELOPMENT (http://www.obdev.at/vusb/)
18unless otherwise noted. This includes the firmware-only USB device
19implementation for Atmel AVR microcontrollers, some simple device examples
20and host side software examples and libraries.
21
22
232 LICENSE GRANTS
24
252.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source
26code of V-USB.
27
282.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the
29non-exclusive right to use, copy and distribute V-USB with your hardware
30product(s), restricted by the limitations in section 3 below.
31
322.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify
33the source code and your copy of V-USB according to your needs.
34
352.4 USB IDs. OBJECTIVE DEVELOPMENT furnishes you with one or two USB
36Product ID(s), sent to you in e-mail. These Product IDs are reserved
37exclusively for you. OBJECTIVE DEVELOPMENT has obtained USB Product ID
38ranges under the Vendor ID 5824 from Wouter van Ooijen (Van Ooijen
39Technische Informatica, www.voti.nl) and under the Vendor ID 8352 from
40Jason Kotzin (Clay Logic, www.claylogic.com). Both owners of the Vendor IDs
41have obtained these IDs from the USB Implementers Forum, Inc.
42(www.usb.org). OBJECTIVE DEVELOPMENT disclaims all liability which might
43arise from the assignment of USB IDs.
44
452.5 USB Certification. Although not part of this agreement, we want to make
46it clear that you cannot become USB certified when you use V-USB or a USB
47Product ID assigned by OBJECTIVE DEVELOPMENT. AVR microcontrollers don't
48meet the electrical specifications required by the USB specification and
49the USB Implementers Forum certifies only members who bought a Vendor ID of
50their own.
51
52
533 LICENSE RESTRICTIONS
54
553.1 Number of Units. Only one of the following three definitions is
56applicable. Which one is determined by the amount you pay to OBJECTIVE
57DEVELOPMENT, see section 4 ("Payment") below.
58
59Hobby License: You may use V-USB according to section 2 above in no more
60than 5 hardware units. These units must not be sold for profit.
61
62Entry Level License: You may use V-USB according to section 2 above in no
63more than 150 hardware units.
64
65Professional License: You may use V-USB according to section 2 above in
66any number of hardware units, except for large scale production ("unlimited
67fair use"). Quantities below 10,000 units are not considered large scale
68production. If your reach quantities which are obviously large scale
69production, you must pay a license fee of 0.10 EUR per unit for all units
70above 10,000.
71
723.2 Rental. You may not rent, lease, or lend V-USB or otherwise encumber
73any copy of V-USB, or any of the rights granted herein.
74
753.3 Transfer. You may not transfer your rights under this Agreement to
76another party without OBJECTIVE DEVELOPMENT's prior written consent. If
77such consent is obtained, you may permanently transfer this License to
78another party. The recipient of such transfer must agree to all terms and
79conditions of this Agreement.
80
813.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not
82expressly granted.
83
843.5 Non-Exclusive Rights. Your license rights under this Agreement are
85non-exclusive.
86
873.6 Third Party Rights. This Agreement cannot grant you rights controlled
88by third parties. In particular, you are not allowed to use the USB logo or
89other trademarks owned by the USB Implementers Forum, Inc. without their
90consent. Since such consent depends on USB certification, it should be
91noted that V-USB will not pass certification because it does not
92implement checksum verification and the microcontroller ports do not meet
93the electrical specifications.
94
95
964 PAYMENT
97
98The payment amount depends on the variation of this agreement (according to
99section 3.1) into which you want to enter. Concrete prices are listed on
100OBJECTIVE DEVELOPMENT's web site, usually at
101http://www.obdev.at/vusb/license.html. You agree to pay the amount listed
102there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor
103or reseller.
104
105
1065 COPYRIGHT AND OWNERSHIP
107
108V-USB is protected by copyright laws and international copyright
109treaties, as well as other intellectual property laws and treaties. V-USB
110is licensed, not sold.
111
112
1136 TERM AND TERMINATION
114
1156.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE
116DEVELOPMENT may terminate this Agreement and revoke the granted license and
117USB-IDs if you fail to comply with any of its terms and conditions.
118
1196.2 Survival of Terms. All provisions regarding secrecy, confidentiality
120and limitation of liability shall survive termination of this agreement.
121
122
1237 DISCLAIMER OF WARRANTY AND LIABILITY
124
125LIMITED WARRANTY. V-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
126KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE
127DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER
128EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
129OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
130NON-INFRINGEMENT, WITH REGARD TO V-USB, AND THE PROVISION OF OR FAILURE
131TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL
132RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO
133STATE/JURISDICTION.
134
135LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
136IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY
137SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER
138(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
139BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY
140LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE V-USB OR THE
141PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE
142DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY
143CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS
144AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR V-USB.
145
146
1478 MISCELLANEOUS TERMS
148
1498.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing
150purposes that you entered into this agreement.
151
1528.2 Entire Agreement. This document represents the entire agreement between
153OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by
154an authorized representative of both, OBJECTIVE DEVELOPMENT and you.
155
1568.3 Severability. In case a provision of these terms and conditions should
157be or become partly or entirely invalid, ineffective, or not executable,
158the validity of all other provisions shall not be affected.
159
1608.4 Applicable Law. This agreement is governed by the laws of the Republic
161of Austria.
162
1638.5 Responsible Courts. The responsible courts in Vienna/Austria will have
164exclusive jurisdiction regarding all disputes in connection with this
165agreement.
166
diff --git a/tmk_core/protocol/vusb/usbdrv/License.txt b/tmk_core/protocol/vusb/usbdrv/License.txt
deleted file mode 100644
index ce4c3aed45..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/License.txt
+++ /dev/null
@@ -1,361 +0,0 @@
1OBJECTIVE DEVELOPMENT GmbH's V-USB driver software is distributed under the
2terms and conditions of the GNU GPL version 2 or the GNU GPL version 3. It is
3your choice whether you apply the terms of version 2 or version 3. The full
4text of GPLv2 is included below. In addition to the requirements in the GPL,
5we STRONGLY ENCOURAGE you to do the following:
6
7(1) Publish your entire project on a web site and drop us a note with the URL.
8Use the form at http://www.obdev.at/vusb/feedback.html for your submission.
9
10(2) Adhere to minimum publication standards. Please include AT LEAST:
11 - a circuit diagram in PDF, PNG or GIF format
12 - full source code for the host software
13 - a readme.txt file in ASCII format which describes the purpose of the
14 project and what can be found in which directories and which files
15 - a reference to http://www.obdev.at/vusb/
16
17(3) If you improve the driver firmware itself, please give us a free license
18to your modifications for our commercial license offerings.
19
20
21
22 GNU GENERAL PUBLIC LICENSE
23 Version 2, June 1991
24
25 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
26 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 Everyone is permitted to copy and distribute verbatim copies
28 of this license document, but changing it is not allowed.
29
30 Preamble
31
32 The licenses for most software are designed to take away your
33freedom to share and change it. By contrast, the GNU General Public
34License is intended to guarantee your freedom to share and change free
35software--to make sure the software is free for all its users. This
36General Public License applies to most of the Free Software
37Foundation's software and to any other program whose authors commit to
38using it. (Some other Free Software Foundation software is covered by
39the GNU Library General Public License instead.) You can apply it to
40your programs, too.
41
42 When we speak of free software, we are referring to freedom, not
43price. Our General Public Licenses are designed to make sure that you
44have the freedom to distribute copies of free software (and charge for
45this service if you wish), that you receive source code or can get it
46if you want it, that you can change the software or use pieces of it
47in new free programs; and that you know you can do these things.
48
49 To protect your rights, we need to make restrictions that forbid
50anyone to deny you these rights or to ask you to surrender the rights.
51These restrictions translate to certain responsibilities for you if you
52distribute copies of the software, or if you modify it.
53
54 For example, if you distribute copies of such a program, whether
55gratis or for a fee, you must give the recipients all the rights that
56you have. You must make sure that they, too, receive or can get the
57source code. And you must show them these terms so they know their
58rights.
59
60 We protect your rights with two steps: (1) copyright the software, and
61(2) offer you this license which gives you legal permission to copy,
62distribute and/or modify the software.
63
64 Also, for each author's protection and ours, we want to make certain
65that everyone understands that there is no warranty for this free
66software. If the software is modified by someone else and passed on, we
67want its recipients to know that what they have is not the original, so
68that any problems introduced by others will not reflect on the original
69authors' reputations.
70
71 Finally, any free program is threatened constantly by software
72patents. We wish to avoid the danger that redistributors of a free
73program will individually obtain patent licenses, in effect making the
74program proprietary. To prevent this, we have made it clear that any
75patent must be licensed for everyone's free use or not licensed at all.
76
77 The precise terms and conditions for copying, distribution and
78modification follow.
79
80 GNU GENERAL PUBLIC LICENSE
81 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
82
83 0. This License applies to any program or other work which contains
84a notice placed by the copyright holder saying it may be distributed
85under the terms of this General Public License. The "Program", below,
86refers to any such program or work, and a "work based on the Program"
87means either the Program or any derivative work under copyright law:
88that is to say, a work containing the Program or a portion of it,
89either verbatim or with modifications and/or translated into another
90language. (Hereinafter, translation is included without limitation in
91the term "modification".) Each licensee is addressed as "you".
92
93Activities other than copying, distribution and modification are not
94covered by this License; they are outside its scope. The act of
95running the Program is not restricted, and the output from the Program
96is covered only if its contents constitute a work based on the
97Program (independent of having been made by running the Program).
98Whether that is true depends on what the Program does.
99
100 1. You may copy and distribute verbatim copies of the Program's
101source code as you receive it, in any medium, provided that you
102conspicuously and appropriately publish on each copy an appropriate
103copyright notice and disclaimer of warranty; keep intact all the
104notices that refer to this License and to the absence of any warranty;
105and give any other recipients of the Program a copy of this License
106along with the Program.
107
108You may charge a fee for the physical act of transferring a copy, and
109you may at your option offer warranty protection in exchange for a fee.
110
111 2. You may modify your copy or copies of the Program or any portion
112of it, thus forming a work based on the Program, and copy and
113distribute such modifications or work under the terms of Section 1
114above, provided that you also meet all of these conditions:
115
116 a) You must cause the modified files to carry prominent notices
117 stating that you changed the files and the date of any change.
118
119 b) You must cause any work that you distribute or publish, that in
120 whole or in part contains or is derived from the Program or any
121 part thereof, to be licensed as a whole at no charge to all third
122 parties under the terms of this License.
123
124 c) If the modified program normally reads commands interactively
125 when run, you must cause it, when started running for such
126 interactive use in the most ordinary way, to print or display an
127 announcement including an appropriate copyright notice and a
128 notice that there is no warranty (or else, saying that you provide
129 a warranty) and that users may redistribute the program under
130 these conditions, and telling the user how to view a copy of this
131 License. (Exception: if the Program itself is interactive but
132 does not normally print such an announcement, your work based on
133 the Program is not required to print an announcement.)
134
135These requirements apply to the modified work as a whole. If
136identifiable sections of that work are not derived from the Program,
137and can be reasonably considered independent and separate works in
138themselves, then this License, and its terms, do not apply to those
139sections when you distribute them as separate works. But when you
140distribute the same sections as part of a whole which is a work based
141on the Program, the distribution of the whole must be on the terms of
142this License, whose permissions for other licensees extend to the
143entire whole, and thus to each and every part regardless of who wrote it.
144
145Thus, it is not the intent of this section to claim rights or contest
146your rights to work written entirely by you; rather, the intent is to
147exercise the right to control the distribution of derivative or
148collective works based on the Program.
149
150In addition, mere aggregation of another work not based on the Program
151with the Program (or with a work based on the Program) on a volume of
152a storage or distribution medium does not bring the other work under
153the scope of this License.
154
155 3. You may copy and distribute the Program (or a work based on it,
156under Section 2) in object code or executable form under the terms of
157Sections 1 and 2 above provided that you also do one of the following:
158
159 a) Accompany it with the complete corresponding machine-readable
160 source code, which must be distributed under the terms of Sections
161 1 and 2 above on a medium customarily used for software interchange; or,
162
163 b) Accompany it with a written offer, valid for at least three
164 years, to give any third party, for a charge no more than your
165 cost of physically performing source distribution, a complete
166 machine-readable copy of the corresponding source code, to be
167 distributed under the terms of Sections 1 and 2 above on a medium
168 customarily used for software interchange; or,
169
170 c) Accompany it with the information you received as to the offer
171 to distribute corresponding source code. (This alternative is
172 allowed only for noncommercial distribution and only if you
173 received the program in object code or executable form with such
174 an offer, in accord with Subsection b above.)
175
176The source code for a work means the preferred form of the work for
177making modifications to it. For an executable work, complete source
178code means all the source code for all modules it contains, plus any
179associated interface definition files, plus the scripts used to
180control compilation and installation of the executable. However, as a
181special exception, the source code distributed need not include
182anything that is normally distributed (in either source or binary
183form) with the major components (compiler, kernel, and so on) of the
184operating system on which the executable runs, unless that component
185itself accompanies the executable.
186
187If distribution of executable or object code is made by offering
188access to copy from a designated place, then offering equivalent
189access to copy the source code from the same place counts as
190distribution of the source code, even though third parties are not
191compelled to copy the source along with the object code.
192
193 4. You may not copy, modify, sublicense, or distribute the Program
194except as expressly provided under this License. Any attempt
195otherwise to copy, modify, sublicense or distribute the Program is
196void, and will automatically terminate your rights under this License.
197However, parties who have received copies, or rights, from you under
198this License will not have their licenses terminated so long as such
199parties remain in full compliance.
200
201 5. You are not required to accept this License, since you have not
202signed it. However, nothing else grants you permission to modify or
203distribute the Program or its derivative works. These actions are
204prohibited by law if you do not accept this License. Therefore, by
205modifying or distributing the Program (or any work based on the
206Program), you indicate your acceptance of this License to do so, and
207all its terms and conditions for copying, distributing or modifying
208the Program or works based on it.
209
210 6. Each time you redistribute the Program (or any work based on the
211Program), the recipient automatically receives a license from the
212original licensor to copy, distribute or modify the Program subject to
213these terms and conditions. You may not impose any further
214restrictions on the recipients' exercise of the rights granted herein.
215You are not responsible for enforcing compliance by third parties to
216this License.
217
218 7. If, as a consequence of a court judgment or allegation of patent
219infringement or for any other reason (not limited to patent issues),
220conditions are imposed on you (whether by court order, agreement or
221otherwise) that contradict the conditions of this License, they do not
222excuse you from the conditions of this License. If you cannot
223distribute so as to satisfy simultaneously your obligations under this
224License and any other pertinent obligations, then as a consequence you
225may not distribute the Program at all. For example, if a patent
226license would not permit royalty-free redistribution of the Program by
227all those who receive copies directly or indirectly through you, then
228the only way you could satisfy both it and this License would be to
229refrain entirely from distribution of the Program.
230
231If any portion of this section is held invalid or unenforceable under
232any particular circumstance, the balance of the section is intended to
233apply and the section as a whole is intended to apply in other
234circumstances.
235
236It is not the purpose of this section to induce you to infringe any
237patents or other property right claims or to contest validity of any
238such claims; this section has the sole purpose of protecting the
239integrity of the free software distribution system, which is
240implemented by public license practices. Many people have made
241generous contributions to the wide range of software distributed
242through that system in reliance on consistent application of that
243system; it is up to the author/donor to decide if he or she is willing
244to distribute software through any other system and a licensee cannot
245impose that choice.
246
247This section is intended to make thoroughly clear what is believed to
248be a consequence of the rest of this License.
249
250 8. If the distribution and/or use of the Program is restricted in
251certain countries either by patents or by copyrighted interfaces, the
252original copyright holder who places the Program under this License
253may add an explicit geographical distribution limitation excluding
254those countries, so that distribution is permitted only in or among
255countries not thus excluded. In such case, this License incorporates
256the limitation as if written in the body of this License.
257
258 9. The Free Software Foundation may publish revised and/or new versions
259of the General Public License from time to time. Such new versions will
260be similar in spirit to the present version, but may differ in detail to
261address new problems or concerns.
262
263Each version is given a distinguishing version number. If the Program
264specifies a version number of this License which applies to it and "any
265later version", you have the option of following the terms and conditions
266either of that version or of any later version published by the Free
267Software Foundation. If the Program does not specify a version number of
268this License, you may choose any version ever published by the Free Software
269Foundation.
270
271 10. If you wish to incorporate parts of the Program into other free
272programs whose distribution conditions are different, write to the author
273to ask for permission. For software which is copyrighted by the Free
274Software Foundation, write to the Free Software Foundation; we sometimes
275make exceptions for this. Our decision will be guided by the two goals
276of preserving the free status of all derivatives of our free software and
277of promoting the sharing and reuse of software generally.
278
279 NO WARRANTY
280
281 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
282FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
283OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
284PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
285OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
286MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
287TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
288PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
289REPAIR OR CORRECTION.
290
291 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
292WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
293REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
294INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
295OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
296TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
297YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
298PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
299POSSIBILITY OF SUCH DAMAGES.
300
301 END OF TERMS AND CONDITIONS
302
303 How to Apply These Terms to Your New Programs
304
305 If you develop a new program, and you want it to be of the greatest
306possible use to the public, the best way to achieve this is to make it
307free software which everyone can redistribute and change under these terms.
308
309 To do so, attach the following notices to the program. It is safest
310to attach them to the start of each source file to most effectively
311convey the exclusion of warranty; and each file should have at least
312the "copyright" line and a pointer to where the full notice is found.
313
314 <one line to give the program's name and a brief idea of what it does.>
315 Copyright (C) <year> <name of author>
316
317 This program is free software; you can redistribute it and/or modify
318 it under the terms of the GNU General Public License as published by
319 the Free Software Foundation; either version 2 of the License, or
320 (at your option) any later version.
321
322 This program is distributed in the hope that it will be useful,
323 but WITHOUT ANY WARRANTY; without even the implied warranty of
324 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
325 GNU General Public License for more details.
326
327 You should have received a copy of the GNU General Public License
328 along with this program; if not, write to the Free Software
329 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
330
331
332Also add information on how to contact you by electronic and paper mail.
333
334If the program is interactive, make it output a short notice like this
335when it starts in an interactive mode:
336
337 Gnomovision version 69, Copyright (C) year name of author
338 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
339 This is free software, and you are welcome to redistribute it
340 under certain conditions; type `show c' for details.
341
342The hypothetical commands `show w' and `show c' should show the appropriate
343parts of the General Public License. Of course, the commands you use may
344be called something other than `show w' and `show c'; they could even be
345mouse-clicks or menu items--whatever suits your program.
346
347You should also get your employer (if you work as a programmer) or your
348school, if any, to sign a "copyright disclaimer" for the program, if
349necessary. Here is a sample; alter the names:
350
351 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
352 `Gnomovision' (which makes passes at compilers) written by James Hacker.
353
354 <signature of Ty Coon>, 1 April 1989
355 Ty Coon, President of Vice
356
357This General Public License does not permit incorporating your program into
358proprietary programs. If your program is a subroutine library, you may
359consider it more useful to permit linking proprietary applications with the
360library. If this is what you want to do, use the GNU Library General
361Public License instead of this License.
diff --git a/tmk_core/protocol/vusb/usbdrv/Readme.txt b/tmk_core/protocol/vusb/usbdrv/Readme.txt
deleted file mode 100644
index 3cff49f6fa..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/Readme.txt
+++ /dev/null
@@ -1,172 +0,0 @@
1This is the readme file to Objective Development's firmware-only USB driver
2for Atmel AVR microcontrollers. For more information please visit
3http://www.obdev.at/vusb/
4
5This directory contains the USB firmware only. Copy it as-is to your own
6project and add all .c and .S files to your project (these files are marked
7with an asterisk in the list below). Then copy usbconfig-prototype.h as
8usbconfig.h to your project and edit it according to your configuration.
9
10
11TECHNICAL DOCUMENTATION
12=======================
13The technical documentation (API) for the firmware driver is contained in the
14file "usbdrv.h". Please read all of it carefully! Configuration options are
15documented in "usbconfig-prototype.h".
16
17The driver consists of the following files:
18 readme.txt ............. The file you are currently reading.
19 Changelog.txt .......... Release notes for all versions of the driver.
20 usbdrv.h ............... Driver interface definitions and technical docs.
21* usbdrv.c ............... High level language part of the driver. Link this
22 module to your code!
23* usbdrvasm.S ............ Assembler part of the driver. This module is mostly
24 a stub and includes one of the usbdrvasm*.S files
25 depending on processor clock. Link this module to
26 your code!
27 usbdrvasm*.inc ......... Assembler routines for particular clock frequencies.
28 Included by usbdrvasm.S, don't link it directly!
29 asmcommon.inc .......... Common assembler routines. Included by
30 usbdrvasm*.inc, don't link it directly!
31 usbconfig-prototype.h .. Prototype for your own usbdrv.h file.
32* oddebug.c .............. Debug functions. Only used when DEBUG_LEVEL is
33 defined to a value greater than 0. Link this module
34 to your code!
35 oddebug.h .............. Interface definitions of the debug module.
36 usbportability.h ....... Header with compiler-dependent stuff.
37 usbdrvasm.asm .......... Compatibility stub for IAR-C-compiler. Use this
38 module instead of usbdrvasm.S when you assembler
39 with IAR's tools.
40 License.txt ............ Open Source license for this driver.
41 CommercialLicense.txt .. Optional commercial license for this driver.
42 USB-ID-FAQ.txt ......... General infos about USB Product- and Vendor-IDs.
43 USB-IDs-for-free.txt ... List and terms of use for free shared PIDs.
44
45(*) ... These files should be linked to your project.
46
47
48CPU CORE CLOCK FREQUENCY
49========================
50We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz,
5116 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The
52actual clock rate must be configured in usbconfig.h.
53
5412 MHz Clock
55This is the traditional clock rate of V-USB because it's the lowest clock
56rate where the timing constraints of the USB spec can be met.
57
5815 MHz Clock
59Similar to 12 MHz, but some NOPs inserted. On the other hand, the higher clock
60rate allows for some loops which make the resulting code size somewhat smaller
61than the 12 MHz version.
62
6316 MHz Clock
64This clock rate has been added for users of the Arduino board and other
65ready-made boards which come with a fixed 16 MHz crystal. It's also an option
66if you need the slightly higher clock rate for performance reasons. Since
6716 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code
68is somewhat tricky and has to insert a leap cycle every third byte.
69
7012.8 MHz and 16.5 MHz Clock
71The assembler modules for these clock rates differ from the other modules
72because they have been built for an RC oscillator with only 1% precision. The
73receiver code inserts leap cycles to compensate for clock deviations. 1% is
74also the precision which can be achieved by calibrating the internal RC
75oscillator of the AVR. Please note that only AVRs with internal 64 MHz PLL
76oscillator can reach 16.5 MHz with the RC oscillator. This includes the very
77popular ATTiny25, ATTiny45, ATTiny85 series as well as the ATTiny26. Almost
78all AVRs can reach 12.8 MHz, although this is outside the specified range.
79
80See the EasyLogger example at http://www.obdev.at/vusb/easylogger.html for
81code which calibrates the RC oscillator based on the USB frame clock.
82
8318 MHz Clock
84This module is closer to the USB specification because it performs an on the
85fly CRC check for incoming packets. Packets with invalid checksum are
86discarded as required by the spec. If you also implement checks for data
87PID toggling on application level (see option USB_CFG_CHECK_DATA_TOGGLING
88in usbconfig.h for more info), this ensures data integrity. Due to the CRC
89tables and alignment requirements, this code is bigger than modules for other
90clock rates. To activate this module, you must define USB_CFG_CHECK_CRC to 1
91and USB_CFG_CLOCK_KHZ to 18000 in usbconfig.h.
92
9320 MHz Clock
94This module is for people who won't do it with less than the maximum. Since
9520 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code
96uses similar tricks as the 16 MHz module to insert leap cycles.
97
98
99USB IDENTIFIERS
100===============
101Every USB device needs a vendor- and a product-identifier (VID and PID). VIDs
102are obtained from usb.org for a price of 1,500 USD. Once you have a VID, you
103can assign PIDs at will.
104
105Since an entry level cost of 1,500 USD is too high for most small companies
106and hobbyists, we provide some VID/PID pairs for free. See the file
107USB-IDs-for-free.txt for details.
108
109Objective Development also has some license offerings which include product
110IDs. See http://www.obdev.at/vusb/ for details.
111
112
113DEVELOPMENT SYSTEM
114==================
115This driver has been developed and optimized for the GNU compiler version 3
116and 4. We recommend that you use the GNU compiler suite because it is freely
117available. V-USB has also been ported to the IAR compiler and assembler. It
118has been tested with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the
119"small" and "tiny" memory model. Not every release is tested with IAR CC and
120the driver may therefore fail to compile with IAR. Please note that gcc is
121more efficient for usbdrv.c because this module has been deliberately
122optimized for gcc.
123
124Gcc version 3 produces smaller code than version 4 due to new optimizing
125capabilities which don't always improve things on 8 bit CPUs. The code size
126generated by gcc 4 can be reduced with the compiler options
127-fno-move-loop-invariants, -fno-tree-scev-cprop and
128-fno-inline-small-functions in addition to -Os. On devices with more than
1298k of flash memory, we also recommend the linker option --relax (written as
130-Wl,--relax for gcc) to convert absolute calls into relative where possible.
131
132For more information about optimizing options see:
133
134 http://www.tty1.net/blog/2008-04-29-avr-gcc-optimisations_en.html
135
136These optimizations are good for gcc 4.x. Version 3.x of gcc does not support
137most of these options and produces good code anyway.
138
139
140USING V-USB FOR FREE
141====================
142The AVR firmware driver is published under the GNU General Public License
143Version 2 (GPL2) and the GNU General Public License Version 3 (GPL3). It is
144your choice whether you apply the terms of version 2 or version 3.
145
146If you decide for the free GPL2 or GPL3, we STRONGLY ENCOURAGE you to do the
147following things IN ADDITION to the obligations from the GPL:
148
149(1) Publish your entire project on a web site and drop us a note with the URL.
150Use the form at http://www.obdev.at/vusb/feedback.html for your submission.
151If you don't have a web site, you can publish the project in obdev's
152documentation wiki at
153http://www.obdev.at/goto.php?t=vusb-wiki&p=hosted-projects.
154
155(2) Adhere to minimum publication standards. Please include AT LEAST:
156 - a circuit diagram in PDF, PNG or GIF format
157 - full source code for the host software
158 - a readme.txt file in ASCII format which describes the purpose of the
159 project and what can be found in which directories and which files
160 - a reference to http://www.obdev.at/vusb/
161
162(3) If you improve the driver firmware itself, please give us a free license
163to your modifications for our commercial license offerings.
164
165
166COMMERCIAL LICENSES FOR V-USB
167=============================
168If you don't want to publish your source code under the terms of the GPL,
169you can simply pay money for V-USB. As an additional benefit you get
170USB PIDs for free, reserved exclusively to you. See the file
171"CommercialLicense.txt" for details.
172
diff --git a/tmk_core/protocol/vusb/usbdrv/USB-ID-FAQ.txt b/tmk_core/protocol/vusb/usbdrv/USB-ID-FAQ.txt
deleted file mode 100644
index d1de8fb618..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/USB-ID-FAQ.txt
+++ /dev/null
@@ -1,149 +0,0 @@
1Version 2009-08-22
2
3==========================
4WHY DO WE NEED THESE IDs?
5==========================
6
7USB is more than a low level protocol for data transport. It also defines a
8common set of requests which must be understood by all devices. And as part
9of these common requests, the specification defines data structures, the
10USB Descriptors, which are used to describe the properties of the device.
11
12From the perspective of an operating system, it is therefore possible to find
13out basic properties of a device (such as e.g. the manufacturer and the name
14of the device) without a device-specific driver. This is essential because
15the operating system can choose a driver to load based on this information
16(Plug-And-Play).
17
18Among the most important properties in the Device Descriptor are the USB
19Vendor- and Product-ID. Both are 16 bit integers. The most simple form of
20driver matching is based on these IDs. The driver announces the Vendor- and
21Product-IDs of the devices it can handle and the operating system loads the
22appropriate driver when the device is connected.
23
24It is obvious that this technique only works if the pair Vendor- plus
25Product-ID is unique: Only devices which require the same driver can have the
26same pair of IDs.
27
28
29=====================================================
30HOW DOES THE USB STANDARD ENSURE THAT IDs ARE UNIQUE?
31=====================================================
32
33Since it is so important that USB IDs are unique, the USB Implementers Forum,
34Inc. (usb.org) needs a way to enforce this legally. It is not forbidden by
35law to build a device and assign it any random numbers as IDs. Usb.org
36therefore needs an agreement to regulate the use of USB IDs. The agreement
37binds only parties who agreed to it, of course. Everybody else is free to use
38any numbers for their IDs.
39
40So how can usb.org ensure that every manufacturer of USB devices enters into
41an agreement with them? They do it via trademark licensing. Usb.org has
42registered the trademark "USB", all associated logos and related terms. If
43you want to put an USB logo on your product or claim that it is USB
44compliant, you must license these trademarks from usb.org. And this is where
45you enter into an agreement. See the "USB-IF Trademark License Agreement and
46Usage Guidelines for the USB-IF Logo" at
47http://www.usb.org/developers/logo_license/.
48
49Licensing the USB trademarks requires that you buy a USB Vendor-ID from
50usb.org (one-time fee of ca. 2,000 USD), that you become a member of usb.org
51(yearly fee of ca. 4,000 USD) and that you meet all the technical
52specifications from the USB spec.
53
54This means that most hobbyists and small companies will never be able to
55become USB compliant, just because membership is so expensive. And you can't
56be compliant with a driver based on V-USB anyway, because the AVR's port pins
57don't meet the electrical specifications for USB. So, in principle, all
58hobbyists and small companies are free to choose any random numbers for their
59IDs. They have nothing to lose...
60
61There is one exception worth noting, though: If you use a sub-component which
62implements USB, the vendor of the sub-components may guarantee USB
63compliance. This might apply to some or all of FTDI's solutions.
64
65
66=======================================================================
67WHY SHOULD YOU OBTAIN USB IDs EVEN IF YOU DON'T LICENSE USB TRADEMARKS?
68=======================================================================
69
70You have learned in the previous section that you are free to choose any
71numbers for your IDs anyway. So why not do exactly this? There is still the
72technical issue. If you choose IDs which are already in use by somebody else,
73operating systems will load the wrong drivers and your device won't work.
74Even if you choose IDs which are not currently in use, they may be in use in
75the next version of the operating system or even after an automatic update.
76
77So what you need is a pair of Vendor- and Product-IDs for which you have the
78guarantee that no USB compliant product uses them. This implies that no
79operating system will ever ship with drivers responsible for these IDs.
80
81
82==============================================
83HOW DOES OBJECTIVE DEVELOPMENT HANDLE USB IDs?
84==============================================
85
86Objective Development gives away pairs of USB-IDs with their V-USB licenses.
87In order to ensure that these IDs are unique, Objective Development has an
88agreement with the company/person who has bought the USB Vendor-ID from
89usb.org. This agreement ensures that a range of USB Product-IDs is reserved
90for assignment by Objective Development and that the owner of the Vendor-ID
91won't give it to anybody else.
92
93This means that you have to trust three parties to ensure uniqueness of
94your IDs:
95
96 - Objective Development, that they don't give the same PID to more than
97 one person.
98 - The owner of the Vendor-ID that they don't assign PIDs from the range
99 assigned to Objective Development to anybody else.
100 - Usb.org that they don't assign the same Vendor-ID a second time.
101
102
103==================================
104WHO IS THE OWNER OF THE VENDOR-ID?
105==================================
106
107Objective Development has obtained ranges of USB Product-IDs under two
108Vendor-IDs: Under Vendor-ID 5824 from Wouter van Ooijen (Van Ooijen
109Technische Informatica, www.voti.nl) and under Vendor-ID 8352 from Jason
110Kotzin (Clay Logic, www.claylogic.com). Both VID owners have received their
111Vendor-ID directly from usb.org.
112
113
114=========================================================================
115CAN I USE USB-IDs FROM OBJECTIVE DEVELOPMENT WITH OTHER DRIVERS/HARDWARE?
116=========================================================================
117
118The short answer is: Yes. All you get is a guarantee that the IDs are never
119assigned to anybody else. What more do you need?
120
121
122============================
123WHAT ABOUT SHARED ID PAIRS?
124============================
125
126Objective Development has reserved some PID/VID pairs for shared use. You
127have no guarantee of uniqueness for them, except that no USB compliant device
128uses them. In order to avoid technical problems, we must ensure that all
129devices with the same pair of IDs use the same driver on kernel level. For
130details, see the file USB-IDs-for-free.txt.
131
132
133======================================================
134I HAVE HEARD THAT SUB-LICENSING OF USB-IDs IS ILLEGAL?
135======================================================
136
137A 16 bit integer number cannot be protected by copyright laws. It is not
138sufficiently complex. And since none of the parties involved entered into the
139USB-IF Trademark License Agreement, we are not bound by this agreement. So
140there is no reason why it should be illegal to sub-license USB-IDs.
141
142
143=============================================
144WHO IS LIABLE IF THERE ARE INCOMPATIBILITIES?
145=============================================
146
147Objective Development disclaims all liabilities which might arise from the
148assignment of IDs. If you guarantee product features to your customers
149without proper disclaimer, YOU are liable for that.
diff --git a/tmk_core/protocol/vusb/usbdrv/USB-IDs-for-free.txt b/tmk_core/protocol/vusb/usbdrv/USB-IDs-for-free.txt
deleted file mode 100644
index 2f4d59ad18..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/USB-IDs-for-free.txt
+++ /dev/null
@@ -1,148 +0,0 @@
1Version 2009-08-22
2
3===========================
4FREE USB-IDs FOR SHARED USE
5===========================
6
7Objective Development has reserved a set of USB Product-IDs for use according
8to the guidelines outlined below. For more information about the concept of
9USB IDs please see the file USB-ID-FAQ.txt. Objective Development guarantees
10that the IDs listed below are not used by any USB compliant devices.
11
12
13====================
14MECHANISM OF SHARING
15====================
16
17From a technical point of view, two different devices can share the same USB
18Vendor- and Product-ID if they require the same driver on operating system
19level. We make use of this fact by assigning separate IDs for various device
20classes. On application layer, devices must be distinguished by their textual
21name or serial number. We offer separate sets of IDs for discrimination by
22textual name and for serial number.
23
24Examples for shared use of USB IDs are included with V-USB in the "examples"
25subdirectory.
26
27
28======================================
29IDs FOR DISCRIMINATION BY TEXTUAL NAME
30======================================
31
32If you use one of the IDs listed below, your device and host-side software
33must conform to these rules:
34
35(1) The USB device MUST provide a textual representation of the manufacturer
36and product identification. The manufacturer identification MUST be available
37at least in USB language 0x0409 (English/US).
38
39(2) The textual manufacturer identification MUST contain either an Internet
40domain name (e.g. "mycompany.com") registered and owned by you, or an e-mail
41address under your control (e.g. "myname@gmx.net"). You can embed the domain
42name or e-mail address in any string you like, e.g. "Objective Development
43http://www.obdev.at/vusb/".
44
45(3) You are responsible for retaining ownership of the domain or e-mail
46address for as long as any of your products are in use.
47
48(4) You may choose any string for the textual product identification, as long
49as this string is unique within the scope of your textual manufacturer
50identification.
51
52(5) Application side device look-up MUST be based on the textual manufacturer
53and product identification in addition to VID/PID matching. The driver
54matching MUST be a comparison of the entire strings, NOT a sub-string match.
55
56(6) For devices which implement a particular USB device class (e.g. HID), the
57operating system's default class driver MUST be used. If an operating system
58driver for Vendor Class devices is needed, this driver must be libusb or
59libusb-win32 (see http://libusb.org/ and
60http://libusb-win32.sourceforge.net/).
61
62Table if IDs for discrimination by textual name:
63
64PID dec (hex) | VID dec (hex) | Description of use
65==============+===============+============================================
661500 (0x05dc) | 5824 (0x16c0) | For Vendor Class devices with libusb
67--------------+---------------+--------------------------------------------
681503 (0x05df) | 5824 (0x16c0) | For generic HID class devices (which are
69 | | NOT mice, keyboards or joysticks)
70--------------+---------------+--------------------------------------------
711505 (0x05e1) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
72--------------+---------------+--------------------------------------------
731508 (0x05e4) | 5824 (0x16c0) | For MIDI class devices
74--------------+---------------+--------------------------------------------
75
76Note that Windows caches the textual product- and vendor-description for
77mice, keyboards and joysticks. Name-bsed discrimination is therefore not
78recommended for these device classes.
79
80
81=======================================
82IDs FOR DISCRIMINATION BY SERIAL NUMBER
83=======================================
84
85If you use one of the IDs listed below, your device and host-side software
86must conform to these rules:
87
88(1) The USB device MUST provide a textual representation of the serial
89number. The serial number string MUST be available at least in USB language
900x0409 (English/US).
91
92(2) The serial number MUST start with either an Internet domain name (e.g.
93"mycompany.com") registered and owned by you, or an e-mail address under your
94control (e.g. "myname@gmx.net"), both terminated with a colon (":") character.
95You MAY append any string you like for further discrimination of your devices.
96
97(3) You are responsible for retaining ownership of the domain or e-mail
98address for as long as any of your products are in use.
99
100(5) Application side device look-up MUST be based on the serial number string
101in addition to VID/PID matching. The matching must start at the first
102character of the serial number string and include the colon character
103terminating your domain or e-mail address. It MAY stop anywhere after that.
104
105(6) For devices which implement a particular USB device class (e.g. HID), the
106operating system's default class driver MUST be used. If an operating system
107driver for Vendor Class devices is needed, this driver must be libusb or
108libusb-win32 (see http://libusb.org/ and
109http://libusb-win32.sourceforge.net/).
110
111Table if IDs for discrimination by serial number string:
112
113PID dec (hex) | VID dec (hex) | Description of use
114===============+===============+===========================================
11510200 (0x27d8) | 5824 (0x16c0) | For Vendor Class devices with libusb
116---------------+---------------+-------------------------------------------
11710201 (0x27d9) | 5824 (0x16c0) | For generic HID class devices (which are
118 | | NOT mice, keyboards or joysticks)
119---------------+---------------+-------------------------------------------
12010202 (0x27da) | 5824 (0x16c0) | For USB Mice
121---------------+---------------+-------------------------------------------
12210203 (0x27db) | 5824 (0x16c0) | For USB Keyboards
123---------------+---------------+-------------------------------------------
12410204 (0x27db) | 5824 (0x16c0) | For USB Joysticks
125---------------+---------------+-------------------------------------------
12610205 (0x27dc) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
127---------------+---------------+-------------------------------------------
12810206 (0x27dd) | 5824 (0x16c0) | For MIDI class devices
129---------------+---------------+-------------------------------------------
130
131
132=================
133ORIGIN OF USB-IDs
134=================
135
136OBJECTIVE DEVELOPMENT Software GmbH has obtained all VID/PID pairs listed
137here from Wouter van Ooijen (see www.voti.nl) for exclusive disposition.
138Wouter van Ooijen has obtained the VID from the USB Implementers Forum, Inc.
139(see www.usb.org). The VID is registered for the company name "Van Ooijen
140Technische Informatica".
141
142
143==========
144DISCLAIMER
145==========
146
147OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any
148problems which are caused by the shared use of these VID/PID pairs.
diff --git a/tmk_core/protocol/vusb/usbdrv/asmcommon.inc b/tmk_core/protocol/vusb/usbdrv/asmcommon.inc
deleted file mode 100644
index 07d692be3b..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/asmcommon.inc
+++ /dev/null
@@ -1,188 +0,0 @@
1/* Name: asmcommon.inc
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2007-11-05
5 * Tabsize: 4
6 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * Revision: $Id$
9 */
10
11/* Do not link this file! Link usbdrvasm.S instead, which includes the
12 * appropriate implementation!
13 */
14
15/*
16General Description:
17This file contains assembler code which is shared among the USB driver
18implementations for different CPU cocks. Since the code must be inserted
19in the middle of the module, it's split out into this file and #included.
20
21Jump destinations called from outside:
22 sofError: Called when no start sequence was found.
23 se0: Called when a package has been successfully received.
24 overflow: Called when receive buffer overflows.
25 doReturn: Called after sending data.
26
27Outside jump destinations used by this module:
28 waitForJ: Called to receive an already arriving packet.
29 sendAckAndReti:
30 sendNakAndReti:
31 sendCntAndReti:
32 usbSendAndReti:
33
34The following macros must be defined before this file is included:
35 .macro POP_STANDARD
36 .endm
37 .macro POP_RETI
38 .endm
39*/
40
41#define token x1
42
43overflow:
44 ldi x2, 1<<USB_INTR_PENDING_BIT
45 USB_STORE_PENDING(x2) ; clear any pending interrupts
46ignorePacket:
47 clr token
48 rjmp storeTokenAndReturn
49
50;----------------------------------------------------------------------------
51; Processing of received packet (numbers in brackets are cycles after center of SE0)
52;----------------------------------------------------------------------------
53;This is the only non-error exit point for the software receiver loop
54;we don't check any CRCs here because there is no time left.
55se0:
56 subi cnt, USB_BUFSIZE ;[5]
57 neg cnt ;[6]
58 sub YL, cnt ;[7]
59 sbci YH, 0 ;[8]
60 ldi x2, 1<<USB_INTR_PENDING_BIT ;[9]
61 USB_STORE_PENDING(x2) ;[10] clear pending intr and check flag later. SE0 should be over.
62 ld token, y ;[11]
63 cpi token, USBPID_DATA0 ;[13]
64 breq handleData ;[14]
65 cpi token, USBPID_DATA1 ;[15]
66 breq handleData ;[16]
67 lds shift, usbDeviceAddr;[17]
68 ldd x2, y+1 ;[19] ADDR and 1 bit endpoint number
69 lsl x2 ;[21] shift out 1 bit endpoint number
70 cpse x2, shift ;[22]
71 rjmp ignorePacket ;[23]
72/* only compute endpoint number in x3 if required later */
73#if USB_CFG_HAVE_INTRIN_ENDPOINT || USB_CFG_IMPLEMENT_FN_WRITEOUT
74 ldd x3, y+2 ;[24] endpoint number + crc
75 rol x3 ;[26] shift in LSB of endpoint
76#endif
77 cpi token, USBPID_IN ;[27]
78 breq handleIn ;[28]
79 cpi token, USBPID_SETUP ;[29]
80 breq handleSetupOrOut ;[30]
81 cpi token, USBPID_OUT ;[31]
82 brne ignorePacket ;[32] must be ack, nak or whatever
83; rjmp handleSetupOrOut ; fallthrough
84
85;Setup and Out are followed by a data packet two bit times (16 cycles) after
86;the end of SE0. The sync code allows up to 40 cycles delay from the start of
87;the sync pattern until the first bit is sampled. That's a total of 56 cycles.
88handleSetupOrOut: ;[32]
89#if USB_CFG_IMPLEMENT_FN_WRITEOUT /* if we have data for endpoint != 0, set usbCurrentTok to address */
90 andi x3, 0xf ;[32]
91 breq storeTokenAndReturn ;[33]
92 mov token, x3 ;[34] indicate that this is endpoint x OUT
93#endif
94storeTokenAndReturn:
95 sts usbCurrentTok, token;[35]
96doReturn:
97 POP_STANDARD ;[37] 12...16 cycles
98 USB_LOAD_PENDING(YL) ;[49]
99 sbrc YL, USB_INTR_PENDING_BIT;[50] check whether data is already arriving
100 rjmp waitForJ ;[51] save the pops and pushes -- a new interrupt is already pending
101sofError:
102 POP_RETI ;macro call
103 reti
104
105handleData:
106#if USB_CFG_CHECK_CRC
107 CRC_CLEANUP_AND_CHECK ; jumps to ignorePacket if CRC error
108#endif
109 lds shift, usbCurrentTok;[18]
110 tst shift ;[20]
111 breq doReturn ;[21]
112 lds x2, usbRxLen ;[22]
113 tst x2 ;[24]
114 brne sendNakAndReti ;[25]
115; 2006-03-11: The following two lines fix a problem where the device was not
116; recognized if usbPoll() was called less frequently than once every 4 ms.
117 cpi cnt, 4 ;[26] zero sized data packets are status phase only -- ignore and ack
118 brmi sendAckAndReti ;[27] keep rx buffer clean -- we must not NAK next SETUP
119#if USB_CFG_CHECK_DATA_TOGGLING
120 sts usbCurrentDataToken, token ; store for checking by C code
121#endif
122 sts usbRxLen, cnt ;[28] store received data, swap buffers
123 sts usbRxToken, shift ;[30]
124 lds x2, usbInputBufOffset;[32] swap buffers
125 ldi cnt, USB_BUFSIZE ;[34]
126 sub cnt, x2 ;[35]
127 sts usbInputBufOffset, cnt;[36] buffers now swapped
128 rjmp sendAckAndReti ;[38] 40 + 17 = 57 until SOP
129
130handleIn:
131;We don't send any data as long as the C code has not processed the current
132;input data and potentially updated the output data. That's more efficient
133;in terms of code size than clearing the tx buffers when a packet is received.
134 lds x1, usbRxLen ;[30]
135 cpi x1, 1 ;[32] negative values are flow control, 0 means "buffer free"
136 brge sendNakAndReti ;[33] unprocessed input packet?
137 ldi x1, USBPID_NAK ;[34] prepare value for usbTxLen
138#if USB_CFG_HAVE_INTRIN_ENDPOINT
139 andi x3, 0xf ;[35] x3 contains endpoint
140#if USB_CFG_SUPPRESS_INTR_CODE
141 brne sendNakAndReti ;[36]
142#else
143 brne handleIn1 ;[36]
144#endif
145#endif
146 lds cnt, usbTxLen ;[37]
147 sbrc cnt, 4 ;[39] all handshake tokens have bit 4 set
148 rjmp sendCntAndReti ;[40] 42 + 16 = 58 until SOP
149 sts usbTxLen, x1 ;[41] x1 == USBPID_NAK from above
150 ldi YL, lo8(usbTxBuf) ;[43]
151 ldi YH, hi8(usbTxBuf) ;[44]
152 rjmp usbSendAndReti ;[45] 57 + 12 = 59 until SOP
153
154; Comment about when to set usbTxLen to USBPID_NAK:
155; We should set it back when we receive the ACK from the host. This would
156; be simple to implement: One static variable which stores whether the last
157; tx was for endpoint 0 or 1 and a compare in the receiver to distinguish the
158; ACK. However, we set it back immediately when we send the package,
159; assuming that no error occurs and the host sends an ACK. We save one byte
160; RAM this way and avoid potential problems with endless retries. The rest of
161; the driver assumes error-free transfers anyway.
162
163#if !USB_CFG_SUPPRESS_INTR_CODE && USB_CFG_HAVE_INTRIN_ENDPOINT /* placed here due to relative jump range */
164handleIn1: ;[38]
165#if USB_CFG_HAVE_INTRIN_ENDPOINT3
166; 2006-06-10 as suggested by O.Tamura: support second INTR IN / BULK IN endpoint
167 cpi x3, USB_CFG_EP3_NUMBER;[38]
168 breq handleIn3 ;[39]
169#endif
170 lds cnt, usbTxLen1 ;[40]
171 sbrc cnt, 4 ;[42] all handshake tokens have bit 4 set
172 rjmp sendCntAndReti ;[43] 47 + 16 = 63 until SOP
173 sts usbTxLen1, x1 ;[44] x1 == USBPID_NAK from above
174 ldi YL, lo8(usbTxBuf1) ;[46]
175 ldi YH, hi8(usbTxBuf1) ;[47]
176 rjmp usbSendAndReti ;[48] 50 + 12 = 62 until SOP
177
178#if USB_CFG_HAVE_INTRIN_ENDPOINT3
179handleIn3:
180 lds cnt, usbTxLen3 ;[41]
181 sbrc cnt, 4 ;[43]
182 rjmp sendCntAndReti ;[44] 49 + 16 = 65 until SOP
183 sts usbTxLen3, x1 ;[45] x1 == USBPID_NAK from above
184 ldi YL, lo8(usbTxBuf3) ;[47]
185 ldi YH, hi8(usbTxBuf3) ;[48]
186 rjmp usbSendAndReti ;[49] 51 + 12 = 63 until SOP
187#endif
188#endif
diff --git a/tmk_core/protocol/vusb/usbdrv/oddebug.c b/tmk_core/protocol/vusb/usbdrv/oddebug.c
deleted file mode 100644
index bcd28ff014..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/oddebug.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/* Name: oddebug.c
2 * Project: AVR library
3 * Author: Christian Starkjohann
4 * Creation Date: 2005-01-16
5 * Tabsize: 4
6 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: oddebug.c 692 2008-11-07 15:07:40Z cs $
9 */
10
11#include "oddebug.h"
12
13#if DEBUG_LEVEL > 0
14
15# warning "Never compile production devices with debugging enabled"
16
17static void uartPutc(char c) {
18 while (!(ODDBG_USR & (1 << ODDBG_UDRE)))
19 ; /* wait for data register empty */
20 ODDBG_UDR = c;
21}
22
23static uchar hexAscii(uchar h) {
24 h &= 0xf;
25 if (h >= 10) h += 'a' - (uchar)10 - '0';
26 h += '0';
27 return h;
28}
29
30static void printHex(uchar c) {
31 uartPutc(hexAscii(c >> 4));
32 uartPutc(hexAscii(c));
33}
34
35void odDebug(uchar prefix, uchar *data, uchar len) {
36 printHex(prefix);
37 uartPutc(':');
38 while (len--) {
39 uartPutc(' ');
40 printHex(*data++);
41 }
42 uartPutc('\r');
43 uartPutc('\n');
44}
45
46#endif
diff --git a/tmk_core/protocol/vusb/usbdrv/oddebug.h b/tmk_core/protocol/vusb/usbdrv/oddebug.h
deleted file mode 100644
index f93f338794..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/oddebug.h
+++ /dev/null
@@ -1,121 +0,0 @@
1/* Name: oddebug.h
2 * Project: AVR library
3 * Author: Christian Starkjohann
4 * Creation Date: 2005-01-16
5 * Tabsize: 4
6 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: oddebug.h 692 2008-11-07 15:07:40Z cs $
9 */
10
11#ifndef __oddebug_h_included__
12#define __oddebug_h_included__
13
14/*
15General Description:
16This module implements a function for debug logs on the serial line of the
17AVR microcontroller. Debugging can be configured with the define
18'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debugging
19calls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is
202, DBG1 and DBG2 logs will be printed.
21
22A debug log consists of a label ('prefix') to indicate which debug log created
23the output and a memory block to dump in hex ('data' and 'len').
24*/
25
26#ifndef F_CPU
27# define F_CPU 12000000 /* 12 MHz */
28#endif
29
30/* make sure we have the UART defines: */
31#include "usbportability.h"
32
33#ifndef uchar
34# define uchar unsigned char
35#endif
36
37#if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */
38# warning "Debugging disabled because device has no UART"
39# undef DEBUG_LEVEL
40#endif
41
42#ifndef DEBUG_LEVEL
43# define DEBUG_LEVEL 0
44#endif
45
46/* ------------------------------------------------------------------------- */
47
48#if DEBUG_LEVEL > 0
49# define DBG1(prefix, data, len) odDebug(prefix, data, len)
50#else
51# define DBG1(prefix, data, len)
52#endif
53
54#if DEBUG_LEVEL > 1
55# define DBG2(prefix, data, len) odDebug(prefix, data, len)
56#else
57# define DBG2(prefix, data, len)
58#endif
59
60/* ------------------------------------------------------------------------- */
61
62#if DEBUG_LEVEL > 0
63extern void odDebug(uchar prefix, uchar *data, uchar len);
64
65/* Try to find our control registers; ATMEL likes to rename these */
66
67# if defined UBRR
68# define ODDBG_UBRR UBRR
69# elif defined UBRRL
70# define ODDBG_UBRR UBRRL
71# elif defined UBRR0
72# define ODDBG_UBRR UBRR0
73# elif defined UBRR0L
74# define ODDBG_UBRR UBRR0L
75# endif
76
77# if defined UCR
78# define ODDBG_UCR UCR
79# elif defined UCSRB
80# define ODDBG_UCR UCSRB
81# elif defined UCSR0B
82# define ODDBG_UCR UCSR0B
83# endif
84
85# if defined TXEN
86# define ODDBG_TXEN TXEN
87# else
88# define ODDBG_TXEN TXEN0
89# endif
90
91# if defined USR
92# define ODDBG_USR USR
93# elif defined UCSRA
94# define ODDBG_USR UCSRA
95# elif defined UCSR0A
96# define ODDBG_USR UCSR0A
97# endif
98
99# if defined UDRE
100# define ODDBG_UDRE UDRE
101# else
102# define ODDBG_UDRE UDRE0
103# endif
104
105# if defined UDR
106# define ODDBG_UDR UDR
107# elif defined UDR0
108# define ODDBG_UDR UDR0
109# endif
110
111static inline void odDebugInit(void) {
112 ODDBG_UCR |= (1 << ODDBG_TXEN);
113 ODDBG_UBRR = F_CPU / (19200 * 16L) - 1;
114}
115#else
116# define odDebugInit()
117#endif
118
119/* ------------------------------------------------------------------------- */
120
121#endif /* __oddebug_h_included__ */
diff --git a/tmk_core/protocol/vusb/usbdrv/usbconfig-prototype.h b/tmk_core/protocol/vusb/usbdrv/usbconfig-prototype.h
deleted file mode 100644
index 020ea51474..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbconfig-prototype.h
+++ /dev/null
@@ -1,376 +0,0 @@
1/* Name: usbconfig.h
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2005-04-01
5 * Tabsize: 4
6 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
9 */
10
11#ifndef __usbconfig_h_included__
12#define __usbconfig_h_included__
13
14/*
15General Description:
16This file is an example configuration (with inline documentation) for the USB
17driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
18also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
19wire the lines to any other port, as long as D+ is also wired to INT0 (or any
20other hardware interrupt, as long as it is the highest level interrupt, see
21section at the end of this file).
22+ To create your own usbconfig.h file, copy this file to your project's
23+ firmware source directory) and rename it to "usbconfig.h".
24+ Then edit it accordingly.
25*/
26
27/* ---------------------------- Hardware Config ---------------------------- */
28
29#define USB_CFG_IOPORTNAME D
30/* This is the port where the USB bus is connected. When you configure it to
31 * "B", the registers PORTB, PINB and DDRB will be used.
32 */
33#define USB_CFG_DMINUS_BIT 4
34/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
35 * This may be any bit in the port.
36 */
37#define USB_CFG_DPLUS_BIT 2
38/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
39 * This may be any bit in the port. Please note that D+ must also be connected
40 * to interrupt pin INT0! [You can also use other interrupts, see section
41 * "Optional MCU Description" below, or you can connect D- to the interrupt, as
42 * it is required if you use the USB_COUNT_SOF feature. If you use D- for the
43 * interrupt, the USB interrupt will also be triggered at Start-Of-Frame
44 * markers every millisecond.]
45 */
46#define USB_CFG_CLOCK_KHZ (F_CPU / 1000)
47/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
48 * 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
49 * require no crystal, they tolerate +/- 1% deviation from the nominal
50 * frequency. All other rates require a precision of 2000 ppm and thus a
51 * crystal!
52 * Since F_CPU should be defined to your actual clock rate anyway, you should
53 * not need to modify this setting.
54 */
55#define USB_CFG_CHECK_CRC 0
56/* Define this to 1 if you want that the driver checks integrity of incoming
57 * data packets (CRC checks). CRC checks cost quite a bit of code size and are
58 * currently only available for 18 MHz crystal clock. You must choose
59 * USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
60 */
61
62/* ----------------------- Optional Hardware Config ------------------------ */
63
64/* #define USB_CFG_PULLUP_IOPORTNAME D */
65/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
66 * V+, you can connect and disconnect the device from firmware by calling
67 * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
68 * This constant defines the port on which the pullup resistor is connected.
69 */
70/* #define USB_CFG_PULLUP_BIT 4 */
71/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
72 * above) where the 1.5k pullup resistor is connected. See description
73 * above for details.
74 */
75
76/* --------------------------- Functional Range ---------------------------- */
77
78#define USB_CFG_HAVE_INTRIN_ENDPOINT 0
79/* Define this to 1 if you want to compile a version with two endpoints: The
80 * default control endpoint 0 and an interrupt-in endpoint (any other endpoint
81 * number).
82 */
83#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
84/* Define this to 1 if you want to compile a version with three endpoints: The
85 * default control endpoint 0, an interrupt-in endpoint 3 (or the number
86 * configured below) and a catch-all default interrupt-in endpoint as above.
87 * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
88 */
89#define USB_CFG_EP3_NUMBER 3
90/* If the so-called endpoint 3 is used, it can now be configured to any other
91 * endpoint number (except 0) with this macro. Default if undefined is 3.
92 */
93/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
94/* The above macro defines the startup condition for data toggling on the
95 * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
96 * Since the token is toggled BEFORE sending any data, the first packet is
97 * sent with the oposite value of this configuration!
98 */
99#define USB_CFG_IMPLEMENT_HALT 0
100/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
101 * for endpoint 1 (interrupt endpoint). Although you may not need this feature,
102 * it is required by the standard. We have made it a config option because it
103 * bloats the code considerably.
104 */
105#define USB_CFG_SUPPRESS_INTR_CODE 0
106/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
107 * want to send any data over them. If this macro is defined to 1, functions
108 * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
109 * you need the interrupt-in endpoints in order to comply to an interface
110 * (e.g. HID), but never want to send any data. This option saves a couple
111 * of bytes in flash memory and the transmit buffers in RAM.
112 */
113#define USB_CFG_INTR_POLL_INTERVAL 10
114/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
115 * interval. The value is in milliseconds and must not be less than 10 ms for
116 * low speed devices.
117 */
118#define USB_CFG_IS_SELF_POWERED 0
119/* Define this to 1 if the device has its own power supply. Set it to 0 if the
120 * device is powered from the USB bus.
121 */
122#define USB_CFG_MAX_BUS_POWER 100
123/* Set this variable to the maximum USB bus power consumption of your device.
124 * The value is in milliamperes. [It will be divided by two since USB
125 * communicates power requirements in units of 2 mA.]
126 */
127#define USB_CFG_IMPLEMENT_FN_WRITE 0
128/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
129 * transfers. Set it to 0 if you don't need it and want to save a couple of
130 * bytes.
131 */
132#define USB_CFG_IMPLEMENT_FN_READ 0
133/* Set this to 1 if you need to send control replies which are generated
134 * "on the fly" when usbFunctionRead() is called. If you only want to send
135 * data from a static buffer, set it to 0 and return the data from
136 * usbFunctionSetup(). This saves a couple of bytes.
137 */
138#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
139/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
140 * You must implement the function usbFunctionWriteOut() which receives all
141 * interrupt/bulk data sent to any endpoint other than 0. The endpoint number
142 * can be found in 'usbRxToken'.
143 */
144#define USB_CFG_HAVE_FLOWCONTROL 0
145/* Define this to 1 if you want flowcontrol over USB data. See the definition
146 * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
147 * usbdrv.h.
148 */
149#define USB_CFG_DRIVER_FLASH_PAGE 0
150/* If the device has more than 64 kBytes of flash, define this to the 64 k page
151 * where the driver's constants (descriptors) are located. Or in other words:
152 * Define this to 1 for boot loaders on the ATMega128.
153 */
154#define USB_CFG_LONG_TRANSFERS 0
155/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
156 * in a single control-in or control-out transfer. Note that the capability
157 * for long transfers increases the driver size.
158 */
159/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
160/* This macro is a hook if you want to do unconventional things. If it is
161 * defined, it's inserted at the beginning of received message processing.
162 * If you eat the received message and don't want default processing to
163 * proceed, do a return after doing your things. One possible application
164 * (besides debugging) is to flash a status LED on each packet.
165 */
166/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
167/* This macro is a hook if you need to know when an USB RESET occurs. It has
168 * one parameter which distinguishes between the start of RESET state and its
169 * end.
170 */
171/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
172/* This macro (if defined) is executed when a USB SET_ADDRESS request was
173 * received.
174 */
175#define USB_COUNT_SOF 0
176/* define this macro to 1 if you need the global variable "usbSofCount" which
177 * counts SOF packets. This feature requires that the hardware interrupt is
178 * connected to D- instead of D+.
179 */
180/* #ifdef __ASSEMBLER__
181 * macro myAssemblerMacro
182 * in YL, TCNT0
183 * sts timer0Snapshot, YL
184 * endm
185 * #endif
186 * #define USB_SOF_HOOK myAssemblerMacro
187 * This macro (if defined) is executed in the assembler module when a
188 * Start Of Frame condition is detected. It is recommended to define it to
189 * the name of an assembler macro which is defined here as well so that more
190 * than one assembler instruction can be used. The macro may use the register
191 * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
192 * immediately after an SOF pulse may be lost and must be retried by the host.
193 * What can you do with this hook? Since the SOF signal occurs exactly every
194 * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
195 * designs running on the internal RC oscillator.
196 * Please note that Start Of Frame detection works only if D- is wired to the
197 * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
198 */
199#define USB_CFG_CHECK_DATA_TOGGLING 0
200/* define this macro to 1 if you want to filter out duplicate data packets
201 * sent by the host. Duplicates occur only as a consequence of communication
202 * errors, when the host does not receive an ACK. Please note that you need to
203 * implement the filtering yourself in usbFunctionWriteOut() and
204 * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
205 * for each control- and out-endpoint to check for duplicate packets.
206 */
207#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
208/* define this macro to 1 if you want the function usbMeasureFrameLength()
209 * compiled in. This function can be used to calibrate the AVR's RC oscillator.
210 */
211#define USB_USE_FAST_CRC 0
212/* The assembler module has two implementations for the CRC algorithm. One is
213 * faster, the other is smaller. This CRC routine is only used for transmitted
214 * messages where timing is not critical. The faster routine needs 31 cycles
215 * per byte while the smaller one needs 61 to 69 cycles. The faster routine
216 * may be worth the 32 bytes bigger code size if you transmit lots of data and
217 * run the AVR close to its limit.
218 */
219
220/* -------------------------- Device Description --------------------------- */
221
222#define USB_CFG_VENDOR_ID 0xc0, 0x16 /* = 0x16c0 = 5824 = voti.nl */
223/* USB vendor ID for the device, low byte first. If you have registered your
224 * own Vendor ID, define it here. Otherwise you may use one of obdev's free
225 * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
226 * *** IMPORTANT NOTE ***
227 * This template uses obdev's shared VID/PID pair for Vendor Class devices
228 * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
229 * the implications!
230 */
231#define USB_CFG_DEVICE_ID 0xdc, 0x05 /* = 0x05dc = 1500 */
232/* This is the ID of the product, low byte first. It is interpreted in the
233 * scope of the vendor ID. If you have registered your own VID with usb.org
234 * or if you have licensed a PID from somebody else, define it here. Otherwise
235 * you may use one of obdev's free shared VID/PID pairs. See the file
236 * USB-IDs-for-free.txt for details!
237 * *** IMPORTANT NOTE ***
238 * This template uses obdev's shared VID/PID pair for Vendor Class devices
239 * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
240 * the implications!
241 */
242#define USB_CFG_DEVICE_VERSION 0x00, 0x01
243/* Version number of the device: Minor number first, then major number.
244 */
245#define USB_CFG_VENDOR_NAME 'o', 'b', 'd', 'e', 'v', '.', 'a', 't'
246#define USB_CFG_VENDOR_NAME_LEN 8
247/* These two values define the vendor name returned by the USB device. The name
248 * must be given as a list of characters under single quotes. The characters
249 * are interpreted as Unicode (UTF-16) entities.
250 * If you don't want a vendor name string, undefine these macros.
251 * ALWAYS define a vendor name containing your Internet domain name if you use
252 * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
253 * details.
254 */
255#define USB_CFG_DEVICE_NAME 'T', 'e', 'm', 'p', 'l', 'a', 't', 'e'
256#define USB_CFG_DEVICE_NAME_LEN 8
257/* Same as above for the device name. If you don't want a device name, undefine
258 * the macros. See the file USB-IDs-for-free.txt before you assign a name if
259 * you use a shared VID/PID.
260 */
261/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
262/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
263/* Same as above for the serial number. If you don't want a serial number,
264 * undefine the macros.
265 * It may be useful to provide the serial number through other means than at
266 * compile time. See the section about descriptor properties below for how
267 * to fine tune control over USB descriptors such as the string descriptor
268 * for the serial number.
269 */
270#define USB_CFG_DEVICE_CLASS 0xff /* set to 0 if deferred to interface */
271#define USB_CFG_DEVICE_SUBCLASS 0
272/* See USB specification if you want to conform to an existing device class.
273 * Class 0xff is "vendor specific".
274 */
275#define USB_CFG_INTERFACE_CLASS 0 /* define class here if not at device level */
276#define USB_CFG_INTERFACE_SUBCLASS 0
277#define USB_CFG_INTERFACE_PROTOCOL 0
278/* See USB specification if you want to conform to an existing device class or
279 * protocol. The following classes must be set at interface level:
280 * HID class is 3, no subclass and protocol required (but may be useful!)
281 * CDC class is 2, use subclass 2 and protocol 1 for ACM
282 */
283/* #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 42 */
284/* Define this to the length of the HID report descriptor, if you implement
285 * an HID device. Otherwise don't define it or define it to 0.
286 * If you use this define, you must add a PROGMEM character array named
287 * "usbHidReportDescriptor" to your code which contains the report descriptor.
288 * Don't forget to keep the array and this define in sync!
289 */
290
291/* #define USB_PUBLIC static */
292/* Use the define above if you #include usbdrv.c instead of linking against it.
293 * This technique saves a couple of bytes in flash memory.
294 */
295
296/* ------------------- Fine Control over USB Descriptors ------------------- */
297/* If you don't want to use the driver's default USB descriptors, you can
298 * provide our own. These can be provided as (1) fixed length static data in
299 * flash memory, (2) fixed length static data in RAM or (3) dynamically at
300 * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
301 * information about this function.
302 * Descriptor handling is configured through the descriptor's properties. If
303 * no properties are defined or if they are 0, the default descriptor is used.
304 * Possible properties are:
305 * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
306 * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
307 * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
308 * you want RAM pointers.
309 * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
310 * in static memory is in RAM, not in flash memory.
311 * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
312 * the driver must know the descriptor's length. The descriptor itself is
313 * found at the address of a well known identifier (see below).
314 * List of static descriptor names (must be declared PROGMEM if in flash):
315 * char usbDescriptorDevice[];
316 * char usbDescriptorConfiguration[];
317 * char usbDescriptorHidReport[];
318 * char usbDescriptorString0[];
319 * int usbDescriptorStringVendor[];
320 * int usbDescriptorStringDevice[];
321 * int usbDescriptorStringSerialNumber[];
322 * Other descriptors can't be provided statically, they must be provided
323 * dynamically at runtime.
324 *
325 * Descriptor properties are or-ed or added together, e.g.:
326 * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
327 *
328 * The following descriptors are defined:
329 * USB_CFG_DESCR_PROPS_DEVICE
330 * USB_CFG_DESCR_PROPS_CONFIGURATION
331 * USB_CFG_DESCR_PROPS_STRINGS
332 * USB_CFG_DESCR_PROPS_STRING_0
333 * USB_CFG_DESCR_PROPS_STRING_VENDOR
334 * USB_CFG_DESCR_PROPS_STRING_PRODUCT
335 * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
336 * USB_CFG_DESCR_PROPS_HID
337 * USB_CFG_DESCR_PROPS_HID_REPORT
338 * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
339 *
340 * Note about string descriptors: String descriptors are not just strings, they
341 * are Unicode strings prefixed with a 2 byte header. Example:
342 * int serialNumberDescriptor[] = {
343 * USB_STRING_DESCRIPTOR_HEADER(6),
344 * 'S', 'e', 'r', 'i', 'a', 'l'
345 * };
346 */
347
348#define USB_CFG_DESCR_PROPS_DEVICE 0
349#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
350#define USB_CFG_DESCR_PROPS_STRINGS 0
351#define USB_CFG_DESCR_PROPS_STRING_0 0
352#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
353#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
354#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
355#define USB_CFG_DESCR_PROPS_HID 0
356#define USB_CFG_DESCR_PROPS_HID_REPORT 0
357#define USB_CFG_DESCR_PROPS_UNKNOWN 0
358
359/* ----------------------- Optional MCU Description ------------------------ */
360
361/* The following configurations have working defaults in usbdrv.h. You
362 * usually don't need to set them explicitly. Only if you want to run
363 * the driver on a device which is not yet supported or with a compiler
364 * which is not fully supported (such as IAR C) or if you use a differnt
365 * interrupt than INT0, you may have to define some of these.
366 */
367/* #define USB_INTR_CFG MCUCR */
368/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
369/* #define USB_INTR_CFG_CLR 0 */
370/* #define USB_INTR_ENABLE GIMSK */
371/* #define USB_INTR_ENABLE_BIT INT0 */
372/* #define USB_INTR_PENDING GIFR */
373/* #define USB_INTR_PENDING_BIT INTF0 */
374/* #define USB_INTR_VECTOR INT0_vect */
375
376#endif /* __usbconfig_h_included__ */
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrv.c b/tmk_core/protocol/vusb/usbdrv/usbdrv.c
deleted file mode 100644
index f69198b1b9..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrv.c
+++ /dev/null
@@ -1,622 +0,0 @@
1/* Name: usbdrv.c
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2004-12-29
5 * Tabsize: 4
6 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: usbdrv.c 791 2010-07-15 15:56:13Z cs $
9 */
10
11#include "usbportability.h"
12#include "usbdrv.h"
13#include "oddebug.h"
14
15/*
16General Description:
17This module implements the C-part of the USB driver. See usbdrv.h for a
18documentation of the entire driver.
19*/
20
21/* ------------------------------------------------------------------------- */
22
23/* raw USB registers / interface to assembler code: */
24uchar usbRxBuf[2 * USB_BUFSIZE]; /* raw RX buffer: PID, 8 bytes data, 2 bytes CRC */
25uchar usbInputBufOffset; /* offset in usbRxBuf used for low level receiving */
26uchar usbDeviceAddr; /* assigned during enumeration, defaults to 0 */
27uchar usbNewDeviceAddr; /* device ID which should be set after status phase */
28uchar usbConfiguration; /* currently selected configuration. Administered by driver, but not used */
29volatile schar usbRxLen; /* = 0; number of bytes in usbRxBuf; 0 means free, -1 for flow control */
30uchar usbCurrentTok; /* last token received or endpoint number for last OUT token if != 0 */
31uchar usbRxToken; /* token for data we received; or endpont number for last OUT */
32volatile uchar usbTxLen = USBPID_NAK; /* number of bytes to transmit with next IN token or handshake token */
33uchar usbTxBuf[USB_BUFSIZE]; /* data to transmit with next IN, free if usbTxLen contains handshake token */
34#if USB_COUNT_SOF
35volatile uchar usbSofCount; /* incremented by assembler module every SOF */
36#endif
37#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE
38usbTxStatus_t usbTxStatus1;
39# if USB_CFG_HAVE_INTRIN_ENDPOINT3
40usbTxStatus_t usbTxStatus3;
41# endif
42#endif
43#if USB_CFG_CHECK_DATA_TOGGLING
44uchar usbCurrentDataToken; /* when we check data toggling to ignore duplicate packets */
45#endif
46
47/* USB status registers / not shared with asm code */
48uchar * usbMsgPtr; /* data to transmit next -- ROM or RAM address */
49static usbMsgLen_t usbMsgLen = USB_NO_MSG; /* remaining number of bytes */
50static uchar usbMsgFlags; /* flag values see below */
51
52#define USB_FLG_MSGPTR_IS_ROM (1 << 6)
53#define USB_FLG_USE_USER_RW (1 << 7)
54
55/*
56optimizing hints:
57- do not post/pre inc/dec integer values in operations
58- assign value of USB_READ_FLASH() to register variables and don't use side effects in arg
59- use narrow scope for variables which should be in X/Y/Z register
60- assign char sized expressions to variables to force 8 bit arithmetics
61*/
62
63/* -------------------------- String Descriptors --------------------------- */
64
65#if USB_CFG_DESCR_PROPS_STRINGS == 0
66
67# if USB_CFG_DESCR_PROPS_STRING_0 == 0
68# undef USB_CFG_DESCR_PROPS_STRING_0
69# define USB_CFG_DESCR_PROPS_STRING_0 sizeof(usbDescriptorString0)
70const PROGMEM char usbDescriptorString0[] = {
71 /* language descriptor */
72 4, /* sizeof(usbDescriptorString0): length of descriptor in bytes */
73 3, /* descriptor type */
74 0x09, 0x04, /* language index (0x0409 = US-English) */
75};
76# endif
77
78# if USB_CFG_DESCR_PROPS_STRING_VENDOR == 0 && USB_CFG_VENDOR_NAME_LEN
79# undef USB_CFG_DESCR_PROPS_STRING_VENDOR
80# define USB_CFG_DESCR_PROPS_STRING_VENDOR sizeof(usbDescriptorStringVendor)
81const PROGMEM int usbDescriptorStringVendor[] = {USB_STRING_DESCRIPTOR_HEADER(USB_CFG_VENDOR_NAME_LEN), USB_CFG_VENDOR_NAME};
82# endif
83
84# if USB_CFG_DESCR_PROPS_STRING_PRODUCT == 0 && USB_CFG_DEVICE_NAME_LEN
85# undef USB_CFG_DESCR_PROPS_STRING_PRODUCT
86# define USB_CFG_DESCR_PROPS_STRING_PRODUCT sizeof(usbDescriptorStringDevice)
87const PROGMEM int usbDescriptorStringDevice[] = {USB_STRING_DESCRIPTOR_HEADER(USB_CFG_DEVICE_NAME_LEN), USB_CFG_DEVICE_NAME};
88# endif
89
90# if USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER == 0 && USB_CFG_SERIAL_NUMBER_LEN
91# undef USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
92# define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER sizeof(usbDescriptorStringSerialNumber)
93const PROGMEM int usbDescriptorStringSerialNumber[] = {USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN), USB_CFG_SERIAL_NUMBER};
94# endif
95
96#endif /* USB_CFG_DESCR_PROPS_STRINGS == 0 */
97
98/* --------------------------- Device Descriptor --------------------------- */
99
100#if USB_CFG_DESCR_PROPS_DEVICE == 0
101# undef USB_CFG_DESCR_PROPS_DEVICE
102# define USB_CFG_DESCR_PROPS_DEVICE sizeof(usbDescriptorDevice)
103const PROGMEM char usbDescriptorDevice[] = {
104 /* USB device descriptor */
105 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */
106 USBDESCR_DEVICE, /* descriptor type */
107 0x10, 0x01, /* USB version supported */
108 USB_CFG_DEVICE_CLASS, USB_CFG_DEVICE_SUBCLASS, 0, /* protocol */
109 8, /* max packet size */
110 /* the following two casts affect the first byte of the constant only, but
111 * that's sufficient to avoid a warning with the default values.
112 */
113 (char)USB_CFG_VENDOR_ID, /* 2 bytes */
114 (char)USB_CFG_DEVICE_ID, /* 2 bytes */
115 USB_CFG_DEVICE_VERSION, /* 2 bytes */
116 USB_CFG_DESCR_PROPS_STRING_VENDOR != 0 ? 1 : 0, /* manufacturer string index */
117 USB_CFG_DESCR_PROPS_STRING_PRODUCT != 0 ? 2 : 0, /* product string index */
118 USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER != 0 ? 3 : 0, /* serial number string index */
119 1, /* number of configurations */
120};
121#endif
122
123/* ----------------------- Configuration Descriptor ------------------------ */
124
125#if USB_CFG_DESCR_PROPS_HID_REPORT != 0 && USB_CFG_DESCR_PROPS_HID == 0
126# undef USB_CFG_DESCR_PROPS_HID
127# define USB_CFG_DESCR_PROPS_HID 9 /* length of HID descriptor in config descriptor below */
128#endif
129
130#if USB_CFG_DESCR_PROPS_CONFIGURATION == 0
131# undef USB_CFG_DESCR_PROPS_CONFIGURATION
132# define USB_CFG_DESCR_PROPS_CONFIGURATION sizeof(usbDescriptorConfiguration)
133PROGMEM char usbDescriptorConfiguration[] = {
134 /* USB configuration descriptor */
135 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */
136 USBDESCR_CONFIG, /* descriptor type */
137 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT3 + (USB_CFG_DESCR_PROPS_HID & 0xff), 0,
138 /* total length of data returned (including inlined descriptors) */
139 1, /* number of interfaces in this configuration */
140 1, /* index of this configuration */
141 0, /* configuration name string index */
142# if USB_CFG_IS_SELF_POWERED
143 (1 << 7) | USBATTR_SELFPOWER, /* attributes */
144# else
145 (1 << 7), /* attributes */
146# endif
147 USB_CFG_MAX_BUS_POWER / 2, /* max USB current in 2mA units */
148 /* interface descriptor follows inline: */
149 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */
150 USBDESCR_INTERFACE, /* descriptor type */
151 0, /* index of this interface */
152 0, /* alternate setting for this interface */
153 USB_CFG_HAVE_INTRIN_ENDPOINT + USB_CFG_HAVE_INTRIN_ENDPOINT3, /* endpoints excl 0: number of endpoint descriptors to follow */
154 USB_CFG_INTERFACE_CLASS, USB_CFG_INTERFACE_SUBCLASS, USB_CFG_INTERFACE_PROTOCOL, 0, /* string index for interface */
155# if (USB_CFG_DESCR_PROPS_HID & 0xff) /* HID descriptor */
156 9, /* sizeof(usbDescrHID): length of descriptor in bytes */
157 USBDESCR_HID, /* descriptor type: HID */
158 0x01, 0x01, /* BCD representation of HID version */
159 0x00, /* target country code */
160 0x01, /* number of HID Report (or other HID class) Descriptor infos to follow */
161 0x22, /* descriptor type: report */
162 USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0, /* total length of report descriptor */
163# endif
164# if USB_CFG_HAVE_INTRIN_ENDPOINT /* endpoint descriptor for endpoint 1 */
165 7, /* sizeof(usbDescrEndpoint) */
166 USBDESCR_ENDPOINT, /* descriptor type = endpoint */
167 (char)0x81, /* IN endpoint number 1 */
168 0x03, /* attrib: Interrupt endpoint */
169 8, 0, /* maximum packet size */
170 USB_CFG_INTR_POLL_INTERVAL, /* in ms */
171# endif
172# if USB_CFG_HAVE_INTRIN_ENDPOINT3 /* endpoint descriptor for endpoint 3 */
173 7, /* sizeof(usbDescrEndpoint) */
174 USBDESCR_ENDPOINT, /* descriptor type = endpoint */
175 (char)(0x80 | USB_CFG_EP3_NUMBER), /* IN endpoint number 3 */
176 0x03, /* attrib: Interrupt endpoint */
177 8, 0, /* maximum packet size */
178 USB_CFG_INTR_POLL_INTERVAL, /* in ms */
179# endif
180};
181#endif
182
183/* ------------------------------------------------------------------------- */
184
185static inline void usbResetDataToggling(void) {
186#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE
187 USB_SET_DATATOKEN1(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */
188# if USB_CFG_HAVE_INTRIN_ENDPOINT3
189 USB_SET_DATATOKEN3(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */
190# endif
191#endif
192}
193
194static inline void usbResetStall(void) {
195#if USB_CFG_IMPLEMENT_HALT && USB_CFG_HAVE_INTRIN_ENDPOINT
196 usbTxLen1 = USBPID_NAK;
197# if USB_CFG_HAVE_INTRIN_ENDPOINT3
198 usbTxLen3 = USBPID_NAK;
199# endif
200#endif
201}
202
203/* ------------------------------------------------------------------------- */
204
205#if !USB_CFG_SUPPRESS_INTR_CODE
206# if USB_CFG_HAVE_INTRIN_ENDPOINT
207static void usbGenericSetInterrupt(uchar *data, uchar len, usbTxStatus_t *txStatus) {
208 uchar *p;
209 char i;
210
211# if USB_CFG_IMPLEMENT_HALT
212 if (usbTxLen1 == USBPID_STALL) return;
213# endif
214 if (txStatus->len & 0x10) { /* packet buffer was empty */
215 txStatus->buffer[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* toggle token */
216 } else {
217 txStatus->len = USBPID_NAK; /* avoid sending outdated (overwritten) interrupt data */
218 }
219 p = txStatus->buffer + 1;
220 i = len;
221 do { /* if len == 0, we still copy 1 byte, but that's no problem */
222 *p++ = *data++;
223 } while (--i > 0); /* loop control at the end is 2 bytes shorter than at beginning */
224 usbCrc16Append(&txStatus->buffer[1], len);
225 txStatus->len = len + 4; /* len must be given including sync byte */
226 DBG2(0x21 + (((int)txStatus >> 3) & 3), txStatus->buffer, len + 3);
227}
228
229USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len) { usbGenericSetInterrupt(data, len, &usbTxStatus1); }
230# endif
231
232# if USB_CFG_HAVE_INTRIN_ENDPOINT3
233USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len) { usbGenericSetInterrupt(data, len, &usbTxStatus3); }
234# endif
235#endif /* USB_CFG_SUPPRESS_INTR_CODE */
236
237/* ------------------ utilities for code following below ------------------- */
238
239/* Use defines for the switch statement so that we can choose between an
240 * if()else if() and a switch/case based implementation. switch() is more
241 * efficient for a LARGE set of sequential choices, if() is better in all other
242 * cases.
243 */
244#if USB_CFG_USE_SWITCH_STATEMENT
245# define SWITCH_START(cmd) \
246 switch (cmd) { \
247 {
248# define SWITCH_CASE(value) \
249 } \
250 break; \
251 case (value): {
252# define SWITCH_CASE2(v1, v2) \
253 } \
254 break; \
255 case (v1): \
256 case (v2): {
257# define SWITCH_CASE3(v1, v2, v3) \
258 } \
259 break; \
260 case (v1): \
261 case (v2): \
262 case (v3): {
263# define SWITCH_DEFAULT \
264 } \
265 break; \
266 default: {
267# define SWITCH_END \
268 } \
269 }
270#else
271# define SWITCH_START(cmd) \
272 { \
273 uchar _cmd = cmd; \
274 if (0) {
275# define SWITCH_CASE(value) \
276 } \
277 else if (_cmd == (value)) {
278# define SWITCH_CASE2(v1, v2) \
279 } \
280 else if (_cmd == (v1) || _cmd == (v2)) {
281# define SWITCH_CASE3(v1, v2, v3) \
282 } \
283 else if (_cmd == (v1) || _cmd == (v2) || (_cmd == v3)) {
284# define SWITCH_DEFAULT \
285 } \
286 else {
287# define SWITCH_END \
288 } \
289 }
290#endif
291
292#ifndef USB_RX_USER_HOOK
293# define USB_RX_USER_HOOK(data, len)
294#endif
295#ifndef USB_SET_ADDRESS_HOOK
296# define USB_SET_ADDRESS_HOOK()
297#endif
298
299/* ------------------------------------------------------------------------- */
300
301/* We use if() instead of #if in the macro below because #if can't be used
302 * in macros and the compiler optimizes constant conditions anyway.
303 * This may cause problems with undefined symbols if compiled without
304 * optimizing!
305 */
306#define GET_DESCRIPTOR(cfgProp, staticName) \
307 if (cfgProp) { \
308 if ((cfgProp)&USB_PROP_IS_RAM) flags = 0; \
309 if ((cfgProp)&USB_PROP_IS_DYNAMIC) { \
310 len = usbFunctionDescriptor(rq); \
311 } else { \
312 len = USB_PROP_LENGTH(cfgProp); \
313 usbMsgPtr = (uchar *)(staticName); \
314 } \
315 }
316
317/* usbDriverDescriptor() is similar to usbFunctionDescriptor(), but used
318 * internally for all types of descriptors.
319 */
320static inline usbMsgLen_t usbDriverDescriptor(usbRequest_t *rq) {
321 usbMsgLen_t len = 0;
322 uchar flags = USB_FLG_MSGPTR_IS_ROM;
323
324 SWITCH_START(rq->wValue.bytes[1])
325 SWITCH_CASE(USBDESCR_DEVICE) /* 1 */
326 GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_DEVICE, usbDescriptorDevice)
327 SWITCH_CASE(USBDESCR_CONFIG) /* 2 */
328 GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_CONFIGURATION, usbDescriptorConfiguration)
329 SWITCH_CASE(USBDESCR_STRING) /* 3 */
330#if USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC
331 if (USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_RAM) flags = 0;
332 len = usbFunctionDescriptor(rq);
333#else /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */
334 SWITCH_START(rq->wValue.bytes[0])
335 SWITCH_CASE(0)
336 GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_0, usbDescriptorString0)
337 SWITCH_CASE(1)
338 GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_VENDOR, usbDescriptorStringVendor)
339 SWITCH_CASE(2)
340 GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_PRODUCT, usbDescriptorStringDevice)
341 SWITCH_CASE(3)
342 GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER, usbDescriptorStringSerialNumber)
343 SWITCH_DEFAULT
344 if (USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC) {
345 len = usbFunctionDescriptor(rq);
346 }
347 SWITCH_END
348#endif /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */
349#if USB_CFG_DESCR_PROPS_HID_REPORT /* only support HID descriptors if enabled */
350 SWITCH_CASE(USBDESCR_HID) /* 0x21 */
351 GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID, usbDescriptorConfiguration + 18)
352 SWITCH_CASE(USBDESCR_HID_REPORT) /* 0x22 */
353 GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID_REPORT, usbDescriptorHidReport)
354#endif
355 SWITCH_DEFAULT
356 if (USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC) {
357 len = usbFunctionDescriptor(rq);
358 }
359 SWITCH_END
360 usbMsgFlags = flags;
361 return len;
362}
363
364/* ------------------------------------------------------------------------- */
365
366/* usbDriverSetup() is similar to usbFunctionSetup(), but it's used for
367 * standard requests instead of class and custom requests.
368 */
369static inline usbMsgLen_t usbDriverSetup(usbRequest_t *rq) {
370 uchar len = 0, *dataPtr = usbTxBuf + 9; /* there are 2 bytes free space at the end of the buffer */
371 uchar value = rq->wValue.bytes[0];
372#if USB_CFG_IMPLEMENT_HALT
373 uchar index = rq->wIndex.bytes[0];
374#endif
375
376 dataPtr[0] = 0; /* default reply common to USBRQ_GET_STATUS and USBRQ_GET_INTERFACE */
377 SWITCH_START(rq->bRequest)
378 SWITCH_CASE(USBRQ_GET_STATUS) /* 0 */
379 uchar recipient = rq->bmRequestType & USBRQ_RCPT_MASK; /* assign arith ops to variables to enforce byte size */
380 if (USB_CFG_IS_SELF_POWERED && recipient == USBRQ_RCPT_DEVICE) dataPtr[0] = USB_CFG_IS_SELF_POWERED;
381#if USB_CFG_IMPLEMENT_HALT
382 if (recipient == USBRQ_RCPT_ENDPOINT && index == 0x81) /* request status for endpoint 1 */
383 dataPtr[0] = usbTxLen1 == USBPID_STALL;
384#endif
385 dataPtr[1] = 0;
386 len = 2;
387#if USB_CFG_IMPLEMENT_HALT
388 SWITCH_CASE2(USBRQ_CLEAR_FEATURE, USBRQ_SET_FEATURE) /* 1, 3 */
389 if (value == 0 && index == 0x81) { /* feature 0 == HALT for endpoint == 1 */
390 usbTxLen1 = rq->bRequest == USBRQ_CLEAR_FEATURE ? USBPID_NAK : USBPID_STALL;
391 usbResetDataToggling();
392 }
393#endif
394 SWITCH_CASE(USBRQ_SET_ADDRESS) /* 5 */
395 usbNewDeviceAddr = value;
396 USB_SET_ADDRESS_HOOK();
397 SWITCH_CASE(USBRQ_GET_DESCRIPTOR) /* 6 */
398 len = usbDriverDescriptor(rq);
399 goto skipMsgPtrAssignment;
400 SWITCH_CASE(USBRQ_GET_CONFIGURATION) /* 8 */
401 dataPtr = &usbConfiguration; /* send current configuration value */
402 len = 1;
403 SWITCH_CASE(USBRQ_SET_CONFIGURATION) /* 9 */
404 usbConfiguration = value;
405 usbResetStall();
406 SWITCH_CASE(USBRQ_GET_INTERFACE) /* 10 */
407 len = 1;
408#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE
409 SWITCH_CASE(USBRQ_SET_INTERFACE) /* 11 */
410 usbResetDataToggling();
411 usbResetStall();
412#endif
413 SWITCH_DEFAULT /* 7=SET_DESCRIPTOR, 12=SYNC_FRAME */
414 /* Should we add an optional hook here? */
415 SWITCH_END usbMsgPtr = dataPtr;
416skipMsgPtrAssignment:
417 return len;
418}
419
420/* ------------------------------------------------------------------------- */
421
422/* usbProcessRx() is called for every message received by the interrupt
423 * routine. It distinguishes between SETUP and DATA packets and processes
424 * them accordingly.
425 */
426static inline void usbProcessRx(uchar *data, uchar len) {
427 usbRequest_t *rq = (void *)data;
428
429 /* usbRxToken can be:
430 * 0x2d 00101101 (USBPID_SETUP for setup data)
431 * 0xe1 11100001 (USBPID_OUT: data phase of setup transfer)
432 * 0...0x0f for OUT on endpoint X
433 */
434 DBG2(0x10 + (usbRxToken & 0xf), data, len + 2); /* SETUP=1d, SETUP-DATA=11, OUTx=1x */
435 USB_RX_USER_HOOK(data, len)
436#if USB_CFG_IMPLEMENT_FN_WRITEOUT
437 if (usbRxToken < 0x10) { /* OUT to endpoint != 0: endpoint number in usbRxToken */
438 usbFunctionWriteOut(data, len);
439 return;
440 }
441#endif
442 if (usbRxToken == (uchar)USBPID_SETUP) {
443 if (len != 8) /* Setup size must be always 8 bytes. Ignore otherwise. */
444 return;
445 usbMsgLen_t replyLen;
446 usbTxBuf[0] = USBPID_DATA0; /* initialize data toggling */
447 usbTxLen = USBPID_NAK; /* abort pending transmit */
448 usbMsgFlags = 0;
449 uchar type = rq->bmRequestType & USBRQ_TYPE_MASK;
450 if (type != USBRQ_TYPE_STANDARD) { /* standard requests are handled by driver */
451 replyLen = usbFunctionSetup(data);
452 } else {
453 replyLen = usbDriverSetup(rq);
454 }
455#if USB_CFG_IMPLEMENT_FN_READ || USB_CFG_IMPLEMENT_FN_WRITE
456 if (replyLen == USB_NO_MSG) { /* use user-supplied read/write function */
457 /* do some conditioning on replyLen, but on IN transfers only */
458 if ((rq->bmRequestType & USBRQ_DIR_MASK) != USBRQ_DIR_HOST_TO_DEVICE) {
459 if (sizeof(replyLen) < sizeof(rq->wLength.word)) { /* help compiler with optimizing */
460 replyLen = rq->wLength.bytes[0];
461 } else {
462 replyLen = rq->wLength.word;
463 }
464 }
465 usbMsgFlags = USB_FLG_USE_USER_RW;
466 } else /* The 'else' prevents that we limit a replyLen of USB_NO_MSG to the maximum transfer len. */
467#endif
468 if (sizeof(replyLen) < sizeof(rq->wLength.word)) { /* help compiler with optimizing */
469 if (!rq->wLength.bytes[1] && replyLen > rq->wLength.bytes[0]) /* limit length to max */
470 replyLen = rq->wLength.bytes[0];
471 } else {
472 if (replyLen > rq->wLength.word) /* limit length to max */
473 replyLen = rq->wLength.word;
474 }
475 usbMsgLen = replyLen;
476 } else { /* usbRxToken must be USBPID_OUT, which means data phase of setup (control-out) */
477#if USB_CFG_IMPLEMENT_FN_WRITE
478 if (usbMsgFlags & USB_FLG_USE_USER_RW) {
479 uchar rval = usbFunctionWrite(data, len);
480 if (rval == 0xff) { /* an error occurred */
481 usbTxLen = USBPID_STALL;
482 } else if (rval != 0) { /* This was the final package */
483 usbMsgLen = 0; /* answer with a zero-sized data packet */
484 }
485 }
486#endif
487 }
488}
489
490/* ------------------------------------------------------------------------- */
491
492/* This function is similar to usbFunctionRead(), but it's also called for
493 * data handled automatically by the driver (e.g. descriptor reads).
494 */
495static uchar usbDeviceRead(uchar *data, uchar len) {
496 if (len > 0) { /* don't bother app with 0 sized reads */
497#if USB_CFG_IMPLEMENT_FN_READ
498 if (usbMsgFlags & USB_FLG_USE_USER_RW) {
499 len = usbFunctionRead(data, len);
500 } else
501#endif
502 {
503 uchar i = len, *r = usbMsgPtr;
504 if (usbMsgFlags & USB_FLG_MSGPTR_IS_ROM) { /* ROM data */
505 do {
506 uchar c = USB_READ_FLASH(r); /* assign to char size variable to enforce byte ops */
507 *data++ = c;
508 r++;
509 } while (--i);
510 } else { /* RAM data */
511 do {
512 *data++ = *r++;
513 } while (--i);
514 }
515 usbMsgPtr = r;
516 }
517 }
518 return len;
519}
520
521/* ------------------------------------------------------------------------- */
522
523/* usbBuildTxBlock() is called when we have data to transmit and the
524 * interrupt routine's transmit buffer is empty.
525 */
526static inline void usbBuildTxBlock(void) {
527 usbMsgLen_t wantLen;
528 uchar len;
529
530 wantLen = usbMsgLen;
531 if (wantLen > 8) wantLen = 8;
532 usbMsgLen -= wantLen;
533 usbTxBuf[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* DATA toggling */
534 len = usbDeviceRead(usbTxBuf + 1, wantLen);
535 if (len <= 8) { /* valid data packet */
536 usbCrc16Append(&usbTxBuf[1], len);
537 len += 4; /* length including sync byte */
538 if (len < 12) /* a partial package identifies end of message */
539 usbMsgLen = USB_NO_MSG;
540 } else {
541 len = USBPID_STALL; /* stall the endpoint */
542 usbMsgLen = USB_NO_MSG;
543 }
544 usbTxLen = len;
545 DBG2(0x20, usbTxBuf, len - 1);
546}
547
548/* ------------------------------------------------------------------------- */
549
550static inline void usbHandleResetHook(uchar notResetState) {
551#ifdef USB_RESET_HOOK
552 static uchar wasReset;
553 uchar isReset = !notResetState;
554
555 if (wasReset != isReset) {
556 USB_RESET_HOOK(isReset);
557 wasReset = isReset;
558 }
559#endif
560}
561
562/* ------------------------------------------------------------------------- */
563
564USB_PUBLIC void usbPoll(void) {
565 schar len;
566 uchar i;
567
568 len = usbRxLen - 3;
569 if (len >= 0) {
570 /* We could check CRC16 here -- but ACK has already been sent anyway. If you
571 * need data integrity checks with this driver, check the CRC in your app
572 * code and report errors back to the host. Since the ACK was already sent,
573 * retries must be handled on application level.
574 * unsigned crc = usbCrc16(buffer + 1, usbRxLen - 3);
575 */
576 usbProcessRx(usbRxBuf + USB_BUFSIZE + 1 - usbInputBufOffset, len);
577#if USB_CFG_HAVE_FLOWCONTROL
578 if (usbRxLen > 0) /* only mark as available if not inactivated */
579 usbRxLen = 0;
580#else
581 usbRxLen = 0; /* mark rx buffer as available */
582#endif
583 }
584 if (usbTxLen & 0x10) { /* transmit system idle */
585 if (usbMsgLen != USB_NO_MSG) { /* transmit data pending? */
586 usbBuildTxBlock();
587 }
588 }
589 for (i = 20; i > 0; i--) {
590 uchar usbLineStatus = USBIN & USBMASK;
591 if (usbLineStatus != 0) /* SE0 has ended */
592 goto isNotReset;
593 }
594 /* RESET condition, called multiple times during reset */
595 usbNewDeviceAddr = 0;
596 usbDeviceAddr = 0;
597 usbResetStall();
598 DBG1(0xff, 0, 0);
599isNotReset:
600 usbHandleResetHook(i);
601}
602
603/* ------------------------------------------------------------------------- */
604
605USB_PUBLIC void usbInit(void) {
606#if USB_INTR_CFG_SET != 0
607 USB_INTR_CFG |= USB_INTR_CFG_SET;
608#endif
609#if USB_INTR_CFG_CLR != 0
610 USB_INTR_CFG &= ~(USB_INTR_CFG_CLR);
611#endif
612 USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT);
613 usbResetDataToggling();
614#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE
615 usbTxLen1 = USBPID_NAK;
616# if USB_CFG_HAVE_INTRIN_ENDPOINT3
617 usbTxLen3 = USBPID_NAK;
618# endif
619#endif
620}
621
622/* ------------------------------------------------------------------------- */
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrv.h b/tmk_core/protocol/vusb/usbdrv/usbdrv.h
deleted file mode 100644
index 88a1bce76e..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrv.h
+++ /dev/null
@@ -1,730 +0,0 @@
1/* Name: usbdrv.h
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2004-12-29
5 * Tabsize: 4
6 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: usbdrv.h 793 2010-07-15 15:58:11Z cs $
9 */
10
11#ifndef __usbdrv_h_included__
12#define __usbdrv_h_included__
13#include "usbconfig.h"
14#include "usbportability.h"
15
16/*
17Hardware Prerequisites:
18=======================
19USB lines D+ and D- MUST be wired to the same I/O port. We recommend that D+
20triggers the interrupt (best achieved by using INT0 for D+), but it is also
21possible to trigger the interrupt from D-. If D- is used, interrupts are also
22triggered by SOF packets. D- requires a pull-up of 1.5k to +3.5V (and the
23device must be powered at 3.5V) to identify as low-speed USB device. A
24pull-down or pull-up of 1M SHOULD be connected from D+ to +3.5V to prevent
25interference when no USB master is connected. If you use Zener diodes to limit
26the voltage on D+ and D-, you MUST use a pull-down resistor, not a pull-up.
27We use D+ as interrupt source and not D- because it does not trigger on
28keep-alive and RESET states. If you want to count keep-alive events with
29USB_COUNT_SOF, you MUST use D- as an interrupt source.
30
31As a compile time option, the 1.5k pull-up resistor on D- can be made
32switchable to allow the device to disconnect at will. See the definition of
33usbDeviceConnect() and usbDeviceDisconnect() further down in this file.
34
35Please adapt the values in usbconfig.h according to your hardware!
36
37The device MUST be clocked at exactly 12 MHz, 15 MHz, 16 MHz or 20 MHz
38or at 12.8 MHz resp. 16.5 MHz +/- 1%. See usbconfig-prototype.h for details.
39
40
41Limitations:
42============
43Robustness with respect to communication errors:
44The driver assumes error-free communication. It DOES check for errors in
45the PID, but does NOT check bit stuffing errors, SE0 in middle of a byte,
46token CRC (5 bit) and data CRC (16 bit). CRC checks can not be performed due
47to timing constraints: We must start sending a reply within 7 bit times.
48Bit stuffing and misplaced SE0 would have to be checked in real-time, but CPU
49performance does not permit that. The driver does not check Data0/Data1
50toggling, but application software can implement the check.
51
52Input characteristics:
53Since no differential receiver circuit is used, electrical interference
54robustness may suffer. The driver samples only one of the data lines with
55an ordinary I/O pin's input characteristics. However, since this is only a
56low speed USB implementation and the specification allows for 8 times the
57bit rate over the same hardware, we should be on the safe side. Even the spec
58requires detection of asymmetric states at high bit rate for SE0 detection.
59
60Number of endpoints:
61The driver supports the following endpoints:
62
63- Endpoint 0, the default control endpoint.
64- Any number of interrupt- or bulk-out endpoints. The data is sent to
65 usbFunctionWriteOut() and USB_CFG_IMPLEMENT_FN_WRITEOUT must be defined
66 to 1 to activate this feature. The endpoint number can be found in the
67 global variable 'usbRxToken'.
68- One default interrupt- or bulk-in endpoint. This endpoint is used for
69 interrupt- or bulk-in transfers which are not handled by any other endpoint.
70 You must define USB_CFG_HAVE_INTRIN_ENDPOINT in order to activate this
71 feature and call usbSetInterrupt() to send interrupt/bulk data.
72- One additional interrupt- or bulk-in endpoint. This was endpoint 3 in
73 previous versions of this driver but can now be configured to any endpoint
74 number. You must define USB_CFG_HAVE_INTRIN_ENDPOINT3 in order to activate
75 this feature and call usbSetInterrupt3() to send interrupt/bulk data. The
76 endpoint number can be set with USB_CFG_EP3_NUMBER.
77
78Please note that the USB standard forbids bulk endpoints for low speed devices!
79Most operating systems allow them anyway, but the AVR will spend 90% of the CPU
80time in the USB interrupt polling for bulk data.
81
82Maximum data payload:
83Data payload of control in and out transfers may be up to 254 bytes. In order
84to accept payload data of out transfers, you need to implement
85'usbFunctionWrite()'.
86
87USB Suspend Mode supply current:
88The USB standard limits power consumption to 500uA when the bus is in suspend
89mode. This is not a problem for self-powered devices since they don't need
90bus power anyway. Bus-powered devices can achieve this only by putting the
91CPU in sleep mode. The driver does not implement suspend handling by itself.
92However, the application may implement activity monitoring and wakeup from
93sleep. The host sends regular SE0 states on the bus to keep it active. These
94SE0 states can be detected by using D- as the interrupt source. Define
95USB_COUNT_SOF to 1 and use the global variable usbSofCount to check for bus
96activity.
97
98Operation without an USB master:
99The driver behaves neutral without connection to an USB master if D- reads
100as 1. To avoid spurious interrupts, we recommend a high impedance (e.g. 1M)
101pull-down or pull-up resistor on D+ (interrupt). If Zener diodes are used,
102use a pull-down. If D- becomes statically 0, the driver may block in the
103interrupt routine.
104
105Interrupt latency:
106The application must ensure that the USB interrupt is not disabled for more
107than 25 cycles (this is for 12 MHz, faster clocks allow longer latency).
108This implies that all interrupt routines must either have the "ISR_NOBLOCK"
109attribute set (see "avr/interrupt.h") or be written in assembler with "sei"
110as the first instruction.
111
112Maximum interrupt duration / CPU cycle consumption:
113The driver handles all USB communication during the interrupt service
114routine. The routine will not return before an entire USB message is received
115and the reply is sent. This may be up to ca. 1200 cycles @ 12 MHz (= 100us) if
116the host conforms to the standard. The driver will consume CPU cycles for all
117USB messages, even if they address another (low-speed) device on the same bus.
118
119*/
120
121/* ------------------------------------------------------------------------- */
122/* --------------------------- Module Interface ---------------------------- */
123/* ------------------------------------------------------------------------- */
124
125#define USBDRV_VERSION 20100715
126/* This define uniquely identifies a driver version. It is a decimal number
127 * constructed from the driver's release date in the form YYYYMMDD. If the
128 * driver's behavior or interface changes, you can use this constant to
129 * distinguish versions. If it is not defined, the driver's release date is
130 * older than 2006-01-25.
131 */
132
133#ifndef USB_PUBLIC
134# define USB_PUBLIC
135#endif
136/* USB_PUBLIC is used as declaration attribute for all functions exported by
137 * the USB driver. The default is no attribute (see above). You may define it
138 * to static either in usbconfig.h or from the command line if you include
139 * usbdrv.c instead of linking against it. Including the C module of the driver
140 * directly in your code saves a couple of bytes in flash memory.
141 */
142
143#ifndef __ASSEMBLER__
144# ifndef uchar
145# define uchar unsigned char
146# endif
147# ifndef schar
148# define schar signed char
149# endif
150/* shortcuts for well defined 8 bit integer types */
151
152# if USB_CFG_LONG_TRANSFERS /* if more than 254 bytes transfer size required */
153# define usbMsgLen_t unsigned
154# else
155# define usbMsgLen_t uchar
156# endif
157/* usbMsgLen_t is the data type used for transfer lengths. By default, it is
158 * defined to uchar, allowing a maximum of 254 bytes (255 is reserved for
159 * USB_NO_MSG below). If the usbconfig.h defines USB_CFG_LONG_TRANSFERS to 1,
160 * a 16 bit data type is used, allowing up to 16384 bytes (the rest is used
161 * for flags in the descriptor configuration).
162 */
163# define USB_NO_MSG ((usbMsgLen_t)-1) /* constant meaning "no message" */
164
165struct usbRequest; /* forward declaration */
166
167USB_PUBLIC void usbInit(void);
168/* This function must be called before interrupts are enabled and the main
169 * loop is entered. We exepct that the PORT and DDR bits for D+ and D- have
170 * not been changed from their default status (which is 0). If you have changed
171 * them, set both back to 0 (configure them as input with no internal pull-up).
172 */
173USB_PUBLIC void usbPoll(void);
174/* This function must be called at regular intervals from the main loop.
175 * Maximum delay between calls is somewhat less than 50ms (USB timeout for
176 * accepting a Setup message). Otherwise the device will not be recognized.
177 * Please note that debug outputs through the UART take ~ 0.5ms per byte
178 * at 19200 bps.
179 */
180extern uchar *usbMsgPtr;
181/* This variable may be used to pass transmit data to the driver from the
182 * implementation of usbFunctionWrite(). It is also used internally by the
183 * driver for standard control requests.
184 */
185USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]);
186/* This function is called when the driver receives a SETUP transaction from
187 * the host which is not answered by the driver itself (in practice: class and
188 * vendor requests). All control transfers start with a SETUP transaction where
189 * the host communicates the parameters of the following (optional) data
190 * transfer. The SETUP data is available in the 'data' parameter which can
191 * (and should) be casted to 'usbRequest_t *' for a more user-friendly access
192 * to parameters.
193 *
194 * If the SETUP indicates a control-in transfer, you should provide the
195 * requested data to the driver. There are two ways to transfer this data:
196 * (1) Set the global pointer 'usbMsgPtr' to the base of the static RAM data
197 * block and return the length of the data in 'usbFunctionSetup()'. The driver
198 * will handle the rest. Or (2) return USB_NO_MSG in 'usbFunctionSetup()'. The
199 * driver will then call 'usbFunctionRead()' when data is needed. See the
200 * documentation for usbFunctionRead() for details.
201 *
202 * If the SETUP indicates a control-out transfer, the only way to receive the
203 * data from the host is through the 'usbFunctionWrite()' call. If you
204 * implement this function, you must return USB_NO_MSG in 'usbFunctionSetup()'
205 * to indicate that 'usbFunctionWrite()' should be used. See the documentation
206 * of this function for more information. If you just want to ignore the data
207 * sent by the host, return 0 in 'usbFunctionSetup()'.
208 *
209 * Note that calls to the functions usbFunctionRead() and usbFunctionWrite()
210 * are only done if enabled by the configuration in usbconfig.h.
211 */
212USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq);
213/* You need to implement this function ONLY if you provide USB descriptors at
214 * runtime (which is an expert feature). It is very similar to
215 * usbFunctionSetup() above, but it is called only to request USB descriptor
216 * data. See the documentation of usbFunctionSetup() above for more info.
217 */
218# if USB_CFG_HAVE_INTRIN_ENDPOINT
219USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len);
220/* This function sets the message which will be sent during the next interrupt
221 * IN transfer. The message is copied to an internal buffer and must not exceed
222 * a length of 8 bytes. The message may be 0 bytes long just to indicate the
223 * interrupt status to the host.
224 * If you need to transfer more bytes, use a control read after the interrupt.
225 */
226# define usbInterruptIsReady() (usbTxLen1 & 0x10)
227/* This macro indicates whether the last interrupt message has already been
228 * sent. If you set a new interrupt message before the old was sent, the
229 * message already buffered will be lost.
230 */
231# if USB_CFG_HAVE_INTRIN_ENDPOINT3
232USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len);
233# define usbInterruptIsReady3() (usbTxLen3 & 0x10)
234/* Same as above for endpoint 3 */
235# endif
236# endif /* USB_CFG_HAVE_INTRIN_ENDPOINT */
237# if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* simplified interface for backward compatibility */
238# define usbHidReportDescriptor usbDescriptorHidReport
239/* should be declared as: PROGMEM char usbHidReportDescriptor[]; */
240/* If you implement an HID device, you need to provide a report descriptor.
241 * The HID report descriptor syntax is a bit complex. If you understand how
242 * report descriptors are constructed, we recommend that you use the HID
243 * Descriptor Tool from usb.org, see http://www.usb.org/developers/hidpage/.
244 * Otherwise you should probably start with a working example.
245 */
246# endif /* USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH */
247# if USB_CFG_IMPLEMENT_FN_WRITE
248USB_PUBLIC uchar usbFunctionWrite(uchar *data, uchar len);
249/* This function is called by the driver to provide a control transfer's
250 * payload data (control-out). It is called in chunks of up to 8 bytes. The
251 * total count provided in the current control transfer can be obtained from
252 * the 'length' property in the setup data. If an error occurred during
253 * processing, return 0xff (== -1). The driver will answer the entire transfer
254 * with a STALL token in this case. If you have received the entire payload
255 * successfully, return 1. If you expect more data, return 0. If you don't
256 * know whether the host will send more data (you should know, the total is
257 * provided in the usbFunctionSetup() call!), return 1.
258 * NOTE: If you return 0xff for STALL, 'usbFunctionWrite()' may still be called
259 * for the remaining data. You must continue to return 0xff for STALL in these
260 * calls.
261 * In order to get usbFunctionWrite() called, define USB_CFG_IMPLEMENT_FN_WRITE
262 * to 1 in usbconfig.h and return 0xff in usbFunctionSetup()..
263 */
264# endif /* USB_CFG_IMPLEMENT_FN_WRITE */
265# if USB_CFG_IMPLEMENT_FN_READ
266USB_PUBLIC uchar usbFunctionRead(uchar *data, uchar len);
267/* This function is called by the driver to ask the application for a control
268 * transfer's payload data (control-in). It is called in chunks of up to 8
269 * bytes each. You should copy the data to the location given by 'data' and
270 * return the actual number of bytes copied. If you return less than requested,
271 * the control-in transfer is terminated. If you return 0xff, the driver aborts
272 * the transfer with a STALL token.
273 * In order to get usbFunctionRead() called, define USB_CFG_IMPLEMENT_FN_READ
274 * to 1 in usbconfig.h and return 0xff in usbFunctionSetup()..
275 */
276# endif /* USB_CFG_IMPLEMENT_FN_READ */
277
278extern uchar usbRxToken; /* may be used in usbFunctionWriteOut() below */
279# if USB_CFG_IMPLEMENT_FN_WRITEOUT
280USB_PUBLIC void usbFunctionWriteOut(uchar *data, uchar len);
281/* This function is called by the driver when data is received on an interrupt-
282 * or bulk-out endpoint. The endpoint number can be found in the global
283 * variable usbRxToken. You must define USB_CFG_IMPLEMENT_FN_WRITEOUT to 1 in
284 * usbconfig.h to get this function called.
285 */
286# endif /* USB_CFG_IMPLEMENT_FN_WRITEOUT */
287# ifdef USB_CFG_PULLUP_IOPORTNAME
288# define usbDeviceConnect() ((USB_PULLUP_DDR |= (1 << USB_CFG_PULLUP_BIT)), (USB_PULLUP_OUT |= (1 << USB_CFG_PULLUP_BIT)))
289# define usbDeviceDisconnect() ((USB_PULLUP_DDR &= ~(1 << USB_CFG_PULLUP_BIT)), (USB_PULLUP_OUT &= ~(1 << USB_CFG_PULLUP_BIT)))
290# else /* USB_CFG_PULLUP_IOPORTNAME */
291# define usbDeviceConnect() (USBDDR &= ~(1 << USBMINUS))
292# define usbDeviceDisconnect() (USBDDR |= (1 << USBMINUS))
293# endif /* USB_CFG_PULLUP_IOPORTNAME */
294/* The macros usbDeviceConnect() and usbDeviceDisconnect() (intended to look
295 * like a function) connect resp. disconnect the device from the host's USB.
296 * If the constants USB_CFG_PULLUP_IOPORT and USB_CFG_PULLUP_BIT are defined
297 * in usbconfig.h, a disconnect consists of removing the pull-up resisitor
298 * from D-, otherwise the disconnect is done by brute-force pulling D- to GND.
299 * This does not conform to the spec, but it works.
300 * Please note that the USB interrupt must be disabled while the device is
301 * in disconnected state, or the interrupt handler will hang! You can either
302 * turn off the USB interrupt selectively with
303 * USB_INTR_ENABLE &= ~(1 << USB_INTR_ENABLE_BIT)
304 * or use cli() to disable interrupts globally.
305 */
306extern unsigned usbCrc16(unsigned data, uchar len);
307# define usbCrc16(data, len) usbCrc16((unsigned)(data), len)
308/* This function calculates the binary complement of the data CRC used in
309 * USB data packets. The value is used to build raw transmit packets.
310 * You may want to use this function for data checksums or to verify received
311 * data. We enforce 16 bit calling conventions for compatibility with IAR's
312 * tiny memory model.
313 */
314extern unsigned usbCrc16Append(unsigned data, uchar len);
315# define usbCrc16Append(data, len) usbCrc16Append((unsigned)(data), len)
316/* This function is equivalent to usbCrc16() above, except that it appends
317 * the 2 bytes CRC (lowbyte first) in the 'data' buffer after reading 'len'
318 * bytes.
319 */
320# if USB_CFG_HAVE_MEASURE_FRAME_LENGTH
321extern unsigned usbMeasureFrameLength(void);
322/* This function MUST be called IMMEDIATELY AFTER USB reset and measures 1/7 of
323 * the number of CPU cycles during one USB frame minus one low speed bit
324 * length. In other words: return value = 1499 * (F_CPU / 10.5 MHz)
325 * Since this is a busy wait, you MUST disable all interrupts with cli() before
326 * calling this function.
327 * This can be used to calibrate the AVR's RC oscillator.
328 */
329# endif
330extern uchar usbConfiguration;
331/* This value contains the current configuration set by the host. The driver
332 * allows setting and querying of this variable with the USB SET_CONFIGURATION
333 * and GET_CONFIGURATION requests, but does not use it otherwise.
334 * You may want to reflect the "configured" status with a LED on the device or
335 * switch on high power parts of the circuit only if the device is configured.
336 */
337# if USB_COUNT_SOF
338extern volatile uchar usbSofCount;
339/* This variable is incremented on every SOF packet. It is only available if
340 * the macro USB_COUNT_SOF is defined to a value != 0.
341 */
342# endif
343# if USB_CFG_CHECK_DATA_TOGGLING
344extern uchar usbCurrentDataToken;
345/* This variable can be checked in usbFunctionWrite() and usbFunctionWriteOut()
346 * to ignore duplicate packets.
347 */
348# endif
349
350# define USB_STRING_DESCRIPTOR_HEADER(stringLength) ((2 * (stringLength) + 2) | (3 << 8))
351/* This macro builds a descriptor header for a string descriptor given the
352 * string's length. See usbdrv.c for an example how to use it.
353 */
354# if USB_CFG_HAVE_FLOWCONTROL
355extern volatile schar usbRxLen;
356# define usbDisableAllRequests() usbRxLen = -1
357/* Must be called from usbFunctionWrite(). This macro disables all data input
358 * from the USB interface. Requests from the host are answered with a NAK
359 * while they are disabled.
360 */
361# define usbEnableAllRequests() usbRxLen = 0
362/* May only be called if requests are disabled. This macro enables input from
363 * the USB interface after it has been disabled with usbDisableAllRequests().
364 */
365# define usbAllRequestsAreDisabled() (usbRxLen < 0)
366/* Use this macro to find out whether requests are disabled. It may be needed
367 * to ensure that usbEnableAllRequests() is never called when requests are
368 * enabled.
369 */
370# endif
371
372# define USB_SET_DATATOKEN1(token) usbTxBuf1[0] = token
373# define USB_SET_DATATOKEN3(token) usbTxBuf3[0] = token
374/* These two macros can be used by application software to reset data toggling
375 * for interrupt-in endpoints 1 and 3. Since the token is toggled BEFORE
376 * sending data, you must set the opposite value of the token which should come
377 * first.
378 */
379
380#endif /* __ASSEMBLER__ */
381
382/* ------------------------------------------------------------------------- */
383/* ----------------- Definitions for Descriptor Properties ----------------- */
384/* ------------------------------------------------------------------------- */
385/* This is advanced stuff. See usbconfig-prototype.h for more information
386 * about the various methods to define USB descriptors. If you do nothing,
387 * the default descriptors will be used.
388 */
389#define USB_PROP_IS_DYNAMIC (1 << 14)
390/* If this property is set for a descriptor, usbFunctionDescriptor() will be
391 * used to obtain the particular descriptor. Data directly returned via
392 * usbMsgPtr are FLASH data by default, combine (OR) with USB_PROP_IS_RAM to
393 * return RAM data.
394 */
395#define USB_PROP_IS_RAM (1 << 15)
396/* If this property is set for a descriptor, the data is read from RAM
397 * memory instead of Flash. The property is used for all methods to provide
398 * external descriptors.
399 */
400#define USB_PROP_LENGTH(len) ((len)&0x3fff)
401/* If a static external descriptor is used, this is the total length of the
402 * descriptor in bytes.
403 */
404
405/* all descriptors which may have properties: */
406#ifndef USB_CFG_DESCR_PROPS_DEVICE
407# define USB_CFG_DESCR_PROPS_DEVICE 0
408#endif
409#ifndef USB_CFG_DESCR_PROPS_CONFIGURATION
410# define USB_CFG_DESCR_PROPS_CONFIGURATION 0
411#endif
412#ifndef USB_CFG_DESCR_PROPS_STRINGS
413# define USB_CFG_DESCR_PROPS_STRINGS 0
414#endif
415#ifndef USB_CFG_DESCR_PROPS_STRING_0
416# define USB_CFG_DESCR_PROPS_STRING_0 0
417#endif
418#ifndef USB_CFG_DESCR_PROPS_STRING_VENDOR
419# define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
420#endif
421#ifndef USB_CFG_DESCR_PROPS_STRING_PRODUCT
422# define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
423#endif
424#ifndef USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
425# define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
426#endif
427#ifndef USB_CFG_DESCR_PROPS_HID
428# define USB_CFG_DESCR_PROPS_HID 0
429#endif
430#if !(USB_CFG_DESCR_PROPS_HID_REPORT)
431# undef USB_CFG_DESCR_PROPS_HID_REPORT
432# if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* do some backward compatibility tricks */
433# define USB_CFG_DESCR_PROPS_HID_REPORT USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH
434# else
435# define USB_CFG_DESCR_PROPS_HID_REPORT 0
436# endif
437#endif
438#ifndef USB_CFG_DESCR_PROPS_UNKNOWN
439# define USB_CFG_DESCR_PROPS_UNKNOWN 0
440#endif
441
442/* ------------------ forward declaration of descriptors ------------------- */
443/* If you use external static descriptors, they must be stored in global
444 * arrays as declared below:
445 */
446#ifndef __ASSEMBLER__
447extern
448# if !(USB_CFG_DESCR_PROPS_DEVICE & USB_PROP_IS_RAM)
449 PROGMEM
450# endif
451 const char usbDescriptorDevice[];
452
453extern
454# if !(USB_CFG_DESCR_PROPS_CONFIGURATION & USB_PROP_IS_RAM)
455 PROGMEM
456# endif
457 const char usbDescriptorConfiguration[];
458
459extern
460# if !(USB_CFG_DESCR_PROPS_HID_REPORT & USB_PROP_IS_RAM)
461 PROGMEM
462# endif
463 const char usbDescriptorHidReport[];
464
465extern
466# if !(USB_CFG_DESCR_PROPS_STRING_0 & USB_PROP_IS_RAM)
467 PROGMEM
468# endif
469 const char usbDescriptorString0[];
470
471extern
472# if !(USB_CFG_DESCR_PROPS_STRING_VENDOR & USB_PROP_IS_RAM)
473 PROGMEM
474# endif
475 const int usbDescriptorStringVendor[];
476
477extern
478# if !(USB_CFG_DESCR_PROPS_STRING_PRODUCT & USB_PROP_IS_RAM)
479 PROGMEM
480# endif
481 const int usbDescriptorStringDevice[];
482
483extern
484# if !(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER & USB_PROP_IS_RAM)
485 PROGMEM
486# endif
487 const int usbDescriptorStringSerialNumber[];
488
489#endif /* __ASSEMBLER__ */
490
491/* ------------------------------------------------------------------------- */
492/* ------------------------ General Purpose Macros ------------------------- */
493/* ------------------------------------------------------------------------- */
494
495#define USB_CONCAT(a, b) a##b
496#define USB_CONCAT_EXPANDED(a, b) USB_CONCAT(a, b)
497
498#define USB_OUTPORT(name) USB_CONCAT(PORT, name)
499#define USB_INPORT(name) USB_CONCAT(PIN, name)
500#define USB_DDRPORT(name) USB_CONCAT(DDR, name)
501/* The double-define trick above lets us concatenate strings which are
502 * defined by macros.
503 */
504
505/* ------------------------------------------------------------------------- */
506/* ------------------------- Constant definitions -------------------------- */
507/* ------------------------------------------------------------------------- */
508
509#if !defined __ASSEMBLER__ && (!defined USB_CFG_VENDOR_ID || !defined USB_CFG_DEVICE_ID)
510# warning "You should define USB_CFG_VENDOR_ID and USB_CFG_DEVICE_ID in usbconfig.h"
511/* If the user has not defined IDs, we default to obdev's free IDs.
512 * See USB-IDs-for-free.txt for details.
513 */
514#endif
515
516/* make sure we have a VID and PID defined, byte order is lowbyte, highbyte */
517#ifndef USB_CFG_VENDOR_ID
518# define USB_CFG_VENDOR_ID 0xc0, 0x16 /* = 0x16c0 = 5824 = voti.nl */
519#endif
520
521#ifndef USB_CFG_DEVICE_ID
522# if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH
523# define USB_CFG_DEVICE_ID 0xdf, 0x05 /* = 0x5df = 1503, shared PID for HIDs */
524# elif USB_CFG_INTERFACE_CLASS == 2
525# define USB_CFG_DEVICE_ID 0xe1, 0x05 /* = 0x5e1 = 1505, shared PID for CDC Modems */
526# else
527# define USB_CFG_DEVICE_ID 0xdc, 0x05 /* = 0x5dc = 1500, obdev's free PID */
528# endif
529#endif
530
531/* Derive Output, Input and DataDirection ports from port names */
532#ifndef USB_CFG_IOPORTNAME
533# error "You must define USB_CFG_IOPORTNAME in usbconfig.h, see usbconfig-prototype.h"
534#endif
535
536#define USBOUT USB_OUTPORT(USB_CFG_IOPORTNAME)
537#define USB_PULLUP_OUT USB_OUTPORT(USB_CFG_PULLUP_IOPORTNAME)
538#define USBIN USB_INPORT(USB_CFG_IOPORTNAME)
539#define USBDDR USB_DDRPORT(USB_CFG_IOPORTNAME)
540#define USB_PULLUP_DDR USB_DDRPORT(USB_CFG_PULLUP_IOPORTNAME)
541
542#define USBMINUS USB_CFG_DMINUS_BIT
543#define USBPLUS USB_CFG_DPLUS_BIT
544#define USBIDLE (1 << USB_CFG_DMINUS_BIT) /* value representing J state */
545#define USBMASK ((1 << USB_CFG_DPLUS_BIT) | (1 << USB_CFG_DMINUS_BIT)) /* mask for USB I/O bits */
546
547/* defines for backward compatibility with older driver versions: */
548#define USB_CFG_IOPORT USB_OUTPORT(USB_CFG_IOPORTNAME)
549#ifdef USB_CFG_PULLUP_IOPORTNAME
550# define USB_CFG_PULLUP_IOPORT USB_OUTPORT(USB_CFG_PULLUP_IOPORTNAME)
551#endif
552
553#ifndef USB_CFG_EP3_NUMBER /* if not defined in usbconfig.h */
554# define USB_CFG_EP3_NUMBER 3
555#endif
556
557#ifndef USB_CFG_HAVE_INTRIN_ENDPOINT3
558# define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
559#endif
560
561#define USB_BUFSIZE 11 /* PID, 8 bytes data, 2 bytes CRC */
562
563/* ----- Try to find registers and bits responsible for ext interrupt 0 ----- */
564
565#ifndef USB_INTR_CFG /* allow user to override our default */
566# if defined EICRA
567# define USB_INTR_CFG EICRA
568# else
569# define USB_INTR_CFG MCUCR
570# endif
571#endif
572#ifndef USB_INTR_CFG_SET /* allow user to override our default */
573# if defined(USB_COUNT_SOF) || defined(USB_SOF_HOOK)
574# define USB_INTR_CFG_SET (1 << ISC01) /* cfg for falling edge */
575 /* If any SOF logic is used, the interrupt must be wired to D- where
576 * we better trigger on falling edge
577 */
578# else
579# define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) /* cfg for rising edge */
580# endif
581#endif
582#ifndef USB_INTR_CFG_CLR /* allow user to override our default */
583# define USB_INTR_CFG_CLR 0 /* no bits to clear */
584#endif
585
586#ifndef USB_INTR_ENABLE /* allow user to override our default */
587# if defined GIMSK
588# define USB_INTR_ENABLE GIMSK
589# elif defined EIMSK
590# define USB_INTR_ENABLE EIMSK
591# else
592# define USB_INTR_ENABLE GICR
593# endif
594#endif
595#ifndef USB_INTR_ENABLE_BIT /* allow user to override our default */
596# define USB_INTR_ENABLE_BIT INT0
597#endif
598
599#ifndef USB_INTR_PENDING /* allow user to override our default */
600# if defined EIFR
601# define USB_INTR_PENDING EIFR
602# else
603# define USB_INTR_PENDING GIFR
604# endif
605#endif
606#ifndef USB_INTR_PENDING_BIT /* allow user to override our default */
607# define USB_INTR_PENDING_BIT INTF0
608#endif
609
610/*
611The defines above don't work for the following chips
612at90c8534: no ISC0?, no PORTB, can't find a data sheet
613at86rf401: no PORTB, no MCUCR etc, low clock rate
614atmega103: no ISC0? (maybe omission in header, can't find data sheet)
615atmega603: not defined in avr-libc
616at43usb320, at43usb355, at76c711: have USB anyway
617at94k: is different...
618
619at90s1200, attiny11, attiny12, attiny15, attiny28: these have no RAM
620*/
621
622/* ------------------------------------------------------------------------- */
623/* ----------------- USB Specification Constants and Types ----------------- */
624/* ------------------------------------------------------------------------- */
625
626/* USB Token values */
627#define USBPID_SETUP 0x2d
628#define USBPID_OUT 0xe1
629#define USBPID_IN 0x69
630#define USBPID_DATA0 0xc3
631#define USBPID_DATA1 0x4b
632
633#define USBPID_ACK 0xd2
634#define USBPID_NAK 0x5a
635#define USBPID_STALL 0x1e
636
637#ifndef USB_INITIAL_DATATOKEN
638# define USB_INITIAL_DATATOKEN USBPID_DATA1
639#endif
640
641#ifndef __ASSEMBLER__
642
643typedef struct usbTxStatus {
644 volatile uchar len;
645 uchar buffer[USB_BUFSIZE];
646} usbTxStatus_t;
647
648extern usbTxStatus_t usbTxStatus1, usbTxStatus3;
649# define usbTxLen1 usbTxStatus1.len
650# define usbTxBuf1 usbTxStatus1.buffer
651# define usbTxLen3 usbTxStatus3.len
652# define usbTxBuf3 usbTxStatus3.buffer
653
654typedef union usbWord {
655 unsigned word;
656 uchar bytes[2];
657} usbWord_t;
658
659typedef struct usbRequest {
660 uchar bmRequestType;
661 uchar bRequest;
662 usbWord_t wValue;
663 usbWord_t wIndex;
664 usbWord_t wLength;
665} usbRequest_t;
666/* This structure matches the 8 byte setup request */
667#endif
668
669/* bmRequestType field in USB setup:
670 * d t t r r r r r, where
671 * d ..... direction: 0=host->device, 1=device->host
672 * t ..... type: 0=standard, 1=class, 2=vendor, 3=reserved
673 * r ..... recipient: 0=device, 1=interface, 2=endpoint, 3=other
674 */
675
676/* USB setup recipient values */
677#define USBRQ_RCPT_MASK 0x1f
678#define USBRQ_RCPT_DEVICE 0
679#define USBRQ_RCPT_INTERFACE 1
680#define USBRQ_RCPT_ENDPOINT 2
681
682/* USB request type values */
683#define USBRQ_TYPE_MASK 0x60
684#define USBRQ_TYPE_STANDARD (0 << 5)
685#define USBRQ_TYPE_CLASS (1 << 5)
686#define USBRQ_TYPE_VENDOR (2 << 5)
687
688/* USB direction values: */
689#define USBRQ_DIR_MASK 0x80
690#define USBRQ_DIR_HOST_TO_DEVICE (0 << 7)
691#define USBRQ_DIR_DEVICE_TO_HOST (1 << 7)
692
693/* USB Standard Requests */
694#define USBRQ_GET_STATUS 0
695#define USBRQ_CLEAR_FEATURE 1
696#define USBRQ_SET_FEATURE 3
697#define USBRQ_SET_ADDRESS 5
698#define USBRQ_GET_DESCRIPTOR 6
699#define USBRQ_SET_DESCRIPTOR 7
700#define USBRQ_GET_CONFIGURATION 8
701#define USBRQ_SET_CONFIGURATION 9
702#define USBRQ_GET_INTERFACE 10
703#define USBRQ_SET_INTERFACE 11
704#define USBRQ_SYNCH_FRAME 12
705
706/* USB descriptor constants */
707#define USBDESCR_DEVICE 1
708#define USBDESCR_CONFIG 2
709#define USBDESCR_STRING 3
710#define USBDESCR_INTERFACE 4
711#define USBDESCR_ENDPOINT 5
712#define USBDESCR_HID 0x21
713#define USBDESCR_HID_REPORT 0x22
714#define USBDESCR_HID_PHYS 0x23
715
716//#define USBATTR_BUSPOWER 0x80 // USB 1.1 does not define this value any more
717#define USBATTR_SELFPOWER 0x40
718#define USBATTR_REMOTEWAKE 0x20
719
720/* USB HID Requests */
721#define USBRQ_HID_GET_REPORT 0x01
722#define USBRQ_HID_GET_IDLE 0x02
723#define USBRQ_HID_GET_PROTOCOL 0x03
724#define USBRQ_HID_SET_REPORT 0x09
725#define USBRQ_HID_SET_IDLE 0x0a
726#define USBRQ_HID_SET_PROTOCOL 0x0b
727
728/* ------------------------------------------------------------------------- */
729
730#endif /* __usbdrv_h_included__ */
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm.S b/tmk_core/protocol/vusb/usbdrv/usbdrvasm.S
deleted file mode 100644
index 2e8097da9c..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm.S
+++ /dev/null
@@ -1,393 +0,0 @@
1/* Name: usbdrvasm.S
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2007-06-13
5 * Tabsize: 4
6 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * Revision: $Id: usbdrvasm.S 785 2010-05-30 17:57:07Z cs $
9 */
10
11/*
12General Description:
13This module is the assembler part of the USB driver. This file contains
14general code (preprocessor acrobatics and CRC computation) and then includes
15the file appropriate for the given clock rate.
16*/
17
18#define __SFR_OFFSET 0 /* used by avr-libc's register definitions */
19#include "usbportability.h"
20#include "usbdrv.h" /* for common defs */
21
22/* register names */
23#define x1 r16
24#define x2 r17
25#define shift r18
26#define cnt r19
27#define x3 r20
28#define x4 r21
29#define x5 r22
30#define bitcnt x5
31#define phase x4
32#define leap x4
33
34/* Some assembler dependent definitions and declarations: */
35
36#ifdef __IAR_SYSTEMS_ASM__
37 extern usbRxBuf, usbDeviceAddr, usbNewDeviceAddr, usbInputBufOffset
38 extern usbCurrentTok, usbRxLen, usbRxToken, usbTxLen
39 extern usbTxBuf, usbTxStatus1, usbTxStatus3
40# if USB_COUNT_SOF
41 extern usbSofCount
42# endif
43 public usbCrc16
44 public usbCrc16Append
45
46 COMMON INTVEC
47# ifndef USB_INTR_VECTOR
48 ORG INT0_vect
49# else /* USB_INTR_VECTOR */
50 ORG USB_INTR_VECTOR
51# undef USB_INTR_VECTOR
52# endif /* USB_INTR_VECTOR */
53# define USB_INTR_VECTOR usbInterruptHandler
54 rjmp USB_INTR_VECTOR
55 RSEG CODE
56
57#else /* __IAR_SYSTEMS_ASM__ */
58
59# ifndef USB_INTR_VECTOR /* default to hardware interrupt INT0 */
60# ifdef INT0_vect
61# define USB_INTR_VECTOR INT0_vect // this is the "new" define for the vector
62# else
63# define USB_INTR_VECTOR SIG_INTERRUPT0 // this is the "old" vector
64# endif
65# endif
66 .text
67 .global USB_INTR_VECTOR
68 .type USB_INTR_VECTOR, @function
69 .global usbCrc16
70 .global usbCrc16Append
71#endif /* __IAR_SYSTEMS_ASM__ */
72
73
74#if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */
75# define USB_LOAD_PENDING(reg) in reg, USB_INTR_PENDING
76# define USB_STORE_PENDING(reg) out USB_INTR_PENDING, reg
77#else /* It's a memory address, use lds and sts */
78# define USB_LOAD_PENDING(reg) lds reg, USB_INTR_PENDING
79# define USB_STORE_PENDING(reg) sts USB_INTR_PENDING, reg
80#endif
81
82#define usbTxLen1 usbTxStatus1
83#define usbTxBuf1 (usbTxStatus1 + 1)
84#define usbTxLen3 usbTxStatus3
85#define usbTxBuf3 (usbTxStatus3 + 1)
86
87
88;----------------------------------------------------------------------------
89; Utility functions
90;----------------------------------------------------------------------------
91
92#ifdef __IAR_SYSTEMS_ASM__
93/* Register assignments for usbCrc16 on IAR cc */
94/* Calling conventions on IAR:
95 * First parameter passed in r16/r17, second in r18/r19 and so on.
96 * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer)
97 * Result is passed in r16/r17
98 * In case of the "tiny" memory model, pointers are only 8 bit with no
99 * padding. We therefore pass argument 1 as "16 bit unsigned".
100 */
101RTMODEL "__rt_version", "3"
102/* The line above will generate an error if cc calling conventions change.
103 * The value "3" above is valid for IAR 4.10B/W32
104 */
105# define argLen r18 /* argument 2 */
106# define argPtrL r16 /* argument 1 */
107# define argPtrH r17 /* argument 1 */
108
109# define resCrcL r16 /* result */
110# define resCrcH r17 /* result */
111
112# define ptrL ZL
113# define ptrH ZH
114# define ptr Z
115# define byte r22
116# define bitCnt r19
117# define polyL r20
118# define polyH r21
119# define scratch r23
120
121#else /* __IAR_SYSTEMS_ASM__ */
122/* Register assignments for usbCrc16 on gcc */
123/* Calling conventions on gcc:
124 * First parameter passed in r24/r25, second in r22/23 and so on.
125 * Callee must preserve r1-r17, r28/r29
126 * Result is passed in r24/r25
127 */
128# define argLen r22 /* argument 2 */
129# define argPtrL r24 /* argument 1 */
130# define argPtrH r25 /* argument 1 */
131
132# define resCrcL r24 /* result */
133# define resCrcH r25 /* result */
134
135# define ptrL XL
136# define ptrH XH
137# define ptr x
138# define byte r18
139# define bitCnt r19
140# define polyL r20
141# define polyH r21
142# define scratch r23
143
144#endif
145
146#if USB_USE_FAST_CRC
147
148; This implementation is faster, but has bigger code size
149; Thanks to Slawomir Fras (BoskiDialer) for this code!
150; It implements the following C pseudo-code:
151; unsigned table(unsigned char x)
152; {
153; unsigned value;
154;
155; value = (unsigned)x << 6;
156; value ^= (unsigned)x << 7;
157; if(parity(x))
158; value ^= 0xc001;
159; return value;
160; }
161; unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen)
162; {
163; unsigned crc = 0xffff;
164;
165; while(argLen--)
166; crc = table(lo8(crc) ^ *argPtr++) ^ hi8(crc);
167; return ~crc;
168; }
169
170; extern unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen);
171; argPtr r24+25 / r16+r17
172; argLen r22 / r18
173; temp variables:
174; byte r18 / r22
175; scratch r23
176; resCrc r24+r25 / r16+r17
177; ptr X / Z
178usbCrc16:
179 mov ptrL, argPtrL
180 mov ptrH, argPtrH
181 ldi resCrcL, 0xFF
182 ldi resCrcH, 0xFF
183 rjmp usbCrc16LoopTest
184usbCrc16ByteLoop:
185 ld byte, ptr+
186 eor resCrcL, byte ; resCrcL is now 'x' in table()
187 mov byte, resCrcL ; compute parity of 'x'
188 swap byte
189 eor byte, resCrcL
190 mov scratch, byte
191 lsr byte
192 lsr byte
193 eor byte, scratch
194 inc byte
195 lsr byte
196 andi byte, 1 ; byte is now parity(x)
197 mov scratch, resCrcL
198 mov resCrcL, resCrcH
199 eor resCrcL, byte ; low byte of if(parity(x)) value ^= 0xc001;
200 neg byte
201 andi byte, 0xc0
202 mov resCrcH, byte ; high byte of if(parity(x)) value ^= 0xc001;
203 clr byte
204 lsr scratch
205 ror byte
206 eor resCrcH, scratch
207 eor resCrcL, byte
208 lsr scratch
209 ror byte
210 eor resCrcH, scratch
211 eor resCrcL, byte
212usbCrc16LoopTest:
213 subi argLen, 1
214 brsh usbCrc16ByteLoop
215 com resCrcL
216 com resCrcH
217 ret
218
219#else /* USB_USE_FAST_CRC */
220
221; This implementation is slower, but has less code size
222;
223; extern unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen);
224; argPtr r24+25 / r16+r17
225; argLen r22 / r18
226; temp variables:
227; byte r18 / r22
228; bitCnt r19
229; poly r20+r21
230; scratch r23
231; resCrc r24+r25 / r16+r17
232; ptr X / Z
233usbCrc16:
234 mov ptrL, argPtrL
235 mov ptrH, argPtrH
236 ldi resCrcL, 0
237 ldi resCrcH, 0
238 ldi polyL, lo8(0xa001)
239 ldi polyH, hi8(0xa001)
240 com argLen ; argLen = -argLen - 1: modified loop to ensure that carry is set
241 ldi bitCnt, 0 ; loop counter with starnd condition = end condition
242 rjmp usbCrcLoopEntry
243usbCrcByteLoop:
244 ld byte, ptr+
245 eor resCrcL, byte
246usbCrcBitLoop:
247 ror resCrcH ; carry is always set here (see brcs jumps to here)
248 ror resCrcL
249 brcs usbCrcNoXor
250 eor resCrcL, polyL
251 eor resCrcH, polyH
252usbCrcNoXor:
253 subi bitCnt, 224 ; (8 * 224) % 256 = 0; this loop iterates 8 times
254 brcs usbCrcBitLoop
255usbCrcLoopEntry:
256 subi argLen, -1
257 brcs usbCrcByteLoop
258usbCrcReady:
259 ret
260; Thanks to Reimar Doeffinger for optimizing this CRC routine!
261
262#endif /* USB_USE_FAST_CRC */
263
264; extern unsigned usbCrc16Append(unsigned char *data, unsigned char len);
265usbCrc16Append:
266 rcall usbCrc16
267 st ptr+, resCrcL
268 st ptr+, resCrcH
269 ret
270
271#undef argLen
272#undef argPtrL
273#undef argPtrH
274#undef resCrcL
275#undef resCrcH
276#undef ptrL
277#undef ptrH
278#undef ptr
279#undef byte
280#undef bitCnt
281#undef polyL
282#undef polyH
283#undef scratch
284
285
286#if USB_CFG_HAVE_MEASURE_FRAME_LENGTH
287#ifdef __IAR_SYSTEMS_ASM__
288/* Register assignments for usbMeasureFrameLength on IAR cc */
289/* Calling conventions on IAR:
290 * First parameter passed in r16/r17, second in r18/r19 and so on.
291 * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer)
292 * Result is passed in r16/r17
293 * In case of the "tiny" memory model, pointers are only 8 bit with no
294 * padding. We therefore pass argument 1 as "16 bit unsigned".
295 */
296# define resL r16
297# define resH r17
298# define cnt16L r30
299# define cnt16H r31
300# define cntH r18
301
302#else /* __IAR_SYSTEMS_ASM__ */
303/* Register assignments for usbMeasureFrameLength on gcc */
304/* Calling conventions on gcc:
305 * First parameter passed in r24/r25, second in r22/23 and so on.
306 * Callee must preserve r1-r17, r28/r29
307 * Result is passed in r24/r25
308 */
309# define resL r24
310# define resH r25
311# define cnt16L r24
312# define cnt16H r25
313# define cntH r26
314#endif
315# define cnt16 cnt16L
316
317; extern unsigned usbMeasurePacketLength(void);
318; returns time between two idle strobes in multiples of 7 CPU clocks
319.global usbMeasureFrameLength
320usbMeasureFrameLength:
321 ldi cntH, 6 ; wait ~ 10 ms for D- == 0
322 clr cnt16L
323 clr cnt16H
324usbMFTime16:
325 dec cntH
326 breq usbMFTimeout
327usbMFWaitStrobe: ; first wait for D- == 0 (idle strobe)
328 sbiw cnt16, 1 ;[0] [6]
329 breq usbMFTime16 ;[2]
330 sbic USBIN, USBMINUS ;[3]
331 rjmp usbMFWaitStrobe ;[4]
332usbMFWaitIdle: ; then wait until idle again
333 sbis USBIN, USBMINUS ;1 wait for D- == 1
334 rjmp usbMFWaitIdle ;2
335 ldi cnt16L, 1 ;1 represents cycles so far
336 clr cnt16H ;1
337usbMFWaitLoop:
338 in cntH, USBIN ;[0] [7]
339 adiw cnt16, 1 ;[1]
340 breq usbMFTimeout ;[3]
341 andi cntH, USBMASK ;[4]
342 brne usbMFWaitLoop ;[5]
343usbMFTimeout:
344#if resL != cnt16L
345 mov resL, cnt16L
346 mov resH, cnt16H
347#endif
348 ret
349
350#undef resL
351#undef resH
352#undef cnt16
353#undef cnt16L
354#undef cnt16H
355#undef cntH
356
357#endif /* USB_CFG_HAVE_MEASURE_FRAME_LENGTH */
358
359;----------------------------------------------------------------------------
360; Now include the clock rate specific code
361;----------------------------------------------------------------------------
362
363#ifndef USB_CFG_CLOCK_KHZ
364# ifdef F_CPU
365# define USB_CFG_CLOCK_KHZ (F_CPU/1000)
366# else
367# error "USB_CFG_CLOCK_KHZ not defined in usbconfig.h and no F_CPU set!"
368# endif
369#endif
370
371#if USB_CFG_CHECK_CRC /* separate dispatcher for CRC type modules */
372# if USB_CFG_CLOCK_KHZ == 18000
373# include "usbdrvasm18-crc.inc"
374# else
375# error "USB_CFG_CLOCK_KHZ is not one of the supported crc-rates!"
376# endif
377#else /* USB_CFG_CHECK_CRC */
378# if USB_CFG_CLOCK_KHZ == 12000
379# include "usbdrvasm12.inc"
380# elif USB_CFG_CLOCK_KHZ == 12800
381# include "usbdrvasm128.inc"
382# elif USB_CFG_CLOCK_KHZ == 15000
383# include "usbdrvasm15.inc"
384# elif USB_CFG_CLOCK_KHZ == 16000
385# include "usbdrvasm16.inc"
386# elif USB_CFG_CLOCK_KHZ == 16500
387# include "usbdrvasm165.inc"
388# elif USB_CFG_CLOCK_KHZ == 20000
389# include "usbdrvasm20.inc"
390# else
391# error "USB_CFG_CLOCK_KHZ is not one of the supported non-crc-rates!"
392# endif
393#endif /* USB_CFG_CHECK_CRC */
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm.asm b/tmk_core/protocol/vusb/usbdrv/usbdrvasm.asm
deleted file mode 100644
index 9cc4e4d739..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm.asm
+++ /dev/null
@@ -1,21 +0,0 @@
1/* Name: usbdrvasm.asm
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2006-03-01
5 * Tabsize: 4
6 * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id$
9 */
10
11/*
12General Description:
13The IAR compiler/assembler system prefers assembler files with file extension
14".asm". We simply provide this file as an alias for usbdrvasm.S.
15
16Thanks to Oleg Semyonov for his help with the IAR tools port!
17*/
18
19#include "usbdrvasm.S"
20
21end
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc
deleted file mode 100644
index c1167584cb..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc
+++ /dev/null
@@ -1,393 +0,0 @@
1/* Name: usbdrvasm12.inc
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2004-12-29
5 * Tabsize: 4
6 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: usbdrvasm12.inc 740 2009-04-13 18:23:31Z cs $
9 */
10
11/* Do not link this file! Link usbdrvasm.S instead, which includes the
12 * appropriate implementation!
13 */
14
15/*
16General Description:
17This file is the 12 MHz version of the asssembler part of the USB driver. It
18requires a 12 MHz crystal (not a ceramic resonator and not a calibrated RC
19oscillator).
20
21See usbdrv.h for a description of the entire driver.
22
23Since almost all of this code is timing critical, don't change unless you
24really know what you are doing! Many parts require not only a maximum number
25of CPU cycles, but even an exact number of cycles!
26
27
28Timing constraints according to spec (in bit times):
29timing subject min max CPUcycles
30---------------------------------------------------------------------------
31EOP of OUT/SETUP to sync pattern of DATA0 (both rx) 2 16 16-128
32EOP of IN to sync pattern of DATA0 (rx, then tx) 2 7.5 16-60
33DATAx (rx) to ACK/NAK/STALL (tx) 2 7.5 16-60
34*/
35
36;Software-receiver engine. Strict timing! Don't change unless you can preserve timing!
37;interrupt response time: 4 cycles + insn running = 7 max if interrupts always enabled
38;max allowable interrupt latency: 34 cycles -> max 25 cycles interrupt disable
39;max stack usage: [ret(2), YL, SREG, YH, shift, x1, x2, x3, cnt, x4] = 11 bytes
40;Numbers in brackets are maximum cycles since SOF.
41USB_INTR_VECTOR:
42;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt
43 push YL ;2 [35] push only what is necessary to sync with edge ASAP
44 in YL, SREG ;1 [37]
45 push YL ;2 [39]
46;----------------------------------------------------------------------------
47; Synchronize with sync pattern:
48;----------------------------------------------------------------------------
49;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K]
50;sync up with J to K edge during sync pattern -- use fastest possible loops
51;The first part waits at most 1 bit long since we must be in sync pattern.
52;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to
53;waitForJ, ensure that this prerequisite is met.
54waitForJ:
55 inc YL
56 sbis USBIN, USBMINUS
57 brne waitForJ ; just make sure we have ANY timeout
58waitForK:
59;The following code results in a sampling window of 1/4 bit which meets the spec.
60 sbis USBIN, USBMINUS
61 rjmp foundK
62 sbis USBIN, USBMINUS
63 rjmp foundK
64 sbis USBIN, USBMINUS
65 rjmp foundK
66 sbis USBIN, USBMINUS
67 rjmp foundK
68 sbis USBIN, USBMINUS
69 rjmp foundK
70#if USB_COUNT_SOF
71 lds YL, usbSofCount
72 inc YL
73 sts usbSofCount, YL
74#endif /* USB_COUNT_SOF */
75#ifdef USB_SOF_HOOK
76 USB_SOF_HOOK
77#endif
78 rjmp sofError
79foundK:
80;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling]
81;we have 1 bit time for setup purposes, then sample again. Numbers in brackets
82;are cycles from center of first sync (double K) bit after the instruction
83 push YH ;2 [2]
84 lds YL, usbInputBufOffset;2 [4]
85 clr YH ;1 [5]
86 subi YL, lo8(-(usbRxBuf));1 [6]
87 sbci YH, hi8(-(usbRxBuf));1 [7]
88
89 sbis USBIN, USBMINUS ;1 [8] we want two bits K [sample 1 cycle too early]
90 rjmp haveTwoBitsK ;2 [10]
91 pop YH ;2 [11] undo the push from before
92 rjmp waitForK ;2 [13] this was not the end of sync, retry
93haveTwoBitsK:
94;----------------------------------------------------------------------------
95; push more registers and initialize values while we sample the first bits:
96;----------------------------------------------------------------------------
97 push shift ;2 [16]
98 push x1 ;2 [12]
99 push x2 ;2 [14]
100
101 in x1, USBIN ;1 [17] <-- sample bit 0
102 ldi shift, 0xff ;1 [18]
103 bst x1, USBMINUS ;1 [19]
104 bld shift, 0 ;1 [20]
105 push x3 ;2 [22]
106 push cnt ;2 [24]
107
108 in x2, USBIN ;1 [25] <-- sample bit 1
109 ser x3 ;1 [26] [inserted init instruction]
110 eor x1, x2 ;1 [27]
111 bst x1, USBMINUS ;1 [28]
112 bld shift, 1 ;1 [29]
113 ldi cnt, USB_BUFSIZE;1 [30] [inserted init instruction]
114 rjmp rxbit2 ;2 [32]
115
116;----------------------------------------------------------------------------
117; Receiver loop (numbers in brackets are cycles within byte after instr)
118;----------------------------------------------------------------------------
119
120unstuff0: ;1 (branch taken)
121 andi x3, ~0x01 ;1 [15]
122 mov x1, x2 ;1 [16] x2 contains last sampled (stuffed) bit
123 in x2, USBIN ;1 [17] <-- sample bit 1 again
124 ori shift, 0x01 ;1 [18]
125 rjmp didUnstuff0 ;2 [20]
126
127unstuff1: ;1 (branch taken)
128 mov x2, x1 ;1 [21] x1 contains last sampled (stuffed) bit
129 andi x3, ~0x02 ;1 [22]
130 ori shift, 0x02 ;1 [23]
131 nop ;1 [24]
132 in x1, USBIN ;1 [25] <-- sample bit 2 again
133 rjmp didUnstuff1 ;2 [27]
134
135unstuff2: ;1 (branch taken)
136 andi x3, ~0x04 ;1 [29]
137 ori shift, 0x04 ;1 [30]
138 mov x1, x2 ;1 [31] x2 contains last sampled (stuffed) bit
139 nop ;1 [32]
140 in x2, USBIN ;1 [33] <-- sample bit 3
141 rjmp didUnstuff2 ;2 [35]
142
143unstuff3: ;1 (branch taken)
144 in x2, USBIN ;1 [34] <-- sample stuffed bit 3 [one cycle too late]
145 andi x3, ~0x08 ;1 [35]
146 ori shift, 0x08 ;1 [36]
147 rjmp didUnstuff3 ;2 [38]
148
149unstuff4: ;1 (branch taken)
150 andi x3, ~0x10 ;1 [40]
151 in x1, USBIN ;1 [41] <-- sample stuffed bit 4
152 ori shift, 0x10 ;1 [42]
153 rjmp didUnstuff4 ;2 [44]
154
155unstuff5: ;1 (branch taken)
156 andi x3, ~0x20 ;1 [48]
157 in x2, USBIN ;1 [49] <-- sample stuffed bit 5
158 ori shift, 0x20 ;1 [50]
159 rjmp didUnstuff5 ;2 [52]
160
161unstuff6: ;1 (branch taken)
162 andi x3, ~0x40 ;1 [56]
163 in x1, USBIN ;1 [57] <-- sample stuffed bit 6
164 ori shift, 0x40 ;1 [58]
165 rjmp didUnstuff6 ;2 [60]
166
167; extra jobs done during bit interval:
168; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs]
169; bit 1: se0 check
170; bit 2: overflow check
171; bit 3: recovery from delay [bit 0 tasks took too long]
172; bit 4: none
173; bit 5: none
174; bit 6: none
175; bit 7: jump, eor
176rxLoop:
177 eor x3, shift ;1 [0] reconstruct: x3 is 0 at bit locations we changed, 1 at others
178 in x1, USBIN ;1 [1] <-- sample bit 0
179 st y+, x3 ;2 [3] store data
180 ser x3 ;1 [4]
181 nop ;1 [5]
182 eor x2, x1 ;1 [6]
183 bst x2, USBMINUS;1 [7]
184 bld shift, 0 ;1 [8]
185 in x2, USBIN ;1 [9] <-- sample bit 1 (or possibly bit 0 stuffed)
186 andi x2, USBMASK ;1 [10]
187 breq se0 ;1 [11] SE0 check for bit 1
188 andi shift, 0xf9 ;1 [12]
189didUnstuff0:
190 breq unstuff0 ;1 [13]
191 eor x1, x2 ;1 [14]
192 bst x1, USBMINUS;1 [15]
193 bld shift, 1 ;1 [16]
194rxbit2:
195 in x1, USBIN ;1 [17] <-- sample bit 2 (or possibly bit 1 stuffed)
196 andi shift, 0xf3 ;1 [18]
197 breq unstuff1 ;1 [19] do remaining work for bit 1
198didUnstuff1:
199 subi cnt, 1 ;1 [20]
200 brcs overflow ;1 [21] loop control
201 eor x2, x1 ;1 [22]
202 bst x2, USBMINUS;1 [23]
203 bld shift, 2 ;1 [24]
204 in x2, USBIN ;1 [25] <-- sample bit 3 (or possibly bit 2 stuffed)
205 andi shift, 0xe7 ;1 [26]
206 breq unstuff2 ;1 [27]
207didUnstuff2:
208 eor x1, x2 ;1 [28]
209 bst x1, USBMINUS;1 [29]
210 bld shift, 3 ;1 [30]
211didUnstuff3:
212 andi shift, 0xcf ;1 [31]
213 breq unstuff3 ;1 [32]
214 in x1, USBIN ;1 [33] <-- sample bit 4
215 eor x2, x1 ;1 [34]
216 bst x2, USBMINUS;1 [35]
217 bld shift, 4 ;1 [36]
218didUnstuff4:
219 andi shift, 0x9f ;1 [37]
220 breq unstuff4 ;1 [38]
221 nop2 ;2 [40]
222 in x2, USBIN ;1 [41] <-- sample bit 5
223 eor x1, x2 ;1 [42]
224 bst x1, USBMINUS;1 [43]
225 bld shift, 5 ;1 [44]
226didUnstuff5:
227 andi shift, 0x3f ;1 [45]
228 breq unstuff5 ;1 [46]
229 nop2 ;2 [48]
230 in x1, USBIN ;1 [49] <-- sample bit 6
231 eor x2, x1 ;1 [50]
232 bst x2, USBMINUS;1 [51]
233 bld shift, 6 ;1 [52]
234didUnstuff6:
235 cpi shift, 0x02 ;1 [53]
236 brlo unstuff6 ;1 [54]
237 nop2 ;2 [56]
238 in x2, USBIN ;1 [57] <-- sample bit 7
239 eor x1, x2 ;1 [58]
240 bst x1, USBMINUS;1 [59]
241 bld shift, 7 ;1 [60]
242didUnstuff7:
243 cpi shift, 0x04 ;1 [61]
244 brsh rxLoop ;2 [63] loop control
245unstuff7:
246 andi x3, ~0x80 ;1 [63]
247 ori shift, 0x80 ;1 [64]
248 in x2, USBIN ;1 [65] <-- sample stuffed bit 7
249 nop ;1 [66]
250 rjmp didUnstuff7 ;2 [68]
251
252macro POP_STANDARD ; 12 cycles
253 pop cnt
254 pop x3
255 pop x2
256 pop x1
257 pop shift
258 pop YH
259 endm
260macro POP_RETI ; 5 cycles
261 pop YL
262 out SREG, YL
263 pop YL
264 endm
265
266#include "asmcommon.inc"
267
268;----------------------------------------------------------------------------
269; Transmitting data
270;----------------------------------------------------------------------------
271
272txByteLoop:
273txBitloop:
274stuffN1Delay: ; [03]
275 ror shift ;[-5] [11] [59]
276 brcc doExorN1 ;[-4] [60]
277 subi x4, 1 ;[-3]
278 brne commonN1 ;[-2]
279 lsl shift ;[-1] compensate ror after rjmp stuffDelay
280 nop ;[00] stuffing consists of just waiting 8 cycles
281 rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear
282
283sendNakAndReti: ;0 [-19] 19 cycles until SOP
284 ldi x3, USBPID_NAK ;1 [-18]
285 rjmp usbSendX3 ;2 [-16]
286sendAckAndReti: ;0 [-19] 19 cycles until SOP
287 ldi x3, USBPID_ACK ;1 [-18]
288 rjmp usbSendX3 ;2 [-16]
289sendCntAndReti: ;0 [-17] 17 cycles until SOP
290 mov x3, cnt ;1 [-16]
291usbSendX3: ;0 [-16]
292 ldi YL, 20 ;1 [-15] 'x3' is R20
293 ldi YH, 0 ;1 [-14]
294 ldi cnt, 2 ;1 [-13]
295; rjmp usbSendAndReti fallthrough
296
297; USB spec says:
298; idle = J
299; J = (D+ = 0), (D- = 1) or USBOUT = 0x01
300; K = (D+ = 1), (D- = 0) or USBOUT = 0x02
301; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles)
302
303;usbSend:
304;pointer to data in 'Y'
305;number of bytes in 'cnt' -- including sync byte
306;uses: x1...x2, x4, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x4 = bitstuff cnt]
307;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction)
308usbSendAndReti:
309 in x2, USBDDR ;[-12] 12 cycles until SOP
310 ori x2, USBMASK ;[-11]
311 sbi USBOUT, USBMINUS ;[-10] prepare idle state; D+ and D- must have been 0 (no pullups)
312 out USBDDR, x2 ;[-8] <--- acquire bus
313 in x1, USBOUT ;[-7] port mirror for tx loop
314 ldi shift, 0x40 ;[-6] sync byte is first byte sent (we enter loop after ror)
315 ldi x2, USBMASK ;[-5]
316 push x4 ;[-4]
317doExorN1:
318 eor x1, x2 ;[-2] [06] [62]
319 ldi x4, 6 ;[-1] [07] [63]
320commonN1:
321stuffN2Delay:
322 out USBOUT, x1 ;[00] [08] [64] <--- set bit
323 ror shift ;[01]
324 brcc doExorN2 ;[02]
325 subi x4, 1 ;[03]
326 brne commonN2 ;[04]
327 lsl shift ;[05] compensate ror after rjmp stuffDelay
328 rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear
329doExorN2:
330 eor x1, x2 ;[04] [12]
331 ldi x4, 6 ;[05] [13]
332commonN2:
333 nop ;[06] [14]
334 subi cnt, 171 ;[07] [15] trick: (3 * 171) & 0xff = 1
335 out USBOUT, x1 ;[08] [16] <--- set bit
336 brcs txBitloop ;[09] [25] [41]
337
338stuff6Delay:
339 ror shift ;[42] [50]
340 brcc doExor6 ;[43]
341 subi x4, 1 ;[44]
342 brne common6 ;[45]
343 lsl shift ;[46] compensate ror after rjmp stuffDelay
344 nop ;[47] stuffing consists of just waiting 8 cycles
345 rjmp stuff6Delay ;[48] after ror, C bit is reliably clear
346doExor6:
347 eor x1, x2 ;[45] [53]
348 ldi x4, 6 ;[46]
349common6:
350stuff7Delay:
351 ror shift ;[47] [55]
352 out USBOUT, x1 ;[48] <--- set bit
353 brcc doExor7 ;[49]
354 subi x4, 1 ;[50]
355 brne common7 ;[51]
356 lsl shift ;[52] compensate ror after rjmp stuffDelay
357 rjmp stuff7Delay ;[53] after ror, C bit is reliably clear
358doExor7:
359 eor x1, x2 ;[51] [59]
360 ldi x4, 6 ;[52]
361common7:
362 ld shift, y+ ;[53]
363 tst cnt ;[55]
364 out USBOUT, x1 ;[56] <--- set bit
365 brne txByteLoop ;[57]
366
367;make SE0:
368 cbr x1, USBMASK ;[58] prepare SE0 [spec says EOP may be 15 to 18 cycles]
369 lds x2, usbNewDeviceAddr;[59]
370 lsl x2 ;[61] we compare with left shifted address
371 subi YL, 2 + 20 ;[62] Only assign address on data packets, not ACK/NAK in x3
372 sbci YH, 0 ;[63]
373 out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle
374;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm:
375;set address only after data packet was sent, not after handshake
376 breq skipAddrAssign ;[01]
377 sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer
378skipAddrAssign:
379;end of usbDeviceAddress transfer
380 ldi x2, 1<<USB_INTR_PENDING_BIT;[03] int0 occurred during TX -- clear pending flag
381 USB_STORE_PENDING(x2) ;[04]
382 ori x1, USBIDLE ;[05]
383 in x2, USBDDR ;[06]
384 cbr x2, USBMASK ;[07] set both pins to input
385 mov x3, x1 ;[08]
386 cbr x3, USBMASK ;[09] configure no pullup on both pins
387 pop x4 ;[10]
388 nop2 ;[12]
389 nop2 ;[14]
390 out USBOUT, x1 ;[16] <-- out J (idle) -- end of SE0 (EOP signal)
391 out USBDDR, x2 ;[17] <-- release bus now
392 out USBOUT, x3 ;[18] <-- ensure no pull-up resistors are active
393 rjmp doReturn
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm128.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm128.inc
deleted file mode 100644
index bcd6621cc2..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm128.inc
+++ /dev/null
@@ -1,750 +0,0 @@
1/* Name: usbdrvasm128.inc
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2008-10-11
5 * Tabsize: 4
6 * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: usbdrvasm128.inc 758 2009-08-06 10:12:54Z cs $
9 */
10
11/* Do not link this file! Link usbdrvasm.S instead, which includes the
12 * appropriate implementation!
13 */
14
15/*
16General Description:
17This file is the 12.8 MHz version of the USB driver. It is intended for use
18with the internal RC oscillator. Although 12.8 MHz is outside the guaranteed
19calibration range of the oscillator, almost all AVRs can reach this frequency.
20This version contains a phase locked loop in the receiver routine to cope with
21slight clock rate deviations of up to +/- 1%.
22
23See usbdrv.h for a description of the entire driver.
24
25LIMITATIONS
26===========
27Although it may seem very handy to save the crystal and use the internal
28RC oscillator of the CPU, this method (and this module) has some serious
29limitations:
30(1) The guaranteed calibration range of the oscillator is only 8.1 MHz.
31They typical range is 14.5 MHz and most AVRs can actually reach this rate.
32(2) Writing EEPROM and Flash may be unreliable (short data lifetime) since
33the write procedure is timed from the RC oscillator.
34(3) End Of Packet detection (SE0) should be in bit 1, bit it is only checked
35if bits 0 and 1 both read as 0 on D- and D+ read as 0 in the middle. This may
36cause problems with old hubs which delay SE0 by up to one cycle.
37(4) Code size is much larger than that of the other modules.
38
39Since almost all of this code is timing critical, don't change unless you
40really know what you are doing! Many parts require not only a maximum number
41of CPU cycles, but even an exact number of cycles!
42
43Implementation notes:
44======================
45min frequency: 67 cycles for 8 bit -> 12.5625 MHz
46max frequency: 69.286 cycles for 8 bit -> 12.99 MHz
47nominal frequency: 12.77 MHz ( = sqrt(min * max))
48
49sampling positions: (next even number in range [+/- 0.5])
50cycle index range: 0 ... 66
51bits:
52.5, 8.875, 17.25, 25.625, 34, 42.375, 50.75, 59.125
53[0/1], [9], [17], [25/+26], [34], [+42/43], [51], [59]
54
55bit number: 0 1 2 3 4 5 6 7
56spare cycles 1 2 1 2 1 1 1 0
57
58operations to perform: duration cycle
59 ----------------
60 eor fix, shift 1 -> 00
61 andi phase, USBMASK 1 -> 08
62 breq se0 1 -> 16 (moved to 11)
63 st y+, data 2 -> 24, 25
64 mov data, fix 1 -> 33
65 ser data 1 -> 41
66 subi cnt, 1 1 -> 49
67 brcs overflow 1 -> 50
68
69layout of samples and operations:
70[##] = sample bit
71<##> = sample phase
72*##* = operation
73
740: *00* [01] 02 03 04 <05> 06 07
751: *08* [09] 10 11 12 <13> 14 15 *16*
762: [17] 18 19 20 <21> 22 23
773: *24* *25* [26] 27 28 29 <30> 31 32
784: *33* [34] 35 36 37 <38> 39 40
795: *41* [42] 43 44 45 <46> 47 48
806: *49* *50* [51] 52 53 54 <55> 56 57 58
817: [59] 60 61 62 <63> 64 65 66
82*****************************************************************************/
83
84/* we prefer positive expressions (do if condition) instead of negative
85 * (skip if condition), therefore use defines for skip instructions:
86 */
87#define ifioclr sbis
88#define ifioset sbic
89#define ifrclr sbrs
90#define ifrset sbrc
91
92/* The registers "fix" and "data" swap their meaning during the loop. Use
93 * defines to keep their name constant.
94 */
95#define fix x2
96#define data x1
97#undef phase /* phase has a default definition to x4 */
98#define phase x3
99
100
101USB_INTR_VECTOR:
102;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt, r0
103 push YL ;2 push only what is necessary to sync with edge ASAP
104 in YL, SREG ;1
105 push YL ;2
106;----------------------------------------------------------------------------
107; Synchronize with sync pattern:
108;----------------------------------------------------------------------------
109;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K]
110;sync up with J to K edge during sync pattern -- use fastest possible loops
111;The first part waits at most 1 bit long since we must be in sync pattern.
112;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to
113;waitForJ, ensure that this prerequisite is met.
114waitForJ:
115 inc YL
116 sbis USBIN, USBMINUS
117 brne waitForJ ; just make sure we have ANY timeout
118waitForK:
119;The following code results in a sampling window of 1/4 bit which meets the spec.
120 sbis USBIN, USBMINUS
121 rjmp foundK
122 sbis USBIN, USBMINUS
123 rjmp foundK
124 sbis USBIN, USBMINUS
125 rjmp foundK
126 sbis USBIN, USBMINUS
127 rjmp foundK
128 sbis USBIN, USBMINUS ;[0]
129 rjmp foundK ;[1]
130#if USB_COUNT_SOF
131 lds YL, usbSofCount
132 inc YL
133 sts usbSofCount, YL
134#endif /* USB_COUNT_SOF */
135#ifdef USB_SOF_HOOK
136 USB_SOF_HOOK
137#endif
138 rjmp sofError
139
140foundK:
141;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling]
142;we have 1 bit time for setup purposes, then sample again. Numbers in brackets
143;are cycles from center of first sync (double K) bit after the instruction
144 push YH ;[2]
145 lds YL, usbInputBufOffset;[4]
146 clr YH ;[6]
147 subi YL, lo8(-(usbRxBuf));[7]
148 sbci YH, hi8(-(usbRxBuf));[8]
149
150 sbis USBIN, USBMINUS ;[9] we want two bits K [we want to sample at 8 + 4 - 1.5 = 10.5]
151 rjmp haveTwoBitsK ;[10]
152 pop YH ;[11] undo the push from before
153 rjmp waitForK ;[13] this was not the end of sync, retry
154haveTwoBitsK:
155;----------------------------------------------------------------------------
156; push more registers and initialize values while we sample the first bits:
157;----------------------------------------------------------------------------
158#define fix x2
159#define data x1
160
161 push shift ;[12]
162 push x1 ;[14]
163 push x2 ;[16]
164 ldi shift, 0x80 ;[18] prevent bit-unstuffing but init low bits to 0
165 ifioset USBIN, USBMINUS ;[19] [01] <--- bit 0 [10.5 + 8 = 18.5]
166 ori shift, 1<<0 ;[02]
167 push x3 ;[03]
168 push cnt ;[05]
169 push r0 ;[07]
170 ifioset USBIN, USBMINUS ;[09] <--- bit 1
171 ori shift, 1<<1 ;[10]
172 ser fix ;[11]
173 ldi cnt, USB_BUFSIZE ;[12]
174 mov data, shift ;[13]
175 lsl shift ;[14]
176 nop2 ;[15]
177 ifioset USBIN, USBMINUS ;[17] <--- bit 2
178 ori data, 3<<2 ;[18] store in bit 2 AND bit 3
179 eor shift, data ;[19] do nrzi decoding
180 andi data, 1<<3 ;[20]
181 in phase, USBIN ;[21] <- phase
182 brne jumpToEntryAfterSet ;[22] if USBMINS at bit 3 was 1
183 nop ;[23]
184 rjmp entryAfterClr ;[24]
185jumpToEntryAfterSet:
186 rjmp entryAfterSet ;[24]
187
188;----------------------------------------------------------------------------
189; Receiver loop (numbers in brackets are cycles within byte after instr)
190;----------------------------------------------------------------------------
191#undef fix
192#define fix x1
193#undef data
194#define data x2
195
196bit7IsSet:
197 ifrclr phase, USBMINUS ;[62] check phase only if D- changed
198 lpm ;[63]
199 in phase, USBIN ;[64] <- phase (one cycle too late)
200 ori shift, 1 << 7 ;[65]
201 nop ;[66]
202;;;;rjmp bit0AfterSet ; -> [00] == [67] moved block up to save jump
203bit0AfterSet:
204 eor fix, shift ;[00]
205#undef fix
206#define fix x2
207#undef data
208#define data x1 /* we now have result in data, fix is reset to 0xff */
209 ifioclr USBIN, USBMINUS ;[01] <--- sample 0
210 rjmp bit0IsClr ;[02]
211 andi shift, ~(7 << 0) ;[03]
212 breq unstuff0s ;[04]
213 in phase, USBIN ;[05] <- phase
214 rjmp bit1AfterSet ;[06]
215unstuff0s:
216 in phase, USBIN ;[06] <- phase (one cycle too late)
217 andi fix, ~(1 << 0) ;[07]
218 ifioclr USBIN, USBMINUS ;[00]
219 ifioset USBIN, USBPLUS ;[01]
220 rjmp bit0IsClr ;[02] executed if first expr false or second true
221se0AndStore: ; executed only if both bits 0
222 st y+, x1 ;[15/17] cycles after start of byte
223 rjmp se0 ;[17/19]
224
225bit0IsClr:
226 ifrset phase, USBMINUS ;[04] check phase only if D- changed
227 lpm ;[05]
228 in phase, USBIN ;[06] <- phase (one cycle too late)
229 ori shift, 1 << 0 ;[07]
230bit1AfterClr:
231 andi phase, USBMASK ;[08]
232 ifioset USBIN, USBMINUS ;[09] <--- sample 1
233 rjmp bit1IsSet ;[10]
234 breq se0AndStore ;[11] if D- was 0 in bits 0 AND 1 and D+ was 0 in between, we have SE0
235 andi shift, ~(7 << 1) ;[12]
236 in phase, USBIN ;[13] <- phase
237 breq unstuff1c ;[14]
238 rjmp bit2AfterClr ;[15]
239unstuff1c:
240 andi fix, ~(1 << 1) ;[16]
241 nop2 ;[08]
242 nop2 ;[10]
243bit1IsSet:
244 ifrclr phase, USBMINUS ;[12] check phase only if D- changed
245 lpm ;[13]
246 in phase, USBIN ;[14] <- phase (one cycle too late)
247 ori shift, 1 << 1 ;[15]
248 nop ;[16]
249bit2AfterSet:
250 ifioclr USBIN, USBMINUS ;[17] <--- sample 2
251 rjmp bit2IsClr ;[18]
252 andi shift, ~(7 << 2) ;[19]
253 breq unstuff2s ;[20]
254 in phase, USBIN ;[21] <- phase
255 rjmp bit3AfterSet ;[22]
256unstuff2s:
257 in phase, USBIN ;[22] <- phase (one cycle too late)
258 andi fix, ~(1 << 2) ;[23]
259 nop2 ;[16]
260 nop2 ;[18]
261bit2IsClr:
262 ifrset phase, USBMINUS ;[20] check phase only if D- changed
263 lpm ;[21]
264 in phase, USBIN ;[22] <- phase (one cycle too late)
265 ori shift, 1 << 2 ;[23]
266bit3AfterClr:
267 st y+, data ;[24]
268entryAfterClr:
269 ifioset USBIN, USBMINUS ;[26] <--- sample 3
270 rjmp bit3IsSet ;[27]
271 andi shift, ~(7 << 3) ;[28]
272 breq unstuff3c ;[29]
273 in phase, USBIN ;[30] <- phase
274 rjmp bit4AfterClr ;[31]
275unstuff3c:
276 in phase, USBIN ;[31] <- phase (one cycle too late)
277 andi fix, ~(1 << 3) ;[32]
278 nop2 ;[25]
279 nop2 ;[27]
280bit3IsSet:
281 ifrclr phase, USBMINUS ;[29] check phase only if D- changed
282 lpm ;[30]
283 in phase, USBIN ;[31] <- phase (one cycle too late)
284 ori shift, 1 << 3 ;[32]
285bit4AfterSet:
286 mov data, fix ;[33] undo this move by swapping defines
287#undef fix
288#define fix x1
289#undef data
290#define data x2
291 ifioclr USBIN, USBMINUS ;[34] <--- sample 4
292 rjmp bit4IsClr ;[35]
293 andi shift, ~(7 << 4) ;[36]
294 breq unstuff4s ;[37]
295 in phase, USBIN ;[38] <- phase
296 rjmp bit5AfterSet ;[39]
297unstuff4s:
298 in phase, USBIN ;[39] <- phase (one cycle too late)
299 andi fix, ~(1 << 4) ;[40]
300 nop2 ;[33]
301 nop2 ;[35]
302bit4IsClr:
303 ifrset phase, USBMINUS ;[37] check phase only if D- changed
304 lpm ;[38]
305 in phase, USBIN ;[39] <- phase (one cycle too late)
306 ori shift, 1 << 4 ;[40]
307bit5AfterClr:
308 ser data ;[41]
309 ifioset USBIN, USBMINUS ;[42] <--- sample 5
310 rjmp bit5IsSet ;[43]
311 andi shift, ~(7 << 5) ;[44]
312 breq unstuff5c ;[45]
313 in phase, USBIN ;[46] <- phase
314 rjmp bit6AfterClr ;[47]
315unstuff5c:
316 in phase, USBIN ;[47] <- phase (one cycle too late)
317 andi fix, ~(1 << 5) ;[48]
318 nop2 ;[41]
319 nop2 ;[43]
320bit5IsSet:
321 ifrclr phase, USBMINUS ;[45] check phase only if D- changed
322 lpm ;[46]
323 in phase, USBIN ;[47] <- phase (one cycle too late)
324 ori shift, 1 << 5 ;[48]
325bit6AfterSet:
326 subi cnt, 1 ;[49]
327 brcs jumpToOverflow ;[50]
328 ifioclr USBIN, USBMINUS ;[51] <--- sample 6
329 rjmp bit6IsClr ;[52]
330 andi shift, ~(3 << 6) ;[53]
331 cpi shift, 2 ;[54]
332 in phase, USBIN ;[55] <- phase
333 brlt unstuff6s ;[56]
334 rjmp bit7AfterSet ;[57]
335
336jumpToOverflow:
337 rjmp overflow
338
339unstuff6s:
340 andi fix, ~(1 << 6) ;[50]
341 lpm ;[51]
342bit6IsClr:
343 ifrset phase, USBMINUS ;[54] check phase only if D- changed
344 lpm ;[55]
345 in phase, USBIN ;[56] <- phase (one cycle too late)
346 ori shift, 1 << 6 ;[57]
347 nop ;[58]
348bit7AfterClr:
349 ifioset USBIN, USBMINUS ;[59] <--- sample 7
350 rjmp bit7IsSet ;[60]
351 andi shift, ~(1 << 7) ;[61]
352 cpi shift, 4 ;[62]
353 in phase, USBIN ;[63] <- phase
354 brlt unstuff7c ;[64]
355 rjmp bit0AfterClr ;[65] -> [00] == [67]
356unstuff7c:
357 andi fix, ~(1 << 7) ;[58]
358 nop ;[59]
359 rjmp bit7IsSet ;[60]
360
361bit7IsClr:
362 ifrset phase, USBMINUS ;[62] check phase only if D- changed
363 lpm ;[63]
364 in phase, USBIN ;[64] <- phase (one cycle too late)
365 ori shift, 1 << 7 ;[65]
366 nop ;[66]
367;;;;rjmp bit0AfterClr ; -> [00] == [67] moved block up to save jump
368bit0AfterClr:
369 eor fix, shift ;[00]
370#undef fix
371#define fix x2
372#undef data
373#define data x1 /* we now have result in data, fix is reset to 0xff */
374 ifioset USBIN, USBMINUS ;[01] <--- sample 0
375 rjmp bit0IsSet ;[02]
376 andi shift, ~(7 << 0) ;[03]
377 breq unstuff0c ;[04]
378 in phase, USBIN ;[05] <- phase
379 rjmp bit1AfterClr ;[06]
380unstuff0c:
381 in phase, USBIN ;[06] <- phase (one cycle too late)
382 andi fix, ~(1 << 0) ;[07]
383 ifioclr USBIN, USBMINUS ;[00]
384 ifioset USBIN, USBPLUS ;[01]
385 rjmp bit0IsSet ;[02] executed if first expr false or second true
386 rjmp se0AndStore ;[03] executed only if both bits 0
387bit0IsSet:
388 ifrclr phase, USBMINUS ;[04] check phase only if D- changed
389 lpm ;[05]
390 in phase, USBIN ;[06] <- phase (one cycle too late)
391 ori shift, 1 << 0 ;[07]
392bit1AfterSet:
393 andi shift, ~(7 << 1) ;[08] compensated by "ori shift, 1<<1" if bit1IsClr
394 ifioclr USBIN, USBMINUS ;[09] <--- sample 1
395 rjmp bit1IsClr ;[10]
396 breq unstuff1s ;[11]
397 nop2 ;[12] do not check for SE0 if bit 0 was 1
398 in phase, USBIN ;[14] <- phase (one cycle too late)
399 rjmp bit2AfterSet ;[15]
400unstuff1s:
401 in phase, USBIN ;[13] <- phase
402 andi fix, ~(1 << 1) ;[14]
403 lpm ;[07]
404 nop2 ;[10]
405bit1IsClr:
406 ifrset phase, USBMINUS ;[12] check phase only if D- changed
407 lpm ;[13]
408 in phase, USBIN ;[14] <- phase (one cycle too late)
409 ori shift, 1 << 1 ;[15]
410 nop ;[16]
411bit2AfterClr:
412 ifioset USBIN, USBMINUS ;[17] <--- sample 2
413 rjmp bit2IsSet ;[18]
414 andi shift, ~(7 << 2) ;[19]
415 breq unstuff2c ;[20]
416 in phase, USBIN ;[21] <- phase
417 rjmp bit3AfterClr ;[22]
418unstuff2c:
419 in phase, USBIN ;[22] <- phase (one cycle too late)
420 andi fix, ~(1 << 2) ;[23]
421 nop2 ;[16]
422 nop2 ;[18]
423bit2IsSet:
424 ifrclr phase, USBMINUS ;[20] check phase only if D- changed
425 lpm ;[21]
426 in phase, USBIN ;[22] <- phase (one cycle too late)
427 ori shift, 1 << 2 ;[23]
428bit3AfterSet:
429 st y+, data ;[24]
430entryAfterSet:
431 ifioclr USBIN, USBMINUS ;[26] <--- sample 3
432 rjmp bit3IsClr ;[27]
433 andi shift, ~(7 << 3) ;[28]
434 breq unstuff3s ;[29]
435 in phase, USBIN ;[30] <- phase
436 rjmp bit4AfterSet ;[31]
437unstuff3s:
438 in phase, USBIN ;[31] <- phase (one cycle too late)
439 andi fix, ~(1 << 3) ;[32]
440 nop2 ;[25]
441 nop2 ;[27]
442bit3IsClr:
443 ifrset phase, USBMINUS ;[29] check phase only if D- changed
444 lpm ;[30]
445 in phase, USBIN ;[31] <- phase (one cycle too late)
446 ori shift, 1 << 3 ;[32]
447bit4AfterClr:
448 mov data, fix ;[33] undo this move by swapping defines
449#undef fix
450#define fix x1
451#undef data
452#define data x2
453 ifioset USBIN, USBMINUS ;[34] <--- sample 4
454 rjmp bit4IsSet ;[35]
455 andi shift, ~(7 << 4) ;[36]
456 breq unstuff4c ;[37]
457 in phase, USBIN ;[38] <- phase
458 rjmp bit5AfterClr ;[39]
459unstuff4c:
460 in phase, USBIN ;[39] <- phase (one cycle too late)
461 andi fix, ~(1 << 4) ;[40]
462 nop2 ;[33]
463 nop2 ;[35]
464bit4IsSet:
465 ifrclr phase, USBMINUS ;[37] check phase only if D- changed
466 lpm ;[38]
467 in phase, USBIN ;[39] <- phase (one cycle too late)
468 ori shift, 1 << 4 ;[40]
469bit5AfterSet:
470 ser data ;[41]
471 ifioclr USBIN, USBMINUS ;[42] <--- sample 5
472 rjmp bit5IsClr ;[43]
473 andi shift, ~(7 << 5) ;[44]
474 breq unstuff5s ;[45]
475 in phase, USBIN ;[46] <- phase
476 rjmp bit6AfterSet ;[47]
477unstuff5s:
478 in phase, USBIN ;[47] <- phase (one cycle too late)
479 andi fix, ~(1 << 5) ;[48]
480 nop2 ;[41]
481 nop2 ;[43]
482bit5IsClr:
483 ifrset phase, USBMINUS ;[45] check phase only if D- changed
484 lpm ;[46]
485 in phase, USBIN ;[47] <- phase (one cycle too late)
486 ori shift, 1 << 5 ;[48]
487bit6AfterClr:
488 subi cnt, 1 ;[49]
489 brcs overflow ;[50]
490 ifioset USBIN, USBMINUS ;[51] <--- sample 6
491 rjmp bit6IsSet ;[52]
492 andi shift, ~(3 << 6) ;[53]
493 cpi shift, 2 ;[54]
494 in phase, USBIN ;[55] <- phase
495 brlt unstuff6c ;[56]
496 rjmp bit7AfterClr ;[57]
497unstuff6c:
498 andi fix, ~(1 << 6) ;[50]
499 lpm ;[51]
500bit6IsSet:
501 ifrclr phase, USBMINUS ;[54] check phase only if D- changed
502 lpm ;[55]
503 in phase, USBIN ;[56] <- phase (one cycle too late)
504 ori shift, 1 << 6 ;[57]
505bit7AfterSet:
506 ifioclr USBIN, USBMINUS ;[59] <--- sample 7
507 rjmp bit7IsClr ;[60]
508 andi shift, ~(1 << 7) ;[61]
509 cpi shift, 4 ;[62]
510 in phase, USBIN ;[63] <- phase
511 brlt unstuff7s ;[64]
512 rjmp bit0AfterSet ;[65] -> [00] == [67]
513unstuff7s:
514 andi fix, ~(1 << 7) ;[58]
515 nop ;[59]
516 rjmp bit7IsClr ;[60]
517
518macro POP_STANDARD ; 14 cycles
519 pop r0
520 pop cnt
521 pop x3
522 pop x2
523 pop x1
524 pop shift
525 pop YH
526 endm
527macro POP_RETI ; 5 cycles
528 pop YL
529 out SREG, YL
530 pop YL
531 endm
532
533#include "asmcommon.inc"
534
535;----------------------------------------------------------------------------
536; Transmitting data
537;----------------------------------------------------------------------------
538
539txByteLoop:
540txBitloop:
541stuffN1Delay: ; [03]
542 ror shift ;[-5] [11] [63]
543 brcc doExorN1 ;[-4] [64]
544 subi x3, 1 ;[-3]
545 brne commonN1 ;[-2]
546 lsl shift ;[-1] compensate ror after rjmp stuffDelay
547 nop ;[00] stuffing consists of just waiting 8 cycles
548 rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear
549
550sendNakAndReti:
551 ldi cnt, USBPID_NAK ;[-19]
552 rjmp sendCntAndReti ;[-18]
553sendAckAndReti:
554 ldi cnt, USBPID_ACK ;[-17]
555sendCntAndReti:
556 mov r0, cnt ;[-16]
557 ldi YL, 0 ;[-15] R0 address is 0
558 ldi YH, 0 ;[-14]
559 ldi cnt, 2 ;[-13]
560; rjmp usbSendAndReti fallthrough
561
562; USB spec says:
563; idle = J
564; J = (D+ = 0), (D- = 1) or USBOUT = 0x01
565; K = (D+ = 1), (D- = 0) or USBOUT = 0x02
566; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles)
567
568;usbSend:
569;pointer to data in 'Y'
570;number of bytes in 'cnt' -- including sync byte
571;uses: x1...x3, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x3 = bitstuff cnt]
572;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction)
573usbSendAndReti:
574 in x2, USBDDR ;[-10] 10 cycles until SOP
575 ori x2, USBMASK ;[-9]
576 sbi USBOUT, USBMINUS ;[-8] prepare idle state; D+ and D- must have been 0 (no pullups)
577 out USBDDR, x2 ;[-6] <--- acquire bus
578 in x1, USBOUT ;[-5] port mirror for tx loop
579 ldi shift, 0x40 ;[-4] sync byte is first byte sent (we enter loop after ror)
580 ldi x2, USBMASK ;[-3]
581doExorN1:
582 eor x1, x2 ;[-2] [06] [62]
583 ldi x3, 6 ;[-1] [07] [63]
584commonN1:
585stuffN2Delay:
586 out USBOUT, x1 ;[00] [08] [64] <--- set bit
587 ror shift ;[01]
588 brcc doExorN2 ;[02]
589 subi x3, 1 ;[03]
590 brne commonN2 ;[04]
591 lsl shift ;[05] compensate ror after rjmp stuffDelay
592 rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear
593doExorN2:
594 eor x1, x2 ;[04] [12]
595 ldi x3, 6 ;[05] [13]
596commonN2:
597 nop2 ;[06] [14]
598 subi cnt, 171 ;[08] [16] trick: (3 * 171) & 0xff = 1
599 out USBOUT, x1 ;[09] [17] <--- set bit
600 brcs txBitloop ;[10] [27] [44]
601
602stuff6Delay:
603 ror shift ;[45] [53]
604 brcc doExor6 ;[46]
605 subi x3, 1 ;[47]
606 brne common6 ;[48]
607 lsl shift ;[49] compensate ror after rjmp stuffDelay
608 nop ;[50] stuffing consists of just waiting 8 cycles
609 rjmp stuff6Delay ;[51] after ror, C bit is reliably clear
610doExor6:
611 eor x1, x2 ;[48] [56]
612 ldi x3, 6 ;[49]
613common6:
614stuff7Delay:
615 ror shift ;[50] [58]
616 out USBOUT, x1 ;[51] <--- set bit
617 brcc doExor7 ;[52]
618 subi x3, 1 ;[53]
619 brne common7 ;[54]
620 lsl shift ;[55] compensate ror after rjmp stuffDelay
621 rjmp stuff7Delay ;[56] after ror, C bit is reliably clear
622doExor7:
623 eor x1, x2 ;[54] [62]
624 ldi x3, 6 ;[55]
625common7:
626 ld shift, y+ ;[56]
627 nop ;[58]
628 tst cnt ;[59]
629 out USBOUT, x1 ;[60] [00]<--- set bit
630 brne txByteLoop ;[61] [01]
631;make SE0:
632 cbr x1, USBMASK ;[02] prepare SE0 [spec says EOP may be 15 to 18 cycles]
633 lds x2, usbNewDeviceAddr;[03]
634 lsl x2 ;[05] we compare with left shifted address
635 subi YL, 2 + 0 ;[06] Only assign address on data packets, not ACK/NAK in r0
636 sbci YH, 0 ;[07]
637 out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle
638;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm:
639;set address only after data packet was sent, not after handshake
640 breq skipAddrAssign ;[01]
641 sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer
642skipAddrAssign:
643;end of usbDeviceAddress transfer
644 ldi x2, 1<<USB_INTR_PENDING_BIT;[03] int0 occurred during TX -- clear pending flag
645 USB_STORE_PENDING(x2) ;[04]
646 ori x1, USBIDLE ;[05]
647 in x2, USBDDR ;[06]
648 cbr x2, USBMASK ;[07] set both pins to input
649 mov x3, x1 ;[08]
650 cbr x3, USBMASK ;[09] configure no pullup on both pins
651 lpm ;[10]
652 lpm ;[13]
653 out USBOUT, x1 ;[16] <-- out J (idle) -- end of SE0 (EOP signal)
654 out USBDDR, x2 ;[17] <-- release bus now
655 out USBOUT, x3 ;[18] <-- ensure no pull-up resistors are active
656 rjmp doReturn
657
658
659
660/*****************************************************************************
661The following PHP script generates a code skeleton for the receiver routine:
662
663<?php
664
665function printCmdBuffer($thisBit)
666{
667global $cycle;
668
669 $nextBit = ($thisBit + 1) % 8;
670 $s = ob_get_contents();
671 ob_end_clean();
672 $s = str_replace("#", $thisBit, $s);
673 $s = str_replace("@", $nextBit, $s);
674 $lines = explode("\n", $s);
675 for($i = 0; $i < count($lines); $i++){
676 $s = $lines[$i];
677 if(ereg("\\[([0-9-][0-9])\\]", $s, $regs)){
678 $c = $cycle + (int)$regs[1];
679 $s = ereg_replace("\\[[0-9-][0-9]\\]", sprintf("[%02d]", $c), $s);
680 }
681 if(strlen($s) > 0)
682 echo "$s\n";
683 }
684}
685
686function printBit($isAfterSet, $bitNum)
687{
688 ob_start();
689 if($isAfterSet){
690?>
691 ifioclr USBIN, USBMINUS ;[00] <--- sample
692 rjmp bit#IsClr ;[01]
693 andi shift, ~(7 << #) ;[02]
694 breq unstuff#s ;[03]
695 in phase, USBIN ;[04] <- phase
696 rjmp bit@AfterSet ;[05]
697unstuff#s:
698 in phase, USBIN ;[05] <- phase (one cycle too late)
699 andi fix, ~(1 << #) ;[06]
700 nop2 ;[-1]
701 nop2 ;[01]
702bit#IsClr:
703 ifrset phase, USBMINUS ;[03] check phase only if D- changed
704 lpm ;[04]
705 in phase, USBIN ;[05] <- phase (one cycle too late)
706 ori shift, 1 << # ;[06]
707<?php
708 }else{
709?>
710 ifioset USBIN, USBMINUS ;[00] <--- sample
711 rjmp bit#IsSet ;[01]
712 andi shift, ~(7 << #) ;[02]
713 breq unstuff#c ;[03]
714 in phase, USBIN ;[04] <- phase
715 rjmp bit@AfterClr ;[05]
716unstuff#c:
717 in phase, USBIN ;[05] <- phase (one cycle too late)
718 andi fix, ~(1 << #) ;[06]
719 nop2 ;[-1]
720 nop2 ;[01]
721bit#IsSet:
722 ifrclr phase, USBMINUS ;[03] check phase only if D- changed
723 lpm ;[04]
724 in phase, USBIN ;[05] <- phase (one cycle too late)
725 ori shift, 1 << # ;[06]
726<?php
727 }
728 printCmdBuffer($bitNum);
729}
730
731$bitStartCycles = array(1, 9, 17, 26, 34, 42, 51, 59);
732for($i = 0; $i < 16; $i++){
733 $bit = $i % 8;
734 $emitClrCode = ($i + (int)($i / 8)) % 2;
735 $cycle = $bitStartCycles[$bit];
736 if($emitClrCode){
737 printf("bit%dAfterClr:\n", $bit);
738 }else{
739 printf("bit%dAfterSet:\n", $bit);
740 }
741 ob_start();
742 echo " ***** ;[-1]\n";
743 printCmdBuffer($bit);
744 printBit(!$emitClrCode, $bit);
745 if($i == 7)
746 echo "\n";
747}
748
749?>
750*****************************************************************************/
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc
deleted file mode 100644
index 401b7f8fff..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc
+++ /dev/null
@@ -1,423 +0,0 @@
1/* Name: usbdrvasm15.inc
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: contributed by V. Bosch
4 * Creation Date: 2007-08-06
5 * Tabsize: 4
6 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * Revision: $Id: usbdrvasm15.inc 740 2009-04-13 18:23:31Z cs $
9 */
10
11/* Do not link this file! Link usbdrvasm.S instead, which includes the
12 * appropriate implementation!
13 */
14
15/*
16General Description:
17This file is the 15 MHz version of the asssembler part of the USB driver. It
18requires a 15 MHz crystal (not a ceramic resonator and not a calibrated RC
19oscillator).
20
21See usbdrv.h for a description of the entire driver.
22
23Since almost all of this code is timing critical, don't change unless you
24really know what you are doing! Many parts require not only a maximum number
25of CPU cycles, but even an exact number of cycles!
26*/
27
28;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes
29;nominal frequency: 15 MHz -> 10.0 cycles per bit, 80.0 cycles per byte
30; Numbers in brackets are clocks counted from center of last sync bit
31; when instruction starts
32
33;----------------------------------------------------------------------------
34; order of registers pushed:
35; YL, SREG [sofError] YH, shift, x1, x2, x3, bitcnt, cnt, x4
36;----------------------------------------------------------------------------
37USB_INTR_VECTOR:
38 push YL ;2 push only what is necessary to sync with edge ASAP
39 in YL, SREG ;1
40 push YL ;2
41;----------------------------------------------------------------------------
42; Synchronize with sync pattern:
43;
44; sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K]
45; sync up with J to K edge during sync pattern -- use fastest possible loops
46;The first part waits at most 1 bit long since we must be in sync pattern.
47;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to
48;waitForJ, ensure that this prerequisite is met.
49waitForJ:
50 inc YL
51 sbis USBIN, USBMINUS
52 brne waitForJ ; just make sure we have ANY timeout
53;-------------------------------------------------------------------------------
54; The following code results in a sampling window of < 1/4 bit
55; which meets the spec.
56;-------------------------------------------------------------------------------
57waitForK: ;-
58 sbis USBIN, USBMINUS ;1 [00] <-- sample
59 rjmp foundK ;2 [01]
60 sbis USBIN, USBMINUS ; <-- sample
61 rjmp foundK
62 sbis USBIN, USBMINUS ; <-- sample
63 rjmp foundK
64 sbis USBIN, USBMINUS ; <-- sample
65 rjmp foundK
66 sbis USBIN, USBMINUS ; <-- sample
67 rjmp foundK
68 sbis USBIN, USBMINUS ; <-- sample
69 rjmp foundK
70#if USB_COUNT_SOF
71 lds YL, usbSofCount
72 inc YL
73 sts usbSofCount, YL
74#endif /* USB_COUNT_SOF */
75#ifdef USB_SOF_HOOK
76 USB_SOF_HOOK
77#endif
78 rjmp sofError
79;------------------------------------------------------------------------------
80; {3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for
81; center sampling]
82; we have 1 bit time for setup purposes, then sample again.
83; Numbers in brackets are cycles from center of first sync (double K)
84; bit after the instruction
85;------------------------------------------------------------------------------
86foundK: ;- [02]
87 lds YL, usbInputBufOffset;2 [03+04] tx loop
88 push YH ;2 [05+06]
89 clr YH ;1 [07]
90 subi YL, lo8(-(usbRxBuf)) ;1 [08] [rx loop init]
91 sbci YH, hi8(-(usbRxBuf)) ;1 [09] [rx loop init]
92 push shift ;2 [10+11]
93 ser shift ;1 [12]
94 sbis USBIN, USBMINUS ;1 [-1] [13] <--sample:we want two bits K (sample 1 cycle too early)
95 rjmp haveTwoBitsK ;2 [00] [14]
96 pop shift ;2 [15+16] undo the push from before
97 pop YH ;2 [17+18] undo the push from before
98 rjmp waitForK ;2 [19+20] this was not the end of sync, retry
99; The entire loop from waitForK until rjmp waitForK above must not exceed two
100; bit times (= 20 cycles).
101
102;----------------------------------------------------------------------------
103; push more registers and initialize values while we sample the first bits:
104;----------------------------------------------------------------------------
105haveTwoBitsK: ;- [01]
106 push x1 ;2 [02+03]
107 push x2 ;2 [04+05]
108 push x3 ;2 [06+07]
109 push bitcnt ;2 [08+09]
110 in x1, USBIN ;1 [00] [10] <-- sample bit 0
111 bst x1, USBMINUS ;1 [01]
112 bld shift, 0 ;1 [02]
113 push cnt ;2 [03+04]
114 ldi cnt, USB_BUFSIZE ;1 [05]
115 push x4 ;2 [06+07] tx loop
116 rjmp rxLoop ;2 [08]
117;----------------------------------------------------------------------------
118; Receiver loop (numbers in brackets are cycles within byte after instr)
119;----------------------------------------------------------------------------
120unstuff0: ;- [07] (branch taken)
121 andi x3, ~0x01 ;1 [08]
122 mov x1, x2 ;1 [09] x2 contains last sampled (stuffed) bit
123 in x2, USBIN ;1 [00] [10] <-- sample bit 1 again
124 andi x2, USBMASK ;1 [01]
125 breq se0Hop ;1 [02] SE0 check for bit 1
126 ori shift, 0x01 ;1 [03] 0b00000001
127 nop ;1 [04]
128 rjmp didUnstuff0 ;2 [05]
129;-----------------------------------------------------
130unstuff1: ;- [05] (branch taken)
131 mov x2, x1 ;1 [06] x1 contains last sampled (stuffed) bit
132 andi x3, ~0x02 ;1 [07]
133 ori shift, 0x02 ;1 [08] 0b00000010
134 nop ;1 [09]
135 in x1, USBIN ;1 [00] [10] <-- sample bit 2 again
136 andi x1, USBMASK ;1 [01]
137 breq se0Hop ;1 [02] SE0 check for bit 2
138 rjmp didUnstuff1 ;2 [03]
139;-----------------------------------------------------
140unstuff2: ;- [05] (branch taken)
141 andi x3, ~0x04 ;1 [06]
142 ori shift, 0x04 ;1 [07] 0b00000100
143 mov x1, x2 ;1 [08] x2 contains last sampled (stuffed) bit
144 nop ;1 [09]
145 in x2, USBIN ;1 [00] [10] <-- sample bit 3
146 andi x2, USBMASK ;1 [01]
147 breq se0Hop ;1 [02] SE0 check for bit 3
148 rjmp didUnstuff2 ;2 [03]
149;-----------------------------------------------------
150unstuff3: ;- [00] [10] (branch taken)
151 in x2, USBIN ;1 [01] [11] <-- sample stuffed bit 3 one cycle too late
152 andi x2, USBMASK ;1 [02]
153 breq se0Hop ;1 [03] SE0 check for stuffed bit 3
154 andi x3, ~0x08 ;1 [04]
155 ori shift, 0x08 ;1 [05] 0b00001000
156 rjmp didUnstuff3 ;2 [06]
157;----------------------------------------------------------------------------
158; extra jobs done during bit interval:
159;
160; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs],
161; overflow check, jump to the head of rxLoop
162; bit 1: SE0 check
163; bit 2: SE0 check, recovery from delay [bit 0 tasks took too long]
164; bit 3: SE0 check, recovery from delay [bit 0 tasks took too long]
165; bit 4: SE0 check, none
166; bit 5: SE0 check, none
167; bit 6: SE0 check, none
168; bit 7: SE0 check, reconstruct: x3 is 0 at bit locations we changed, 1 at others
169;----------------------------------------------------------------------------
170rxLoop: ;- [09]
171 in x2, USBIN ;1 [00] [10] <-- sample bit 1 (or possibly bit 0 stuffed)
172 andi x2, USBMASK ;1 [01]
173 brne SkipSe0Hop ;1 [02]
174se0Hop: ;- [02]
175 rjmp se0 ;2 [03] SE0 check for bit 1
176SkipSe0Hop: ;- [03]
177 ser x3 ;1 [04]
178 andi shift, 0xf9 ;1 [05] 0b11111001
179 breq unstuff0 ;1 [06]
180didUnstuff0: ;- [06]
181 eor x1, x2 ;1 [07]
182 bst x1, USBMINUS ;1 [08]
183 bld shift, 1 ;1 [09]
184 in x1, USBIN ;1 [00] [10] <-- sample bit 2 (or possibly bit 1 stuffed)
185 andi x1, USBMASK ;1 [01]
186 breq se0Hop ;1 [02] SE0 check for bit 2
187 andi shift, 0xf3 ;1 [03] 0b11110011
188 breq unstuff1 ;1 [04] do remaining work for bit 1
189didUnstuff1: ;- [04]
190 eor x2, x1 ;1 [05]
191 bst x2, USBMINUS ;1 [06]
192 bld shift, 2 ;1 [07]
193 nop2 ;2 [08+09]
194 in x2, USBIN ;1 [00] [10] <-- sample bit 3 (or possibly bit 2 stuffed)
195 andi x2, USBMASK ;1 [01]
196 breq se0Hop ;1 [02] SE0 check for bit 3
197 andi shift, 0xe7 ;1 [03] 0b11100111
198 breq unstuff2 ;1 [04]
199didUnstuff2: ;- [04]
200 eor x1, x2 ;1 [05]
201 bst x1, USBMINUS ;1 [06]
202 bld shift, 3 ;1 [07]
203didUnstuff3: ;- [07]
204 andi shift, 0xcf ;1 [08] 0b11001111
205 breq unstuff3 ;1 [09]
206 in x1, USBIN ;1 [00] [10] <-- sample bit 4
207 andi x1, USBMASK ;1 [01]
208 breq se0Hop ;1 [02] SE0 check for bit 4
209 eor x2, x1 ;1 [03]
210 bst x2, USBMINUS ;1 [04]
211 bld shift, 4 ;1 [05]
212didUnstuff4: ;- [05]
213 andi shift, 0x9f ;1 [06] 0b10011111
214 breq unstuff4 ;1 [07]
215 nop2 ;2 [08+09]
216 in x2, USBIN ;1 [00] [10] <-- sample bit 5
217 andi x2, USBMASK ;1 [01]
218 breq se0 ;1 [02] SE0 check for bit 5
219 eor x1, x2 ;1 [03]
220 bst x1, USBMINUS ;1 [04]
221 bld shift, 5 ;1 [05]
222didUnstuff5: ;- [05]
223 andi shift, 0x3f ;1 [06] 0b00111111
224 breq unstuff5 ;1 [07]
225 nop2 ;2 [08+09]
226 in x1, USBIN ;1 [00] [10] <-- sample bit 6
227 andi x1, USBMASK ;1 [01]
228 breq se0 ;1 [02] SE0 check for bit 6
229 eor x2, x1 ;1 [03]
230 bst x2, USBMINUS ;1 [04]
231 bld shift, 6 ;1 [05]
232didUnstuff6: ;- [05]
233 cpi shift, 0x02 ;1 [06] 0b00000010
234 brlo unstuff6 ;1 [07]
235 nop2 ;2 [08+09]
236 in x2, USBIN ;1 [00] [10] <-- sample bit 7
237 andi x2, USBMASK ;1 [01]
238 breq se0 ;1 [02] SE0 check for bit 7
239 eor x1, x2 ;1 [03]
240 bst x1, USBMINUS ;1 [04]
241 bld shift, 7 ;1 [05]
242didUnstuff7: ;- [05]
243 cpi shift, 0x04 ;1 [06] 0b00000100
244 brlo unstuff7 ;1 [07]
245 eor x3, shift ;1 [08] reconstruct: x3 is 0 at bit locations we changed, 1 at others
246 nop ;1 [09]
247 in x1, USBIN ;1 [00] [10] <-- sample bit 0
248 st y+, x3 ;2 [01+02] store data
249 eor x2, x1 ;1 [03]
250 bst x2, USBMINUS ;1 [04]
251 bld shift, 0 ;1 [05]
252 subi cnt, 1 ;1 [06]
253 brcs overflow ;1 [07]
254 rjmp rxLoop ;2 [08]
255;-----------------------------------------------------
256unstuff4: ;- [08]
257 andi x3, ~0x10 ;1 [09]
258 in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 4
259 andi x1, USBMASK ;1 [01]
260 breq se0 ;1 [02] SE0 check for stuffed bit 4
261 ori shift, 0x10 ;1 [03]
262 rjmp didUnstuff4 ;2 [04]
263;-----------------------------------------------------
264unstuff5: ;- [08]
265 ori shift, 0x20 ;1 [09]
266 in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 5
267 andi x2, USBMASK ;1 [01]
268 breq se0 ;1 [02] SE0 check for stuffed bit 5
269 andi x3, ~0x20 ;1 [03]
270 rjmp didUnstuff5 ;2 [04]
271;-----------------------------------------------------
272unstuff6: ;- [08]
273 andi x3, ~0x40 ;1 [09]
274 in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 6
275 andi x1, USBMASK ;1 [01]
276 breq se0 ;1 [02] SE0 check for stuffed bit 6
277 ori shift, 0x40 ;1 [03]
278 rjmp didUnstuff6 ;2 [04]
279;-----------------------------------------------------
280unstuff7: ;- [08]
281 andi x3, ~0x80 ;1 [09]
282 in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 7
283 andi x2, USBMASK ;1 [01]
284 breq se0 ;1 [02] SE0 check for stuffed bit 7
285 ori shift, 0x80 ;1 [03]
286 rjmp didUnstuff7 ;2 [04]
287
288macro POP_STANDARD ; 16 cycles
289 pop x4
290 pop cnt
291 pop bitcnt
292 pop x3
293 pop x2
294 pop x1
295 pop shift
296 pop YH
297 endm
298macro POP_RETI ; 5 cycles
299 pop YL
300 out SREG, YL
301 pop YL
302 endm
303
304#include "asmcommon.inc"
305
306;---------------------------------------------------------------------------
307; USB spec says:
308; idle = J
309; J = (D+ = 0), (D- = 1)
310; K = (D+ = 1), (D- = 0)
311; Spec allows 7.5 bit times from EOP to SOP for replies
312;---------------------------------------------------------------------------
313bitstuffN: ;- [04]
314 eor x1, x4 ;1 [05]
315 clr x2 ;1 [06]
316 nop ;1 [07]
317 rjmp didStuffN ;1 [08]
318;---------------------------------------------------------------------------
319bitstuff6: ;- [04]
320 eor x1, x4 ;1 [05]
321 clr x2 ;1 [06]
322 rjmp didStuff6 ;1 [07]
323;---------------------------------------------------------------------------
324bitstuff7: ;- [02]
325 eor x1, x4 ;1 [03]
326 clr x2 ;1 [06]
327 nop ;1 [05]
328 rjmp didStuff7 ;1 [06]
329;---------------------------------------------------------------------------
330sendNakAndReti: ;- [-19]
331 ldi x3, USBPID_NAK ;1 [-18]
332 rjmp sendX3AndReti ;1 [-17]
333;---------------------------------------------------------------------------
334sendAckAndReti: ;- [-17]
335 ldi cnt, USBPID_ACK ;1 [-16]
336sendCntAndReti: ;- [-16]
337 mov x3, cnt ;1 [-15]
338sendX3AndReti: ;- [-15]
339 ldi YL, 20 ;1 [-14] x3==r20 address is 20
340 ldi YH, 0 ;1 [-13]
341 ldi cnt, 2 ;1 [-12]
342; rjmp usbSendAndReti fallthrough
343;---------------------------------------------------------------------------
344;usbSend:
345;pointer to data in 'Y'
346;number of bytes in 'cnt' -- including sync byte [range 2 ... 12]
347;uses: x1...x4, btcnt, shift, cnt, Y
348;Numbers in brackets are time since first bit of sync pattern is sent
349;We need not to match the transfer rate exactly because the spec demands
350;only 1.5% precision anyway.
351usbSendAndReti: ;- [-13] 13 cycles until SOP
352 in x2, USBDDR ;1 [-12]
353 ori x2, USBMASK ;1 [-11]
354 sbi USBOUT, USBMINUS ;2 [-09-10] prepare idle state; D+ and D- must have been 0 (no pullups)
355 in x1, USBOUT ;1 [-08] port mirror for tx loop
356 out USBDDR, x2 ;1 [-07] <- acquire bus
357 ; need not init x2 (bitstuff history) because sync starts with 0
358 ldi x4, USBMASK ;1 [-06] exor mask
359 ldi shift, 0x80 ;1 [-05] sync byte is first byte sent
360 ldi bitcnt, 6 ;1 [-04]
361txBitLoop: ;- [-04] [06]
362 sbrs shift, 0 ;1 [-03] [07]
363 eor x1, x4 ;1 [-02] [08]
364 ror shift ;1 [-01] [09]
365didStuffN: ;- [09]
366 out USBOUT, x1 ;1 [00] [10] <-- out N
367 ror x2 ;1 [01]
368 cpi x2, 0xfc ;1 [02]
369 brcc bitstuffN ;1 [03]
370 dec bitcnt ;1 [04]
371 brne txBitLoop ;1 [05]
372 sbrs shift, 0 ;1 [06]
373 eor x1, x4 ;1 [07]
374 ror shift ;1 [08]
375didStuff6: ;- [08]
376 nop ;1 [09]
377 out USBOUT, x1 ;1 [00] [10] <-- out 6
378 ror x2 ;1 [01]
379 cpi x2, 0xfc ;1 [02]
380 brcc bitstuff6 ;1 [03]
381 sbrs shift, 0 ;1 [04]
382 eor x1, x4 ;1 [05]
383 ror shift ;1 [06]
384 ror x2 ;1 [07]
385didStuff7: ;- [07]
386 ldi bitcnt, 6 ;1 [08]
387 cpi x2, 0xfc ;1 [09]
388 out USBOUT, x1 ;1 [00] [10] <-- out 7
389 brcc bitstuff7 ;1 [01]
390 ld shift, y+ ;2 [02+03]
391 dec cnt ;1 [04]
392 brne txBitLoop ;1 [05]
393makeSE0:
394 cbr x1, USBMASK ;1 [06] prepare SE0 [spec says EOP may be 19 to 23 cycles]
395 lds x2, usbNewDeviceAddr;2 [07+08]
396 lsl x2 ;1 [09] we compare with left shifted address
397;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm:
398;set address only after data packet was sent, not after handshake
399 out USBOUT, x1 ;1 [00] [10] <-- out SE0-- from now 2 bits==20 cycl. until bus idle
400 subi YL, 20 + 2 ;1 [01] Only assign address on data packets, not ACK/NAK in x3
401 sbci YH, 0 ;1 [02]
402 breq skipAddrAssign ;1 [03]
403 sts usbDeviceAddr, x2 ;2 [04+05] if not skipped: SE0 is one cycle longer
404;----------------------------------------------------------------------------
405;end of usbDeviceAddress transfer
406skipAddrAssign: ;- [03/04]
407 ldi x2, 1<<USB_INTR_PENDING_BIT ;1 [05] int0 occurred during TX -- clear pending flag
408 USB_STORE_PENDING(x2) ;1 [06]
409 ori x1, USBIDLE ;1 [07]
410 in x2, USBDDR ;1 [08]
411 cbr x2, USBMASK ;1 [09] set both pins to input
412 mov x3, x1 ;1 [10]
413 cbr x3, USBMASK ;1 [11] configure no pullup on both pins
414 ldi x4, 3 ;1 [12]
415se0Delay: ;- [12] [15]
416 dec x4 ;1 [13] [16]
417 brne se0Delay ;1 [14] [17]
418 nop2 ;2 [18+19]
419 out USBOUT, x1 ;1 [20] <--out J (idle) -- end of SE0 (EOP sig.)
420 out USBDDR, x2 ;1 [21] <--release bus now
421 out USBOUT, x3 ;1 [22] <--ensure no pull-up resistors are active
422 rjmp doReturn ;1 [23]
423;---------------------------------------------------------------------------
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm16.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm16.inc
deleted file mode 100644
index 207b6e48a1..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm16.inc
+++ /dev/null
@@ -1,346 +0,0 @@
1/* Name: usbdrvasm16.inc
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2007-06-15
5 * Tabsize: 4
6 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * Revision: $Id: usbdrvasm16.inc 760 2009-08-09 18:59:43Z cs $
9 */
10
11/* Do not link this file! Link usbdrvasm.S instead, which includes the
12 * appropriate implementation!
13 */
14
15/*
16General Description:
17This file is the 16 MHz version of the asssembler part of the USB driver. It
18requires a 16 MHz crystal (not a ceramic resonator and not a calibrated RC
19oscillator).
20
21See usbdrv.h for a description of the entire driver.
22
23Since almost all of this code is timing critical, don't change unless you
24really know what you are doing! Many parts require not only a maximum number
25of CPU cycles, but even an exact number of cycles!
26*/
27
28;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes
29;nominal frequency: 16 MHz -> 10.6666666 cycles per bit, 85.333333333 cycles per byte
30; Numbers in brackets are clocks counted from center of last sync bit
31; when instruction starts
32
33USB_INTR_VECTOR:
34;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt
35 push YL ;[-25] push only what is necessary to sync with edge ASAP
36 in YL, SREG ;[-23]
37 push YL ;[-22]
38 push YH ;[-20]
39;----------------------------------------------------------------------------
40; Synchronize with sync pattern:
41;----------------------------------------------------------------------------
42;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K]
43;sync up with J to K edge during sync pattern -- use fastest possible loops
44;The first part waits at most 1 bit long since we must be in sync pattern.
45;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to
46;waitForJ, ensure that this prerequisite is met.
47waitForJ:
48 inc YL
49 sbis USBIN, USBMINUS
50 brne waitForJ ; just make sure we have ANY timeout
51waitForK:
52;The following code results in a sampling window of < 1/4 bit which meets the spec.
53 sbis USBIN, USBMINUS ;[-15]
54 rjmp foundK ;[-14]
55 sbis USBIN, USBMINUS
56 rjmp foundK
57 sbis USBIN, USBMINUS
58 rjmp foundK
59 sbis USBIN, USBMINUS
60 rjmp foundK
61 sbis USBIN, USBMINUS
62 rjmp foundK
63 sbis USBIN, USBMINUS
64 rjmp foundK
65#if USB_COUNT_SOF
66 lds YL, usbSofCount
67 inc YL
68 sts usbSofCount, YL
69#endif /* USB_COUNT_SOF */
70#ifdef USB_SOF_HOOK
71 USB_SOF_HOOK
72#endif
73 rjmp sofError
74foundK: ;[-12]
75;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling]
76;we have 1 bit time for setup purposes, then sample again. Numbers in brackets
77;are cycles from center of first sync (double K) bit after the instruction
78 push bitcnt ;[-12]
79; [---] ;[-11]
80 lds YL, usbInputBufOffset;[-10]
81; [---] ;[-9]
82 clr YH ;[-8]
83 subi YL, lo8(-(usbRxBuf));[-7] [rx loop init]
84 sbci YH, hi8(-(usbRxBuf));[-6] [rx loop init]
85 push shift ;[-5]
86; [---] ;[-4]
87 ldi bitcnt, 0x55 ;[-3] [rx loop init]
88 sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early)
89 rjmp haveTwoBitsK ;[-1]
90 pop shift ;[0] undo the push from before
91 pop bitcnt ;[2] undo the push from before
92 rjmp waitForK ;[4] this was not the end of sync, retry
93; The entire loop from waitForK until rjmp waitForK above must not exceed two
94; bit times (= 21 cycles).
95
96;----------------------------------------------------------------------------
97; push more registers and initialize values while we sample the first bits:
98;----------------------------------------------------------------------------
99haveTwoBitsK:
100 push x1 ;[1]
101 push x2 ;[3]
102 push x3 ;[5]
103 ldi shift, 0 ;[7]
104 ldi x3, 1<<4 ;[8] [rx loop init] first sample is inverse bit, compensate that
105 push x4 ;[9] == leap
106
107 in x1, USBIN ;[11] <-- sample bit 0
108 andi x1, USBMASK ;[12]
109 bst x1, USBMINUS ;[13]
110 bld shift, 7 ;[14]
111 push cnt ;[15]
112 ldi leap, 0 ;[17] [rx loop init]
113 ldi cnt, USB_BUFSIZE;[18] [rx loop init]
114 rjmp rxbit1 ;[19] arrives at [21]
115
116;----------------------------------------------------------------------------
117; Receiver loop (numbers in brackets are cycles within byte after instr)
118;----------------------------------------------------------------------------
119
120; duration of unstuffing code should be 10.66666667 cycles. We adjust "leap"
121; accordingly to approximate this value in the long run.
122
123unstuff6:
124 andi x2, USBMASK ;[03]
125 ori x3, 1<<6 ;[04] will not be shifted any more
126 andi shift, ~0x80;[05]
127 mov x1, x2 ;[06] sampled bit 7 is actually re-sampled bit 6
128 subi leap, -1 ;[07] total duration = 11 bits -> subtract 1/3
129 rjmp didUnstuff6 ;[08]
130
131unstuff7:
132 ori x3, 1<<7 ;[09] will not be shifted any more
133 in x2, USBIN ;[00] [10] re-sample bit 7
134 andi x2, USBMASK ;[01]
135 andi shift, ~0x80;[02]
136 subi leap, 2 ;[03] total duration = 10 bits -> add 1/3
137 rjmp didUnstuff7 ;[04]
138
139unstuffEven:
140 ori x3, 1<<6 ;[09] will be shifted right 6 times for bit 0
141 in x1, USBIN ;[00] [10]
142 andi shift, ~0x80;[01]
143 andi x1, USBMASK ;[02]
144 breq se0 ;[03]
145 subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3
146 nop2 ;[05]
147 rjmp didUnstuffE ;[06]
148
149unstuffOdd:
150 ori x3, 1<<5 ;[09] will be shifted right 4 times for bit 1
151 in x2, USBIN ;[00] [10]
152 andi shift, ~0x80;[01]
153 andi x2, USBMASK ;[02]
154 breq se0 ;[03]
155 subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3
156 nop2 ;[05]
157 rjmp didUnstuffO ;[06]
158
159rxByteLoop:
160 andi x1, USBMASK ;[03]
161 eor x2, x1 ;[04]
162 subi leap, 1 ;[05]
163 brpl skipLeap ;[06]
164 subi leap, -3 ;1 one leap cycle every 3rd byte -> 85 + 1/3 cycles per byte
165 nop ;1
166skipLeap:
167 subi x2, 1 ;[08]
168 ror shift ;[09]
169didUnstuff6:
170 cpi shift, 0xfc ;[10]
171 in x2, USBIN ;[00] [11] <-- sample bit 7
172 brcc unstuff6 ;[01]
173 andi x2, USBMASK ;[02]
174 eor x1, x2 ;[03]
175 subi x1, 1 ;[04]
176 ror shift ;[05]
177didUnstuff7:
178 cpi shift, 0xfc ;[06]
179 brcc unstuff7 ;[07]
180 eor x3, shift ;[08] reconstruct: x3 is 1 at bit locations we changed, 0 at others
181 st y+, x3 ;[09] store data
182rxBitLoop:
183 in x1, USBIN ;[00] [11] <-- sample bit 0/2/4
184 andi x1, USBMASK ;[01]
185 eor x2, x1 ;[02]
186 andi x3, 0x3f ;[03] topmost two bits reserved for 6 and 7
187 subi x2, 1 ;[04]
188 ror shift ;[05]
189 cpi shift, 0xfc ;[06]
190 brcc unstuffEven ;[07]
191didUnstuffE:
192 lsr x3 ;[08]
193 lsr x3 ;[09]
194rxbit1:
195 in x2, USBIN ;[00] [10] <-- sample bit 1/3/5
196 andi x2, USBMASK ;[01]
197 breq se0 ;[02]
198 eor x1, x2 ;[03]
199 subi x1, 1 ;[04]
200 ror shift ;[05]
201 cpi shift, 0xfc ;[06]
202 brcc unstuffOdd ;[07]
203didUnstuffO:
204 subi bitcnt, 0xab;[08] == addi 0x55, 0x55 = 0x100/3
205 brcs rxBitLoop ;[09]
206
207 subi cnt, 1 ;[10]
208 in x1, USBIN ;[00] [11] <-- sample bit 6
209 brcc rxByteLoop ;[01]
210 rjmp overflow
211
212macro POP_STANDARD ; 14 cycles
213 pop cnt
214 pop x4
215 pop x3
216 pop x2
217 pop x1
218 pop shift
219 pop bitcnt
220 endm
221macro POP_RETI ; 7 cycles
222 pop YH
223 pop YL
224 out SREG, YL
225 pop YL
226 endm
227
228#include "asmcommon.inc"
229
230; USB spec says:
231; idle = J
232; J = (D+ = 0), (D- = 1)
233; K = (D+ = 1), (D- = 0)
234; Spec allows 7.5 bit times from EOP to SOP for replies
235
236bitstuffN:
237 eor x1, x4 ;[5]
238 ldi x2, 0 ;[6]
239 nop2 ;[7]
240 nop ;[9]
241 out USBOUT, x1 ;[10] <-- out
242 rjmp didStuffN ;[0]
243
244bitstuff6:
245 eor x1, x4 ;[5]
246 ldi x2, 0 ;[6] Carry is zero due to brcc
247 rol shift ;[7] compensate for ror shift at branch destination
248 rjmp didStuff6 ;[8]
249
250bitstuff7:
251 ldi x2, 0 ;[2] Carry is zero due to brcc
252 rjmp didStuff7 ;[3]
253
254
255sendNakAndReti:
256 ldi x3, USBPID_NAK ;[-18]
257 rjmp sendX3AndReti ;[-17]
258sendAckAndReti:
259 ldi cnt, USBPID_ACK ;[-17]
260sendCntAndReti:
261 mov x3, cnt ;[-16]
262sendX3AndReti:
263 ldi YL, 20 ;[-15] x3==r20 address is 20
264 ldi YH, 0 ;[-14]
265 ldi cnt, 2 ;[-13]
266; rjmp usbSendAndReti fallthrough
267
268;usbSend:
269;pointer to data in 'Y'
270;number of bytes in 'cnt' -- including sync byte [range 2 ... 12]
271;uses: x1...x4, btcnt, shift, cnt, Y
272;Numbers in brackets are time since first bit of sync pattern is sent
273;We don't match the transfer rate exactly (don't insert leap cycles every third
274;byte) because the spec demands only 1.5% precision anyway.
275usbSendAndReti: ; 12 cycles until SOP
276 in x2, USBDDR ;[-12]
277 ori x2, USBMASK ;[-11]
278 sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups)
279 in x1, USBOUT ;[-8] port mirror for tx loop
280 out USBDDR, x2 ;[-7] <- acquire bus
281; need not init x2 (bitstuff history) because sync starts with 0
282 ldi x4, USBMASK ;[-6] exor mask
283 ldi shift, 0x80 ;[-5] sync byte is first byte sent
284txByteLoop:
285 ldi bitcnt, 0x35 ;[-4] [6] binary 0011 0101
286txBitLoop:
287 sbrs shift, 0 ;[-3] [7]
288 eor x1, x4 ;[-2] [8]
289 out USBOUT, x1 ;[-1] [9] <-- out N
290 ror shift ;[0] [10]
291 ror x2 ;[1]
292didStuffN:
293 cpi x2, 0xfc ;[2]
294 brcc bitstuffN ;[3]
295 lsr bitcnt ;[4]
296 brcc txBitLoop ;[5]
297 brne txBitLoop ;[6]
298
299 sbrs shift, 0 ;[7]
300 eor x1, x4 ;[8]
301didStuff6:
302 out USBOUT, x1 ;[-1] [9] <-- out 6
303 ror shift ;[0] [10]
304 ror x2 ;[1]
305 cpi x2, 0xfc ;[2]
306 brcc bitstuff6 ;[3]
307 ror shift ;[4]
308didStuff7:
309 ror x2 ;[5]
310 sbrs x2, 7 ;[6]
311 eor x1, x4 ;[7]
312 nop ;[8]
313 cpi x2, 0xfc ;[9]
314 out USBOUT, x1 ;[-1][10] <-- out 7
315 brcc bitstuff7 ;[0] [11]
316 ld shift, y+ ;[1]
317 dec cnt ;[3]
318 brne txByteLoop ;[4]
319;make SE0:
320 cbr x1, USBMASK ;[5] prepare SE0 [spec says EOP may be 21 to 25 cycles]
321 lds x2, usbNewDeviceAddr;[6]
322 lsl x2 ;[8] we compare with left shifted address
323 subi YL, 20 + 2 ;[9] Only assign address on data packets, not ACK/NAK in x3
324 sbci YH, 0 ;[10]
325 out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle
326;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm:
327;set address only after data packet was sent, not after handshake
328 breq skipAddrAssign ;[0]
329 sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer
330skipAddrAssign:
331;end of usbDeviceAddress transfer
332 ldi x2, 1<<USB_INTR_PENDING_BIT;[2] int0 occurred during TX -- clear pending flag
333 USB_STORE_PENDING(x2) ;[3]
334 ori x1, USBIDLE ;[4]
335 in x2, USBDDR ;[5]
336 cbr x2, USBMASK ;[6] set both pins to input
337 mov x3, x1 ;[7]
338 cbr x3, USBMASK ;[8] configure no pullup on both pins
339 ldi x4, 4 ;[9]
340se0Delay:
341 dec x4 ;[10] [13] [16] [19]
342 brne se0Delay ;[11] [14] [17] [20]
343 out USBOUT, x1 ;[21] <-- out J (idle) -- end of SE0 (EOP signal)
344 out USBDDR, x2 ;[22] <-- release bus now
345 out USBOUT, x3 ;[23] <-- ensure no pull-up resistors are active
346 rjmp doReturn
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm165.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm165.inc
deleted file mode 100644
index 79b3c61cf8..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm165.inc
+++ /dev/null
@@ -1,453 +0,0 @@
1/* Name: usbdrvasm165.inc
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2007-04-22
5 * Tabsize: 4
6 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * Revision: $Id: usbdrvasm165.inc 740 2009-04-13 18:23:31Z cs $
9 */
10
11/* Do not link this file! Link usbdrvasm.S instead, which includes the
12 * appropriate implementation!
13 */
14
15/*
16General Description:
17This file is the 16.5 MHz version of the USB driver. It is intended for the
18ATTiny45 and similar controllers running on 16.5 MHz internal RC oscillator.
19This version contains a phase locked loop in the receiver routine to cope with
20slight clock rate deviations of up to +/- 1%.
21
22See usbdrv.h for a description of the entire driver.
23
24Since almost all of this code is timing critical, don't change unless you
25really know what you are doing! Many parts require not only a maximum number
26of CPU cycles, but even an exact number of cycles!
27*/
28
29;Software-receiver engine. Strict timing! Don't change unless you can preserve timing!
30;interrupt response time: 4 cycles + insn running = 7 max if interrupts always enabled
31;max allowable interrupt latency: 59 cycles -> max 52 cycles interrupt disable
32;max stack usage: [ret(2), r0, SREG, YL, YH, shift, x1, x2, x3, x4, cnt] = 12 bytes
33;nominal frequency: 16.5 MHz -> 11 cycles per bit
34; 16.3125 MHz < F_CPU < 16.6875 MHz (+/- 1.1%)
35; Numbers in brackets are clocks counted from center of last sync bit
36; when instruction starts
37
38
39USB_INTR_VECTOR:
40;order of registers pushed: YL, SREG [sofError], r0, YH, shift, x1, x2, x3, x4, cnt
41 push YL ;[-23] push only what is necessary to sync with edge ASAP
42 in YL, SREG ;[-21]
43 push YL ;[-20]
44;----------------------------------------------------------------------------
45; Synchronize with sync pattern:
46;----------------------------------------------------------------------------
47;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K]
48;sync up with J to K edge during sync pattern -- use fastest possible loops
49;The first part waits at most 1 bit long since we must be in sync pattern.
50;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to
51;waitForJ, ensure that this prerequisite is met.
52waitForJ:
53 inc YL
54 sbis USBIN, USBMINUS
55 brne waitForJ ; just make sure we have ANY timeout
56waitForK:
57;The following code results in a sampling window of < 1/4 bit which meets the spec.
58 sbis USBIN, USBMINUS ;[-15]
59 rjmp foundK ;[-14]
60 sbis USBIN, USBMINUS
61 rjmp foundK
62 sbis USBIN, USBMINUS
63 rjmp foundK
64 sbis USBIN, USBMINUS
65 rjmp foundK
66 sbis USBIN, USBMINUS
67 rjmp foundK
68 sbis USBIN, USBMINUS
69 rjmp foundK
70#if USB_COUNT_SOF
71 lds YL, usbSofCount
72 inc YL
73 sts usbSofCount, YL
74#endif /* USB_COUNT_SOF */
75#ifdef USB_SOF_HOOK
76 USB_SOF_HOOK
77#endif
78 rjmp sofError
79foundK: ;[-12]
80;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling]
81;we have 1 bit time for setup purposes, then sample again. Numbers in brackets
82;are cycles from center of first sync (double K) bit after the instruction
83 push r0 ;[-12]
84; [---] ;[-11]
85 push YH ;[-10]
86; [---] ;[-9]
87 lds YL, usbInputBufOffset;[-8]
88; [---] ;[-7]
89 clr YH ;[-6]
90 subi YL, lo8(-(usbRxBuf));[-5] [rx loop init]
91 sbci YH, hi8(-(usbRxBuf));[-4] [rx loop init]
92 mov r0, x2 ;[-3] [rx loop init]
93 sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early)
94 rjmp haveTwoBitsK ;[-1]
95 pop YH ;[0] undo the pushes from before
96 pop r0 ;[2]
97 rjmp waitForK ;[4] this was not the end of sync, retry
98; The entire loop from waitForK until rjmp waitForK above must not exceed two
99; bit times (= 22 cycles).
100
101;----------------------------------------------------------------------------
102; push more registers and initialize values while we sample the first bits:
103;----------------------------------------------------------------------------
104haveTwoBitsK: ;[1]
105 push shift ;[1]
106 push x1 ;[3]
107 push x2 ;[5]
108 push x3 ;[7]
109 ldi shift, 0xff ;[9] [rx loop init]
110 ori x3, 0xff ;[10] [rx loop init] == ser x3, clear zero flag
111
112 in x1, USBIN ;[11] <-- sample bit 0
113 bst x1, USBMINUS ;[12]
114 bld shift, 0 ;[13]
115 push x4 ;[14] == phase
116; [---] ;[15]
117 push cnt ;[16]
118; [---] ;[17]
119 ldi phase, 0 ;[18] [rx loop init]
120 ldi cnt, USB_BUFSIZE;[19] [rx loop init]
121 rjmp rxbit1 ;[20]
122; [---] ;[21]
123
124;----------------------------------------------------------------------------
125; Receiver loop (numbers in brackets are cycles within byte after instr)
126;----------------------------------------------------------------------------
127/*
128byte oriented operations done during loop:
129bit 0: store data
130bit 1: SE0 check
131bit 2: overflow check
132bit 3: catch up
133bit 4: rjmp to achieve conditional jump range
134bit 5: PLL
135bit 6: catch up
136bit 7: jump, fixup bitstuff
137; 87 [+ 2] cycles
138------------------------------------------------------------------
139*/
140continueWithBit5:
141 in x2, USBIN ;[055] <-- bit 5
142 eor r0, x2 ;[056]
143 or phase, r0 ;[057]
144 sbrc phase, USBMINUS ;[058]
145 lpm ;[059] optional nop3; modifies r0
146 in phase, USBIN ;[060] <-- phase
147 eor x1, x2 ;[061]
148 bst x1, USBMINUS ;[062]
149 bld shift, 5 ;[063]
150 andi shift, 0x3f ;[064]
151 in x1, USBIN ;[065] <-- bit 6
152 breq unstuff5 ;[066] *** unstuff escape
153 eor phase, x1 ;[067]
154 eor x2, x1 ;[068]
155 bst x2, USBMINUS ;[069]
156 bld shift, 6 ;[070]
157didUnstuff6: ;[ ]
158 in r0, USBIN ;[071] <-- phase
159 cpi shift, 0x02 ;[072]
160 brlo unstuff6 ;[073] *** unstuff escape
161didUnstuff5: ;[ ]
162 nop2 ;[074]
163; [---] ;[075]
164 in x2, USBIN ;[076] <-- bit 7
165 eor x1, x2 ;[077]
166 bst x1, USBMINUS ;[078]
167 bld shift, 7 ;[079]
168didUnstuff7: ;[ ]
169 eor r0, x2 ;[080]
170 or phase, r0 ;[081]
171 in r0, USBIN ;[082] <-- phase
172 cpi shift, 0x04 ;[083]
173 brsh rxLoop ;[084]
174; [---] ;[085]
175unstuff7: ;[ ]
176 andi x3, ~0x80 ;[085]
177 ori shift, 0x80 ;[086]
178 in x2, USBIN ;[087] <-- sample stuffed bit 7
179 nop ;[088]
180 rjmp didUnstuff7 ;[089]
181; [---] ;[090]
182 ;[080]
183
184unstuff5: ;[067]
185 eor phase, x1 ;[068]
186 andi x3, ~0x20 ;[069]
187 ori shift, 0x20 ;[070]
188 in r0, USBIN ;[071] <-- phase
189 mov x2, x1 ;[072]
190 nop ;[073]
191 nop2 ;[074]
192; [---] ;[075]
193 in x1, USBIN ;[076] <-- bit 6
194 eor r0, x1 ;[077]
195 or phase, r0 ;[078]
196 eor x2, x1 ;[079]
197 bst x2, USBMINUS ;[080]
198 bld shift, 6 ;[081] no need to check bitstuffing, we just had one
199 in r0, USBIN ;[082] <-- phase
200 rjmp didUnstuff5 ;[083]
201; [---] ;[084]
202 ;[074]
203
204unstuff6: ;[074]
205 andi x3, ~0x40 ;[075]
206 in x1, USBIN ;[076] <-- bit 6 again
207 ori shift, 0x40 ;[077]
208 nop2 ;[078]
209; [---] ;[079]
210 rjmp didUnstuff6 ;[080]
211; [---] ;[081]
212 ;[071]
213
214unstuff0: ;[013]
215 eor r0, x2 ;[014]
216 or phase, r0 ;[015]
217 andi x2, USBMASK ;[016] check for SE0
218 in r0, USBIN ;[017] <-- phase
219 breq didUnstuff0 ;[018] direct jump to se0 would be too long
220 andi x3, ~0x01 ;[019]
221 ori shift, 0x01 ;[020]
222 mov x1, x2 ;[021] mov existing sample
223 in x2, USBIN ;[022] <-- bit 1 again
224 rjmp didUnstuff0 ;[023]
225; [---] ;[024]
226 ;[014]
227
228unstuff1: ;[024]
229 eor r0, x1 ;[025]
230 or phase, r0 ;[026]
231 andi x3, ~0x02 ;[027]
232 in r0, USBIN ;[028] <-- phase
233 ori shift, 0x02 ;[029]
234 mov x2, x1 ;[030]
235 rjmp didUnstuff1 ;[031]
236; [---] ;[032]
237 ;[022]
238
239unstuff2: ;[035]
240 eor r0, x2 ;[036]
241 or phase, r0 ;[037]
242 andi x3, ~0x04 ;[038]
243 in r0, USBIN ;[039] <-- phase
244 ori shift, 0x04 ;[040]
245 mov x1, x2 ;[041]
246 rjmp didUnstuff2 ;[042]
247; [---] ;[043]
248 ;[033]
249
250unstuff3: ;[043]
251 in x2, USBIN ;[044] <-- bit 3 again
252 eor r0, x2 ;[045]
253 or phase, r0 ;[046]
254 andi x3, ~0x08 ;[047]
255 ori shift, 0x08 ;[048]
256 nop ;[049]
257 in r0, USBIN ;[050] <-- phase
258 rjmp didUnstuff3 ;[051]
259; [---] ;[052]
260 ;[042]
261
262unstuff4: ;[053]
263 andi x3, ~0x10 ;[054]
264 in x1, USBIN ;[055] <-- bit 4 again
265 ori shift, 0x10 ;[056]
266 rjmp didUnstuff4 ;[057]
267; [---] ;[058]
268 ;[048]
269
270rxLoop: ;[085]
271 eor x3, shift ;[086] reconstruct: x3 is 0 at bit locations we changed, 1 at others
272 in x1, USBIN ;[000] <-- bit 0
273 st y+, x3 ;[001]
274; [---] ;[002]
275 eor r0, x1 ;[003]
276 or phase, r0 ;[004]
277 eor x2, x1 ;[005]
278 in r0, USBIN ;[006] <-- phase
279 ser x3 ;[007]
280 bst x2, USBMINUS ;[008]
281 bld shift, 0 ;[009]
282 andi shift, 0xf9 ;[010]
283rxbit1: ;[ ]
284 in x2, USBIN ;[011] <-- bit 1
285 breq unstuff0 ;[012] *** unstuff escape
286 andi x2, USBMASK ;[013] SE0 check for bit 1
287didUnstuff0: ;[ ] Z only set if we detected SE0 in bitstuff
288 breq se0 ;[014]
289 eor r0, x2 ;[015]
290 or phase, r0 ;[016]
291 in r0, USBIN ;[017] <-- phase
292 eor x1, x2 ;[018]
293 bst x1, USBMINUS ;[019]
294 bld shift, 1 ;[020]
295 andi shift, 0xf3 ;[021]
296didUnstuff1: ;[ ]
297 in x1, USBIN ;[022] <-- bit 2
298 breq unstuff1 ;[023] *** unstuff escape
299 eor r0, x1 ;[024]
300 or phase, r0 ;[025]
301 subi cnt, 1 ;[026] overflow check
302 brcs overflow ;[027]
303 in r0, USBIN ;[028] <-- phase
304 eor x2, x1 ;[029]
305 bst x2, USBMINUS ;[030]
306 bld shift, 2 ;[031]
307 andi shift, 0xe7 ;[032]
308didUnstuff2: ;[ ]
309 in x2, USBIN ;[033] <-- bit 3
310 breq unstuff2 ;[034] *** unstuff escape
311 eor r0, x2 ;[035]
312 or phase, r0 ;[036]
313 eor x1, x2 ;[037]
314 bst x1, USBMINUS ;[038]
315 in r0, USBIN ;[039] <-- phase
316 bld shift, 3 ;[040]
317 andi shift, 0xcf ;[041]
318didUnstuff3: ;[ ]
319 breq unstuff3 ;[042] *** unstuff escape
320 nop ;[043]
321 in x1, USBIN ;[044] <-- bit 4
322 eor x2, x1 ;[045]
323 bst x2, USBMINUS ;[046]
324 bld shift, 4 ;[047]
325didUnstuff4: ;[ ]
326 eor r0, x1 ;[048]
327 or phase, r0 ;[049]
328 in r0, USBIN ;[050] <-- phase
329 andi shift, 0x9f ;[051]
330 breq unstuff4 ;[052] *** unstuff escape
331 rjmp continueWithBit5;[053]
332; [---] ;[054]
333
334macro POP_STANDARD ; 16 cycles
335 pop cnt
336 pop x4
337 pop x3
338 pop x2
339 pop x1
340 pop shift
341 pop YH
342 pop r0
343 endm
344macro POP_RETI ; 5 cycles
345 pop YL
346 out SREG, YL
347 pop YL
348 endm
349
350#include "asmcommon.inc"
351
352
353; USB spec says:
354; idle = J
355; J = (D+ = 0), (D- = 1)
356; K = (D+ = 1), (D- = 0)
357; Spec allows 7.5 bit times from EOP to SOP for replies
358
359bitstuff7:
360 eor x1, x4 ;[4]
361 ldi x2, 0 ;[5]
362 nop2 ;[6] C is zero (brcc)
363 rjmp didStuff7 ;[8]
364
365bitstuffN:
366 eor x1, x4 ;[5]
367 ldi x2, 0 ;[6]
368 lpm ;[7] 3 cycle NOP, modifies r0
369 out USBOUT, x1 ;[10] <-- out
370 rjmp didStuffN ;[0]
371
372#define bitStatus x3
373
374sendNakAndReti:
375 ldi cnt, USBPID_NAK ;[-19]
376 rjmp sendCntAndReti ;[-18]
377sendAckAndReti:
378 ldi cnt, USBPID_ACK ;[-17]
379sendCntAndReti:
380 mov r0, cnt ;[-16]
381 ldi YL, 0 ;[-15] R0 address is 0
382 ldi YH, 0 ;[-14]
383 ldi cnt, 2 ;[-13]
384; rjmp usbSendAndReti fallthrough
385
386;usbSend:
387;pointer to data in 'Y'
388;number of bytes in 'cnt' -- including sync byte [range 2 ... 12]
389;uses: x1...x4, shift, cnt, Y
390;Numbers in brackets are time since first bit of sync pattern is sent
391usbSendAndReti: ; 12 cycles until SOP
392 in x2, USBDDR ;[-12]
393 ori x2, USBMASK ;[-11]
394 sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups)
395 in x1, USBOUT ;[-8] port mirror for tx loop
396 out USBDDR, x2 ;[-7] <- acquire bus
397; need not init x2 (bitstuff history) because sync starts with 0
398 ldi x4, USBMASK ;[-6] exor mask
399 ldi shift, 0x80 ;[-5] sync byte is first byte sent
400 ldi bitStatus, 0xff ;[-4] init bit loop counter, works for up to 12 bytes
401byteloop:
402bitloop:
403 sbrs shift, 0 ;[8] [-3]
404 eor x1, x4 ;[9] [-2]
405 out USBOUT, x1 ;[10] [-1] <-- out
406 ror shift ;[0]
407 ror x2 ;[1]
408didStuffN:
409 cpi x2, 0xfc ;[2]
410 brcc bitstuffN ;[3]
411 nop ;[4]
412 subi bitStatus, 37 ;[5] 256 / 7 ~=~ 37
413 brcc bitloop ;[6] when we leave the loop, bitStatus has almost the initial value
414 sbrs shift, 0 ;[7]
415 eor x1, x4 ;[8]
416 ror shift ;[9]
417didStuff7:
418 out USBOUT, x1 ;[10] <-- out
419 ror x2 ;[0]
420 cpi x2, 0xfc ;[1]
421 brcc bitstuff7 ;[2]
422 ld shift, y+ ;[3]
423 dec cnt ;[5]
424 brne byteloop ;[6]
425;make SE0:
426 cbr x1, USBMASK ;[7] prepare SE0 [spec says EOP may be 21 to 25 cycles]
427 lds x2, usbNewDeviceAddr;[8]
428 lsl x2 ;[10] we compare with left shifted address
429 out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle
430;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm:
431;set address only after data packet was sent, not after handshake
432 subi YL, 2 ;[0] Only assign address on data packets, not ACK/NAK in r0
433 sbci YH, 0 ;[1]
434 breq skipAddrAssign ;[2]
435 sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer
436skipAddrAssign:
437;end of usbDeviceAddress transfer
438 ldi x2, 1<<USB_INTR_PENDING_BIT;[4] int0 occurred during TX -- clear pending flag
439 USB_STORE_PENDING(x2) ;[5]
440 ori x1, USBIDLE ;[6]
441 in x2, USBDDR ;[7]
442 cbr x2, USBMASK ;[8] set both pins to input
443 mov x3, x1 ;[9]
444 cbr x3, USBMASK ;[10] configure no pullup on both pins
445 ldi x4, 4 ;[11]
446se0Delay:
447 dec x4 ;[12] [15] [18] [21]
448 brne se0Delay ;[13] [16] [19] [22]
449 out USBOUT, x1 ;[23] <-- out J (idle) -- end of SE0 (EOP signal)
450 out USBDDR, x2 ;[24] <-- release bus now
451 out USBOUT, x3 ;[25] <-- ensure no pull-up resistors are active
452 rjmp doReturn
453
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm18-crc.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm18-crc.inc
deleted file mode 100644
index f83347df7f..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm18-crc.inc
+++ /dev/null
@@ -1,707 +0,0 @@
1/* Name: usbdrvasm18.inc
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Lukas Schrittwieser (based on 20 MHz usbdrvasm20.inc by Jeroen Benschop)
4 * Creation Date: 2009-01-20
5 * Tabsize: 4
6 * Copyright: (c) 2008 by Lukas Schrittwieser and OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * Revision: $Id: usbdrvasm18-crc.inc 740 2009-04-13 18:23:31Z cs $
9 */
10
11/* Do not link this file! Link usbdrvasm.S instead, which includes the
12 * appropriate implementation!
13 */
14
15/*
16General Description:
17This file is the 18 MHz version of the asssembler part of the USB driver. It
18requires a 18 MHz crystal (not a ceramic resonator and not a calibrated RC
19oscillator).
20
21See usbdrv.h for a description of the entire driver.
22
23Since almost all of this code is timing critical, don't change unless you
24really know what you are doing! Many parts require not only a maximum number
25of CPU cycles, but even an exact number of cycles!
26*/
27
28
29;max stack usage: [ret(2), YL, SREG, YH, [sofError], bitcnt(x5), shift, x1, x2, x3, x4, cnt, ZL, ZH] = 14 bytes
30;nominal frequency: 18 MHz -> 12 cycles per bit
31; Numbers in brackets are clocks counted from center of last sync bit
32; when instruction starts
33;register use in receive loop to receive the data bytes:
34; shift assembles the byte currently being received
35; x1 holds the D+ and D- line state
36; x2 holds the previous line state
37; cnt holds the number of bytes left in the receive buffer
38; x3 holds the higher crc byte (see algorithm below)
39; x4 is used as temporary register for the crc algorithm
40; x5 is used for unstuffing: when unstuffing the last received bit is inverted in shift (to prevent further
41; unstuffing calls. In the same time the corresponding bit in x5 is cleared to mark the bit as beening iverted
42; zl lower crc value and crc table index
43; zh used for crc table accesses
44
45;--------------------------------------------------------------------------------------------------------------
46; CRC mods:
47; table driven crc checker, Z points to table in prog space
48; ZL is the lower crc byte, x3 is the higher crc byte
49; x4 is used as temp register to store different results
50; the initialization of the crc register is not 0xFFFF but 0xFE54. This is because during the receipt of the
51; first data byte an virtual zero data byte is added to the crc register, this results in the correct initial
52; value of 0xFFFF at beginning of the second data byte before the first data byte is added to the crc.
53; The magic number 0xFE54 results form the crc table: At tabH[0x54] = 0xFF = crcH (required) and
54; tabL[0x54] = 0x01 -> crcL = 0x01 xor 0xFE = 0xFF
55; bitcnt is renamed to x5 and is used for unstuffing purposes, the unstuffing works like in the 12MHz version
56;--------------------------------------------------------------------------------------------------------------
57; CRC algorithm:
58; The crc register is formed by x3 (higher byte) and ZL (lower byte). The algorithm uses a 'reversed' form
59; i.e. that it takes the least significant bit first and shifts to the right. So in fact the highest order
60; bit seen from the polynomial devision point of view is the lsb of ZL. (If this sounds strange to you i
61; propose a research on CRC :-) )
62; Each data byte received is xored to ZL, the lower crc byte. This byte now builds the crc
63; table index. Next the new high byte is loaded from the table and stored in x4 until we have space in x3
64; (its destination).
65; Afterwards the lower table is loaded from the table and stored in ZL (the old index is overwritten as
66; we don't need it anymore. In fact this is a right shift by 8 bits.) Now the old crc high value is xored
67; to ZL, this is the second shift of the old crc value. Now x4 (the temp reg) is moved to x3 and the crc
68; calculation is done.
69; Prior to the first byte the two CRC register have to be initialized to 0xFFFF (as defined in usb spec)
70; however the crc engine also runs during the receipt of the first byte, therefore x3 and zl are initialized
71; to a magic number which results in a crc value of 0xFFFF after the first complete byte.
72;
73; This algorithm is split into the extra cycles of the different bits:
74; bit7: XOR the received byte to ZL
75; bit5: load the new high byte to x4
76; bit6: load the lower xor byte from the table, xor zl and x3, store result in zl (=the new crc low value)
77; move x4 (the new high byte) to x3, the crc value is ready
78;
79
80
81macro POP_STANDARD ; 18 cycles
82 pop ZH
83 pop ZL
84 pop cnt
85 pop x5
86 pop x3
87 pop x2
88 pop x1
89 pop shift
90 pop x4
91 endm
92macro POP_RETI ; 7 cycles
93 pop YH
94 pop YL
95 out SREG, YL
96 pop YL
97 endm
98
99macro CRC_CLEANUP_AND_CHECK
100 ; the last byte has already been xored with the lower crc byte, we have to do the table lookup and xor
101 ; x3 is the higher crc byte, zl the lower one
102 ldi ZH, hi8(usbCrcTableHigh);[+1] get the new high byte from the table
103 lpm x2, Z ;[+2][+3][+4]
104 ldi ZH, hi8(usbCrcTableLow);[+5] get the new low xor byte from the table
105 lpm ZL, Z ;[+6][+7][+8]
106 eor ZL, x3 ;[+7] xor the old high byte with the value from the table, x2:ZL now holds the crc value
107 cpi ZL, 0x01 ;[+8] if the crc is ok we have a fixed remainder value of 0xb001 in x2:ZL (see usb spec)
108 brne ignorePacket ;[+9] detected a crc fault -> paket is ignored and retransmitted by the host
109 cpi x2, 0xb0 ;[+10]
110 brne ignorePacket ;[+11] detected a crc fault -> paket is ignored and retransmitted by the host
111 endm
112
113
114USB_INTR_VECTOR:
115;order of registers pushed: YL, SREG, YH, [sofError], x4, shift, x1, x2, x3, x5, cnt, ZL, ZH
116 push YL ;[-28] push only what is necessary to sync with edge ASAP
117 in YL, SREG ;[-26]
118 push YL ;[-25]
119 push YH ;[-23]
120;----------------------------------------------------------------------------
121; Synchronize with sync pattern:
122;----------------------------------------------------------------------------
123;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K]
124;sync up with J to K edge during sync pattern -- use fastest possible loops
125;The first part waits at most 1 bit long since we must be in sync pattern.
126;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to
127;waitForJ, ensure that this prerequisite is met.
128waitForJ:
129 inc YL
130 sbis USBIN, USBMINUS
131 brne waitForJ ; just make sure we have ANY timeout
132waitForK:
133;The following code results in a sampling window of < 1/4 bit which meets the spec.
134 sbis USBIN, USBMINUS ;[-17]
135 rjmp foundK ;[-16]
136 sbis USBIN, USBMINUS
137 rjmp foundK
138 sbis USBIN, USBMINUS
139 rjmp foundK
140 sbis USBIN, USBMINUS
141 rjmp foundK
142 sbis USBIN, USBMINUS
143 rjmp foundK
144 sbis USBIN, USBMINUS
145 rjmp foundK
146 sbis USBIN, USBMINUS
147 rjmp foundK
148 sbis USBIN, USBMINUS
149 rjmp foundK
150 sbis USBIN, USBMINUS
151 rjmp foundK
152#if USB_COUNT_SOF
153 lds YL, usbSofCount
154 inc YL
155 sts usbSofCount, YL
156#endif /* USB_COUNT_SOF */
157#ifdef USB_SOF_HOOK
158 USB_SOF_HOOK
159#endif
160 rjmp sofError
161foundK: ;[-15]
162;{3, 5} after falling D- edge, average delay: 4 cycles
163;bit0 should be at 30 (2.5 bits) for center sampling. Currently at 4 so 26 cylces till bit 0 sample
164;use 1 bit time for setup purposes, then sample again. Numbers in brackets
165;are cycles from center of first sync (double K) bit after the instruction
166 push x4 ;[-14]
167; [---] ;[-13]
168 lds YL, usbInputBufOffset;[-12] used to toggle the two usb receive buffers
169; [---] ;[-11]
170 clr YH ;[-10]
171 subi YL, lo8(-(usbRxBuf));[-9] [rx loop init]
172 sbci YH, hi8(-(usbRxBuf));[-8] [rx loop init]
173 push shift ;[-7]
174; [---] ;[-6]
175 ldi shift, 0x80 ;[-5] the last bit is the end of byte marker for the pid receiver loop
176 clc ;[-4] the carry has to be clear for receipt of pid bit 0
177 sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early)
178 rjmp haveTwoBitsK ;[-2]
179 pop shift ;[-1] undo the push from before
180 pop x4 ;[1]
181 rjmp waitForK ;[3] this was not the end of sync, retry
182; The entire loop from waitForK until rjmp waitForK above must not exceed two
183; bit times (= 24 cycles).
184
185;----------------------------------------------------------------------------
186; push more registers and initialize values while we sample the first bits:
187;----------------------------------------------------------------------------
188haveTwoBitsK:
189 push x1 ;[0]
190 push x2 ;[2]
191 push x3 ;[4] crc high byte
192 ldi x2, 1<<USBPLUS ;[6] [rx loop init] current line state is K state. D+=="1", D-=="0"
193 push x5 ;[7]
194 push cnt ;[9]
195 ldi cnt, USB_BUFSIZE ;[11]
196
197
198;--------------------------------------------------------------------------------------------------------------
199; receives the pid byte
200; there is no real unstuffing algorithm implemented here as a stuffing bit is impossible in the pid byte.
201; That's because the last four bits of the byte are the inverted of the first four bits. If we detect a
202; unstuffing condition something went wrong and abort
203; shift has to be initialized to 0x80
204;--------------------------------------------------------------------------------------------------------------
205
206; pid bit 0 - used for even more register saving (we need the z pointer)
207 in x1, USBIN ;[0] sample line state
208 andi x1, USBMASK ;[1] filter only D+ and D- bits
209 eor x2, x1 ;[2] generate inverted of actual bit
210 sbrc x2, USBMINUS ;[3] if the bit is set we received a zero
211 sec ;[4]
212 ror shift ;[5] we perform no unstuffing check here as this is the first bit
213 mov x2, x1 ;[6]
214 push ZL ;[7]
215 ;[8]
216 push ZH ;[9]
217 ;[10]
218 ldi x3, 0xFE ;[11] x3 is the high order crc value
219
220
221bitloopPid:
222 in x1, USBIN ;[0] sample line state
223 andi x1, USBMASK ;[1] filter only D+ and D- bits
224 breq nse0 ;[2] both lines are low so handle se0
225 eor x2, x1 ;[3] generate inverted of actual bit
226 sbrc x2, USBMINUS ;[4] set the carry if we received a zero
227 sec ;[5]
228 ror shift ;[6]
229 ldi ZL, 0x54 ;[7] ZL is the low order crc value
230 ser x4 ;[8] the is no bit stuffing check here as the pid bit can't be stuffed. if so
231 ; some error occured. In this case the paket is discarded later on anyway.
232 mov x2, x1 ;[9] prepare for the next cycle
233 brcc bitloopPid ;[10] while 0s drop out of shift we get the next bit
234 eor x4, shift ;[11] invert all bits in shift and store result in x4
235
236;--------------------------------------------------------------------------------------------------------------
237; receives data bytes and calculates the crc
238; the last USBIN state has to be in x2
239; this is only the first half, due to branch distanc limitations the second half of the loop is near the end
240; of this asm file
241;--------------------------------------------------------------------------------------------------------------
242
243rxDataStart:
244 in x1, USBIN ;[0] sample line state (note: a se0 check is not useful due to bit dribbling)
245 ser x5 ;[1] prepare the unstuff marker register
246 eor x2, x1 ;[2] generates the inverted of the actual bit
247 bst x2, USBMINUS ;[3] copy the bit from x2
248 bld shift, 0 ;[4] and store it in shift
249 mov x2, shift ;[5] make a copy of shift for unstuffing check
250 andi x2, 0xF9 ;[6] mask the last six bits, if we got six zeros (which are six ones in fact)
251 breq unstuff0 ;[7] then Z is set now and we branch to the unstuffing handler
252didunstuff0:
253 subi cnt, 1 ;[8] cannot use dec because it doesn't affect the carry flag
254 brcs nOverflow ;[9] Too many bytes received. Ignore packet
255 st Y+, x4 ;[10] store the last received byte
256 ;[11] st needs two cycles
257
258; bit1
259 in x2, USBIN ;[0] sample line state
260 andi x1, USBMASK ;[1] check for se0 during bit 0
261 breq nse0 ;[2]
262 andi x2, USBMASK ;[3] check se0 during bit 1
263 breq nse0 ;[4]
264 eor x1, x2 ;[5]
265 bst x1, USBMINUS ;[6]
266 bld shift, 1 ;[7]
267 mov x1, shift ;[8]
268 andi x1, 0xF3 ;[9]
269 breq unstuff1 ;[10]
270didunstuff1:
271 nop ;[11]
272
273; bit2
274 in x1, USBIN ;[0] sample line state
275 andi x1, USBMASK ;[1] check for se0 (as there is nothing else to do here
276 breq nOverflow ;[2]
277 eor x2, x1 ;[3] generates the inverted of the actual bit
278 bst x2, USBMINUS ;[4]
279 bld shift, 2 ;[5] store the bit
280 mov x2, shift ;[6]
281 andi x2, 0xE7 ;[7] if we have six zeros here (which means six 1 in the stream)
282 breq unstuff2 ;[8] the next bit is a stuffing bit
283didunstuff2:
284 nop2 ;[9]
285 ;[10]
286 nop ;[11]
287
288; bit3
289 in x2, USBIN ;[0] sample line state
290 andi x2, USBMASK ;[1] check for se0
291 breq nOverflow ;[2]
292 eor x1, x2 ;[3]
293 bst x1, USBMINUS ;[4]
294 bld shift, 3 ;[5]
295 mov x1, shift ;[6]
296 andi x1, 0xCF ;[7]
297 breq unstuff3 ;[8]
298didunstuff3:
299 nop ;[9]
300 rjmp rxDataBit4 ;[10]
301 ;[11]
302
303; the avr branch instructions allow an offset of +63 insturction only, so we need this
304; 'local copy' of se0
305nse0:
306 rjmp se0 ;[4]
307 ;[5]
308; the same same as for se0 is needed for overflow and StuffErr
309nOverflow:
310stuffErr:
311 rjmp overflow
312
313
314unstuff0: ;[8] this is the branch delay of breq unstuffX
315 andi x1, USBMASK ;[9] do an se0 check here (if the last crc byte ends with 5 one's we might end up here
316 breq didunstuff0 ;[10] event tough the message is complete -> jump back and store the byte
317 ori shift, 0x01 ;[11] invert the last received bit to prevent furhter unstuffing
318 in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors
319 andi x5, 0xFE ;[1] mark this bit as inverted (will be corrected before storing shift)
320 eor x1, x2 ;[2] x1 and x2 have to be different because the stuff bit is always a zero
321 andi x1, USBMASK ;[3] mask the interesting bits
322 breq stuffErr ;[4] if the stuff bit is a 1-bit something went wrong
323 mov x1, x2 ;[5] the next bit expects the last state to be in x1
324 rjmp didunstuff0 ;[6]
325 ;[7] jump delay of rjmp didunstuffX
326
327unstuff1: ;[11] this is the jump delay of breq unstuffX
328 in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors
329 ori shift, 0x02 ;[1] invert the last received bit to prevent furhter unstuffing
330 andi x5, 0xFD ;[2] mark this bit as inverted (will be corrected before storing shift)
331 eor x2, x1 ;[3] x1 and x2 have to be different because the stuff bit is always a zero
332 andi x2, USBMASK ;[4] mask the interesting bits
333 breq stuffErr ;[5] if the stuff bit is a 1-bit something went wrong
334 mov x2, x1 ;[6] the next bit expects the last state to be in x2
335 nop2 ;[7]
336 ;[8]
337 rjmp didunstuff1 ;[9]
338 ;[10] jump delay of rjmp didunstuffX
339
340unstuff2: ;[9] this is the jump delay of breq unstuffX
341 ori shift, 0x04 ;[10] invert the last received bit to prevent furhter unstuffing
342 andi x5, 0xFB ;[11] mark this bit as inverted (will be corrected before storing shift)
343 in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors
344 eor x1, x2 ;[1] x1 and x2 have to be different because the stuff bit is always a zero
345 andi x1, USBMASK ;[2] mask the interesting bits
346 breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong
347 mov x1, x2 ;[4] the next bit expects the last state to be in x1
348 nop2 ;[5]
349 ;[6]
350 rjmp didunstuff2 ;[7]
351 ;[8] jump delay of rjmp didunstuffX
352
353unstuff3: ;[9] this is the jump delay of breq unstuffX
354 ori shift, 0x08 ;[10] invert the last received bit to prevent furhter unstuffing
355 andi x5, 0xF7 ;[11] mark this bit as inverted (will be corrected before storing shift)
356 in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors
357 eor x2, x1 ;[1] x1 and x2 have to be different because the stuff bit is always a zero
358 andi x2, USBMASK ;[2] mask the interesting bits
359 breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong
360 mov x2, x1 ;[4] the next bit expects the last state to be in x2
361 nop2 ;[5]
362 ;[6]
363 rjmp didunstuff3 ;[7]
364 ;[8] jump delay of rjmp didunstuffX
365
366
367
368; the include has to be here due to branch distance restirctions
369#define __USE_CRC__
370#include "asmcommon.inc"
371
372
373
374; USB spec says:
375; idle = J
376; J = (D+ = 0), (D- = 1)
377; K = (D+ = 1), (D- = 0)
378; Spec allows 7.5 bit times from EOP to SOP for replies
379; 7.5 bit times is 90 cycles. ...there is plenty of time
380
381
382sendNakAndReti:
383 ldi x3, USBPID_NAK ;[-18]
384 rjmp sendX3AndReti ;[-17]
385sendAckAndReti:
386 ldi cnt, USBPID_ACK ;[-17]
387sendCntAndReti:
388 mov x3, cnt ;[-16]
389sendX3AndReti:
390 ldi YL, 20 ;[-15] x3==r20 address is 20
391 ldi YH, 0 ;[-14]
392 ldi cnt, 2 ;[-13]
393; rjmp usbSendAndReti fallthrough
394
395;usbSend:
396;pointer to data in 'Y'
397;number of bytes in 'cnt' -- including sync byte [range 2 ... 12]
398;uses: x1...x4, btcnt, shift, cnt, Y
399;Numbers in brackets are time since first bit of sync pattern is sent
400
401usbSendAndReti: ; 12 cycles until SOP
402 in x2, USBDDR ;[-12]
403 ori x2, USBMASK ;[-11]
404 sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups)
405 in x1, USBOUT ;[-8] port mirror for tx loop
406 out USBDDR, x2 ;[-6] <- acquire bus
407 ldi x2, 0 ;[-6] init x2 (bitstuff history) because sync starts with 0
408 ldi x4, USBMASK ;[-5] exor mask
409 ldi shift, 0x80 ;[-4] sync byte is first byte sent
410txByteLoop:
411 ldi bitcnt, 0x40 ;[-3]=[9] binary 01000000
412txBitLoop: ; the loop sends the first 7 bits of the byte
413 sbrs shift, 0 ;[-2]=[10] if we have to send a 1 don't change the line state
414 eor x1, x4 ;[-1]=[11]
415 out USBOUT, x1 ;[0]
416 ror shift ;[1]
417 ror x2 ;[2] transfers the last sent bit to the stuffing history
418didStuffN:
419 nop ;[3]
420 nop ;[4]
421 cpi x2, 0xfc ;[5] if we sent six consecutive ones
422 brcc bitstuffN ;[6]
423 lsr bitcnt ;[7]
424 brne txBitLoop ;[8] restart the loop while the 1 is still in the bitcount
425
426; transmit bit 7
427 sbrs shift, 0 ;[9]
428 eor x1, x4 ;[10]
429didStuff7:
430 ror shift ;[11]
431 out USBOUT, x1 ;[0] transfer bit 7 to the pins
432 ror x2 ;[1] move the bit into the stuffing history
433 cpi x2, 0xfc ;[2]
434 brcc bitstuff7 ;[3]
435 ld shift, y+ ;[4] get next byte to transmit
436 dec cnt ;[5] decrement byte counter
437 brne txByteLoop ;[7] if we have more bytes start next one
438 ;[8] branch delay
439
440;make SE0:
441 cbr x1, USBMASK ;[8] prepare SE0 [spec says EOP may be 25 to 30 cycles]
442 lds x2, usbNewDeviceAddr;[9]
443 lsl x2 ;[11] we compare with left shifted address
444 out USBOUT, x1 ;[0] <-- out SE0 -- from now 2 bits = 24 cycles until bus idle
445 subi YL, 20 + 2 ;[1] Only assign address on data packets, not ACK/NAK in x3
446 sbci YH, 0 ;[2]
447;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm:
448;set address only after data packet was sent, not after handshake
449 breq skipAddrAssign ;[3]
450 sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer
451skipAddrAssign:
452;end of usbDeviceAddress transfer
453 ldi x2, 1<<USB_INTR_PENDING_BIT;[5] int0 occurred during TX -- clear pending flag
454 USB_STORE_PENDING(x2) ;[6]
455 ori x1, USBIDLE ;[7]
456 in x2, USBDDR ;[8]
457 cbr x2, USBMASK ;[9] set both pins to input
458 mov x3, x1 ;[10]
459 cbr x3, USBMASK ;[11] configure no pullup on both pins
460 ldi x4, 4 ;[12]
461se0Delay:
462 dec x4 ;[13] [16] [19] [22]
463 brne se0Delay ;[14] [17] [20] [23]
464 out USBOUT, x1 ;[24] <-- out J (idle) -- end of SE0 (EOP signal)
465 out USBDDR, x2 ;[25] <-- release bus now
466 out USBOUT, x3 ;[26] <-- ensure no pull-up resistors are active
467 rjmp doReturn
468
469bitstuffN:
470 eor x1, x4 ;[8] generate a zero
471 ldi x2, 0 ;[9] reset the bit stuffing history
472 nop2 ;[10]
473 out USBOUT, x1 ;[0] <-- send the stuffing bit
474 rjmp didStuffN ;[1]
475
476bitstuff7:
477 eor x1, x4 ;[5]
478 ldi x2, 0 ;[6] reset bit stuffing history
479 clc ;[7] fill a zero into the shift register
480 rol shift ;[8] compensate for ror shift at branch destination
481 rjmp didStuff7 ;[9]
482 ;[10] jump delay
483
484;--------------------------------------------------------------------------------------------------------------
485; receives data bytes and calculates the crc
486; second half of the data byte receiver loop
487; most parts of the crc algorithm are here
488;--------------------------------------------------------------------------------------------------------------
489
490nOverflow2:
491 rjmp overflow
492
493rxDataBit4:
494 in x1, USBIN ;[0] sample line state
495 andi x1, USBMASK ;[1] check for se0
496 breq nOverflow2 ;[2]
497 eor x2, x1 ;[3]
498 bst x2, USBMINUS ;[4]
499 bld shift, 4 ;[5]
500 mov x2, shift ;[6]
501 andi x2, 0x9F ;[7]
502 breq unstuff4 ;[8]
503didunstuff4:
504 nop2 ;[9][10]
505 nop ;[11]
506
507; bit5
508 in x2, USBIN ;[0] sample line state
509 ldi ZH, hi8(usbCrcTableHigh);[1] use the table for the higher byte
510 eor x1, x2 ;[2]
511 bst x1, USBMINUS ;[3]
512 bld shift, 5 ;[4]
513 mov x1, shift ;[5]
514 andi x1, 0x3F ;[6]
515 breq unstuff5 ;[7]
516didunstuff5:
517 lpm x4, Z ;[8] load the higher crc xor-byte and store it for later use
518 ;[9] lpm needs 3 cycles
519 ;[10]
520 ldi ZH, hi8(usbCrcTableLow);[11] load the lower crc xor byte adress
521
522; bit6
523 in x1, USBIN ;[0] sample line state
524 eor x2, x1 ;[1]
525 bst x2, USBMINUS ;[2]
526 bld shift, 6 ;[3]
527 mov x2, shift ;[4]
528 andi x2, 0x7E ;[5]
529 breq unstuff6 ;[6]
530didunstuff6:
531 lpm ZL, Z ;[7] load the lower xor crc byte
532 ;[8] lpm needs 3 cycles
533 ;[9]
534 eor ZL, x3 ;[10] xor the old high crc byte with the low xor-byte
535 mov x3, x4 ;[11] move the new high order crc value from temp to its destination
536
537; bit7
538 in x2, USBIN ;[0] sample line state
539 eor x1, x2 ;[1]
540 bst x1, USBMINUS ;[2]
541 bld shift, 7 ;[3] now shift holds the complete but inverted data byte
542 mov x1, shift ;[4]
543 andi x1, 0xFC ;[5]
544 breq unstuff7 ;[6]
545didunstuff7:
546 eor x5, shift ;[7] x5 marks all bits which have not been inverted by the unstuffing subs
547 mov x4, x5 ;[8] keep a copy of the data byte it will be stored during next bit0
548 eor ZL, x4 ;[9] feed the actual byte into the crc algorithm
549 rjmp rxDataStart ;[10] next byte
550 ;[11] during the reception of the next byte this one will be fed int the crc algorithm
551
552unstuff4: ;[9] this is the jump delay of rjmp unstuffX
553 ori shift, 0x10 ;[10] invert the last received bit to prevent furhter unstuffing
554 andi x5, 0xEF ;[11] mark this bit as inverted (will be corrected before storing shift)
555 in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors
556 eor x1, x2 ;[1] x1 and x2 have to be different because the stuff bit is always a zero
557 andi x1, USBMASK ;[2] mask the interesting bits
558 breq stuffErr2 ;[3] if the stuff bit is a 1-bit something went wrong
559 mov x1, x2 ;[4] the next bit expects the last state to be in x1
560 nop2 ;[5]
561 ;[6]
562 rjmp didunstuff4 ;[7]
563 ;[8] jump delay of rjmp didunstuffX
564
565unstuff5: ;[8] this is the jump delay of rjmp unstuffX
566 nop ;[9]
567 ori shift, 0x20 ;[10] invert the last received bit to prevent furhter unstuffing
568 andi x5, 0xDF ;[11] mark this bit as inverted (will be corrected before storing shift)
569 in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors
570 eor x2, x1 ;[1] x1 and x2 have to be different because the stuff bit is always a zero
571 andi x2, USBMASK ;[2] mask the interesting bits
572 breq stuffErr2 ;[3] if the stuff bit is a 1-bit something went wrong
573 mov x2, x1 ;[4] the next bit expects the last state to be in x2
574 nop ;[5]
575 rjmp didunstuff5 ;[6]
576 ;[7] jump delay of rjmp didunstuffX
577
578unstuff6: ;[7] this is the jump delay of rjmp unstuffX
579 nop2 ;[8]
580 ;[9]
581 ori shift, 0x40 ;[10] invert the last received bit to prevent furhter unstuffing
582 andi x5, 0xBF ;[11] mark this bit as inverted (will be corrected before storing shift)
583 in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors
584 eor x1, x2 ;[1] x1 and x2 have to be different because the stuff bit is always a zero
585 andi x1, USBMASK ;[2] mask the interesting bits
586 breq stuffErr2 ;[3] if the stuff bit is a 1-bit something went wrong
587 mov x1, x2 ;[4] the next bit expects the last state to be in x1
588 rjmp didunstuff6 ;[5]
589 ;[6] jump delay of rjmp didunstuffX
590
591unstuff7: ;[7] this is the jump delay of rjmp unstuffX
592 nop ;[8]
593 nop ;[9]
594 ori shift, 0x80 ;[10] invert the last received bit to prevent furhter unstuffing
595 andi x5, 0x7F ;[11] mark this bit as inverted (will be corrected before storing shift)
596 in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors
597 eor x2, x1 ;[1] x1 and x2 have to be different because the stuff bit is always a zero
598 andi x2, USBMASK ;[2] mask the interesting bits
599 breq stuffErr2 ;[3] if the stuff bit is a 1-bit something went wrong
600 mov x2, x1 ;[4] the next bit expects the last state to be in x2
601 rjmp didunstuff7 ;[5]
602 ;[6] jump delay of rjmp didunstuff7
603
604; local copy of the stuffErr desitnation for the second half of the receiver loop
605stuffErr2:
606 rjmp stuffErr
607
608;--------------------------------------------------------------------------------------------------------------
609; The crc table follows. It has to be aligned to enable a fast loading of the needed bytes.
610; There are two tables of 256 entries each, the low and the high byte table.
611; Table values were generated with the following C code:
612/*
613#include <stdio.h>
614int main (int argc, char **argv)
615{
616 int i, j;
617 for (i=0; i<512; i++){
618 unsigned short crc = i & 0xff;
619 for(j=0; j<8; j++) crc = (crc >> 1) ^ ((crc & 1) ? 0xa001 : 0);
620 if((i & 7) == 0) printf("\n.byte ");
621 printf("0x%02x, ", (i > 0xff ? (crc >> 8) : crc) & 0xff);
622 if(i == 255) printf("\n");
623 }
624 return 0;
625}
626
627// Use the following algorithm to compute CRC values:
628ushort computeCrc(uchar *msg, uchar msgLen)
629{
630 uchar i;
631 ushort crc = 0xffff;
632 for(i = 0; i < msgLen; i++)
633 crc = usbCrcTable16[lo8(crc) ^ msg[i]] ^ hi8(crc);
634 return crc;
635}
636*/
637
638.balign 256
639usbCrcTableLow:
640.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
641.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
642.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
643.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
644.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
645.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
646.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
647.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
648.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
649.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
650.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
651.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
652.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
653.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
654.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
655.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
656.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
657.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
658.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
659.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
660.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
661.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
662.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
663.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
664.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
665.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
666.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
667.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
668.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
669.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
670.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41
671.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
672
673; .balign 256
674usbCrcTableHigh:
675.byte 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2
676.byte 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04
677.byte 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E
678.byte 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8
679.byte 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A
680.byte 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC
681.byte 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6
682.byte 0xD2, 0x12, 0x13, 0xD3, 0x11, 0xD1, 0xD0, 0x10
683.byte 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32
684.byte 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4
685.byte 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE
686.byte 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38
687.byte 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA
688.byte 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C
689.byte 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26
690.byte 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0
691.byte 0xA0, 0x60, 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62
692.byte 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4
693.byte 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE
694.byte 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68
695.byte 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA
696.byte 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C
697.byte 0xB4, 0x74, 0x75, 0xB5, 0x77, 0xB7, 0xB6, 0x76
698.byte 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0
699.byte 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92
700.byte 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54
701.byte 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E
702.byte 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98
703.byte 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A
704.byte 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C
705.byte 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86
706.byte 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40
707
diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc
deleted file mode 100644
index 303abaf64c..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc
+++ /dev/null
@@ -1,360 +0,0 @@
1/* Name: usbdrvasm20.inc
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Jeroen Benschop
4 * Based on usbdrvasm16.inc from Christian Starkjohann
5 * Creation Date: 2008-03-05
6 * Tabsize: 4
7 * Copyright: (c) 2008 by Jeroen Benschop and OBJECTIVE DEVELOPMENT Software GmbH
8 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
9 * Revision: $Id: usbdrvasm20.inc 740 2009-04-13 18:23:31Z cs $
10 */
11
12/* Do not link this file! Link usbdrvasm.S instead, which includes the
13 * appropriate implementation!
14 */
15
16/*
17General Description:
18This file is the 20 MHz version of the asssembler part of the USB driver. It
19requires a 20 MHz crystal (not a ceramic resonator and not a calibrated RC
20oscillator).
21
22See usbdrv.h for a description of the entire driver.
23
24Since almost all of this code is timing critical, don't change unless you
25really know what you are doing! Many parts require not only a maximum number
26of CPU cycles, but even an exact number of cycles!
27*/
28
29#define leap2 x3
30#ifdef __IAR_SYSTEMS_ASM__
31#define nextInst $+2
32#else
33#define nextInst .+0
34#endif
35
36;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes
37;nominal frequency: 20 MHz -> 13.333333 cycles per bit, 106.666667 cycles per byte
38; Numbers in brackets are clocks counted from center of last sync bit
39; when instruction starts
40;register use in receive loop:
41; shift assembles the byte currently being received
42; x1 holds the D+ and D- line state
43; x2 holds the previous line state
44; x4 (leap) is used to add a leap cycle once every three bytes received
45; X3 (leap2) is used to add a leap cycle once every three stuff bits received
46; bitcnt is used to determine when a stuff bit is due
47; cnt holds the number of bytes left in the receive buffer
48
49USB_INTR_VECTOR:
50;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt
51 push YL ;[-28] push only what is necessary to sync with edge ASAP
52 in YL, SREG ;[-26]
53 push YL ;[-25]
54 push YH ;[-23]
55;----------------------------------------------------------------------------
56; Synchronize with sync pattern:
57;----------------------------------------------------------------------------
58;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K]
59;sync up with J to K edge during sync pattern -- use fastest possible loops
60;The first part waits at most 1 bit long since we must be in sync pattern.
61;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to
62;waitForJ, ensure that this prerequisite is met.
63waitForJ:
64 inc YL
65 sbis USBIN, USBMINUS
66 brne waitForJ ; just make sure we have ANY timeout
67waitForK:
68;The following code results in a sampling window of < 1/4 bit which meets the spec.
69 sbis USBIN, USBMINUS ;[-19]
70 rjmp foundK ;[-18]
71 sbis USBIN, USBMINUS
72 rjmp foundK
73 sbis USBIN, USBMINUS
74 rjmp foundK
75 sbis USBIN, USBMINUS
76 rjmp foundK
77 sbis USBIN, USBMINUS
78 rjmp foundK
79 sbis USBIN, USBMINUS
80 rjmp foundK
81 sbis USBIN, USBMINUS
82 rjmp foundK
83 sbis USBIN, USBMINUS
84 rjmp foundK
85 sbis USBIN, USBMINUS
86 rjmp foundK
87#if USB_COUNT_SOF
88 lds YL, usbSofCount
89 inc YL
90 sts usbSofCount, YL
91#endif /* USB_COUNT_SOF */
92#ifdef USB_SOF_HOOK
93 USB_SOF_HOOK
94#endif
95 rjmp sofError
96foundK: ;[-16]
97;{3, 5} after falling D- edge, average delay: 4 cycles
98;bit0 should be at 34 for center sampling. Currently at 4 so 30 cylces till bit 0 sample
99;use 1 bit time for setup purposes, then sample again. Numbers in brackets
100;are cycles from center of first sync (double K) bit after the instruction
101 push bitcnt ;[-16]
102; [---] ;[-15]
103 lds YL, usbInputBufOffset;[-14]
104; [---] ;[-13]
105 clr YH ;[-12]
106 subi YL, lo8(-(usbRxBuf));[-11] [rx loop init]
107 sbci YH, hi8(-(usbRxBuf));[-10] [rx loop init]
108 push shift ;[-9]
109; [---] ;[-8]
110 ldi shift,0x40 ;[-7] set msb to "1" so processing bit7 can be detected
111 nop2 ;[-6]
112; [---] ;[-5]
113 ldi bitcnt, 5 ;[-4] [rx loop init]
114 sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early)
115 rjmp haveTwoBitsK ;[-2]
116 pop shift ;[-1] undo the push from before
117 pop bitcnt ;[1]
118 rjmp waitForK ;[3] this was not the end of sync, retry
119; The entire loop from waitForK until rjmp waitForK above must not exceed two
120; bit times (= 27 cycles).
121
122;----------------------------------------------------------------------------
123; push more registers and initialize values while we sample the first bits:
124;----------------------------------------------------------------------------
125haveTwoBitsK:
126 push x1 ;[0]
127 push x2 ;[2]
128 push x3 ;[4] (leap2)
129 ldi leap2, 0x55 ;[6] add leap cycle on 2nd,5th,8th,... stuff bit
130 push x4 ;[7] == leap
131 ldi leap, 0x55 ;[9] skip leap cycle on 2nd,5th,8th,... byte received
132 push cnt ;[10]
133 ldi cnt, USB_BUFSIZE ;[12] [rx loop init]
134 ldi x2, 1<<USBPLUS ;[13] current line state is K state. D+=="1", D-=="0"
135bit0:
136 in x1, USBIN ;[0] sample line state
137 andi x1, USBMASK ;[1] filter only D+ and D- bits
138 rjmp handleBit ;[2] make bit0 14 cycles long
139
140;----------------------------------------------------------------------------
141; Process bit7. However, bit 6 still may need unstuffing.
142;----------------------------------------------------------------------------
143
144b6checkUnstuff:
145 dec bitcnt ;[9]
146 breq unstuff6 ;[10]
147bit7:
148 subi cnt, 1 ;[11] cannot use dec becaus it does not affect the carry flag
149 brcs overflow ;[12] Too many bytes received. Ignore packet
150 in x1, USBIN ;[0] sample line state
151 andi x1, USBMASK ;[1] filter only D+ and D- bits
152 cpse x1, x2 ;[2] when previous line state equals current line state, handle "1"
153 rjmp b7handle0 ;[3] when line state differs, handle "0"
154 sec ;[4]
155 ror shift ;[5] shift "1" into the data
156 st y+, shift ;[6] store the data into the buffer
157 ldi shift, 0x40 ;[7] reset data for receiving the next byte
158 subi leap, 0x55 ;[9] trick to introduce a leap cycle every 3 bytes
159 brcc nextInst ;[10 or 11] it will fail after 85 bytes. However low speed can only receive 11
160 dec bitcnt ;[11 or 12]
161 brne bit0 ;[12 or 13]
162 ldi x1, 1 ;[13 or 14] unstuffing bit 7
163 in bitcnt, USBIN ;[0] sample stuff bit
164 rjmp unstuff ;[1]
165
166b7handle0:
167 mov x2,x1 ;[5] Set x2 to current line state
168 ldi bitcnt, 6 ;[6]
169 lsr shift ;[7] shift "0" into the data
170 st y+, shift ;[8] store data into the buffer
171 ldi shift, 0x40 ;[10] reset data for receiving the next byte
172 subi leap, 0x55 ;[11] trick to introduce a leap cycle every 3 bytes
173 brcs bit0 ;[12] it will fail after 85 bytes. However low speed can only receive 11
174 rjmp bit0 ;[13]
175
176
177;----------------------------------------------------------------------------
178; Handle unstuff
179; x1==0xFF indicate unstuffing bit6
180;----------------------------------------------------------------------------
181
182unstuff6:
183 ldi x1,0xFF ;[12] indicate unstuffing bit 6
184 in bitcnt, USBIN ;[0] sample stuff bit
185 nop ;[1] fix timing
186unstuff: ;b0-5 b6 b7
187 mov x2,bitcnt ;[3] [2] [3] Set x2 to match line state
188 subi leap2, 0x55 ;[4] [3] [4] delay loop
189 brcs nextInst ;[5] [4] [5] add one cycle every three stuff bits
190 sbci leap2,0 ;[6] [5] [6]
191 ldi bitcnt,6 ;[7] [6] [7] reset bit stuff counter
192 andi x2, USBMASK ;[8] [7] [8] only keep D+ and D-
193 cpi x1,0 ;[9] [8] [9]
194 brmi bit7 ;[10] [9] [10] finished unstuffing bit6 When x1<0
195 breq bitloop ;[11] --- [11] finished unstuffing bit0-5 when x1=0
196 nop ;--- --- [12]
197 in x1, USBIN ;--- --- [0] sample line state for bit0
198 andi x1, USBMASK ;--- --- [1] filter only D+ and D- bits
199 rjmp handleBit ;--- --- [2] make bit0 14 cycles long
200
201;----------------------------------------------------------------------------
202; Receiver loop (numbers in brackets are cycles within byte after instr)
203;----------------------------------------------------------------------------
204bitloop:
205 in x1, USBIN ;[0] sample line state
206 andi x1, USBMASK ;[1] filter only D+ and D- bits
207 breq se0 ;[2] both lines are low so handle se0
208handleBit:
209 cpse x1, x2 ;[3] when previous line state equals current line state, handle "1"
210 rjmp handle0 ;[4] when line state differs, handle "0"
211 sec ;[5]
212 ror shift ;[6] shift "1" into the data
213 brcs b6checkUnstuff ;[7] When after shift C is set, next bit is bit7
214 nop2 ;[8]
215 dec bitcnt ;[10]
216 brne bitloop ;[11]
217 ldi x1,0 ;[12] indicate unstuff for bit other than bit6 or bit7
218 in bitcnt, USBIN ;[0] sample stuff bit
219 rjmp unstuff ;[1]
220
221handle0:
222 mov x2, x1 ;[6] Set x2 to current line state
223 ldi bitcnt, 6 ;[7] reset unstuff counter.
224 lsr shift ;[8] shift "0" into the data
225 brcs bit7 ;[9] When after shift C is set, next bit is bit7
226 nop ;[10]
227 rjmp bitloop ;[11]
228
229;----------------------------------------------------------------------------
230; End of receive loop. Now start handling EOP
231;----------------------------------------------------------------------------
232
233macro POP_STANDARD ; 14 cycles
234 pop cnt
235 pop x4
236 pop x3
237 pop x2
238 pop x1
239 pop shift
240 pop bitcnt
241 endm
242macro POP_RETI ; 7 cycles
243 pop YH
244 pop YL
245 out SREG, YL
246 pop YL
247 endm
248
249
250
251#include "asmcommon.inc"
252
253; USB spec says:
254; idle = J
255; J = (D+ = 0), (D- = 1)
256; K = (D+ = 1), (D- = 0)
257; Spec allows 7.5 bit times from EOP to SOP for replies
258; 7.5 bit times is 100 cycles. This implementation arrives a bit later at se0
259; then specified in the include file but there is plenty of time
260
261bitstuffN:
262 eor x1, x4 ;[8]
263 ldi x2, 0 ;[9]
264 nop2 ;[10]
265 out USBOUT, x1 ;[12] <-- out
266 rjmp didStuffN ;[0]
267
268bitstuff7:
269 eor x1, x4 ;[6]
270 ldi x2, 0 ;[7] Carry is zero due to brcc
271 rol shift ;[8] compensate for ror shift at branch destination
272 nop2 ;[9]
273 rjmp didStuff7 ;[11]
274
275sendNakAndReti:
276 ldi x3, USBPID_NAK ;[-18]
277 rjmp sendX3AndReti ;[-17]
278sendAckAndReti:
279 ldi cnt, USBPID_ACK ;[-17]
280sendCntAndReti:
281 mov x3, cnt ;[-16]
282sendX3AndReti:
283 ldi YL, 20 ;[-15] x3==r20 address is 20
284 ldi YH, 0 ;[-14]
285 ldi cnt, 2 ;[-13]
286; rjmp usbSendAndReti fallthrough
287
288;usbSend:
289;pointer to data in 'Y'
290;number of bytes in 'cnt' -- including sync byte [range 2 ... 12]
291;uses: x1...x4, btcnt, shift, cnt, Y
292;Numbers in brackets are time since first bit of sync pattern is sent
293;We don't match the transfer rate exactly (don't insert leap cycles every third
294;byte) because the spec demands only 1.5% precision anyway.
295usbSendAndReti: ; 12 cycles until SOP
296 in x2, USBDDR ;[-12]
297 ori x2, USBMASK ;[-11]
298 sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups)
299 in x1, USBOUT ;[-8] port mirror for tx loop
300 out USBDDR, x2 ;[-7] <- acquire bus
301; need not init x2 (bitstuff history) because sync starts with 0
302 ldi x4, USBMASK ;[-6] exor mask
303 ldi shift, 0x80 ;[-5] sync byte is first byte sent
304txByteLoop:
305 ldi bitcnt, 0x49 ;[-4] [10] binary 01001001
306txBitLoop:
307 sbrs shift, 0 ;[-3] [10] [11]
308 eor x1, x4 ;[-2] [11] [12]
309 out USBOUT, x1 ;[-1] [12] [13] <-- out N
310 ror shift ;[0] [13] [14]
311 ror x2 ;[1]
312didStuffN:
313 nop2 ;[2]
314 nop ;[4]
315 cpi x2, 0xfc ;[5]
316 brcc bitstuffN ;[6]
317 lsr bitcnt ;[7]
318 brcc txBitLoop ;[8]
319 brne txBitLoop ;[9]
320
321 sbrs shift, 0 ;[10]
322 eor x1, x4 ;[11]
323didStuff7:
324 out USBOUT, x1 ;[-1] [13] <-- out 7
325 ror shift ;[0] [14]
326 ror x2 ;[1]
327 nop ;[2]
328 cpi x2, 0xfc ;[3]
329 brcc bitstuff7 ;[4]
330 ld shift, y+ ;[5]
331 dec cnt ;[7]
332 brne txByteLoop ;[8]
333;make SE0:
334 cbr x1, USBMASK ;[9] prepare SE0 [spec says EOP may be 25 to 30 cycles]
335 lds x2, usbNewDeviceAddr;[10]
336 lsl x2 ;[12] we compare with left shifted address
337 out USBOUT, x1 ;[13] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle
338 subi YL, 20 + 2 ;[0] Only assign address on data packets, not ACK/NAK in x3
339 sbci YH, 0 ;[1]
340;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm:
341;set address only after data packet was sent, not after handshake
342 breq skipAddrAssign ;[2]
343 sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer
344skipAddrAssign:
345;end of usbDeviceAddress transfer
346 ldi x2, 1<<USB_INTR_PENDING_BIT;[4] int0 occurred during TX -- clear pending flag
347 USB_STORE_PENDING(x2) ;[5]
348 ori x1, USBIDLE ;[6]
349 in x2, USBDDR ;[7]
350 cbr x2, USBMASK ;[8] set both pins to input
351 mov x3, x1 ;[9]
352 cbr x3, USBMASK ;[10] configure no pullup on both pins
353 ldi x4, 5 ;[11]
354se0Delay:
355 dec x4 ;[12] [15] [18] [21] [24]
356 brne se0Delay ;[13] [16] [19] [22] [25]
357 out USBOUT, x1 ;[26] <-- out J (idle) -- end of SE0 (EOP signal)
358 out USBDDR, x2 ;[27] <-- release bus now
359 out USBOUT, x3 ;[28] <-- ensure no pull-up resistors are active
360 rjmp doReturn
diff --git a/tmk_core/protocol/vusb/usbdrv/usbportability.h b/tmk_core/protocol/vusb/usbdrv/usbportability.h
deleted file mode 100644
index 206041097d..0000000000
--- a/tmk_core/protocol/vusb/usbdrv/usbportability.h
+++ /dev/null
@@ -1,146 +0,0 @@
1/* Name: usbportability.h
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2008-06-17
5 * Tabsize: 4
6 * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: usbportability.h 785 2010-05-30 17:57:07Z cs $
9 */
10
11// clang-format off
12
13/*
14General Description:
15This header is intended to contain all (or at least most of) the compiler
16and library dependent stuff. The C code is written for avr-gcc and avr-libc.
17The API of other development environments is converted to gcc's and avr-libc's
18API by means of defines.
19
20This header also contains all system includes since they depend on the
21development environment.
22
23Thanks to Oleg Semyonov for his help with the IAR tools port!
24*/
25
26#ifndef __usbportability_h_INCLUDED__
27#define __usbportability_h_INCLUDED__
28
29/* We check explicitly for IAR and CodeVision. Default is avr-gcc/avr-libc. */
30
31/* ------------------------------------------------------------------------- */
32#if defined __IAR_SYSTEMS_ICC__ || defined __IAR_SYSTEMS_ASM__ /* check for IAR */
33/* ------------------------------------------------------------------------- */
34
35#ifndef ENABLE_BIT_DEFINITIONS
36# define ENABLE_BIT_DEFINITIONS 1 /* Enable bit definitions */
37#endif
38
39/* Include IAR headers */
40#include <ioavr.h>
41#ifndef __IAR_SYSTEMS_ASM__
42# include <inavr.h>
43#endif
44
45#define __attribute__(arg) /* not supported on IAR */
46
47#ifdef __IAR_SYSTEMS_ASM__
48# define __ASSEMBLER__ /* IAR does not define standard macro for asm */
49#endif
50
51#ifdef __HAS_ELPM__
52# define PROGMEM __farflash
53#else
54# define PROGMEM __flash
55#endif
56
57#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr))
58
59/* The following definitions are not needed by the driver, but may be of some
60 * help if you port a gcc based project to IAR.
61 */
62#define cli() __disable_interrupt()
63#define sei() __enable_interrupt()
64#define wdt_reset() __watchdog_reset()
65#define _BV(x) (1 << (x))
66
67/* assembler compatibility macros */
68#define nop2 rjmp $+2 /* jump to next instruction */
69#define XL r26
70#define XH r27
71#define YL r28
72#define YH r29
73#define ZL r30
74#define ZH r31
75#define lo8(x) LOW(x)
76#define hi8(x) (((x)>>8) & 0xff) /* not HIGH to allow XLINK to make a proper range check */
77
78/* Depending on the device you use, you may get problems with the way usbdrv.h
79 * handles the differences between devices. Since IAR does not use #defines
80 * for MCU registers, we can't check for the existence of a particular
81 * register with an #ifdef. If the autodetection mechanism fails, include
82 * definitions for the required USB_INTR_* macros in your usbconfig.h. See
83 * usbconfig-prototype.h and usbdrv.h for details.
84 */
85
86/* ------------------------------------------------------------------------- */
87#elif __CODEVISIONAVR__ /* check for CodeVision AVR */
88/* ------------------------------------------------------------------------- */
89/* This port is not working (yet) */
90
91/* #define F_CPU _MCU_CLOCK_FREQUENCY_ seems to be defined automatically */
92
93#include <io.h>
94#include <delay.h>
95
96#define __attribute__(arg) /* not supported on IAR */
97
98#define PROGMEM __flash
99#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr))
100
101#ifndef __ASSEMBLER__
102static inline void cli(void)
103{
104 #asm("cli");
105}
106static inline void sei(void)
107{
108 #asm("sei");
109}
110#endif
111#define _delay_ms(t) delay_ms(t)
112#define _BV(x) (1 << (x))
113#define USB_CFG_USE_SWITCH_STATEMENT 1 /* macro for if() cascase fails for unknown reason */
114
115#define macro .macro
116#define endm .endmacro
117#define nop2 rjmp .+0 /* jump to next instruction */
118
119/* ------------------------------------------------------------------------- */
120#else /* default development environment is avr-gcc/avr-libc */
121/* ------------------------------------------------------------------------- */
122
123#include <avr/io.h>
124#ifdef __ASSEMBLER__
125# define _VECTOR(N) __vector_ ## N /* io.h does not define this for asm */
126#else
127# include <avr/pgmspace.h>
128#endif
129
130#if USB_CFG_DRIVER_FLASH_PAGE
131# define USB_READ_FLASH(addr) pgm_read_byte_far(((long)USB_CFG_DRIVER_FLASH_PAGE << 16) | (long)(addr))
132#else
133# define USB_READ_FLASH(addr) pgm_read_byte(addr)
134#endif
135
136#define macro .macro
137#define endm .endm
138#define nop2 rjmp .+0 /* jump to next instruction */
139
140#endif /* development environment */
141
142/* for conveniecne, ensure that PRG_RDB exists */
143#ifndef PRG_RDB
144# define PRG_RDB(addr) USB_READ_FLASH(addr)
145#endif
146#endif /* __usbportability_h_INCLUDED__ */
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index 4c8e6003fe..5feff889a1 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18#include <avr/wdt.h> 18#include <avr/wdt.h>
19#include <util/delay.h> 19#include <util/delay.h>
20#include <stdint.h> 20#include <stdint.h>
21#include "usbdrv.h" 21#include <usbdrv/usbdrv.h>
22#include "usbconfig.h" 22#include "usbconfig.h"
23#include "host.h" 23#include "host.h"
24#include "report.h" 24#include "report.h"
@@ -290,12 +290,12 @@ usbMsgLen_t usbFunctionSetup(uchar data[8]) {
290 if (rq->bRequest == USBRQ_HID_GET_REPORT) { 290 if (rq->bRequest == USBRQ_HID_GET_REPORT) {
291 debug("GET_REPORT:"); 291 debug("GET_REPORT:");
292 /* we only have one report type, so don't look at wValue */ 292 /* we only have one report type, so don't look at wValue */
293 usbMsgPtr = (void *)&keyboard_report; 293 usbMsgPtr = (usbMsgPtr_t)&keyboard_report;
294 return sizeof(keyboard_report); 294 return sizeof(keyboard_report);
295 } else if (rq->bRequest == USBRQ_HID_GET_IDLE) { 295 } else if (rq->bRequest == USBRQ_HID_GET_IDLE) {
296 debug("GET_IDLE: "); 296 debug("GET_IDLE: ");
297 // debug_hex(vusb_idle_rate); 297 // debug_hex(vusb_idle_rate);
298 usbMsgPtr = &vusb_idle_rate; 298 usbMsgPtr = (usbMsgPtr_t)&vusb_idle_rate;
299 return 1; 299 return 1;
300 } else if (rq->bRequest == USBRQ_HID_SET_IDLE) { 300 } else if (rq->bRequest == USBRQ_HID_SET_IDLE) {
301 vusb_idle_rate = rq->wValue.bytes[1]; 301 vusb_idle_rate = rq->wValue.bytes[1];
@@ -815,29 +815,29 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) {
815 */ 815 */
816 switch (rq->wValue.bytes[1]) { 816 switch (rq->wValue.bytes[1]) {
817 case USBDESCR_DEVICE: 817 case USBDESCR_DEVICE:
818 usbMsgPtr = (unsigned char *)&usbDeviceDescriptor; 818 usbMsgPtr = (usbMsgPtr_t)&usbDeviceDescriptor;
819 len = sizeof(usbDeviceDescriptor_t); 819 len = sizeof(usbDeviceDescriptor_t);
820 break; 820 break;
821 case USBDESCR_CONFIG: 821 case USBDESCR_CONFIG:
822 usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor; 822 usbMsgPtr = (usbMsgPtr_t)&usbConfigurationDescriptor;
823 len = sizeof(usbConfigurationDescriptor_t); 823 len = sizeof(usbConfigurationDescriptor_t);
824 break; 824 break;
825 case USBDESCR_STRING: 825 case USBDESCR_STRING:
826 switch (rq->wValue.bytes[0]) { 826 switch (rq->wValue.bytes[0]) {
827 case 0: 827 case 0:
828 usbMsgPtr = (unsigned char *)&usbStringDescriptorZero; 828 usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorZero;
829 len = usbStringDescriptorZero.header.bLength; 829 len = usbStringDescriptorZero.header.bLength;
830 break; 830 break;
831 case 1: // iManufacturer 831 case 1: // iManufacturer
832 usbMsgPtr = (unsigned char *)&usbStringDescriptorManufacturer; 832 usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorManufacturer;
833 len = usbStringDescriptorManufacturer.header.bLength; 833 len = usbStringDescriptorManufacturer.header.bLength;
834 break; 834 break;
835 case 2: // iProduct 835 case 2: // iProduct
836 usbMsgPtr = (unsigned char *)&usbStringDescriptorProduct; 836 usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorProduct;
837 len = usbStringDescriptorProduct.header.bLength; 837 len = usbStringDescriptorProduct.header.bLength;
838 break; 838 break;
839 case 3: // iSerialNumber 839 case 3: // iSerialNumber
840 usbMsgPtr = (unsigned char *)&usbStringDescriptorSerial; 840 usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorSerial;
841 len = usbStringDescriptorSerial.header.bLength; 841 len = usbStringDescriptorSerial.header.bLength;
842 break; 842 break;
843 } 843 }
@@ -845,24 +845,24 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) {
845 case USBDESCR_HID: 845 case USBDESCR_HID:
846 switch (rq->wValue.bytes[0]) { 846 switch (rq->wValue.bytes[0]) {
847 case KEYBOARD_INTERFACE: 847 case KEYBOARD_INTERFACE:
848 usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.keyboardHID; 848 usbMsgPtr = (usbMsgPtr_t)&usbConfigurationDescriptor.keyboardHID;
849 len = sizeof(usbHIDDescriptor_t); 849 len = sizeof(usbHIDDescriptor_t);
850 break; 850 break;
851#if defined(RAW_ENABLE) 851#if defined(RAW_ENABLE)
852 case RAW_INTERFACE: 852 case RAW_INTERFACE:
853 usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.rawHID; 853 usbMsgPtr = (usbMsgPtr_t)&usbConfigurationDescriptor.rawHID;
854 len = sizeof(usbHIDDescriptor_t); 854 len = sizeof(usbHIDDescriptor_t);
855 break; 855 break;
856#endif 856#endif
857#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) 857#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
858 case MOUSE_EXTRA_INTERFACE: 858 case MOUSE_EXTRA_INTERFACE:
859 usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.mouseExtraHID; 859 usbMsgPtr = (usbMsgPtr_t)&usbConfigurationDescriptor.mouseExtraHID;
860 len = sizeof(usbHIDDescriptor_t); 860 len = sizeof(usbHIDDescriptor_t);
861 break; 861 break;
862#endif 862#endif
863#if defined(CONSOLE_ENABLE) 863#if defined(CONSOLE_ENABLE)
864 case CONSOLE_INTERFACE: 864 case CONSOLE_INTERFACE:
865 usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.consoleHID; 865 usbMsgPtr = (usbMsgPtr_t)&usbConfigurationDescriptor.consoleHID;
866 len = sizeof(usbHIDDescriptor_t); 866 len = sizeof(usbHIDDescriptor_t);
867 break; 867 break;
868#endif 868#endif
@@ -872,24 +872,24 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) {
872 /* interface index */ 872 /* interface index */
873 switch (rq->wIndex.word) { 873 switch (rq->wIndex.word) {
874 case KEYBOARD_INTERFACE: 874 case KEYBOARD_INTERFACE:
875 usbMsgPtr = (unsigned char *)keyboard_hid_report; 875 usbMsgPtr = (usbMsgPtr_t)keyboard_hid_report;
876 len = sizeof(keyboard_hid_report); 876 len = sizeof(keyboard_hid_report);
877 break; 877 break;
878#if defined(RAW_ENABLE) 878#if defined(RAW_ENABLE)
879 case RAW_INTERFACE: 879 case RAW_INTERFACE:
880 usbMsgPtr = (unsigned char *)raw_hid_report; 880 usbMsgPtr = (usbMsgPtr_t)raw_hid_report;
881 len = sizeof(raw_hid_report); 881 len = sizeof(raw_hid_report);
882 break; 882 break;
883#endif 883#endif
884#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) 884#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
885 case MOUSE_EXTRA_INTERFACE: 885 case MOUSE_EXTRA_INTERFACE:
886 usbMsgPtr = (unsigned char *)mouse_extra_hid_report; 886 usbMsgPtr = (usbMsgPtr_t)mouse_extra_hid_report;
887 len = sizeof(mouse_extra_hid_report); 887 len = sizeof(mouse_extra_hid_report);
888 break; 888 break;
889#endif 889#endif
890#if defined(CONSOLE_ENABLE) 890#if defined(CONSOLE_ENABLE)
891 case CONSOLE_INTERFACE: 891 case CONSOLE_INTERFACE:
892 usbMsgPtr = (unsigned char *)console_hid_report; 892 usbMsgPtr = (usbMsgPtr_t)console_hid_report;
893 len = sizeof(console_hid_report); 893 len = sizeof(console_hid_report);
894 break; 894 break;
895#endif 895#endif
diff --git a/users/ericgebhart/ericgebhart.c b/users/ericgebhart/ericgebhart.c
index 76143c6ed1..abb87899b7 100644
--- a/users/ericgebhart/ericgebhart.c
+++ b/users/ericgebhart/ericgebhart.c
@@ -61,11 +61,6 @@ uint32_t layer_state_set_keymap (uint32_t state) {
61__attribute__ ((weak)) 61__attribute__ ((weak))
62void led_set_keymap(uint8_t usb_led) {} 62void led_set_keymap(uint8_t usb_led) {}
63 63
64// Runs just one time when the keyboard initializes.
65void matrix_init_user(void) {
66 //ACTION_DEFAULT_LAYER_SET(DVORAK) ;
67}
68
69// check default layerstate to see which layer we are on. 64// check default layerstate to see which layer we are on.
70// if (biton32(layer_state) == _DIABLO) { --- current layer 65// if (biton32(layer_state) == _DIABLO) { --- current layer
71// if (biton32(default_layer_state) == _DIABLO) { --- current default layer 66// if (biton32(default_layer_state) == _DIABLO) { --- current default layer
diff --git a/users/ninjonas/ninjonas.c b/users/ninjonas/ninjonas.c
index 7e5afcec87..d66a5b008c 100644
--- a/users/ninjonas/ninjonas.c
+++ b/users/ninjonas/ninjonas.c
@@ -36,4 +36,4 @@ void keyboard_post_init_user() {
36 } 36 }
37 #endif 37 #endif
38 layer_state_set_user(layer_state); 38 layer_state_set_user(layer_state);
39} \ No newline at end of file 39}
diff --git a/users/ridingqwerty/ridingqwerty.c b/users/ridingqwerty/ridingqwerty.c
index ee6e7e897a..19b417a80f 100644
--- a/users/ridingqwerty/ridingqwerty.c
+++ b/users/ridingqwerty/ridingqwerty.c
@@ -45,7 +45,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
45 return state; 45 return state;
46} 46}
47 47
48uint16_t get_tapping_term(uint16_t keycode) { 48uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
49 switch (keycode) { 49 switch (keycode) {
50 case RC(ENT): 50 case RC(ENT):
51 case ED(ESC): 51 case ED(ESC):
diff --git a/users/tominabox1/tominabox1.c b/users/tominabox1/tominabox1.c
index 95e6ee7803..d2e9e12581 100644
--- a/users/tominabox1/tominabox1.c
+++ b/users/tominabox1/tominabox1.c
@@ -106,7 +106,7 @@ qk_tap_dance_action_t tap_dance_actions[] = {
106 106
107#endif // CRKBD 107#endif // CRKBD
108 108
109uint16_t get_tapping_term(uint16_t keycode) { 109uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
110 switch (keycode) { 110 switch (keycode) {
111 case LSFT_T(KC_CAPS): 111 case LSFT_T(KC_CAPS):
112 return 250; 112 return 250;