From fced377ac007d27f2650ccffbe0b18abcdcfe23d Mon Sep 17 00:00:00 2001 From: James Young <18669334+noroadsleft@users.noreply.github.com> Date: Sat, 30 May 2020 13:14:59 -0700 Subject: [PATCH] 2020 May 30 Breaking Changes Update (#9215) * Branch point for 2020 May 30 Breaking Change * Migrate `ACTION_LAYER_TOGGLE` to `TG()` (#8954) * Migrate `ACTION_MODS_ONESHOT` to `OSM()` (#8957) * Migrate `ACTION_DEFAULT_LAYER_SET` to `DF()` (#8958) * Migrate `ACTION_LAYER_MODS` to `LM()` (#8959) * Migrate `ACTION_MODS_TAP_KEY` to `MT()` (#8968) * Convert V-USB usbdrv to a submodule (#8321) * Unify Tap Hold functions and documentation (#8348) * Changing board names to prevent confusion (#8412) * Move the Keyboardio Model01 to a keyboardio/ subdir (#8499) * Move spaceman keyboards (#8830) * Migrate miscellaneous `fn_actions` entries (#8977) * Migrate `ACTION_MODS_KEY` to chained mod keycodes (#8979) * Organizing my keyboards (plaid, tartan, ergoinu) (#8537) * Refactor Lily58 to use split_common (#6260) * Refactor zinc to use split_common (#7114) * Add a message if bin/qmk doesn't work (#9000) * Fix conflicting types for 'tfp_printf' (#8269) * Fixed RGB_DISABLE_AFTER_TIMEOUT to be seconds based & small internals cleanup (#6480) * Refactor and updates to TKC1800 code (#8472) * Switch to qmk forks for everything (#9019) * audio refactor: replace deprecated PLAY_NOTE_ARRAY (#8484) * Audio enable corrections (2/3) (#8903) * Split HHKB to ANSI and JP layouts and Add VIA support for each (#8582) * Audio enable corrections (Part 4) (#8974) * Fix typo from PR7114 (#9171) * Augment future branch Changelogs (#8978) * Revert "Branch point for 2020 May 30 Breaking Change" --- .gitmodules | 8 +- Makefile | 6 +- docs/ChangeLog/20200530.md | 239 ++++++ docs/_summary.md | 1 + docs/breaking_changes.md | 45 +- docs/breaking_changes_instructions.md | 2 +- docs/custom_quantum_functions.md | 57 +- docs/feature_rgb_matrix.md | 3 +- docs/ja/custom_quantum_functions.md | 8 +- docs/tap_hold.md | 87 +- docs/zh-cn/custom_quantum_functions.md | 6 +- keyboards/at101_bh/at101_bh.c | 1 + .../at101_bh.h} | 5 +- .../{at101_blackheart => at101_bh}/config.h | 2 +- .../{at101_blackheart => at101_bh}/info.json | 4 +- .../keymaps/default/keymap.c | 0 .../{at101_blackheart => at101_bh}/readme.md | 8 +- .../{at101_blackheart => at101_bh}/rules.mk | 0 keyboards/at101_blackheart/at101_blackheart.c | 1 - keyboards/atomic/keymaps/pvc/keymap.c | 6 +- keyboards/atreus62/keymaps/atreus52/keymap.c | 17 +- .../pegasushoof/keymaps/blowrak/keymap.c | 8 +- keyboards/ckeys/handwire_101/config.h | 6 +- keyboards/ckeys/handwire_101/rules.mk | 2 +- .../clueboard/card/keymaps/default/keymap.c | 3 +- .../clueboard/card/keymaps/default/rules.mk | 2 +- .../usb_usb/keymaps/chriskopher/keymap.c | 2 +- .../usb_usb/keymaps/coloneljesus/keymap.c | 6 +- keyboards/crkbd/keymaps/drashna/keymap.c | 2 +- keyboards/cu75/cu75.c | 2 +- keyboards/{ => dm9records}/ergoinu/config.h | 0 keyboards/{ => dm9records}/ergoinu/ergoinu.c | 0 keyboards/{ => dm9records}/ergoinu/ergoinu.h | 0 keyboards/{ => dm9records}/ergoinu/info.json | 2 +- .../ergoinu/keymaps/default/config.h | 0 .../ergoinu/keymaps/default/keymap.c | 0 .../ergoinu/keymaps/default/rules.mk | 0 .../ergoinu/keymaps/default_jis/config.h | 0 .../ergoinu/keymaps/default_jis/keymap.c | 0 .../ergoinu/keymaps/default_jis/rules.mk | 0 keyboards/{ => dm9records}/ergoinu/matrix.c | 0 keyboards/{ => dm9records}/ergoinu/readme.md | 4 +- keyboards/{ => dm9records}/ergoinu/rules.mk | 4 +- keyboards/{ => dm9records}/ergoinu/serial.c | 0 keyboards/{ => dm9records}/ergoinu/serial.h | 0 .../{ => dm9records}/ergoinu/serial_config.h | 0 .../{ => dm9records}/ergoinu/split_util.c | 0 .../{ => dm9records}/ergoinu/split_util.h | 0 keyboards/{ => dm9records}/plaid/config.h | 0 keyboards/{ => dm9records}/plaid/info.json | 4 +- .../plaid/keymaps/brickbots/config.h | 0 .../plaid/keymaps/brickbots/keymap.c | 0 .../plaid/keymaps/brickbots/readme.md | 0 .../plaid/keymaps/default/config.h | 0 .../plaid/keymaps/default/keymap.c | 0 .../plaid/keymaps/default/readme.md | 0 .../plaid/keymaps/thehalfdeafchef/config.h | 0 .../plaid/keymaps/thehalfdeafchef/keymap.c | 0 .../plaid/keymaps/thehalfdeafchef/readme.md | 0 keyboards/{ => dm9records}/plaid/plaid.c | 0 keyboards/{ => dm9records}/plaid/plaid.h | 0 keyboards/{ => dm9records}/plaid/readme.md | 4 +- keyboards/{ => dm9records}/plaid/rules.mk | 0 keyboards/{ => dm9records}/tartan/config.h | 0 keyboards/{ => dm9records}/tartan/info.json | 2 +- .../tartan/keymaps/default/keymap.c | 0 .../tartan/keymaps/default/readme.md | 0 keyboards/{ => dm9records}/tartan/readme.md | 4 +- keyboards/{ => dm9records}/tartan/rules.mk | 0 keyboards/{ => dm9records}/tartan/tartan.c | 0 keyboards/{ => dm9records}/tartan/tartan.h | 0 keyboards/eco/rules.mk | 2 +- .../ergodox_stm32/keymaps/default/keymap.c | 4 - keyboards/ergotravel/keymaps/ckofy/keymap.c | 23 +- .../gh60/revc/keymaps/robotmaxtron/keymap.c | 6 +- keyboards/gh60/satan/keymaps/denolfe/keymap.c | 3 +- .../keymaps/milestogo/keymap.c | 1 - keyboards/hhkb/ansi/ansi.c | 1 + keyboards/hhkb/ansi/ansi.h | 23 + keyboards/hhkb/{ => ansi}/config.h | 15 +- keyboards/hhkb/ansi/hhkb_avr.h | 157 ++++ keyboards/hhkb/ansi/info.json | 73 ++ .../{ => ansi}/keymaps/blakedietz/README.md | 0 .../{ => ansi}/keymaps/blakedietz/config.h | 0 .../{ => ansi}/keymaps/blakedietz/keymap.c | 0 .../{ => ansi}/keymaps/blakedietz/rules.mk | 0 .../hhkb/{ => ansi}/keymaps/brett/config.h | 0 .../hhkb/{ => ansi}/keymaps/brett/keymap.c | 0 .../hhkb/{ => ansi}/keymaps/brett/readme.md | 0 .../hhkb/{ => ansi}/keymaps/brett/rules.mk | 0 .../hhkb/{ => ansi}/keymaps/cinaeco/README.md | 0 .../hhkb/{ => ansi}/keymaps/cinaeco/config.h | 0 .../hhkb/{ => ansi}/keymaps/cinaeco/keymap.c | 0 .../hhkb/{ => ansi}/keymaps/cinaeco/rules.mk | 0 .../hhkb/{ => ansi}/keymaps/dbroqua/keymap.c | 0 .../hhkb/{ => ansi}/keymaps/dbroqua/readme.md | 0 .../hhkb/{ => ansi}/keymaps/default/keymap.c | 0 .../hhkb/{ => ansi}/keymaps/eric/keymap.c | 0 .../dhertz => ansi/keymaps/krusli}/config.h | 0 .../hhkb/{ => ansi}/keymaps/krusli/keymap.c | 0 .../hhkb/{ => ansi}/keymaps/lxol/keymap.c | 16 +- .../hhkb/{ => ansi}/keymaps/mjt/config.h | 0 .../hhkb/{ => ansi}/keymaps/mjt/keymap.c | 3 +- .../hhkb/{ => ansi}/keymaps/mjt/readme.md | 0 keyboards/hhkb/ansi/keymaps/mjt/rules.mk | 1 + .../{ => ansi}/keymaps/schaeferdev/README.md | 0 .../{ => ansi}/keymaps/schaeferdev/config.h | 0 .../{ => ansi}/keymaps/schaeferdev/keymap.c | 0 .../{ => ansi}/keymaps/schaeferdev/rules.mk | 0 .../keymaps/shela/action_pseudo_lut.c | 0 .../keymaps/shela/action_pseudo_lut.h | 0 .../hhkb/{ => ansi}/keymaps/shela/config.h | 0 .../hhkb/{ => ansi}/keymaps/shela/keymap.c | 11 +- .../{ => ansi}/keymaps/shela/keymap_jis2us.h | 0 .../hhkb/{ => ansi}/keymaps/shela/readme.md | 0 .../hhkb/{ => ansi}/keymaps/shela/rules.mk | 0 .../hhkb/{ => ansi}/keymaps/smt/keymap.c | 0 .../{ => ansi}/keymaps/tobiasvl_iso/keymap.c | 0 .../{ => ansi}/keymaps/tobiasvl_iso/readme.md | 0 .../{ => ansi}/keymaps/tominabox1/.gitignore | 0 .../{ => ansi}/keymaps/tominabox1/keymap.c | 0 keyboards/hhkb/ansi/keymaps/via/keymap.c | 68 ++ keyboards/hhkb/ansi/keymaps/via/rules.mk | 1 + .../hhkb/{ => ansi}/keymaps/xyverz/keymap.c | 0 keyboards/hhkb/ansi/matrix.c | 211 +++++ keyboards/hhkb/ansi/readme.md | 14 + keyboards/hhkb/{ => ansi}/rules.mk | 12 +- keyboards/hhkb/hhkb.c | 1 - keyboards/hhkb/jp/config.h | 104 +++ keyboards/hhkb/{ => jp}/hhkb_avr.h | 13 +- keyboards/hhkb/{ => jp}/info.json | 67 +- keyboards/hhkb/jp/jp.c | 1 + keyboards/hhkb/{hhkb.h => jp/jp.h} | 26 +- .../hhkb/{ => jp}/keymaps/bakingpy/keymap.c | 0 .../hhkb/{ => jp}/keymaps/bakingpy/rules.mk | 0 .../jp => jp/keymaps/default}/keymap.c | 0 .../keymaps/default}/rules.mk | 0 .../keymaps/default_mac}/keymap.c | 0 .../jp => jp/keymaps/default_mac}/rules.mk | 0 .../krusli => jp/keymaps/dhertz}/config.h | 0 .../hhkb/{ => jp}/keymaps/dhertz/keymap.c | 0 .../hhkb/{ => jp}/keymaps/dhertz/keymap.h | 0 .../hhkb/{ => jp}/keymaps/dhertz/rules.mk | 0 .../hhkb/{ => jp}/keymaps/enoch_jp/keymap.c | 0 .../hhkb/{ => jp}/keymaps/enoch_jp/rules.mk | 0 .../{ => jp}/keymaps/halfqwerty_jp/README.md | 0 .../{ => jp}/keymaps/halfqwerty_jp/keymap.c | 0 .../keymaps/halfqwerty_jp}/rules.mk | 0 .../hhkb/{ => jp}/keymaps/rdg_jp/keymap.c | 0 .../hhkb/{ => jp}/keymaps/rdg_jp/rules.mk | 0 .../hhkb/{ => jp}/keymaps/sh_jp/README.md | 0 .../hhkb/{ => jp}/keymaps/sh_jp/keymap.c | 0 .../hhkb/{ => jp}/keymaps/sh_jp/rules.mk | 0 keyboards/hhkb/jp/keymaps/via/config.h | 2 + keyboards/hhkb/jp/keymaps/via/keymap.c | 58 ++ keyboards/hhkb/jp/keymaps/via/rules.mk | 1 + keyboards/hhkb/{ => jp}/matrix.c | 5 +- keyboards/hhkb/{ => jp}/readme.md | 2 +- keyboards/hhkb/jp/rules.mk | 69 ++ .../infinity60/keymaps/jpetermans/keymap.c | 8 +- keyboards/jd45/keymaps/justin/keymap.c | 20 +- keyboards/jd45/keymaps/mjt6u/keymap.c | 4 +- .../nyquist/keymaps/danielhklein/keymap.c | 13 +- .../keebio/viterbi/keymaps/bakingpy/keymap.c | 6 +- .../keebio/viterbi/keymaps/dwallace/keymap.c | 2 +- .../keebio/viterbi/keymaps/mike808/keymap.c | 4 +- keyboards/{ => keyboardio}/model01/config.h | 0 keyboards/{ => keyboardio}/model01/info.json | 2 +- .../model01/keymaps/default/config.h | 0 .../model01/keymaps/default/keymap.c | 0 .../model01/keymaps/default/readme.md | 0 .../model01/keymaps/dshields/config.h | 0 .../model01/keymaps/dshields/keymap.c | 0 .../model01/keymaps/dshields/readme.md | 0 .../model01/keymaps/tw1t611/config.h | 0 .../model01/keymaps/tw1t611/keymap.c | 0 .../model01/keymaps/tw1t611/readme.md | 0 keyboards/{ => keyboardio}/model01/leds.c | 0 keyboards/{ => keyboardio}/model01/leds.h | 0 keyboards/{ => keyboardio}/model01/matrix.c | 0 keyboards/{ => keyboardio}/model01/model01.c | 0 keyboards/{ => keyboardio}/model01/model01.h | 0 keyboards/{ => keyboardio}/model01/readme.md | 10 +- keyboards/{ => keyboardio}/model01/rules.mk | 0 .../model01/wire-protocol-constants.h | 0 keyboards/keyboardio/readme.md | 18 + keyboards/kinesis/keymaps/milestogo/keymap.c | 26 +- keyboards/lets_split/keymaps/mjt/keymap.c | 6 +- keyboards/lets_split/keymaps/piemod/keymap.c | 20 +- keyboards/lily58/config.h | 12 +- keyboards/lily58/i2c.c | 162 ---- keyboards/lily58/i2c.h | 46 -- keyboards/lily58/keymaps/chuan/config.h | 64 ++ keyboards/lily58/keymaps/chuan/keymap.c | 230 ++++++ keyboards/lily58/keymaps/chuan/rules.mk | 11 + keyboards/lily58/keymaps/default/config.h | 4 +- keyboards/lily58/keymaps/default/keymap.c | 58 +- keyboards/lily58/keymaps/default/rules.mk | 4 +- keyboards/lily58/keymaps/yuchi/keymap.c | 47 +- keyboards/lily58/keymaps/yuchi/rules.mk | 5 +- .../lib/{glcdfont.c => glcdfont_lily.c} | 1 + keyboards/lily58/lib/host_led_state_reader.c | 9 +- keyboards/lily58/lib/keylogger.c | 1 + keyboards/lily58/lib/layer_state_reader.c | 8 +- keyboards/lily58/lib/mode_icon_reader.c | 1 + keyboards/lily58/lib/timelogger.c | 1 + keyboards/lily58/lily58.c | 7 +- keyboards/lily58/rev1/config.h | 2 - keyboards/lily58/rev1/rules.mk | 3 - keyboards/lily58/rev1/split_scomm.c | 91 --- keyboards/lily58/rev1/split_scomm.h | 24 - keyboards/lily58/rev1/split_util.h | 19 - keyboards/lily58/rules.mk | 16 +- keyboards/lily58/serial.h | 84 -- keyboards/lily58/serial_config.h | 4 - keyboards/lily58/ssd1306.c | 344 -------- keyboards/lily58/ssd1306.h | 90 --- keyboards/meira/keymaps/default/keymap.c | 6 +- keyboards/meira/keymaps/grahampheath/keymap.c | 6 +- keyboards/meira/keymaps/takmiya/keymap.c | 2 +- keyboards/meishi/keymaps/default/keymap.c | 4 - keyboards/navi10/rev3/rules.mk | 2 +- .../nomu30/keymaps/center_sprit/keymap.c | 2 +- keyboards/nomu30/keymaps/like_jis/keymap.c | 2 +- .../config.h | 0 .../info.json | 2 +- .../keymaps/default/keymap.c | 0 keyboards/omnikey_bh/omnikey_bh.c | 1 + .../omnikey_bh.h} | 5 +- .../readme.md | 6 +- .../rules.mk | 0 .../omnikey_blackheart/omnikey_blackheart.c | 1 - keyboards/pancake/feather/readme.md | 1 - keyboards/pancake/keymaps/default/readme.md | 1 - keyboards/pancake/promicro/readme.md | 1 - keyboards/planck/keymaps/ab/keymap.c | 22 +- .../planck/keymaps/angerthosenear/keymap.c | 11 +- keyboards/planck/keymaps/austin/keymap.c | 13 +- keyboards/planck/keymaps/brandon/keymap.c | 10 +- keyboards/planck/keymaps/chance/keymap.c | 6 +- keyboards/planck/keymaps/charlie/keymap.c | 51 +- keyboards/planck/keymaps/circuit/keymap.c | 10 +- keyboards/planck/keymaps/david/keymap.c | 12 +- .../planck/keymaps/dr_notsokind/keymap.c | 10 +- keyboards/planck/keymaps/dzobert/keymap.c | 10 +- keyboards/planck/keymaps/emilyh/keymap.c | 16 +- keyboards/planck/keymaps/espynn/keymap.c | 20 +- keyboards/planck/keymaps/ishtob/keymap.c | 20 +- keyboards/planck/keymaps/joe/keymap.c | 21 +- keyboards/planck/keymaps/kyle/keymap.c | 12 +- keyboards/planck/keymaps/lucas/keymap.c | 9 +- keyboards/planck/keymaps/matrixman/keymap.c | 7 +- keyboards/planck/keymaps/max/keymap.c | 10 +- keyboards/planck/keymaps/mollat/keymap.c | 4 - keyboards/planck/keymaps/piemod/keymap.c | 46 +- keyboards/planck/keymaps/pvc/keymap.c | 6 +- .../planck/keymaps/that_canadian/keymap.c | 8 +- keyboards/planck/keymaps/zrichard/keymap.c | 6 +- keyboards/planck/rev6/config.h | 1 + keyboards/planck/rev6/rules.mk | 2 +- .../preonic/keymaps/that_canadian/keymap.c | 8 +- keyboards/preonic/rev1/rules.mk | 2 +- keyboards/preonic/rev2/rules.mk | 2 +- keyboards/preonic/rev3/config.h | 1 + keyboards/preonic/rev3/rules.mk | 2 +- .../rgbkb/zen/rev1/keymaps/default/keymap.c | 4 +- .../zen/rev1/keymaps/jwlawrence/keymap.c | 4 +- keyboards/scarletbandana/rules.mk | 2 +- keyboards/sck/neiso/rules.mk | 2 +- .../s60_x/keymaps/ansi_qwertz/keymap.c | 14 +- keyboards/sentraq/s60_x/keymaps/hasu/keymap.c | 28 +- keyboards/sentraq/s60_x/keymaps/jpec/keymap.c | 15 +- .../sentraq/s60_x/keymaps/poker/keymap.c | 34 +- .../sentraq/s60_x/keymaps/poker_bit/keymap.c | 13 +- .../sentraq/s60_x/keymaps/poker_set/keymap.c | 12 +- .../sentraq/s60_x/keymaps/spacefn/keymap.c | 9 +- .../sentraq/s65_x/keymaps/kelorean/keymap.c | 12 +- keyboards/sentraq/s65_x/keymaps/nall/keymap.c | 10 +- keyboards/{ => spaceman}/2_milk/2_milk.c | 0 keyboards/{ => spaceman}/2_milk/2_milk.h | 0 keyboards/{ => spaceman}/2_milk/config.h | 2 +- keyboards/{ => spaceman}/2_milk/info.json | 2 +- .../2_milk/keymaps/binary/keymap.c | 0 .../2_milk/keymaps/binary/readme.md | 0 .../2_milk/keymaps/copypasta/keymap.c | 0 .../2_milk/keymaps/copypasta/readme.md | 0 .../2_milk/keymaps/default/keymap.c | 0 .../2_milk/keymaps/default/readme.md | 0 .../2_milk/keymaps/emoji/config.h | 0 .../2_milk/keymaps/emoji/keymap.c | 0 .../2_milk/keymaps/emoji/readme.md | 0 .../2_milk/keymaps/emoji/rules.mk | 0 .../2_milk/keymaps/excessbread/keymap.c | 0 .../2_milk/keymaps/excessbread/readme.md | 0 .../2_milk/keymaps/mikethetiger/keymap.c | 0 .../2_milk/keymaps/mikethetiger/readme.md | 0 .../2_milk/keymaps/mikethetiger/rules.mk | 0 .../2_milk/keymaps/mouse/keymap.c | 0 .../2_milk/keymaps/mouse/readme.md | 0 keyboards/{ => spaceman}/2_milk/readme.md | 6 +- keyboards/{ => spaceman}/2_milk/rules.mk | 0 keyboards/{ => spaceman}/pancake/config.h | 0 .../{ => spaceman}/pancake/feather/config.h | 0 .../{ => spaceman}/pancake/feather/rules.mk | 0 keyboards/{ => spaceman}/pancake/info.json | 2 +- .../pancake/keymaps/default/keymap.c | 0 .../pancake/keymaps/default/readme.md | 3 + keyboards/{ => spaceman}/pancake/pancake.c | 0 keyboards/{ => spaceman}/pancake/pancake.h | 0 .../{ => spaceman}/pancake/promicro/config.h | 0 .../{ => spaceman}/pancake/promicro/rules.mk | 0 keyboards/{ => spaceman}/pancake/readme.md | 4 +- keyboards/subatomic/rules.mk | 2 +- .../liminal/keymaps/default/keymap.c | 4 +- .../liminal/keymaps/default_iso/keymap.c | 2 +- .../minivan/keymaps/like_jis/keymap.c | 2 +- .../minivan/keymaps/mjt/keymap.c | 12 +- .../roadkit/keymaps/mjt/keymap.c | 6 +- keyboards/tkc1800/config.h | 5 + keyboards/tkc1800/i2c.c | 166 ---- keyboards/tkc1800/i2c.h | 49 -- keyboards/tkc1800/keymaps/default/config.h | 24 - keyboards/tkc1800/keymaps/default/keymap.c | 99 +-- keyboards/tkc1800/keymaps/smt/config.h | 24 - keyboards/tkc1800/keymaps/smt/keymap.c | 95 +-- keyboards/tkc1800/keymaps/via/keymap.c | 99 +-- keyboards/tkc1800/keymaps/wkl/config.h | 24 - keyboards/tkc1800/keymaps/wkl/keymap.c | 100 +-- keyboards/tkc1800/keymaps/yanfali/config.h | 24 - keyboards/tkc1800/keymaps/yanfali/keymap.c | 94 +-- keyboards/tkc1800/rules.mk | 9 +- keyboards/tkc1800/tkc1800.c | 7 + .../treadstone32/keymaps/default/keymap.c | 2 +- .../treadstone32/keymaps/like_jis/keymap.c | 2 +- .../vision_division/keymaps/default/rules.mk | 1 - keyboards/vision_division/rules.mk | 2 +- keyboards/xd60/keymaps/Jos/keymap.c | 7 +- keyboards/xd60/keymaps/cheese/keymap.c | 8 +- .../{z150_blackheart => z150_bh}/config.h | 0 .../{z150_blackheart => z150_bh}/info.json | 2 +- .../keymaps/default/keymap.c | 0 .../keymaps/default_tkl/keymap.c | 0 .../{z150_blackheart => z150_bh}/readme.md | 6 +- .../{z150_blackheart => z150_bh}/rules.mk | 0 .../z150_blackheart.c => z150_bh/z150_bh.c} | 2 +- .../z150_blackheart.h => z150_bh/z150_bh.h} | 0 keyboards/zinc/config.h | 25 - keyboards/zinc/i2c.c | 162 ---- keyboards/zinc/i2c.h | 49 -- keyboards/zinc/keymaps/default/config.h | 2 - keyboards/zinc/keymaps/default/keymap.c | 26 +- keyboards/zinc/keymaps/default/readme_en.md | 131 +++ keyboards/zinc/keymaps/default/readme_jp.md | 48 +- keyboards/zinc/keymaps/default/rules.mk | 57 +- keyboards/zinc/keymaps/ginjake/config.h | 2 - keyboards/zinc/keymaps/ginjake/rules.mk | 48 +- keyboards/zinc/keymaps/monks/config.h | 2 - keyboards/zinc/keymaps/monks/keymap.c | 3 +- keyboards/zinc/keymaps/monks/readme_jp.md | 2 +- keyboards/zinc/keymaps/monks/rules.mk | 50 +- keyboards/zinc/keymaps/toshi0383/config.h | 2 - keyboards/zinc/keymaps/toshi0383/rules.mk | 67 +- keyboards/zinc/readme.md | 6 +- keyboards/zinc/rev1/config.h | 61 +- keyboards/zinc/rev1/matrix.c | 357 --------- keyboards/zinc/rev1/rev1.c | 1 - keyboards/zinc/rev1/rev1.h | 15 - keyboards/zinc/rev1/rules.mk | 5 +- keyboards/zinc/rev1/serial_config.h | 18 - keyboards/zinc/rev1/serial_config_simpleapi.h | 8 - keyboards/zinc/rev1/split_scomm.c | 95 --- keyboards/zinc/rev1/split_scomm.h | 24 - keyboards/zinc/rev1/split_util.c | 70 -- keyboards/zinc/rev1/split_util.h | 19 - keyboards/zinc/reva/config.h | 56 +- keyboards/zinc/reva/matrix.c | 357 --------- keyboards/zinc/reva/reva.c | 1 - keyboards/zinc/reva/reva.h | 15 - keyboards/zinc/reva/rules.mk | 5 +- keyboards/zinc/reva/serial_config.h | 18 - keyboards/zinc/reva/serial_config_simpleapi.h | 8 - keyboards/zinc/reva/split_scomm.c | 95 --- keyboards/zinc/reva/split_scomm.h | 24 - keyboards/zinc/reva/split_util.c | 70 -- keyboards/zinc/reva/split_util.h | 19 - keyboards/zinc/rules.mk | 4 - keyboards/zinc/serial.c | 589 -------------- keyboards/zinc/serial.h | 84 -- keyboards/zinc/zinc.h | 6 +- layouts/community/60_iso/unxmaal/keymap.c | 2 - layouts/community/ergodox/algernon/keymap.c | 18 +- .../ergodox/colemak_osx_pc_no/keymap.c | 3 +- layouts/community/ergodox/drashna/keymap.c | 2 +- layouts/community/ergodox/guni/keymap.c | 19 +- layouts/community/ergodox/kastyle/keymap.c | 8 +- layouts/community/ergodox/mpiechotka/keymap.c | 10 +- .../norwegian_programmer_osx_pc/keymap.c | 3 +- .../keymap.c | 3 +- layouts/community/ergodox/townk_osx/keymap.c | 13 +- lib/printf | 1 + lib/vusb | 1 + message.mk | 3 +- quantum/audio/audio.h | 3 - quantum/audio/audio_avr.c | 5 + quantum/rgb_matrix.c | 106 ++- quantum/rgb_matrix.h | 8 +- .../rgb_matrix_animations/breathing_anim.h | 2 +- .../rgb_matrix_animations/digital_rain_anim.h | 24 +- .../jellybean_raindrops_anim.h | 2 +- .../rgb_matrix_animations/raindrops_anim.h | 2 +- .../typing_heatmap_anim.h | 28 +- .../rgb_matrix_runners/effect_runner_dx_dy.h | 2 +- .../effect_runner_dx_dy_dist.h | 2 +- quantum/rgb_matrix_runners/effect_runner_i.h | 2 +- .../effect_runner_sin_cos_i.h | 2 +- quantum/rgb_matrix_types.h | 7 - tmk_core/common.mk | 9 +- tmk_core/common/action.c | 4 +- tmk_core/common/action_tapping.c | 6 +- tmk_core/common/action_tapping.h | 2 +- tmk_core/common/chibios/printf.c | 233 ------ tmk_core/common/chibios/printf.h | 110 --- tmk_core/common/command.c | 4 - tmk_core/common/print.h | 5 +- tmk_core/protocol/arm_atsam/led_matrix.c | 2 +- tmk_core/protocol/chibios/main.c | 3 - tmk_core/protocol/chibios/usb_main.c | 5 +- tmk_core/protocol/chibios/usb_main.h | 2 - tmk_core/protocol/iwrap.mk | 18 +- tmk_core/protocol/iwrap/main.c | 2 +- tmk_core/protocol/vusb.mk | 16 +- tmk_core/protocol/vusb/main.c | 4 +- tmk_core/protocol/vusb/sendchar_usart.c | 2 +- tmk_core/protocol/vusb/usbdrv/Changelog.txt | 308 ------- .../vusb/usbdrv/CommercialLicense.txt | 166 ---- tmk_core/protocol/vusb/usbdrv/License.txt | 361 --------- tmk_core/protocol/vusb/usbdrv/Readme.txt | 172 ---- tmk_core/protocol/vusb/usbdrv/USB-ID-FAQ.txt | 149 ---- .../protocol/vusb/usbdrv/USB-IDs-for-free.txt | 148 ---- tmk_core/protocol/vusb/usbdrv/asmcommon.inc | 188 ----- tmk_core/protocol/vusb/usbdrv/oddebug.c | 46 -- tmk_core/protocol/vusb/usbdrv/oddebug.h | 121 --- .../vusb/usbdrv/usbconfig-prototype.h | 376 --------- tmk_core/protocol/vusb/usbdrv/usbdrv.c | 622 --------------- tmk_core/protocol/vusb/usbdrv/usbdrv.h | 730 ----------------- tmk_core/protocol/vusb/usbdrv/usbdrvasm.S | 393 --------- tmk_core/protocol/vusb/usbdrv/usbdrvasm.asm | 21 - tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc | 393 --------- .../protocol/vusb/usbdrv/usbdrvasm128.inc | 750 ------------------ tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc | 423 ---------- tmk_core/protocol/vusb/usbdrv/usbdrvasm16.inc | 346 -------- .../protocol/vusb/usbdrv/usbdrvasm165.inc | 453 ----------- .../protocol/vusb/usbdrv/usbdrvasm18-crc.inc | 707 ----------------- tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc | 360 --------- .../protocol/vusb/usbdrv/usbportability.h | 146 ---- tmk_core/protocol/vusb/vusb.c | 34 +- users/ericgebhart/ericgebhart.c | 5 - users/ninjonas/ninjonas.c | 2 +- users/ridingqwerty/ridingqwerty.c | 2 +- users/tominabox1/tominabox1.c | 2 +- 460 files changed, 2627 insertions(+), 12712 deletions(-) create mode 100644 docs/ChangeLog/20200530.md create mode 100644 keyboards/at101_bh/at101_bh.c rename keyboards/{at101_blackheart/at101_blackheart.h => at101_bh/at101_bh.h} (96%) rename keyboards/{at101_blackheart => at101_bh}/config.h (95%) rename keyboards/{at101_blackheart => at101_bh}/info.json (98%) rename keyboards/{at101_blackheart => at101_bh}/keymaps/default/keymap.c (100%) rename keyboards/{at101_blackheart => at101_bh}/readme.md (77%) rename keyboards/{at101_blackheart => at101_bh}/rules.mk (100%) delete mode 100644 keyboards/at101_blackheart/at101_blackheart.c rename keyboards/{ => dm9records}/ergoinu/config.h (100%) rename keyboards/{ => dm9records}/ergoinu/ergoinu.c (100%) rename keyboards/{ => dm9records}/ergoinu/ergoinu.h (100%) rename keyboards/{ => dm9records}/ergoinu/info.json (98%) rename keyboards/{ => dm9records}/ergoinu/keymaps/default/config.h (100%) rename keyboards/{ => dm9records}/ergoinu/keymaps/default/keymap.c (100%) rename keyboards/{ => dm9records}/ergoinu/keymaps/default/rules.mk (100%) rename keyboards/{ => dm9records}/ergoinu/keymaps/default_jis/config.h (100%) rename keyboards/{ => dm9records}/ergoinu/keymaps/default_jis/keymap.c (100%) rename keyboards/{ => dm9records}/ergoinu/keymaps/default_jis/rules.mk (100%) rename keyboards/{ => dm9records}/ergoinu/matrix.c (100%) rename keyboards/{ => dm9records}/ergoinu/readme.md (89%) rename keyboards/{ => dm9records}/ergoinu/rules.mk (95%) rename keyboards/{ => dm9records}/ergoinu/serial.c (100%) rename keyboards/{ => dm9records}/ergoinu/serial.h (100%) rename keyboards/{ => dm9records}/ergoinu/serial_config.h (100%) rename keyboards/{ => dm9records}/ergoinu/split_util.c (100%) rename keyboards/{ => dm9records}/ergoinu/split_util.h (100%) rename keyboards/{ => dm9records}/plaid/config.h (100%) rename keyboards/{ => dm9records}/plaid/info.json (97%) rename keyboards/{ => dm9records}/plaid/keymaps/brickbots/config.h (100%) rename keyboards/{ => dm9records}/plaid/keymaps/brickbots/keymap.c (100%) rename keyboards/{ => dm9records}/plaid/keymaps/brickbots/readme.md (100%) rename keyboards/{ => dm9records}/plaid/keymaps/default/config.h (100%) rename keyboards/{ => dm9records}/plaid/keymaps/default/keymap.c (100%) rename keyboards/{ => dm9records}/plaid/keymaps/default/readme.md (100%) rename keyboards/{ => dm9records}/plaid/keymaps/thehalfdeafchef/config.h (100%) rename keyboards/{ => dm9records}/plaid/keymaps/thehalfdeafchef/keymap.c (100%) rename keyboards/{ => dm9records}/plaid/keymaps/thehalfdeafchef/readme.md (100%) rename keyboards/{ => dm9records}/plaid/plaid.c (100%) rename keyboards/{ => dm9records}/plaid/plaid.h (100%) rename keyboards/{ => dm9records}/plaid/readme.md (91%) rename keyboards/{ => dm9records}/plaid/rules.mk (100%) rename keyboards/{ => dm9records}/tartan/config.h (100%) rename keyboards/{ => dm9records}/tartan/info.json (99%) rename keyboards/{ => dm9records}/tartan/keymaps/default/keymap.c (100%) rename keyboards/{ => dm9records}/tartan/keymaps/default/readme.md (100%) rename keyboards/{ => dm9records}/tartan/readme.md (91%) rename keyboards/{ => dm9records}/tartan/rules.mk (100%) rename keyboards/{ => dm9records}/tartan/tartan.c (100%) rename keyboards/{ => dm9records}/tartan/tartan.h (100%) create mode 100644 keyboards/hhkb/ansi/ansi.c create mode 100644 keyboards/hhkb/ansi/ansi.h rename keyboards/hhkb/{ => ansi}/config.h (94%) create mode 100644 keyboards/hhkb/ansi/hhkb_avr.h create mode 100644 keyboards/hhkb/ansi/info.json rename keyboards/hhkb/{ => ansi}/keymaps/blakedietz/README.md (100%) rename keyboards/hhkb/{ => ansi}/keymaps/blakedietz/config.h (100%) rename keyboards/hhkb/{ => ansi}/keymaps/blakedietz/keymap.c (100%) rename keyboards/hhkb/{ => ansi}/keymaps/blakedietz/rules.mk (100%) rename keyboards/hhkb/{ => ansi}/keymaps/brett/config.h (100%) rename keyboards/hhkb/{ => ansi}/keymaps/brett/keymap.c (100%) rename keyboards/hhkb/{ => ansi}/keymaps/brett/readme.md (100%) rename keyboards/hhkb/{ => ansi}/keymaps/brett/rules.mk (100%) rename keyboards/hhkb/{ => ansi}/keymaps/cinaeco/README.md (100%) rename keyboards/hhkb/{ => ansi}/keymaps/cinaeco/config.h (100%) rename keyboards/hhkb/{ => ansi}/keymaps/cinaeco/keymap.c (100%) rename keyboards/hhkb/{ => ansi}/keymaps/cinaeco/rules.mk (100%) rename keyboards/hhkb/{ => ansi}/keymaps/dbroqua/keymap.c (100%) rename keyboards/hhkb/{ => ansi}/keymaps/dbroqua/readme.md (100%) rename keyboards/hhkb/{ => ansi}/keymaps/default/keymap.c (100%) rename keyboards/hhkb/{ => ansi}/keymaps/eric/keymap.c (100%) rename keyboards/hhkb/{keymaps/dhertz => ansi/keymaps/krusli}/config.h (100%) rename keyboards/hhkb/{ => ansi}/keymaps/krusli/keymap.c (100%) rename keyboards/hhkb/{ => ansi}/keymaps/lxol/keymap.c (97%) rename keyboards/hhkb/{ => ansi}/keymaps/mjt/config.h (100%) rename keyboards/hhkb/{ => ansi}/keymaps/mjt/keymap.c (98%) rename keyboards/hhkb/{ => ansi}/keymaps/mjt/readme.md (100%) create mode 100644 keyboards/hhkb/ansi/keymaps/mjt/rules.mk rename keyboards/hhkb/{ => ansi}/keymaps/schaeferdev/README.md (100%) rename keyboards/hhkb/{ => ansi}/keymaps/schaeferdev/config.h (100%) rename keyboards/hhkb/{ => ansi}/keymaps/schaeferdev/keymap.c (100%) rename keyboards/hhkb/{ => ansi}/keymaps/schaeferdev/rules.mk (100%) rename keyboards/hhkb/{ => ansi}/keymaps/shela/action_pseudo_lut.c (100%) rename keyboards/hhkb/{ => ansi}/keymaps/shela/action_pseudo_lut.h (100%) rename keyboards/hhkb/{ => ansi}/keymaps/shela/config.h (100%) rename keyboards/hhkb/{ => ansi}/keymaps/shela/keymap.c (95%) rename keyboards/hhkb/{ => ansi}/keymaps/shela/keymap_jis2us.h (100%) rename keyboards/hhkb/{ => ansi}/keymaps/shela/readme.md (100%) rename keyboards/hhkb/{ => ansi}/keymaps/shela/rules.mk (100%) rename keyboards/hhkb/{ => ansi}/keymaps/smt/keymap.c (100%) rename keyboards/hhkb/{ => ansi}/keymaps/tobiasvl_iso/keymap.c (100%) rename keyboards/hhkb/{ => ansi}/keymaps/tobiasvl_iso/readme.md (100%) rename keyboards/hhkb/{ => ansi}/keymaps/tominabox1/.gitignore (100%) rename keyboards/hhkb/{ => ansi}/keymaps/tominabox1/keymap.c (100%) create mode 100644 keyboards/hhkb/ansi/keymaps/via/keymap.c create mode 100644 keyboards/hhkb/ansi/keymaps/via/rules.mk rename keyboards/hhkb/{ => ansi}/keymaps/xyverz/keymap.c (100%) create mode 100644 keyboards/hhkb/ansi/matrix.c create mode 100644 keyboards/hhkb/ansi/readme.md rename keyboards/hhkb/{ => ansi}/rules.mk (94%) delete mode 100644 keyboards/hhkb/hhkb.c create mode 100644 keyboards/hhkb/jp/config.h rename keyboards/hhkb/{ => jp}/hhkb_avr.h (98%) rename keyboards/hhkb/{ => jp}/info.json (53%) create mode 100644 keyboards/hhkb/jp/jp.c rename keyboards/hhkb/{hhkb.h => jp/jp.h} (57%) rename keyboards/hhkb/{ => jp}/keymaps/bakingpy/keymap.c (100%) rename keyboards/hhkb/{ => jp}/keymaps/bakingpy/rules.mk (100%) rename keyboards/hhkb/{keymaps/jp => jp/keymaps/default}/keymap.c (100%) rename keyboards/hhkb/{keymaps/halfqwerty_jp => jp/keymaps/default}/rules.mk (100%) rename keyboards/hhkb/{keymaps/jp_mac => jp/keymaps/default_mac}/keymap.c (100%) rename keyboards/hhkb/{keymaps/jp => jp/keymaps/default_mac}/rules.mk (100%) rename keyboards/hhkb/{keymaps/krusli => jp/keymaps/dhertz}/config.h (100%) rename keyboards/hhkb/{ => jp}/keymaps/dhertz/keymap.c (100%) rename keyboards/hhkb/{ => jp}/keymaps/dhertz/keymap.h (100%) rename keyboards/hhkb/{ => jp}/keymaps/dhertz/rules.mk (100%) rename keyboards/hhkb/{ => jp}/keymaps/enoch_jp/keymap.c (100%) rename keyboards/hhkb/{ => jp}/keymaps/enoch_jp/rules.mk (100%) rename keyboards/hhkb/{ => jp}/keymaps/halfqwerty_jp/README.md (100%) rename keyboards/hhkb/{ => jp}/keymaps/halfqwerty_jp/keymap.c (100%) rename keyboards/hhkb/{keymaps/jp_mac => jp/keymaps/halfqwerty_jp}/rules.mk (100%) rename keyboards/hhkb/{ => jp}/keymaps/rdg_jp/keymap.c (100%) rename keyboards/hhkb/{ => jp}/keymaps/rdg_jp/rules.mk (100%) rename keyboards/hhkb/{ => jp}/keymaps/sh_jp/README.md (100%) rename keyboards/hhkb/{ => jp}/keymaps/sh_jp/keymap.c (100%) rename keyboards/hhkb/{ => jp}/keymaps/sh_jp/rules.mk (100%) create mode 100644 keyboards/hhkb/jp/keymaps/via/config.h create mode 100644 keyboards/hhkb/jp/keymaps/via/keymap.c create mode 100644 keyboards/hhkb/jp/keymaps/via/rules.mk rename keyboards/hhkb/{ => jp}/matrix.c (99%) rename keyboards/hhkb/{ => jp}/readme.md (95%) create mode 100644 keyboards/hhkb/jp/rules.mk rename keyboards/{ => keyboardio}/model01/config.h (100%) rename keyboards/{ => keyboardio}/model01/info.json (98%) rename keyboards/{ => keyboardio}/model01/keymaps/default/config.h (100%) rename keyboards/{ => keyboardio}/model01/keymaps/default/keymap.c (100%) rename keyboards/{ => keyboardio}/model01/keymaps/default/readme.md (100%) rename keyboards/{ => keyboardio}/model01/keymaps/dshields/config.h (100%) rename keyboards/{ => keyboardio}/model01/keymaps/dshields/keymap.c (100%) rename keyboards/{ => keyboardio}/model01/keymaps/dshields/readme.md (100%) rename keyboards/{ => keyboardio}/model01/keymaps/tw1t611/config.h (100%) rename keyboards/{ => keyboardio}/model01/keymaps/tw1t611/keymap.c (100%) rename keyboards/{ => keyboardio}/model01/keymaps/tw1t611/readme.md (100%) rename keyboards/{ => keyboardio}/model01/leds.c (100%) rename keyboards/{ => keyboardio}/model01/leds.h (100%) rename keyboards/{ => keyboardio}/model01/matrix.c (100%) rename keyboards/{ => keyboardio}/model01/model01.c (100%) rename keyboards/{ => keyboardio}/model01/model01.h (100%) rename keyboards/{ => keyboardio}/model01/readme.md (84%) rename keyboards/{ => keyboardio}/model01/rules.mk (100%) rename keyboards/{ => keyboardio}/model01/wire-protocol-constants.h (100%) create mode 100644 keyboards/keyboardio/readme.md delete mode 100755 keyboards/lily58/i2c.c delete mode 100755 keyboards/lily58/i2c.h create mode 100644 keyboards/lily58/keymaps/chuan/config.h create mode 100644 keyboards/lily58/keymaps/chuan/keymap.c create mode 100644 keyboards/lily58/keymaps/chuan/rules.mk rename keyboards/lily58/lib/{glcdfont.c => glcdfont_lily.c} (99%) delete mode 100755 keyboards/lily58/rev1/split_scomm.c delete mode 100755 keyboards/lily58/rev1/split_scomm.h delete mode 100755 keyboards/lily58/rev1/split_util.h delete mode 100755 keyboards/lily58/serial.h delete mode 100644 keyboards/lily58/serial_config.h delete mode 100755 keyboards/lily58/ssd1306.c delete mode 100755 keyboards/lily58/ssd1306.h rename keyboards/{omnikey_blackheart => omnikey_bh}/config.h (100%) rename keyboards/{omnikey_blackheart => omnikey_bh}/info.json (99%) rename keyboards/{omnikey_blackheart => omnikey_bh}/keymaps/default/keymap.c (100%) create mode 100644 keyboards/omnikey_bh/omnikey_bh.c rename keyboards/{omnikey_blackheart/omnikey_blackheart.h => omnikey_bh/omnikey_bh.h} (96%) rename keyboards/{omnikey_blackheart => omnikey_bh}/readme.md (83%) rename keyboards/{omnikey_blackheart => omnikey_bh}/rules.mk (100%) delete mode 100644 keyboards/omnikey_blackheart/omnikey_blackheart.c delete mode 100644 keyboards/pancake/feather/readme.md delete mode 100644 keyboards/pancake/keymaps/default/readme.md delete mode 100644 keyboards/pancake/promicro/readme.md rename keyboards/{ => spaceman}/2_milk/2_milk.c (100%) rename keyboards/{ => spaceman}/2_milk/2_milk.h (100%) rename keyboards/{ => spaceman}/2_milk/config.h (97%) rename keyboards/{ => spaceman}/2_milk/info.json (84%) rename keyboards/{ => spaceman}/2_milk/keymaps/binary/keymap.c (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/binary/readme.md (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/copypasta/keymap.c (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/copypasta/readme.md (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/default/keymap.c (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/default/readme.md (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/emoji/config.h (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/emoji/keymap.c (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/emoji/readme.md (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/emoji/rules.mk (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/excessbread/keymap.c (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/excessbread/readme.md (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/mikethetiger/keymap.c (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/mikethetiger/readme.md (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/mikethetiger/rules.mk (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/mouse/keymap.c (100%) rename keyboards/{ => spaceman}/2_milk/keymaps/mouse/readme.md (100%) rename keyboards/{ => spaceman}/2_milk/readme.md (70%) rename keyboards/{ => spaceman}/2_milk/rules.mk (100%) rename keyboards/{ => spaceman}/pancake/config.h (100%) rename keyboards/{ => spaceman}/pancake/feather/config.h (100%) rename keyboards/{ => spaceman}/pancake/feather/rules.mk (100%) rename keyboards/{ => spaceman}/pancake/info.json (98%) rename keyboards/{ => spaceman}/pancake/keymaps/default/keymap.c (100%) create mode 100644 keyboards/spaceman/pancake/keymaps/default/readme.md rename keyboards/{ => spaceman}/pancake/pancake.c (100%) rename keyboards/{ => spaceman}/pancake/pancake.h (100%) rename keyboards/{ => spaceman}/pancake/promicro/config.h (100%) rename keyboards/{ => spaceman}/pancake/promicro/rules.mk (100%) rename keyboards/{ => spaceman}/pancake/readme.md (82%) delete mode 100644 keyboards/tkc1800/i2c.c delete mode 100644 keyboards/tkc1800/i2c.h delete mode 100644 keyboards/tkc1800/keymaps/default/config.h delete mode 100644 keyboards/tkc1800/keymaps/smt/config.h delete mode 100644 keyboards/tkc1800/keymaps/wkl/config.h delete mode 100644 keyboards/tkc1800/keymaps/yanfali/config.h delete mode 100644 keyboards/vision_division/keymaps/default/rules.mk rename keyboards/{z150_blackheart => z150_bh}/config.h (100%) rename keyboards/{z150_blackheart => z150_bh}/info.json (99%) rename keyboards/{z150_blackheart => z150_bh}/keymaps/default/keymap.c (100%) rename keyboards/{z150_blackheart => z150_bh}/keymaps/default_tkl/keymap.c (100%) rename keyboards/{z150_blackheart => z150_bh}/readme.md (86%) rename keyboards/{z150_blackheart => z150_bh}/rules.mk (100%) rename keyboards/{z150_blackheart/z150_blackheart.c => z150_bh/z150_bh.c} (95%) rename keyboards/{z150_blackheart/z150_blackheart.h => z150_bh/z150_bh.h} (100%) delete mode 100644 keyboards/zinc/i2c.c delete mode 100644 keyboards/zinc/i2c.h create mode 100644 keyboards/zinc/keymaps/default/readme_en.md delete mode 100644 keyboards/zinc/rev1/matrix.c delete mode 100644 keyboards/zinc/rev1/serial_config.h delete mode 100644 keyboards/zinc/rev1/serial_config_simpleapi.h delete mode 100644 keyboards/zinc/rev1/split_scomm.c delete mode 100644 keyboards/zinc/rev1/split_scomm.h delete mode 100644 keyboards/zinc/rev1/split_util.c delete mode 100644 keyboards/zinc/rev1/split_util.h delete mode 100644 keyboards/zinc/reva/matrix.c delete mode 100644 keyboards/zinc/reva/serial_config.h delete mode 100644 keyboards/zinc/reva/serial_config_simpleapi.h delete mode 100644 keyboards/zinc/reva/split_scomm.c delete mode 100644 keyboards/zinc/reva/split_scomm.h delete mode 100644 keyboards/zinc/reva/split_util.c delete mode 100644 keyboards/zinc/reva/split_util.h delete mode 100644 keyboards/zinc/serial.c delete mode 100644 keyboards/zinc/serial.h create mode 160000 lib/printf create mode 160000 lib/vusb delete mode 100644 tmk_core/common/chibios/printf.c delete mode 100644 tmk_core/common/chibios/printf.h delete mode 100644 tmk_core/protocol/vusb/usbdrv/Changelog.txt delete mode 100644 tmk_core/protocol/vusb/usbdrv/CommercialLicense.txt delete mode 100644 tmk_core/protocol/vusb/usbdrv/License.txt delete mode 100644 tmk_core/protocol/vusb/usbdrv/Readme.txt delete mode 100644 tmk_core/protocol/vusb/usbdrv/USB-ID-FAQ.txt delete mode 100644 tmk_core/protocol/vusb/usbdrv/USB-IDs-for-free.txt delete mode 100644 tmk_core/protocol/vusb/usbdrv/asmcommon.inc delete mode 100644 tmk_core/protocol/vusb/usbdrv/oddebug.c delete mode 100644 tmk_core/protocol/vusb/usbdrv/oddebug.h delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbconfig-prototype.h delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrv.c delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrv.h delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrvasm.S delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrvasm.asm delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrvasm128.inc delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrvasm16.inc delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrvasm165.inc delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrvasm18-crc.inc delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc delete mode 100644 tmk_core/protocol/vusb/usbdrv/usbportability.h diff --git a/.gitmodules b/.gitmodules index 6d8ab8b9463..324ef790d34 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,7 +12,13 @@ branch = master [submodule "lib/googletest"] path = lib/googletest - url = https://github.com/google/googletest + url = https://github.com/qmk/googletest [submodule "lib/lufa"] path = lib/lufa url = https://github.com/qmk/lufa +[submodule "lib/vusb"] + path = lib/vusb + url = https://github.com/qmk/v-usb +[submodule "lib/printf"] + path = lib/printf + url = https://github.com/qmk/printf diff --git a/Makefile b/Makefile index 0e57a72a0bd..c851e01e731 100644 --- a/Makefile +++ b/Makefile @@ -562,14 +562,16 @@ endef %: # Check if we have the CMP tool installed cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi; - # Ensure that python3 is installed. This check can be removed after python is used in more places. - if ! python3 --version 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; fi + # Ensure that bin/qmk works. This will be a failing check after the next develop merge on 2020 Aug 29. + if ! bin/qmk hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; fi # Check if the submodules are dirty, and display a warning if they are ifndef SKIP_GIT if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi if [ ! -e lib/chibios-contrib ]; then git submodule sync lib/chibios-contrib && git submodule update --depth 50 --init lib/chibios-contrib; fi if [ ! -e lib/ugfx ]; then git submodule sync lib/ugfx && git submodule update --depth 50 --init lib/ugfx; fi if [ ! -e lib/lufa ]; then git submodule sync lib/lufa && git submodule update --depth 50 --init lib/lufa; fi + if [ ! -e lib/vusb ]; then git submodule sync lib/vusb && git submodule update --depth 50 --init lib/vusb; fi + if [ ! -e lib/printf ]; then git submodule sync lib/printf && git submodule update --depth 50 --init lib/printf; fi git submodule status --recursive 2>/dev/null | \ while IFS= read -r x; do \ case "$$x" in \ diff --git a/docs/ChangeLog/20200530.md b/docs/ChangeLog/20200530.md new file mode 100644 index 00000000000..9def9ae1235 --- /dev/null +++ b/docs/ChangeLog/20200530.md @@ -0,0 +1,239 @@ +# QMK Breaking Change - 2020 May 30 Changelog + +Four 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. + +The list of changes follows. + + +## Core Changes + +### Converting V-USB usbdrv to a submodule + +[#8321](https://github.com/qmk/qmk_firmware/pull/8321) and [qmk_compiler#62](https://github.com/qmk/qmk_compiler/pull/62). + +These 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. + +### Unify Tap Hold functions and documentation + +[#8348](https://github.com/qmk/qmk_firmware/pull/8348) + +Updates all of the per key tap-hold functions to pass the `keyrecord_t` structure, and include documentation changes. + +Any remaining versions or code outside of the main repo will need to be converted: +| Old function | New Function | +|------------------------------------------------------|---------------------------------------------------------------------------| +|`uint16_t get_tapping_term(uint16_t keycode)` |`uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record)` | +|`bool get_ignore_mod_tap_interrupt(uint16_t keycode)` |`bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record)` | + +### Python Required In The Build Process + +[#9000](https://github.com/qmk/qmk_firmware/pull/9000) + +This 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. + +After the next breaking change you will not be able to build if `bin/qmk hello` does not work. + +### Upgrade from tinyprintf to mpaland/printf + +[#8269](https://github.com/qmk/qmk_firmware/pull/8269) + +- Provides debug functionality on ChibiOS/ARM that is more compliant than previous integrations. +- Less maintenence, fewer QMK customisations, and allows QMK to sidestep previous compile and runtime issues. +- A `make git-submodule` may be required after pulling the latest QMK Firmware code to update to the new dependency. + +### Fixed RGB_DISABLE_AFTER_TIMEOUT to be seconds based & small internals cleanup + +[#6480](https://github.com/qmk/qmk_firmware/pull/6480) + +- Changes `RGB_DISABLE_AFTER_TIMEOUT` to be based on milliseconds instead of ticks. +- Includes a code cleanup, resulting in a savings of 100 bytes, depending on features used. +- Fixed issues with timeouts / suspending at the wrong time not turning off all LEDs in some cases. + +The `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. + +Before: `#define RGB_DISABLE_AFTER_TIMEOUT 100` +After: `#define RGB_DISABLE_TIMEOUT 120000` + +### Switch to qmk forks for everything + +[#9019](https://github.com/qmk/qmk_firmware/pull/9019) + +Fork all QMK submodules to protect against upstream repositories disappearing. + +### code cleanup regarding deprecated macro PLAY_NOTE_ARRAY by replacing it with PLAY_SONG + +[#8484](https://github.com/qmk/qmk_firmware/pull/8484) + +Removes the deprecated `PLAY_NOTE_ARRAY` macro. References to it are replaced with `PLAY_SONG`, which references the same function. + +### fixing wrong configuration of AUDIO feature + +[#8903](https://github.com/qmk/qmk_firmware/pull/8903) and [#8974](https://github.com/qmk/qmk_firmware/pull/8974) + +`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. + +These changes fix this by disabling Audio on keyboards that have the feature misconfigured, and therefore non-functional. + +Also, add a compile-time error to alert the user to a missing pin-configuration (on AVR boards) when `AUDIO_ENABLE = yes` is set. + + +## Keyboard Refactors + +### Migrating Lily58 to use split_common + +[#6260](https://github.com/qmk/qmk_firmware/pull/6260) + +Modifies 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: + +- SSD1306 display +- i2c for OLED +- Serial Communication + +This allows current lily58 firmware to advance with updates to the `split_common` library, which is shared with many other split keyboards. + +#### To migrate existing Lily58 firmware: + +[Changes to `config.h`](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-445ac369c8717dcd6fc6fc3630836fc1): +- Remove `#define SSD1306OLED` from config.h + + +[Changes to `keymap.c`](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-20943ea59856e9bdf3d99ecb2eee40b7): +- Find/Replace each instance of `#ifdef SSD1306OLED` with `#ifdef OLED_DRIVER_ENABLE` +- 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) +- 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)) +- [Remove](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-20943ea59856e9bdf3d99ecb2eee40b7L138-L141) the block +```c +#ifdef SSD1306OLED + iota_gfx_init(!has_usb()); // turns on the display +#endif +``` +- 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: +```c +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (!is_keyboard_master()) + return OLED_ROTATION_180; // flips the display 180 degrees if offhand + return rotation; +} +``` +- Remove the functions `matrix_scan_user`, `matrix_update` and `iota_gfx_task_user` +- Find/Replace `matrix_render_user(struct CharacterMatrix *matrix)` with `iota_gfx_task_user(void)` +- Find/Replace `is_master` with `is_keyboard_master()` +- For each instance of `matrix_write_ln(matrix, display_fn())`, rewrite it as `oled_write_ln(read_layer_state(), false);` +- For each instance of `matrix_write(matrix, read_logo());`, replace with `oled_write(read_logo(), false);` + +### Refactor zinc to use split_common + +[#7114](https://github.com/qmk/qmk_firmware/pull/7114) and [#9171](https://github.com/qmk/qmk_firmware/pull/9171) + +* Refactor to use split_common and remove split codes under the zinc/revx/ +* Add - backlight RGB LED and/or underglow RGB LED option +* Add - continuous RGB animations feature (between L and R halves) +* Fix - keymap files to adapt to changes + * all authors of keymaps confirmed this PR +* Update - documents and rules.mk + +### Refactor of TKC1800 to use common OLED code + +[#8472](https://github.com/qmk/qmk_firmware/pull/8472) + +Modifies 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: + +- SSD1306 display +- i2c for OLED + +This allows current TKC1800 firmware to advance with updates to those drivers, which are shared with other keyboards. + +#### To migrate existing TKC1800 firmware: + +[Changes to `config.h`](https://github.com/qmk/qmk_firmware/pull/8472/files#diff-d10b26e676b4a55cbb00d71955116526): +- Remove `#define SSD1306OLED` from config.h + +[Changes to `tkc1800.c`](https://github.com/qmk/qmk_firmware/pull/8472/files#diff-3b35bd30abe89c8110717c6972cd2cc5): +- Add the following to avoid debug errors on HID_listen if the screen is not present +```c +void keyboard_pre_init_kb(void) { + setPinInputHigh(D0); + setPinInputHigh(D1); + + keyboard_pre_init_user(); +} +``` + +[Changes to `keymap.c`](https://github.com/qmk/qmk_firmware/pull/8472/files#diff-05a2a344ce27e4d045fe68520ccd4771): +- Find/Replace each instance of `#ifdef SSD1306OLED` with `#ifdef OLED_DRIVER_ENABLE` +- 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) +- [Remove](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-20943ea59856e9bdf3d99ecb2eee40b7L91-L158) the block +```c +#ifdef SSD1306OLED + iota_gfx_init(!has_usb()); // turns on the display +#endif +``` +- 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: +```c +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (!is_keyboard_master()) + return OLED_ROTATION_180; // flips the display 180 degrees if offhand + return rotation; +} +``` +- Remove the function `iota_gfx_task_user` + +### Split HHKB to ANSI and JP layouts and Add VIA support for each + +[#8582](https://github.com/qmk/qmk_firmware/pull/8582) + +- Splits the HHKB codebase into two separate folders `keyboards/hhkb/ansi` and `keyboards/hhkb/jp`. +- Adds VIA Configurator support for both versions. + +#### Migrating existing HHKB keymaps + +- Remove any checks for the `HHKB_JP` definition + - All checks for this definition have been removed, and each version uses the source that is appropriate to that version. +- Move the directory for your keymap into the appropriate `keymaps` directory + - `keyboards/hhkb/ansi/keymaps/` for ANSI HHKBs + - `keyboards/hhkb/jp/keymaps/` for HHKB JPs +- Compile with the new keyboard names + - This PR changes the compilation instructions for the HHKB Alternate Controller. To compile firmware for this controller moving forward, use: + - `make hhkb/ansi` for ANSI-layout HHKBs + - `make hhkb/jp` for HHKB JP keyboards + + +## Keyboard Moves + +- [#8412](https://github.com/qmk/qmk_firmware/pull/8412 "Changing board names to prevent confusion") by blindassassin111 +- [#8499](https://github.com/qmk/qmk_firmware/pull/8499 "Move the Keyboardio Model01 to a keyboardio/ subdir") by algernon +- [#8830](https://github.com/qmk/qmk_firmware/pull/8830 "Move spaceman keyboards") by Spaceman (formerly known as Rionlion100) +- [#8537](https://github.com/qmk/qmk_firmware/pull/8537 "Organizing my keyboards (plaid, tartan, ergoinu)") by hsgw + +Keyboards by Keyboardio, Spaceman, and hsgw move to vendor folders, while PCBs designed by blindassassin111 are renamed. + +Old Name | New Name +:----------------- | :----------------- +2_milk | spaceman/2_milk +at101_blackheart | at101_bh +ergoinu | dm9records/ergoinu +model01 | keyboardio/model01 +omnikey_blackheart | omnikey_bh +pancake | spaceman/pancake +plaid | dm9records/plaid +tartan | dm9records/tartan +z150_blackheart | z150_bh + +If you own one of these PCBs, please use the new names to compile your firmware moving forward. + + +## Keycode Migration PRs + +[#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") + +Authored by fauxpark, these pull requests remove references to deprecated TMK macros that have been superseded by native QMK keycodes. + +Old `fn_actions` action | New QMK keycode +:---------------------- | :-------------- +`ACTION_DEFAULT_LAYER_SET(layer)` | `DF(layer)` +`ACTION_LAYER_MODS(layer, mod)` | `LM(layer, mod)` +`ACTION_LAYER_ONESHOT(mod)` | `OSL(mod)` +`ACTION_LAYER_TOGGLE(layer)` | `TG(layer)` +`ACTION_MODS_ONESHOT(mod)` | `OSM(mod)` +`ACTION_MODS_TAP_KEY(mod, kc)` | `MT(mod, kc)` +`ACTION_MODS_KEY(mod, kc)`
e.g. `ACTION_MODS_KEY(MOD_LCTL, KC_0)` | `MOD(kc)`
e.g. `LCTL(KC_0)` diff --git a/docs/_summary.md b/docs/_summary.md index b3553b42850..1b6ddc67ca8 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -115,6 +115,7 @@ * [Overview](breaking_changes.md) * [My Pull Request Was Flagged](breaking_changes_instructions.md) * History + * [2020 May 30](ChangeLog/20200530.md) * [2020 Feb 29](ChangeLog/20200229.md) * [2019 Aug 30](ChangeLog/20190830.md) diff --git a/docs/breaking_changes.md b/docs/breaking_changes.md index 6c684970d82..154695ddacb 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 ## What has been included in past Breaking Changes? +* [2020 May 30](ChangeLog/20200530.md) * [2020 Feb 29](ChangeLog/20200229.md) * [2019 Aug 30](ChangeLog/20190830.md) ## When is the next Breaking Change? -The next Breaking Change is scheduled for May 30, 2020. +The next Breaking Change is scheduled for Aug 29, 2020. ### Important Dates -* [x] 2020 Feb 29 - `future` is created. It will be rebased weekly. -* [ ] 2020 May 2 - `future` closed to new PR's. -* [ ] 2020 May 2 - Call for testers. -* [ ] 2020 May 28 - `master` is locked, no PR's merged. -* [ ] 2020 May 30 - Merge `future` to `master`. -* [ ] 2020 May 30 - `master` is unlocked. PR's can be merged again. +* [x] 2020 May 30 - `develop` is created. It will be rebased weekly. +* [ ] 2020 Aug 1 - `develop` closed to new PR's. +* [ ] 2020 Aug 1 - Call for testers. +* [ ] 2020 Aug 27 - `master` is locked, no PR's merged. +* [ ] 2020 Aug 29 - Merge `develop` to `master`. +* [ ] 2020 Aug 29 - `master` is unlocked. PR's can be merged again. ## What changes will be included? -To 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. +To 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. -If 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. +If 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. Criteria for acceptance: @@ -37,9 +38,9 @@ Criteria for acceptance: This section documents various processes we use when running the Breaking Changes process. -## Rebase `future` from `master` +## Rebase `develop` from `master` -This is run every Friday while `future` is open. +This is run every Friday while `develop` is open. Process: @@ -47,31 +48,31 @@ Process: cd qmk_firmware git checkout master git pull --ff-only -git checkout future +git checkout develop git rebase master git push --force ``` -## Creating the `future` branch +## Creating the `develop` branch -This happens immediately after the previous `future` branch is merged. +This happens immediately after the previous `develop` branch is merged. * `qmk_firmware` git commands * [ ] `git checkout master` * [ ] `git pull --ff-only` - * [ ] `git checkout -b future` + * [ ] `git checkout -b develop` * [ ] Edit `readme.md` * [ ] Add a big notice at the top that this is a testing branch. * [ ] Include a link to this document * [ ] `git commit -m 'Branch point for Breaking Change'` * [ ] `git tag breakpoint___
` * [ ] `git tag ` # Prevent the breakpoint tag from confusing version incrementing - * [ ] `git push origin future` + * [ ] `git push origin develop` * [ ] `git push --tags` ## 4 Weeks Before Merge -* `future` is now closed to new PR's, only fixes for current PR's may be merged +* `develop` is now closed to new PR's, only fixes for current PR's may be merged * Post call for testers * [ ] Discord * [ ] GitHub PR @@ -94,15 +95,15 @@ This happens immediately after the previous `future` branch is merged. ## Day Of Merge * `qmk_firmware` git commands - * [ ] `git checkout future` + * [ ] `git checkout develop` * [ ] `git pull --ff-only` * [ ] `git rebase origin/master` * [ ] Edit `readme.md` - * [ ] Remove the notes about `future` + * [ ] Remove the notes about `develop` * [ ] Roll up the ChangeLog into one file. * [ ] `git commit -m 'Merge point for Breaking Change'` - * [ ] `git push origin future` + * [ ] `git push origin develop` * GitHub Actions - * [ ] Create a PR for `future` + * [ ] Create a PR for `develop` * [ ] Make sure travis comes back clean - * [ ] Merge `future` PR + * [ ] Merge `develop` PR diff --git a/docs/breaking_changes_instructions.md b/docs/breaking_changes_instructions.md index 3f2f93834f6..d835671556d 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 We 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 – [each section here started as a changelog](ChangeLog/20190830.md "n.b. This should link to the 2019 Aug 30 Breaking Changes doc - @noroadsleft"). -Your changelog should be located at `docs/ChangeLog/YYYYMMDD/PR####.md`, where `YYYYMMDD` is the date on which QMK's breaking change branch – usually named `future` – will be merged into the `master` branch, and `####` is the number of your pull request. +Your changelog should be located at `docs/ChangeLog/YYYYMMDD/PR####.md`, where `YYYYMMDD` is the date on which QMK's breaking change branch – usually named `develop` – will be merged into the `master` branch, and `####` is the number of your pull request. If 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. diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md index 84ae589ed6c..6eb144af76b 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) { case KC_ENTER: // Play a tone when enter is pressed if (record->event.pressed) { - PLAY_NOTE_ARRAY(tone_qwerty); + PLAY_SONG(tone_qwerty); } return true; // Let QMK send the enter press/release events default: @@ -438,7 +438,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_ENTER: // Play a tone when enter is pressed if (record->event.pressed) { - PLAY_NOTE_ARRAY(tone_qwerty); + PLAY_SONG(tone_qwerty); } return true; // Let QMK send the enter press/release events 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 * Keymap: `void eeconfig_init_user(void)`, `uint32_t eeconfig_read_user(void)` and `void eeconfig_update_user(uint32_t val)` The `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. - -# Custom Tapping Term - -By 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. - -There are two configurable options to control per-key timeout behaviors: - -- `TAPPING_TERM_PER_KEY` -- `IGNORE_MOD_TAP_INTERRUPT_PER_KEY` - -You need to add `#define` lines to your `config.h` for each feature you want. - -``` -#define TAPPING_TERM_PER_KEY -#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY -``` - - -## Example `get_tapping_term` Implementation - -To change the `TAPPING_TERM` based on the keycode, you'd want to add something like the following to your `keymap.c` file: - -```c -uint16_t get_tapping_term(uint16_t keycode) { - switch (keycode) { - case SFT_T(KC_SPC): - return TAPPING_TERM + 1250; - case LT(1, KC_GRV): - return 130; - default: - return TAPPING_TERM; - } -} -``` - -## Example `get_ignore_mod_tap_interrupt` Implementation - -To 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: - -```c -bool get_ignore_mod_tap_interrupt(uint16_t keycode) { - switch (keycode) { - case SFT_T(KC_SPC): - return true; - default: - return false; - } -} -``` - -## `get_tapping_term` / `get_ignore_mod_tap_interrupt` Function Documentation - -Unlike 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 15057827c84..a4f434cbd92 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 ```c #define RGB_MATRIX_KEYPRESSES // reacts to keypresses #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) -#define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects +#define RGB_DISABLE_TIMEOUT 0 // number of milliseconds to wait until rgb automatically turns off +#define RGB_DISABLE_AFTER_TIMEOUT 0 // OBSOLETE: number of ticks to wait until disabling effects #define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended #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) #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 7e4fbd897ee..1524717c8e3 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) { case KC_ENTER: // enter が押された時に音を再生します if (record->event.pressed) { - PLAY_NOTE_ARRAY(tone_qwerty); + PLAY_SONG(tone_qwerty); } return true; // QMK に enter のプレスまたはリリースイベントを送信させます default: @@ -440,7 +440,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_ENTER: // enter が押された時に音を再生します if (record->event.pressed) { - PLAY_NOTE_ARRAY(tone_qwerty); + PLAY_SONG(tone_qwerty); } return true; // QMK に enter のプレスまたはリリースイベントを送信させます case RGB_LYR: // これにより、アンダーグローをレイヤー表示として、あるいは通常通りに使うことができます。 @@ -511,7 +511,7 @@ void eeconfig_init_user(void) { // EEPROM がリセットされます! キーコードに基づいて `TAPPING_TERM` を変更するには、次のようなものを `keymap.c` ファイルに追加します: ```c -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case SFT_T(KC_SPC): return TAPPING_TERM + 1250; @@ -528,7 +528,7 @@ uint16_t get_tapping_term(uint16_t keycode) { キーコードに基づいて `IGNORE_MOD_TAP_INTERRUPT` の値を変更するには、次のようなものを `keymap.c` ファイルに追加します: ```c -bool get_ignore_mod_tap_interrupt(uint16_t keycode) { +bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case SFT_T(KC_SPC): return true; diff --git a/docs/tap_hold.md b/docs/tap_hold.md index a0b648694b9..2dc57f03c2d 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 These options let you modify the behavior of the Tap-Hold keys. +## Tapping Term + +The 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. + +You can set the global time for this by adding the following setting to your `config.h`: + +```c +#define TAPPING_TERM 200 +``` + +This setting is defined in milliseconds, and does default to 200ms. This is a good average for a majority of people. + +For more granular control of this feature, you can add the following to your `config.h`: +```c +#define TAPPING_TERM_PER_KEY +``` + +You can then add the following function to your keymap: + +```c +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case SFT_T(KC_SPC): + return TAPPING_TERM + 1250; + case LT(1, KC_GRV): + return 130; + default: + return TAPPING_TERM; +} +``` + + ## Permissive Hold As 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 ?> 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`. +For more granular control of this feature, you can add the following to your `config.h`: + +```c +#define PERMISSIVE_HOLD_PER_KEY +``` + +You can then add the following function to your keymap: + +```c +bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LT(1, KC_BSPC): + return true; + default: + return false; + } +} +``` + ## Ignore Mod Tap Interrupt To 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 You can then add the following function to your keymap: ```c -bool get_ignore_mod_tap_interrupt(uint16_t keycode) { - switch (keycode) { - case SFT_T(KC_SPC): - return true; - default: - return false; - } +bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case SFT_T(KC_SPC): + return true; + default: + return false; + } } ``` @@ -106,12 +157,12 @@ You can then add the following function to your keymap: ```c bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LT(1, KC_BSPC): - return true; - default: - return false; - } + switch (keycode) { + case LT(1, KC_BSPC): + return true; + default: + return false; + } } ``` @@ -126,3 +177,13 @@ To enable `retro tapping`, add the following to your `config.h`: Holding 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. For 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. + +## Why do we include the key record for the per key functions? + +One 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. + +Well, 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. + +## Why is there no `*_kb` or `*_user` functions?! + +Unlike 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 f2c6098dcb7..95b2084dbf4 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) { case KC_ENTER: // 当按下回车时播放音符 if (record->event.pressed) { - PLAY_NOTE_ARRAY(tone_qwerty); + PLAY_SONG(tone_qwerty); } return true; // 让QMK触发回车按下/释放事件 default: @@ -413,7 +413,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_ENTER: // 在按下回车时播放音符 if (record->event.pressed) { - PLAY_NOTE_ARRAY(tone_qwerty); + PLAY_SONG(tone_qwerty); } return true; // 让QMK产生回车按下/释放事件 case RGB_LYR: // 本句让underglow作为层指示,或正常使用。 @@ -473,7 +473,7 @@ void eeconfig_init_user(void) { // EEPROM正被重置 想要修改基于键码的`TAPPING TERM`,你要向`keymap.c`文件添加如下代码: ```c -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case SFT_T(KC_SPC): 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 00000000000..3b519373b07 --- /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 similarity index 96% rename from keyboards/at101_blackheart/at101_blackheart.h rename to keyboards/at101_bh/at101_bh.h index 24ac1b7c541..54655cf60e8 100644 --- a/keyboards/at101_blackheart/at101_blackheart.h +++ b/keyboards/at101_bh/at101_bh.h @@ -1,5 +1,4 @@ -#ifndef at101_blackheart_H -#define at101_blackheart_H +#pragma once #include "quantum.h" @@ -24,5 +23,3 @@ { K1000, K1001, KC_NO, KC_NO, KC_NO, K1005, K1006, K1007, K1008, K1009 }, \ { K1100, K1101, K1102, KC_NO, KC_NO, K1105, K1106, K1107, K1108, KC_NO } \ } - -#endif diff --git a/keyboards/at101_blackheart/config.h b/keyboards/at101_bh/config.h similarity index 95% rename from keyboards/at101_blackheart/config.h rename to keyboards/at101_bh/config.h index 83814c6486c..6928118b796 100644 --- a/keyboards/at101_blackheart/config.h +++ b/keyboards/at101_bh/config.h @@ -7,7 +7,7 @@ #define PRODUCT_ID 0x6060 #define DEVICE_VER 0x0001 #define MANUFACTURER blindassassin111 -#define PRODUCT AT101_Blackheart PCB +#define PRODUCT AT101_BH PCB #define DESCRIPTION Replacement AT101 PCB /* key matrix size */ diff --git a/keyboards/at101_blackheart/info.json b/keyboards/at101_bh/info.json similarity index 98% rename from keyboards/at101_blackheart/info.json rename to keyboards/at101_bh/info.json index 4bef46712d1..1d28dc230bd 100644 --- a/keyboards/at101_blackheart/info.json +++ b/keyboards/at101_bh/info.json @@ -1,6 +1,6 @@ { - "keyboard_name": "AT101 Blackheart PCB", - "keyboard_folder": "at101_blackheart", + "keyboard_name": "AT101 BH PCB", + "keyboard_folder": "at101_bh", "url": "https://deskthority.net/group-buys-f50/programmable-vintage-board-pcbs-omnikey-at101-and-z-150-t19325.html", "maintainer": "qmk, blindassassin111", "width": 22.5, diff --git a/keyboards/at101_blackheart/keymaps/default/keymap.c b/keyboards/at101_bh/keymaps/default/keymap.c similarity index 100% rename from keyboards/at101_blackheart/keymaps/default/keymap.c rename to keyboards/at101_bh/keymaps/default/keymap.c diff --git a/keyboards/at101_blackheart/readme.md b/keyboards/at101_bh/readme.md similarity index 77% rename from keyboards/at101_blackheart/readme.md rename to keyboards/at101_bh/readme.md index d435d6955aa..8a9ce2496ff 100644 --- a/keyboards/at101_blackheart/readme.md +++ b/keyboards/at101_bh/readme.md @@ -1,15 +1,15 @@ -# AT101 Blackheart PCB +# AT101 BH PCB -![AT101 Blackheart PCB](https://deskthority.net/resources/image/48571) +![AT101 BH PCB](https://deskthority.net/resources/image/48571) A replacement PCB for AT101 keyboards. Keyboard Maintainer: QMK Community and blindassassin111 -Hardware Supported: AT101 blackheart PCB +Hardware Supported: AT101 BH PCB Hardware Availability: https://deskthority.net/group-buys-f50/programmable-vintage-board-pcbs-omnikey-at101-and-z-150-t19325.html Make example for this keyboard (after setting up your build environment): - make at101_blackheart:default + make at101_bh:default See 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 similarity index 100% rename from keyboards/at101_blackheart/rules.mk rename to 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 aa07a786436..00000000000 --- a/keyboards/at101_blackheart/at101_blackheart.c +++ /dev/null @@ -1 +0,0 @@ -#include "at101_blackheart.h" diff --git a/keyboards/atomic/keymaps/pvc/keymap.c b/keyboards/atomic/keymaps/pvc/keymap.c index 33b3a9d824b..361d702c5bc 100644 --- a/keyboards/atomic/keymaps/pvc/keymap.c +++ b/keyboards/atomic/keymaps/pvc/keymap.c @@ -102,7 +102,7 @@ enum keyboard_macros { #define SC_CCLS LCTL(KC_F4) #define TG_NKRO MAGIC_TOGGLE_NKRO -#define OS_SHFT KC_FN0 +#define OS_SHFT OSM(MOD_LSFT) #define ________________ _______, _______ #define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX @@ -258,10 +258,6 @@ void persistent_default_layer_set(uint16_t default_layer) { default_layer_set(default_layer); } -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_MODS_ONESHOT(MOD_LSFT), -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function diff --git a/keyboards/atreus62/keymaps/atreus52/keymap.c b/keyboards/atreus62/keymaps/atreus52/keymap.c index c7dcb67653c..31a01ccd879 100644 --- a/keyboards/atreus62/keymaps/atreus52/keymap.c +++ b/keyboards/atreus62/keymaps/atreus52/keymap.c @@ -10,6 +10,8 @@ #define KC_RAIS MO(RAISE) #define KC_LOWR MO(LOWER) +#define KC_TGBD TG(BDO) +#define KC_TGRS TG(RESETL) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [DVORAK] = LAYOUT_kc( @@ -17,7 +19,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { NO, QUOT, COMM, DOT, P, Y, F, G, C, R, L, NO, \ NO, A, O, E, U, I, D, H, T, N, S, NO, \ NO, SCLN, Q, J, K, X, B, M, W, V, Z, NO, \ - NO, FN2, LALT, LCTL, LOWR, LSFT, BSPC, ENT, SPC, RAIS, LGUI, LEFT, RGHT, NO + NO, TGBD, LALT, LCTL, LOWR, LSFT, BSPC, ENT, SPC, RAIS, LGUI, LEFT, RGHT, NO ), [QWERTY] = LAYOUT_kc( @@ -25,7 +27,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { NO, Q, W, E, R, T, Y, U, I, O, P, NO, \ NO, A, S, D, F, G, H, J, K, L, SCLN, NO, \ NO, Z, X, C, V, B, N, M, COMM, DOT, SLSH, NO, \ - NO, FN2, LALT, LCTL, LOWR, LSFT, BSPC, ENT, SPC, RAIS, LGUI, LEFT, RGHT, NO + NO, TGBD, LALT, LCTL, LOWR, LSFT, BSPC, ENT, SPC, RAIS, LGUI, LEFT, RGHT, NO ), [RAISE] = LAYOUT_kc( @@ -33,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { NO, TILD, GRV, LCBR, RCBR, DQUO, QUOT, EQL, PLUS, MINS, QUES, NO, \ NO, ESC, TAB, LPRN, RPRN, BSLS, SLSH, LEFT, DOWN, UP, RGHT, NO, \ NO, TRNS, TRNS, LBRC, RBRC, TRNS, INS, PIPE, UNDS, TRNS, TRNS, NO, \ - NO, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN3, NO + NO, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TGRS, NO ), [LOWER] = LAYOUT_kc( @@ -49,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { NO, TAB, Q, W, E, R, 6, Y, I, O, P, NO, \ NO, LSFT, A, S, D, F, 7, G, H, J, K, NO, \ NO, T, Z, X, C, V, 8, B, N, M, L, NO, \ - NO, LCTL, SPC, SPC, SPC, SPC, COMM, ENT, 9, NO, NO, NO, FN2, NO + NO, LCTL, SPC, SPC, SPC, SPC, COMM, ENT, 9, NO, NO, NO, TGBD, NO ), [RESETL] = LAYOUT( @@ -57,15 +59,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_FN3,KC_NO + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, TG(RESETL),KC_NO ) }; -const uint16_t PROGMEM fn_actions[] = { - [2] = ACTION_LAYER_TOGGLE(BDO), // BDO layer - [3] = ACTION_LAYER_TOGGLE(RESETL) // RESET layer -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function switch (id) { diff --git a/keyboards/bpiphany/pegasushoof/keymaps/blowrak/keymap.c b/keyboards/bpiphany/pegasushoof/keymaps/blowrak/keymap.c index aad2d643cd9..f9234a7b2f9 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] = { 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, \ 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, \ 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, \ - MO(KM_MEDIA),KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_FN1, KC_LEFT,KC_DOWN,KC_RGHT), + MO(KM_MEDIA),KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,TG(KM_QWERTY), KC_LEFT,KC_DOWN,KC_RGHT), /* Layer 1: Standard ISO layer */ [KM_QWERTY] = LAYOUT( \ 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] = { 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, \ 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, \ 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, \ - MO(KM_MEDIA),KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_FN1, KC_LEFT,KC_DOWN,KC_RGHT), + MO(KM_MEDIA),KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,TG(KM_QWERTY), KC_LEFT,KC_DOWN,KC_RGHT), /* Layer 2: Media layer */ [KM_MEDIA] = LAYOUT( \ _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_WAKE,KC_PWR, KC_SLEP, \ @@ -75,10 +75,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______), }; -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_TOGGLE(KM_QWERTY) -}; - void matrix_scan_user(void) { uint8_t layer = biton32(layer_state); diff --git a/keyboards/ckeys/handwire_101/config.h b/keyboards/ckeys/handwire_101/config.h index 3dc99319ed0..849f4f6077d 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 . //#define MAGIC_KEY_SLEEP_LED Z // Audio Click -#define AUDIO_CLICKY +//#define AUDIO_CLICKY // Music Mode Polyphony // NOTE: Must change polyphony_rate to a number higher than 0 in voices.c -#define AUDIO_VOICES -#define PITCH_STANDARD_A 880.0f +//#define AUDIO_VOICES +//#define PITCH_STANDARD_A 880.0f // Mouse keys #define MOUSEKEY_DELAY 0 diff --git a/keyboards/ckeys/handwire_101/rules.mk b/keyboards/ckeys/handwire_101/rules.mk index 41a29b35373..83d55e0f706 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 #MIDI_ENABLE = yes # MIDI controls UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = no # Audio output FAUXCLICKY_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 0fa1d9d9891..0d94eb46c92 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) { bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { +#ifdef AUDIO_ENABLE case SONG_SU: if (record->event.pressed) { PLAY_SONG(tone_startup); @@ -58,7 +59,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; - +#endif default: return true; } diff --git a/keyboards/clueboard/card/keymaps/default/rules.mk b/keyboards/clueboard/card/keymaps/default/rules.mk index 998bb5e0eb1..82ee482bed1 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 NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = no # Audio output UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_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 c472f78b7de..716ff19abdd 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] = { // clang-format on // Configure ignore mod tap interrupt per key -bool get_ignore_mod_tap_interrupt(uint16_t keycode) { +bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { switch (keycode) { // I don't like how mod tap interrupt feels with these keys specifically when I'm typing 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 7e399081951..ce4876536f8 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] = { GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, CAPS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS, INS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, TILD, TRNS,APP, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS ), }; -const action_t PROGMEM fn_actions[] = { - [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde -}; - #endif diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c index 55d51eb08ac..0769edf3b94 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) { oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } #endif -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case ALT_T(KC_A): return TAPPING_TERM + 100; diff --git a/keyboards/cu75/cu75.c b/keyboards/cu75/cu75.c index 6dc28984545..60c92b708a6 100644 --- a/keyboards/cu75/cu75.c +++ b/keyboards/cu75/cu75.c @@ -26,7 +26,7 @@ void matrix_init_kb(void) #ifdef AUDIO_ENABLE audio_init(); - PLAY_NOTE_ARRAY(test_sound, false, STACCATO); + PLAY_SONG(test_sound); // Fix port B5 cbi(DDRB, 5); sbi(PORTB, 5); diff --git a/keyboards/ergoinu/config.h b/keyboards/dm9records/ergoinu/config.h similarity index 100% rename from keyboards/ergoinu/config.h rename to keyboards/dm9records/ergoinu/config.h diff --git a/keyboards/ergoinu/ergoinu.c b/keyboards/dm9records/ergoinu/ergoinu.c similarity index 100% rename from keyboards/ergoinu/ergoinu.c rename to keyboards/dm9records/ergoinu/ergoinu.c diff --git a/keyboards/ergoinu/ergoinu.h b/keyboards/dm9records/ergoinu/ergoinu.h similarity index 100% rename from keyboards/ergoinu/ergoinu.h rename to keyboards/dm9records/ergoinu/ergoinu.h diff --git a/keyboards/ergoinu/info.json b/keyboards/dm9records/ergoinu/info.json similarity index 98% rename from keyboards/ergoinu/info.json rename to keyboards/dm9records/ergoinu/info.json index 81f53fd2557..3627049a5ed 100644 --- a/keyboards/ergoinu/info.json +++ b/keyboards/dm9records/ergoinu/info.json @@ -1,7 +1,7 @@ { "keyboard_name": "Ergoinu", "url": "", - "maintainer": "hsgw", + "maintainer": "hsgw(Takuya Urakawa)", "width": 18, "height": 5.4, "layouts": { diff --git a/keyboards/ergoinu/keymaps/default/config.h b/keyboards/dm9records/ergoinu/keymaps/default/config.h similarity index 100% rename from keyboards/ergoinu/keymaps/default/config.h rename to keyboards/dm9records/ergoinu/keymaps/default/config.h diff --git a/keyboards/ergoinu/keymaps/default/keymap.c b/keyboards/dm9records/ergoinu/keymaps/default/keymap.c similarity index 100% rename from keyboards/ergoinu/keymaps/default/keymap.c rename to keyboards/dm9records/ergoinu/keymaps/default/keymap.c diff --git a/keyboards/ergoinu/keymaps/default/rules.mk b/keyboards/dm9records/ergoinu/keymaps/default/rules.mk similarity index 100% rename from keyboards/ergoinu/keymaps/default/rules.mk rename to 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 similarity index 100% rename from keyboards/ergoinu/keymaps/default_jis/config.h rename to 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 similarity index 100% rename from keyboards/ergoinu/keymaps/default_jis/keymap.c rename to 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 similarity index 100% rename from keyboards/ergoinu/keymaps/default_jis/rules.mk rename to keyboards/dm9records/ergoinu/keymaps/default_jis/rules.mk diff --git a/keyboards/ergoinu/matrix.c b/keyboards/dm9records/ergoinu/matrix.c similarity index 100% rename from keyboards/ergoinu/matrix.c rename to keyboards/dm9records/ergoinu/matrix.c diff --git a/keyboards/ergoinu/readme.md b/keyboards/dm9records/ergoinu/readme.md similarity index 89% rename from keyboards/ergoinu/readme.md rename to keyboards/dm9records/ergoinu/readme.md index 06e0cf352eb..de0a1c6c970 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 Make example for this keyboard (after setting up your build environment): - make ergoinu:default + make dm9records/ergoinu:default (or) - make ergoinu:default_jis + make dm9records/ergoinu:default_jis See [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 similarity index 95% rename from keyboards/ergoinu/rules.mk rename to keyboards/dm9records/ergoinu/rules.mk index 6f5debe00c3..493046ffa4d 100644 --- a/keyboards/ergoinu/rules.mk +++ b/keyboards/dm9records/ergoinu/rules.mk @@ -26,7 +26,7 @@ MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. SUBPROJECT_rev1 = no USE_I2C = no # i2c is not supported # 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 CUSTOM_MATRIX = yes SRC += matrix.c serial.c split_util.c -DEFAULT_FOLDER = ergoinu - # ergoinu configs DISABLE_PROMICRO_LEDs = yes diff --git a/keyboards/ergoinu/serial.c b/keyboards/dm9records/ergoinu/serial.c similarity index 100% rename from keyboards/ergoinu/serial.c rename to keyboards/dm9records/ergoinu/serial.c diff --git a/keyboards/ergoinu/serial.h b/keyboards/dm9records/ergoinu/serial.h similarity index 100% rename from keyboards/ergoinu/serial.h rename to keyboards/dm9records/ergoinu/serial.h diff --git a/keyboards/ergoinu/serial_config.h b/keyboards/dm9records/ergoinu/serial_config.h similarity index 100% rename from keyboards/ergoinu/serial_config.h rename to keyboards/dm9records/ergoinu/serial_config.h diff --git a/keyboards/ergoinu/split_util.c b/keyboards/dm9records/ergoinu/split_util.c similarity index 100% rename from keyboards/ergoinu/split_util.c rename to keyboards/dm9records/ergoinu/split_util.c diff --git a/keyboards/ergoinu/split_util.h b/keyboards/dm9records/ergoinu/split_util.h similarity index 100% rename from keyboards/ergoinu/split_util.h rename to keyboards/dm9records/ergoinu/split_util.h diff --git a/keyboards/plaid/config.h b/keyboards/dm9records/plaid/config.h similarity index 100% rename from keyboards/plaid/config.h rename to keyboards/dm9records/plaid/config.h diff --git a/keyboards/plaid/info.json b/keyboards/dm9records/plaid/info.json similarity index 97% rename from keyboards/plaid/info.json rename to keyboards/dm9records/plaid/info.json index 13bd05c149e..318154d7de1 100644 --- a/keyboards/plaid/info.json +++ b/keyboards/dm9records/plaid/info.json @@ -1,8 +1,8 @@ { "keyboard_name": "Plaid // Through Hole", - "keyboard_folder": "planid", + "keyboard_folder": "dm9records/plaid", "url": "https://github.com/hsgw/plaid", - "maintainer": "hsgw", + "maintainer": "hsgw(Takuya Urakawa)", "width": 12, "height": 4, "layouts": { diff --git a/keyboards/plaid/keymaps/brickbots/config.h b/keyboards/dm9records/plaid/keymaps/brickbots/config.h similarity index 100% rename from keyboards/plaid/keymaps/brickbots/config.h rename to keyboards/dm9records/plaid/keymaps/brickbots/config.h diff --git a/keyboards/plaid/keymaps/brickbots/keymap.c b/keyboards/dm9records/plaid/keymaps/brickbots/keymap.c similarity index 100% rename from keyboards/plaid/keymaps/brickbots/keymap.c rename to keyboards/dm9records/plaid/keymaps/brickbots/keymap.c diff --git a/keyboards/plaid/keymaps/brickbots/readme.md b/keyboards/dm9records/plaid/keymaps/brickbots/readme.md similarity index 100% rename from keyboards/plaid/keymaps/brickbots/readme.md rename to keyboards/dm9records/plaid/keymaps/brickbots/readme.md diff --git a/keyboards/plaid/keymaps/default/config.h b/keyboards/dm9records/plaid/keymaps/default/config.h similarity index 100% rename from keyboards/plaid/keymaps/default/config.h rename to keyboards/dm9records/plaid/keymaps/default/config.h diff --git a/keyboards/plaid/keymaps/default/keymap.c b/keyboards/dm9records/plaid/keymaps/default/keymap.c similarity index 100% rename from keyboards/plaid/keymaps/default/keymap.c rename to keyboards/dm9records/plaid/keymaps/default/keymap.c diff --git a/keyboards/plaid/keymaps/default/readme.md b/keyboards/dm9records/plaid/keymaps/default/readme.md similarity index 100% rename from keyboards/plaid/keymaps/default/readme.md rename to keyboards/dm9records/plaid/keymaps/default/readme.md diff --git a/keyboards/plaid/keymaps/thehalfdeafchef/config.h b/keyboards/dm9records/plaid/keymaps/thehalfdeafchef/config.h similarity index 100% rename from keyboards/plaid/keymaps/thehalfdeafchef/config.h rename to keyboards/dm9records/plaid/keymaps/thehalfdeafchef/config.h diff --git a/keyboards/plaid/keymaps/thehalfdeafchef/keymap.c b/keyboards/dm9records/plaid/keymaps/thehalfdeafchef/keymap.c similarity index 100% rename from keyboards/plaid/keymaps/thehalfdeafchef/keymap.c rename to keyboards/dm9records/plaid/keymaps/thehalfdeafchef/keymap.c diff --git a/keyboards/plaid/keymaps/thehalfdeafchef/readme.md b/keyboards/dm9records/plaid/keymaps/thehalfdeafchef/readme.md similarity index 100% rename from keyboards/plaid/keymaps/thehalfdeafchef/readme.md rename to keyboards/dm9records/plaid/keymaps/thehalfdeafchef/readme.md diff --git a/keyboards/plaid/plaid.c b/keyboards/dm9records/plaid/plaid.c similarity index 100% rename from keyboards/plaid/plaid.c rename to keyboards/dm9records/plaid/plaid.c diff --git a/keyboards/plaid/plaid.h b/keyboards/dm9records/plaid/plaid.h similarity index 100% rename from keyboards/plaid/plaid.h rename to keyboards/dm9records/plaid/plaid.h diff --git a/keyboards/plaid/readme.md b/keyboards/dm9records/plaid/readme.md similarity index 91% rename from keyboards/plaid/readme.md rename to keyboards/dm9records/plaid/readme.md index a491d05d3bf..79621deec8b 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) Hardware Availability: Group buy in r/mk Make example for this keyboard (after setting up your build environment): - make plaid:default + make dm9records/plaid:default Flashing example for this keyboard: - make plaid:default:flash + make dm9records/plaid:default:flash ## Bootloader use usbasploader in my repository. diff --git a/keyboards/plaid/rules.mk b/keyboards/dm9records/plaid/rules.mk similarity index 100% rename from keyboards/plaid/rules.mk rename to keyboards/dm9records/plaid/rules.mk diff --git a/keyboards/tartan/config.h b/keyboards/dm9records/tartan/config.h similarity index 100% rename from keyboards/tartan/config.h rename to keyboards/dm9records/tartan/config.h diff --git a/keyboards/tartan/info.json b/keyboards/dm9records/tartan/info.json similarity index 99% rename from keyboards/tartan/info.json rename to keyboards/dm9records/tartan/info.json index 72da8bd9d42..ff0ddfdf9dc 100644 --- a/keyboards/tartan/info.json +++ b/keyboards/dm9records/tartan/info.json @@ -1,6 +1,6 @@ { "keyboard_name": "Tartan # Through Hole", - "keyboard_folder": "tartan", + "keyboard_folder": "dm9records/tartan", "url": "https://github.com/hsgw/tartan", "maintainer": "hsgw(Takuya Urakawa)", "width": 13, diff --git a/keyboards/tartan/keymaps/default/keymap.c b/keyboards/dm9records/tartan/keymaps/default/keymap.c similarity index 100% rename from keyboards/tartan/keymaps/default/keymap.c rename to keyboards/dm9records/tartan/keymaps/default/keymap.c diff --git a/keyboards/tartan/keymaps/default/readme.md b/keyboards/dm9records/tartan/keymaps/default/readme.md similarity index 100% rename from keyboards/tartan/keymaps/default/readme.md rename to keyboards/dm9records/tartan/keymaps/default/readme.md diff --git a/keyboards/tartan/readme.md b/keyboards/dm9records/tartan/readme.md similarity index 91% rename from keyboards/tartan/readme.md rename to keyboards/dm9records/tartan/readme.md index 83a3aebaeae..b8439ed2299 100644 --- a/keyboards/tartan/readme.md +++ b/keyboards/dm9records/tartan/readme.md @@ -10,12 +10,12 @@ A 60% keyboard with only through hole components. Make example for this keyboard (after setting up your build environment): - make tartan:default + make dm9records/tartan:default Flash firmware: // In bootloader mode - make tartan:default:flash + make dm9records/tartan:default:flash ## Bootloader use usbasploader in my repository. diff --git a/keyboards/tartan/rules.mk b/keyboards/dm9records/tartan/rules.mk similarity index 100% rename from keyboards/tartan/rules.mk rename to keyboards/dm9records/tartan/rules.mk diff --git a/keyboards/tartan/tartan.c b/keyboards/dm9records/tartan/tartan.c similarity index 100% rename from keyboards/tartan/tartan.c rename to keyboards/dm9records/tartan/tartan.c diff --git a/keyboards/tartan/tartan.h b/keyboards/dm9records/tartan/tartan.h similarity index 100% rename from keyboards/tartan/tartan.h rename to keyboards/dm9records/tartan/tartan.h diff --git a/keyboards/eco/rules.mk b/keyboards/eco/rules.mk index 7f7f20ed3b8..078131da7c7 100644 --- a/keyboards/eco/rules.mk +++ b/keyboards/eco/rules.mk @@ -23,7 +23,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = yes # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = no # Audio output UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_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 dcf8d15b7b7..04a12962e3e 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] = { }; -const uint16_t PROGMEM fn_actions[] = { - [1] = TT(1) -}; - layer_state_t layer_state_set_user(layer_state_t state) { uint8_t layer = get_highest_layer(state); diff --git a/keyboards/ergotravel/keymaps/ckofy/keymap.c b/keyboards/ergotravel/keymaps/ckofy/keymap.c index 691d4aa943b..b9a2c140d87 100644 --- a/keyboards/ergotravel/keymaps/ckofy/keymap.c +++ b/keyboards/ergotravel/keymaps/ckofy/keymap.c @@ -18,17 +18,6 @@ enum custom_keycodes { ADJUST, }; -/* Fn keys */ - -enum { - - F_SFT = 0, - F_ALT, - F_CTRL, - F_NUMPAD -// F_LOWER, -// F_RAISE, -}; #define KC_ KC_TRNS #define KC_XXXX KC_NO @@ -57,8 +46,8 @@ enum { #define KC_UDO LCTL(KC_Z) #define KC_CUT LCTL(KC_X) #define KC_SVE LCTL(KC_S) -#define KC_OSH F(F_SFT) -#define KC_OCTL F(F_CTRL) +#define KC_OSH OSM(MOD_LSFT) +#define KC_OCTL OSM(MOD_LCTL) #define KC_NUMP TT(_NUMPAD) #define KC_SHESC MT(MOD_LSFT,KC_ESC) #define KC_SHENT MT(MOD_RSFT,KC_ENT) @@ -142,14 +131,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -const uint16_t PROGMEM fn_actions[] = { - [F_SFT] = ACTION_MODS_ONESHOT (MOD_LSFT) - ,[F_ALT] = ACTION_MODS_ONESHOT (MOD_LALT) - ,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL) -}; - - - bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case COLEMAK: diff --git a/keyboards/gh60/revc/keymaps/robotmaxtron/keymap.c b/keyboards/gh60/revc/keymaps/robotmaxtron/keymap.c index d7d8316c66a..770fe723b56 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] = { */ [_FL] = LAYOUT( 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, \ - 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, \ + 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, \ 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, \ - 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, \ + 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, \ KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS), /* @@ -106,8 +106,6 @@ enum function_id { }; const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_TOGGLE(1), // Toggle Arrow Layer overlay - [3] = ACTION_LAYER_TOGGLE(3), // Toggle Underglow Layer overlay [4] = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow [5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode [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 98fcd9b989a..a70c409fe86 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] = { 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, \ 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, \ 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, \ - KC_TRNS, KC_TRNS, F(9), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + KC_TRNS, KC_TRNS, LM(2, MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), #endif [_SL] = LAYOUT_60_ansi( @@ -99,7 +99,6 @@ const uint16_t PROGMEM fn_actions[] = { [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL), [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL), #endif - [9] = ACTION_LAYER_MODS(2, MOD_LSFT) }; void 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 602bdd157bc..94d9289cdcd 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 #define TT_SYM MO(_SYM) #define TT_MOV LT(_MOV,KC_BSPC) #define TT_NUM MO(_NUM) -#define SSFT ACTION_MODS_ONESHOT(MOD_LSFT) enum macro_keycodes { DHPASTE=1, diff --git a/keyboards/hhkb/ansi/ansi.c b/keyboards/hhkb/ansi/ansi.c new file mode 100644 index 00000000000..cefc4e06904 --- /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 00000000000..28e8d2fef89 --- /dev/null +++ b/keyboards/hhkb/ansi/ansi.h @@ -0,0 +1,23 @@ +#pragma once + +#include "quantum.h" + +#define LAYOUT( \ + K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \ + K32, K01, K02, K13, K12, K23, K22, K42, K43, K62, K63, K73, K72, K52, \ + K33, K04, K03, K14, K15, K24, K25, K45, K44, K65, K64, K74, K53, \ + K34, K05, K06, K07, K16, K17, K26, K46, K66, K76, K75, K55, K54, \ + K35, K36, K37, K57, K56) \ + \ +{ \ + { K00, K01, K02, K03, K04, K05, K06, K07 }, \ + { K10, K11, K12, K13, K14, K15, K16, K17 }, \ + { K20, K21, K22, K23, K24, K25, K26, KC_NO }, \ + { K30, K31, K32, K33, K34, K35, K36, K37 }, \ + { K40, K41, K42, K43, K44, K45, K46, KC_NO }, \ + { K50, K51, K52, K53, K54, K55, K56, K57 }, \ + { K60, K61, K62, K63, K64, K65, K66, KC_NO }, \ + { K70, K71, K72, K73, K74, K75, K76, KC_NO } \ +} + +#define LAYOUT_60_hhkb LAYOUT diff --git a/keyboards/hhkb/config.h b/keyboards/hhkb/ansi/config.h similarity index 94% rename from keyboards/hhkb/config.h rename to keyboards/hhkb/ansi/config.h index fc747a6e942..689fd556819 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 along with this program. If not, see . */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once #include "config_common.h" /* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0xCAFE +#define VENDOR_ID 0x4848 // HH = happy hacking +#define PRODUCT_ID 0x0001 // ANSI HHKB #define DEVICE_VER 0x0104 #define MANUFACTURER q.m.k #define PRODUCT HHKB mod #define DESCRIPTION q.m.k keyboard firmware for HHKB /* key matrix size */ -#ifdef HHKB_JP -# define MATRIX_ROWS 16 -#else -# define MATRIX_ROWS 8 -#endif +#define MATRIX_ROWS 8 #define MATRIX_COLS 8 #define TAPPING_TERM 200 @@ -107,5 +102,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -#endif diff --git a/keyboards/hhkb/ansi/hhkb_avr.h b/keyboards/hhkb/ansi/hhkb_avr.h new file mode 100644 index 00000000000..f9446deef71 --- /dev/null +++ b/keyboards/hhkb/ansi/hhkb_avr.h @@ -0,0 +1,157 @@ +#pragma once + +#include +#include +#include +#include +#include + + +// Timer resolution check +#if (1000000/TIMER_RAW_FREQ > 20) +# error "Timer resolution(>20us) is not enough for HHKB matrix scan tweak on V-USB." +#endif + + +/* + * HHKB Matrix I/O + * + * row: HC4051[A,B,C] selects scan row0-7 + * row-ext: [En0,En1] row extention for JP + * col: LS145[A,B,C,D] selects scan col0-7 and enable(D) + * key: on: 0/off: 1 + * prev: hysteresis control: assert(1) when previous key state is on + */ + + +#if defined(__AVR_ATmega32U4__) +/* + * For TMK HHKB alt controller(ATMega32U4) + * + * row: PB0-2 + * col: PB3-5,6 + * key: PD7(pull-uped) + * prev: PB7 + * power: PD4(L:off/H:on) + * row-ext: PC6,7 for HHKB JP(active low) + */ +static inline void KEY_ENABLE(void) { (PORTB &= ~(1<<6)); } +static inline void KEY_UNABLE(void) { (PORTB |= (1<<6)); } +static inline bool KEY_STATE(void) { return (PIND & (1<<7)); } +static inline void KEY_PREV_ON(void) { (PORTB |= (1<<7)); } +static inline void KEY_PREV_OFF(void) { (PORTB &= ~(1<<7)); } +#ifdef HHKB_POWER_SAVING +static inline void KEY_POWER_ON(void) { + DDRB = 0xFF; PORTB = 0x40; // change pins output + DDRD |= (1<<4); PORTD |= (1<<4); // MOS FET switch on + /* Without this wait you will miss or get false key events. */ + _delay_ms(5); // wait for powering up +} +static inline void KEY_POWER_OFF(void) { + /* input with pull-up consumes less than without it when pin is open. */ + DDRB = 0x00; PORTB = 0xFF; // change pins input with pull-up + DDRD |= (1<<4); PORTD &= ~(1<<4); // MOS FET switch off +} +static inline bool KEY_POWER_STATE(void) { return PORTD & (1<<4); } +#else +static inline void KEY_POWER_ON(void) {} +static inline void KEY_POWER_OFF(void) {} +static inline bool KEY_POWER_STATE(void) { return true; } +#endif +static inline void KEY_INIT(void) +{ + /* row,col,prev: output */ + DDRB = 0xFF; + PORTB = 0x40; // unable + /* key: input with pull-up */ + DDRD &= ~0x80; + PORTD |= 0x80; + + KEY_UNABLE(); + KEY_PREV_OFF(); + + KEY_POWER_OFF(); +} +static inline void KEY_SELECT(uint8_t ROW, uint8_t COL) +{ + PORTB = (PORTB & 0xC0) | (((COL) & 0x07)<<3) | ((ROW) & 0x07); + +} + + +#elif defined(__AVR_AT90USB1286__) +/* + * For Teensy++(AT90USB1286) + * + * HHKB pro HHKB pro2 + * row: PB0-2 (6-8) (5-7) + * col: PB3-5,6 (9-12) (8-11) + * key: PE6(pull-uped) (4) (3) + * prev: PE7 (5) (4) + * + * TODO: convert into 'staitc inline' function + */ +#define KEY_INIT() do { \ + DDRB |= 0x7F; \ + DDRE |= (1<<7); \ + DDRE &= ~(1<<6); \ + PORTE |= (1<<6); \ +} while (0) +#define KEY_SELECT(ROW, COL) (PORTB = (PORTB & 0xC0) | \ + (((COL) & 0x07)<<3) | \ + ((ROW) & 0x07)) +#define KEY_ENABLE() (PORTB &= ~(1<<6)) +#define KEY_UNABLE() (PORTB |= (1<<6)) +#define KEY_STATE() (PINE & (1<<6)) +#define KEY_PREV_ON() (PORTE |= (1<<7)) +#define KEY_PREV_OFF() (PORTE &= ~(1<<7)) +#define KEY_POWER_ON() +#define KEY_POWER_OFF() +#define KEY_POWER_STATE() true + + +#else +# error "define code for matrix scan" +#endif + + +#if 0 +// For ATMega328P with V-USB +// +// #elif defined(__AVR_ATmega328P__) +// Ports for V-USB +// key: PB0(pull-uped) +// prev: PB1 +// row: PB2-4 +// col: PC0-2,3 +// power: PB5(Low:on/Hi-z:off) +#define KEY_INIT() do { \ + DDRB |= 0x3E; \ + DDRB &= ~(1<<0); \ + PORTB |= 1<<0; \ + DDRC |= 0x0F; \ + KEY_UNABLE(); \ + KEY_PREV_OFF(); \ +} while (0) +#define KEY_SELECT(ROW, COL) do { \ + PORTB = (PORTB & 0xE3) | ((ROW) & 0x07)<<2; \ + PORTC = (PORTC & 0xF8) | ((COL) & 0x07); \ +} while (0) +#define KEY_ENABLE() (PORTC &= ~(1<<3)) +#define KEY_UNABLE() (PORTC |= (1<<3)) +#define KEY_STATE() (PINB & (1<<0)) +#define KEY_PREV_ON() (PORTB |= (1<<1)) +#define KEY_PREV_OFF() (PORTB &= ~(1<<1)) +// Power supply switching +#define KEY_POWER_ON() do { \ + KEY_INIT(); \ + PORTB &= ~(1<<5); \ + _delay_ms(1); \ +} while (0) +#define KEY_POWER_OFF() do { \ + DDRB &= ~0x3F; \ + PORTB &= ~0x3F; \ + DDRC &= ~0x0F; \ + PORTC &= ~0x0F; \ +} while (0) +#endif diff --git a/keyboards/hhkb/ansi/info.json b/keyboards/hhkb/ansi/info.json new file mode 100644 index 00000000000..a36f1d44c82 --- /dev/null +++ b/keyboards/hhkb/ansi/info.json @@ -0,0 +1,73 @@ +{ + "keyboard_name": "HHKB", + "url": "", + "maintainer": "qmk", + "width": 15, + "height": 5, + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "Esc", "x": 0, "y": 0 }, + { "label": "!", "x": 1, "y": 0 }, + { "label": "@", "x": 2, "y": 0 }, + { "label": "#", "x": 3, "y": 0 }, + { "label": "$", "x": 4, "y": 0 }, + { "label": "%", "x": 5, "y": 0 }, + { "label": "^", "x": 6, "y": 0 }, + { "label": "&", "x": 7, "y": 0 }, + { "label": "*", "x": 8, "y": 0 }, + { "label": "(", "x": 9, "y": 0 }, + { "label": ")", "x": 10, "y": 0 }, + { "label": "_", "x": 11, "y": 0 }, + { "label": "+", "x": 12, "y": 0 }, + { "label": "|", "x": 13, "y": 0 }, + { "label": "~", "x": 14, "y": 0 }, + { "label": "Tab", "x": 0, "y": 1, "w": 1.5 }, + { "label": "Q", "x": 1.5, "y": 1 }, + { "label": "W", "x": 2.5, "y": 1 }, + { "label": "E", "x": 3.5, "y": 1 }, + { "label": "R", "x": 4.5, "y": 1 }, + { "label": "T", "x": 5.5, "y": 1 }, + { "label": "Y", "x": 6.5, "y": 1 }, + { "label": "U", "x": 7.5, "y": 1 }, + { "label": "I", "x": 8.5, "y": 1 }, + { "label": "O", "x": 9.5, "y": 1 }, + { "label": "P", "x": 10.5, "y": 1 }, + { "label": "{", "x": 11.5, "y": 1 }, + { "label": "}", "x": 12.5, "y": 1 }, + { "label": "Delete", "x": 13.5, "y": 1, "w": 1.5 }, + { "label": "Control", "x": 0, "y": 2, "w": 1.75 }, + { "label": "A", "x": 1.75, "y": 2 }, + { "label": "S", "x": 2.75, "y": 2 }, + { "label": "D", "x": 3.75, "y": 2 }, + { "label": "F", "x": 4.75, "y": 2 }, + { "label": "G", "x": 5.75, "y": 2 }, + { "label": "H", "x": 6.75, "y": 2 }, + { "label": "J", "x": 7.75, "y": 2 }, + { "label": "K", "x": 8.75, "y": 2 }, + { "label": "L", "x": 9.75, "y": 2 }, + { "label": ":", "x": 10.75, "y": 2 }, + { "label": "\"", "x": 11.75, "y": 2 }, + { "label": "Return", "x": 12.75, "y": 2, "w": 2.25 }, + { "label": "Shift", "x": 0, "y": 3, "w": 2.25 }, + { "label": "Z", "x": 2.25, "y": 3 }, + { "label": "X", "x": 3.25, "y": 3 }, + { "label": "C", "x": 4.25, "y": 3 }, + { "label": "V", "x": 5.25, "y": 3 }, + { "label": "B", "x": 6.25, "y": 3 }, + { "label": "N", "x": 7.25, "y": 3 }, + { "label": "M", "x": 8.25, "y": 3 }, + { "label": "<", "x": 9.25, "y": 3 }, + { "label": ">", "x": 10.25, "y": 3 }, + { "label": "?", "x": 11.25, "y": 3 }, + { "label": "Shift", "x": 12.25, "y": 3, "w": 1.75 }, + { "label": "Fn", "x": 14, "y": 3 }, + { "label": "", "x": 1.5, "y": 4 }, + { "label": "", "x": 2.5, "y": 4, "w": 1.5 }, + { "x": 4, "y": 4, "w": 6 }, + { "label": "", "x": 10, "y": 4, "w": 1.5 }, + { "label": "", "x": 11.5, "y": 4 } + ] + } + } +} diff --git a/keyboards/hhkb/keymaps/blakedietz/README.md b/keyboards/hhkb/ansi/keymaps/blakedietz/README.md similarity index 100% rename from keyboards/hhkb/keymaps/blakedietz/README.md rename to keyboards/hhkb/ansi/keymaps/blakedietz/README.md diff --git a/keyboards/hhkb/keymaps/blakedietz/config.h b/keyboards/hhkb/ansi/keymaps/blakedietz/config.h similarity index 100% rename from keyboards/hhkb/keymaps/blakedietz/config.h rename to keyboards/hhkb/ansi/keymaps/blakedietz/config.h diff --git a/keyboards/hhkb/keymaps/blakedietz/keymap.c b/keyboards/hhkb/ansi/keymaps/blakedietz/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/blakedietz/keymap.c rename to keyboards/hhkb/ansi/keymaps/blakedietz/keymap.c diff --git a/keyboards/hhkb/keymaps/blakedietz/rules.mk b/keyboards/hhkb/ansi/keymaps/blakedietz/rules.mk similarity index 100% rename from keyboards/hhkb/keymaps/blakedietz/rules.mk rename to keyboards/hhkb/ansi/keymaps/blakedietz/rules.mk diff --git a/keyboards/hhkb/keymaps/brett/config.h b/keyboards/hhkb/ansi/keymaps/brett/config.h similarity index 100% rename from keyboards/hhkb/keymaps/brett/config.h rename to keyboards/hhkb/ansi/keymaps/brett/config.h diff --git a/keyboards/hhkb/keymaps/brett/keymap.c b/keyboards/hhkb/ansi/keymaps/brett/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/brett/keymap.c rename to keyboards/hhkb/ansi/keymaps/brett/keymap.c diff --git a/keyboards/hhkb/keymaps/brett/readme.md b/keyboards/hhkb/ansi/keymaps/brett/readme.md similarity index 100% rename from keyboards/hhkb/keymaps/brett/readme.md rename to keyboards/hhkb/ansi/keymaps/brett/readme.md diff --git a/keyboards/hhkb/keymaps/brett/rules.mk b/keyboards/hhkb/ansi/keymaps/brett/rules.mk similarity index 100% rename from keyboards/hhkb/keymaps/brett/rules.mk rename to keyboards/hhkb/ansi/keymaps/brett/rules.mk diff --git a/keyboards/hhkb/keymaps/cinaeco/README.md b/keyboards/hhkb/ansi/keymaps/cinaeco/README.md similarity index 100% rename from keyboards/hhkb/keymaps/cinaeco/README.md rename to keyboards/hhkb/ansi/keymaps/cinaeco/README.md diff --git a/keyboards/hhkb/keymaps/cinaeco/config.h b/keyboards/hhkb/ansi/keymaps/cinaeco/config.h similarity index 100% rename from keyboards/hhkb/keymaps/cinaeco/config.h rename to keyboards/hhkb/ansi/keymaps/cinaeco/config.h diff --git a/keyboards/hhkb/keymaps/cinaeco/keymap.c b/keyboards/hhkb/ansi/keymaps/cinaeco/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/cinaeco/keymap.c rename to keyboards/hhkb/ansi/keymaps/cinaeco/keymap.c diff --git a/keyboards/hhkb/keymaps/cinaeco/rules.mk b/keyboards/hhkb/ansi/keymaps/cinaeco/rules.mk similarity index 100% rename from keyboards/hhkb/keymaps/cinaeco/rules.mk rename to keyboards/hhkb/ansi/keymaps/cinaeco/rules.mk diff --git a/keyboards/hhkb/keymaps/dbroqua/keymap.c b/keyboards/hhkb/ansi/keymaps/dbroqua/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/dbroqua/keymap.c rename to keyboards/hhkb/ansi/keymaps/dbroqua/keymap.c diff --git a/keyboards/hhkb/keymaps/dbroqua/readme.md b/keyboards/hhkb/ansi/keymaps/dbroqua/readme.md similarity index 100% rename from keyboards/hhkb/keymaps/dbroqua/readme.md rename to keyboards/hhkb/ansi/keymaps/dbroqua/readme.md diff --git a/keyboards/hhkb/keymaps/default/keymap.c b/keyboards/hhkb/ansi/keymaps/default/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/default/keymap.c rename to keyboards/hhkb/ansi/keymaps/default/keymap.c diff --git a/keyboards/hhkb/keymaps/eric/keymap.c b/keyboards/hhkb/ansi/keymaps/eric/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/eric/keymap.c rename to keyboards/hhkb/ansi/keymaps/eric/keymap.c diff --git a/keyboards/hhkb/keymaps/dhertz/config.h b/keyboards/hhkb/ansi/keymaps/krusli/config.h similarity index 100% rename from keyboards/hhkb/keymaps/dhertz/config.h rename to keyboards/hhkb/ansi/keymaps/krusli/config.h diff --git a/keyboards/hhkb/keymaps/krusli/keymap.c b/keyboards/hhkb/ansi/keymaps/krusli/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/krusli/keymap.c rename to keyboards/hhkb/ansi/keymaps/krusli/keymap.c diff --git a/keyboards/hhkb/keymaps/lxol/keymap.c b/keyboards/hhkb/ansi/keymaps/lxol/keymap.c similarity index 97% rename from keyboards/hhkb/keymaps/lxol/keymap.c rename to keyboards/hhkb/ansi/keymaps/lxol/keymap.c index 3e3b3d2ed0c..462a980471f 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] = { 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, 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, - 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, + 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), 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), KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT), @@ -80,7 +80,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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), 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), - 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, + 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), 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, KC_LALT, KC_LGUI, RGUI(KC_SPC), KC_RGUI, KC_RALT), @@ -104,7 +104,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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), 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), - 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, + 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), 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, KC_LALT, KC_LGUI, LGUI(KC_SPC), KC_LGUI, KC_RALT), @@ -128,7 +128,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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), 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), - 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, + 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), 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, KC_LALT, KC_LGUI, RALT(KC_SPC), KC_RGUI, KC_RALT), @@ -152,7 +152,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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), 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), - 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, + 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), 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, KC_LALT, KC_LGUI, LALT(KC_SPC), KC_LGUI, KC_RALT), @@ -176,14 +176,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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, 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, - 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, + 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), 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), KC_RGUI, KC_RALT, KC_SPC, KC_RALT, KC_RGUI)}; -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT) // RControl with tap Enter* -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function diff --git a/keyboards/hhkb/keymaps/mjt/config.h b/keyboards/hhkb/ansi/keymaps/mjt/config.h similarity index 100% rename from keyboards/hhkb/keymaps/mjt/config.h rename to keyboards/hhkb/ansi/keymaps/mjt/config.h diff --git a/keyboards/hhkb/keymaps/mjt/keymap.c b/keyboards/hhkb/ansi/keymaps/mjt/keymap.c similarity index 98% rename from keyboards/hhkb/keymaps/mjt/keymap.c rename to keyboards/hhkb/ansi/keymaps/mjt/keymap.c index e51eb8bf922..b62676edd98 100644 --- a/keyboards/hhkb/keymaps/mjt/keymap.c +++ b/keyboards/hhkb/ansi/keymaps/mjt/keymap.c @@ -17,7 +17,6 @@ enum hhkb_keycodes DYNAMIC_MACRO_RANGE, }; -#include "dynamic_macro.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -104,7 +103,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) bool process_record_user(uint16_t keycode, keyrecord_t *record) { uint16_t macro_kc = (keycode == MO(DYN) ? DYN_REC_STOP : keycode); - if (!process_record_dynamic_macro(macro_kc, record)) + if (!process_dynamic_macro(macro_kc, record)) { return false; } diff --git a/keyboards/hhkb/keymaps/mjt/readme.md b/keyboards/hhkb/ansi/keymaps/mjt/readme.md similarity index 100% rename from keyboards/hhkb/keymaps/mjt/readme.md rename to 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 00000000000..9e6797ed307 --- /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 similarity index 100% rename from keyboards/hhkb/keymaps/schaeferdev/README.md rename to keyboards/hhkb/ansi/keymaps/schaeferdev/README.md diff --git a/keyboards/hhkb/keymaps/schaeferdev/config.h b/keyboards/hhkb/ansi/keymaps/schaeferdev/config.h similarity index 100% rename from keyboards/hhkb/keymaps/schaeferdev/config.h rename to keyboards/hhkb/ansi/keymaps/schaeferdev/config.h diff --git a/keyboards/hhkb/keymaps/schaeferdev/keymap.c b/keyboards/hhkb/ansi/keymaps/schaeferdev/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/schaeferdev/keymap.c rename to keyboards/hhkb/ansi/keymaps/schaeferdev/keymap.c diff --git a/keyboards/hhkb/keymaps/schaeferdev/rules.mk b/keyboards/hhkb/ansi/keymaps/schaeferdev/rules.mk similarity index 100% rename from keyboards/hhkb/keymaps/schaeferdev/rules.mk rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/shela/action_pseudo_lut.c rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/shela/action_pseudo_lut.h rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/shela/config.h rename to keyboards/hhkb/ansi/keymaps/shela/config.h diff --git a/keyboards/hhkb/keymaps/shela/keymap.c b/keyboards/hhkb/ansi/keymaps/shela/keymap.c similarity index 95% rename from keyboards/hhkb/keymaps/shela/keymap.c rename to keyboards/hhkb/ansi/keymaps/shela/keymap.c index 2d5f4c64ac3..3971e8f9455 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] = { 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, 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, 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), - KC_LGUI, KC_FN3, LT(SPACE_FN, KC_SPACE), KC_FN4, KC_RGUI), + KC_LGUI, MT(MOD_LALT, KC_MHEN), LT(SPACE_FN, KC_SPACE), MT(MOD_RALT, KC_KANA), KC_RGUI), /* Layer 2: Dvorak Layer * ,-----------------------------------------------------------------------------------------. @@ -133,7 +133,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [HHKB] = 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, - 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, + 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, 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, 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, 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) */ const uint16_t PROGMEM fn_actions[] = { [1] = ACTION_FUNCTION(PSEUDO_US_FUNCTION), - [3] = ACTION_MODS_TAP_KEY(MOD_LALT, KC_MHEN), - [4] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_KANA), - [5] = ACTION_DEFAULT_LAYER_SET(BASE), - [6] = ACTION_DEFAULT_LAYER_SET(PSEUDO_US), - [7] = ACTION_DEFAULT_LAYER_SET(MOUSE), - [8] = ACTION_DEFAULT_LAYER_SET(TENKEY), - [9] = ACTION_DEFAULT_LAYER_SET(DVORAK), }; diff --git a/keyboards/hhkb/keymaps/shela/keymap_jis2us.h b/keyboards/hhkb/ansi/keymaps/shela/keymap_jis2us.h similarity index 100% rename from keyboards/hhkb/keymaps/shela/keymap_jis2us.h rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/shela/readme.md rename to keyboards/hhkb/ansi/keymaps/shela/readme.md diff --git a/keyboards/hhkb/keymaps/shela/rules.mk b/keyboards/hhkb/ansi/keymaps/shela/rules.mk similarity index 100% rename from keyboards/hhkb/keymaps/shela/rules.mk rename to keyboards/hhkb/ansi/keymaps/shela/rules.mk diff --git a/keyboards/hhkb/keymaps/smt/keymap.c b/keyboards/hhkb/ansi/keymaps/smt/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/smt/keymap.c rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/tobiasvl_iso/keymap.c rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/tobiasvl_iso/readme.md rename to keyboards/hhkb/ansi/keymaps/tobiasvl_iso/readme.md diff --git a/keyboards/hhkb/keymaps/tominabox1/.gitignore b/keyboards/hhkb/ansi/keymaps/tominabox1/.gitignore similarity index 100% rename from keyboards/hhkb/keymaps/tominabox1/.gitignore rename to keyboards/hhkb/ansi/keymaps/tominabox1/.gitignore diff --git a/keyboards/hhkb/keymaps/tominabox1/keymap.c b/keyboards/hhkb/ansi/keymaps/tominabox1/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/tominabox1/keymap.c rename to 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 00000000000..bdbd32898a0 --- /dev/null +++ b/keyboards/hhkb/ansi/keymaps/via/keymap.c @@ -0,0 +1,68 @@ +#include QMK_KEYBOARD_H + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* BASE Level: Default Layer + |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---| + | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` | + |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---| + | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Backs | | + |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---| + | Cont | A | S | D | F | G | H | J | K | L | ; | ' | Ent | | | + |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---| + | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | Fn0 | | | + |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---| + + |------+------+-----------------------+------+------| + | LAlt | LGUI | ******* Space ******* | RGUI | RAlt | + |------+------+-----------------------+------+------| + */ + + [0] = LAYOUT( // default layer + 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, + 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, + 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, + 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), + KC_LALT, KC_LGUI, /* */ KC_SPC, KC_RGUI, KC_RALT + ), + + /* Layer HHKB: HHKB mode (HHKB Fn) + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | Pwr | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | Ins | Del | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | Caps | | | | | | | | Psc | Slk | Pus | Up | | Backs | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | | VoD | VoU | Mut | | | * | / | Hom | PgU | Lef | Rig | Enter | | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | | | | | | | + | - | End | PgD | Dow | | | | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + + |------+------+----------------------+------+------+ + | **** | **** | ******************** | **** | **** | + |------+------+----------------------+------+------+ + + */ + + [1] = 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, + 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, + 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, + 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, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + [2] = LAYOUT( + 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, + 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, 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, 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 + ), + [3] = LAYOUT( + 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, + 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, 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, 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 + ) +}; diff --git a/keyboards/hhkb/ansi/keymaps/via/rules.mk b/keyboards/hhkb/ansi/keymaps/via/rules.mk new file mode 100644 index 00000000000..1e5b99807cb --- /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 similarity index 100% rename from keyboards/hhkb/keymaps/xyverz/keymap.c rename to 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 00000000000..f22e69f6b02 --- /dev/null +++ b/keyboards/hhkb/ansi/matrix.c @@ -0,0 +1,211 @@ +/* +Copyright 2011 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +/* + * scan matrix + */ +#include +#include +#include +#include "print.h" +#include "debug.h" +#include "util.h" +#include "timer.h" +#include "matrix.h" +#include "hhkb_avr.h" +#include +#include "suspend.h" +#include "lufa.h" + + +// matrix power saving +#define MATRIX_POWER_SAVE 10000 +static uint32_t matrix_last_modified = 0; + +// matrix state buffer(1:on, 0:off) +static matrix_row_t *matrix; +static matrix_row_t *matrix_prev; +static matrix_row_t _matrix0[MATRIX_ROWS]; +static matrix_row_t _matrix1[MATRIX_ROWS]; + + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ +#ifdef DEBUG + debug_enable = true; + debug_keyboard = true; +#endif + + KEY_INIT(); + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00; + for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix1[i] = 0x00; + matrix = _matrix0; + matrix_prev = _matrix1; +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +uint8_t matrix_scan(void) +{ + uint8_t *tmp; + + tmp = matrix_prev; + matrix_prev = matrix; + matrix = tmp; + + // power on + if (!KEY_POWER_STATE()) KEY_POWER_ON(); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + KEY_SELECT(row, col); + _delay_us(5); + + // Not sure this is needed. This just emulates HHKB controller's behaviour. + if (matrix_prev[row] & (1< 20/(1000000/TIMER_RAW_FREQ)) { + matrix[row] = matrix_prev[row]; + } + + _delay_us(5); + KEY_PREV_OFF(); + KEY_UNABLE(); + + // NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE. + // This takes 25us or more to make sure KEY_STATE returns to idle state. + + _delay_us(75); + + } + if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32(); + } + // power off + if (KEY_POWER_STATE() && + (USB_DeviceState == DEVICE_STATE_Suspended || + USB_DeviceState == DEVICE_STATE_Unattached ) && + timer_elapsed32(matrix_last_modified) > MATRIX_POWER_SAVE) { + KEY_POWER_OFF(); + suspend_power_down(); + } + + matrix_scan_quantum(); + + return 1; +} + +bool matrix_is_modified(void) +{ + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + if (matrix[i] != matrix_prev[i]) + return true; + } + return false; +} + +inline +bool matrix_has_ghost(void) +{ + return false; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & (1<= 0; --r) { + count += bitpop16(matrix_get_row(r)); + } + return count; +} + +void matrix_power_up(void) { + KEY_POWER_ON(); +} +void matrix_power_down(void) { + KEY_POWER_OFF(); +} diff --git a/keyboards/hhkb/ansi/readme.md b/keyboards/hhkb/ansi/readme.md new file mode 100644 index 00000000000..495aa4c3f7b --- /dev/null +++ b/keyboards/hhkb/ansi/readme.md @@ -0,0 +1,14 @@ +HHKB Alternate Controller +=== + +An alternative controler for the HHKB designed by hasu. + +Keyboard Maintainer: QMK Community +Hardware Supported: HHKB Alternate Controller +Hardware Availability: https://geekhack.org/index.php?topic=12047.0 + +Make example for this keyboard (after setting up your build environment): + + make hhkb/ansi:default + +See [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 similarity index 94% rename from keyboards/hhkb/rules.mk rename to keyboards/hhkb/ansi/rules.mk index 68fb51a30cf..a367ef48d14 100644 --- a/keyboards/hhkb/rules.mk +++ b/keyboards/hhkb/ansi/rules.mk @@ -47,14 +47,14 @@ OPT_DEFS += -DHHKB_RN42_ENABLE # Support for the RN42 Bluetooth module. This is the BT module in Hasu's BT # HHKB Alt controller. -RN42_DIR = rn42 +RN42_DIR = ../rn42 SRC += serial_uart.c \ - rn42/suart.S \ - rn42/rn42.c \ - rn42/rn42_task.c \ - rn42/battery.c \ - rn42/main.c + ../rn42/suart.S \ + ../rn42/rn42.c \ + ../rn42/rn42_task.c \ + ../rn42/battery.c \ + ../rn42/main.c VPATH += $(RN42_DIR) diff --git a/keyboards/hhkb/hhkb.c b/keyboards/hhkb/hhkb.c deleted file mode 100644 index a9d35123ffa..00000000000 --- a/keyboards/hhkb/hhkb.c +++ /dev/null @@ -1 +0,0 @@ -#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 00000000000..01dab6d440c --- /dev/null +++ b/keyboards/hhkb/jp/config.h @@ -0,0 +1,104 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x4848 // HH = happy hacking +#define PRODUCT_ID 0x0002 // HHKB JP +#define DEVICE_VER 0x0104 +#define MANUFACTURER q.m.k +#define PRODUCT HHKB mod +#define DESCRIPTION q.m.k keyboard firmware for HHKB + +/* key matrix size */ +#define MATRIX_ROWS 16 +#define MATRIX_COLS 8 + +#define TAPPING_TERM 200 + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +#ifdef HHKB_RN42_ENABLE +// rn42 support -- acquired from the tmk repo. This is almost certainly not +// integrated with qmk in the correct way. + +#define SUART_OUT_PORT PORTD +#define SUART_OUT_BIT 0 +#define SUART_IN_PIN PIND +#define SUART_IN_BIT 1 + +#ifdef __AVR_ATmega32U4__ + /* iom32u4.h has no definition of UCSR1D. copy from iom32u2.h */ + #define UCSR1D _SFR_MEM8(0xCB) + #define RTSEN 0 + #define CTSEN 1 + + #define SERIAL_UART_BAUD 115200 + #define SERIAL_UART_DATA UDR1 + #define SERIAL_UART_UBRR ((F_CPU/(16.0*SERIAL_UART_BAUD)-1+0.5)) + #define SERIAL_UART_RXD_VECT USART1_RX_vect + #define SERIAL_UART_TXD_READY (UCSR1A&(1<>8); /* baud rate */ \ + UCSR1B |= (1< #include @@ -67,11 +66,11 @@ static inline void KEY_INIT(void) /* key: input with pull-up */ DDRD &= ~0x80; PORTD |= 0x80; -#ifdef HHKB_JP + /* row extention for HHKB JP */ DDRC |= (1<<6|1<<7); PORTC |= (1<<6|1<<7); -#endif + KEY_UNABLE(); KEY_PREV_OFF(); @@ -80,10 +79,10 @@ static inline void KEY_INIT(void) static inline void KEY_SELECT(uint8_t ROW, uint8_t COL) { PORTB = (PORTB & 0xC0) | (((COL) & 0x07)<<3) | ((ROW) & 0x07); -#ifdef HHKB_JP + if ((ROW) & 0x08) PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<6); else PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<7); -#endif + } @@ -163,5 +162,3 @@ static inline void KEY_SELECT(uint8_t ROW, uint8_t COL) PORTC &= ~0x0F; \ } while (0) #endif - -#endif diff --git a/keyboards/hhkb/info.json b/keyboards/hhkb/jp/info.json similarity index 53% rename from keyboards/hhkb/info.json rename to keyboards/hhkb/jp/info.json index 3beaff83da9..7594987d96c 100644 --- a/keyboards/hhkb/info.json +++ b/keyboards/hhkb/jp/info.json @@ -1,75 +1,10 @@ { - "keyboard_name": "hhkb", + "keyboard_name": "HHKB JP", "url": "", "maintainer": "qmk", "width": 15, "height": 5, "layouts": { - "LAYOUT": { - "layout": [ - { "label": "Esc", "x": 0, "y": 0 }, - { "label": "!", "x": 1, "y": 0 }, - { "label": "@", "x": 2, "y": 0 }, - { "label": "#", "x": 3, "y": 0 }, - { "label": "$", "x": 4, "y": 0 }, - { "label": "%", "x": 5, "y": 0 }, - { "label": "^", "x": 6, "y": 0 }, - { "label": "&", "x": 7, "y": 0 }, - { "label": "*", "x": 8, "y": 0 }, - { "label": "(", "x": 9, "y": 0 }, - { "label": ")", "x": 10, "y": 0 }, - { "label": "_", "x": 11, "y": 0 }, - { "label": "+", "x": 12, "y": 0 }, - { "label": "|", "x": 13, "y": 0 }, - { "label": "~", "x": 14, "y": 0 }, - { "label": "Tab", "x": 0, "y": 1, "w": 1.5 }, - { "label": "Q", "x": 1.5, "y": 1 }, - { "label": "W", "x": 2.5, "y": 1 }, - { "label": "E", "x": 3.5, "y": 1 }, - { "label": "R", "x": 4.5, "y": 1 }, - { "label": "T", "x": 5.5, "y": 1 }, - { "label": "Y", "x": 6.5, "y": 1 }, - { "label": "U", "x": 7.5, "y": 1 }, - { "label": "I", "x": 8.5, "y": 1 }, - { "label": "O", "x": 9.5, "y": 1 }, - { "label": "P", "x": 10.5, "y": 1 }, - { "label": "{", "x": 11.5, "y": 1 }, - { "label": "}", "x": 12.5, "y": 1 }, - { "label": "Delete", "x": 13.5, "y": 1, "w": 1.5 }, - { "label": "Control", "x": 0, "y": 2, "w": 1.75 }, - { "label": "A", "x": 1.75, "y": 2 }, - { "label": "S", "x": 2.75, "y": 2 }, - { "label": "D", "x": 3.75, "y": 2 }, - { "label": "F", "x": 4.75, "y": 2 }, - { "label": "G", "x": 5.75, "y": 2 }, - { "label": "H", "x": 6.75, "y": 2 }, - { "label": "J", "x": 7.75, "y": 2 }, - { "label": "K", "x": 8.75, "y": 2 }, - { "label": "L", "x": 9.75, "y": 2 }, - { "label": ":", "x": 10.75, "y": 2 }, - { "label": "\"", "x": 11.75, "y": 2 }, - { "label": "Return", "x": 12.75, "y": 2, "w": 2.25 }, - { "label": "Shift", "x": 0, "y": 3, "w": 2.25 }, - { "label": "Z", "x": 2.25, "y": 3 }, - { "label": "X", "x": 3.25, "y": 3 }, - { "label": "C", "x": 4.25, "y": 3 }, - { "label": "V", "x": 5.25, "y": 3 }, - { "label": "B", "x": 6.25, "y": 3 }, - { "label": "N", "x": 7.25, "y": 3 }, - { "label": "M", "x": 8.25, "y": 3 }, - { "label": "<", "x": 9.25, "y": 3 }, - { "label": ">", "x": 10.25, "y": 3 }, - { "label": "?", "x": 11.25, "y": 3 }, - { "label": "Shift", "x": 12.25, "y": 3, "w": 1.75 }, - { "label": "Fn", "x": 14, "y": 3 }, - { "label": "", "x": 1.5, "y": 4 }, - { "label": "", "x": 2.5, "y": 4, "w": 1.5 }, - { "x": 4, "y": 4, "w": 6 }, - { "label": "", "x": 10, "y": 4, "w": 1.5 }, - { "label": "", "x": 11.5, "y": 4 } - ] - }, - "LAYOUT_JP": { "layout": [ { "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 00000000000..f1f1388c773 --- /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 similarity index 57% rename from keyboards/hhkb/hhkb.h rename to keyboards/hhkb/jp/jp.h index 668f78eecc5..a95796f25f9 100644 --- a/keyboards/hhkb/hhkb.h +++ b/keyboards/hhkb/jp/jp.h @@ -1,28 +1,7 @@ -#ifndef HHKB_H -#define HHKB_H +#pragma once #include "quantum.h" -#define LAYOUT( \ - K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \ - K32, K01, K02, K13, K12, K23, K22, K42, K43, K62, K63, K73, K72, K52, \ - K33, K04, K03, K14, K15, K24, K25, K45, K44, K65, K64, K74, K53, \ - K34, K05, K06, K07, K16, K17, K26, K46, K66, K76, K75, K55, K54, \ - K35, K36, K37, K57, K56) \ - \ -{ \ - { K00, K01, K02, K03, K04, K05, K06, K07 }, \ - { K10, K11, K12, K13, K14, K15, K16, K17 }, \ - { K20, K21, K22, K23, K24, K25, K26, KC_NO }, \ - { K30, K31, K32, K33, K34, K35, K36, K37 }, \ - { K40, K41, K42, K43, K44, K45, K46, KC_NO }, \ - { K50, K51, K52, K53, K54, K55, K56, K57 }, \ - { K60, K61, K62, K63, K64, K65, K66, KC_NO }, \ - { K70, K71, K72, K73, K74, K75, K76, KC_NO } \ -} - -#define LAYOUT_60_hhkb LAYOUT - #define LAYOUT_JP( \ K02, K32, K62, K22, K12, K52, K72, KA2, K92, K82, KB2, KE2, KF2, KD2, KC2, \ K03, K63, K23, K13, K53, K73, KA3, K93, K83, KB3, KE3, KF3, KD3, \ @@ -47,6 +26,3 @@ { KC_NO, KC_NO, KE2, KE3, KE4, KE5, KE6, KC_NO }, \ { KC_NO, KC_NO, KF2, KF3, KF4, KF5, KF6, KC_NO } \ } - - -#endif diff --git a/keyboards/hhkb/keymaps/bakingpy/keymap.c b/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/bakingpy/keymap.c rename to keyboards/hhkb/jp/keymaps/bakingpy/keymap.c diff --git a/keyboards/hhkb/keymaps/bakingpy/rules.mk b/keyboards/hhkb/jp/keymaps/bakingpy/rules.mk similarity index 100% rename from keyboards/hhkb/keymaps/bakingpy/rules.mk rename to keyboards/hhkb/jp/keymaps/bakingpy/rules.mk diff --git a/keyboards/hhkb/keymaps/jp/keymap.c b/keyboards/hhkb/jp/keymaps/default/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/jp/keymap.c rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/halfqwerty_jp/rules.mk rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/jp_mac/keymap.c rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/jp/rules.mk rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/krusli/config.h rename to keyboards/hhkb/jp/keymaps/dhertz/config.h diff --git a/keyboards/hhkb/keymaps/dhertz/keymap.c b/keyboards/hhkb/jp/keymaps/dhertz/keymap.c similarity index 100% rename from keyboards/hhkb/keymaps/dhertz/keymap.c rename to keyboards/hhkb/jp/keymaps/dhertz/keymap.c diff --git a/keyboards/hhkb/keymaps/dhertz/keymap.h b/keyboards/hhkb/jp/keymaps/dhertz/keymap.h similarity index 100% rename from keyboards/hhkb/keymaps/dhertz/keymap.h rename to keyboards/hhkb/jp/keymaps/dhertz/keymap.h diff --git a/keyboards/hhkb/keymaps/dhertz/rules.mk b/keyboards/hhkb/jp/keymaps/dhertz/rules.mk similarity index 100% rename from keyboards/hhkb/keymaps/dhertz/rules.mk rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/enoch_jp/keymap.c rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/enoch_jp/rules.mk rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/halfqwerty_jp/README.md rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/halfqwerty_jp/keymap.c rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/jp_mac/rules.mk rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/rdg_jp/keymap.c rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/rdg_jp/rules.mk rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/sh_jp/README.md rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/sh_jp/keymap.c rename to 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 similarity index 100% rename from keyboards/hhkb/keymaps/sh_jp/rules.mk rename to 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 00000000000..96c85573df1 --- /dev/null +++ b/keyboards/hhkb/jp/keymaps/via/config.h @@ -0,0 +1,2 @@ +// 3 layers or else it will not fit in EEPROM +#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 00000000000..cb1ba76fb0e --- /dev/null +++ b/keyboards/hhkb/jp/keymaps/via/keymap.c @@ -0,0 +1,58 @@ +#include QMK_KEYBOARD_H + +/* Layer 0: HHKB JP + * ,-----------------------------------------------------------. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp| + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | + * |------------------------------------------------------` Ent| + * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| | + * |-----------------------------------------------------------| + * |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft| + * |-----------------------------------------------------------| + * | ||Ctl|Alt|Cmd| | Spc |Bsp| | | ||Lft|Dwn|Rgh| + * `-----------------------------------------------------------' + */ + +/* Layer 1: HHKB mode (HHKB Fn) + * ,-----------------------------------------------------------. + * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + * |-----------------------------------------------------------| + * |Caps | | | | | | | |Psc|Slk|Pus|Up | | | + * |------------------------------------------------------` | + * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | | + * |-----------------------------------------------------------| + * | | | | | | | +| -|End|PgD|Dow| | | | + * |-----------------------------------------------------------| + * | || | | | | | | | | || | | | + * `-----------------------------------------------------------' + */ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_JP( + 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, + 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_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, + 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, + 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), + + [1] = LAYOUT_JP( + 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, + KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______, + _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT, + _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [2] = LAYOUT_JP( + 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, + 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, 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, 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ) +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt) +{ + return MACRO_NONE; +} diff --git a/keyboards/hhkb/jp/keymaps/via/rules.mk b/keyboards/hhkb/jp/keymaps/via/rules.mk new file mode 100644 index 00000000000..1e5b99807cb --- /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 similarity index 99% rename from keyboards/hhkb/matrix.c rename to keyboards/hhkb/jp/matrix.c index 666b6f595f1..437356af6d2 100644 --- a/keyboards/hhkb/matrix.c +++ b/keyboards/hhkb/jp/matrix.c @@ -140,13 +140,10 @@ uint8_t matrix_scan(void) // NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE. // This takes 25us or more to make sure KEY_STATE returns to idle state. -#ifdef HHKB_JP + // Looks like JP needs faster scan due to its twice larger matrix // or it can drop keys in fast key typing _delay_us(30); -#else - _delay_us(75); -#endif } if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32(); } diff --git a/keyboards/hhkb/readme.md b/keyboards/hhkb/jp/readme.md similarity index 95% rename from keyboards/hhkb/readme.md rename to keyboards/hhkb/jp/readme.md index 57eb8143910..41c1d2214ea 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 Make example for this keyboard (after setting up your build environment): - make hhkb:default + make hhkb/jp:default See [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 00000000000..774b444c531 --- /dev/null +++ b/keyboards/hhkb/jp/rules.mk @@ -0,0 +1,69 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = atmel-dfu + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +CUSTOM_MATRIX = yes # Custom matrix file for the HHKB +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +# MIDI_ENABLE = yes # MIDI controls +# UNICODE_ENABLE = yes # Unicode +# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID + + +# HHKB_RN42_ENABLE = yes # Enable support for hasu's BT alt controller -- code borrowed from tmk source tree. + +# Either uncomment the HHKB_RN42_ENABLE line above, or run make enabling the +# feature. Be sure to clean any existing build before trying to enable rn42 +# support. For example: +# +# make hhkb-keymap-clean +# make hhkb-keymap-dfu HHKB_RN42_ENABLE=yes + +# project specific files +SRC = matrix.c + +ifeq ($(strip $(HHKB_RN42_ENABLE)), yes) + +OPT_DEFS += -DHHKB_RN42_ENABLE + +# Support for the RN42 Bluetooth module. This is the BT module in Hasu's BT +# HHKB Alt controller. +RN42_DIR = ../rn42 + +SRC += serial_uart.c \ + ../rn42/suart.S \ + ../rn42/rn42.c \ + ../rn42/rn42_task.c \ + ../rn42/battery.c \ + ../rn42/main.c + +VPATH += $(RN42_DIR) + +endif + + +# debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION +# debug-on: all + +# debug-off: EXTRAFLAGS += -DNO_DEBUG -DNO_PRINT +# debug-off: OPT_DEFS := $(filter-out -DCONSOLE_ENABLE,$(OPT_DEFS)) +# debug-off: all diff --git a/keyboards/infinity60/keymaps/jpetermans/keymap.c b/keyboards/infinity60/keymaps/jpetermans/keymap.c index c99b05e4c5c..a169d658f70 100644 --- a/keyboards/infinity60/keymaps/jpetermans/keymap.c +++ b/keyboards/infinity60/keymaps/jpetermans/keymap.c @@ -15,8 +15,6 @@ enum ic60_keycodes { NUMPAD, FNAV, MEDIA, - TILDE, - CTLALTDEL, BACKLIGHT, BRIGHT, DIM, @@ -55,7 +53,7 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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,\ 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, \ 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, \ - 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, \ + 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, \ KC_LCTL, KC_LGUI,KC_LALT, LT(_FNAV, KC_SPC), KC_RALT,TG(_NUMPAD),MO(_MEDIA), KC_RCTL \ ), @@ -74,7 +72,7 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_CAPS,_______,_______,_______,_______,_______,_______,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR,_______,_______,KC_DEL, \ _______,_______,KC_BTN2,_______,_______,_______,KC_HOME,KC_LEFT,KC_DOWN,KC_RGHT,KC_INS,_______,_______, \ _______,KC_APP,KC_BTN1,KC_CALC,_______,_______,KC_END,_______,_______,_______,_______,_______,KC_NO, \ - _______,_______,_______, _______, F(CTLALTDEL),KC_NLCK,_______,_______ \ + _______,_______,_______, _______, C(A(KC_DEL)),KC_NLCK,_______,_______ \ ), /* media */ @@ -162,8 +160,6 @@ uint8_t led_game[5] = { //======== qmk functions ========= const uint16_t fn_actions[] = { - [CTLALTDEL] = ACTION_KEY(LALT(LCTL(KC_DEL))), - [TILDE] = ACTION_LAYER_MODS(_TILDE, MOD_LSFT), [ALL] = ACTION_FUNCTION(ACTION_LEDS_ALL), [GAME] = ACTION_FUNCTION(ACTION_LEDS_GAME), [BACKLIGHT] = ACTION_FUNCTION(ACTION_LEDS_BACKLIGHT), diff --git a/keyboards/jd45/keymaps/justin/keymap.c b/keyboards/jd45/keymaps/justin/keymap.c index 1c0e780724d..985ff19b887 100644 --- a/keyboards/jd45/keymaps/justin/keymap.c +++ b/keyboards/jd45/keymaps/justin/keymap.c @@ -3,15 +3,22 @@ #define KC_MO1 MO(1) #define KC_MO2 MO(2) #define KC_MO3 MO(3) +#define KC_LM4 LM(4, MOD_LSFT) + +#define KC_MTCM MT(MOD_LCTL, KC_MINS) +#define KC_MTSG MT(MOD_LSFT, KC_GRV) +#define KC_MTSW MT(MOD_RSFT, KC_RGUI) +#define KC_MTSC MT(MOD_RSFT, KC_CAPS) +#define KC_MTCT MT(MOD_LCTL, KC_TAB) #define KC_BLTG BL_TOGG const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_kc( ESC, Q, W, F, P, G, J, L, U, Y, SCLN, QUOT, BSPC, - FN8, A, R, S, T, D, H, N, E, I, O, ENT, - LSFT, Z, X, C, V, B, K, M, COMM, DOT, SLSH, FN6, - FN4, LGUI, FN7, MO2, MO1, SPC, FN5, RALT, MO3, FN0), + MTCT, A, R, S, T, D, H, N, E, I, O, ENT, + LSFT, Z, X, C, V, B, K, M, COMM, DOT, SLSH, MTSC, + MTSG, LGUI, LM4, MO2, MO1, SPC, MTSW, RALT, MO3, MTCM), [1] = LAYOUT_kc( TRNS, FN10, FN11, FN12, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, UP, DEL, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, HOME, PGUP, LEFT, RGHT, @@ -42,13 +49,6 @@ enum macro_id }; const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_MINS), - [4] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_GRV), - [5] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_RGUI), - [6] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_CAPS), - [7] = ACTION_LAYER_MODS(4, MOD_LSFT), // FN4 - [8] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_TAB), - [10] = ACTION_MACRO(PSWD1), [11] = ACTION_MACRO(PSWD2), [12] = ACTION_MACRO(PSWD3) diff --git a/keyboards/jd45/keymaps/mjt6u/keymap.c b/keyboards/jd45/keymaps/mjt6u/keymap.c index 6fda6ac95fa..dc7c3bb7e32 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) { persistent_default_layer_set(1UL << _QWERTY); #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_fnpc, false, 0); + PLAY_SONG(tone_fnpc); #endif print("Space-FN"); } @@ -130,7 +130,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { persistent_default_layer_set(1UL << _QWERTYNUMMODS); #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_fnmac, false, 0); + PLAY_SONG(tone_fnmac); #endif print("Space-Numpad"); } diff --git a/keyboards/keebio/nyquist/keymaps/danielhklein/keymap.c b/keyboards/keebio/nyquist/keymaps/danielhklein/keymap.c index 14428812f2b..00f0bb3ced4 100644 --- a/keyboards/keebio/nyquist/keymaps/danielhklein/keymap.c +++ b/keyboards/keebio/nyquist/keymaps/danielhklein/keymap.c @@ -30,16 +30,9 @@ enum custom_keycodes { ARROW }; - // Enable these functions using FUNC(n) macro. - const uint16_t PROGMEM fn_actions[] = { - [0] = LT(_LOWER, KC_SPC), //Hold for momentary Lower layer, Tap for Backspace, - [1] = LT(_RAISE, KC_BSPC), //Hold for momentary Raise layer, Tap for Space, - [2] = MO(_ARROW), //Hold for momentary Arrow - }; - -#define SPC_LWR FUNC(0) -#define BSP_RSE FUNC(1) -#define ARW FUNC(2) +#define SPC_LWR LT(_LOWER, KC_SPC) +#define BSP_RSE LT(_RAISE, KC_BSPC) +#define ARW MO(_ARROW) // Underglow setup #define RGBLIGHT_SLEEP diff --git a/keyboards/keebio/viterbi/keymaps/bakingpy/keymap.c b/keyboards/keebio/viterbi/keymaps/bakingpy/keymap.c index f0122bef05a..ab8cf2a9ae2 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif persistent_default_layer_set(1UL<<_QWERTY); } @@ -167,7 +167,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_colemak, false, 0); + PLAY_SONG(tone_colemak); #endif persistent_default_layer_set(1UL<<_COLEMAK); } @@ -176,7 +176,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + PLAY_SONG(tone_dvorak); #endif persistent_default_layer_set(1UL<<_DVORAK); } diff --git a/keyboards/keebio/viterbi/keymaps/dwallace/keymap.c b/keyboards/keebio/viterbi/keymaps/dwallace/keymap.c index 5a797cb0bd0..c03cf970fd7 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif persistent_default_layer_set(1UL<<_QWERTY); } diff --git a/keyboards/keebio/viterbi/keymaps/mike808/keymap.c b/keyboards/keebio/viterbi/keymaps/mike808/keymap.c index e1dc91d2b2b..9922f1a555f 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif persistent_default_layer_set(1UL << _QWERTY); } @@ -137,7 +137,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + PLAY_SONG(tone_dvorak); #endif persistent_default_layer_set(1UL << _DVORAK); } diff --git a/keyboards/model01/config.h b/keyboards/keyboardio/model01/config.h similarity index 100% rename from keyboards/model01/config.h rename to keyboards/keyboardio/model01/config.h diff --git a/keyboards/model01/info.json b/keyboards/keyboardio/model01/info.json similarity index 98% rename from keyboards/model01/info.json rename to keyboards/keyboardio/model01/info.json index 60c914d5c04..66bea171d22 100644 --- a/keyboards/model01/info.json +++ b/keyboards/keyboardio/model01/info.json @@ -1,6 +1,6 @@ { "keyboard_name": "model01", - "keyboard_folder": "model01", + "keyboard_folder": "keyboardio/model01", "url": "https://keyboard.io", "maintainer": "qmk", "width": 18.5, diff --git a/keyboards/model01/keymaps/default/config.h b/keyboards/keyboardio/model01/keymaps/default/config.h similarity index 100% rename from keyboards/model01/keymaps/default/config.h rename to keyboards/keyboardio/model01/keymaps/default/config.h diff --git a/keyboards/model01/keymaps/default/keymap.c b/keyboards/keyboardio/model01/keymaps/default/keymap.c similarity index 100% rename from keyboards/model01/keymaps/default/keymap.c rename to keyboards/keyboardio/model01/keymaps/default/keymap.c diff --git a/keyboards/model01/keymaps/default/readme.md b/keyboards/keyboardio/model01/keymaps/default/readme.md similarity index 100% rename from keyboards/model01/keymaps/default/readme.md rename to keyboards/keyboardio/model01/keymaps/default/readme.md diff --git a/keyboards/model01/keymaps/dshields/config.h b/keyboards/keyboardio/model01/keymaps/dshields/config.h similarity index 100% rename from keyboards/model01/keymaps/dshields/config.h rename to keyboards/keyboardio/model01/keymaps/dshields/config.h diff --git a/keyboards/model01/keymaps/dshields/keymap.c b/keyboards/keyboardio/model01/keymaps/dshields/keymap.c similarity index 100% rename from keyboards/model01/keymaps/dshields/keymap.c rename to keyboards/keyboardio/model01/keymaps/dshields/keymap.c diff --git a/keyboards/model01/keymaps/dshields/readme.md b/keyboards/keyboardio/model01/keymaps/dshields/readme.md similarity index 100% rename from keyboards/model01/keymaps/dshields/readme.md rename to keyboards/keyboardio/model01/keymaps/dshields/readme.md diff --git a/keyboards/model01/keymaps/tw1t611/config.h b/keyboards/keyboardio/model01/keymaps/tw1t611/config.h similarity index 100% rename from keyboards/model01/keymaps/tw1t611/config.h rename to keyboards/keyboardio/model01/keymaps/tw1t611/config.h diff --git a/keyboards/model01/keymaps/tw1t611/keymap.c b/keyboards/keyboardio/model01/keymaps/tw1t611/keymap.c similarity index 100% rename from keyboards/model01/keymaps/tw1t611/keymap.c rename to keyboards/keyboardio/model01/keymaps/tw1t611/keymap.c diff --git a/keyboards/model01/keymaps/tw1t611/readme.md b/keyboards/keyboardio/model01/keymaps/tw1t611/readme.md similarity index 100% rename from keyboards/model01/keymaps/tw1t611/readme.md rename to keyboards/keyboardio/model01/keymaps/tw1t611/readme.md diff --git a/keyboards/model01/leds.c b/keyboards/keyboardio/model01/leds.c similarity index 100% rename from keyboards/model01/leds.c rename to keyboards/keyboardio/model01/leds.c diff --git a/keyboards/model01/leds.h b/keyboards/keyboardio/model01/leds.h similarity index 100% rename from keyboards/model01/leds.h rename to keyboards/keyboardio/model01/leds.h diff --git a/keyboards/model01/matrix.c b/keyboards/keyboardio/model01/matrix.c similarity index 100% rename from keyboards/model01/matrix.c rename to keyboards/keyboardio/model01/matrix.c diff --git a/keyboards/model01/model01.c b/keyboards/keyboardio/model01/model01.c similarity index 100% rename from keyboards/model01/model01.c rename to keyboards/keyboardio/model01/model01.c diff --git a/keyboards/model01/model01.h b/keyboards/keyboardio/model01/model01.h similarity index 100% rename from keyboards/model01/model01.h rename to keyboards/keyboardio/model01/model01.h diff --git a/keyboards/model01/readme.md b/keyboards/keyboardio/model01/readme.md similarity index 84% rename from keyboards/model01/readme.md rename to keyboards/keyboardio/model01/readme.md index 34bd291e2ed..5f55a881287 100644 --- a/keyboards/model01/readme.md +++ b/keyboards/keyboardio/model01/readme.md @@ -2,13 +2,13 @@ A split keyboard. -Keyboard Maintainer: QMK Community -Hardware Supported: Keyboardio Model 01 -Hardware Availability: [Keyboardio](https://shop.keyboard.io) +* Keyboard Maintainer: QMK Community +* Hardware Supported: Keyboardio Model 01 +* Hardware Availability: [Keyboardio](https://shop.keyboard.io) Make example for this keyboard (after setting up your build environment): - make model01:default + make keyboardio/model01:default See 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). @@ -17,7 +17,7 @@ Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/ne To program the keyboard, if you have avrdude installed: - make model01:default:avrdude + make keyboardio/model01:default:flash When prompted to reset your keyboard, press the prog key at upper left. If the keyboard 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 similarity index 100% rename from keyboards/model01/rules.mk rename to keyboards/keyboardio/model01/rules.mk diff --git a/keyboards/model01/wire-protocol-constants.h b/keyboards/keyboardio/model01/wire-protocol-constants.h similarity index 100% rename from keyboards/model01/wire-protocol-constants.h rename to keyboards/keyboardio/model01/wire-protocol-constants.h diff --git a/keyboards/keyboardio/readme.md b/keyboards/keyboardio/readme.md new file mode 100644 index 00000000000..d9ce48c2362 --- /dev/null +++ b/keyboards/keyboardio/readme.md @@ -0,0 +1,18 @@ +# Keyboardio + +Keyboardio are an US-based Keyboard maker, known for their +[Model01](https://shop.keyboard.io/collections/frontpage/products/model-01-keyboard), +and more recently, the Keyboardio +[Atreus](https://www.kickstarter.com/projects/keyboardio/atreus) keyboards. + +## Online Stores + +**Website:** https://shop.keyboard.io/ + +## Social Media + +**Discord:** https://discord.gg/4az77sf +**Forums:** https://community.keyboard.io/ +**Twitter:** https://twitter.com/keyboardio +**Facebook:** https://facebook.com/keyboardio +**Blog:** https://blog.keyboard.io/ diff --git a/keyboards/kinesis/keymaps/milestogo/keymap.c b/keyboards/kinesis/keymaps/milestogo/keymap.c index 024df591271..8c01bcb83dc 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] = { KC_TAB, KC_Q ,KC_W ,KC_E ,KC_R ,KC_T , TT(_MOUSE) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G , KC_LSFT,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B , - KC_GRAVE, KC_ESC, KC_FN4, LT(_SYMB, KC_RIGHT), + KC_GRAVE, KC_ESC, MT(MOD_LGUI,KC_LEFT), LT(_SYMB, KC_RIGHT), KC_LCTL,KC_LALT, KC_DEL, KC_BSPC, KC_DEL ,TT(_MOUSE) , - KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,TT(_MOUSE) ,KC_FN1 ,TT(_SYMB), KC_NO, RESET, + KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,TT(_MOUSE) ,TG(_MOUSE) ,TT(_SYMB), KC_NO, RESET, KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS, KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS, KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT, KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_RSFT, - LT(_SYMB, KC_UP), KC_FN7, KC_LBRC ,KC_RBRC, + LT(_SYMB, KC_UP), MT(MOD_LGUI,KC_DOWN), KC_LBRC ,KC_RBRC, KC_RALT,KC_RGUI, KC_PGUP, KC_PGDN,KC_ENTER ,KC_SPC @@ -101,7 +101,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_CIRC, KC_LCBR, KC_RCBR, KC_AT, KC_PERC, _______, KC_EXLM, KC_HASH, KC_0, KC_EQL, KC_TILD, _______, KC_6, KC_7, KC_8, KC_9, KC_PIPE, - _______, KC_COLON, KC_FN4, LT(_SYMB, KC_RIGHT), + _______, KC_COLON, MT(MOD_LGUI,KC_LEFT), LT(_SYMB, KC_RIGHT), _______, _______, _______, _______, _______, RESET, @@ -110,7 +110,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_AMPR, KC_LBRC, KC_LPRN, KC_RPRN, KC_UNDS, _______, KC_ASTR, KC_PLUS, KC_1, KC_MINS, KC_RBRC, KC_GRV, KC_DLR, KC_2, KC_3, KC_4, KC_5, XXXXXXX, - LT(_SYMB, KC_UP), KC_FN7, KC_BSLS, XXXXXXX, + LT(_SYMB, KC_UP), MT(MOD_LGUI,KC_DOWN), KC_BSLS, XXXXXXX, _______, _______, _______, _______, _______, _______ @@ -149,7 +149,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_SLSH, RSFT(KC_COMM), RSFT(KC_DOT), _______, _______, _______, _______, RSFT(KC_LBRC), RSFT(KC_RBRC), _______, _______, _______, KC_EQL, RSFT(KC_9), RSFT(KC_0), _______, _______, - _______, _______, KC_FN4, LT(_SYMB, KC_RIGHT), + _______, _______, MT(MOD_LGUI,KC_LEFT), LT(_SYMB, KC_RIGHT), _______, _______, _______, _______, _______, RESET, @@ -158,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, KC_PLUS, KC_MINS, _______, _______, _______, _______, KC_EQL, KC_PIPE, _______, _______, _______, _______, _______, _______, _______, _______, - LT(_SYMB, KC_UP), KC_FN7, _______, _______, + LT(_SYMB, KC_UP), MT(MOD_LGUI,KC_DOWN), _______, _______, _______, _______, _______, _______, _______, _______ @@ -192,7 +192,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_EXLM ,KC_AT, KC_HASH, KC_DLR ,KC_PERC , _______, KC_NO, KC_NO, KC_UP, KC_NO, KC_PGUP, - KC_FN1, LGUI(KC_Z),LGUI(KC_X),LGUI(KC_C),LGUI(KC_V), KC_NO, + TG(_MOUSE), LGUI(KC_Z),LGUI(KC_X),LGUI(KC_C),LGUI(KC_V), KC_NO, _______, KC_NO, KC_NO, KC_UP, KC_NO, KC_PGDN, _______, _______, KC_NO, KC_NO, _______, _______, @@ -261,16 +261,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; - - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_TOGGLE(_MOUSE) , - [4]= ACTION_MODS_TAP_KEY(MOD_LGUI,KC_LEFT), - [7]= ACTION_MODS_TAP_KEY(MOD_LGUI,KC_DOWN), - - -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // 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 b0394659cc5..a7fa4f55d32 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif persistent_default_layer_set(1UL<<_QWERTY); } @@ -161,7 +161,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_colemak, false, 0); + PLAY_SONG(tone_colemak); #endif persistent_default_layer_set(1UL<<_COLEMAK); } @@ -170,7 +170,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + PLAY_SONG(tone_dvorak); #endif persistent_default_layer_set(1UL<<_DVORAK); } diff --git a/keyboards/lets_split/keymaps/piemod/keymap.c b/keyboards/lets_split/keymaps/piemod/keymap.c index d789b7a8be8..68e7e0ba05e 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] = { 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, \ 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, \ 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, \ - 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 \ + 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 \ ), [_ARROW] = LAYOUT( \ @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_SYMBOL] = LAYOUT( \ KC_TILD, KC_GRAVE, KC_NO, KC_EQUAL, KC_PLUS, KC_NO, KC_LBRACKET, KC_RBRACKET, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \ - KC_NO, KC_NO, KC_TRNS, KC_SCOLON, KC_COLN, KC_NO, KC_LCBR, KC_RCBR, KC_DLR, KC_PERC, KC_CIRC, F(2), \ + 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), \ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLASH, KC_SLASH, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, \ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ASTR, KC_SLASH, KC_MINUS, KC_PLUS, KC_EQUAL \ ), @@ -81,19 +81,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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 \ ) }; - -enum function_id { - TEENSY_KEY, - CUSTOM_KEY, - L_CTRL_ALT_ENT, - R_CTRL_ALT_ENT, -}; - -int CAPSLOCKED = 0; - - const uint16_t PROGMEM fn_actions[] = { - // Special Keys - [1] = ACTION_MODS_KEY(KC_LCTRL, KC_LALT), // FN10 = Ctrl + Alt. - // Symbols - [2] = ACTION_MODS_KEY(MOD_LSFT, KC_SLASH), // FN21 = Question mark. - }; diff --git a/keyboards/lily58/config.h b/keyboards/lily58/config.h index 50bf2beb325..0bdaa1f76e7 100644 --- a/keyboards/lily58/config.h +++ b/keyboards/lily58/config.h @@ -19,10 +19,11 @@ along with this program. If not, see . #pragma once #include "config_common.h" -#include -#define USE_I2C -#define USE_SERIAL +#ifndef SOFT_SERIAL_PIN +#define SOFT_SERIAL_PIN D2 +#define SERIAL_USE_MULTI_TRANSACTION +#endif #if !defined(NO_ACTION_MACRO) #define NO_ACTION_MACRO @@ -30,3 +31,8 @@ along with this program. If not, see . #if !defined(NO_ACTION_FUNCTION) #define NO_ACTION_FUNCTION #endif + +#define DIODE_DIRECTION COL2ROW + +// Use the lily version to get the Lily58 logo instead of the qmk logo +#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 4bee5c63982..00000000000 --- a/keyboards/lily58/i2c.c +++ /dev/null @@ -1,162 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "i2c.h" - -#ifdef USE_I2C - -// Limits the amount of we wait for any one i2c transaction. -// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is -// 9 bits, a single transaction will take around 90μs to complete. -// -// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit -// poll loop takes at least 8 clock cycles to execute -#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 - -#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) - -volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -static volatile uint8_t slave_buffer_pos; -static volatile bool slave_has_register_set = false; - -// Wait for an i2c operation to finish -inline static -void i2c_delay(void) { - uint16_t lim = 0; - while(!(TWCR & (1<10. - // Check datasheets for more info. - TWBR = ((F_CPU/SCL_CLOCK)-16)/2; -} - -// Start a transaction with the given i2c slave address. The direction of the -// transfer is set with I2C_READ and I2C_WRITE. -// returns: 0 => success -// 1 => error -uint8_t i2c_master_start(uint8_t address) { - TWCR = (1< slave ACK -// 1 => slave NACK -uint8_t i2c_master_write(uint8_t data) { - TWDR = data; - TWCR = (1<= SLAVE_BUFFER_SIZE ) { - ack = 0; - slave_buffer_pos = 0; - } - slave_has_register_set = true; - } else { - i2c_slave_buffer[slave_buffer_pos] = TWDR; - BUFFER_POS_INC(); - } - break; - - case TW_ST_SLA_ACK: - case TW_ST_DATA_ACK: - // master has addressed this device as a slave transmitter and is - // requesting data. - TWDR = i2c_slave_buffer[slave_buffer_pos]; - BUFFER_POS_INC(); - break; - - case TW_BUS_ERROR: // something went wrong, reset twi state - TWCR = 0; - default: - break; - } - // Reset everything, so we are ready for the next TWI interrupt - TWCR |= (1< - -#ifndef F_CPU -#define F_CPU 16000000UL -#endif - -#define I2C_READ 1 -#define I2C_WRITE 0 - -#define I2C_ACK 1 -#define I2C_NACK 0 - -#define SLAVE_BUFFER_SIZE 0x10 - -// i2c SCL clock frequency 400kHz -#define SCL_CLOCK 400000L - -extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -void i2c_master_init(void); -uint8_t i2c_master_start(uint8_t address); -void i2c_master_stop(void); -uint8_t i2c_master_write(uint8_t data); -uint8_t i2c_master_read(int); -void i2c_reset_state(void); -void i2c_slave_init(uint8_t address); - - -static inline unsigned char i2c_start_read(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_READ); -} - -static inline unsigned char i2c_start_write(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_WRITE); -} - -// from SSD1306 scrips -extern unsigned char i2c_rep_start(unsigned char addr); -extern void i2c_start_wait(unsigned char addr); -extern unsigned char i2c_readAck(void); -extern unsigned char i2c_readNak(void); -extern unsigned char i2c_read(unsigned char ack); - -#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 00000000000..fa93060db16 --- /dev/null +++ b/keyboards/lily58/keymaps/chuan/config.h @@ -0,0 +1,64 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#pragma once + +// #define USE_MATRIX_I2C + +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +// #define SSD1306OLED + +#define USE_SERIAL_PD2 + +#define TAPPING_FORCE_HOLD + +/* define tapping term */ +#define TAPPING_TERM 200 + + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 27 +#define RGBLIGHT_LIMIT_VAL 120 +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + +#define ENCODERS_PAD_A { F4 } +#define ENCODERS_PAD_B { F5 } + + + /* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +// Underglow +/* +#undef RGBLED_NUM +#define RGBLED_NUM 14 // Number of LEDs +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_SLEEP +*/ diff --git a/keyboards/lily58/keymaps/chuan/keymap.c b/keyboards/lily58/keymaps/chuan/keymap.c new file mode 100644 index 00000000000..da49e67a0eb --- /dev/null +++ b/keyboards/lily58/keymaps/chuan/keymap.c @@ -0,0 +1,230 @@ +#include QMK_KEYBOARD_H + +#ifdef RGBLIGHT_ENABLE +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; +#endif + +extern uint8_t is_master; + +#define _QWERTY 0 +#define _LOWER 1 +#define _RAISE 2 +#define _ADJUST 3 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + LOWER, + RAISE, + ADJUST, +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* QWERTY + * ,-----------------------------------------. ,-----------------------------------------. + * | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | ` | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | | Y | U | I | O | P | - | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * |HYPER | A | S | D | F | G |-------. ,-------| H | J | K | L | ; | ' | + * |------+------+------+------+------+------| - | | + |------+------+------+------+------+------| + * |LShift| Z | X | C | V | B |-------| |-------| N | M | , | . | / |RShift| + * `-----------------------------------------/ / \ \-----------------------------------------' + * | LCtl | LGUI |LALT | /Space / \Space \ |RAISE | [ | ] | + * | | | |/ LOWER / \ \ | ' | | | + * `----------------------------' '------''--------------------' + */ + + [_QWERTY] = LAYOUT( + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, \ + 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, \ + 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, \ + KC_LCTRL, KC_LGUI, KC_LALT,LT(_LOWER, KC_SPC), KC_SPC, LT(2,KC_QUOT), KC_LBRC, KC_RBRC \ +), +/* LOWER + * ,-----------------------------------------. ,-----------------------------------------. + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ` | ! | @ | # | $ | % |-------. ,-------| ^ | & | * | ( | ) | - | + * |------+------+------+------+------+------| cmd spc| | |------+------+------+------+------+------| + * | | | |ctrl c| | |-------| |-------| | - | _ | [ | ] | | | + * `-----------------------------------------/ / \ \-----------------------------------------' + * | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE | { | } | + * | | | |/ / \ \ | | | | + * `----------------------------' '------''--------------------' + */ +[_LOWER] = LAYOUT( + KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_TILD, \ + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______,\ + _______, _______, _______, C(KC_C), _______, _______, LGUI(KC_SPC), _______, _______, KC_MINS, KC_UNDS , KC_LBRC, KC_RBRC, KC_PIPE, \ + _______, _______, _______, _______, _______, RAISE, KC_LCBR, KC_RCBR\ +), +/* RAISE + * ,-----------------------------------------. ,-----------------------------------------. + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | F1 | F2 | F3 | F4 | F5 | F6 |-------. ,-------| | Left | Down | Up |Right | | + * |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------| + * | F7 | F8 | F9 | F10 | F11 | F12 |-------| |-------| + | - | = | [ | ] | \ | + * `-----------------------------------------/ / \ \-----------------------------------------' + * | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE |BackSP| RGUI | + * | | | |/ / \ \ | | | | + * `----------------------------' '------''--------------------' + */ + +[_RAISE] = LAYOUT( + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC_DEL, _______, \ + 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, _______, \ + _______, _______, _______, _______, _______, _______, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, KC_RGHT, XXXXXXX, \ + _______, _______, _______, _______, _______, _______, _______, TG(_ADJUST),KC_PLUS, KC_MUTE ,KC_VOLD ,KC_VOLU, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______ \ +), +/* ADJUST + * ,-----------------------------------------. ,-----------------------------------------. + * | | | | | | | | | 7 | 8 | 9 |RGB ON| HUE+ | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | 4 | 5 | 6 | MODE | HUE- | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | |-------. ,-------| | 1 | 2 | 3 | SAT+ | VAL+ | + * |------+------+------+------+------+------| | |DEFAULT|------+------+------+------+------+------| + * | | | | | | |-------| |-------| | 0 | 0 | . | SAT- | VAL- | + * `-----------------------------------------/ / \ \-----------------------------------------' + * | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE |BackSP| RGUI | + * | | | |/ / \ \ | | | | + * `----------------------------' '------''--------------------' + */ + [_ADJUST] = LAYOUT( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_7 , KC_8 , KC_9 , RGB_TOG, RGB_HUI, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_4 , KC_5 , KC_6 , RGB_MOD, RGB_HUD, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_1 , KC_2 , KC_3 , RGB_SAI, RGB_VAI, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(_ADJUST), XXXXXXX, KC_0 , KC_0 , KC_DOT, RGB_SAD, RGB_VAD,\ + _______, _______, _______, _______, _______, _______,KC_BSPC, _______ \ + ) +}; + +int RGB_current_mode; + +int counter = 0; +int lastIndex = 9; + +// Setting ADJUST layer RGB back to default +void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { + layer_on(layer3); + } else { + layer_off(layer3); + } +} + +void matrix_init_user(void) { + #ifdef RGBLIGHT_ENABLE + RGB_current_mode = rgblight_config.mode; + #endif +} + +#ifdef OLED_DRIVER_ENABLE + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (!is_keyboard_master()) + return OLED_ROTATION_180; // flips the display 180 degrees if offhand + return rotation; +} + +// When add source files to SRC in rules.mk, you can use functions. +const char *read_layer_state(void); +const char *read_logo(void); +void set_keylog(uint16_t keycode, keyrecord_t *record); +const char *read_keylog(void); +const char *read_keylogs(void); + +const char *read_mode_icon(bool swap); +const char *read_host_led_state(void); +void set_timelog(void); +const char *read_timelog(void); + +char encoder_debug[24]; + +void oled_task_user(void) { + // Host Keyboard Layer Status + snprintf(encoder_debug, sizeof(encoder_debug), "%i %i", counter, lastIndex ); + if (is_keyboard_master()) { + // If you want to change the display of OLED, you need to change here + oled_write_ln(read_layer_state(), false); + // oled_write_ln(read_keylog(), false); + // oled_write_ln(read_keylogs(), false); + // oled_write_ln(read_mode_icon(keymap_config.swap_lalt_lgui), false); + oled_write_ln(read_host_led_state(), false); + oled_write_ln(encoder_debug, false); + // oled_write_ln(read_timelog(), false); + } else { + oled_write(read_logo(), false); + // oled_write_ln(encoder_debug, false); + } +} +#endif //OLED_DRIVER_ENABLE + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { +#ifdef SSD1306OLED + // set_keylog(keycode, record); +#endif + // set_timelog(); + } + + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} + +void encoder_update_user(uint8_t index, bool clockwise) { + lastIndex = index; + if (clockwise) { + counter++; + tap_code(KC_PGDN); + } else { + counter--; + tap_code(KC_PGUP); + } +} diff --git a/keyboards/lily58/keymaps/chuan/rules.mk b/keyboards/lily58/keymaps/chuan/rules.mk new file mode 100644 index 00000000000..3e05cb7d920 --- /dev/null +++ b/keyboards/lily58/keymaps/chuan/rules.mk @@ -0,0 +1,11 @@ +EXTRAKEY_ENABLE = yes +NKRO_ENABLE = yes +ENCODER_ENABLE = yes +# If you want to change the display of OLED, you need to change here +SRC += ./lib/rgb_state_reader.c \ + ./lib/layer_state_reader.c \ + ./lib/logo_reader.c \ + ./lib/mode_icon_reader.c \ + ./lib/host_led_state_reader.c \ + ./lib/timelogger.c \ + ./lib/keylogger.c \ diff --git a/keyboards/lily58/keymaps/default/config.h b/keyboards/lily58/keymaps/default/config.h index 58bbdc5e9d0..6b9e52c05ee 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 . // #define MASTER_RIGHT // #define EE_HANDS -#define SSD1306OLED - #define USE_SERIAL_PD2 #define TAPPING_FORCE_HOLD @@ -49,4 +47,4 @@ along with this program. If not, see . #define RGBLED_NUM 14 // Number of LEDs #define RGBLIGHT_ANIMATIONS #define RGBLIGHT_SLEEP -*/ \ No newline at end of file +*/ diff --git a/keyboards/lily58/keymaps/default/keymap.c b/keyboards/lily58/keymaps/default/keymap.c index f36248e12d3..f0fbaa8b0d2 100644 --- a/keyboards/lily58/keymaps/default/keymap.c +++ b/keyboards/lily58/keymaps/default/keymap.c @@ -8,8 +8,6 @@ #include "ssd1306.h" #endif - - #ifdef RGBLIGHT_ENABLE //Following line allows macro to read current RGB settings extern rgblight_config_t rgblight_config; @@ -135,16 +133,18 @@ void matrix_init_user(void) { #ifdef RGBLIGHT_ENABLE RGB_current_mode = rgblight_config.mode; #endif - //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h - #ifdef SSD1306OLED - iota_gfx_init(!has_usb()); // turns on the display - #endif } -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#ifdef SSD1306OLED +//SSD1306 OLED update loop, make sure to enable OLED_DRIVER_ENABLE=yes in rules.mk +#ifdef OLED_DRIVER_ENABLE -// When add source files to SRC in rules.mk, you can use functions. +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (!is_keyboard_master()) + return OLED_ROTATION_180; // flips the display 180 degrees if offhand + return rotation; +} + +// When you add source files to SRC in rules.mk, you can use functions. const char *read_layer_state(void); const char *read_logo(void); void set_keylog(uint16_t keycode, keyrecord_t *record); @@ -156,42 +156,24 @@ const char *read_keylogs(void); // void set_timelog(void); // const char *read_timelog(void); -void matrix_scan_user(void) { - iota_gfx_task(); -} - -void matrix_render_user(struct CharacterMatrix *matrix) { - if (is_master) { +void oled_task_user(void) { + if (is_keyboard_master()) { // If you want to change the display of OLED, you need to change here - matrix_write_ln(matrix, read_layer_state()); - matrix_write_ln(matrix, read_keylog()); - matrix_write_ln(matrix, read_keylogs()); - //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui)); - //matrix_write_ln(matrix, read_host_led_state()); - //matrix_write_ln(matrix, read_timelog()); + oled_write_ln(read_layer_state(), false); + oled_write_ln(read_keylog(), false); + oled_write_ln(read_keylogs(), false); + //oled_write_ln(read_mode_icon(keymap_config.swap_lalt_lgui), false); + //oled_write_ln(read_host_led_state(), false); + //oled_write_ln(read_timelog(), false); } else { - matrix_write(matrix, read_logo()); - } -} - -void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; + oled_write(read_logo(), false); } } - -void iota_gfx_task_user(void) { - struct CharacterMatrix matrix; - matrix_clear(&matrix); - matrix_render_user(&matrix); - matrix_update(&display, &matrix); -} -#endif//SSD1306OLED +#endif // OLED_DRIVER_ENABLE bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { -#ifdef SSD1306OLED +#ifdef OLED_DRIVER_ENABLE set_keylog(keycode, record); #endif // set_timelog(); diff --git a/keyboards/lily58/keymaps/default/rules.mk b/keyboards/lily58/keymaps/default/rules.mk index b39305767b8..a5b6303a1e1 100644 --- a/keyboards/lily58/keymaps/default/rules.mk +++ b/keyboards/lily58/keymaps/default/rules.mk @@ -15,13 +15,13 @@ UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing +OLED_DRIVER_ENABLE= yes # OLED display # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend # If you want to change the display of OLED, you need to change here -SRC += ./lib/glcdfont.c \ - ./lib/rgb_state_reader.c \ +SRC += ./lib/rgb_state_reader.c \ ./lib/layer_state_reader.c \ ./lib/logo_reader.c \ ./lib/keylogger.c \ diff --git a/keyboards/lily58/keymaps/yuchi/keymap.c b/keyboards/lily58/keymaps/yuchi/keymap.c index 13b6cb1687e..d258fbcbc04 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] = { * |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE | * | | | |/ / \ \ | | | | * `----------------------------' '------''--------------------' - */ + */ [_ADJUST] = LAYOUT( \ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ @@ -137,14 +137,16 @@ void matrix_init_user(void) { #ifdef RGBLIGHT_ENABLE RGB_current_mode = rgblight_config.mode; #endif - //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h - #ifdef SSD1306OLED - iota_gfx_init(!has_usb()); // turns on the display - #endif } -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#ifdef SSD1306OLED +//SSD1306 OLED update loop, make sure to enable OLED_DRIVER_ENABLE=yes in rules.mk +#ifdef OLED_DRIVER_ENABLE + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (!is_keyboard_master()) + return OLED_ROTATION_180; // flips the display 180 degrees if offhand + return rotation; +} // When add source files to SRC in rules.mk, you can use functions. const char *read_layer_state(void); @@ -165,35 +167,22 @@ void matrix_scan_user(void) { void matrix_render_user(struct CharacterMatrix *matrix) { if (is_master) { // If you want to change the display of OLED, you need to change here - matrix_write_ln(matrix, read_layer_state()); - matrix_write_ln(matrix, read_keylog()); - matrix_write_ln(matrix, read_keylogs()); - //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui)); - //matrix_write_ln(matrix, read_host_led_state()); - //matrix_write_ln(matrix, read_timelog()); + oled_write_ln(read_layer_state(), false); + oled_write_ln(read_keylog(), false); + oled_write_ln(read_keylogs(), false); + //oled_write_ln(read_mode_icon(keymap_config.swap_lalt_lgui), false); + //oled_write_ln(read_host_led_state(), false); + //oled_write_ln(read_timelog(), false); } else { - matrix_write(matrix, read_logo()); + oled_write(read_logo(), false); } } -void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} - -void iota_gfx_task_user(void) { - struct CharacterMatrix matrix; - matrix_clear(&matrix); - matrix_render_user(&matrix); - matrix_update(&display, &matrix); -} #endif//SSD1306OLED bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { -#ifdef SSD1306OLED +#ifdef OLED_DRIVER_ENABLE set_keylog(keycode, record); #endif // set_timelog(); @@ -236,4 +225,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; } return true; -} \ No newline at end of file +} diff --git a/keyboards/lily58/keymaps/yuchi/rules.mk b/keyboards/lily58/keymaps/yuchi/rules.mk index 922fac6b69f..0db9ac50fa1 100644 --- a/keyboards/lily58/keymaps/yuchi/rules.mk +++ b/keyboards/lily58/keymaps/yuchi/rules.mk @@ -13,15 +13,14 @@ MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend # If you want to change the display of OLED, you need to change here -SRC += ./lib/glcdfont.c \ - ./lib/rgb_state_reader.c \ +SRC += ./lib/rgb_state_reader.c \ ./lib/layer_state_reader.c \ ./lib/logo_reader.c \ ./lib/keylogger.c \ diff --git a/keyboards/lily58/lib/glcdfont.c b/keyboards/lily58/lib/glcdfont_lily.c similarity index 99% rename from keyboards/lily58/lib/glcdfont.c rename to keyboards/lily58/lib/glcdfont_lily.c index 94f026ba971..0aa69ea8226 100644 --- a/keyboards/lily58/lib/glcdfont.c +++ b/keyboards/lily58/lib/glcdfont_lily.c @@ -1,6 +1,7 @@ // This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. // See gfxfont.h for newer custom bitmap font info. +// Modified to show the Lily58 logo instead of the qmk logo #include "progmem.h" // 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 0e22173b1d8..589dd6152eb 100644 --- a/keyboards/lily58/lib/host_led_state_reader.c +++ b/keyboards/lily58/lib/host_led_state_reader.c @@ -1,15 +1,16 @@ #include +#include "led.h" +#include "host.h" #include "lily58.h" char host_led_state_str[24]; const char *read_host_led_state(void) { - uint8_t leds = host_keyboard_leds(); snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s", - (leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ", - (leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ", - (leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- "); + (IS_HOST_LED_ON(USB_LED_NUM_LOCK)) ? "on" : "- ", + (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) ? "on" : "- ", + (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) ? "on" : "- "); return host_led_state_str; } diff --git a/keyboards/lily58/lib/keylogger.c b/keyboards/lily58/lib/keylogger.c index a1bd476d20b..2fc3e663eca 100644 --- a/keyboards/lily58/lib/keylogger.c +++ b/keyboards/lily58/lib/keylogger.c @@ -1,4 +1,5 @@ #include +#include "action.h" #include "lily58.h" char keylog_str[24] = {}; diff --git a/keyboards/lily58/lib/layer_state_reader.c b/keyboards/lily58/lib/layer_state_reader.c index 48674b0673a..0e9dd7039bb 100644 --- a/keyboards/lily58/lib/layer_state_reader.c +++ b/keyboards/lily58/lib/layer_state_reader.c @@ -4,10 +4,10 @@ #include "lily58.h" #define L_BASE 0 -#define L_LOWER 2 -#define L_RAISE 4 -#define L_ADJUST 8 -#define L_ADJUST_TRI 14 +#define L_LOWER (1 << 1) +#define L_RAISE (1 << 2) +#define L_ADJUST (1 << 3) +#define L_ADJUST_TRI (L_ADJUST | L_RAISE | L_LOWER) char layer_state_str[24]; diff --git a/keyboards/lily58/lib/mode_icon_reader.c b/keyboards/lily58/lib/mode_icon_reader.c index 2bce4a71b0e..27c6d92cd04 100644 --- a/keyboards/lily58/lib/mode_icon_reader.c +++ b/keyboards/lily58/lib/mode_icon_reader.c @@ -1,4 +1,5 @@ #include +#include #include "lily58.h" char mode_icon[24]; diff --git a/keyboards/lily58/lib/timelogger.c b/keyboards/lily58/lib/timelogger.c index bfbfbe8a214..b00c13cb0ab 100644 --- a/keyboards/lily58/lib/timelogger.c +++ b/keyboards/lily58/lib/timelogger.c @@ -1,4 +1,5 @@ #include +#include "timer.h" #include "lily58.h" char timelog_str[24] = {}; diff --git a/keyboards/lily58/lily58.c b/keyboards/lily58/lily58.c index eacd90a82de..03975057f40 100644 --- a/keyboards/lily58/lily58.c +++ b/keyboards/lily58/lily58.c @@ -1,10 +1,5 @@ #include "lily58.h" -#include "ssd1306.h" bool process_record_kb(uint16_t keycode, keyrecord_t *record) { -#ifdef SSD1306OLED - return process_record_gfx(keycode,record) && process_record_user(keycode, record); -#else return process_record_user(keycode, record); -#endif -} \ No newline at end of file +} diff --git a/keyboards/lily58/rev1/config.h b/keyboards/lily58/rev1/config.h index 4e8e3a7c9cd..adcf11b52bc 100644 --- a/keyboards/lily58/rev1/config.h +++ b/keyboards/lily58/rev1/config.h @@ -36,8 +36,6 @@ along with this program. If not, see . #define MATRIX_ROW_PINS { C6, D7, E6, B4, B5 } #define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } -/* define tapping term */ -#define TAPPING_TERM 100 /* define if matrix has ghost */ //#define MATRIX_HAS_GHOST diff --git a/keyboards/lily58/rev1/rules.mk b/keyboards/lily58/rev1/rules.mk index 6028b5a5b95..e69de29bb2d 100644 --- a/keyboards/lily58/rev1/rules.mk +++ b/keyboards/lily58/rev1/rules.mk @@ -1,3 +0,0 @@ -SRC += rev1/matrix.c -SRC += rev1/split_util.c -SRC += 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 a1fe6ba5b82..00000000000 --- a/keyboards/lily58/rev1/split_scomm.c +++ /dev/null @@ -1,91 +0,0 @@ -#ifdef USE_SERIAL -#ifdef SERIAL_USE_MULTI_TRANSACTION -/* --- USE flexible API (using multi-type transaction function) --- */ - -#include -#include -#include -#include -#include "serial.h" -#ifdef CONSOLE_ENABLE - #include -#endif - -uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; -uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; -uint8_t volatile status_com = 0; -uint8_t volatile status1 = 0; -uint8_t slave_buffer_change_count = 0; -uint8_t s_change_old = 0xff; -uint8_t s_change_new = 0xff; - -SSTD_t transactions[] = { -#define GET_SLAVE_STATUS 0 - /* master buffer not changed, only recive slave_buffer_change_count */ - { (uint8_t *)&status_com, - 0, NULL, - sizeof(slave_buffer_change_count), &slave_buffer_change_count, - }, -#define PUT_MASTER_GET_SLAVE_STATUS 1 - /* master buffer changed need send, and recive slave_buffer_change_count */ - { (uint8_t *)&status_com, - sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer, - sizeof(slave_buffer_change_count), &slave_buffer_change_count, - }, -#define GET_SLAVE_BUFFER 2 - /* recive serial_slave_buffer */ - { (uint8_t *)&status1, - 0, NULL, - sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer - } -}; - -void serial_master_init(void) -{ - soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); -} - -void serial_slave_init(void) -{ - soft_serial_target_init(transactions, TID_LIMIT(transactions)); -} - -// 0 => no error -// 1 => slave did not respond -// 2 => checksum error -int serial_update_buffers(int master_update) -{ - int status, smatstatus; - static int need_retry = 0; - - if( s_change_old != s_change_new ) { - smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER); - if( smatstatus == TRANSACTION_END ) { - s_change_old = s_change_new; -#ifdef CONSOLE_ENABLE - uprintf("slave matrix = %b %b %b %b\n", - serial_slave_buffer[0], serial_slave_buffer[1], - serial_slave_buffer[2], serial_slave_buffer[3]); -#endif - } - } else { - // serial_slave_buffer dosen't change - smatstatus = TRANSACTION_END; // dummy status - } - - if( !master_update && !need_retry) { - status = soft_serial_transaction(GET_SLAVE_STATUS); - } else { - status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS); - } - if( status == TRANSACTION_END ) { - s_change_new = slave_buffer_change_count; - need_retry = 0; - } else { - need_retry = 1; - } - return smatstatus; -} - -#endif // SERIAL_USE_MULTI_TRANSACTION -#endif /* USE_SERIAL */ diff --git a/keyboards/lily58/rev1/split_scomm.h b/keyboards/lily58/rev1/split_scomm.h deleted file mode 100755 index 873d8939d81..00000000000 --- a/keyboards/lily58/rev1/split_scomm.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SPLIT_COMM_H -#define SPLIT_COMM_H - -#ifndef SERIAL_USE_MULTI_TRANSACTION -/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */ -#include "serial.h" - -#else -/* --- USE flexible API (using multi-type transaction function) --- */ -// Buffers for master - slave communication -#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 -#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 - -extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; -extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; -extern uint8_t slave_buffer_change_count; - -void serial_master_init(void); -void serial_slave_init(void); -int serial_update_buffers(int master_changed); - -#endif - -#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 687ca19bd3e..00000000000 --- a/keyboards/lily58/rev1/split_util.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef SPLIT_KEYBOARD_UTIL_H -#define SPLIT_KEYBOARD_UTIL_H - -#include -#include "eeconfig.h" - -#define SLAVE_I2C_ADDRESS 0x32 - -extern volatile bool isLeftHand; - -// slave version of matix scan, defined in matrix.c -void matrix_slave_scan(void); - -void split_keyboard_setup(void); -bool has_usb(void); - -void matrix_master_OLED_init (void); - -#endif diff --git a/keyboards/lily58/rules.mk b/keyboards/lily58/rules.mk index d413510bac1..34b512d59a6 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 RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend - -CUSTOM_MATRIX = yes - -SRC += i2c.c -SRC += serial.c -SRC += ssd1306.c - -# A workaround until #7089 is merged. -# serial.c must not be compiled with the -lto option. -# The current LIB_SRC has a side effect with the -fno-lto option, so use it. -LIB_SRC += serial.c - -# if firmware size over limit, try this option -# CFLAGS += -flto +OLED_DRIVER_ENABLE = yes # OLED display +SPLIT_KEYBOARD = yes DEFAULT_FOLDER = lily58/rev1 diff --git a/keyboards/lily58/serial.h b/keyboards/lily58/serial.h deleted file mode 100755 index 7e0c0847a43..00000000000 --- a/keyboards/lily58/serial.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef SOFT_SERIAL_H -#define SOFT_SERIAL_H - -#include - -// ///////////////////////////////////////////////////////////////// -// Need Soft Serial defines in config.h -// ///////////////////////////////////////////////////////////////// -// ex. -// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6 -// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5 -// // 1: about 137kbps (default) -// // 2: about 75kbps -// // 3: about 39kbps -// // 4: about 26kbps -// // 5: about 20kbps -// -// //// USE Simple API (OLD API, compatible with let's split serial.c) -// ex. -// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 -// #define SERIAL_MASTER_BUFFER_LENGTH 1 -// -// //// USE flexible API (using multi-type transaction function) -// #define SERIAL_USE_MULTI_TRANSACTION -// -// ///////////////////////////////////////////////////////////////// - - -#ifndef SERIAL_USE_MULTI_TRANSACTION -/* --- USE Simple API (OLD API, compatible with let's split serial.c) */ -#if SERIAL_SLAVE_BUFFER_LENGTH > 0 -extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; -#endif -#if SERIAL_MASTER_BUFFER_LENGTH > 0 -extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; -#endif - -void serial_master_init(void); -void serial_slave_init(void); -int serial_update_buffers(void); - -#endif // USE Simple API - -// Soft Serial Transaction Descriptor -typedef struct _SSTD_t { - uint8_t *status; - uint8_t initiator2target_buffer_size; - uint8_t *initiator2target_buffer; - uint8_t target2initiator_buffer_size; - uint8_t *target2initiator_buffer; -} SSTD_t; -#define TID_LIMIT( table ) (sizeof(table) / sizeof(SSTD_t)) - -// initiator is transaction start side -void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size); -// target is interrupt accept side -void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size); - -// initiator resullt -#define TRANSACTION_END 0 -#define TRANSACTION_NO_RESPONSE 0x1 -#define TRANSACTION_DATA_ERROR 0x2 -#define TRANSACTION_TYPE_ERROR 0x4 -#ifndef SERIAL_USE_MULTI_TRANSACTION -int soft_serial_transaction(void); -#else -int soft_serial_transaction(int sstd_index); -#endif - -// target status -// *SSTD_t.status has -// initiator: -// TRANSACTION_END -// or TRANSACTION_NO_RESPONSE -// or TRANSACTION_DATA_ERROR -// target: -// TRANSACTION_DATA_ERROR -// or TRANSACTION_ACCEPTED -#define TRANSACTION_ACCEPTED 0x8 -#ifdef SERIAL_USE_MULTI_TRANSACTION -int soft_serial_get_and_clean_status(int sstd_index); -#endif - -#endif /* SOFT_SERIAL_H */ diff --git a/keyboards/lily58/serial_config.h b/keyboards/lily58/serial_config.h deleted file mode 100644 index 4fab8e8ddfc..00000000000 --- a/keyboards/lily58/serial_config.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef SOFT_SERIAL_PIN -#define SOFT_SERIAL_PIN D2 -#define SERIAL_USE_MULTI_TRANSACTION -#endif diff --git a/keyboards/lily58/ssd1306.c b/keyboards/lily58/ssd1306.c deleted file mode 100755 index 20c2738db77..00000000000 --- a/keyboards/lily58/ssd1306.c +++ /dev/null @@ -1,344 +0,0 @@ -#ifdef SSD1306OLED - -#include "ssd1306.h" -#include "i2c.h" -#include -#include "print.h" -#ifdef ADAFRUIT_BLE_ENABLE -#include "adafruit_ble.h" -#endif -#ifdef PROTOCOL_LUFA -#include "lufa.h" -#endif -#include "sendchar.h" -#include "timer.h" - -extern const unsigned char font[] PROGMEM; - -// Set this to 1 to help diagnose early startup problems -// when testing power-on with ble. Turn it off otherwise, -// as the latency of printing most of the debug info messes -// with the matrix scan, causing keys to drop. -#define DEBUG_TO_SCREEN 0 - -//static uint16_t last_battery_update; -//static uint32_t vbat; -//#define BatteryUpdateInterval 10000 /* milliseconds */ - -// 'last_flush' is declared as uint16_t, -// so this must be less than 65535 -#define ScreenOffInterval 60000 /* milliseconds */ -#if DEBUG_TO_SCREEN -static uint8_t displaying; -#endif -static uint16_t last_flush; - -static bool force_dirty = true; - -// Write command sequence. -// Returns true on success. -static inline bool _send_cmd1(uint8_t cmd) { - bool res = false; - - if (i2c_start_write(SSD1306_ADDRESS)) { - xprintf("failed to start write to %d\n", SSD1306_ADDRESS); - goto done; - } - - if (i2c_master_write(0x0 /* command byte follows */)) { - print("failed to write control byte\n"); - - goto done; - } - - if (i2c_master_write(cmd)) { - xprintf("failed to write command %d\n", cmd); - goto done; - } - res = true; -done: - i2c_master_stop(); - return res; -} - -// Write 2-byte command sequence. -// Returns true on success -static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { - if (!_send_cmd1(cmd)) { - return false; - } - return _send_cmd1(opr); -} - -// Write 3-byte command sequence. -// Returns true on success -static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { - if (!_send_cmd1(cmd)) { - return false; - } - if (!_send_cmd1(opr1)) { - return false; - } - return _send_cmd1(opr2); -} - -#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} -#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} -#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} - -static void clear_display(void) { - matrix_clear(&display); - - // Clear all of the display bits (there can be random noise - // in the RAM on startup) - send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); - send_cmd3(ColumnAddr, 0, DisplayWidth - 1); - - if (i2c_start_write(SSD1306_ADDRESS)) { - goto done; - } - if (i2c_master_write(0x40)) { - // Data mode - goto done; - } - for (uint8_t row = 0; row < MatrixRows; ++row) { - for (uint8_t col = 0; col < DisplayWidth; ++col) { - i2c_master_write(0); - } - } - - display.dirty = false; - -done: - i2c_master_stop(); -} - -#if DEBUG_TO_SCREEN -#undef sendchar -static int8_t capture_sendchar(uint8_t c) { - sendchar(c); - iota_gfx_write_char(c); - - if (!displaying) { - iota_gfx_flush(); - } - return 0; -} -#endif - -bool iota_gfx_init(bool rotate) { - bool success = false; - - i2c_master_init(); - send_cmd1(DisplayOff); - send_cmd2(SetDisplayClockDiv, 0x80); - send_cmd2(SetMultiPlex, DisplayHeight - 1); - - send_cmd2(SetDisplayOffset, 0); - - - send_cmd1(SetStartLine | 0x0); - send_cmd2(SetChargePump, 0x14 /* Enable */); - send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); - - if(rotate){ - // the following Flip the display orientation 180 degrees - send_cmd1(SegRemap); - send_cmd1(ComScanInc); - }else{ - // Flips the display orientation 0 degrees - send_cmd1(SegRemap | 0x1); - send_cmd1(ComScanDec); - } - - send_cmd2(SetComPins, 0x2); - send_cmd2(SetContrast, 0x8f); - send_cmd2(SetPreCharge, 0xf1); - send_cmd2(SetVComDetect, 0x40); - send_cmd1(DisplayAllOnResume); - send_cmd1(NormalDisplay); - send_cmd1(DeActivateScroll); - send_cmd1(DisplayOn); - - send_cmd2(SetContrast, 0); // Dim - - clear_display(); - - success = true; - - iota_gfx_flush(); - -#if DEBUG_TO_SCREEN - print_set_sendchar(capture_sendchar); -#endif - -done: - return success; -} - -bool iota_gfx_off(void) { - bool success = false; - - send_cmd1(DisplayOff); - success = true; - -done: - return success; -} - -bool iota_gfx_on(void) { - bool success = false; - - send_cmd1(DisplayOn); - success = true; - -done: - return success; -} - -void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { - *matrix->cursor = c; - ++matrix->cursor; - - if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { - // We went off the end; scroll the display upwards by one line - memmove(&matrix->display[0], &matrix->display[1], - MatrixCols * (MatrixRows - 1)); - matrix->cursor = &matrix->display[MatrixRows - 1][0]; - memset(matrix->cursor, ' ', MatrixCols); - } -} - -void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { - matrix->dirty = true; - - if (c == '\n') { - // Clear to end of line from the cursor and then move to the - // start of the next line - uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; - - while (cursor_col++ < MatrixCols) { - matrix_write_char_inner(matrix, ' '); - } - return; - } - - matrix_write_char_inner(matrix, c); -} - -void iota_gfx_write_char(uint8_t c) { - matrix_write_char(&display, c); -} - -void matrix_write(struct CharacterMatrix *matrix, const char *data) { - const char *end = data + strlen(data); - while (data < end) { - matrix_write_char(matrix, *data); - ++data; - } -} - -void matrix_write_ln(struct CharacterMatrix *matrix, const char *data) { - char data_ln[strlen(data)+2]; - snprintf(data_ln, sizeof(data_ln), "%s\n", data); - matrix_write(matrix, data_ln); -} - -void iota_gfx_write(const char *data) { - matrix_write(&display, data); -} - -void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { - while (true) { - uint8_t c = pgm_read_byte(data); - if (c == 0) { - return; - } - matrix_write_char(matrix, c); - ++data; - } -} - -void iota_gfx_write_P(const char *data) { - matrix_write_P(&display, data); -} - -void matrix_clear(struct CharacterMatrix *matrix) { - memset(matrix->display, ' ', sizeof(matrix->display)); - matrix->cursor = &matrix->display[0][0]; - matrix->dirty = true; -} - -void iota_gfx_clear_screen(void) { - matrix_clear(&display); -} - -void matrix_render(struct CharacterMatrix *matrix) { - last_flush = timer_read(); - iota_gfx_on(); -#if DEBUG_TO_SCREEN - ++displaying; -#endif - - // Move to the home position - send_cmd3(PageAddr, 0, MatrixRows - 1); - send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); - - if (i2c_start_write(SSD1306_ADDRESS)) { - goto done; - } - if (i2c_master_write(0x40)) { - // Data mode - goto done; - } - - for (uint8_t row = 0; row < MatrixRows; ++row) { - for (uint8_t col = 0; col < MatrixCols; ++col) { - const uint8_t *glyph = font + (matrix->display[row][col] * FontWidth); - - for (uint8_t glyphCol = 0; glyphCol < FontWidth; ++glyphCol) { - uint8_t colBits = pgm_read_byte(glyph + glyphCol); - i2c_master_write(colBits); - } - - // 1 column of space between chars (it's not included in the glyph) - //i2c_master_write(0); - } - } - - matrix->dirty = false; - -done: - i2c_master_stop(); -#if DEBUG_TO_SCREEN - --displaying; -#endif -} - -void iota_gfx_flush(void) { - matrix_render(&display); -} - -__attribute__ ((weak)) -void iota_gfx_task_user(void) { -} - -void iota_gfx_task(void) { - iota_gfx_task_user(); - - if (display.dirty|| force_dirty) { - iota_gfx_flush(); - force_dirty = false; - } - - if (timer_elapsed(last_flush) > ScreenOffInterval) { - iota_gfx_off(); - } -} - -bool process_record_gfx(uint16_t keycode, keyrecord_t *record) { - force_dirty = true; - return true; -} - -#endif diff --git a/keyboards/lily58/ssd1306.h b/keyboards/lily58/ssd1306.h deleted file mode 100755 index 0ca093093a1..00000000000 --- a/keyboards/lily58/ssd1306.h +++ /dev/null @@ -1,90 +0,0 @@ -#pragma once - -#include -#include -#include "action.h" - -enum ssd1306_cmds { - DisplayOff = 0xAE, - DisplayOn = 0xAF, - - SetContrast = 0x81, - DisplayAllOnResume = 0xA4, - - DisplayAllOn = 0xA5, - NormalDisplay = 0xA6, - InvertDisplay = 0xA7, - SetDisplayOffset = 0xD3, - SetComPins = 0xda, - SetVComDetect = 0xdb, - SetDisplayClockDiv = 0xD5, - SetPreCharge = 0xd9, - SetMultiPlex = 0xa8, - SetLowColumn = 0x00, - SetHighColumn = 0x10, - SetStartLine = 0x40, - - SetMemoryMode = 0x20, - ColumnAddr = 0x21, - PageAddr = 0x22, - - ComScanInc = 0xc0, - ComScanDec = 0xc8, - SegRemap = 0xa0, - SetChargePump = 0x8d, - ExternalVcc = 0x01, - SwitchCapVcc = 0x02, - - ActivateScroll = 0x2f, - DeActivateScroll = 0x2e, - SetVerticalScrollArea = 0xa3, - RightHorizontalScroll = 0x26, - LeftHorizontalScroll = 0x27, - VerticalAndRightHorizontalScroll = 0x29, - VerticalAndLeftHorizontalScroll = 0x2a, -}; - -// Controls the SSD1306 128x32 OLED display via i2c - -#ifndef SSD1306_ADDRESS -#define SSD1306_ADDRESS 0x3C -#endif - -#define DisplayHeight 32 -#define DisplayWidth 128 - -#define FontHeight 8 -#define FontWidth 6 - -#define MatrixRows (DisplayHeight / FontHeight) -#define MatrixCols (DisplayWidth / FontWidth) - -struct CharacterMatrix { - uint8_t display[MatrixRows][MatrixCols]; - uint8_t *cursor; - bool dirty; -}; - -struct CharacterMatrix display; - -bool iota_gfx_init(bool rotate); -void iota_gfx_task(void); -bool iota_gfx_off(void); -bool iota_gfx_on(void); -void iota_gfx_flush(void); -void iota_gfx_write_char(uint8_t c); -void iota_gfx_write(const char *data); -void iota_gfx_write_P(const char *data); -void iota_gfx_clear_screen(void); - -void iota_gfx_task_user(void); - -void matrix_clear(struct CharacterMatrix *matrix); -void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c); -void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c); -void matrix_write(struct CharacterMatrix *matrix, const char *data); -void matrix_write_ln(struct CharacterMatrix *matrix, const char *data); -void matrix_write_P(struct CharacterMatrix *matrix, const char *data); -void matrix_render(struct CharacterMatrix *matrix); - -bool 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 9bcd771c421..5c80df0f061 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif // persistent_default_layer_set(1UL<<_QWERTY); } @@ -196,7 +196,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_colemak, false, 0); + PLAY_SONG(tone_colemak); #endif // persistent_default_layer_set(1UL<<_COLEMAK); } @@ -205,7 +205,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + PLAY_SONG(tone_dvorak); #endif // persistent_default_layer_set(1UL<<_DVORAK); } diff --git a/keyboards/meira/keymaps/grahampheath/keymap.c b/keyboards/meira/keymaps/grahampheath/keymap.c index cd02137877b..ace172a2a40 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif } return false; @@ -251,7 +251,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_colemak, false, 0); + PLAY_SONG(tone_colemak); #endif } return false; @@ -259,7 +259,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + PLAY_SONG(tone_dvorak); #endif } return false; diff --git a/keyboards/meira/keymaps/takmiya/keymap.c b/keyboards/meira/keymaps/takmiya/keymap.c index 12dad6d6901..bf693d8ad22 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif // persistent_default_layer_set(1UL<<_QWERTY); } diff --git a/keyboards/meishi/keymaps/default/keymap.c b/keyboards/meishi/keymaps/default/keymap.c index 528beb168b7..ea6e42a961c 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] = { ), }; -const uint16_t PROGMEM fn_actions[] = { - -}; - void matrix_init_user(void) { } diff --git a/keyboards/navi10/rev3/rules.mk b/keyboards/navi10/rev3/rules.mk index b98e7eb2d65..d5a072f1617 100644 --- a/keyboards/navi10/rev3/rules.mk +++ b/keyboards/navi10/rev3/rules.mk @@ -28,6 +28,6 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow MIDI_ENABLE = no # MIDI support UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = no # Audio output FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches HD44780_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 8ef037f42b6..cc540b891ff 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] = { ) }; -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KC_BSLO: return TAPPING_LAYER_TERM; diff --git a/keyboards/nomu30/keymaps/like_jis/keymap.c b/keyboards/nomu30/keymaps/like_jis/keymap.c index 203d0a7a415..fc2d26ad7a3 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] = { ) }; -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KC_BSLO: return TAPPING_LAYER_TERM; diff --git a/keyboards/omnikey_blackheart/config.h b/keyboards/omnikey_bh/config.h similarity index 100% rename from keyboards/omnikey_blackheart/config.h rename to keyboards/omnikey_bh/config.h diff --git a/keyboards/omnikey_blackheart/info.json b/keyboards/omnikey_bh/info.json similarity index 99% rename from keyboards/omnikey_blackheart/info.json rename to keyboards/omnikey_bh/info.json index 138c954b77a..50d64e143cf 100644 --- a/keyboards/omnikey_blackheart/info.json +++ b/keyboards/omnikey_bh/info.json @@ -1,5 +1,5 @@ { - "keyboard_name": "Omnikey Blackheart PCB", + "keyboard_name": "Omnikey BH PCB", "url": "", "maintainer": "qmk", "width": 25.5, diff --git a/keyboards/omnikey_blackheart/keymaps/default/keymap.c b/keyboards/omnikey_bh/keymaps/default/keymap.c similarity index 100% rename from keyboards/omnikey_blackheart/keymaps/default/keymap.c rename to 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 00000000000..c2f52f30c32 --- /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 similarity index 96% rename from keyboards/omnikey_blackheart/omnikey_blackheart.h rename to keyboards/omnikey_bh/omnikey_bh.h index 5d2d948c495..f36184f3905 100644 --- a/keyboards/omnikey_blackheart/omnikey_blackheart.h +++ b/keyboards/omnikey_bh/omnikey_bh.h @@ -1,5 +1,4 @@ -#ifndef omnikey_blackheart -#define omnikey_blackheart +#pragma once #include "quantum.h" @@ -18,5 +17,3 @@ { K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414, K415, K416, K417, K418, K419, K420, K421, KC_NO }, \ { 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 } \ } - -#endif \ No newline at end of file diff --git a/keyboards/omnikey_blackheart/readme.md b/keyboards/omnikey_bh/readme.md similarity index 83% rename from keyboards/omnikey_blackheart/readme.md rename to keyboards/omnikey_bh/readme.md index 04bb49818c1..7de22f29a45 100644 --- a/keyboards/omnikey_blackheart/readme.md +++ b/keyboards/omnikey_bh/readme.md @@ -1,14 +1,14 @@ -Omnikey Blackheart PCB +Omnikey BH PCB === A replacement PCB for Omnikey keyboards. Supports 101, 102, Plus, Ultra T, Ultra, Prime and Stellar, as well as customs. Keyboard Maintainer: QMK Community and blindassassin111 -Hardware Supported: Omnikey blackheart PCB +Hardware Supported: Omnikey BH PCB Hardware Availability: https://deskthority.net/group-buys-f50/omnikey-replacement-pcb-t18276.html Make example for this keyboard (after setting up your build environment): - make omnikey_blackheart:default + make omnikey_bh:default See [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 similarity index 100% rename from keyboards/omnikey_blackheart/rules.mk rename to 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 e54047fa68a..00000000000 --- a/keyboards/omnikey_blackheart/omnikey_blackheart.c +++ /dev/null @@ -1 +0,0 @@ -#include "omnikey_blackheart.h" diff --git a/keyboards/pancake/feather/readme.md b/keyboards/pancake/feather/readme.md deleted file mode 100644 index 8b137891791..00000000000 --- a/keyboards/pancake/feather/readme.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/keyboards/pancake/keymaps/default/readme.md b/keyboards/pancake/keymaps/default/readme.md deleted file mode 100644 index 8b137891791..00000000000 --- a/keyboards/pancake/keymaps/default/readme.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/keyboards/pancake/promicro/readme.md b/keyboards/pancake/promicro/readme.md deleted file mode 100644 index 8b137891791..00000000000 --- a/keyboards/pancake/promicro/readme.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/keyboards/planck/keymaps/ab/keymap.c b/keyboards/planck/keymaps/ab/keymap.c index c028e7949f8..8835bfc87db 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; // Func macro definitions. #define LWR_PGDN LT(_LOWER, KC_PGDN) // Tap for PgDn, hold for LOWER #define RSE_PGUP LT(_RAISE, KC_PGUP) // Tap for PgUp, hold for RAISE -#define CTL_CAPS FUNC(2) // Tap for Caps, hold for Ctrl (DOESN'T SEEM TO WORK) -#define SFT_ENT FUNC(3) // Tap for Enter, hold for Shift -#define ZM_NRM FUNC(4) // Zoom normal -#define ZM_IN FUNC(5) // Zoom out -#define ZM_OUT FUNC(6) // Zoom in -#define EM_UNDO FUNC(7) // Emacs Undo - -// Enable these functions using FUNC(n) macro. -const uint16_t PROGMEM fn_actions[] = { - [2] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_CAPS), - [3] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT), - [4] = ACTION_MODS_KEY(MOD_LCTL, KC_0), - [5] = ACTION_MODS_KEY(MOD_LCTL, KC_MINS), - [6] = ACTION_MODS_KEY(MOD_LCTL, KC_PLUS), - [7] = ACTION_MODS_KEY(MOD_LCTL, KC_UNDS), - }; +#define CTL_CAPS MT(MOD_LCTL, KC_CAPS) // Tap for Caps, hold for Ctrl (DOESN'T SEEM TO WORK) +#define SFT_ENT MT(MOD_RSFT, KC_ENT) // Tap for Enter, hold for Shift +#define ZM_NRM C(KC_0) // Zoom normal +#define ZM_IN C(KC_MINS) // Zoom out +#define ZM_OUT C(KC_PLUS) // Zoom in +#define EM_UNDO C(KC_UNDS) // Emacs Undo // This config can be found at Keyboard layout editor site: http://goo.gl/zjXL2l const 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 6a497641e6b..6e9c69333e2 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] = { ), [2] = LAYOUT_planck_grid( /* RAISE */ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS, - 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, + 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, KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), [3] = LAYOUT_planck_grid( /* LOWER */ 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, - 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), + 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), KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END ) }; - - -const uint16_t PROGMEM fn_actions[] = { - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; diff --git a/keyboards/planck/keymaps/austin/keymap.c b/keyboards/planck/keymaps/austin/keymap.c index 16bca795105..3461ca95519 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] = { KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, - KC_FN3, KC_LGUI, KC_LALT, KC_LCTL, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + DF(0), KC_LGUI, KC_LALT, KC_LCTL, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), [2] = LAYOUT_planck_grid( /* RAISE */ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, - 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, + 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, KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), [3] = LAYOUT_planck_grid( /* LOWER */ 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, - 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), + 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), KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ) }; - - -const uint16_t PROGMEM fn_actions[] = { - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; diff --git a/keyboards/planck/keymaps/brandon/keymap.c b/keyboards/planck/keymaps/brandon/keymap.c index ade4ea30f07..66533e53a21 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] = { */ [BASE_QWERTY_LAYER] = LAYOUT_planck_grid( 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, - F(5), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT_NAVS, F(6), + 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), KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, 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 ), @@ -140,7 +140,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [LOWER_LAYER] = LAYOUT_planck_grid( 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), - F(5), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, F(6), + 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), KC_LSPO, KC_MINS, KC_EQL, KC_GRV, KC_BSLS, ___x___, KC_NDSH, KC_MDSH, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, 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 ), @@ -224,12 +224,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; -const uint16_t PROGMEM fn_actions[] = { - // Modifiers - [5] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_TAB), - [6] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT), -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { switch(id) { diff --git a/keyboards/planck/keymaps/chance/keymap.c b/keyboards/planck/keymaps/chance/keymap.c index 23af2277bd6..46d077ddc34 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] = { [_QWERTY] = LAYOUT_planck_grid( KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, F(0) , + 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), KC_LCTRL,KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), @@ -179,10 +179,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT), -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function diff --git a/keyboards/planck/keymaps/charlie/keymap.c b/keyboards/planck/keymaps/charlie/keymap.c index 29d05022381..4a3adba5133 100644 --- a/keyboards/planck/keymaps/charlie/keymap.c +++ b/keyboards/planck/keymaps/charlie/keymap.c @@ -2,52 +2,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_planck_grid( /* Native */ - KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, FUNC(2), + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, DF(1), KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_TAB, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, KC_DEL, KC_LCTL, KC_NO, KC_LSFT, KC_LALT, KC_SPC, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), [1] = LAYOUT_planck_grid( /* QWERTY->PHOTOSHOP */ - KC_DELETE, KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, FUNC(1), - KC_O, KC_G, KC_S, KC_U, KC_T, FUNC(27), KC_F21, KC_F10, KC_F11, KC_F7, KC_F8, KC_F9, - KC_TAB, FUNC(4), FUNC(5), FUNC(6), KC_F1, FUNC(7), KC_F18, KC_F19, KC_F23, KC_F20, KC_F22, FUNC(9), - KC_COMM, KC_DOT, KC_R, FUNC(11), MO(2), KC_SPC, FUNC(12), KC_F2, FUNC(8), KC_F3, KC_F14 + KC_DELETE, KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, DF(0), + 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, + 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))), + 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 ), - [2] = LAYOUT_planck_grid( /* 2: FUNC(3 PHOTOSHOP */ - KC_ESC, FUNC(25), FUNC(26), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, FUNC(19), FUNC(20), FUNC(21), - KC_C, KC_NO, FUNC(22), FUNC(5), KC_NO, FUNC(23), KC_NO, KC_NO, KC_NO, KC_NO, FUNC(13), KC_NO, - FUNC(14), FUNC(15), FUNC(16), FUNC(17), MO(2), KC_SPC, FUNC(18), KC_NO, KC_NO, KC_F24, KC_NO + [2] = LAYOUT_planck_grid( /* PHOTOSHOP */ + 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, + 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)), + 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, + 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 ) }; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_DEFAULT_LAYER_SET(0), // set Qwerty layout - [2] = ACTION_DEFAULT_LAYER_SET(1), // set Photoshop presets - - [4] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F9), // photo folder AHK - [5] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_I), // select inverse - [6] = ACTION_MODS_KEY(MOD_LSFT, KC_M), // marquee select - [7] = ACTION_MODS_KEY(MOD_LALT, KC_BSPC), // fill - [8] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_X), // warp - [9] = ACTION_MODS_KEY(MOD_LCTL | MOD_LALT | MOD_LSFT, KC_F12), // merge all new layer - [10] = ACTION_MODS_KEY(MOD_LCTL, KC_MINS), // zoom out - [11] = ACTION_MODS_KEY(MOD_LCTL, KC_H), // RBG sliders - [12] = ACTION_MODS_KEY(MOD_LCTL, KC_S), // save - [13] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_F5), // layer mask from transparancy - [14] = ACTION_MODS_KEY(MOD_LCTL, KC_F2), // stroke - [15] = ACTION_MODS_KEY(MOD_LCTL | MOD_LSFT, KC_F2), // stroke layer - [16] = ACTION_MODS_KEY(MOD_LCTL, KC_0), // zoom 0 - [17] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_H), // HSV sliders - [18] = ACTION_MODS_KEY(MOD_LCTL | MOD_LSFT, KC_S), // save as - [19] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F7), // gaussian blur - [20] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F8), // motion blur - [21] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_X), // liquify filter - [22] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // prev layer blending - [23] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_BSPC), // KC_NOrmal layer blending - [24] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), // next layer blending - [25] = ACTION_MODS_KEY(MOD_LCTL, KC_Z), // step back - [26] = ACTION_MODS_KEY(MOD_LCTL, KC_Y), // step forward - [27] = ACTION_MODS_KEY(MOD_LCTL, KC_R), // rasterize - -}; diff --git a/keyboards/planck/keymaps/circuit/keymap.c b/keyboards/planck/keymaps/circuit/keymap.c index 018cff4e54d..805ebd7fd38 100644 --- a/keyboards/planck/keymaps/circuit/keymap.c +++ b/keyboards/planck/keymaps/circuit/keymap.c @@ -23,8 +23,8 @@ enum planck_keycodes { }; // Key code names -#define SFT_ENT FUNC(0) // Tap for enter, hold for right shift -#define LOCK FUNC(1) +#define SFT_ENT MT(MOD_RSFT, KC_ENT) // Tap for enter, hold for right shift +#define LOCK TG(_LOCKED) #define KC_PSTE KC_PASTE #ifdef TAP_DANCE_ENABLE @@ -41,12 +41,6 @@ qk_tap_dance_action_t tap_dance_actions[] = { }; #endif -// Function definitions -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT), - [1] = ACTION_LAYER_TOGGLE(_LOCKED) -}; - // Layout definitions const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/planck/keymaps/david/keymap.c b/keyboards/planck/keymaps/david/keymap.c index 57aafed2a0d..d093efe04ac 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] = { KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, - KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + DF(0), KC_LCTL, KC_LALT, KC_LGUI, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), [2] = LAYOUT_planck_grid( /* RAISE */ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, - KC_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + KC_TRNS, DF(0), DF(1), RESET, M(0), M(1), M(2), KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_TRNS, KC_F11, KC_F12, M(0), M(1), M(2), M(3), M(4), M(5), M(6), M(7), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), [3] = LAYOUT_planck_grid( /* LOWER */ 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, - 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), + 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), KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ) }; - -const uint16_t PROGMEM fn_actions[] = { - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; diff --git a/keyboards/planck/keymaps/dr_notsokind/keymap.c b/keyboards/planck/keymaps/dr_notsokind/keymap.c index a244da2e422..1055c754f0f 100644 --- a/keyboards/planck/keymaps/dr_notsokind/keymap.c +++ b/keyboards/planck/keymaps/dr_notsokind/keymap.c @@ -34,8 +34,8 @@ enum planck_keycodes { #include "dynamic_macro.h" // Key code names -#define SFT_ENT FUNC(0) // Tap for enter, hold for right shift -#define LOCK FUNC(1) +#define SFT_ENT MT(MOD_RSFT, KC_ENT) // Tap for enter, hold for right shift +#define LOCK TG(_LOCKED) #define KC_PSTE KC_PASTE #define ZOOM_IN LCTL(KC_EQL) #define ZOOM_OUT LCTL(KC_MINS) @@ -55,12 +55,6 @@ qk_tap_dance_action_t tap_dance_actions[] = { }; #endif -// Function definitions -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT), - [1] = ACTION_LAYER_TOGGLE(_LOCKED) -}; - // Layout definitions const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/planck/keymaps/dzobert/keymap.c b/keyboards/planck/keymaps/dzobert/keymap.c index 17b1bef0193..6012c068a95 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] = { KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TAB, KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_BSPC, KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, - KC_FN4, KC_RSFT, KC_LGUI, KC_LSFT, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + DF(1), KC_RSFT, KC_LGUI, KC_LSFT, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT // Space is repeated to accommadate for both spacebar wiring positions ), [1] = LAYOUT_planck_grid( /* Colemak */ KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TAB, KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_BSPC, KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, - KC_FN3, KC_RSFT, KC_LGUI, KC_LSFT, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + DF(0), KC_RSFT, KC_LGUI, KC_LSFT, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), [2] = LAYOUT_planck_grid( /* RAISE */ 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] = { 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 ) }; - -const uint16_t PROGMEM fn_actions[] = { - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; diff --git a/keyboards/planck/keymaps/emilyh/keymap.c b/keyboards/planck/keymaps/emilyh/keymap.c index 4a8a7d0c511..3beadd8e2db 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif persistant_default_layer_set(1UL<<_QWERTY); } @@ -196,7 +196,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_colemak, false, 0); + PLAY_SONG(tone_colemak); #endif persistant_default_layer_set(1UL<<_COLEMAK); } @@ -205,7 +205,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + PLAY_SONG(tone_dvorak); #endif persistant_default_layer_set(1UL<<_DVORAK); } @@ -246,7 +246,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { #ifdef AUDIO_ENABLE stop_all_notes(); - PLAY_NOTE_ARRAY(tone_plover, false, 0); + PLAY_SONG(tone_plover); #endif layer_off(_RAISE); layer_off(_LOWER); @@ -264,7 +264,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case EXT_PLV: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_plover_gb, false, 0); + PLAY_SONG(tone_plover_gb); #endif layer_off(_PLOVER); } @@ -285,12 +285,12 @@ void matrix_init_user(void) { void startup_user() { _delay_ms(20); // gets rid of tick - PLAY_NOTE_ARRAY(tone_startup, false, 0); + PLAY_SONG(tone_startup); } void shutdown_user() { - PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + PLAY_SONG(tone_goodbye); _delay_ms(150); stop_all_notes(); } @@ -302,7 +302,7 @@ void music_on_user(void) void music_scale_user(void) { - PLAY_NOTE_ARRAY(music_scale, false, 0); + PLAY_SONG(music_scale); } #endif diff --git a/keyboards/planck/keymaps/espynn/keymap.c b/keyboards/planck/keymaps/espynn/keymap.c index 924a8c35c68..305fb6e759f 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; // Func macro definitions. #define LWR_PGDN LT(_LOWER, KC_PGDN) // Tap for PgDn, hold for LOWER #define RSE_PGUP LT(_RAISE, KC_PGUP) // Tap for PgUp, hold for RAISE -#define CTL_CAPS FUNC(2) // Tap for Caps, hold for Ctrl (DOESN'T SEEM TO WORK) -#define SFT_ENT FUNC(3) // Tap for Enter, hold for Shift -#define ZM_NRM FUNC(4) // Zoom normal -#define ZM_IN FUNC(5) // Zoom out -#define ZM_OUT FUNC(6) // Zoom in - -// Enable these functions using FUNC(n) macro. -const uint16_t PROGMEM fn_actions[] = { - [2] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_CAPS), - [3] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT), - [4] = ACTION_MODS_KEY(MOD_LCTL, KC_0), - [5] = ACTION_MODS_KEY(MOD_LCTL, KC_MINS), - [6] = ACTION_MODS_KEY(MOD_LCTL, KC_PLUS), - [7] = ACTION_MODS_KEY(MOD_LCTL, KC_UNDS), - }; +#define CTL_CAPS MT(MOD_LCTL, KC_CAPS) // Tap for Caps, hold for Ctrl (DOESN'T SEEM TO WORK) +#define SFT_ENT MT(MOD_RSFT, KC_ENT) // Tap for Enter, hold for Shift +#define ZM_NRM C(KC_0) // Zoom normal +#define ZM_IN C(KC_MINS) // Zoom out +#define ZM_OUT C(KC_PLUS) // Zoom in // This config can be found at Keyboard layout editor site: https://goo.gl/cF7uIO const 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 e036d8a5a33..aeb36b36879 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] = { }; -const uint16_t PROGMEM fn_actions[] = { - ACTION_SWAP_HANDS_TAP_KEY(KC_SPC), -}; - #ifdef AUDIO_ENABLE float tone_startup[][2] = SONG(STARTUP_SOUND); @@ -230,7 +226,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif persistant_default_layer_set(1UL<<_QWERTY); } @@ -239,7 +235,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { case COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_colemak, false, 0); + PLAY_SONG(tone_colemak); #endif persistant_default_layer_set(1UL<<_COLEMAK); } @@ -248,7 +244,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { case DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + PLAY_SONG(tone_dvorak); #endif persistant_default_layer_set(1UL<<_DVORAK); } @@ -289,7 +285,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { #ifdef AUDIO_ENABLE stop_all_notes(); - PLAY_NOTE_ARRAY(tone_plover, false, 0); + PLAY_SONG(tone_plover); #endif layer_off(_RAISE); layer_off(_LOWER); @@ -307,7 +303,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { case EXT_PLV: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_plover_gb, false, 0); + PLAY_SONG(tone_plover_gb); #endif layer_off(_PLOVER); } @@ -331,12 +327,12 @@ void startup_user() rgblight_mode(RGB_MATRIX_CYCLE_ALL); #endif //RGB_matrix wait_ms(20); // gets rid of tick - PLAY_NOTE_ARRAY(tone_startup, false, 0); + PLAY_SONG(tone_startup); } void shutdown_user() { - PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + PLAY_SONG(tone_goodbye); wait_ms(150); stop_all_notes(); } @@ -348,7 +344,7 @@ void music_on_user(void) void music_scale_user(void) { - PLAY_NOTE_ARRAY(music_scale, false, 0); + PLAY_SONG(music_scale); } #endif diff --git a/keyboards/planck/keymaps/joe/keymap.c b/keyboards/planck/keymaps/joe/keymap.c index b759a86cea9..49b2948e658 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] = { [0] = LAYOUT_planck_grid( /* Joe colemak */ FN3_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS, KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT , - F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_UP, KC_QUOT, + 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, KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4),KC_SPC, KC_SPC, MO(5),KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT ), [1] = LAYOUT_planck_grid( /* Joe soft Colemak */ FN3_ESC, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_MINS, KC_BSPC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_ENT , - F(15), CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, KC_COMM, KC_DOT, KC_UP, KC_QUOT, + 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, KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4),KC_SPC, KC_SPC, MO(5),KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT ), [2] = LAYOUT_planck_grid( /* Joe NUMPAD */ 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 , 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 , - F(15), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PCMM, KC_PMNS, KC_P1, KC_P2, KC_P3 , + 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 , KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4), KC_TRNS, KC_TRNS, MO(5), KC_PPLS, KC_P0, KC_PDOT, KC_PENT ), [3] = LAYOUT_planck_grid( /* Joe 1337 haxOr5*/ FN3_ESC, KC_Q, KC_W, KC_F, KC_P, KC_6, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS, KC_BSPC, KC_4, KC_R, KC_5, KC_7, KC_D, KC_H, KC_N, KC_3, KC_1, KC_0, KC_ENT , - F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_UP, KC_QUOT, + 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, KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, MO(4),KC_SPC, KC_SPC, MO(5),KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT ), [4] = LAYOUT_planck_grid( /* Joe LOWER fn1 */ @@ -44,21 +44,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO , KC_NO, KC_MPLY, KC_MPRV, KC_MNXT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RESET , KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO , - 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)) + 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)) ) }; -const uint16_t PROGMEM fn_actions[] = { - /* toggle layers */ - [6] = ACTION_DEFAULT_LAYER_SET(0), - [7] = ACTION_DEFAULT_LAYER_SET(1), - [8] = ACTION_DEFAULT_LAYER_SET(2), - [9] = ACTION_DEFAULT_LAYER_SET(3), - - /* tab on tap, shift on hold */ - [15] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_TAB), -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { switch (id) { diff --git a/keyboards/planck/keymaps/kyle/keymap.c b/keyboards/planck/keymaps/kyle/keymap.c index a788aa859f8..896dfe93977 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] = { KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, - KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + DF(0), KC_LCTL, KC_LALT, KC_LGUI, MO(3), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), [2] = LAYOUT_planck_grid( /* RAISE */ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, - 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, + 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, KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), [3] = LAYOUT_planck_grid( /* LOWER */ 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, - 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), + 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), KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ) }; - -const uint16_t PROGMEM fn_actions[] = { - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; diff --git a/keyboards/planck/keymaps/lucas/keymap.c b/keyboards/planck/keymaps/lucas/keymap.c index 9bd4b7a60b6..26ca6a5505e 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] = { * |LCTL |LGUI | Tab |LALT |Lower| Space | |Mute |Vol- |Vol+ | P/P | * `-----------------------------------------------------------------------' */ - 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), + 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), 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), 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), 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] = { * | | | Tab | ALT | | Space |CrJmp| GUI |Left |Down |Right| * `-----------------------------------------------------------------------' */ - MO(6), KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, F(4), + MO(6), KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, TG(5), KC_ENT, KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, DE_SCLN, KC_LCTL, KC_LSFT, KC_Y, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, DE_DOT, KC_UP, DE_SLSH, 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] = { ), }; -const uint16_t PROGMEM fn_actions[] = { - [4] = ACTION_LAYER_TOGGLE(5), // toggle Gaming - [5] = ACTION_MODS_TAP_KEY(KC_LSFT, KC_CAPS), //Shift on press, Caps on tap -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { switch(id) { diff --git a/keyboards/planck/keymaps/matrixman/keymap.c b/keyboards/planck/keymaps/matrixman/keymap.c index 20982a24ea2..7525e345bb6 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] = { 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) ,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 ,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) - ,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 + ,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 ), // accessed via the left symb-layer key, includes a semicolon where the right symb-layer key was [_SYMB_L] = LAYOUT_planck_grid( @@ -53,11 +53,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_LAYER_MODS(_NAV_ALT, MOD_LALT) - -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function diff --git a/keyboards/planck/keymaps/max/keymap.c b/keyboards/planck/keymaps/max/keymap.c index 1e5d6a61c2f..b84404e1e58 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] = { ), [2] = LAYOUT_planck_grid( /* RAISE */ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, - KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS, + KC_TRNS, DF(0), DF(1), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS, KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(2), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), [3] = LAYOUT_planck_grid( /* LOWER */ 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, - 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, + 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, 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), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ) }; - -const uint16_t PROGMEM fn_actions[] = { - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; diff --git a/keyboards/planck/keymaps/mollat/keymap.c b/keyboards/planck/keymaps/mollat/keymap.c index 2952a0ca8fc..f993d299b6f 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] = { ) }; -const uint16_t PROGMEM fn_actions[] = { - [_LCTL] = ACTION_MODS_TAP_KEY(KC_LCTL, M(12)), // does not work -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { switch(id) { diff --git a/keyboards/planck/keymaps/piemod/keymap.c b/keyboards/planck/keymaps/piemod/keymap.c index 57002cc3867..d75b8bf53b1 100644 --- a/keyboards/planck/keymaps/piemod/keymap.c +++ b/keyboards/planck/keymaps/piemod/keymap.c @@ -1,13 +1,13 @@ #include QMK_KEYBOARD_H #define DVORAK 0 -#define ARROW 1 //F(1) -#define SYMBOL 2 // F(2) -#define NUMBER 3 // F(3) -#define FUNCTION 4 // F(4) -#define EMACS 5 // F(5) -#define CUSTOM_MACROS 6 // F(6) -#define MOUSE 7 // F(7) +#define ARROW 1 +#define SYMBOL 2 +#define NUMBER 3 +#define FUNCTION 4 +#define EMACS 5 +#define CUSTOM_MACROS 6 +#define MOUSE 7 #define LT_1A LT(1, KC_A) #define LT_2O LT(2, KC_O) @@ -22,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_QUOTE, LT_7COM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DELETE, KC_TAB, LT_1A, LT_2O, LT_3E, LT_4U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENTER, KC_LSHIFT, KC_SCOLON, LT_5Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_MINUS, - F(10), LT_6CTL, KC_MENU, KC_LALT, KC_LGUI, KC_BSPACE, KC_SPACE, KC_RCTRL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT + 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 ), [ARROW] = LAYOUT_planck_grid( @@ -34,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [SYMBOL] = LAYOUT_planck_grid( KC_TILD, KC_GRAVE, KC_NO, KC_EQUAL, KC_PLUS, KC_NO, KC_LBRACKET, KC_RBRACKET, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, - KC_NO, KC_NO, KC_TRNS, KC_SCOLON, KC_COLN, KC_NO, KC_LCBR, KC_RCBR, KC_DLR, KC_PERC, KC_CIRC, F(21), + 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), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLASH, KC_SLASH, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ASTR, KC_SLASH, KC_MINUS, KC_PLUS, KC_EQUAL ), @@ -75,31 +75,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; - - enum function_id { - TEENSY_KEY, - CUSTOM_KEY, - L_CTRL_ALT_ENT, - R_CTRL_ALT_ENT, - }; - - int CAPSLOCKED = 0; - - const uint16_t PROGMEM fn_actions[] = { - - // DVORAK 0 - // ARROW 1, F(1) - // SYMBOL 2, F(2) - // NUMBER 3, F(3) - // FUNCTION 4, F(4) - // EMACS 5, F(5) - // MACROS 6, F(6) - // MOUSE 7, F(7) - - // Special Keys - [10] = ACTION_MODS_KEY(KC_LCTRL, KC_LALT), // FN10 = Ctrl + Alt. - - // Symbols - [21] = ACTION_MODS_KEY(MOD_LSFT, KC_SLASH), // FN21 = Question mark. - - }; diff --git a/keyboards/planck/keymaps/pvc/keymap.c b/keyboards/planck/keymaps/pvc/keymap.c index 78123c44ce9..8428c2335f3 100644 --- a/keyboards/planck/keymaps/pvc/keymap.c +++ b/keyboards/planck/keymaps/pvc/keymap.c @@ -99,7 +99,7 @@ enum keyboard_macros { #define SC_CCLS LCTL(KC_F4) #define TG_NKRO MAGIC_TOGGLE_NKRO -#define OS_SHFT KC_FN0 +#define OS_SHFT OSM(MOD_RSFT) #define ________________ _______, _______ #define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX @@ -234,10 +234,6 @@ void persistent_default_layer_set(uint16_t default_layer) default_layer_set(default_layer); } -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_MODS_ONESHOT(MOD_RSFT), -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { diff --git a/keyboards/planck/keymaps/that_canadian/keymap.c b/keyboards/planck/keymaps/that_canadian/keymap.c index 178422cd8b9..8974555fb96 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif persistant_default_layer_set(1UL<<_QWERTY); } @@ -185,12 +185,12 @@ void matrix_init_user(void) { void startup_user() { _delay_ms(20); // gets rid of tick - PLAY_NOTE_ARRAY(tone_startup, false, 0); + PLAY_SONG(tone_startup); } void shutdown_user() { - PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + PLAY_SONG(tone_goodbye); _delay_ms(150); stop_all_notes(); } @@ -202,7 +202,7 @@ void music_on_user(void) void music_scale_user(void) { - PLAY_NOTE_ARRAY(music_scale, false, 0); + PLAY_SONG(music_scale); } #endif diff --git a/keyboards/planck/keymaps/zrichard/keymap.c b/keyboards/planck/keymaps/zrichard/keymap.c index 550117d0006..f3f60b7d1da 100755 --- a/keyboards/planck/keymaps/zrichard/keymap.c +++ b/keyboards/planck/keymaps/zrichard/keymap.c @@ -107,7 +107,7 @@ enum { #define SC_CCLS LCTL(KC_F4) #define TG_NKRO MAGIC_TOGGLE_NKRO -#define OS_SHFT KC_FN0 +#define OS_SHFT OSM(MOD_RSFT) #define ________________ _______, _______ #define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX @@ -243,10 +243,6 @@ void persistant_default_layer_set(uint16_t default_layer) default_layer_set(default_layer); } -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_MODS_ONESHOT(MOD_RSFT), -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { diff --git a/keyboards/planck/rev6/config.h b/keyboards/planck/rev6/config.h index 3cea2e721e9..3fbbae02787 100644 --- a/keyboards/planck/rev6/config.h +++ b/keyboards/planck/rev6/config.h @@ -53,6 +53,7 @@ #define MUSIC_MAP #undef AUDIO_VOICES +// Note: following undef isn't really necessary on STM32, C6_AUDIO is AVR related #undef C6_AUDIO /* 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 49f6088c375..d101f36d655 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 NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = yes # Audio output UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_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 bf9e89e1f2a..d1d274f293e 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif persistant_default_layer_set(1UL<<_QWERTY); } @@ -213,12 +213,12 @@ void matrix_init_user(void) { void startup_user() { _delay_ms(20); // gets rid of tick - PLAY_NOTE_ARRAY(tone_startup, false, 0); + PLAY_SONG(tone_startup); } void shutdown_user() { - PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + PLAY_SONG(tone_goodbye); _delay_ms(150); stop_all_notes(); } @@ -230,7 +230,7 @@ void music_on_user(void) void music_scale_user(void) { - PLAY_NOTE_ARRAY(music_scale, false, 0); + PLAY_SONG(music_scale); } #endif diff --git a/keyboards/preonic/rev1/rules.mk b/keyboards/preonic/rev1/rules.mk index 9be496ce791..45edfa0b0f1 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 NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = yes # Audio output UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. diff --git a/keyboards/preonic/rev2/rules.mk b/keyboards/preonic/rev2/rules.mk index b98f9b52c8a..f24c6a49b7b 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 NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = yes # Audio output UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. diff --git a/keyboards/preonic/rev3/config.h b/keyboards/preonic/rev3/config.h index b5b2ced5a72..b7429f757a5 100644 --- a/keyboards/preonic/rev3/config.h +++ b/keyboards/preonic/rev3/config.h @@ -40,6 +40,7 @@ #define MUSIC_MAP #undef AUDIO_VOICES +// Note: following undef isn't really necessary on STM32, C6_AUDIO is AVR related #undef C6_AUDIO /* 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 4c5d2f2ffec..a5fc16a2e57 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 NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = yes # Audio output UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_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 23c4168f2bc..4516f62e8dd 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif persistant_default_layer_set(1UL<<_QWERTY); } @@ -87,7 +87,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { //case COLEMAK: //if (record->event.pressed) { //#ifdef AUDIO_ENABLE - //PLAY_NOTE_ARRAY(tone_colemak, false, 0); + //PLAY_SONG(tone_colemak); //#endif //persistant_default_layer_set(1UL<<_COLEMAK); //} diff --git a/keyboards/rgbkb/zen/rev1/keymaps/jwlawrence/keymap.c b/keyboards/rgbkb/zen/rev1/keymaps/jwlawrence/keymap.c index 13edd0db8da..bca4684dc5a 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) { case QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif persistant_default_layer_set(1UL<<_QWERTY); } @@ -86,7 +86,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { //case COLEMAK: //if (record->event.pressed) { //#ifdef AUDIO_ENABLE - //PLAY_NOTE_ARRAY(tone_colemak, false, 0); + //PLAY_SONG(tone_colemak); //#endif //persistant_default_layer_set(1UL<<_COLEMAK); //} diff --git a/keyboards/scarletbandana/rules.mk b/keyboards/scarletbandana/rules.mk index ff2b9a258ce..32ff3a078bf 100644 --- a/keyboards/scarletbandana/rules.mk +++ b/keyboards/scarletbandana/rules.mk @@ -26,7 +26,7 @@ NKRO_ENABLE = no # USB Nkey Rollover MIDI_ENABLE = no # MIDI support UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = yes # Audio output RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches BACKLIGHT_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 221054879c6..990edc9df2f 100644 --- a/keyboards/sck/neiso/rules.mk +++ b/keyboards/sck/neiso/rules.mk @@ -28,6 +28,6 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow MIDI_ENABLE = no # MIDI support UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = no # Audio output FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches HD44780_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 cfeda0a245d..2bfe82977c7 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 . //Function //Mute microphone #define KC_SPACEFN LT(2, KC_SPACE) -#define KC_OSLS KC_FN3 -#define KC_GMLK KC_FN1 +#define KC_OSLS OSM(MOD_LSFT) +#define KC_GMLK TG(1) #define KC_FUNC MO(2) #define MICMUTE RCTL(KC_LCTL) enum function_codes { - F_OSLS = 3, - F_GMLK = 1, }; enum layer_names { @@ -146,14 +144,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -/* -* Fn action definition -*/ -const uint16_t PROGMEM fn_actions[] = { - [F_GMLK] = ACTION_LAYER_TOGGLE(1), // Disable SpaceFn and Oneshot Shift - [F_OSLS] = ACTION_MODS_ONESHOT(MOD_LSFT) // Oneshot Leftshift -}; - void matrix_init_user(void) { } diff --git a/keyboards/sentraq/s60_x/keymaps/hasu/keymap.c b/keyboards/sentraq/s60_x/keymaps/hasu/keymap.c index c72c37d9d30..cba307ba495 100644 --- a/keyboards/sentraq/s60_x/keymaps/hasu/keymap.c +++ b/keyboards/sentraq/s60_x/keymaps/hasu/keymap.c @@ -7,6 +7,13 @@ #define KC_LT5 LT(5, KC_SLSH) #define KC_LT6 LT(6, KC_SCLN) +#define KC_MTRS MT(MOD_RSFT, KC_GRV) + +#define KC_DF0 DF(0) +#define KC_DF1 DF(1) +#define KC_DF2 DF(2) +#define KC_DF3 DF(3) + /* * Hasu */ @@ -28,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, NO, BSPC, \ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, \ CAPS, A, S, D, F, G, H, J, K, L, LT6, QUOT, NO, ENT, \ - LSFT, NO, Z, X, C, V, B, N, M, COMM, DOT, LT5, NO, FN9, NO, \ + LSFT, NO, Z, X, C, V, B, N, M, COMM, DOT, LT5, NO, MTRS, NO, \ LCTL, LGUI, LALT, SPC, RALT, MO6, MO6, MO4), /* Keymap 1: colemak ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ @@ -165,20 +172,9 @@ Lw: set Workman layout */ LAYOUT_kc( - FN5, FN6, FN7, FN8, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ - TRNS, FN5, FN8, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ - TRNS, TRNS, TRNS, FN7, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ - TRNS, TRNS, TRNS, TRNS, FN6, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + DF0, DF1, DF2, DF3, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + TRNS, DF0, DF3, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + TRNS, TRNS, TRNS, DF2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + TRNS, TRNS, TRNS, TRNS, DF1, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), }; - -/* - * Fn action definition - */ -const uint16_t PROGMEM fn_actions[] = { - [5] = ACTION_DEFAULT_LAYER_SET(0), // set qwerty layout - [6] = ACTION_DEFAULT_LAYER_SET(1), // set colemak layout - [7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout - [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout - [9] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRV), -}; diff --git a/keyboards/sentraq/s60_x/keymaps/jpec/keymap.c b/keyboards/sentraq/s60_x/keymaps/jpec/keymap.c index 01455401981..24182ad20a3 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 . #define KC_MO1 MO(1) #define KC_SPFN LT(1, KC_SPC) +#define KC_SDEL S(KC_DEL) +#define KC_CINS C(KC_INS) +#define KC_SINS S(KC_INS) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Layout 0: Default Layer @@ -57,20 +60,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, DEL, \ TRNS, MPRV, MPLY, MNXT, MSTP, TRNS, TRNS, PGUP, UP, PGDN, TRNS, SLCK, PAUS, INS, \ TRNS, VOLD, MUTE, VOLU, TRNS, TRNS, HOME, LEFT, DOWN, RGHT, END, TRNS, TRNS, PENT, \ - TRNS, TRNS, PSCR, FN2, FN3, FN4, CALC, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CAPS, TRNS, \ + TRNS, TRNS, PSCR, SDEL, CINS, SINS, CALC, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CAPS, TRNS, \ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), }; -/* -* Fn action definition -*/ -const uint16_t PROGMEM fn_actions[] = { - [2] = ACTION_MODS_KEY(MOD_LSFT, KC_DEL), /* Cut */ - [3] = ACTION_MODS_KEY(MOD_LCTL, KC_INS), /* Copy */ - [4] = ACTION_MODS_KEY(MOD_LSFT, KC_INS), /* Paste */ -}; - - void matrix_init_user(void) { } diff --git a/keyboards/sentraq/s60_x/keymaps/poker/keymap.c b/keyboards/sentraq/s60_x/keymaps/poker/keymap.c index 3b38ed501b8..6286f243717 100644 --- a/keyboards/sentraq/s60_x/keymaps/poker/keymap.c +++ b/keyboards/sentraq/s60_x/keymaps/poker/keymap.c @@ -3,6 +3,16 @@ #define KC_MO6 MO(6) #define KC_MO7 MO(7) +#define KC_DF0 DF(0) +#define KC_DF1 DF(1) +#define KC_DF2 DF(2) +#define KC_DF3 DF(3) + +#define KC_TG4 TG(4) +#define KC_TG5 TG(5) + +#define KC_CSES C(S(KC_ESC)) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* 0: qwerty ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ @@ -139,10 +149,10 @@ FnS: toggle Arrow overlay */ LAYOUT_kc( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ - TRNS, FN2, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, MO7, \ - TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN3, END, TRNS, TRNS, \ + TRNS, TG5, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, MO7, \ + TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \ TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \ - TRNS, TRNS, TRNS, FN1, TRNS, TRNS, TRNS, TRNS), + TRNS, TRNS, TRNS, TG4, TRNS, TRNS, TRNS, TRNS), /* 7: Layout selector ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ │ Lq │ Lc │ Ld │ Lw │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ @@ -163,19 +173,9 @@ Lw: set Workman layout */ LAYOUT_kc( - FN5, FN6, FN7, FN8, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ - TRNS, FN5, FN8, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ - TRNS, TRNS, TRNS, FN7, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ - TRNS, TRNS, TRNS, TRNS, FN6, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + DF0, DF1, DF2, DF3, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + TRNS, DF0, DF3, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + TRNS, TRNS, TRNS, DF2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + TRNS, TRNS, TRNS, TRNS, DF1, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), }; -const uint16_t PROGMEM fn_actions[] = { - /* Poker Layout */ - [1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay - [2] = ACTION_LAYER_TOGGLE(5), // toggle Esc overlay - [3] = ACTION_MODS_KEY(MOD_RCTL|MOD_RSFT, KC_ESC), // Task(RControl,RShift+Esc) - [5] = ACTION_DEFAULT_LAYER_SET(0), // set qwerty layout - [6] = ACTION_DEFAULT_LAYER_SET(1), // set colemak layout - [7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout - [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout -}; diff --git a/keyboards/sentraq/s60_x/keymaps/poker_bit/keymap.c b/keyboards/sentraq/s60_x/keymaps/poker_bit/keymap.c index d66cc93c3ae..a4ab412ee2b 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 @@ #include QMK_KEYBOARD_H +#define KC_TG5 TG(5) +#define KC_TG6 TG(6) +#define KC_CSES C(S(KC_ESC)) + // Poker fix with toggle and bit operation // Fn + Esc = ` // Fn + {left, down, up, right} = {home, pgdown, pgup, end} @@ -38,10 +42,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [4] = LAYOUT_kc( TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ - CAPS, FN2, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ - TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN4, END, TRNS, TRNS, \ + CAPS, TG6, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ + TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \ TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \ - TRNS, TRNS, TRNS, FN1, TRNS, TRNS, TRNS, TRNS), + TRNS, TRNS, TRNS, TG5, TRNS, TRNS, TRNS, TRNS), /* 5: Poker with Arrow ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ @@ -103,8 +107,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM fn_actions[] = { /* Poker Layout */ [0] = ACTION_LAYER_BIT_XOR(1, 0b0101, ON_BOTH), // Poker Fn(with fix for Esc) - [1] = ACTION_LAYER_TOGGLE(5), // Poker Arrow toggle - [2] = ACTION_LAYER_TOGGLE(6), // Poker Esc toggle [3] = ACTION_LAYER_BIT_XOR(1, 0b1101, ON_BOTH), // Poker Fn(with fix for Arrow) - [4] = ACTION_MODS_KEY(MOD_RCTL|MOD_RSFT, KC_ESC), // FN3 Task(RControl,RShift+Esc) }; diff --git a/keyboards/sentraq/s60_x/keymaps/poker_set/keymap.c b/keyboards/sentraq/s60_x/keymaps/poker_set/keymap.c index 3f639246795..64678cd56ca 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 @@ #include QMK_KEYBOARD_H +#define KC_CSES C(S(KC_ESC)) + // Poker fix with set(state transition) // Fn + Esc = ` // Fn + {left, down, up, right} = {home, pgdown, pgup, end} @@ -96,7 +98,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LAYOUT_kc( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ TRNS, FN6, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ - TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN8, END, TRNS, TRNS, \ + TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \ TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \ TRNS, TRNS, TRNS, FN5, FN4, TRNS, TRNS, TRNS), /* 5: Poker Fn'd arrow @@ -115,7 +117,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LAYOUT_kc( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ TRNS, FN7, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ - TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN8, END, TRNS, TRNS, \ + TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \ TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, PGUP, TRNS, \ TRNS, TRNS, TRNS, FN4, FN5, HOME, PGDN, END), /* 6: Poker Fn'd Esc @@ -134,7 +136,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LAYOUT_kc( GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ TRNS, FN4, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ - TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN8, END, TRNS, TRNS, \ + TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \ TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, TRNS, TRNS, \ TRNS, TRNS, TRNS, FN7, FN6, TRNS, TRNS, TRNS), /* 7: Poker Fn'd Arrow + Esc @@ -153,7 +155,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LAYOUT_kc( GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, TRNS, \ TRNS, FN5, UP, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, CALC, TRNS, HOME, INS, TRNS, \ - TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, FN8, END, TRNS, TRNS, \ + TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, PSCR, SLCK, PAUS, TRNS, CSES, END, TRNS, TRNS, \ TRNS, TRNS, DEL, TRNS, WHOM, MUTE, VOLU, VOLD, TRNS, PGUP, PGDN, DEL, TRNS, PGUP, TRNS, \ TRNS, TRNS, TRNS, FN6, FN7, HOME, PGDN, END), }; @@ -173,6 +175,4 @@ const uint16_t PROGMEM fn_actions[] = { [5] = ACTION_LAYER_SET(1, ON_RELEASE), // FN5 move to arrow when release [6] = ACTION_LAYER_SET(2, ON_RELEASE), // FN6 move to Esc when release [7] = ACTION_LAYER_SET(3, ON_RELEASE), // FN7 move to arrow + Esc when release - - [8] = ACTION_MODS_KEY(MOD_RCTL|MOD_RSFT, KC_ESC), // FN8 Task(RControl,RShift+Esc) }; diff --git a/keyboards/sentraq/s60_x/keymaps/spacefn/keymap.c b/keyboards/sentraq/s60_x/keymaps/spacefn/keymap.c index ee7ec6cd687..6ef273d1e31 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] = { GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, DEL, \ TRNS, TRNS, TRNS, ESC, TRNS, TRNS, TRNS, HOME, UP, END, PSCR, SLCK, PAUS, INS, \ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, PGUP, LEFT, DOWN, RGHT, TRNS, TRNS, TRNS, TRNS, \ - TRNS, TRNS, TRNS, TRNS, TRNS, SPC, PGDN, GRV, FN1, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + TRNS, TRNS, TRNS, TRNS, TRNS, SPC, PGDN, GRV, TILD, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), }; - -/* - * Fn action definition - */ -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde -}; diff --git a/keyboards/sentraq/s65_x/keymaps/kelorean/keymap.c b/keyboards/sentraq/s65_x/keymaps/kelorean/keymap.c index d5b4937aa59..8e1496bc9c1 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] = { [_FL] = LAYOUT_65_ansi( 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, _______, _______, \ - _______, F(3), KC_UP, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, \ + _______, TG(_AL), KC_UP, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, \ _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______, _______, _______, \ - _______, F(5), _______, F(1), F(2), _______, _______, _______, KC_HOME, KC_END, _______, _______, KC_VOLU, _______, \ + _______, TG(_UL), _______, TG(_CM), TG(_DV), _______, _______, _______, KC_HOME, KC_END, _______, _______, KC_VOLU, _______, \ _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_MPLY), /* 5: Locking layer for controlling the underglow @@ -138,11 +138,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_TOGGLE(_CM), //Toggle Colemak Layer overlay - [2] = ACTION_LAYER_TOGGLE(_DV), // Toggle Dvorak Layer overlay - [3] = ACTION_LAYER_TOGGLE(_AL), // Toggle Arrow Layer overlay - [5] = ACTION_LAYER_TOGGLE(_UL), // Toggle Underglow Layer overlay - -}; diff --git a/keyboards/sentraq/s65_x/keymaps/nall/keymap.c b/keyboards/sentraq/s65_x/keymaps/nall/keymap.c index 093070cb4b8..8589a797fe6 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] = { [_FL] = LAYOUT_65_ansi( 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, \ - 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, \ + 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, \ 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, \ - 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, \ + 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, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_MPLY), /* 3: Locking layer for controlling the underglow @@ -92,9 +92,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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, \ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), }; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_TOGGLE(_AL), // Toggle Arrow Layer overlay - [3] = ACTION_LAYER_TOGGLE(_UL), // Toggle Underglow Layer overlay -}; - diff --git a/keyboards/2_milk/2_milk.c b/keyboards/spaceman/2_milk/2_milk.c similarity index 100% rename from keyboards/2_milk/2_milk.c rename to keyboards/spaceman/2_milk/2_milk.c diff --git a/keyboards/2_milk/2_milk.h b/keyboards/spaceman/2_milk/2_milk.h similarity index 100% rename from keyboards/2_milk/2_milk.h rename to keyboards/spaceman/2_milk/2_milk.h diff --git a/keyboards/2_milk/config.h b/keyboards/spaceman/2_milk/config.h similarity index 97% rename from keyboards/2_milk/config.h rename to keyboards/spaceman/2_milk/config.h index e9a104117b1..49211535d02 100644 --- a/keyboards/2_milk/config.h +++ b/keyboards/spaceman/2_milk/config.h @@ -20,7 +20,7 @@ #define VENDOR_ID 0xFEED #define PRODUCT_ID 0xB195 #define DEVICE_VER 0x0001 -#define MANUFACTURER rionlion100 +#define MANUFACTURER Spaceman #define PRODUCT 2% Milk #define DESCRIPTION A milk themed 2% Keyboard diff --git a/keyboards/2_milk/info.json b/keyboards/spaceman/2_milk/info.json similarity index 84% rename from keyboards/2_milk/info.json rename to keyboards/spaceman/2_milk/info.json index 6dc4eeaf8bf..6c2bd78b282 100644 --- a/keyboards/2_milk/info.json +++ b/keyboards/spaceman/2_milk/info.json @@ -2,7 +2,7 @@ "keyboard_name": "2% Milk", "keyboard_folder": "2_milk", "url": "", - "maintainer": "rionlion100 (Spaceman)", + "maintainer": "Spaceman", "width": 1, "height": 2, "layouts": { diff --git a/keyboards/2_milk/keymaps/binary/keymap.c b/keyboards/spaceman/2_milk/keymaps/binary/keymap.c similarity index 100% rename from keyboards/2_milk/keymaps/binary/keymap.c rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/binary/readme.md rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/copypasta/keymap.c rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/copypasta/readme.md rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/default/keymap.c rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/default/readme.md rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/emoji/config.h rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/emoji/keymap.c rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/emoji/readme.md rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/emoji/rules.mk rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/excessbread/keymap.c rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/excessbread/readme.md rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/mikethetiger/keymap.c rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/mikethetiger/readme.md rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/mikethetiger/rules.mk rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/mouse/keymap.c rename to 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 similarity index 100% rename from keyboards/2_milk/keymaps/mouse/readme.md rename to keyboards/spaceman/2_milk/keymaps/mouse/readme.md diff --git a/keyboards/2_milk/readme.md b/keyboards/spaceman/2_milk/readme.md similarity index 70% rename from keyboards/2_milk/readme.md rename to keyboards/spaceman/2_milk/readme.md index f3a85458ced..6745aa65c8e 100644 --- a/keyboards/2_milk/readme.md +++ b/keyboards/spaceman/2_milk/readme.md @@ -4,12 +4,12 @@ A 2% Meme board themed around a milk carton -Keyboard Maintainer: Spaceman AKA:[Rionlion100](https://github.com/rionlion100) -Hardware Availability: [Open Source](https://github.com/Rionlion100/Spaceboards/tree/master/Keyboards/2%25%20Milk) +Keyboard Maintainer: [Spaceman](https://github.com/Spaceman) +Hardware Availability: [Open Source](https://github.com/Spaceman/Spaceboards/tree/master/Keyboards/2%25%20Milk) Make example for this keyboard (after setting up your build environment): - make 2_milk:default + make spaceman/2_milk:default See 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/2_milk/rules.mk b/keyboards/spaceman/2_milk/rules.mk similarity index 100% rename from keyboards/2_milk/rules.mk rename to keyboards/spaceman/2_milk/rules.mk diff --git a/keyboards/pancake/config.h b/keyboards/spaceman/pancake/config.h similarity index 100% rename from keyboards/pancake/config.h rename to keyboards/spaceman/pancake/config.h diff --git a/keyboards/pancake/feather/config.h b/keyboards/spaceman/pancake/feather/config.h similarity index 100% rename from keyboards/pancake/feather/config.h rename to keyboards/spaceman/pancake/feather/config.h diff --git a/keyboards/pancake/feather/rules.mk b/keyboards/spaceman/pancake/feather/rules.mk similarity index 100% rename from keyboards/pancake/feather/rules.mk rename to keyboards/spaceman/pancake/feather/rules.mk diff --git a/keyboards/pancake/info.json b/keyboards/spaceman/pancake/info.json similarity index 98% rename from keyboards/pancake/info.json rename to keyboards/spaceman/pancake/info.json index 6d2b2a9bb40..9a21f09e18b 100644 --- a/keyboards/pancake/info.json +++ b/keyboards/spaceman/pancake/info.json @@ -2,7 +2,7 @@ "keyboard_name": "Pancake", "keyboard_folder": "Pancake", "url": "", - "maintainer": "rionlion100 (Spaceman)", + "maintainer": "Spaceman", "width": 12, "height": 4, "layouts": { diff --git a/keyboards/pancake/keymaps/default/keymap.c b/keyboards/spaceman/pancake/keymaps/default/keymap.c similarity index 100% rename from keyboards/pancake/keymaps/default/keymap.c rename to 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 00000000000..7eb8cc6d8d6 --- /dev/null +++ b/keyboards/spaceman/pancake/keymaps/default/readme.md @@ -0,0 +1,3 @@ +# Default keymap for Pancake + +designed by: Spaceman diff --git a/keyboards/pancake/pancake.c b/keyboards/spaceman/pancake/pancake.c similarity index 100% rename from keyboards/pancake/pancake.c rename to keyboards/spaceman/pancake/pancake.c diff --git a/keyboards/pancake/pancake.h b/keyboards/spaceman/pancake/pancake.h similarity index 100% rename from keyboards/pancake/pancake.h rename to keyboards/spaceman/pancake/pancake.h diff --git a/keyboards/pancake/promicro/config.h b/keyboards/spaceman/pancake/promicro/config.h similarity index 100% rename from keyboards/pancake/promicro/config.h rename to keyboards/spaceman/pancake/promicro/config.h diff --git a/keyboards/pancake/promicro/rules.mk b/keyboards/spaceman/pancake/promicro/rules.mk similarity index 100% rename from keyboards/pancake/promicro/rules.mk rename to keyboards/spaceman/pancake/promicro/rules.mk diff --git a/keyboards/pancake/readme.md b/keyboards/spaceman/pancake/readme.md similarity index 82% rename from keyboards/pancake/readme.md rename to keyboards/spaceman/pancake/readme.md index 3e3125f4d7a..34cf6382bcb 100644 --- a/keyboards/pancake/readme.md +++ b/keyboards/spaceman/pancake/readme.md @@ -2,11 +2,11 @@ Ortho 40% Ortho Keyboard with an option for the adafruit feather -Keyboard Maintainer: Spaceman AKA:[Rionlion100](https://github.com/rionlion100) +Keyboard Maintainer: [Spaceman](https://github.com/Spaceman) Hardware Availability: [GB](https://geekhack.org/index.php?topic=101371.0) Make example for this keyboard (after setting up your build environment): - make pancake:default + make spaceman/pancake:default See 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 abff350ea0c..0d77351f326 100644 --- a/keyboards/subatomic/rules.mk +++ b/keyboards/subatomic/rules.mk @@ -23,7 +23,7 @@ COMMAND_ENABLE = no # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = yes # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = no # Audio output UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_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 d9d94974530..dd986610116 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] = { ) }; -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case LT(_LOWER, KC_SPACE): return 160; @@ -136,7 +136,7 @@ uint16_t get_tapping_term(uint16_t keycode) { default: #ifndef TAPPING_TERM return 200; -#else +#else return TAPPING_TERM; #endif } diff --git a/keyboards/the_royal/liminal/keymaps/default_iso/keymap.c b/keyboards/the_royal/liminal/keymaps/default_iso/keymap.c index 3d8debee3d6..62ff2b6a5d4 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] = { }; -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case LT(_LOWER, KC_SPACE): return 160; diff --git a/keyboards/thevankeyboards/minivan/keymaps/like_jis/keymap.c b/keyboards/thevankeyboards/minivan/keymaps/like_jis/keymap.c index 3d282e182b3..509b4978028 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] = { }; #define TAPPING_LAYER_TERM 150 // Custom LT Tapping term -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KC_BSLO: return TAPPING_LAYER_TERM; diff --git a/keyboards/thevankeyboards/minivan/keymaps/mjt/keymap.c b/keyboards/thevankeyboards/minivan/keymaps/mjt/keymap.c index 6e22e9e23af..a9d3a802dc0 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) if (record->event.pressed) { #ifdef AUDIO_ENABLE stop_all_notes(); - PLAY_NOTE_ARRAY(tone_plover, false, 0); + PLAY_SONG(tone_plover); #endif layer_off(_NUMSYM); layer_off(_FKEYS); @@ -110,7 +110,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case 7: // LAYERRESET if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + PLAY_SONG(tone_qwerty); #endif layer_off(_NUMSYM); layer_off(_FKEYS); @@ -132,7 +132,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if(record->event.pressed) { #ifdef AUDIO_ENABLE stop_all_notes(); - PLAY_NOTE_ARRAY(tone_adjust, false, 0); + PLAY_SONG(tone_adjust); #endif layer_off(_NUMSYM); layer_off(_FKEYS); @@ -166,12 +166,12 @@ void matrix_init_user(void) { void startup_user() { _delay_ms(20); // gets rid of tick - PLAY_NOTE_ARRAY(tone_startup, false, 0); + PLAY_SONG(tone_startup); } void shutdown_user() { - PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + PLAY_SONG(tone_goodbye); _delay_ms(150); stop_all_notes(); } @@ -183,6 +183,6 @@ void music_on_user(void) void music_scale_user(void) { - PLAY_NOTE_ARRAY(music_scale, false, 0); + PLAY_SONG(music_scale); } #endif diff --git a/keyboards/thevankeyboards/roadkit/keymaps/mjt/keymap.c b/keyboards/thevankeyboards/roadkit/keymaps/mjt/keymap.c index 18454d56496..db5f6c37c81 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) { case NUMPAD_LOCK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_numpad, false, 0); + PLAY_SONG(tone_numpad); #endif persistant_default_layer_set(1UL<<_NUMPAD); } @@ -154,7 +154,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case NAVIGATION_LOCK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_navigation, false, 0); + PLAY_SONG(tone_navigation); #endif persistant_default_layer_set(1UL<<_NAVIGATION); } @@ -163,7 +163,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case EXCEL_LOCK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_excel, false, 0); + PLAY_SONG(tone_excel); #endif persistant_default_layer_set(1UL<<_EXCEL); } diff --git a/keyboards/tkc1800/config.h b/keyboards/tkc1800/config.h index 5ba40bb35cd..9c35699c92c 100644 --- a/keyboards/tkc1800/config.h +++ b/keyboards/tkc1800/config.h @@ -67,6 +67,11 @@ along with this program. If not, see . /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE +#define QMK_ESC_OUTPUT A0 // usually COL +#define QMK_ESC_INPUT F4 // usually ROW +#define QMK_LED D2 // NumLock on TKC1800 +//#define QMK_SPEAKER C6 + /* * Force NKRO * diff --git a/keyboards/tkc1800/i2c.c b/keyboards/tkc1800/i2c.c deleted file mode 100644 index cd2b835d501..00000000000 --- a/keyboards/tkc1800/i2c.c +++ /dev/null @@ -1,166 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "i2c.h" - -#ifdef USE_I2C - -// Limits the amount of we wait for any one i2c transaction. -// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is -// 9 bits, a single transaction will take around 90μs to complete. -// -// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit -// poll loop takes at least 8 clock cycles to execute -#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 - -#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) - -volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -static volatile uint8_t slave_buffer_pos; -static volatile bool slave_has_register_set = false; - -// Wait for an i2c operation to finish -inline static -void i2c_delay(void) { - uint16_t lim = 0; - while(!(TWCR & (1<10. - // Check datasheets for more info. - TWBR = ((F_CPU/SCL_CLOCK)-16)/2; -} - -// Start a transaction with the given i2c slave address. The direction of the -// transfer is set with I2C_READ and I2C_WRITE. -// returns: 0 => success -// 1 => error -uint8_t i2c_master_start(uint8_t address) { - TWCR = (1< slave ACK -// 1 => slave NACK -uint8_t i2c_master_write(uint8_t data) { - TWDR = data; - TWCR = (1<= SLAVE_BUFFER_SIZE ) { - ack = 0; - slave_buffer_pos = 0; - } - slave_has_register_set = true; - } else { - i2c_slave_buffer[slave_buffer_pos] = TWDR; - BUFFER_POS_INC(); - } - break; - - case TW_ST_SLA_ACK: - case TW_ST_DATA_ACK: - // master has addressed this device as a slave transmitter and is - // requesting data. - TWDR = i2c_slave_buffer[slave_buffer_pos]; - BUFFER_POS_INC(); - break; - - case TW_BUS_ERROR: // something went wrong, reset twi state - TWCR = 0; - default: - break; - } - // Reset everything, so we are ready for the next TWI interrupt - TWCR |= (1< - -#ifndef F_CPU -#define F_CPU 16000000UL -#endif - -#define I2C_READ 1 -#define I2C_WRITE 0 - -#define I2C_ACK 1 -#define I2C_NACK 0 - -#define SLAVE_BUFFER_SIZE 0x10 - -// i2c SCL clock frequency -#define SCL_CLOCK 800000L - -extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -void i2c_master_init(void); -uint8_t i2c_master_start(uint8_t address); -void i2c_master_stop(void); -uint8_t i2c_master_write(uint8_t data); -uint8_t i2c_master_read(int); -void i2c_reset_state(void); -void i2c_slave_init(uint8_t address); - - -static inline unsigned char i2c_start_read(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_READ); -} - -static inline unsigned char i2c_start_write(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_WRITE); -} - -// from SSD1306 scrips -extern unsigned char i2c_rep_start(unsigned char addr); -extern void i2c_start_wait(unsigned char addr); -extern unsigned char i2c_readAck(void); -extern unsigned char i2c_readNak(void); -extern unsigned char i2c_read(unsigned char ack); - -#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); - -#endif diff --git a/keyboards/tkc1800/keymaps/default/config.h b/keyboards/tkc1800/keymaps/default/config.h deleted file mode 100644 index ee142927f3a..00000000000 --- a/keyboards/tkc1800/keymaps/default/config.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright 2017 Mathias Andersson - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#define USE_I2C -#define SSD1306OLED -//#define OLED_ROTATE180 -#define SSD1306_ADDRESS 0x3C - -// place overrides here diff --git a/keyboards/tkc1800/keymaps/default/keymap.c b/keyboards/tkc1800/keymaps/default/keymap.c index 5455934a306..4f4c7f8e9cd 100644 --- a/keyboards/tkc1800/keymaps/default/keymap.c +++ b/keyboards/tkc1800/keymaps/default/keymap.c @@ -13,11 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + #include QMK_KEYBOARD_H -#include "LUFA/Drivers/Peripheral/TWI.h" -#include "i2c.h" -#include "ssd1306.h" - //Layers @@ -26,13 +23,6 @@ enum { FUNCTION, }; -bool screenWorks = 0; - -//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() -static char layer_lookup[][14] = {"Base","Function"}; - - - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap BASE: (Base Layer) Default Layer * ,-------------------------------------------------------. ,-------------------. @@ -88,72 +78,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} - -void led_set_user(uint8_t usb_led) { -} - -void matrix_init_user(void) { - #ifdef USE_I2C - i2c_master_init(); - #ifdef SSD1306OLED - // calls code for the SSD1306 OLED - _delay_ms(400); - TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); - if ( iota_gfx_init() ) { // turns on the display - screenWorks = 1; - } - #endif - #endif - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -void matrix_scan_user(void) { - #ifdef SSD1306OLED - if ( screenWorks ) { - iota_gfx_task(); // this is what updates the display continuously - }; - #endif -} - -void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} - -void iota_gfx_task_user(void) { - #if DEBUG_TO_SCREEN - if (debug_enable) { - return; +#ifdef OLED_DRIVER_ENABLE +void oled_task_user(void) { + oled_write_P(PSTR("TKC1800\n"),false); + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case BASE: + oled_write_P(PSTR("Base\n"), false); + break; + case FUNCTION: + oled_write_P(PSTR("Function\n"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("Undefined"), false); } - #endif - - struct CharacterMatrix matrix; - - matrix_clear(&matrix); - matrix_write_P(&matrix, PSTR("TKC1800")); - - uint8_t layer = biton32(layer_state); - - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%d", layer); - matrix_write_P(&matrix, PSTR("\nLayer: ")); - matrix_write(&matrix, layer_lookup[layer]); - // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n\n%s %s %s", - (host_keyboard_leds() & (1< - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#define USE_I2C -#define SSD1306OLED -//#define OLED_ROTATE180 -#define SSD1306_ADDRESS 0x3C - -// place overrides here diff --git a/keyboards/tkc1800/keymaps/smt/keymap.c b/keyboards/tkc1800/keymaps/smt/keymap.c index 9f506b443b8..9b6ad80d3a6 100644 --- a/keyboards/tkc1800/keymaps/smt/keymap.c +++ b/keyboards/tkc1800/keymaps/smt/keymap.c @@ -13,10 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + #include QMK_KEYBOARD_H -#include "LUFA/Drivers/Peripheral/TWI.h" -#include "i2c.h" -#include "ssd1306.h" // Custom macros #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl @@ -32,11 +30,6 @@ enum { FUNCTION, }; -//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() -static char layer_lookup[][14] = {"Qwerty","Dvorak","Function"}; - - - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap QWERTY: (Qwerty Layer) Default Layer * ,-------------------------------------------------------. ,-------------------. @@ -151,64 +144,34 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } -void led_set_user(uint8_t usb_led) { - -} - -void matrix_init_user(void) { - #ifdef USE_I2C - i2c_master_init(); - #ifdef SSD1306OLED - // calls code for the SSD1306 OLED - _delay_ms(400); - TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); - iota_gfx_init(); // turns on the display - #endif - #endif - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -void matrix_scan_user(void) { - #ifdef SSD1306OLED - iota_gfx_task(); // this is what updates the display continuously - #endif -} - -void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} - -void iota_gfx_task_user(void) { - #if DEBUG_TO_SCREEN - if (debug_enable) { - return; +#ifdef OLED_DRIVER_ENABLE +void oled_task_user(void) { + oled_write_P(PSTR("TKC1800\n"),false); + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case QWERTY: + oled_write_P(PSTR("Base\n"), false); + break; + case COLEMAK: + oled_write_P(PSTR("Colemak\n"), false); + break; + case DVORAK: + oled_write_P(PSTR("Dvorak\n"), false); + break; + case FUNCTION: + oled_write_P(PSTR("Function\n"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("Undefined"), false); } - #endif - - struct CharacterMatrix matrix; - - matrix_clear(&matrix); - matrix_write_P(&matrix, PSTR("TKC1800")); - - uint8_t layer = biton32(layer_state); - - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%d", layer); - matrix_write_P(&matrix, PSTR("\nLayer: ")); - matrix_write(&matrix, layer_lookup[layer]); - // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n\n%s %s %s", - (host_keyboard_leds() & (1<. */ #include QMK_KEYBOARD_H -#include "LUFA/Drivers/Peripheral/TWI.h" -#include "i2c.h" -#include "ssd1306.h" - //Layers @@ -26,13 +22,6 @@ enum { FUNCTION, }; -bool screenWorks = 0; - -//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() -static char layer_lookup[][14] = {"Base","Function"}; - - - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap BASE: (Base Layer) Default Layer * ,-------------------------------------------------------. ,-------------------. @@ -88,72 +77,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} - -void led_set_user(uint8_t usb_led) { - -} - -void matrix_init_user(void) { - #ifdef USE_I2C - i2c_master_init(); - #ifdef SSD1306OLED - // calls code for the SSD1306 OLED - _delay_ms(400); - TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); - if ( iota_gfx_init() ) { // turns on the display - screenWorks = 1; - } - #endif - #endif - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -void matrix_scan_user(void) { - #ifdef SSD1306OLED - if ( screenWorks ) { - iota_gfx_task(); // this is what updates the display continuously - }; - #endif -} - -void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} - -void iota_gfx_task_user(void) { - #if DEBUG_TO_SCREEN - if (debug_enable) { - return; +#ifdef OLED_DRIVER_ENABLE +void oled_task_user(void) { + oled_write_P(PSTR("TKC1800\n"),false); + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case BASE: + oled_write_P(PSTR("Base\n"), false); + break; + case FUNCTION: + oled_write_P(PSTR("Function\n"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("Undefined"), false); } - #endif - - struct CharacterMatrix matrix; - - matrix_clear(&matrix); - matrix_write_P(&matrix, PSTR("TKC1800")); - - uint8_t layer = biton32(layer_state); - - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%d", layer); - matrix_write_P(&matrix, PSTR("\nLayer: ")); - matrix_write(&matrix, layer_lookup[layer]); - // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n\n%s %s %s", - (host_keyboard_leds() & (1< - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#define USE_I2C -#define SSD1306OLED -//#define OLED_ROTATE180 -#define SSD1306_ADDRESS 0x3C - -// place overrides here diff --git a/keyboards/tkc1800/keymaps/wkl/keymap.c b/keyboards/tkc1800/keymaps/wkl/keymap.c index 6f331c61ccb..3c65b61d117 100644 --- a/keyboards/tkc1800/keymaps/wkl/keymap.c +++ b/keyboards/tkc1800/keymaps/wkl/keymap.c @@ -13,11 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + #include QMK_KEYBOARD_H -#include "LUFA/Drivers/Peripheral/TWI.h" -#include "i2c.h" -#include "ssd1306.h" - //Layers @@ -26,13 +23,6 @@ enum { FUNCTION, }; -bool screenWorks = 0; - -//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() -static char layer_lookup[][14] = {"Base","Function"}; - - - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap BASE: (Base Layer) Default Layer * ,-------------------------------------------------------. ,-------------------. @@ -71,72 +61,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} - -void led_set_user(uint8_t usb_led) { - -} - -void matrix_init_user(void) { - #ifdef USE_I2C - i2c_master_init(); - #ifdef SSD1306OLED - // calls code for the SSD1306 OLED - _delay_ms(400); - TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); - if ( iota_gfx_init() ) { // turns on the display - screenWorks = 1; - } - #endif - #endif - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -void matrix_scan_user(void) { - #ifdef SSD1306OLED - if ( screenWorks ) { - iota_gfx_task(); // this is what updates the display continuously - }; - #endif -} - -void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} - -void iota_gfx_task_user(void) { - #if DEBUG_TO_SCREEN - if (debug_enable) { - return; +#ifdef OLED_DRIVER_ENABLE +void oled_task_user(void) { + oled_write_P(PSTR("TKC1800\n"),false); + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case BASE: + oled_write_P(PSTR("Base\n"), false); + break; + case FUNCTION: + oled_write_P(PSTR("Function\n"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("Undefined"), false); } - #endif - - struct CharacterMatrix matrix; - - matrix_clear(&matrix); - matrix_write_P(&matrix, PSTR("TKC1800")); - - uint8_t layer = biton32(layer_state); - - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%d", layer); - matrix_write_P(&matrix, PSTR("\nLayer: ")); - matrix_write(&matrix, layer_lookup[layer]); - // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n\n%s %s %s", - (host_keyboard_leds() & (1< - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -//#define USE_I2C -//#define SSD1306OLED -//#define OLED_ROTATE180 -#define SSD1306_ADDRESS 0x3C - -// place overrides here diff --git a/keyboards/tkc1800/keymaps/yanfali/keymap.c b/keyboards/tkc1800/keymaps/yanfali/keymap.c index 8dad3446def..bbffc2d20b0 100644 --- a/keyboards/tkc1800/keymaps/yanfali/keymap.c +++ b/keyboards/tkc1800/keymaps/yanfali/keymap.c @@ -13,11 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + #include QMK_KEYBOARD_H -#include "LUFA/Drivers/Peripheral/TWI.h" -#include "i2c.h" -#include "ssd1306.h" - //Layers @@ -26,11 +23,6 @@ enum { FUNCTION, }; -//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() -static char layer_lookup[][14] = {"Base","Function"}; - - - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap BASE: (Base Layer) Default Layer * ,-------------------------------------------------------. ,-------------------. @@ -69,68 +61,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} - -void led_set_user(uint8_t usb_led) { - -} - -void matrix_init_user(void) { - #ifdef USE_I2C - i2c_master_init(); - #ifdef SSD1306OLED - // calls code for the SSD1306 OLED - _delay_ms(400); - TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); - iota_gfx_init(); // turns on the display - #endif - #endif - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -void matrix_scan_user(void) { - #ifdef SSD1306OLED - iota_gfx_task(); // this is what updates the display continuously - #endif -} - -void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} - -void iota_gfx_task_user(void) { - #if DEBUG_TO_SCREEN - if (debug_enable) { - return; +#ifdef OLED_DRIVER_ENABLE +void oled_task_user(void) { + oled_write_P(PSTR("TKC1800\n"),false); + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case BASE: + oled_write_P(PSTR("Base\n"), false); + break; + case FUNCTION: + oled_write_P(PSTR("Function\n"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("Undefined"), false); } - #endif - - struct CharacterMatrix matrix; - - matrix_clear(&matrix); - matrix_write_P(&matrix, PSTR("TKC1800")); - - uint8_t layer = biton32(layer_state); - - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%d", layer); - matrix_write_P(&matrix, PSTR("\nLayer: ")); - matrix_write(&matrix, layer_lookup[layer]); - // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n\n%s %s %s", - (host_keyboard_leds() & (1<. */ #pragma once -//#ifndef CONFIG_H -//#define CONFIG_H #include "config_common.h" - -// GCC include 'config.h" sequence in qmk_firmware/keyboards/zinc/ -// -include keyboards/zinc/config.h -// -include keyboards/zinc/rev?/config.h -// -include keyboards/zinc/rev?/keymaps/MAPNAME/config.h -// XXXX.c - -#include - -// GCC include search path in qmk_firmare/keyboards/zinc/ -// #include "..." search starts here: -// #include <...> search starts here: -// keyboards/zinc/rev?/keymaps/MAPNAME -// keyboards/zinc -// keyboards/zinc/rev? -// . -// ./tmk_core -// ...... - -#define NO_ACTION_MACRO -#define NO_ACTION_FUNCTION - -//#endif /* CONFIG_H */ diff --git a/keyboards/zinc/i2c.c b/keyboards/zinc/i2c.c deleted file mode 100644 index 4bee5c63982..00000000000 --- a/keyboards/zinc/i2c.c +++ /dev/null @@ -1,162 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "i2c.h" - -#ifdef USE_I2C - -// Limits the amount of we wait for any one i2c transaction. -// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is -// 9 bits, a single transaction will take around 90μs to complete. -// -// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit -// poll loop takes at least 8 clock cycles to execute -#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 - -#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) - -volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -static volatile uint8_t slave_buffer_pos; -static volatile bool slave_has_register_set = false; - -// Wait for an i2c operation to finish -inline static -void i2c_delay(void) { - uint16_t lim = 0; - while(!(TWCR & (1<10. - // Check datasheets for more info. - TWBR = ((F_CPU/SCL_CLOCK)-16)/2; -} - -// Start a transaction with the given i2c slave address. The direction of the -// transfer is set with I2C_READ and I2C_WRITE. -// returns: 0 => success -// 1 => error -uint8_t i2c_master_start(uint8_t address) { - TWCR = (1< slave ACK -// 1 => slave NACK -uint8_t i2c_master_write(uint8_t data) { - TWDR = data; - TWCR = (1<= SLAVE_BUFFER_SIZE ) { - ack = 0; - slave_buffer_pos = 0; - } - slave_has_register_set = true; - } else { - i2c_slave_buffer[slave_buffer_pos] = TWDR; - BUFFER_POS_INC(); - } - break; - - case TW_ST_SLA_ACK: - case TW_ST_DATA_ACK: - // master has addressed this device as a slave transmitter and is - // requesting data. - TWDR = i2c_slave_buffer[slave_buffer_pos]; - BUFFER_POS_INC(); - break; - - case TW_BUS_ERROR: // something went wrong, reset twi state - TWCR = 0; - default: - break; - } - // Reset everything, so we are ready for the next TWI interrupt - TWCR |= (1< - -#ifndef F_CPU -#define F_CPU 16000000UL -#endif - -#define I2C_READ 1 -#define I2C_WRITE 0 - -#define I2C_ACK 1 -#define I2C_NACK 0 - -#define SLAVE_BUFFER_SIZE 0x10 - -// i2c SCL clock frequency 400kHz -#define SCL_CLOCK 400000L - -extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -void i2c_master_init(void); -uint8_t i2c_master_start(uint8_t address); -void i2c_master_stop(void); -uint8_t i2c_master_write(uint8_t data); -uint8_t i2c_master_read(int); -void i2c_reset_state(void); -void i2c_slave_init(uint8_t address); - - -static inline unsigned char i2c_start_read(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_READ); -} - -static inline unsigned char i2c_start_write(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_WRITE); -} - -// from SSD1306 scrips -extern unsigned char i2c_rep_start(unsigned char addr); -extern void i2c_start_wait(unsigned char addr); -extern unsigned char i2c_readAck(void); -extern unsigned char i2c_readNak(void); -extern unsigned char i2c_read(unsigned char ack); - -#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); - -#endif diff --git a/keyboards/zinc/keymaps/default/config.h b/keyboards/zinc/keymaps/default/config.h index 4dcb0724ff7..2185dc9ebe4 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 . */ #pragma once -// if you need more program area, try uncomment follow line -#include "serial_config_simpleapi.h" // place overrides here // Selection of RGBLIGHT MODE to use. diff --git a/keyboards/zinc/keymaps/default/keymap.c b/keyboards/zinc/keymaps/default/keymap.c index 0f08d21ee78..cd1bf0328b8 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] = { \ * |------+------+------+------+------+------| |------+------+------+------+------+------| * | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | MODE | HUE- | SAT- | VAL- | | | | | | | | | + * |MODE R| MODE | HUE- | SAT- | VAL- | | | | | | |PageUp| | * |------+------+------+------+------+------| |------+------+------+------+------+------| * | | | | EISU | EISU | EISU | | KANA | KANA | Home |PageDn|PageUp| End | * `-----------------------------------------' `-----------------------------------------' @@ -147,13 +147,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { \ [_ADJUST] = LAYOUT_ortho_4x12( \ _______, RESET, RGBRST, _______, _______, _______, _______, QWERTY, COLEMAK, DVORAK, _______, KC_INS, \ _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, AG_NORM, AG_SWAP, KC_MINS, KC_EQL, KC_PSCR, KC_SLCK, KC_PAUS,\ - _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, _______, _______,\ - _______, _______, _______, EISU, EISU, EISU, KANA, KANA, KC_HOME, KC_PGDN, KC_PGUP, KC_END\ + RGB_RMOD,RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, KC_PGUP, _______,\ + _______, _______, _______, EISU, EISU, EISU, KANA, KANA, KANA, KC_HOME, KC_PGDN, KC_END\ ) }; // define variables for reactive RGB -bool TOG_STATUS = false; +bool TOG_STATUS = false; // Setting ADJUST layer RGB back to default void 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) { } return false; break; - + case RAISE: if (record->event.pressed) { //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) { } return false; break; + //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 + case RGB_RMOD: + #if defined(RGBLIGHT_ENABLE) + if (record->event.pressed) { + rgblight_mode_noeeprom(RGB_current_config.mode); + rgblight_step_reverse(); + RGB_current_config.mode = rgblight_config.mode; + } + return false; + #endif + break; + case RGB_MOD: - #ifdef RGBLIGHT_ENABLE + #if defined(RGBLIGHT_ENABLE) if (record->event.pressed) { rgblight_mode_noeeprom(RGB_current_config.mode); rgblight_step(); RGB_current_config.mode = rgblight_config.mode; } - #endif return false; + #endif break; 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 00000000000..6447e96ed42 --- /dev/null +++ b/keyboards/zinc/keymaps/default/readme_en.md @@ -0,0 +1,131 @@ +# The Default Zinc Layout +## layout + +### Qwerty + +``` + ,-----------------------------------------. ,-----------------------------------------. + | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Esc | Fn | Alt | Win |Lower |Space | | Space| Raise| Left | Down | Up | Right| + `------------------------------------------ ------------------------------------------' +``` + +### Colemak + +``` + ,-----------------------------------------. ,-----------------------------------------. + | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Esc |ADJUST| Alt | Win |LOWER |Space | | Space| RAISE| Left | Down | Up | Right| + `------------------------------------------ ------------------------------------------' +``` + +### Dvorak + +``` + ,-----------------------------------------. ,-----------------------------------------. + | Tab | ' | , | . | P | Y | | F | G | C | R | L | Del | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Ctrl | A | O | E | U | I | | D | H | T | N | S | / | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Esc |ADJUST| Alt | Win |LOWER |Space | | Space| RAISE| Left | Down | Up | Right| + `-----------------------------------------' `-----------------------------------------' +``` + +### Lower +``` + ,-----------------------------------------. ,-----------------------------------------. + | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | - | _ | + | { | } | | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | | Home | End | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | Next | Vol- | Vol+ | Play | + `-----------------------------------------' `-----------------------------------------' +``` + +### RAISE +``` + ,-----------------------------------------. ,-----------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | Next | Vol- | Vol+ | Play | + `-----------------------------------------' `-----------------------------------------' +``` + +### Adjust (Lower + Raise) +``` + ,-----------------------------------------. ,-----------------------------------------. + | | Reset|RGBRST|Aud on|Audoff| | | |Qwerty|Colemk|Dvorak| | Ins | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause | + |------+------+------+------+------+------| |------+------+------+------+------+------| + |MODE R|RGBMOD| HUE- | SAT- | VAL- | | | | | | |PageUp| | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | EISU | EISU | EISU | | KANA | KANA | KANA | Home |PageDn| End | + `-----------------------------------------' `-----------------------------------------' +``` + +## Compile + +go to qmk top directory. + +``` +$ cd qmk_firmware +``` +make with `zinc:` + +``` +$ make zinc:default +``` + +To make and flash with `:flash` + +``` +$ make zinc:default:flash +``` + + +## Customize + +You can customize from the command line. + +``` +# Zinc keyboard 'default' keymap: convenient command line option +make ZINC= zinc:defualt +# option= back | under | both | cont | na | ios +# ex. +# make ZINC=under zinc:defualt +# make ZINC=under,ios zinc:defualt +# make ZINC=back zinc:default +# make ZINC=back,na zinc:default +# make ZINC=back,ios zinc:default +``` + +Or edit `qmk_firmware/keyboards/zinc/rev1/keymaps/~/rules.mk` directly. + +``` +# Zinc keyboard customize +LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) +LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) +LED_BOTH_ENABLE = no # LED backlight and underglow +LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc +LED_ANIMATIONS = yes # LED animations +IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) +``` diff --git a/keyboards/zinc/keymaps/default/readme_jp.md b/keyboards/zinc/keymaps/default/readme_jp.md index dfedb37c15c..8132f5036e5 100644 --- a/keyboards/zinc/keymaps/default/readme_jp.md +++ b/keyboards/zinc/keymaps/default/readme_jp.md @@ -43,6 +43,44 @@ `-----------------------------------------' `-----------------------------------------' ``` + ### Lower +``` + ,-----------------------------------------. ,-----------------------------------------. + | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | - | _ | + | { | } | | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | | Home | End | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | Next | Vol- | Vol+ | Play | + `-----------------------------------------' `-----------------------------------------' +``` + +### RAISE +``` + ,-----------------------------------------. ,-----------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | Next | Vol- | Vol+ | Play | + `-----------------------------------------' `-----------------------------------------' +``` + +### Adjust (Lower + Raise) +``` + ,-----------------------------------------. ,-----------------------------------------. + | | Reset|RGBRST|Aud on|Audoff| | | |Qwerty|Colemk|Dvorak| | Ins | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause | + |------+------+------+------+------+------| |------+------+------+------+------+------| + |MODE R|RGBMOD| HUE- | SAT- | VAL- | | | | | | |PageUp| | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | EISU | EISU | EISU | | KANA | KANA | KANA | Home |PageDn| End | + `-----------------------------------------' `-----------------------------------------' +``` ## コンパイルの仕方 @@ -76,7 +114,7 @@ $ make zinc:default:clean ``` # Zinc keyboard 'default' keymap: convenient command line option make ZINC= zinc:defualt -# option= back | under | na | ios +# option= back | under | both | cont | na | ios # ex. # make ZINC=under zinc:defualt # make ZINC=under,ios zinc:defualt @@ -85,16 +123,16 @@ make ZINC= zinc:defualt # make ZINC=back,ios zinc:default ``` -あるいは`qmk_firmware/keyboards/zinc/rev1/keymaps/default/rules.mk` の以下の部分を直接編集して機能を有効化してください。 +あるいは`qmk_firmware/keyboards/zinc/rev1/keymaps/~/rules.mk` の以下の部分を直接編集して機能を有効化してください。 ``` # Zinc keyboard customize LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) +LED_BOTH_ENABLE = no # LED backlight and underglow +LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc LED_ANIMATIONS = yes # LED animations IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) - - ``` ## RGB backlight を有効にする @@ -120,4 +158,4 @@ RBG Underglow や RGBバックライトの輝度を抑えて、iPad, iPhone に ``` IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) -``` \ No newline at end of file +``` diff --git a/keyboards/zinc/keymaps/default/rules.mk b/keyboards/zinc/keymaps/default/rules.mk index c980f7d00bf..32e0f21610b 100644 --- a/keyboards/zinc/keymaps/default/rules.mk +++ b/keyboards/zinc/keymaps/default/rules.mk @@ -20,6 +20,9 @@ define ZINC_CUSTOMISE_MSG $(info Zinc customize) $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE)) $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE)) + $(info - LED_BOTH_ENABLE=$(LED_BOTH_ENABLE)) + $(info - LED_RGB_CONT=$(LED_RGB_CONT)) + $(info - RGB_MATRIX=$(RGB_MATRIX)) $(info - LED_ANIMATION=$(LED_ANIMATIONS)) $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE)) endef @@ -27,6 +30,10 @@ endef # Zinc keyboard customize LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) +LED_BOTH_ENABLE = no # LED backlight and underglow +LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc +RGB_MATRIX = no # RGB LED Matrix +RGB_MATRIX_SPLIT_RIGHT = no # RGB Matrix for RIGHT Hand LED_ANIMATIONS = yes # LED animations IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) Link_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 ### Zinc keyboard 'default' keymap: convenient command line option ## make ZINC= zinc:defualt -## option= back | under | na | ios +## option= back | under | both | cont | matrix | na | ios ## ex. ## make ZINC=under zinc:defualt ## make ZINC=under,ios zinc:defualt @@ -47,9 +54,22 @@ Link_Time_Optimization = no # if firmware size over limit, try this option ifneq ($(strip $(ZINC)),) ifeq ($(findstring back,$(ZINC)), back) LED_BACK_ENABLE = yes - else ifeq ($(findstring under,$(ZINC)), under) + endif + ifeq ($(findstring under,$(ZINC)), under) LED_UNDERGLOW_ENABLE = yes endif + ifeq ($(findstring both,$(ZINC)), both) + LED_BOTH_ENABLE = yes + endif + ifeq ($(findstring cont,$(ZINC)), cont) + LED_RGB_CONT = yes + endif + ifeq ($(findstring matrix,$(ZINC)), matrix) + RGB_MATRIX = yes + endif + ifeq ($(findstring right,$(ZINC)), right) + RGB_MATRIX_SPLIT_RIGHT = yes + endif ifeq ($(findstring na,$(ZINC)), na) LED_ANIMATIONS = no endif @@ -62,10 +82,11 @@ endif ifeq ($(strip $(LED_BACK_ENABLE)), yes) RGBLIGHT_ENABLE = yes - OPT_DEFS += -DRGBLED_BACK ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) - $(eval $(call ZINC_CUSTOMISE_MSG)) - $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') + OPT_DEFS += -DRGBLED_BOTH + $(info LED_BOTH_ENABLE option is enabled instead of LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE) + else + OPT_DEFS += -DRGBLED_BACK endif else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) RGBLIGHT_ENABLE = yes @@ -73,18 +94,36 @@ else RGBLIGHT_ENABLE = no endif +ifeq ($(strip $(LED_BOTH_ENABLE)), yes) + RGBLIGHT_ENABLE = yes + OPT_DEFS += -DRGBLED_BOTH +endif + +ifeq ($(strip $(LED_RGB_CONT)), yes) + OPT_DEFS += -DRGBLED_CONT +endif + +ifeq ($(strip $(RGB_MATRIX)), yes) + RGBLIGHT_ENABLE = no + RGB_MATRIX_ENABLE = WS2812 +endif + ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) - OPT_DEFS += -DIOS_DEVICE_ENABLE + OPT_DEFS += -DIOS_DEVICE_ENABLE endif ifeq ($(strip $(LED_ANIMATIONS)), yes) -# OPT_DEFS += -DRGBLIGHT_ANIMATIONS - OPT_DEFS += -DLED_ANIMATIONS +# OPT_DEFS += -DRGBLIGHT_ANIMATIONS + OPT_DEFS += -DLED_ANIMATIONS + +endif +ifeq ($(strip $(RGB_MATRIX_SPLIT_RIGHT)), yes) + OPT_DEFS += -DRGB_MATRIX_SPLIT_RIGHT endif ifeq ($(strip $(Link_Time_Optimization)),yes) - EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization + EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization endif # 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 4dcb0724ff7..2185dc9ebe4 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 . */ #pragma once -// if you need more program area, try uncomment follow line -#include "serial_config_simpleapi.h" // place overrides here // Selection of RGBLIGHT MODE to use. diff --git a/keyboards/zinc/keymaps/ginjake/rules.mk b/keyboards/zinc/keymaps/ginjake/rules.mk index 2dcefc0016d..2cb59fe8b85 100644 --- a/keyboards/zinc/keymaps/ginjake/rules.mk +++ b/keyboards/zinc/keymaps/ginjake/rules.mk @@ -1,12 +1,11 @@ - # Build Options # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = no # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality @@ -21,6 +20,8 @@ define ZINC_CUSTOMISE_MSG $(info Zinc customize) $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE)) $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE)) + $(info - LED_BOTH_ENABLE=$(LED_BOTH_ENABLE)) + $(info - LED_RGB_CONT=$(LED_RGB_CONT)) $(info - LED_ANIMATION=$(LED_ANIMATIONS)) $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE)) endef @@ -28,6 +29,8 @@ endef # Zinc keyboard customize LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) +LED_BOTH_ENABLE = no # LED backlight and underglow +LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc LED_ANIMATIONS = yes # LED animations IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) Link_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 ### Zinc keyboard 'default' keymap: convenient command line option ## make ZINC= zinc:defualt -## option= back | under | na | ios +## option= back | under | both | cont | na | ios ## ex. ## make ZINC=under zinc:defualt ## make ZINC=under,ios zinc:defualt @@ -48,9 +51,16 @@ Link_Time_Optimization = no # if firmware size over limit, try this option ifneq ($(strip $(ZINC)),) ifeq ($(findstring back,$(ZINC)), back) LED_BACK_ENABLE = yes - else ifeq ($(findstring under,$(ZINC)), under) + endif + ifeq ($(findstring under,$(ZINC)), under) LED_UNDERGLOW_ENABLE = yes endif + ifeq ($(findstring both,$(ZINC)), both) + LED_BOTH_ENABLE = yes + endif + ifeq ($(findstring cont,$(ZINC)), cont) + LED_RGB_CONT = yes + endif ifeq ($(findstring na,$(ZINC)), na) LED_ANIMATIONS = no endif @@ -63,10 +73,11 @@ endif ifeq ($(strip $(LED_BACK_ENABLE)), yes) RGBLIGHT_ENABLE = yes - OPT_DEFS += -DRGBLED_BACK ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) - $(eval $(call ZINC_CUSTOMISE_MSG)) - $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') + OPT_DEFS += -DRGBLED_BOTH + $(info LED_BOTH_ENABLE option is enabled instead of LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE) + else + OPT_DEFS += -DRGBLED_BACK endif else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) RGBLIGHT_ENABLE = yes @@ -74,18 +85,27 @@ else RGBLIGHT_ENABLE = no endif +ifeq ($(strip $(LED_BOTH_ENABLE)), yes) + RGBLIGHT_ENABLE = yes + OPT_DEFS += -DRGBLED_BOTH +endif + +ifeq ($(strip $(LED_RGB_CONT)), yes) + OPT_DEFS += -DRGBLED_CONT +endif + ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) - OPT_DEFS += -DIOS_DEVICE_ENABLE + OPT_DEFS += -DIOS_DEVICE_ENABLE endif ifeq ($(strip $(LED_ANIMATIONS)), yes) -# OPT_DEFS += -DRGBLIGHT_ANIMATIONS - OPT_DEFS += -DLED_ANIMATIONS +# OPT_DEFS += -DRGBLIGHT_ANIMATIONS + OPT_DEFS += -DLED_ANIMATIONS endif ifeq ($(strip $(Link_Time_Optimization)),yes) - EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization + EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization endif # 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 4dcb0724ff7..2185dc9ebe4 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 . */ #pragma once -// if you need more program area, try uncomment follow line -#include "serial_config_simpleapi.h" // place overrides here // Selection of RGBLIGHT MODE to use. diff --git a/keyboards/zinc/keymaps/monks/keymap.c b/keyboards/zinc/keymaps/monks/keymap.c index 5fd7c6aa857..a30e8ac5fc1 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] = { \ // define variables for reactive RGB bool TOG_STATUS = false; + // Setting ADJUST layer RGB back to default void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { @@ -163,7 +164,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - + case RAISE: if (record->event.pressed) { //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 f1495af4c8f..e518eb7696d 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 に ``` IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) -``` \ No newline at end of file +``` diff --git a/keyboards/zinc/keymaps/monks/rules.mk b/keyboards/zinc/keymaps/monks/rules.mk index eeabc004c37..c1b98deadae 100644 --- a/keyboards/zinc/keymaps/monks/rules.mk +++ b/keyboards/zinc/keymaps/monks/rules.mk @@ -1,12 +1,11 @@ - # Build Options # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = no # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality @@ -21,6 +20,8 @@ define ZINC_CUSTOMISE_MSG $(info Zinc customize) $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE)) $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE)) + $(info - LED_BOTH_ENABLE=$(LED_BOTH_ENABLE)) + $(info - LED_RGB_CONT=$(LED_RGB_CONT)) $(info - LED_ANIMATION=$(LED_ANIMATIONS)) $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE)) endef @@ -28,6 +29,8 @@ endef # Zinc keyboard customize LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) +LED_BOTH_ENABLE = no # LED backlight and underglow +LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc LED_ANIMATIONS = yes # LED animations IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) Link_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 ### Zinc keyboard 'default' keymap: convenient command line option ## make ZINC= zinc:defualt -## option= back | under | na | ios +## option= back | under | both | cont | na | ios ## ex. ## make ZINC=under zinc:defualt ## make ZINC=under,ios zinc:defualt @@ -48,9 +51,16 @@ Link_Time_Optimization = no # if firmware size over limit, try this option ifneq ($(strip $(ZINC)),) ifeq ($(findstring back,$(ZINC)), back) LED_BACK_ENABLE = yes - else ifeq ($(findstring under,$(ZINC)), under) + endif + ifeq ($(findstring under,$(ZINC)), under) LED_UNDERGLOW_ENABLE = yes endif + ifeq ($(findstring both,$(ZINC)), both) + LED_BOTH_ENABLE = yes + endif + ifeq ($(findstring cont,$(ZINC)), cont) + LED_RGB_CONT = yes + endif ifeq ($(findstring na,$(ZINC)), na) LED_ANIMATIONS = no endif @@ -63,10 +73,11 @@ endif ifeq ($(strip $(LED_BACK_ENABLE)), yes) RGBLIGHT_ENABLE = yes - OPT_DEFS += -DRGBLED_BACK ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) - $(eval $(call ZINC_CUSTOMISE_MSG)) - $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') + OPT_DEFS += -DRGBLED_BOTH + $(info LED_BOTH_ENABLE option is enabled instead of LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE) + else + OPT_DEFS += -DRGBLED_BACK endif else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) RGBLIGHT_ENABLE = yes @@ -74,17 +85,27 @@ else RGBLIGHT_ENABLE = no endif +ifeq ($(strip $(LED_BOTH_ENABLE)), yes) + RGBLIGHT_ENABLE = yes + OPT_DEFS += -DRGBLED_BOTH +endif + +ifeq ($(strip $(LED_RGB_CONT)), yes) + OPT_DEFS += -DRGBLED_CONT +endif + ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) - OPT_DEFS += -DIOS_DEVICE_ENABLE + OPT_DEFS += -DIOS_DEVICE_ENABLE endif ifeq ($(strip $(LED_ANIMATIONS)), yes) -# OPT_DEFS += -DRGBLIGHT_ANIMATIONS - OPT_DEFS += -DLED_ANIMATIONS +# OPT_DEFS += -DRGBLIGHT_ANIMATIONS + OPT_DEFS += -DLED_ANIMATIONS + endif ifeq ($(strip $(Link_Time_Optimization)),yes) - EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization + EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization endif # 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 # $(info -- RGBLIGHT_ENABLE=$(RGBLIGHT_ENABLE)) # $(info -- OPT_DEFS=$(OPT_DEFS)) # $(info ) - diff --git a/keyboards/zinc/keymaps/toshi0383/config.h b/keyboards/zinc/keymaps/toshi0383/config.h index 33108a29e6f..0d53d44247d 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 . */ #pragma once -// if you need more program area, try uncomment follow line -#include "serial_config_simpleapi.h" // place overrides here // Selection of RGBLIGHT MODE to use. diff --git a/keyboards/zinc/keymaps/toshi0383/rules.mk b/keyboards/zinc/keymaps/toshi0383/rules.mk index dca9aa7ff8c..26ac02f3a0c 100644 --- a/keyboards/zinc/keymaps/toshi0383/rules.mk +++ b/keyboards/zinc/keymaps/toshi0383/rules.mk @@ -1,11 +1,12 @@ # Build Options -# change yes to no to disable +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically # BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration -MOUSEKEY_ENABLE = no # Mouse keys +MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration +COMMAND_ENABLE = no # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls @@ -19,6 +20,9 @@ define ZINC_CUSTOMISE_MSG $(info Zinc customize) $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE)) $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE)) + $(info - LED_BOTH_ENABLE=$(LED_BOTH_ENABLE)) + $(info - LED_RGB_CONT=$(LED_RGB_CONT)) + $(info - RGB_MATRIX=$(RGB_MATRIX)) $(info - LED_ANIMATION=$(LED_ANIMATIONS)) $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE)) endef @@ -26,6 +30,10 @@ endef # Zinc keyboard customize LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) +LED_BOTH_ENABLE = no # LED backlight and underglow +LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc +RGB_MATRIX = no # RGB LED Matrix +RGB_MATRIX_SPLIT_RIGHT = no # RGB Matrix for RIGHT Hand LED_ANIMATIONS = yes # LED animations IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) Link_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 ### Zinc keyboard 'default' keymap: convenient command line option ## make ZINC= zinc:defualt -## option= back | under | na | ios +## option= back | under | both | cont | matrix | na | ios ## ex. ## make ZINC=under zinc:defualt ## make ZINC=under,ios zinc:defualt @@ -46,9 +54,22 @@ Link_Time_Optimization = no # if firmware size over limit, try this option ifneq ($(strip $(ZINC)),) ifeq ($(findstring back,$(ZINC)), back) LED_BACK_ENABLE = yes - else ifeq ($(findstring under,$(ZINC)), under) + endif + ifeq ($(findstring under,$(ZINC)), under) LED_UNDERGLOW_ENABLE = yes endif + ifeq ($(findstring both,$(ZINC)), both) + LED_BOTH_ENABLE = yes + endif + ifeq ($(findstring cont,$(ZINC)), cont) + LED_RGB_CONT = yes + endif + ifeq ($(findstring matrix,$(ZINC)), matrix) + RGB_MATRIX = yes + endif + ifeq ($(findstring right,$(ZINC)), right) + RGB_MATRIX_SPLIT_RIGHT = yes + endif ifeq ($(findstring na,$(ZINC)), na) LED_ANIMATIONS = no endif @@ -61,10 +82,11 @@ endif ifeq ($(strip $(LED_BACK_ENABLE)), yes) RGBLIGHT_ENABLE = yes - OPT_DEFS += -DRGBLED_BACK ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) - $(eval $(call ZINC_CUSTOMISE_MSG)) - $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') + OPT_DEFS += -DRGBLED_BOTH + $(info LED_BOTH_ENABLE option is enabled instead of LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE) + else + OPT_DEFS += -DRGBLED_BACK endif else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) RGBLIGHT_ENABLE = yes @@ -72,24 +94,43 @@ else RGBLIGHT_ENABLE = no endif +ifeq ($(strip $(LED_BOTH_ENABLE)), yes) + RGBLIGHT_ENABLE = yes + OPT_DEFS += -DRGBLED_BOTH +endif + +ifeq ($(strip $(LED_RGB_CONT)), yes) + OPT_DEFS += -DRGBLED_CONT +endif + +ifeq ($(strip $(RGB_MATRIX)), yes) + RGBLIGHT_ENABLE = no + RGB_MATRIX_ENABLE = WS2812 +endif + ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) - OPT_DEFS += -DIOS_DEVICE_ENABLE + OPT_DEFS += -DIOS_DEVICE_ENABLE endif ifeq ($(strip $(LED_ANIMATIONS)), yes) -# OPT_DEFS += -DRGBLIGHT_ANIMATIONS - OPT_DEFS += -DLED_ANIMATIONS +# OPT_DEFS += -DRGBLIGHT_ANIMATIONS + OPT_DEFS += -DLED_ANIMATIONS + +endif + +ifeq ($(strip $(RGB_MATRIX_SPLIT_RIGHT)), yes) + OPT_DEFS += -DRGB_MATRIX_SPLIT_RIGHT endif ifeq ($(strip $(Link_Time_Optimization)),yes) - EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization + EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization endif # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + # Uncomment these for debugging # $(info -- RGBLIGHT_ENABLE=$(RGBLIGHT_ENABLE)) # $(info -- OPT_DEFS=$(OPT_DEFS)) # $(info ) - diff --git a/keyboards/zinc/readme.md b/keyboards/zinc/readme.md index 3b4ce105c8b..0e8d6cd65df 100644 --- a/keyboards/zinc/readme.md +++ b/keyboards/zinc/readme.md @@ -5,9 +5,9 @@ Zinc 40% row-staggered split keyboard. -Keyboard Maintainer: [monksoffunk](https://github.com/monksoffunk/) [@monksoffunkJP](https://twitter.com/monksoffunkJP) -Hardware Supported: Zinc PCB -Hardware Availability: (https://twitter.com/monksoffunkJP) +* Keyboard Maintainer: [monksoffunk](https://github.com/monksoffunk/) [@monksoffunkJP](https://twitter.com/monksoffunkJP) +* Hardware Supported: Zinc PCB +* Hardware Availability: (https://twitter.com/monksoffunkJP) Make example for this keyboard (after setting up your build environment): diff --git a/keyboards/zinc/rev1/config.h b/keyboards/zinc/rev1/config.h index 6713b3098a3..1eb63df5bc8 100644 --- a/keyboards/zinc/rev1/config.h +++ b/keyboards/zinc/rev1/config.h @@ -18,9 +18,6 @@ along with this program. If not, see . #pragma once -//#ifndef REV1_CONFIG_H -//#define REV1_CONFIG_H - /* USB Device descriptor parameter */ #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x9991 @@ -33,9 +30,8 @@ along with this program. If not, see . #define TAPPING_TERM 100 /* Use I2C or Serial */ -//#define USE_I2C #define USE_SERIAL -//#define USE_MATRIX_I2C +#define SOFT_SERIAL_PIN D2 /* Select hand configuration */ #define MASTER_LEFT @@ -44,18 +40,14 @@ along with this program. If not, see . /* key matrix size */ // Rows are doubled-up - #define MATRIX_ROWS 8 - #define MATRIX_ROW_PINS { F6, F7, B1, B3 } +#define MATRIX_ROWS 8 +#define MATRIX_ROW_PINS { F6, F7, B1, B3 } // wiring of each half #define MATRIX_COLS 6 #define MATRIX_COL_PINS { F4, D4, C6, D7, E6, B4 } -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST - -/* number of backlight levels */ -// #define BACKLIGHT_LEVELS 3 +#define DIODE_DIRECTION COL2ROW /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 @@ -67,25 +59,44 @@ along with this program. If not, see . /* ws2812 RGB LED */ #define RGB_DI_PIN D3 -#define RGBLIGHT_TIMER -//#define RGBLED_NUM 12 // Number of LEDs. see ./keymaps/default/config.h -#define ws2812_PORTREG PORTD -#define ws2812_DDRREG DDRD // RGB LED support //#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no // see ./rules.mk: LED_BACK_ENABLE or LED_UNDERGLOW_ENABLE set yes -#ifdef RGBLED_BACK - #define RGBLED_NUM 24 -#else - #define RGBLED_NUM 6 +#ifdef RGBLIGHT_ENABLE + #define RGBLIGHT_SPLIT + #ifdef RGBLED_BACK + #ifdef RGBLED_CONT + #define RGBLED_NUM 48 + #define RGBLED_SPLIT { 24, 24 } + #else + #define RGBLED_NUM 24 + #endif + #else + #ifdef RGBLED_BOTH + #ifdef RGBLED_CONT + #define RGBLED_NUM 60 + #define RGBLED_SPLIT { 30, 30 } +// #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} + #else + #define RGBLED_NUM 30 + #endif + #else + #ifdef RGBLED_CONT + #define RGBLED_NUM 12 + #define RGBLED_SPLIT { 6, 6 } + #else + #define RGBLED_NUM 6 + #endif + #endif + #endif #endif #ifndef IOS_DEVICE_ENABLE - #if RGBLED_NUM <= 6 + #if (RGBLED_NUM <= 6) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 12)) #define RGBLIGHT_LIMIT_VAL 255 #else - #if RGBLED_NUM <= 16 + #if (RGBLED_NUM <= 16) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 32)) #define RGBLIGHT_LIMIT_VAL 130 #else #define RGBLIGHT_LIMIT_VAL 120 @@ -93,10 +104,10 @@ along with this program. If not, see . #endif #define RGBLIGHT_VAL_STEP 17 #else - #if RGBLED_NUM <= 6 + #if (RGBLED_NUM <= 6) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 12)) #define RGBLIGHT_LIMIT_VAL 90 #else - #if RGBLED_NUM <= 16 + #if (RGBLED_NUM <= 16) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 32)) #define RGBLIGHT_LIMIT_VAL 45 #else #define RGBLIGHT_LIMIT_VAL 35 @@ -136,5 +147,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -//#endif diff --git a/keyboards/zinc/rev1/matrix.c b/keyboards/zinc/rev1/matrix.c deleted file mode 100644 index df674ce1439..00000000000 --- a/keyboards/zinc/rev1/matrix.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -/* - * scan matrix - */ -#include -#include -#include -#include -#include -#include -#include -#include "print.h" -#include "debug.h" -#include "util.h" -#include "matrix.h" -#include "split_util.h" -#include "quantum.h" - -#ifdef USE_MATRIX_I2C -# include "i2c.h" -#else // USE_SERIAL -# include "split_scomm.h" -#endif - -#ifndef DEBOUNCE -# define DEBOUNCE 5 -#endif - -#define ERROR_DISCONNECT_COUNT 5 - -static uint8_t debouncing = DEBOUNCE; -static const int ROWS_PER_HAND = MATRIX_ROWS/2; -static uint8_t error_count = 0; -uint8_t is_master = 0 ; - -static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; - -/* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; - -static matrix_row_t read_cols(void); -static void init_cols(void); -static void unselect_rows(void); -static void select_row(uint8_t row); -static uint8_t matrix_master_scan(void); - - -__attribute__ ((weak)) -void matrix_init_kb(void) { - matrix_init_user(); -} - -__attribute__ ((weak)) -void matrix_scan_kb(void) { - matrix_scan_user(); -} - -__attribute__ ((weak)) -void matrix_init_user(void) { -} - -__attribute__ ((weak)) -void matrix_scan_user(void) { -} - -inline -uint8_t matrix_rows(void) -{ - return MATRIX_ROWS; -} - -inline -uint8_t matrix_cols(void) -{ - return MATRIX_COLS; -} - -void matrix_init(void) -{ - debug_enable = true; - debug_matrix = true; - debug_mouse = true; - // initialize row and col - unselect_rows(); - init_cols(); - - setPinOutput(B0); - setPinOutput(D5); - writePinHigh(D5); - writePinHigh(B0); - - // initialize matrix state: all keys off - for (uint8_t i=0; i < MATRIX_ROWS; i++) { - matrix[i] = 0; - matrix_debouncing[i] = 0; - } - - is_master = has_usb(); - - matrix_init_quantum(); -} - -uint8_t _matrix_scan(void) -{ - // Right hand is stored after the left in the matirx so, we need to offset it - int offset = isLeftHand ? 0 : (ROWS_PER_HAND); - - for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { - select_row(i); - _delay_us(30); // without this wait read unstable value. - matrix_row_t cols = read_cols(); - if (matrix_debouncing[i+offset] != cols) { - matrix_debouncing[i+offset] = cols; - debouncing = DEBOUNCE; - } - unselect_rows(); - } - - if (debouncing) { - if (--debouncing) { - _delay_ms(1); - } else { - for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { - matrix[i+offset] = matrix_debouncing[i+offset]; - } - } - } - - return 1; -} - -#ifdef USE_MATRIX_I2C - -// Get rows from other half over i2c -int i2c_transaction(void) { - int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; - - int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); - if (err) goto i2c_error; - - // start of matrix stored at 0x00 - err = i2c_master_write(0x00); - if (err) goto i2c_error; - - // Start read - err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); - if (err) goto i2c_error; - - if (!err) { - int i; - for (i = 0; i < ROWS_PER_HAND-1; ++i) { - matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); - } - matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); - i2c_master_stop(); - } else { -i2c_error: // the cable is disconnceted, or something else went wrong - i2c_reset_state(); - return err; - } - - return 0; -} - -#else // USE_SERIAL - -int serial_transaction(int master_changed) { - int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; -#ifdef SERIAL_USE_MULTI_TRANSACTION - int ret=serial_update_buffers(master_changed); -#else - int ret=serial_update_buffers(); -#endif - if (ret ) { - if(ret==2) writePinLow(B0); - return 1; - } - writePinHigh(B0); - memcpy(&matrix[slaveOffset], - (void *)serial_slave_buffer, sizeof(serial_slave_buffer)); - return 0; -} -#endif - -uint8_t matrix_scan(void) -{ - if (is_master) { - matrix_master_scan(); - }else{ - matrix_slave_scan(); - int offset = (isLeftHand) ? ROWS_PER_HAND : 0; - memcpy(&matrix[offset], - (void *)serial_master_buffer, sizeof(serial_master_buffer)); - matrix_scan_quantum(); - } - return 1; -} - - -uint8_t matrix_master_scan(void) { - - int ret = _matrix_scan(); - int mchanged = 1; - int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; - -#ifdef USE_MATRIX_I2C -// for (int i = 0; i < ROWS_PER_HAND; ++i) { - /* i2c_slave_buffer[i] = matrix[offset+i]; */ -// i2c_slave_buffer[i] = matrix[offset+i]; -// } -#else // USE_SERIAL - #ifdef SERIAL_USE_MULTI_TRANSACTION - mchanged = memcmp((void *)serial_master_buffer, - &matrix[offset], sizeof(serial_master_buffer)); - #endif - memcpy((void *)serial_master_buffer, - &matrix[offset], sizeof(serial_master_buffer)); -#endif - -#ifdef USE_MATRIX_I2C - if( i2c_transaction() ) { -#else // USE_SERIAL - if( serial_transaction(mchanged) ) { -#endif - // turn on the indicator led when halves are disconnected - writePinLow(D5); - - error_count++; - - if (error_count > ERROR_DISCONNECT_COUNT) { - // reset other half if disconnected - int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; - for (int i = 0; i < ROWS_PER_HAND; ++i) { - matrix[slaveOffset+i] = 0; - } - } - } else { - // turn off the indicator led on no error - writePinHigh(D5); - error_count = 0; - } - matrix_scan_quantum(); - return ret; -} - -void matrix_slave_scan(void) { - _matrix_scan(); - - int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; - -#ifdef USE_MATRIX_I2C - for (int i = 0; i < ROWS_PER_HAND; ++i) { - /* i2c_slave_buffer[i] = matrix[offset+i]; */ - i2c_slave_buffer[i] = matrix[offset+i]; - } -#else // USE_SERIAL - #ifdef SERIAL_USE_MULTI_TRANSACTION - int change = 0; - #endif - for (int i = 0; i < ROWS_PER_HAND; ++i) { - #ifdef SERIAL_USE_MULTI_TRANSACTION - if( serial_slave_buffer[i] != matrix[offset+i] ) - change = 1; - #endif - serial_slave_buffer[i] = matrix[offset+i]; - } - #ifdef SERIAL_USE_MULTI_TRANSACTION - slave_buffer_change_count += change; - #endif -#endif -} - -bool matrix_is_modified(void) -{ - if (debouncing) return false; - return true; -} - -inline -bool matrix_is_on(uint8_t row, uint8_t col) -{ - return (matrix[row] & ((matrix_row_t)1<> 4) + 1) &= ~_BV(col_pins[x] & 0xF); - _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); - } -} - -static matrix_row_t read_cols(void) -{ - matrix_row_t result = 0; - for(int x = 0; x < MATRIX_COLS; x++) { - result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); - } - return result; -} - -static void unselect_rows(void) -{ - for(int x = 0; x < ROWS_PER_HAND; x++) { - _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); - _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); - } -} - -static void select_row(uint8_t row) -{ - _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); - _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); -} diff --git a/keyboards/zinc/rev1/rev1.c b/keyboards/zinc/rev1/rev1.c index 2ce08a07c43..a9c2cfdbaca 100644 --- a/keyboards/zinc/rev1/rev1.c +++ b/keyboards/zinc/rev1/rev1.c @@ -3,4 +3,3 @@ void matrix_init_kb(void) { matrix_init_user(); }; - diff --git a/keyboards/zinc/rev1/rev1.h b/keyboards/zinc/rev1/rev1.h index aa1c408b0bf..1bf2c565aec 100644 --- a/keyboards/zinc/rev1/rev1.h +++ b/keyboards/zinc/rev1/rev1.h @@ -1,22 +1,7 @@ #pragma once -#include "../zinc.h" - #include "quantum.h" -#ifdef RGBLIGHT_ENABLE -//rgb led driver -#include "ws2812.h" -#endif - -#ifdef USE_I2C -#include -#ifdef __AVR__ - #include - #include -#endif -#endif - // Standard Keymap // (TRRS jack on both halves are to the left side) #define LAYOUT( \ diff --git a/keyboards/zinc/rev1/rules.mk b/keyboards/zinc/rev1/rules.mk index e78b9258d77..d38a6180907 100644 --- a/keyboards/zinc/rev1/rules.mk +++ b/keyboards/zinc/rev1/rules.mk @@ -1,4 +1 @@ -SRC += rev1/matrix.c -SRC += rev1/split_util.c -SRC += rev1/split_scomm.c -SRC += ws2812.c +SPLIT_KEYBOARD = yes diff --git a/keyboards/zinc/rev1/serial_config.h b/keyboards/zinc/rev1/serial_config.h deleted file mode 100644 index 9fb5dfc6714..00000000000 --- a/keyboards/zinc/rev1/serial_config.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef SOFT_SERIAL_CONFIG_H -#define SOFT_SERIAL_CONFIG_H - -#ifndef SOFT_SERIAL_PIN -/* Soft Serial defines */ -#define SOFT_SERIAL_PIN D2 -// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5 -// // 1: about 137kbps (default) -// // 2: about 75kbps -// // 3: about 39kbps -// // 4: about 26kbps -// // 5: about 20kbps -#endif - -//// USE flexible API (using multi-type transaction function) -#define SERIAL_USE_MULTI_TRANSACTION - -#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 e2d22a41e7b..00000000000 --- a/keyboards/zinc/rev1/serial_config_simpleapi.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SERIAL_CONFIG_SIMPLEAPI_H -#define SERIAL_CONFIG_SIMPLEAPI_H - -#undef SERIAL_USE_MULTI_TRANSACTION -#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 -#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 - -#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 50d233ce9af..00000000000 --- a/keyboards/zinc/rev1/split_scomm.c +++ /dev/null @@ -1,95 +0,0 @@ -#ifdef USE_SERIAL -#ifdef SERIAL_USE_MULTI_TRANSACTION -/* --- USE flexible API (using multi-type transaction function) --- */ - -#include -#include -#include -#include -#include "serial.h" -#ifdef SERIAL_DEBUG_MODE -#include -#endif -#ifdef CONSOLE_ENABLE - #include -#endif - -uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; -uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; -uint8_t volatile status_com = 0; -uint8_t volatile status1 = 0; -uint8_t slave_buffer_change_count = 0; -uint8_t s_change_old = 0xff; -uint8_t s_change_new = 0xff; - -SSTD_t transactions[] = { -#define GET_SLAVE_STATUS 0 - /* master buffer not changed, only recive slave_buffer_change_count */ - { (uint8_t *)&status_com, - 0, NULL, - sizeof(slave_buffer_change_count), &slave_buffer_change_count, - }, -#define PUT_MASTER_GET_SLAVE_STATUS 1 - /* master buffer changed need send, and recive slave_buffer_change_count */ - { (uint8_t *)&status_com, - sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer, - sizeof(slave_buffer_change_count), &slave_buffer_change_count, - }, -#define GET_SLAVE_BUFFER 2 - /* recive serial_slave_buffer */ - { (uint8_t *)&status1, - 0, NULL, - sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer - } -}; - -void serial_master_init(void) -{ - soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); -} - -void serial_slave_init(void) -{ - soft_serial_target_init(transactions, TID_LIMIT(transactions)); -} - -// 0 => no error -// 1 => slave did not respond -// 2 => checksum error -int serial_update_buffers(int master_update) -{ - int status, smatstatus; - static int need_retry = 0; - - if( s_change_old != s_change_new ) { - smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER); - if( smatstatus == TRANSACTION_END ) { - s_change_old = s_change_new; -#ifdef CONSOLE_ENABLE - uprintf("slave matrix = %b %b %b %b %b\n", - serial_slave_buffer[0], serial_slave_buffer[1], - serial_slave_buffer[2], serial_slave_buffer[3], - serial_slave_buffer[4] ); -#endif - } - } else { - // serial_slave_buffer dosen't change - smatstatus = TRANSACTION_END; // dummy status - } - - if( !master_update && !need_retry) { - status = soft_serial_transaction(GET_SLAVE_STATUS); - } else { - status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS); - } - if( status == TRANSACTION_END ) { - s_change_new = slave_buffer_change_count; - need_retry = 0; - } else { - need_retry = 1; - } - return smatstatus; -} - -#endif // SERIAL_USE_MULTI_TRANSACTION -#endif /* USE_SERIAL */ diff --git a/keyboards/zinc/rev1/split_scomm.h b/keyboards/zinc/rev1/split_scomm.h deleted file mode 100644 index 873d8939d81..00000000000 --- a/keyboards/zinc/rev1/split_scomm.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SPLIT_COMM_H -#define SPLIT_COMM_H - -#ifndef SERIAL_USE_MULTI_TRANSACTION -/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */ -#include "serial.h" - -#else -/* --- USE flexible API (using multi-type transaction function) --- */ -// Buffers for master - slave communication -#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 -#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 - -extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; -extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; -extern uint8_t slave_buffer_change_count; - -void serial_master_init(void); -void serial_slave_init(void); -int serial_update_buffers(int master_changed); - -#endif - -#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 e1ff8b4379d..00000000000 --- a/keyboards/zinc/rev1/split_util.c +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "split_util.h" -#include "matrix.h" -#include "keyboard.h" - -#ifdef USE_MATRIX_I2C -# include "i2c.h" -#else -# include "split_scomm.h" -#endif - -volatile bool isLeftHand = true; - -static void setup_handedness(void) { - #ifdef EE_HANDS - isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); - #else - // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c - #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) - isLeftHand = !has_usb(); - #else - isLeftHand = has_usb(); - #endif - #endif -} - -static void keyboard_master_setup(void) { - -#ifdef USE_MATRIX_I2C - i2c_master_init(); -#else - serial_master_init(); -#endif -} - -static void keyboard_slave_setup(void) { - -#ifdef USE_MATRIX_I2C - i2c_slave_init(SLAVE_I2C_ADDRESS); -#else - serial_slave_init(); -#endif -} - -bool has_usb(void) { - USBCON |= (1 << OTGPADE); //enables VBUS pad - _delay_us(5); - return (USBSTA & (1< -#include "eeconfig.h" - -#define SLAVE_I2C_ADDRESS 0x32 - -extern volatile bool isLeftHand; - -// slave version of matix scan, defined in matrix.c -void matrix_slave_scan(void); - -void split_keyboard_setup(void); -bool has_usb(void); - -void matrix_master_OLED_init (void); - -#endif diff --git a/keyboards/zinc/reva/config.h b/keyboards/zinc/reva/config.h index 8eeb154acca..e94ffb7c65f 100644 --- a/keyboards/zinc/reva/config.h +++ b/keyboards/zinc/reva/config.h @@ -30,9 +30,8 @@ along with this program. If not, see . #define TAPPING_TERM 100 /* Use I2C or Serial */ -//#define USE_I2C #define USE_SERIAL -//#define USE_MATRIX_I2C +#define SOFT_SERIAL_PIN D2 /* Select hand configuration */ #define MASTER_LEFT @@ -41,18 +40,14 @@ along with this program. If not, see . /* key matrix size */ // Rows are doubled-up - #define MATRIX_ROWS 8 - #define MATRIX_ROW_PINS { D4, C6, D7, E6 } +#define MATRIX_ROWS 8 +#define MATRIX_ROW_PINS { D4, C6, D7, E6 } // wiring of each half #define MATRIX_COLS 6 #define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3} -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST - -/* number of backlight levels */ -// #define BACKLIGHT_LEVELS 3 +#define DIODE_DIRECTION COL2ROW /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 @@ -64,25 +59,44 @@ along with this program. If not, see . /* ws2812 RGB LED */ #define RGB_DI_PIN D3 -#define RGBLIGHT_TIMER -//#define RGBLED_NUM 24 // Number of LEDs. see ./keymaps/default/config.h -#define ws2812_PORTREG PORTD -#define ws2812_DDRREG DDRD // RGB LED support //#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no // see ./rules.mk: LED_BACK_ENABLE or LED_UNDERGLOW_ENABLE set yes -#ifdef RGBLED_BACK - #define RGBLED_NUM 24 -#else - #define RGBLED_NUM 6 +#ifdef RGBLIGHT_ENABLE + #define RGBLIGHT_SPLIT + #ifdef RGBLED_BACK + #ifdef RGBLED_CONT + #define RGBLED_NUM 48 + #define RGBLED_SPLIT { 24, 24 } + #else + #define RGBLED_NUM 24 + #endif + #else + #ifdef RGBLED_BOTH + #ifdef RGBLED_CONT + #define RGBLED_NUM 60 + #define RGBLED_SPLIT { 30, 30 } +// #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} + #else + #define RGBLED_NUM 30 + #endif + #else + #ifdef RGBLED_CONT + #define RGBLED_NUM 12 + #define RGBLED_SPLIT { 6, 6 } + #else + #define RGBLED_NUM 6 + #endif + #endif + #endif #endif #ifndef IOS_DEVICE_ENABLE - #if RGBLED_NUM <= 6 + #if (RGBLED_NUM <= 6) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 12)) #define RGBLIGHT_LIMIT_VAL 255 #else - #if RGBLED_NUM <= 16 + #if (RGBLED_NUM <= 16) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 32)) #define RGBLIGHT_LIMIT_VAL 130 #else #define RGBLIGHT_LIMIT_VAL 120 @@ -90,10 +104,10 @@ along with this program. If not, see . #endif #define RGBLIGHT_VAL_STEP 17 #else - #if RGBLED_NUM <= 6 + #if (RGBLED_NUM <= 6) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 12)) #define RGBLIGHT_LIMIT_VAL 90 #else - #if RGBLED_NUM <= 16 + #if (RGBLED_NUM <= 16) || (defined(RGBLED_CONT) && (RGBLED_NUM <= 32)) #define RGBLIGHT_LIMIT_VAL 45 #else #define RGBLIGHT_LIMIT_VAL 35 diff --git a/keyboards/zinc/reva/matrix.c b/keyboards/zinc/reva/matrix.c deleted file mode 100644 index 5b58500db82..00000000000 --- a/keyboards/zinc/reva/matrix.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -/* - * scan matrix - */ -#include -#include -#include -#include -#include -#include -#include -#include "print.h" -#include "debug.h" -#include "util.h" -#include "matrix.h" -#include "split_util.h" -#include "quantum.h" - -#ifdef USE_MATRIX_I2C -# include "i2c.h" -#else // USE_SERIAL -# include "split_scomm.h" -#endif - -#ifndef DEBOUNCE -# define DEBOUNCE 5 -#endif - -#define ERROR_DISCONNECT_COUNT 5 - -static uint8_t debouncing = DEBOUNCE; -static const int ROWS_PER_HAND = MATRIX_ROWS/2; -static uint8_t error_count = 0; -uint8_t is_master = 0 ; - -static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; - -/* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; - -static matrix_row_t read_cols(void); -static void init_cols(void); -static void unselect_rows(void); -static void select_row(uint8_t row); -static uint8_t matrix_master_scan(void); - - -__attribute__ ((weak)) -void matrix_init_kb(void) { - matrix_init_user(); -} - -__attribute__ ((weak)) -void matrix_scan_kb(void) { - matrix_scan_user(); -} - -__attribute__ ((weak)) -void matrix_init_user(void) { -} - -__attribute__ ((weak)) -void matrix_scan_user(void) { -} - -inline -uint8_t matrix_rows(void) -{ - return MATRIX_ROWS; -} - -inline -uint8_t matrix_cols(void) -{ - return MATRIX_COLS; -} - -void matrix_init(void) -{ - debug_enable = true; - debug_matrix = true; - debug_mouse = true; - // initialize row and col - unselect_rows(); - init_cols(); - - setPinOutput(B0); - setPinOutput(D5); - writePinHigh(B0); - writePinHigh(D5); - - // initialize matrix state: all keys off - for (uint8_t i=0; i < MATRIX_ROWS; i++) { - matrix[i] = 0; - matrix_debouncing[i] = 0; - } - - is_master = has_usb(); - - matrix_init_quantum(); -} - -uint8_t _matrix_scan(void) -{ - // Right hand is stored after the left in the matirx so, we need to offset it - int offset = isLeftHand ? 0 : (ROWS_PER_HAND); - - for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { - select_row(i); - _delay_us(30); // without this wait read unstable value. - matrix_row_t cols = read_cols(); - if (matrix_debouncing[i+offset] != cols) { - matrix_debouncing[i+offset] = cols; - debouncing = DEBOUNCE; - } - unselect_rows(); - } - - if (debouncing) { - if (--debouncing) { - _delay_ms(1); - } else { - for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { - matrix[i+offset] = matrix_debouncing[i+offset]; - } - } - } - - return 1; -} - -#ifdef USE_MATRIX_I2C - -// Get rows from other half over i2c -int i2c_transaction(void) { - int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; - - int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); - if (err) goto i2c_error; - - // start of matrix stored at 0x00 - err = i2c_master_write(0x00); - if (err) goto i2c_error; - - // Start read - err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); - if (err) goto i2c_error; - - if (!err) { - int i; - for (i = 0; i < ROWS_PER_HAND-1; ++i) { - matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); - } - matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); - i2c_master_stop(); - } else { -i2c_error: // the cable is disconnceted, or something else went wrong - i2c_reset_state(); - return err; - } - - return 0; -} - -#else // USE_SERIAL - -int serial_transaction(int master_changed) { - int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; -#ifdef SERIAL_USE_MULTI_TRANSACTION - int ret=serial_update_buffers(master_changed); -#else - int ret=serial_update_buffers(); -#endif - if (ret ) { - if(ret==2) writePinLow(B0); - return 1; - } - writePinHigh(B0); - memcpy(&matrix[slaveOffset], - (void *)serial_slave_buffer, sizeof(serial_slave_buffer)); - return 0; -} -#endif - -uint8_t matrix_scan(void) -{ - if (is_master) { - matrix_master_scan(); - }else{ - matrix_slave_scan(); - int offset = (isLeftHand) ? ROWS_PER_HAND : 0; - memcpy(&matrix[offset], - (void *)serial_master_buffer, sizeof(serial_master_buffer)); - matrix_scan_quantum(); - } - return 1; -} - - -uint8_t matrix_master_scan(void) { - - int ret = _matrix_scan(); - int mchanged = 1; - int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; - -#ifdef USE_MATRIX_I2C -// for (int i = 0; i < ROWS_PER_HAND; ++i) { - /* i2c_slave_buffer[i] = matrix[offset+i]; */ -// i2c_slave_buffer[i] = matrix[offset+i]; -// } -#else // USE_SERIAL - #ifdef SERIAL_USE_MULTI_TRANSACTION - mchanged = memcmp((void *)serial_master_buffer, - &matrix[offset], sizeof(serial_master_buffer)); - #endif - memcpy((void *)serial_master_buffer, - &matrix[offset], sizeof(serial_master_buffer)); -#endif - -#ifdef USE_MATRIX_I2C - if( i2c_transaction() ) { -#else // USE_SERIAL - if( serial_transaction(mchanged) ) { -#endif - // turn on the indicator led when halves are disconnected - writePinLow(D5); - - error_count++; - - if (error_count > ERROR_DISCONNECT_COUNT) { - // reset other half if disconnected - int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; - for (int i = 0; i < ROWS_PER_HAND; ++i) { - matrix[slaveOffset+i] = 0; - } - } - } else { - // turn off the indicator led on no error - writePinHigh(D5); - error_count = 0; - } - matrix_scan_quantum(); - return ret; -} - -void matrix_slave_scan(void) { - _matrix_scan(); - - int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; - -#ifdef USE_MATRIX_I2C - for (int i = 0; i < ROWS_PER_HAND; ++i) { - /* i2c_slave_buffer[i] = matrix[offset+i]; */ - i2c_slave_buffer[i] = matrix[offset+i]; - } -#else // USE_SERIAL - #ifdef SERIAL_USE_MULTI_TRANSACTION - int change = 0; - #endif - for (int i = 0; i < ROWS_PER_HAND; ++i) { - #ifdef SERIAL_USE_MULTI_TRANSACTION - if( serial_slave_buffer[i] != matrix[offset+i] ) - change = 1; - #endif - serial_slave_buffer[i] = matrix[offset+i]; - } - #ifdef SERIAL_USE_MULTI_TRANSACTION - slave_buffer_change_count += change; - #endif -#endif -} - -bool matrix_is_modified(void) -{ - if (debouncing) return false; - return true; -} - -inline -bool matrix_is_on(uint8_t row, uint8_t col) -{ - return (matrix[row] & ((matrix_row_t)1<> 4) + 1) &= ~_BV(col_pins[x] & 0xF); - _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); - } -} - -static matrix_row_t read_cols(void) -{ - matrix_row_t result = 0; - for(int x = 0; x < MATRIX_COLS; x++) { - result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); - } - return result; -} - -static void unselect_rows(void) -{ - for(int x = 0; x < ROWS_PER_HAND; x++) { - _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); - _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); - } -} - -static void select_row(uint8_t row) -{ - _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); - _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); -} diff --git a/keyboards/zinc/reva/reva.c b/keyboards/zinc/reva/reva.c index 2ce08a07c43..a9c2cfdbaca 100644 --- a/keyboards/zinc/reva/reva.c +++ b/keyboards/zinc/reva/reva.c @@ -3,4 +3,3 @@ void matrix_init_kb(void) { matrix_init_user(); }; - diff --git a/keyboards/zinc/reva/reva.h b/keyboards/zinc/reva/reva.h index aa1c408b0bf..1bf2c565aec 100644 --- a/keyboards/zinc/reva/reva.h +++ b/keyboards/zinc/reva/reva.h @@ -1,22 +1,7 @@ #pragma once -#include "../zinc.h" - #include "quantum.h" -#ifdef RGBLIGHT_ENABLE -//rgb led driver -#include "ws2812.h" -#endif - -#ifdef USE_I2C -#include -#ifdef __AVR__ - #include - #include -#endif -#endif - // Standard Keymap // (TRRS jack on both halves are to the left side) #define LAYOUT( \ diff --git a/keyboards/zinc/reva/rules.mk b/keyboards/zinc/reva/rules.mk index 3ea61267a25..83895bdcb87 100644 --- a/keyboards/zinc/reva/rules.mk +++ b/keyboards/zinc/reva/rules.mk @@ -1,4 +1 @@ -SRC += reva/matrix.c -SRC += reva/split_util.c -SRC += reva/split_scomm.c -SRC += ws2812.c +SPLIT_KEYBOARD = yes \ No newline at end of file diff --git a/keyboards/zinc/reva/serial_config.h b/keyboards/zinc/reva/serial_config.h deleted file mode 100644 index 9fb5dfc6714..00000000000 --- a/keyboards/zinc/reva/serial_config.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef SOFT_SERIAL_CONFIG_H -#define SOFT_SERIAL_CONFIG_H - -#ifndef SOFT_SERIAL_PIN -/* Soft Serial defines */ -#define SOFT_SERIAL_PIN D2 -// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5 -// // 1: about 137kbps (default) -// // 2: about 75kbps -// // 3: about 39kbps -// // 4: about 26kbps -// // 5: about 20kbps -#endif - -//// USE flexible API (using multi-type transaction function) -#define SERIAL_USE_MULTI_TRANSACTION - -#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 e2d22a41e7b..00000000000 --- a/keyboards/zinc/reva/serial_config_simpleapi.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SERIAL_CONFIG_SIMPLEAPI_H -#define SERIAL_CONFIG_SIMPLEAPI_H - -#undef SERIAL_USE_MULTI_TRANSACTION -#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 -#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 - -#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 50d233ce9af..00000000000 --- a/keyboards/zinc/reva/split_scomm.c +++ /dev/null @@ -1,95 +0,0 @@ -#ifdef USE_SERIAL -#ifdef SERIAL_USE_MULTI_TRANSACTION -/* --- USE flexible API (using multi-type transaction function) --- */ - -#include -#include -#include -#include -#include "serial.h" -#ifdef SERIAL_DEBUG_MODE -#include -#endif -#ifdef CONSOLE_ENABLE - #include -#endif - -uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; -uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; -uint8_t volatile status_com = 0; -uint8_t volatile status1 = 0; -uint8_t slave_buffer_change_count = 0; -uint8_t s_change_old = 0xff; -uint8_t s_change_new = 0xff; - -SSTD_t transactions[] = { -#define GET_SLAVE_STATUS 0 - /* master buffer not changed, only recive slave_buffer_change_count */ - { (uint8_t *)&status_com, - 0, NULL, - sizeof(slave_buffer_change_count), &slave_buffer_change_count, - }, -#define PUT_MASTER_GET_SLAVE_STATUS 1 - /* master buffer changed need send, and recive slave_buffer_change_count */ - { (uint8_t *)&status_com, - sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer, - sizeof(slave_buffer_change_count), &slave_buffer_change_count, - }, -#define GET_SLAVE_BUFFER 2 - /* recive serial_slave_buffer */ - { (uint8_t *)&status1, - 0, NULL, - sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer - } -}; - -void serial_master_init(void) -{ - soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); -} - -void serial_slave_init(void) -{ - soft_serial_target_init(transactions, TID_LIMIT(transactions)); -} - -// 0 => no error -// 1 => slave did not respond -// 2 => checksum error -int serial_update_buffers(int master_update) -{ - int status, smatstatus; - static int need_retry = 0; - - if( s_change_old != s_change_new ) { - smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER); - if( smatstatus == TRANSACTION_END ) { - s_change_old = s_change_new; -#ifdef CONSOLE_ENABLE - uprintf("slave matrix = %b %b %b %b %b\n", - serial_slave_buffer[0], serial_slave_buffer[1], - serial_slave_buffer[2], serial_slave_buffer[3], - serial_slave_buffer[4] ); -#endif - } - } else { - // serial_slave_buffer dosen't change - smatstatus = TRANSACTION_END; // dummy status - } - - if( !master_update && !need_retry) { - status = soft_serial_transaction(GET_SLAVE_STATUS); - } else { - status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS); - } - if( status == TRANSACTION_END ) { - s_change_new = slave_buffer_change_count; - need_retry = 0; - } else { - need_retry = 1; - } - return smatstatus; -} - -#endif // SERIAL_USE_MULTI_TRANSACTION -#endif /* USE_SERIAL */ diff --git a/keyboards/zinc/reva/split_scomm.h b/keyboards/zinc/reva/split_scomm.h deleted file mode 100644 index 873d8939d81..00000000000 --- a/keyboards/zinc/reva/split_scomm.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SPLIT_COMM_H -#define SPLIT_COMM_H - -#ifndef SERIAL_USE_MULTI_TRANSACTION -/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */ -#include "serial.h" - -#else -/* --- USE flexible API (using multi-type transaction function) --- */ -// Buffers for master - slave communication -#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 -#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 - -extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; -extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; -extern uint8_t slave_buffer_change_count; - -void serial_master_init(void); -void serial_slave_init(void); -int serial_update_buffers(int master_changed); - -#endif - -#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 e1ff8b4379d..00000000000 --- a/keyboards/zinc/reva/split_util.c +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "split_util.h" -#include "matrix.h" -#include "keyboard.h" - -#ifdef USE_MATRIX_I2C -# include "i2c.h" -#else -# include "split_scomm.h" -#endif - -volatile bool isLeftHand = true; - -static void setup_handedness(void) { - #ifdef EE_HANDS - isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); - #else - // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c - #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) - isLeftHand = !has_usb(); - #else - isLeftHand = has_usb(); - #endif - #endif -} - -static void keyboard_master_setup(void) { - -#ifdef USE_MATRIX_I2C - i2c_master_init(); -#else - serial_master_init(); -#endif -} - -static void keyboard_slave_setup(void) { - -#ifdef USE_MATRIX_I2C - i2c_slave_init(SLAVE_I2C_ADDRESS); -#else - serial_slave_init(); -#endif -} - -bool has_usb(void) { - USBCON |= (1 << OTGPADE); //enables VBUS pad - _delay_us(5); - return (USBSTA & (1< -#include "eeconfig.h" - -#define SLAVE_I2C_ADDRESS 0x32 - -extern volatile bool isLeftHand; - -// slave version of matix scan, defined in matrix.c -void matrix_slave_scan(void); - -void split_keyboard_setup(void); -bool has_usb(void); - -void matrix_master_OLED_init (void); - -#endif diff --git a/keyboards/zinc/rules.mk b/keyboards/zinc/rules.mk index 63a8cc8fc3d..36e717d60a0 100644 --- a/keyboards/zinc/rules.mk +++ b/keyboards/zinc/rules.mk @@ -27,12 +27,8 @@ AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. -SUBPROJECT_rev1 = no -USE_I2C = yes -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -CUSTOM_MATRIX = yes DEFAULT_FOLDER = zinc/rev1 diff --git a/keyboards/zinc/serial.c b/keyboards/zinc/serial.c deleted file mode 100644 index f6293c3dc23..00000000000 --- a/keyboards/zinc/serial.c +++ /dev/null @@ -1,589 +0,0 @@ -/* - * WARNING: be careful changing this code, it is very timing dependent - * - * 2018-10-28 checked - * avr-gcc 4.9.2 - * avr-gcc 5.4.0 - * avr-gcc 7.3.0 - */ - -#ifndef F_CPU -#define F_CPU 16000000 -#endif - -#include -#include -#include -#include -#include -#include "serial.h" - -#ifdef SOFT_SERIAL_PIN - -#ifdef __AVR_ATmega32U4__ - // if using ATmega32U4 I2C, can not use PD0 and PD1 in soft serial. - #ifdef USE_I2C - #if SOFT_SERIAL_PIN == D0 || SOFT_SERIAL_PIN == D1 - #error Using ATmega32U4 I2C, so can not use PD0, PD1 - #endif - #endif - - #if SOFT_SERIAL_PIN >= D0 && SOFT_SERIAL_PIN <= D3 - #define SERIAL_PIN_DDR DDRD - #define SERIAL_PIN_PORT PORTD - #define SERIAL_PIN_INPUT PIND - #if SOFT_SERIAL_PIN == D0 - #define SERIAL_PIN_MASK _BV(PD0) - #define EIMSK_BIT _BV(INT0) - #define EICRx_BIT (~(_BV(ISC00) | _BV(ISC01))) - #define SERIAL_PIN_INTERRUPT INT0_vect - #elif SOFT_SERIAL_PIN == D1 - #define SERIAL_PIN_MASK _BV(PD1) - #define EIMSK_BIT _BV(INT1) - #define EICRx_BIT (~(_BV(ISC10) | _BV(ISC11))) - #define SERIAL_PIN_INTERRUPT INT1_vect - #elif SOFT_SERIAL_PIN == D2 - #define SERIAL_PIN_MASK _BV(PD2) - #define EIMSK_BIT _BV(INT2) - #define EICRx_BIT (~(_BV(ISC20) | _BV(ISC21))) - #define SERIAL_PIN_INTERRUPT INT2_vect - #elif SOFT_SERIAL_PIN == D3 - #define SERIAL_PIN_MASK _BV(PD3) - #define EIMSK_BIT _BV(INT3) - #define EICRx_BIT (~(_BV(ISC30) | _BV(ISC31))) - #define SERIAL_PIN_INTERRUPT INT3_vect - #endif - #elif SOFT_SERIAL_PIN == E6 - #define SERIAL_PIN_DDR DDRE - #define SERIAL_PIN_PORT PORTE - #define SERIAL_PIN_INPUT PINE - #define SERIAL_PIN_MASK _BV(PE6) - #define EIMSK_BIT _BV(INT6) - #define EICRx_BIT (~(_BV(ISC60) | _BV(ISC61))) - #define SERIAL_PIN_INTERRUPT INT6_vect - #else - #error invalid SOFT_SERIAL_PIN value - #endif - -#else - #error serial.c now support ATmega32U4 only -#endif - -//////////////// for backward compatibility //////////////////////////////// -#ifndef SERIAL_USE_MULTI_TRANSACTION -/* --- USE Simple API (OLD API, compatible with let's split serial.c) */ - #if SERIAL_SLAVE_BUFFER_LENGTH > 0 - uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; - #endif - #if SERIAL_MASTER_BUFFER_LENGTH > 0 - uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; - #endif - uint8_t volatile status0 = 0; - -SSTD_t transactions[] = { - { (uint8_t *)&status0, - #if SERIAL_MASTER_BUFFER_LENGTH > 0 - sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer, - #else - 0, (uint8_t *)NULL, - #endif - #if SERIAL_SLAVE_BUFFER_LENGTH > 0 - sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer - #else - 0, (uint8_t *)NULL, - #endif - } -}; - -void serial_master_init(void) -{ soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); } - -void serial_slave_init(void) -{ soft_serial_target_init(transactions, TID_LIMIT(transactions)); } - -// 0 => no error -// 1 => slave did not respond -// 2 => checksum error -int serial_update_buffers() -{ - int result; - result = soft_serial_transaction(); - return result; -} - -#endif // end of Simple API (OLD API, compatible with let's split serial.c) -//////////////////////////////////////////////////////////////////////////// - -#define ALWAYS_INLINE __attribute__((always_inline)) -#define NO_INLINE __attribute__((noinline)) -#define _delay_sub_us(x) __builtin_avr_delay_cycles(x) - -// parity check -#define ODD_PARITY 1 -#define EVEN_PARITY 0 -#define PARITY EVEN_PARITY - -#ifdef SERIAL_DELAY - // custom setup in config.h - // #define TID_SEND_ADJUST 2 - // #define SERIAL_DELAY 6 // micro sec - // #define READ_WRITE_START_ADJUST 30 // cycles - // #define READ_WRITE_WIDTH_ADJUST 8 // cycles -#else -// ============ Standard setups ============ - -#ifndef SELECT_SOFT_SERIAL_SPEED -#define SELECT_SOFT_SERIAL_SPEED 1 -// 0: about 189kbps -// 1: about 137kbps (default) -// 2: about 75kbps -// 3: about 39kbps -// 4: about 26kbps -// 5: about 20kbps -#endif - -#if __GNUC__ < 6 - #define TID_SEND_ADJUST 14 -#else - #define TID_SEND_ADJUST 2 -#endif - -#if SELECT_SOFT_SERIAL_SPEED == 0 - // Very High speed - #define SERIAL_DELAY 4 // micro sec - #if __GNUC__ < 6 - #define READ_WRITE_START_ADJUST 33 // cycles - #define READ_WRITE_WIDTH_ADJUST 3 // cycles - #else - #define READ_WRITE_START_ADJUST 34 // cycles - #define READ_WRITE_WIDTH_ADJUST 7 // cycles - #endif -#elif SELECT_SOFT_SERIAL_SPEED == 1 - // High speed - #define SERIAL_DELAY 6 // micro sec - #if __GNUC__ < 6 - #define READ_WRITE_START_ADJUST 30 // cycles - #define READ_WRITE_WIDTH_ADJUST 3 // cycles - #else - #define READ_WRITE_START_ADJUST 33 // cycles - #define READ_WRITE_WIDTH_ADJUST 7 // cycles - #endif -#elif SELECT_SOFT_SERIAL_SPEED == 2 - // Middle speed - #define SERIAL_DELAY 12 // micro sec - #define READ_WRITE_START_ADJUST 30 // cycles - #if __GNUC__ < 6 - #define READ_WRITE_WIDTH_ADJUST 3 // cycles - #else - #define READ_WRITE_WIDTH_ADJUST 7 // cycles - #endif -#elif SELECT_SOFT_SERIAL_SPEED == 3 - // Low speed - #define SERIAL_DELAY 24 // micro sec - #define READ_WRITE_START_ADJUST 30 // cycles - #if __GNUC__ < 6 - #define READ_WRITE_WIDTH_ADJUST 3 // cycles - #else - #define READ_WRITE_WIDTH_ADJUST 7 // cycles - #endif -#elif SELECT_SOFT_SERIAL_SPEED == 4 - // Very Low speed - #define SERIAL_DELAY 36 // micro sec - #define READ_WRITE_START_ADJUST 30 // cycles - #if __GNUC__ < 6 - #define READ_WRITE_WIDTH_ADJUST 3 // cycles - #else - #define READ_WRITE_WIDTH_ADJUST 7 // cycles - #endif -#elif SELECT_SOFT_SERIAL_SPEED == 5 - // Ultra Low speed - #define SERIAL_DELAY 48 // micro sec - #define READ_WRITE_START_ADJUST 30 // cycles - #if __GNUC__ < 6 - #define READ_WRITE_WIDTH_ADJUST 3 // cycles - #else - #define READ_WRITE_WIDTH_ADJUST 7 // cycles - #endif -#else -#error invalid SELECT_SOFT_SERIAL_SPEED value -#endif /* SELECT_SOFT_SERIAL_SPEED */ -#endif /* SERIAL_DELAY */ - -#define SERIAL_DELAY_HALF1 (SERIAL_DELAY/2) -#define SERIAL_DELAY_HALF2 (SERIAL_DELAY - SERIAL_DELAY/2) - -#define SLAVE_INT_WIDTH_US 1 -#ifndef SERIAL_USE_MULTI_TRANSACTION - #define SLAVE_INT_RESPONSE_TIME SERIAL_DELAY -#else - #define SLAVE_INT_ACK_WIDTH_UNIT 2 - #define SLAVE_INT_ACK_WIDTH 4 -#endif - -static SSTD_t *Transaction_table = NULL; -static uint8_t Transaction_table_size = 0; - -inline static void serial_delay(void) ALWAYS_INLINE; -inline static -void serial_delay(void) { - _delay_us(SERIAL_DELAY); -} - -inline static void serial_delay_half1(void) ALWAYS_INLINE; -inline static -void serial_delay_half1(void) { - _delay_us(SERIAL_DELAY_HALF1); -} - -inline static void serial_delay_half2(void) ALWAYS_INLINE; -inline static -void serial_delay_half2(void) { - _delay_us(SERIAL_DELAY_HALF2); -} - -inline static void serial_output(void) ALWAYS_INLINE; -inline static -void serial_output(void) { - SERIAL_PIN_DDR |= SERIAL_PIN_MASK; -} - -// make the serial pin an input with pull-up resistor -inline static void serial_input_with_pullup(void) ALWAYS_INLINE; -inline static -void serial_input_with_pullup(void) { - SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; - SERIAL_PIN_PORT |= SERIAL_PIN_MASK; -} - -inline static uint8_t serial_read_pin(void) ALWAYS_INLINE; -inline static -uint8_t serial_read_pin(void) { - return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); -} - -inline static void serial_low(void) ALWAYS_INLINE; -inline static -void serial_low(void) { - SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; -} - -inline static void serial_high(void) ALWAYS_INLINE; -inline static -void serial_high(void) { - SERIAL_PIN_PORT |= SERIAL_PIN_MASK; -} - -void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size) -{ - Transaction_table = sstd_table; - Transaction_table_size = (uint8_t)sstd_table_size; - serial_output(); - serial_high(); -} - -void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size) -{ - Transaction_table = sstd_table; - Transaction_table_size = (uint8_t)sstd_table_size; - serial_input_with_pullup(); - - // Enable INT0-INT3,INT6 - EIMSK |= EIMSK_BIT; -#if SERIAL_PIN_MASK == _BV(PE6) - // Trigger on falling edge of INT6 - EICRB &= EICRx_BIT; -#else - // Trigger on falling edge of INT0-INT3 - EICRA &= EICRx_BIT; -#endif -} - -// Used by the sender to synchronize timing with the reciver. -static void sync_recv(void) NO_INLINE; -static -void sync_recv(void) { - for (uint8_t i = 0; i < SERIAL_DELAY*5 && serial_read_pin(); i++ ) { - } - // This shouldn't hang if the target disconnects because the - // serial line will float to high if the target does disconnect. - while (!serial_read_pin()); -} - -// Used by the reciver to send a synchronization signal to the sender. -static void sync_send(void) NO_INLINE; -static -void sync_send(void) { - serial_low(); - serial_delay(); - serial_high(); -} - -// Reads a byte from the serial line -static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) NO_INLINE; -static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) { - uint8_t byte, i, p, pb; - - _delay_sub_us(READ_WRITE_START_ADJUST); - for( i = 0, byte = 0, p = PARITY; i < bit; i++ ) { - serial_delay_half1(); // read the middle of pulses - if( serial_read_pin() ) { - byte = (byte << 1) | 1; p ^= 1; - } else { - byte = (byte << 1) | 0; p ^= 0; - } - _delay_sub_us(READ_WRITE_WIDTH_ADJUST); - serial_delay_half2(); - } - /* recive parity bit */ - serial_delay_half1(); // read the middle of pulses - pb = serial_read_pin(); - _delay_sub_us(READ_WRITE_WIDTH_ADJUST); - serial_delay_half2(); - - *pterrcount += (p != pb)? 1 : 0; - - return byte; -} - -// Sends a byte with MSB ordering -void serial_write_chunk(uint8_t data, uint8_t bit) NO_INLINE; -void serial_write_chunk(uint8_t data, uint8_t bit) { - uint8_t b, p; - for( p = PARITY, b = 1<<(bit-1); b ; b >>= 1) { - if(data & b) { - serial_high(); p ^= 1; - } else { - serial_low(); p ^= 0; - } - serial_delay(); - } - /* send parity bit */ - if(p & 1) { serial_high(); } - else { serial_low(); } - serial_delay(); - - serial_low(); // sync_send() / senc_recv() need raise edge -} - -static void serial_send_packet(uint8_t *buffer, uint8_t size) NO_INLINE; -static -void serial_send_packet(uint8_t *buffer, uint8_t size) { - for (uint8_t i = 0; i < size; ++i) { - uint8_t data; - data = buffer[i]; - sync_send(); - serial_write_chunk(data,8); - } -} - -static uint8_t serial_recive_packet(uint8_t *buffer, uint8_t size) NO_INLINE; -static -uint8_t serial_recive_packet(uint8_t *buffer, uint8_t size) { - uint8_t pecount = 0; - for (uint8_t i = 0; i < size; ++i) { - uint8_t data; - sync_recv(); - data = serial_read_chunk(&pecount, 8); - buffer[i] = data; - } - return pecount == 0; -} - -inline static -void change_sender2reciver(void) { - sync_send(); //0 - serial_delay_half1(); //1 - serial_low(); //2 - serial_input_with_pullup(); //2 - serial_delay_half1(); //3 -} - -inline static -void change_reciver2sender(void) { - sync_recv(); //0 - serial_delay(); //1 - serial_low(); //3 - serial_output(); //3 - serial_delay_half1(); //4 -} - -static inline uint8_t nibble_bits_count(uint8_t bits) -{ - bits = (bits & 0x5) + (bits >> 1 & 0x5); - bits = (bits & 0x3) + (bits >> 2 & 0x3); - return bits; -} - -// interrupt handle to be used by the target device -ISR(SERIAL_PIN_INTERRUPT) { - -#ifndef SERIAL_USE_MULTI_TRANSACTION - serial_low(); - serial_output(); - SSTD_t *trans = Transaction_table; -#else - // recive transaction table index - uint8_t tid, bits; - uint8_t pecount = 0; - sync_recv(); - bits = serial_read_chunk(&pecount,7); - tid = bits>>3; - bits = (bits&7) != nibble_bits_count(tid); - if( bits || pecount> 0 || tid > Transaction_table_size ) { - return; - } - serial_delay_half1(); - - serial_high(); // response step1 low->high - serial_output(); - _delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT*SLAVE_INT_ACK_WIDTH); - SSTD_t *trans = &Transaction_table[tid]; - serial_low(); // response step2 ack high->low -#endif - - // target send phase - if( trans->target2initiator_buffer_size > 0 ) - serial_send_packet((uint8_t *)trans->target2initiator_buffer, - trans->target2initiator_buffer_size); - // target switch to input - change_sender2reciver(); - - // target recive phase - if( trans->initiator2target_buffer_size > 0 ) { - if (serial_recive_packet((uint8_t *)trans->initiator2target_buffer, - trans->initiator2target_buffer_size) ) { - *trans->status = TRANSACTION_ACCEPTED; - } else { - *trans->status = TRANSACTION_DATA_ERROR; - } - } else { - *trans->status = TRANSACTION_ACCEPTED; - } - - sync_recv(); //weit initiator output to high -} - -///////// -// start transaction by initiator -// -// int soft_serial_transaction(int sstd_index) -// -// Returns: -// TRANSACTION_END -// TRANSACTION_NO_RESPONSE -// TRANSACTION_DATA_ERROR -// this code is very time dependent, so we need to disable interrupts -#ifndef SERIAL_USE_MULTI_TRANSACTION -int soft_serial_transaction(void) { - SSTD_t *trans = Transaction_table; -#else -int soft_serial_transaction(int sstd_index) { - if( sstd_index > Transaction_table_size ) - return TRANSACTION_TYPE_ERROR; - SSTD_t *trans = &Transaction_table[sstd_index]; -#endif - cli(); - - // signal to the target that we want to start a transaction - serial_output(); - serial_low(); - _delay_us(SLAVE_INT_WIDTH_US); - -#ifndef SERIAL_USE_MULTI_TRANSACTION - // wait for the target response - serial_input_with_pullup(); - _delay_us(SLAVE_INT_RESPONSE_TIME); - - // check if the target is present - if (serial_read_pin()) { - // target failed to pull the line low, assume not present - serial_output(); - serial_high(); - *trans->status = TRANSACTION_NO_RESPONSE; - sei(); - return TRANSACTION_NO_RESPONSE; - } - -#else - // send transaction table index - int tid = (sstd_index<<3) | (7 & nibble_bits_count(sstd_index)); - sync_send(); - _delay_sub_us(TID_SEND_ADJUST); - serial_write_chunk(tid, 7); - serial_delay_half1(); - - // wait for the target response (step1 low->high) - serial_input_with_pullup(); - while( !serial_read_pin() ) { - _delay_sub_us(2); - } - - // check if the target is present (step2 high->low) - for( int i = 0; serial_read_pin(); i++ ) { - if (i > SLAVE_INT_ACK_WIDTH + 1) { - // slave failed to pull the line low, assume not present - serial_output(); - serial_high(); - *trans->status = TRANSACTION_NO_RESPONSE; - sei(); - return TRANSACTION_NO_RESPONSE; - } - _delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT); - } -#endif - - // initiator recive phase - // if the target is present syncronize with it - if( trans->target2initiator_buffer_size > 0 ) { - if (!serial_recive_packet((uint8_t *)trans->target2initiator_buffer, - trans->target2initiator_buffer_size) ) { - serial_output(); - serial_high(); - *trans->status = TRANSACTION_DATA_ERROR; - sei(); - return TRANSACTION_DATA_ERROR; - } - } - - // initiator switch to output - change_reciver2sender(); - - // initiator send phase - if( trans->initiator2target_buffer_size > 0 ) { - serial_send_packet((uint8_t *)trans->initiator2target_buffer, - trans->initiator2target_buffer_size); - } - - // always, release the line when not in use - sync_send(); - - *trans->status = TRANSACTION_END; - sei(); - return TRANSACTION_END; -} - -#ifdef SERIAL_USE_MULTI_TRANSACTION -int soft_serial_get_and_clean_status(int sstd_index) { - SSTD_t *trans = &Transaction_table[sstd_index]; - cli(); - int retval = *trans->status; - *trans->status = 0;; - sei(); - return retval; -} -#endif - -#endif - -// Helix serial.c history -// 2018-1-29 fork from let's split and add PD2, modify sync_recv() (#2308, bceffdefc) -// 2018-6-28 bug fix master to slave comm and speed up (#3255, 1038bbef4) -// (adjusted with avr-gcc 4.9.2) -// 2018-7-13 remove USE_SERIAL_PD2 macro (#3374, f30d6dd78) -// (adjusted with avr-gcc 4.9.2) -// 2018-8-11 add support multi-type transaction (#3608, feb5e4aae) -// (adjusted with avr-gcc 4.9.2) -// 2018-10-21 fix serial and RGB animation conflict (#4191, 4665e4fff) -// (adjusted with avr-gcc 7.3.0) -// 2018-10-28 re-adjust compiler depend value of delay (#4269, 8517f8a66) -// (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 7e0c0847a43..00000000000 --- a/keyboards/zinc/serial.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef SOFT_SERIAL_H -#define SOFT_SERIAL_H - -#include - -// ///////////////////////////////////////////////////////////////// -// Need Soft Serial defines in config.h -// ///////////////////////////////////////////////////////////////// -// ex. -// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6 -// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5 -// // 1: about 137kbps (default) -// // 2: about 75kbps -// // 3: about 39kbps -// // 4: about 26kbps -// // 5: about 20kbps -// -// //// USE Simple API (OLD API, compatible with let's split serial.c) -// ex. -// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 -// #define SERIAL_MASTER_BUFFER_LENGTH 1 -// -// //// USE flexible API (using multi-type transaction function) -// #define SERIAL_USE_MULTI_TRANSACTION -// -// ///////////////////////////////////////////////////////////////// - - -#ifndef SERIAL_USE_MULTI_TRANSACTION -/* --- USE Simple API (OLD API, compatible with let's split serial.c) */ -#if SERIAL_SLAVE_BUFFER_LENGTH > 0 -extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; -#endif -#if SERIAL_MASTER_BUFFER_LENGTH > 0 -extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; -#endif - -void serial_master_init(void); -void serial_slave_init(void); -int serial_update_buffers(void); - -#endif // USE Simple API - -// Soft Serial Transaction Descriptor -typedef struct _SSTD_t { - uint8_t *status; - uint8_t initiator2target_buffer_size; - uint8_t *initiator2target_buffer; - uint8_t target2initiator_buffer_size; - uint8_t *target2initiator_buffer; -} SSTD_t; -#define TID_LIMIT( table ) (sizeof(table) / sizeof(SSTD_t)) - -// initiator is transaction start side -void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size); -// target is interrupt accept side -void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size); - -// initiator resullt -#define TRANSACTION_END 0 -#define TRANSACTION_NO_RESPONSE 0x1 -#define TRANSACTION_DATA_ERROR 0x2 -#define TRANSACTION_TYPE_ERROR 0x4 -#ifndef SERIAL_USE_MULTI_TRANSACTION -int soft_serial_transaction(void); -#else -int soft_serial_transaction(int sstd_index); -#endif - -// target status -// *SSTD_t.status has -// initiator: -// TRANSACTION_END -// or TRANSACTION_NO_RESPONSE -// or TRANSACTION_DATA_ERROR -// target: -// TRANSACTION_DATA_ERROR -// or TRANSACTION_ACCEPTED -#define TRANSACTION_ACCEPTED 0x8 -#ifdef SERIAL_USE_MULTI_TRANSACTION -int soft_serial_get_and_clean_status(int sstd_index); -#endif - -#endif /* SOFT_SERIAL_H */ diff --git a/keyboards/zinc/zinc.h b/keyboards/zinc/zinc.h index 87d889da033..dedc9253b0e 100644 --- a/keyboards/zinc/zinc.h +++ b/keyboards/zinc/zinc.h @@ -1,5 +1,4 @@ -#ifndef ZINC_H -#define ZINC_H +#pragma once #ifdef KEYBOARD_zinc_reva #include "reva.h" @@ -8,7 +7,4 @@ #include "rev1.h" #endif - #include "quantum.h" - -#endif diff --git a/layouts/community/60_iso/unxmaal/keymap.c b/layouts/community/60_iso/unxmaal/keymap.c index 455d969f470..9441997b4bf 100644 --- a/layouts/community/60_iso/unxmaal/keymap.c +++ b/layouts/community/60_iso/unxmaal/keymap.c @@ -108,8 +108,6 @@ enum function_id { }; const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_TOGGLE(1), // Toggle Arrow Layer overlay - [3] = ACTION_LAYER_TOGGLE(3), // Toggle Underglow Layer overlay [4] = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow [5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode [6] = ACTION_FUNCTION(RGBLED_INCREASE_HUE), diff --git a/layouts/community/ergodox/algernon/keymap.c b/layouts/community/ergodox/algernon/keymap.c index fb6de1b721d..e6e9bdaf7f0 100644 --- a/layouts/community/ergodox/algernon/keymap.c +++ b/layouts/community/ergodox/algernon/keymap.c @@ -79,9 +79,6 @@ enum { F_BSE = 0, F_HUN, F_GUI, - F_SFT, - F_ALT, - F_CTRL }; /* Custom keycodes */ @@ -146,9 +143,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ,KC_MPLY ,KC_SLSH ,KC_Q ,KC_J ,KC_K ,KC_X ,TD(CT_TMUX) ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN) - ,F(F_ALT),F(F_GUI) - ,F(F_CTRL) - ,KC_BSPC,F(F_SFT),KC_ESC + ,OSM(MOD_LALT),F(F_GUI) + ,OSM(MOD_LCTL) + ,KC_BSPC,OSM(MOD_LSFT),KC_ESC // right hand ,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] = { ,KC_NO ,KC_Z ,KC_Q ,KC_QUOT ,KC_COMM ,KC_DOT ,TD(CT_TMUX) ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN) - ,F(F_ALT),F(F_GUI) - ,F(F_CTRL) - ,KC_BSPC,F(F_SFT),KC_ESC + ,OSM(MOD_LALT),F(F_GUI) + ,OSM(MOD_LCTL) + ,KC_BSPC,OSM(F_LSFT),KC_ESC // right hand ,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[] = { [F_BSE] = ACTION_LAYER_CLEAR(ON_PRESS) ,[F_HUN] = ACTION_LAYER_INVERT(HUN, ON_PRESS) ,[F_GUI] = ACTION_MACRO_TAP(A_GUI) - ,[F_SFT] = ACTION_MODS_ONESHOT (MOD_LSFT) - ,[F_ALT] = ACTION_MODS_ONESHOT (MOD_LALT) - ,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL) }; static 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 189ff5c43d4..a4a45334949 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] = { MO(4), KC_BTN1, KC_BTN2, KC_TAB,GUI_T(KC_COMMA), NO_AMPR, NO_PIPE, NO_PLUS, - KC_FN1,CTL_T(KC_DOT),ALT_T(NO_MINS), + OSM(MOD_LSFT),CTL_T(KC_DOT),ALT_T(NO_MINS), // right hand KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT, NO_APOS, KC_J, KC_L, KC_U, KC_Y, NO_AA, NO_AE , @@ -222,7 +222,6 @@ enum macro_id { }; const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift. [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed. [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first. [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 69066a47cc4..cb256e5e57b 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) { #endif // RGB_MATRIX_INIT -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { if (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) { if (mod_config(keycode & 0xf) & MOD_MASK_ALT) { return (2 * TAPPING_TERM); diff --git a/layouts/community/ergodox/guni/keymap.c b/layouts/community/ergodox/guni/keymap.c index 14d6f8d3ad1..ff1dd72eb09 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] = { LAYOUT_ergodox( // layer 0 : default // left hand KC_EQL , KC_1, KC_2, KC_3, KC_4, KC_5, KC_LBRC, - KC_FN25 , KC_Q, KC_W, KC_E, KC_R, KC_T, KC_HOME, + MT(MOD_LCTL, KC_TAB) , KC_Q, KC_W, KC_E, KC_R, KC_T, KC_HOME, LT(1, KC_CAPS) , KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT , KC_Z, KC_X, KC_C, KC_V, KC_B, KC_PGUP, KC_LGUI , KC_GRV,KC_LEFT,KC_RGHT,KC_LALT, @@ -16,13 +16,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_BSPC,KC_DEL ,KC_FN23, // right hand KC_RBRC , KC_6, KC_7 , KC_8, KC_9, KC_0, KC_MINS, - KC_END , KC_Y, KC_U , KC_I, KC_O, KC_P, KC_FN28, + KC_END , KC_Y, KC_U , KC_I, KC_O, KC_P, MT(MOD_RCTL, KC_BSLS), KC_H , KC_J, KC_K , KC_L, KC_SCLN,LT(1, KC_QUOT), - KC_PGDN , KC_N, KC_M , KC_COMM,KC_DOT, KC_SLSH,KC_FN29, + KC_PGDN , KC_N, KC_M , KC_COMM,KC_DOT, KC_SLSH,MT(MOD_RSFT, KC_ESC), KC_RALT , KC_DOWN,KC_UP, KC_NO ,KC_RGUI, KC_NO , KC_NO, KC_NO , - KC_FN29,KC_ENT ,KC_SPC + MT(MOD_RSFT, KC_ESC),KC_ENT ,KC_SPC ), LAYOUT_ergodox( // layer 1 : function and symbol keys @@ -122,20 +122,9 @@ enum function_id { const uint16_t PROGMEM fn_actions[] = { [0] = ACTION_FUNCTION(TEENSY_KEY), // FN0 - Teensy key [1] = ACTION_LAYER_SET(0, ON_PRESS), - //[11] = ACTION_MODS_KEY(MOD_LSFT, KC_COMM), - //[12] = ACTION_MODS_KEY(MOD_LSFT, KC_DOT), - - //[14] = ACTION_MODS_KEY(MOD_LSFT, KC_SLSH), - //[17] = ACTION_MODS_KEY(MOD_LSFT, KC_SCLN), - //[20] = ACTION_MODS_KEY(MOD_LSFT, KC_5), - //[21] = ACTION_MODS_KEY(MOD_LSFT, KC_QUOT), [23] = ACTION_LAYER_SET(3, ON_PRESS), [24] = ACTION_LAYER_SET(2, ON_PRESS), - [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_TAB), [26] = ACTION_LAYER_SET(1, ON_PRESS), - [28] = ACTION_MODS_TAP_KEY(MOD_RCTL,KC_BSLS), - //[29] = ACTION_LAYER_TOGGLE(4), - [29] = ACTION_MODS_TAP_KEY(MOD_RSFT,KC_ESC), }; diff --git a/layouts/community/ergodox/kastyle/keymap.c b/layouts/community/ergodox/kastyle/keymap.c index 923715477bb..32eec96f506 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] = { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(1), KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), - KC_FN1, KC_BSLS, LALT(KC_LSFT), KC_LEFT, KC_RGHT, + SH_T(KC_GRV), KC_BSLS, LALT(KC_LSFT), KC_LEFT, KC_RGHT, KC_LGUI, ALT_T(KC_ESC), KC_HOME, KC_BSPC, KC_DEL, KC_END, @@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { TG(1), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), KC_QUOT, MEH_T(KC_NO), KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLSH), KC_RSFT, - KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, KC_FN1, + KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, SH_T(KC_GRV), ALT_T(KC_ESC), KC_RGUI, KC_PGUP, 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) return MACRO_NONE; }; -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_SWAP_HANDS_TAP_KEY(KC_GRV) // FN1 - Tap = Grave/Tilde - Hold Momentary swap hands -}; - // Runs just one time when the keyboard initializes. void matrix_init_user(void) { diff --git a/layouts/community/ergodox/mpiechotka/keymap.c b/layouts/community/ergodox/mpiechotka/keymap.c index a673d0bd8aa..6a89e38a327 100644 --- a/layouts/community/ergodox/mpiechotka/keymap.c +++ b/layouts/community/ergodox/mpiechotka/keymap.c @@ -15,9 +15,7 @@ enum { PC1, PC2, PC3, - PC4, - DL_BASE, - DL_BASE_CM, + PC4 }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -175,7 +173,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // MACROS [MACR] = LAYOUT_ergodox( KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, - KC_NO, F(DL_BASE),F(DL_BASE_CM),KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, DF(BASE), DF(BASE_CM), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, F(PC1), F(PC2), F(PC3), F(PC4), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, @@ -199,9 +197,7 @@ const uint16_t PROGMEM fn_actions[] = { [PC1] = ACTION_MACRO(PC1), [PC2] = ACTION_MACRO(PC2), [PC3] = ACTION_MACRO(PC3), - [PC4] = ACTION_MACRO(PC4), - [DL_BASE] = ACTION_DEFAULT_LAYER_SET(BASE), - [DL_BASE_CM] = ACTION_DEFAULT_LAYER_SET(BASE_CM) + [PC4] = ACTION_MACRO(PC4) }; const 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 63fea6e1c16..ee9a9d1802b 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] = { ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB, KC_HASH, KC_FN7, KC_FN6, - KC_FN1,CTL_T(KC_DOT),GUI_T(KC_COMMA), + OSM(MOD_LSFT),CTL_T(KC_DOT),GUI_T(KC_COMMA), // right hand KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT, NO_APOS, KC_Y, KC_U, KC_I, KC_O, KC_P, NO_AA , @@ -138,7 +138,6 @@ enum macro_id { }; const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift. [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed. [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first. [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 cb61ce59cb8..af1d268bd9f 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] = { ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB, KC_HASH, KC_FN7, KC_FN6, - KC_FN1,CTL_T(KC_DOT),GUI_T(KC_COMMA), + OSM(MOD_LSFT),CTL_T(KC_DOT),GUI_T(KC_COMMA), // right hand KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT, NO_APOS, KC_J, KC_L, KC_U, KC_Y, NO_AA, NO_AE , @@ -138,7 +138,6 @@ enum macro_id { }; const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift. [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed. [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first. [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 55394fab214..6799ad74602 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] = { KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, MEH_T(KC_F16), CTL_T(KC_BSLS), KC_A, KC_S, KC_D, KC_F, KC_G, - KC_FN2, KC_Z, KC_X, KC_C, KC_V, KC_B, ALL_T(KC_F18), - KC_FN1, TG(KEYPAD), KC_LCTRL, KC_LALT, KC_LGUI, + OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, ALL_T(KC_F18), + OSL(FN), TG(KEYPAD), KC_LCTRL, KC_LALT, KC_LGUI, M_TESC, M_TPASTE, KC_HOME, KC_BSPC, KC_DEL, KC_END, @@ -106,8 +106,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_POWER, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, MEH_T(KC_F17), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_EQL, KC_H, KC_J, KC_K, KC_L, KC_SCLN, CTL_T(KC_QUOT), - ALL_T(KC_F19), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_FN2, - KC_RGUI, KC_RALT, CTL_T(KC_LBRC), LT(KEYPAD, KC_RBRC), KC_FN1, + ALL_T(KC_F19), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, OSM(MOD_LSFT), + KC_RGUI, KC_RALT, CTL_T(KC_LBRC), LT(KEYPAD, KC_RBRC), OSL(FN), M_OSXCPY, M_OSXPST, KC_PGUP, KC_PGDN, KC_ENT, KC_SPC), @@ -194,11 +194,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_NO, KC_NO, KC_NO, KC_NO)}; -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_ONESHOT(FN), - [2] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift. -}; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function switch(id) { diff --git a/lib/printf b/lib/printf new file mode 160000 index 00000000000..d3b984684bb --- /dev/null +++ b/lib/printf @@ -0,0 +1 @@ +Subproject commit d3b984684bb8a8bdc48cc7a1abecb93ce59bbe3e diff --git a/lib/vusb b/lib/vusb new file mode 160000 index 00000000000..9a42d205eb6 --- /dev/null +++ b/lib/vusb @@ -0,0 +1 @@ +Subproject commit 9a42d205eb60faca494ff4eabce8d59f0ec0fc7f diff --git a/message.mk b/message.mk index c8da7df0bb4..be04fa9b810 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 MSG_FILE_JUST_RIGHT = The firmware size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n MSG_FILE_NEAR_LIMIT = The firmware size is approaching the maximum - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n MSG_PYTHON_MISSING = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \ - Python 3 is not installed. It will be required by a future version\n\ - of qmk_firmware.\n\n\ + Can not run bin/qmk! This tool will be required when the develop branch is merged on 2020 Aug 29.\n\n\ Please run $(BOLD)util/qmk_install.sh$(NO_COLOR) to install all the dependencies QMK requires.\n\n MSG_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 MSG_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 2bcc27b4a19..805cb4f7ab7 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); // length. This works around the limitation of C's sizeof operation on pointers. // The global float array for the song must be used here. #define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0])))) -#define PLAY_NOTE_ARRAY(note_array, note_repeat, deprecated_arg) \ - play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat)); \ - _Pragma("message \"'PLAY_NOTE_ARRAY' macro is deprecated\"") #define PLAY_SONG(note_array) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), false) #define PLAY_LOOP(note_array) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), true) diff --git a/quantum/audio/audio_avr.c b/quantum/audio/audio_avr.c index 781378788c6..5a96bf64393 100644 --- a/quantum/audio/audio_avr.c +++ b/quantum/audio/audio_avr.c @@ -110,6 +110,11 @@ # define TIMER_1_DUTY_CYCLE OCR1C # define TIMER1_AUDIO_vect TIMER1_COMPC_vect #endif + +#if !defined(BPIN_AUDIO) && !defined(CPIN_AUDIO) +# error "Audio feature enabled, but no suitable pin selected - see docs/feature_audio.md under the AVR settings for available options." +#endif + // ----------------------------------------------------------------------------- int voices = 0; diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 91032b6564c..f3da0ab0f7d 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; // -----End rgb effect includes macros------- // ------------------------------------------ -#ifndef RGB_DISABLE_AFTER_TIMEOUT -# define RGB_DISABLE_AFTER_TIMEOUT 0 +#if defined(RGB_DISABLE_AFTER_TIMEOUT) && !defined(RGB_DISABLE_TIMEOUT) +# define RGB_DISABLE_TIMEOUT (RGB_DISABLE_AFTER_TIMEOUT * 1200) +#endif + +#ifndef RGB_DISABLE_TIMEOUT +# define RGB_DISABLE_TIMEOUT 0 #endif #ifndef RGB_DISABLE_WHEN_USB_SUSPENDED @@ -111,19 +115,29 @@ const point_t k_rgb_matrix_center = RGB_MATRIX_CENTER; # define RGB_MATRIX_STARTUP_SPD UINT8_MAX / 2 #endif -bool g_suspend_state = false; - -rgb_config_t rgb_matrix_config; - -rgb_counters_t g_rgb_counters; -static uint32_t rgb_counters_buffer; - +// globals +bool g_suspend_state = false; +rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr +uint32_t g_rgb_timer; #ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS -uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}}; -#endif +uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}}; +#endif // RGB_MATRIX_FRAMEBUFFER_EFFECTS +#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED +last_hit_t g_last_hit_tracker; +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +// internals +static uint8_t rgb_last_enable = UINT8_MAX; +static uint8_t rgb_last_effect = UINT8_MAX; +static effect_params_t rgb_effect_params = {0, 0xFF}; +static rgb_task_states rgb_task_state = SYNCING; +#if RGB_DISABLE_TIMEOUT > 0 +static uint32_t rgb_anykey_timer; +#endif // RGB_DISABLE_TIMEOUT > 0 + +// double buffers +static uint32_t rgb_timer_buffer; #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -last_hit_t g_last_hit_tracker; static last_hit_t last_hit_buffer; #endif // RGB_MATRIX_KEYREACTIVE_ENABLED @@ -169,21 +183,24 @@ void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color_all(red, green, blue); } bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { +#if RGB_DISABLE_TIMEOUT > 0 + if (record->event.pressed) { + rgb_anykey_timer = 0; + } +#endif // RGB_DISABLE_TIMEOUT > 0 + #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED uint8_t led[LED_HITS_TO_REMEMBER]; uint8_t led_count = 0; # if defined(RGB_MATRIX_KEYRELEASES) - if (!record->event.pressed) { - led_count = rgb_matrix_map_row_column_to_led(record->event.key.row, record->event.key.col, led); - g_rgb_counters.any_key_hit = 0; - } + if (!record->event.pressed) # elif defined(RGB_MATRIX_KEYPRESSES) - if (record->event.pressed) { - led_count = rgb_matrix_map_row_column_to_led(record->event.key.row, record->event.key.col, led); - g_rgb_counters.any_key_hit = 0; - } + if (record->event.pressed) # endif // defined(RGB_MATRIX_KEYRELEASES) + { + led_count = rgb_matrix_map_row_column_to_led(record->event.key.row, record->event.key.col, led); + } if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) { 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) { // Mask out bits 4 and 5 // Increase the factor to make the test animation slower (and reduce to make it faster) uint8_t factor = 10; - switch ((g_rgb_counters.tick & (0b11 << factor)) >> factor) { + switch ((g_rgb_timer & (0b11 << factor)) >> factor) { case 0: { rgb_matrix_set_color_all(20, 0, 0); break; @@ -241,29 +258,26 @@ static bool rgb_matrix_none(effect_params_t *params) { return false; } - RGB_MATRIX_USE_LIMITS(led_min, led_max); - for (uint8_t i = led_min; i < led_max; i++) { - rgb_matrix_set_color(i, 0, 0, 0); - } - return led_max < DRIVER_LED_TOTAL; + rgb_matrix_set_color_all(0, 0, 0); + return false; } -static uint8_t rgb_last_enable = UINT8_MAX; -static uint8_t rgb_last_effect = UINT8_MAX; -static effect_params_t rgb_effect_params = {0, 0xFF}; -static rgb_task_states rgb_task_state = SYNCING; - static void rgb_task_timers(void) { +#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0 + uint32_t deltaTime = timer_elapsed32(rgb_timer_buffer); +#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0 + rgb_timer_buffer = timer_read32(); + // Update double buffer timers - uint16_t deltaTime = timer_elapsed32(rgb_counters_buffer); - rgb_counters_buffer = timer_read32(); - if (g_rgb_counters.any_key_hit < UINT32_MAX) { - if (UINT32_MAX - deltaTime < g_rgb_counters.any_key_hit) { - g_rgb_counters.any_key_hit = UINT32_MAX; +#if RGB_DISABLE_TIMEOUT > 0 + if (rgb_anykey_timer < UINT32_MAX) { + if (UINT32_MAX - deltaTime < rgb_anykey_timer) { + rgb_anykey_timer = UINT32_MAX; } else { - g_rgb_counters.any_key_hit += deltaTime; + rgb_anykey_timer += deltaTime; } } +#endif // RGB_DISABLE_TIMEOUT > 0 // Update double buffer last hit timers #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED @@ -280,7 +294,7 @@ static void rgb_task_timers(void) { static void rgb_task_sync(void) { // next task - if (timer_elapsed32(g_rgb_counters.tick) >= RGB_MATRIX_LED_FLUSH_LIMIT) rgb_task_state = STARTING; + if (timer_elapsed32(g_rgb_timer) >= RGB_MATRIX_LED_FLUSH_LIMIT) rgb_task_state = STARTING; } static void rgb_task_start(void) { @@ -288,7 +302,7 @@ static void rgb_task_start(void) { rgb_effect_params.iter = 0; // update double buffers - g_rgb_counters.tick = rgb_counters_buffer; + g_rgb_timer = rgb_timer_buffer; #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED g_last_hit_tracker = last_hit_buffer; #endif // RGB_MATRIX_KEYREACTIVE_ENABLED @@ -370,8 +384,16 @@ void rgb_matrix_task(void) { // Ideally we would also stop sending zeros to the LED driver PWM buffers // while suspended and just do a software shutdown. This is a cheap hack for now. - 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)); - uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode; + bool suspend_backlight = +#if RGB_DISABLE_WHEN_USB_SUSPENDED == true + g_suspend_state || +#endif // RGB_DISABLE_WHEN_USB_SUSPENDED == true +#if RGB_DISABLE_TIMEOUT > 0 + (rgb_anykey_timer > (uint32_t)RGB_DISABLE_TIMEOUT) || +#endif // RGB_DISABLE_TIMEOUT > 0 + false; + + uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode; switch (rgb_task_state) { case STARTING: @@ -405,8 +427,6 @@ __attribute__((weak)) void rgb_matrix_indicators_user(void) {} void rgb_matrix_init(void) { rgb_matrix_driver.init(); - // TODO: put the 1 second startup delay here? - #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED g_last_hit_tracker.count = 0; for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) { diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h index 7c37311b4e7..d9ce391068c 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix.h @@ -178,14 +178,14 @@ extern const rgb_matrix_driver_t rgb_matrix_driver; extern rgb_config_t rgb_matrix_config; -extern bool g_suspend_state; -extern rgb_counters_t g_rgb_counters; -extern led_config_t g_led_config; +extern bool g_suspend_state; +extern uint32_t g_rgb_timer; +extern led_config_t g_led_config; #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED extern last_hit_t g_last_hit_tracker; #endif #ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS -extern uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS]; +extern uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS]; #endif #endif diff --git a/quantum/rgb_matrix_animations/breathing_anim.h b/quantum/rgb_matrix_animations/breathing_anim.h index 92431555e7a..887425f9daf 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) { RGB_MATRIX_USE_LIMITS(led_min, led_max); HSV hsv = rgb_matrix_config.hsv; - uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 8); + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); RGB rgb = hsv_to_rgb(hsv); 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 7a4a52db1b4..1de45f8e8db 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) { if (params->init) { rgb_matrix_set_color_all(0, 0, 0); - memset(rgb_frame_buffer, 0, sizeof(rgb_frame_buffer)); + memset(g_rgb_frame_buffer, 0, sizeof(g_rgb_frame_buffer)); drop = 0; } @@ -27,10 +27,10 @@ bool DIGITAL_RAIN(effect_params_t* params) { if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) { // top row, pixels have just fallen and we're // making a new rain drop in this column - rgb_frame_buffer[row][col] = max_intensity; - } else if (rgb_frame_buffer[row][col] > 0 && rgb_frame_buffer[row][col] < max_intensity) { + g_rgb_frame_buffer[row][col] = max_intensity; + } else if (g_rgb_frame_buffer[row][col] > 0 && g_rgb_frame_buffer[row][col] < max_intensity) { // neither fully bright nor dark, decay it - rgb_frame_buffer[row][col]--; + g_rgb_frame_buffer[row][col]--; } // set the pixel colour uint8_t led[LED_HITS_TO_REMEMBER]; @@ -38,11 +38,11 @@ bool DIGITAL_RAIN(effect_params_t* params) { // TODO: multiple leds are supported mapped to the same row/column if (led_count > 0) { - if (rgb_frame_buffer[row][col] > pure_green_intensity) { - const uint8_t boost = (uint8_t)((uint16_t)max_brightness_boost * (rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity)); + if (g_rgb_frame_buffer[row][col] > pure_green_intensity) { + 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)); rgb_matrix_set_color(led[0], boost, max_intensity, boost); } else { - const uint8_t green = (uint8_t)((uint16_t)max_intensity * rgb_frame_buffer[row][col] / pure_green_intensity); + const uint8_t green = (uint8_t)((uint16_t)max_intensity * g_rgb_frame_buffer[row][col] / pure_green_intensity); rgb_matrix_set_color(led[0], 0, green, 0); } } @@ -55,15 +55,15 @@ bool DIGITAL_RAIN(effect_params_t* params) { for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) { for (uint8_t col = 0; col < MATRIX_COLS; col++) { // if ths is on the bottom row and bright allow decay - if (row == MATRIX_ROWS - 1 && rgb_frame_buffer[row][col] == max_intensity) { - rgb_frame_buffer[row][col]--; + if (row == MATRIX_ROWS - 1 && g_rgb_frame_buffer[row][col] == max_intensity) { + g_rgb_frame_buffer[row][col]--; } // check if the pixel above is bright - if (rgb_frame_buffer[row - 1][col] == max_intensity) { + if (g_rgb_frame_buffer[row - 1][col] == max_intensity) { // allow old bright pixel to decay - rgb_frame_buffer[row - 1][col]--; + g_rgb_frame_buffer[row - 1][col]--; // make this pixel bright - rgb_frame_buffer[row][col] = max_intensity; + g_rgb_frame_buffer[row][col] = max_intensity; } } } diff --git a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h index 5596146a380..ef2d1500b06 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) { bool JELLYBEAN_RAINDROPS(effect_params_t* params) { if (!params->init) { // Change one LED every tick, make sure speed is not 0 - if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) { + if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) { jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params); } return false; diff --git a/quantum/rgb_matrix_animations/raindrops_anim.h b/quantum/rgb_matrix_animations/raindrops_anim.h index 9f839a1bce0..6e1b5acb0d4 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) { bool RAINDROPS(effect_params_t* params) { if (!params->init) { // Change one LED every tick, make sure speed is not 0 - if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) { + if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) { raindrops_set_color(rand() % DRIVER_LED_TOTAL, params); } return false; diff --git a/quantum/rgb_matrix_animations/typing_heatmap_anim.h b/quantum/rgb_matrix_animations/typing_heatmap_anim.h index dd313f16a5b..e82c1b49eeb 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) { uint8_t m_col = col - 1; uint8_t p_col = col + 1; - if (m_col < col) rgb_frame_buffer[row][m_col] = qadd8(rgb_frame_buffer[row][m_col], 16); - rgb_frame_buffer[row][col] = qadd8(rgb_frame_buffer[row][col], 32); - if (p_col < MATRIX_COLS) rgb_frame_buffer[row][p_col] = qadd8(rgb_frame_buffer[row][p_col], 16); + if (m_col < col) g_rgb_frame_buffer[row][m_col] = qadd8(g_rgb_frame_buffer[row][m_col], 16); + g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32); + if (p_col < MATRIX_COLS) g_rgb_frame_buffer[row][p_col] = qadd8(g_rgb_frame_buffer[row][p_col], 16); if (p_row < MATRIX_ROWS) { - if (m_col < col) rgb_frame_buffer[p_row][m_col] = qadd8(rgb_frame_buffer[p_row][m_col], 13); - rgb_frame_buffer[p_row][col] = qadd8(rgb_frame_buffer[p_row][col], 16); - if (p_col < MATRIX_COLS) rgb_frame_buffer[p_row][p_col] = qadd8(rgb_frame_buffer[p_row][p_col], 13); + if (m_col < col) g_rgb_frame_buffer[p_row][m_col] = qadd8(g_rgb_frame_buffer[p_row][m_col], 13); + g_rgb_frame_buffer[p_row][col] = qadd8(g_rgb_frame_buffer[p_row][col], 16); + if (p_col < MATRIX_COLS) g_rgb_frame_buffer[p_row][p_col] = qadd8(g_rgb_frame_buffer[p_row][p_col], 13); } if (m_row < row) { - if (m_col < col) rgb_frame_buffer[m_row][m_col] = qadd8(rgb_frame_buffer[m_row][m_col], 13); - rgb_frame_buffer[m_row][col] = qadd8(rgb_frame_buffer[m_row][col], 16); - if (p_col < MATRIX_COLS) rgb_frame_buffer[m_row][p_col] = qadd8(rgb_frame_buffer[m_row][p_col], 13); + if (m_col < col) g_rgb_frame_buffer[m_row][m_col] = qadd8(g_rgb_frame_buffer[m_row][m_col], 13); + g_rgb_frame_buffer[m_row][col] = qadd8(g_rgb_frame_buffer[m_row][col], 16); + if (p_col < MATRIX_COLS) g_rgb_frame_buffer[m_row][p_col] = qadd8(g_rgb_frame_buffer[m_row][p_col], 13); } } @@ -31,18 +31,18 @@ bool TYPING_HEATMAP(effect_params_t* params) { // Modified version of RGB_MATRIX_USE_LIMITS to work off of matrix row / col size uint8_t led_min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; uint8_t led_max = led_min + RGB_MATRIX_LED_PROCESS_LIMIT; - if (led_max > sizeof(rgb_frame_buffer)) led_max = sizeof(rgb_frame_buffer); + if (led_max > sizeof(g_rgb_frame_buffer)) led_max = sizeof(g_rgb_frame_buffer); if (params->init) { rgb_matrix_set_color_all(0, 0, 0); - memset(rgb_frame_buffer, 0, sizeof rgb_frame_buffer); + memset(g_rgb_frame_buffer, 0, sizeof g_rgb_frame_buffer); } // Render heatmap & decrease for (int i = led_min; i < led_max; i++) { uint8_t row = i % MATRIX_ROWS; uint8_t col = i / MATRIX_ROWS; - uint8_t val = rgb_frame_buffer[row][col]; + uint8_t val = g_rgb_frame_buffer[row][col]; // set the pixel colour uint8_t led[LED_HITS_TO_REMEMBER]; @@ -55,10 +55,10 @@ bool TYPING_HEATMAP(effect_params_t* params) { rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b); } - rgb_frame_buffer[row][col] = qsub8(val, 1); + g_rgb_frame_buffer[row][col] = qsub8(val, 1); } - return led_max < sizeof(rgb_frame_buffer); + return led_max < sizeof(g_rgb_frame_buffer); } # 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 3d312190a52..9d0c9fab194 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); bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) { RGB_MATRIX_USE_LIMITS(led_min, led_max); - uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2); + uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); 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 1f4767e3214..2824c82527b 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 bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) { RGB_MATRIX_USE_LIMITS(led_min, led_max); - uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2); + uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); 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 eebfb78c028..5e6bf5daaf3 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); bool effect_runner_i(effect_params_t* params, i_f effect_func) { RGB_MATRIX_USE_LIMITS(led_min, led_max); - uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); + uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); 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 c02352b86d5..3fb7d480517 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 bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) { RGB_MATRIX_USE_LIMITS(led_min, led_max); - uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4); int8_t cos_value = cos8(time) - 128; int8_t sin_value = sin8(time) - 128; 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 fc23f55d0eb..f447ac9c562 100644 --- a/quantum/rgb_matrix_types.h +++ b/quantum/rgb_matrix_types.h @@ -43,13 +43,6 @@ typedef struct PACKED { bool init; } effect_params_t; -typedef struct PACKED { - // Global tick at 20 Hz - uint32_t tick; - // Ticks since this key was last hit. - uint32_t any_key_hit; -} rgb_counters_t; - typedef struct PACKED { uint8_t x; uint8_t y; diff --git a/tmk_core/common.mk b/tmk_core/common.mk index aa8a0eb7ad7..63de7c7edee 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -1,3 +1,5 @@ +PRINTF_PATH = $(LIB_PATH)/printf + COMMON_DIR = common PLATFORM_COMMON_DIR = $(COMMON_DIR)/$(PLATFORM_KEY) @@ -21,7 +23,12 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \ ifeq ($(PLATFORM),AVR) TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/xprintf.S else ifeq ($(PLATFORM),CHIBIOS) - TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/printf.c + TMK_COMMON_SRC += $(PRINTF_PATH)/printf.c + TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_FLOAT + TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_EXPONENTIAL + TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_LONG_LONG + TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T + VPATH += $(PRINTF_PATH) else ifeq ($(PLATFORM),ARM_ATSAM) TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/printf.c endif diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 3b1268dc940..7a53e08ed38 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -48,7 +48,7 @@ int retro_tapping_counter = 0; #endif #ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY -__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode) { return false; } +__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { return false; } #endif #ifndef TAP_CODE_DELAY @@ -335,7 +335,7 @@ void process_action(keyrecord_t *record, action_t action) { # if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY) if ( # ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY - !get_ignore_mod_tap_interrupt(get_event_keycode(record->event, false)) && + !get_ignore_mod_tap_interrupt(get_event_keycode(record->event, false), &record) && # endif record->tap.interrupted) { 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 34f08d89048..fe545c79a06 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c @@ -19,10 +19,10 @@ # define IS_TAPPING_RELEASED() (IS_TAPPING() && !tapping_key.event.pressed) # define IS_TAPPING_KEY(k) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (k))) -__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode) { return TAPPING_TERM; } +__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; } # ifdef TAPPING_TERM_PER_KEY -# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_event_keycode(tapping_key.event, false))) +# 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)) # else # define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < TAPPING_TERM) # endif @@ -122,7 +122,7 @@ bool process_tapping(keyrecord_t *keyp) { # if defined(TAPPING_TERM_PER_KEY) || (TAPPING_TERM >= 500) || defined(PERMISSIVE_HOLD) || defined(PERMISSIVE_HOLD_PER_KEY) else if ( # ifdef TAPPING_TERM_PER_KEY - (get_tapping_term(get_event_keycode(tapping_key.event, false)) >= 500) && + (get_tapping_term(get_event_keycode(tapping_key.event, false), keyp) >= 500) && # endif # ifdef PERMISSIVE_HOLD_PER_KEY !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 5eaef1c5f09..7015ce76120 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 . #ifndef NO_ACTION_TAPPING uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache); -uint16_t get_tapping_term(uint16_t keycode); +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record); void action_tapping_process(keyrecord_t record); #endif diff --git a/tmk_core/common/chibios/printf.c b/tmk_core/common/chibios/printf.c deleted file mode 100644 index a99752bb3d4..00000000000 --- a/tmk_core/common/chibios/printf.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * found at: http://www.sparetimelabs.com/tinyprintf/tinyprintf.php - * and: http://www.sparetimelabs.com/printfrevisited/printfrevisited.php - */ - -/* -File: printf.c - -Copyright (C) 2004 Kustaa Nyholm - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "printf.h" - -typedef void (*putcf)(void*, char); -static putcf stdout_putf; -static void* stdout_putp; - -// this adds cca 400 bytes -#define PRINTF_LONG_SUPPORT - -#ifdef PRINTF_LONG_SUPPORT - -static void uli2a(unsigned long int num, unsigned int base, int uc, char* bf) { - int n = 0; - unsigned int d = 1; - while (num / d >= base) d *= base; - while (d != 0) { - int dgt = num / d; - num %= d; - d /= base; - if (n || dgt > 0 || d == 0) { - *bf++ = dgt + (dgt < 10 ? '0' : (uc ? 'A' : 'a') - 10); - ++n; - } - } - *bf = 0; -} - -static void li2a(long num, char* bf) { - if (num < 0) { - num = -num; - *bf++ = '-'; - } - uli2a(num, 10, 0, bf); -} - -#endif - -static void ui2a(unsigned int num, unsigned int base, int uc, char* bf) { - int n = 0; - unsigned int d = 1; - while (num / d >= base) d *= base; - while (d != 0) { - int dgt = num / d; - num %= d; - d /= base; - if (n || dgt > 0 || d == 0) { - *bf++ = dgt + (dgt < 10 ? '0' : (uc ? 'A' : 'a') - 10); - ++n; - } - } - *bf = 0; -} - -static void i2a(int num, char* bf) { - if (num < 0) { - num = -num; - *bf++ = '-'; - } - ui2a(num, 10, 0, bf); -} - -static int a2d(char ch) { - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else - return -1; -} - -static char a2i(char ch, const char** src, int base, int* nump) { - const char* p = *src; - int num = 0; - int digit; - while ((digit = a2d(ch)) >= 0) { - if (digit > base) break; - num = num * base + digit; - ch = *p++; - } - *src = p; - *nump = num; - return ch; -} - -static void putchw(void* putp, putcf putf, int n, char z, char* bf) { - char fc = z ? '0' : ' '; - char ch; - char* p = bf; - while (*p++ && n > 0) n--; - while (n-- > 0) putf(putp, fc); - while ((ch = *bf++)) putf(putp, ch); -} - -void tfp_format(void* putp, putcf putf, const char* fmt, va_list va) { - // This used to handle max of 12, but binary support jumps this to at least 32 - char bf[36]; - - char ch; - - while ((ch = *(fmt++))) { - if (ch != '%') - putf(putp, ch); - else { - char lz = 0; -#ifdef PRINTF_LONG_SUPPORT - char lng = 0; -#endif - int w = 0; - ch = *(fmt++); - if (ch == '0') { - ch = *(fmt++); - lz = 1; - } - if (ch >= '0' && ch <= '9') { - ch = a2i(ch, &fmt, 10, &w); - } -#ifdef PRINTF_LONG_SUPPORT - if (ch == 'l') { - ch = *(fmt++); - lng = 1; - } -#endif - switch (ch) { - case 0: - goto abort; - case 'u': { -#ifdef PRINTF_LONG_SUPPORT - if (lng) - uli2a(va_arg(va, unsigned long int), 10, 0, bf); - else -#endif - ui2a(va_arg(va, unsigned int), 10, 0, bf); - putchw(putp, putf, w, lz, bf); - break; - } - case 'd': { -#ifdef PRINTF_LONG_SUPPORT - if (lng) - li2a(va_arg(va, unsigned long int), bf); - else -#endif - i2a(va_arg(va, int), bf); - putchw(putp, putf, w, lz, bf); - break; - } - case 'x': - case 'X': -#ifdef PRINTF_LONG_SUPPORT - if (lng) - uli2a(va_arg(va, unsigned long int), 16, (ch == 'X'), bf); - else -#endif - ui2a(va_arg(va, unsigned int), 16, (ch == 'X'), bf); - putchw(putp, putf, w, lz, bf); - break; - case 'c': - putf(putp, (char)(va_arg(va, int))); - break; - case 's': - putchw(putp, putf, w, 0, va_arg(va, char*)); - break; - case 'b': -#ifdef PRINTF_LONG_SUPPORT - if (lng) - uli2a(va_arg(va, unsigned long int), 2, 0, bf); - else -#endif - ui2a(va_arg(va, unsigned int), 2, 0, bf); - putchw(putp, putf, w, lz, bf); - break; - case '%': - putf(putp, ch); - default: - break; - } - } - } -abort:; -} - -void init_printf(void* putp, void (*putf)(void*, char)) { - stdout_putf = putf; - stdout_putp = putp; -} - -int tfp_printf(const char* fmt, ...) { - va_list va; - va_start(va, fmt); - tfp_format(stdout_putp, stdout_putf, fmt, va); - va_end(va); - - return 1; -} - -static void putcp(void* p, char c) { *(*((char**)p))++ = c; } - -int tfp_sprintf(char* s, const char* fmt, ...) { - va_list va; - va_start(va, fmt); - tfp_format(&s, putcp, fmt, va); - putcp(&s, 0); - va_end(va); - - return 1; -} diff --git a/tmk_core/common/chibios/printf.h b/tmk_core/common/chibios/printf.h deleted file mode 100644 index 775459e1e8a..00000000000 --- a/tmk_core/common/chibios/printf.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * found at: http://www.sparetimelabs.com/tinyprintf/tinyprintf.php - * and: http://www.sparetimelabs.com/printfrevisited/printfrevisited.php - */ - -/* -File: printf.h - -Copyright (C) 2004 Kustaa Nyholm - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -See the GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -This library is realy just two files: 'printf.h' and 'printf.c'. - -They provide a simple and small (+200 loc) printf functionality to -be used in embedded systems. - -I've found them so usefull in debugging that I do not bother with a -debugger at all. - -They are distributed in source form, so to use them, just compile them -into your project. - -Two printf variants are provided: printf and sprintf. - -The formats supported by this implementation are: 'd' 'u' 'c' 's' 'x' 'X'. - -Zero padding and field width are also supported. - -If the library is compiled with 'PRINTF_SUPPORT_LONG' defined then the -long specifier is also -supported. Note that this will pull in some long math routines (pun intended!) -and thus make your executable noticably longer. - -The memory foot print of course depends on the target cpu, compiler and -compiler options, but a rough guestimate (based on a H8S target) is about -1.4 kB for code and some twenty 'int's and 'char's, say 60 bytes of stack space. -Not too bad. Your milage may vary. By hacking the source code you can -get rid of some hunred bytes, I'm sure, but personally I feel the balance of -functionality and flexibility versus code size is close to optimal for -many embedded systems. - -To use the printf you need to supply your own character output function, -something like : - - void putc ( void* p, char c) - { - while (!SERIAL_PORT_EMPTY) ; - SERIAL_PORT_TX_REGISTER = c; - } - -Before you can call printf you need to initialize it to use your -character output function with something like: - - init_printf(NULL,putc); - -Notice the 'NULL' in 'init_printf' and the parameter 'void* p' in 'putc', -the NULL (or any pointer) you pass into the 'init_printf' will eventually be -passed to your 'putc' routine. This allows you to pass some storage space (or -anything realy) to the character output function, if necessary. -This is not often needed but it was implemented like that because it made -implementing the sprintf function so neat (look at the source code). - -The code is re-entrant, except for the 'init_printf' function, so it -is safe to call it from interupts too, although this may result in mixed output. -If you rely on re-entrancy, take care that your 'putc' function is re-entrant! - -The printf and sprintf functions are actually macros that translate to -'tfp_printf' and 'tfp_sprintf'. This makes it possible -to use them along with 'stdio.h' printf's in a single source file. -You just need to undef the names before you include the 'stdio.h'. -Note that these are not function like macros, so if you have variables -or struct members with these names, things will explode in your face. -Without variadic macros this is the best we can do to wrap these -fucnction. If it is a problem just give up the macros and use the -functions directly or rename them. - -For further details see source code. - -regs Kusti, 23.10.2004 -*/ - -#ifndef __TFP_PRINTF__ -#define __TFP_PRINTF__ - -#include - -void init_printf(void* putp, void (*putf)(void*, char)); - -int tfp_printf(const char* fmt, ...); -int tfp_sprintf(char* s, const char* fmt, ...); - -void tfp_format(void* putp, void (*putf)(void*, char), const char* fmt, va_list va); - -#define printf tfp_printf -#define sprintf tfp_sprintf - -#endif diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index ee3188646c6..3cfcba3058c 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -43,10 +43,6 @@ along with this program. If not, see . # include "mousekey.h" #endif -#ifdef PROTOCOL_VUSB -# include "usbdrv.h" -#endif - #ifdef AUDIO_ENABLE # include "audio.h" #endif /* AUDIO_ENABLE */ diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h index 04ca558109d..1c77236212d 100644 --- a/tmk_core/common/print.h +++ b/tmk_core/common/print.h @@ -72,9 +72,7 @@ extern "C" # elif defined(PROTOCOL_CHIBIOS) /* PROTOCOL_CHIBIOS */ -# ifndef TERMINAL_ENABLE -# include "chibios/printf.h" -# endif +# include "printf.h" // lib/printf/printf.h # ifdef USER_PRINT /* USER_PRINT */ @@ -89,7 +87,6 @@ extern "C" # define uprintf printf # else /* NORMAL PRINT */ - // Create user & normal print defines # define print(s) printf(s) # 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 24eab250676..4b8cc7c5e16 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) { } // This should only be performed once per frame - pomod = (float)((g_rgb_counters.tick / 10) % (uint32_t)(1000.0f / led_animation_speed)) / 10.0f * led_animation_speed; + pomod = (float)((g_rgb_timer / 10) % (uint32_t)(1000.0f / led_animation_speed)) / 10.0f * led_animation_speed; pomod *= 100.0f; pomod = (uint32_t)pomod % 10000; pomod /= 100.0f; diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 61665eb6f4b..7d32c16ed8c 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -158,9 +158,6 @@ int main(void) { /* Init USB */ init_usb_driver(&USB_DRIVER); - /* init printf */ - init_printf(NULL, sendchar_pf); - #ifdef MIDI_ENABLE setup_midi(); #endif diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index ecc83d9ecc9..65bd291bec5 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) { } #endif /* CONSOLE_ENABLE */ -void sendchar_pf(void *p, char c) { - (void)p; - sendchar((uint8_t)c); +void _putchar(char character) { + sendchar(character); } #ifdef RAW_ENABLE diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index 17041b4f2fd..94baf9b35e0 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); #endif /* CONSOLE_ENABLE */ -void sendchar_pf(void *p, char c); - #endif /* _USB_MAIN_H_ */ diff --git a/tmk_core/protocol/iwrap.mk b/tmk_core/protocol/iwrap.mk index eeedd83af2c..934235bd810 100644 --- a/tmk_core/protocol/iwrap.mk +++ b/tmk_core/protocol/iwrap.mk @@ -16,11 +16,17 @@ VPATH += $(TMK_DIR)/protocol/iwrap # V-USB # VUSB_DIR = protocol/vusb -OPT_DEFS += -DPROTOCOL_VUSB -SRC += $(VUSB_DIR)/vusb.c \ - $(VUSB_DIR)/usbdrv/usbdrv.c \ - $(VUSB_DIR)/usbdrv/usbdrvasm.S \ - $(VUSB_DIR)/usbdrv/oddebug.c -VPATH += $(TMK_DIR)/protocol/vusb:$(TMK_DIR)/protocol/vusb/usbdrv +# Path to the V-USB library +VUSB_PATH = $(LIB_PATH)/vusb + +SRC += $(VUSB_DIR)/vusb.c \ + $(VUSB_PATH)/usbdrv/usbdrv.c \ + $(VUSB_PATH)/usbdrv/usbdrvasm.S \ + $(VUSB_PATH)/usbdrv/oddebug.c +# Search Path +VPATH += $(TMK_PATH)/$(VUSB_DIR) +VPATH += $(VUSB_PATH) + +OPT_DEFS += -DPROTOCOL_VUSB diff --git a/tmk_core/protocol/iwrap/main.c b/tmk_core/protocol/iwrap/main.c index 6e9b5455b13..4048a9791dc 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 . #include "iwrap.h" #ifdef PROTOCOL_VUSB # include "vusb.h" -# include "usbdrv.h" +# include #endif #include "uart.h" #include "suart.h" diff --git a/tmk_core/protocol/vusb.mk b/tmk_core/protocol/vusb.mk index 6df0d0d339d..5e564f74805 100644 --- a/tmk_core/protocol/vusb.mk +++ b/tmk_core/protocol/vusb.mk @@ -1,13 +1,13 @@ VUSB_DIR = protocol/vusb -OPT_DEFS += -DPROTOCOL_VUSB +# Path to the V-USB library +VUSB_PATH = $(LIB_PATH)/vusb -SRC += $(VUSB_DIR)/main.c \ +SRC += $(VUSB_DIR)/main.c \ $(VUSB_DIR)/vusb.c \ - $(VUSB_DIR)/usbdrv/usbdrv.c \ - $(VUSB_DIR)/usbdrv/usbdrvasm.S \ - $(VUSB_DIR)/usbdrv/oddebug.c - + $(VUSB_PATH)/usbdrv/usbdrv.c \ + $(VUSB_PATH)/usbdrv/usbdrvasm.S \ + $(VUSB_PATH)/usbdrv/oddebug.c ifneq ($(strip $(CONSOLE_ENABLE)), yes) ifndef NO_UART @@ -18,4 +18,6 @@ endif # Search Path VPATH += $(TMK_PATH)/$(VUSB_DIR) -VPATH += $(TMK_PATH)/$(VUSB_DIR)/usbdrv +VPATH += $(VUSB_PATH) + +OPT_DEFS += -DPROTOCOL_VUSB diff --git a/tmk_core/protocol/vusb/main.c b/tmk_core/protocol/vusb/main.c index 7dc16926d2b..b4063273daa 100644 --- a/tmk_core/protocol/vusb/main.c +++ b/tmk_core/protocol/vusb/main.c @@ -12,8 +12,8 @@ #include #include #include -#include "usbdrv.h" -#include "oddebug.h" +#include +#include #include "vusb.h" #include "keyboard.h" #include "host.h" diff --git a/tmk_core/protocol/vusb/sendchar_usart.c b/tmk_core/protocol/vusb/sendchar_usart.c index 42bd9ee363d..a920a9a536b 100644 --- a/tmk_core/protocol/vusb/sendchar_usart.c +++ b/tmk_core/protocol/vusb/sendchar_usart.c @@ -3,7 +3,7 @@ * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) */ #include -#include "oddebug.h" +#include #include "sendchar.h" #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 1e74180a9ed..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/Changelog.txt +++ /dev/null @@ -1,308 +0,0 @@ -This file documents changes in the firmware-only USB driver for atmel's AVR -microcontrollers. New entries are always appended to the end of the file. -Scroll down to the bottom to see the most recent changes. - -2005-04-01: - - Implemented endpoint 1 as interrupt-in endpoint. - - Moved all configuration options to usbconfig.h which is not part of the - driver. - - Changed interface for usbVendorSetup(). - - Fixed compatibility with ATMega8 device. - - Various minor optimizations. - -2005-04-11: - - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead() - and usbFunctionWrite() now. Added configuration options to choose which - of these functions to compile in. - - Assembler module delivers receive data non-inverted now. - - Made register and bit names compatible with more AVR devices. - -2005-05-03: - - Allow address of usbRxBuf on any memory page as long as the buffer does - not cross 256 byte page boundaries. - - Better device compatibility: works with Mega88 now. - - Code optimization in debugging module. - - Documentation updates. - -2006-01-02: - - Added (free) default Vendor- and Product-IDs bought from voti.nl. - - Added USBID-License.txt file which defines the rules for using the free - shared VID/PID pair. - - Added readme.txt to the usbdrv directory which clarifies administrative - issues. - -2006-01-25: - - Added "configured state" to become more standards compliant. - - Added "HALT" state for interrupt endpoint. - - Driver passes the "USB Command Verifier" test from usb.org now. - - Made "serial number" a configuration option. - - Minor optimizations, we now recommend compiler option "-Os" for best - results. - - Added a version number to usbdrv.h - -2006-02-03: - - New configuration variable USB_BUFFER_SECTION for the memory section where - the USB rx buffer will go. This defaults to ".bss" if not defined. Since - this buffer MUST NOT cross 256 byte pages (not even touch a page at the - end), the user may want to pass a linker option similar to - "-Wl,--section-start=.mybuffer=0x800060". - - Provide structure for usbRequest_t. - - New defines for USB constants. - - Prepared for HID implementations. - - Increased data size limit for interrupt transfers to 8 bytes. - - New macro usbInterruptIsReady() to query interrupt buffer state. - -2006-02-18: - - Ensure that the data token which is sent as an ack to an OUT transfer is - always zero sized. This fixes a bug where the host reports an error after - sending an out transfer to the device, although all data arrived at the - device. - - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite(). - -* Release 2006-02-20 - - - Give a compiler warning when compiling with debugging turned on. - - Added Oleg Semyonov's changes for IAR-cc compatibility. - - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect() - (also thanks to Oleg!). - - Rearranged tests in usbPoll() to save a couple of instructions in the most - likely case that no actions are pending. - - We need a delay between the SET ADDRESS request until the new address - becomes active. This delay was handled in usbPoll() until now. Since the - spec says that the delay must not exceed 2ms, previous versions required - aggressive polling during the enumeration phase. We have now moved the - handling of the delay into the interrupt routine. - - We must not reply with NAK to a SETUP transaction. We can only achieve this - by making sure that the rx buffer is empty when SETUP tokens are expected. - We therefore don't pass zero sized data packets from the status phase of - a transfer to usbPoll(). This change MAY cause troubles if you rely on - receiving a less than 8 bytes long packet in usbFunctionWrite() to - identify the end of a transfer. usbFunctionWrite() will NEVER be called - with a zero length. - -* Release 2006-03-14 - - - Improved IAR C support: tiny memory model, more devices - - Added template usbconfig.h file under the name usbconfig-prototype.h - -* Release 2006-03-26 - - - Added provision for one more interrupt-in endpoint (endpoint 3). - - Added provision for one interrupt-out endpoint (endpoint 1). - - Added flowcontrol macros for USB. - - Added provision for custom configuration descriptor. - - Allow ANY two port bits for D+ and D-. - - Merged (optional) receive endpoint number into global usbRxToken variable. - - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the - variable name from the single port letter instead of computing the address - of related ports from the output-port address. - -* Release 2006-06-26 - - - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the - new features. - - Removed "#warning" directives because IAR does not understand them. Use - unused static variables instead to generate a warning. - - Do not include when compiling with IAR. - - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each - USB descriptor should be handled. It is now possible to provide descriptor - data in Flash, RAM or dynamically at runtime. - - STALL is now a status in usbTxLen* instead of a message. We can now conform - to the spec and leave the stall status pending until it is cleared. - - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the - application code to reset data toggling on interrupt pipes. - -* Release 2006-07-18 - - - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes - an assembler error. - - usbDeviceDisconnect() takes pull-up resistor to high impedance now. - -* Release 2007-02-01 - - - Merged in some code size improvements from usbtiny (thanks to Dick - Streefland for these optimizations!) - - Special alignment requirement for usbRxBuf not required any more. Thanks - again to Dick Streefland for this hint! - - Reverted to "#warning" instead of unused static variables -- new versions - of IAR CC should handle this directive. - - Changed Open Source license to GNU GPL v2 in order to make linking against - other free libraries easier. We no longer require publication of the - circuit diagrams, but we STRONGLY encourage it. If you improve the driver - itself, PLEASE grant us a royalty free license to your changes for our - commercial license. - -* Release 2007-03-29 - - - New configuration option "USB_PUBLIC" in usbconfig.h. - - Set USB version number to 1.10 instead of 1.01. - - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and - USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences - to USB_CFG_DESCR_PROPS_STRING_PRODUCT. - - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver - code. - - New assembler module for 16 MHz crystal. - - usbdrvasm.S contains common code only, clock-specific parts have been moved - to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively. - -* Release 2007-06-25 - - - 16 MHz module: Do SE0 check in stuffed bits as well. - -* Release 2007-07-07 - - - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary - for negative values. - - Added 15 MHz module contributed by V. Bosch. - - Interrupt vector name can now be configured. This is useful if somebody - wants to use a different hardware interrupt than INT0. - -* Release 2007-08-07 - - - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is - not exceeded. - - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN, - USB_COUNT_SOF - - USB_INTR_PENDING can now be a memory address, not just I/O - -* Release 2007-09-19 - - - Split out common parts of assembler modules into separate include file - - Made endpoint numbers configurable so that given interface definitions - can be matched. See USB_CFG_EP3_NUMBER in usbconfig-prototype.h. - - Store endpoint number for interrupt/bulk-out so that usbFunctionWriteOut() - can handle any number of endpoints. - - Define usbDeviceConnect() and usbDeviceDisconnect() even if no - USB_CFG_PULLUP_IOPORTNAME is defined. Directly set D+ and D- to 0 in this - case. - -* Release 2007-12-01 - - - Optimize usbDeviceConnect() and usbDeviceDisconnect() for less code size - when USB_CFG_PULLUP_IOPORTNAME is not defined. - -* Release 2007-12-13 - - - Renamed all include-only assembler modules from *.S to *.inc so that - people don't add them to their project sources. - - Distribute leap bits in tx loop more evenly for 16 MHz module. - - Use "macro" and "endm" instead of ".macro" and ".endm" for IAR - - Avoid compiler warnings for constant expr range by casting some values in - USB descriptors. - -* Release 2008-01-21 - - - Fixed bug in 15 and 16 MHz module where the new address set with - SET_ADDRESS was already accepted at the next NAK or ACK we send, not at - the next data packet we send. This caused problems when the host polled - too fast. Thanks to Alexander Neumann for his help and patience debugging - this issue! - -* Release 2008-02-05 - - - Fixed bug in 16.5 MHz module where a register was used in the interrupt - handler before it was pushed. This bug was introduced with version - 2007-09-19 when common parts were moved to a separate file. - - Optimized CRC routine (thanks to Reimar Doeffinger). - -* Release 2008-02-16 - - - Removed outdated IAR compatibility stuff (code sections). - - Added hook macros for USB_RESET_HOOK() and USB_SET_ADDRESS_HOOK(). - - Added optional routine usbMeasureFrameLength() for calibration of the - internal RC oscillator. - -* Release 2008-02-28 - - - USB_INITIAL_DATATOKEN defaults to USBPID_DATA1 now, which means that we - start with sending USBPID_DATA0. - - Changed defaults in usbconfig-prototype.h - - Added free USB VID/PID pair for MIDI class devices - - Restructured AVR-USB as separate package, not part of PowerSwitch any more. - -* Release 2008-04-18 - - - Restructured usbdrv.c so that it is easier to read and understand. - - Better code optimization with gcc 4. - - If a second interrupt in endpoint is enabled, also add it to config - descriptor. - - Added config option for long transfers (above 254 bytes), see - USB_CFG_LONG_TRANSFERS in usbconfig.h. - - Added 20 MHz module contributed by Jeroen Benschop. - -* Release 2008-05-13 - - - Fixed bug in libs-host/hiddata.c function usbhidGetReport(): length - was not incremented, pointer to length was incremented instead. - - Added code to command line tool(s) which claims an interface. This code - is disabled by default, but may be necessary on newer Linux kernels. - - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING". - - New header "usbportability.h" prepares ports to other development - environments. - - Long transfers (above 254 bytes) did not work when usbFunctionRead() was - used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!] - - In hiddata.c (example code for sending/receiving data over HID), use - USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so - that we need not claim the interface. - - in usbPoll() loop 20 times polling for RESET state instead of 10 times. - This accounts for the higher clock rates we now support. - - Added a module for 12.8 MHz RC oscillator with PLL in receiver loop. - - Added hook to SOF code so that oscillator can be tuned to USB frame clock. - - Added timeout to waitForJ loop. Helps preventing unexpected hangs. - - Added example code for oscillator tuning to libs-device (thanks to - Henrik Haftmann for the idea to this routine). - - Implemented option USB_CFG_SUPPRESS_INTR_CODE. - -* Release 2008-10-22 - - - Fixed libs-device/osctune.h: OSCCAL is memory address on ATMega88 and - similar, not offset of 0x20 needs to be added. - - Allow distribution under GPLv3 for those who have to link against other - code distributed under GPLv3. - -* Release 2008-11-26 - - - Removed libusb-win32 dependency for hid-data example in Makefile.windows. - It was never required and confused many people. - - Added extern uchar usbRxToken to usbdrv.h. - - Integrated a module with CRC checks at 18 MHz by Lukas Schrittwieser. - -* Release 2009-03-23 - - - Hid-mouse example used settings from hid-data example, fixed that. - - Renamed project to V-USB due to a trademark issue with Atmel(r). - - Changed CommercialLicense.txt and USBID-License.txt to make the - background of USB ID registration clearer. - -* Release 2009-04-15 - - - Changed CommercialLicense.txt to reflect the new range of PIDs from - Jason Kotzin. - - Removed USBID-License.txt in favor of USB-IDs-for-free.txt and - USB-ID-FAQ.txt - - Fixed a bug in the 12.8 MHz module: End Of Packet decection was made in - the center between bit 0 and 1 of each byte. This is where the data lines - are expected to change and the sampled data may therefore be nonsense. - We therefore check EOP ONLY if bits 0 AND 1 have both been read as 0 on D-. - - Fixed a bitstuffing problem in the 16 MHz module: If bit 6 was stuffed, - the unstuffing code in the receiver routine was 1 cycle too long. If - multiple bytes had the unstuffing in bit 6, the error summed up until the - receiver was out of sync. - - Included option for faster CRC routine. - Thanks to Slawomir Fras (BoskiDialer) for this code! - - Updated bits in Configuration Descriptor's bmAttributes according to - USB 1.1 (in particular bit 7, it is a must-be-set bit now). - -* Release 2009-08-22 - - - Moved first DBG1() after odDebugInit() in all examples. - - Use vector INT0_vect instead of SIG_INTERRUPT0 if defined. This makes - V-USB compatible with the new "p" suffix devices (e.g. ATMega328p). - - USB_CFG_CLOCK_KHZ setting is now required in usbconfig.h (no default any - more). - - New option USB_CFG_DRIVER_FLASH_PAGE allows boot loaders on devices with - more than 64 kB flash. - - Built-in configuration descriptor allows custom definition for second - endpoint now. - -* 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 11d07d9df03..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/CommercialLicense.txt +++ /dev/null @@ -1,166 +0,0 @@ -V-USB Driver Software License Agreement -Version 2009-08-03 - -THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN -ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING -THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT. - - -1 DEFINITIONS - -1.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH, -Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA. - -1.2 "You" shall mean the Licensee. - -1.3 "V-USB" shall mean all files included in the package distributed under -the name "vusb" by OBJECTIVE DEVELOPMENT (http://www.obdev.at/vusb/) -unless otherwise noted. This includes the firmware-only USB device -implementation for Atmel AVR microcontrollers, some simple device examples -and host side software examples and libraries. - - -2 LICENSE GRANTS - -2.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source -code of V-USB. - -2.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the -non-exclusive right to use, copy and distribute V-USB with your hardware -product(s), restricted by the limitations in section 3 below. - -2.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify -the source code and your copy of V-USB according to your needs. - -2.4 USB IDs. OBJECTIVE DEVELOPMENT furnishes you with one or two USB -Product ID(s), sent to you in e-mail. These Product IDs are reserved -exclusively for you. OBJECTIVE DEVELOPMENT has obtained USB Product ID -ranges under the Vendor ID 5824 from Wouter van Ooijen (Van Ooijen -Technische Informatica, www.voti.nl) and under the Vendor ID 8352 from -Jason Kotzin (Clay Logic, www.claylogic.com). Both owners of the Vendor IDs -have obtained these IDs from the USB Implementers Forum, Inc. -(www.usb.org). OBJECTIVE DEVELOPMENT disclaims all liability which might -arise from the assignment of USB IDs. - -2.5 USB Certification. Although not part of this agreement, we want to make -it clear that you cannot become USB certified when you use V-USB or a USB -Product ID assigned by OBJECTIVE DEVELOPMENT. AVR microcontrollers don't -meet the electrical specifications required by the USB specification and -the USB Implementers Forum certifies only members who bought a Vendor ID of -their own. - - -3 LICENSE RESTRICTIONS - -3.1 Number of Units. Only one of the following three definitions is -applicable. Which one is determined by the amount you pay to OBJECTIVE -DEVELOPMENT, see section 4 ("Payment") below. - -Hobby License: You may use V-USB according to section 2 above in no more -than 5 hardware units. These units must not be sold for profit. - -Entry Level License: You may use V-USB according to section 2 above in no -more than 150 hardware units. - -Professional License: You may use V-USB according to section 2 above in -any number of hardware units, except for large scale production ("unlimited -fair use"). Quantities below 10,000 units are not considered large scale -production. If your reach quantities which are obviously large scale -production, you must pay a license fee of 0.10 EUR per unit for all units -above 10,000. - -3.2 Rental. You may not rent, lease, or lend V-USB or otherwise encumber -any copy of V-USB, or any of the rights granted herein. - -3.3 Transfer. You may not transfer your rights under this Agreement to -another party without OBJECTIVE DEVELOPMENT's prior written consent. If -such consent is obtained, you may permanently transfer this License to -another party. The recipient of such transfer must agree to all terms and -conditions of this Agreement. - -3.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not -expressly granted. - -3.5 Non-Exclusive Rights. Your license rights under this Agreement are -non-exclusive. - -3.6 Third Party Rights. This Agreement cannot grant you rights controlled -by third parties. In particular, you are not allowed to use the USB logo or -other trademarks owned by the USB Implementers Forum, Inc. without their -consent. Since such consent depends on USB certification, it should be -noted that V-USB will not pass certification because it does not -implement checksum verification and the microcontroller ports do not meet -the electrical specifications. - - -4 PAYMENT - -The payment amount depends on the variation of this agreement (according to -section 3.1) into which you want to enter. Concrete prices are listed on -OBJECTIVE DEVELOPMENT's web site, usually at -http://www.obdev.at/vusb/license.html. You agree to pay the amount listed -there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor -or reseller. - - -5 COPYRIGHT AND OWNERSHIP - -V-USB is protected by copyright laws and international copyright -treaties, as well as other intellectual property laws and treaties. V-USB -is licensed, not sold. - - -6 TERM AND TERMINATION - -6.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE -DEVELOPMENT may terminate this Agreement and revoke the granted license and -USB-IDs if you fail to comply with any of its terms and conditions. - -6.2 Survival of Terms. All provisions regarding secrecy, confidentiality -and limitation of liability shall survive termination of this agreement. - - -7 DISCLAIMER OF WARRANTY AND LIABILITY - -LIMITED WARRANTY. V-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE -DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND -NON-INFRINGEMENT, WITH REGARD TO V-USB, AND THE PROVISION OF OR FAILURE -TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL -RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO -STATE/JURISDICTION. - -LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, -IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY -SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER -(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, -BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY -LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE V-USB OR THE -PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE -DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY -CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS -AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR V-USB. - - -8 MISCELLANEOUS TERMS - -8.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing -purposes that you entered into this agreement. - -8.2 Entire Agreement. This document represents the entire agreement between -OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by -an authorized representative of both, OBJECTIVE DEVELOPMENT and you. - -8.3 Severability. In case a provision of these terms and conditions should -be or become partly or entirely invalid, ineffective, or not executable, -the validity of all other provisions shall not be affected. - -8.4 Applicable Law. This agreement is governed by the laws of the Republic -of Austria. - -8.5 Responsible Courts. The responsible courts in Vienna/Austria will have -exclusive jurisdiction regarding all disputes in connection with this -agreement. - diff --git a/tmk_core/protocol/vusb/usbdrv/License.txt b/tmk_core/protocol/vusb/usbdrv/License.txt deleted file mode 100644 index ce4c3aed457..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/License.txt +++ /dev/null @@ -1,361 +0,0 @@ -OBJECTIVE DEVELOPMENT GmbH's V-USB driver software is distributed under the -terms and conditions of the GNU GPL version 2 or the GNU GPL version 3. It is -your choice whether you apply the terms of version 2 or version 3. The full -text of GPLv2 is included below. In addition to the requirements in the GPL, -we STRONGLY ENCOURAGE you to do the following: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/vusb/feedback.html for your submission. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/vusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public 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 3cff49f6fa2..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/Readme.txt +++ /dev/null @@ -1,172 +0,0 @@ -This is the readme file to Objective Development's firmware-only USB driver -for Atmel AVR microcontrollers. For more information please visit -http://www.obdev.at/vusb/ - -This directory contains the USB firmware only. Copy it as-is to your own -project and add all .c and .S files to your project (these files are marked -with an asterisk in the list below). Then copy usbconfig-prototype.h as -usbconfig.h to your project and edit it according to your configuration. - - -TECHNICAL DOCUMENTATION -======================= -The technical documentation (API) for the firmware driver is contained in the -file "usbdrv.h". Please read all of it carefully! Configuration options are -documented in "usbconfig-prototype.h". - -The driver consists of the following files: - readme.txt ............. The file you are currently reading. - Changelog.txt .......... Release notes for all versions of the driver. - usbdrv.h ............... Driver interface definitions and technical docs. -* usbdrv.c ............... High level language part of the driver. Link this - module to your code! -* usbdrvasm.S ............ Assembler part of the driver. This module is mostly - a stub and includes one of the usbdrvasm*.S files - depending on processor clock. Link this module to - your code! - usbdrvasm*.inc ......... Assembler routines for particular clock frequencies. - Included by usbdrvasm.S, don't link it directly! - asmcommon.inc .......... Common assembler routines. Included by - usbdrvasm*.inc, don't link it directly! - usbconfig-prototype.h .. Prototype for your own usbdrv.h file. -* oddebug.c .............. Debug functions. Only used when DEBUG_LEVEL is - defined to a value greater than 0. Link this module - to your code! - oddebug.h .............. Interface definitions of the debug module. - usbportability.h ....... Header with compiler-dependent stuff. - usbdrvasm.asm .......... Compatibility stub for IAR-C-compiler. Use this - module instead of usbdrvasm.S when you assembler - with IAR's tools. - License.txt ............ Open Source license for this driver. - CommercialLicense.txt .. Optional commercial license for this driver. - USB-ID-FAQ.txt ......... General infos about USB Product- and Vendor-IDs. - USB-IDs-for-free.txt ... List and terms of use for free shared PIDs. - -(*) ... These files should be linked to your project. - - -CPU CORE CLOCK FREQUENCY -======================== -We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz, -16 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The -actual clock rate must be configured in usbconfig.h. - -12 MHz Clock -This is the traditional clock rate of V-USB because it's the lowest clock -rate where the timing constraints of the USB spec can be met. - -15 MHz Clock -Similar to 12 MHz, but some NOPs inserted. On the other hand, the higher clock -rate allows for some loops which make the resulting code size somewhat smaller -than the 12 MHz version. - -16 MHz Clock -This clock rate has been added for users of the Arduino board and other -ready-made boards which come with a fixed 16 MHz crystal. It's also an option -if you need the slightly higher clock rate for performance reasons. Since -16 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code -is somewhat tricky and has to insert a leap cycle every third byte. - -12.8 MHz and 16.5 MHz Clock -The assembler modules for these clock rates differ from the other modules -because they have been built for an RC oscillator with only 1% precision. The -receiver code inserts leap cycles to compensate for clock deviations. 1% is -also the precision which can be achieved by calibrating the internal RC -oscillator of the AVR. Please note that only AVRs with internal 64 MHz PLL -oscillator can reach 16.5 MHz with the RC oscillator. This includes the very -popular ATTiny25, ATTiny45, ATTiny85 series as well as the ATTiny26. Almost -all AVRs can reach 12.8 MHz, although this is outside the specified range. - -See the EasyLogger example at http://www.obdev.at/vusb/easylogger.html for -code which calibrates the RC oscillator based on the USB frame clock. - -18 MHz Clock -This module is closer to the USB specification because it performs an on the -fly CRC check for incoming packets. Packets with invalid checksum are -discarded as required by the spec. If you also implement checks for data -PID toggling on application level (see option USB_CFG_CHECK_DATA_TOGGLING -in usbconfig.h for more info), this ensures data integrity. Due to the CRC -tables and alignment requirements, this code is bigger than modules for other -clock rates. To activate this module, you must define USB_CFG_CHECK_CRC to 1 -and USB_CFG_CLOCK_KHZ to 18000 in usbconfig.h. - -20 MHz Clock -This module is for people who won't do it with less than the maximum. Since -20 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code -uses similar tricks as the 16 MHz module to insert leap cycles. - - -USB IDENTIFIERS -=============== -Every USB device needs a vendor- and a product-identifier (VID and PID). VIDs -are obtained from usb.org for a price of 1,500 USD. Once you have a VID, you -can assign PIDs at will. - -Since an entry level cost of 1,500 USD is too high for most small companies -and hobbyists, we provide some VID/PID pairs for free. See the file -USB-IDs-for-free.txt for details. - -Objective Development also has some license offerings which include product -IDs. See http://www.obdev.at/vusb/ for details. - - -DEVELOPMENT SYSTEM -================== -This driver has been developed and optimized for the GNU compiler version 3 -and 4. We recommend that you use the GNU compiler suite because it is freely -available. V-USB has also been ported to the IAR compiler and assembler. It -has been tested with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the -"small" and "tiny" memory model. Not every release is tested with IAR CC and -the driver may therefore fail to compile with IAR. Please note that gcc is -more efficient for usbdrv.c because this module has been deliberately -optimized for gcc. - -Gcc version 3 produces smaller code than version 4 due to new optimizing -capabilities which don't always improve things on 8 bit CPUs. The code size -generated by gcc 4 can be reduced with the compiler options --fno-move-loop-invariants, -fno-tree-scev-cprop and --fno-inline-small-functions in addition to -Os. On devices with more than -8k of flash memory, we also recommend the linker option --relax (written as --Wl,--relax for gcc) to convert absolute calls into relative where possible. - -For more information about optimizing options see: - - http://www.tty1.net/blog/2008-04-29-avr-gcc-optimisations_en.html - -These optimizations are good for gcc 4.x. Version 3.x of gcc does not support -most of these options and produces good code anyway. - - -USING V-USB FOR FREE -==================== -The AVR firmware driver is published under the GNU General Public License -Version 2 (GPL2) and the GNU General Public License Version 3 (GPL3). It is -your choice whether you apply the terms of version 2 or version 3. - -If you decide for the free GPL2 or GPL3, we STRONGLY ENCOURAGE you to do the -following things IN ADDITION to the obligations from the GPL: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/vusb/feedback.html for your submission. -If you don't have a web site, you can publish the project in obdev's -documentation wiki at -http://www.obdev.at/goto.php?t=vusb-wiki&p=hosted-projects. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/vusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - -COMMERCIAL LICENSES FOR V-USB -============================= -If you don't want to publish your source code under the terms of the GPL, -you can simply pay money for V-USB. As an additional benefit you get -USB PIDs for free, reserved exclusively to you. See the file -"CommercialLicense.txt" for details. - 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 d1de8fb618a..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/USB-ID-FAQ.txt +++ /dev/null @@ -1,149 +0,0 @@ -Version 2009-08-22 - -========================== -WHY DO WE NEED THESE IDs? -========================== - -USB is more than a low level protocol for data transport. It also defines a -common set of requests which must be understood by all devices. And as part -of these common requests, the specification defines data structures, the -USB Descriptors, which are used to describe the properties of the device. - -From the perspective of an operating system, it is therefore possible to find -out basic properties of a device (such as e.g. the manufacturer and the name -of the device) without a device-specific driver. This is essential because -the operating system can choose a driver to load based on this information -(Plug-And-Play). - -Among the most important properties in the Device Descriptor are the USB -Vendor- and Product-ID. Both are 16 bit integers. The most simple form of -driver matching is based on these IDs. The driver announces the Vendor- and -Product-IDs of the devices it can handle and the operating system loads the -appropriate driver when the device is connected. - -It is obvious that this technique only works if the pair Vendor- plus -Product-ID is unique: Only devices which require the same driver can have the -same pair of IDs. - - -===================================================== -HOW DOES THE USB STANDARD ENSURE THAT IDs ARE UNIQUE? -===================================================== - -Since it is so important that USB IDs are unique, the USB Implementers Forum, -Inc. (usb.org) needs a way to enforce this legally. It is not forbidden by -law to build a device and assign it any random numbers as IDs. Usb.org -therefore needs an agreement to regulate the use of USB IDs. The agreement -binds only parties who agreed to it, of course. Everybody else is free to use -any numbers for their IDs. - -So how can usb.org ensure that every manufacturer of USB devices enters into -an agreement with them? They do it via trademark licensing. Usb.org has -registered the trademark "USB", all associated logos and related terms. If -you want to put an USB logo on your product or claim that it is USB -compliant, you must license these trademarks from usb.org. And this is where -you enter into an agreement. See the "USB-IF Trademark License Agreement and -Usage Guidelines for the USB-IF Logo" at -http://www.usb.org/developers/logo_license/. - -Licensing the USB trademarks requires that you buy a USB Vendor-ID from -usb.org (one-time fee of ca. 2,000 USD), that you become a member of usb.org -(yearly fee of ca. 4,000 USD) and that you meet all the technical -specifications from the USB spec. - -This means that most hobbyists and small companies will never be able to -become USB compliant, just because membership is so expensive. And you can't -be compliant with a driver based on V-USB anyway, because the AVR's port pins -don't meet the electrical specifications for USB. So, in principle, all -hobbyists and small companies are free to choose any random numbers for their -IDs. They have nothing to lose... - -There is one exception worth noting, though: If you use a sub-component which -implements USB, the vendor of the sub-components may guarantee USB -compliance. This might apply to some or all of FTDI's solutions. - - -======================================================================= -WHY SHOULD YOU OBTAIN USB IDs EVEN IF YOU DON'T LICENSE USB TRADEMARKS? -======================================================================= - -You have learned in the previous section that you are free to choose any -numbers for your IDs anyway. So why not do exactly this? There is still the -technical issue. If you choose IDs which are already in use by somebody else, -operating systems will load the wrong drivers and your device won't work. -Even if you choose IDs which are not currently in use, they may be in use in -the next version of the operating system or even after an automatic update. - -So what you need is a pair of Vendor- and Product-IDs for which you have the -guarantee that no USB compliant product uses them. This implies that no -operating system will ever ship with drivers responsible for these IDs. - - -============================================== -HOW DOES OBJECTIVE DEVELOPMENT HANDLE USB IDs? -============================================== - -Objective Development gives away pairs of USB-IDs with their V-USB licenses. -In order to ensure that these IDs are unique, Objective Development has an -agreement with the company/person who has bought the USB Vendor-ID from -usb.org. This agreement ensures that a range of USB Product-IDs is reserved -for assignment by Objective Development and that the owner of the Vendor-ID -won't give it to anybody else. - -This means that you have to trust three parties to ensure uniqueness of -your IDs: - - - Objective Development, that they don't give the same PID to more than - one person. - - The owner of the Vendor-ID that they don't assign PIDs from the range - assigned to Objective Development to anybody else. - - Usb.org that they don't assign the same Vendor-ID a second time. - - -================================== -WHO IS THE OWNER OF THE VENDOR-ID? -================================== - -Objective Development has obtained ranges of USB Product-IDs under two -Vendor-IDs: Under Vendor-ID 5824 from Wouter van Ooijen (Van Ooijen -Technische Informatica, www.voti.nl) and under Vendor-ID 8352 from Jason -Kotzin (Clay Logic, www.claylogic.com). Both VID owners have received their -Vendor-ID directly from usb.org. - - -========================================================================= -CAN I USE USB-IDs FROM OBJECTIVE DEVELOPMENT WITH OTHER DRIVERS/HARDWARE? -========================================================================= - -The short answer is: Yes. All you get is a guarantee that the IDs are never -assigned to anybody else. What more do you need? - - -============================ -WHAT ABOUT SHARED ID PAIRS? -============================ - -Objective Development has reserved some PID/VID pairs for shared use. You -have no guarantee of uniqueness for them, except that no USB compliant device -uses them. In order to avoid technical problems, we must ensure that all -devices with the same pair of IDs use the same driver on kernel level. For -details, see the file USB-IDs-for-free.txt. - - -====================================================== -I HAVE HEARD THAT SUB-LICENSING OF USB-IDs IS ILLEGAL? -====================================================== - -A 16 bit integer number cannot be protected by copyright laws. It is not -sufficiently complex. And since none of the parties involved entered into the -USB-IF Trademark License Agreement, we are not bound by this agreement. So -there is no reason why it should be illegal to sub-license USB-IDs. - - -============================================= -WHO IS LIABLE IF THERE ARE INCOMPATIBILITIES? -============================================= - -Objective Development disclaims all liabilities which might arise from the -assignment of IDs. If you guarantee product features to your customers -without 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 2f4d59ad18e..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/USB-IDs-for-free.txt +++ /dev/null @@ -1,148 +0,0 @@ -Version 2009-08-22 - -=========================== -FREE USB-IDs FOR SHARED USE -=========================== - -Objective Development has reserved a set of USB Product-IDs for use according -to the guidelines outlined below. For more information about the concept of -USB IDs please see the file USB-ID-FAQ.txt. Objective Development guarantees -that the IDs listed below are not used by any USB compliant devices. - - -==================== -MECHANISM OF SHARING -==================== - -From a technical point of view, two different devices can share the same USB -Vendor- and Product-ID if they require the same driver on operating system -level. We make use of this fact by assigning separate IDs for various device -classes. On application layer, devices must be distinguished by their textual -name or serial number. We offer separate sets of IDs for discrimination by -textual name and for serial number. - -Examples for shared use of USB IDs are included with V-USB in the "examples" -subdirectory. - - -====================================== -IDs FOR DISCRIMINATION BY TEXTUAL NAME -====================================== - -If you use one of the IDs listed below, your device and host-side software -must conform to these rules: - -(1) The USB device MUST provide a textual representation of the manufacturer -and product identification. The manufacturer identification MUST be available -at least in USB language 0x0409 (English/US). - -(2) The textual manufacturer identification MUST contain either an Internet -domain name (e.g. "mycompany.com") registered and owned by you, or an e-mail -address under your control (e.g. "myname@gmx.net"). You can embed the domain -name or e-mail address in any string you like, e.g. "Objective Development -http://www.obdev.at/vusb/". - -(3) You are responsible for retaining ownership of the domain or e-mail -address for as long as any of your products are in use. - -(4) You may choose any string for the textual product identification, as long -as this string is unique within the scope of your textual manufacturer -identification. - -(5) Application side device look-up MUST be based on the textual manufacturer -and product identification in addition to VID/PID matching. The driver -matching MUST be a comparison of the entire strings, NOT a sub-string match. - -(6) For devices which implement a particular USB device class (e.g. HID), the -operating system's default class driver MUST be used. If an operating system -driver for Vendor Class devices is needed, this driver must be libusb or -libusb-win32 (see http://libusb.org/ and -http://libusb-win32.sourceforge.net/). - -Table if IDs for discrimination by textual name: - -PID dec (hex) | VID dec (hex) | Description of use -==============+===============+============================================ -1500 (0x05dc) | 5824 (0x16c0) | For Vendor Class devices with libusb ---------------+---------------+-------------------------------------------- -1503 (0x05df) | 5824 (0x16c0) | For generic HID class devices (which are - | | NOT mice, keyboards or joysticks) ---------------+---------------+-------------------------------------------- -1505 (0x05e1) | 5824 (0x16c0) | For CDC-ACM class devices (modems) ---------------+---------------+-------------------------------------------- -1508 (0x05e4) | 5824 (0x16c0) | For MIDI class devices ---------------+---------------+-------------------------------------------- - -Note that Windows caches the textual product- and vendor-description for -mice, keyboards and joysticks. Name-bsed discrimination is therefore not -recommended for these device classes. - - -======================================= -IDs FOR DISCRIMINATION BY SERIAL NUMBER -======================================= - -If you use one of the IDs listed below, your device and host-side software -must conform to these rules: - -(1) The USB device MUST provide a textual representation of the serial -number. The serial number string MUST be available at least in USB language -0x0409 (English/US). - -(2) The serial number MUST start with either an Internet domain name (e.g. -"mycompany.com") registered and owned by you, or an e-mail address under your -control (e.g. "myname@gmx.net"), both terminated with a colon (":") character. -You MAY append any string you like for further discrimination of your devices. - -(3) You are responsible for retaining ownership of the domain or e-mail -address for as long as any of your products are in use. - -(5) Application side device look-up MUST be based on the serial number string -in addition to VID/PID matching. The matching must start at the first -character of the serial number string and include the colon character -terminating your domain or e-mail address. It MAY stop anywhere after that. - -(6) For devices which implement a particular USB device class (e.g. HID), the -operating system's default class driver MUST be used. If an operating system -driver for Vendor Class devices is needed, this driver must be libusb or -libusb-win32 (see http://libusb.org/ and -http://libusb-win32.sourceforge.net/). - -Table if IDs for discrimination by serial number string: - -PID dec (hex) | VID dec (hex) | Description of use -===============+===============+=========================================== -10200 (0x27d8) | 5824 (0x16c0) | For Vendor Class devices with libusb ----------------+---------------+------------------------------------------- -10201 (0x27d9) | 5824 (0x16c0) | For generic HID class devices (which are - | | NOT mice, keyboards or joysticks) ----------------+---------------+------------------------------------------- -10202 (0x27da) | 5824 (0x16c0) | For USB Mice ----------------+---------------+------------------------------------------- -10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards ----------------+---------------+------------------------------------------- -10204 (0x27db) | 5824 (0x16c0) | For USB Joysticks ----------------+---------------+------------------------------------------- -10205 (0x27dc) | 5824 (0x16c0) | For CDC-ACM class devices (modems) ----------------+---------------+------------------------------------------- -10206 (0x27dd) | 5824 (0x16c0) | For MIDI class devices ----------------+---------------+------------------------------------------- - - -================= -ORIGIN OF USB-IDs -================= - -OBJECTIVE DEVELOPMENT Software GmbH has obtained all VID/PID pairs listed -here from Wouter van Ooijen (see www.voti.nl) for exclusive disposition. -Wouter van Ooijen has obtained the VID from the USB Implementers Forum, Inc. -(see www.usb.org). The VID is registered for the company name "Van Ooijen -Technische Informatica". - - -========== -DISCLAIMER -========== - -OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any -problems 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 07d692be3b9..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/asmcommon.inc +++ /dev/null @@ -1,188 +0,0 @@ -/* Name: asmcommon.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2007-11-05 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id$ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file contains assembler code which is shared among the USB driver -implementations for different CPU cocks. Since the code must be inserted -in the middle of the module, it's split out into this file and #included. - -Jump destinations called from outside: - sofError: Called when no start sequence was found. - se0: Called when a package has been successfully received. - overflow: Called when receive buffer overflows. - doReturn: Called after sending data. - -Outside jump destinations used by this module: - waitForJ: Called to receive an already arriving packet. - sendAckAndReti: - sendNakAndReti: - sendCntAndReti: - usbSendAndReti: - -The following macros must be defined before this file is included: - .macro POP_STANDARD - .endm - .macro POP_RETI - .endm -*/ - -#define token x1 - -overflow: - ldi x2, 1< 0 - -# warning "Never compile production devices with debugging enabled" - -static void uartPutc(char c) { - while (!(ODDBG_USR & (1 << ODDBG_UDRE))) - ; /* wait for data register empty */ - ODDBG_UDR = c; -} - -static uchar hexAscii(uchar h) { - h &= 0xf; - if (h >= 10) h += 'a' - (uchar)10 - '0'; - h += '0'; - return h; -} - -static void printHex(uchar c) { - uartPutc(hexAscii(c >> 4)); - uartPutc(hexAscii(c)); -} - -void odDebug(uchar prefix, uchar *data, uchar len) { - printHex(prefix); - uartPutc(':'); - while (len--) { - uartPutc(' '); - printHex(*data++); - } - uartPutc('\r'); - uartPutc('\n'); -} - -#endif diff --git a/tmk_core/protocol/vusb/usbdrv/oddebug.h b/tmk_core/protocol/vusb/usbdrv/oddebug.h deleted file mode 100644 index f93f3387945..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/oddebug.h +++ /dev/null @@ -1,121 +0,0 @@ -/* Name: oddebug.h - * Project: AVR library - * Author: Christian Starkjohann - * Creation Date: 2005-01-16 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: oddebug.h 692 2008-11-07 15:07:40Z cs $ - */ - -#ifndef __oddebug_h_included__ -#define __oddebug_h_included__ - -/* -General Description: -This module implements a function for debug logs on the serial line of the -AVR microcontroller. Debugging can be configured with the define -'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debugging -calls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is -2, DBG1 and DBG2 logs will be printed. - -A debug log consists of a label ('prefix') to indicate which debug log created -the output and a memory block to dump in hex ('data' and 'len'). -*/ - -#ifndef F_CPU -# define F_CPU 12000000 /* 12 MHz */ -#endif - -/* make sure we have the UART defines: */ -#include "usbportability.h" - -#ifndef uchar -# define uchar unsigned char -#endif - -#if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */ -# warning "Debugging disabled because device has no UART" -# undef DEBUG_LEVEL -#endif - -#ifndef DEBUG_LEVEL -# define DEBUG_LEVEL 0 -#endif - -/* ------------------------------------------------------------------------- */ - -#if DEBUG_LEVEL > 0 -# define DBG1(prefix, data, len) odDebug(prefix, data, len) -#else -# define DBG1(prefix, data, len) -#endif - -#if DEBUG_LEVEL > 1 -# define DBG2(prefix, data, len) odDebug(prefix, data, len) -#else -# define DBG2(prefix, data, len) -#endif - -/* ------------------------------------------------------------------------- */ - -#if DEBUG_LEVEL > 0 -extern void odDebug(uchar prefix, uchar *data, uchar len); - -/* Try to find our control registers; ATMEL likes to rename these */ - -# if defined UBRR -# define ODDBG_UBRR UBRR -# elif defined UBRRL -# define ODDBG_UBRR UBRRL -# elif defined UBRR0 -# define ODDBG_UBRR UBRR0 -# elif defined UBRR0L -# define ODDBG_UBRR UBRR0L -# endif - -# if defined UCR -# define ODDBG_UCR UCR -# elif defined UCSRB -# define ODDBG_UCR UCSRB -# elif defined UCSR0B -# define ODDBG_UCR UCSR0B -# endif - -# if defined TXEN -# define ODDBG_TXEN TXEN -# else -# define ODDBG_TXEN TXEN0 -# endif - -# if defined USR -# define ODDBG_USR USR -# elif defined UCSRA -# define ODDBG_USR UCSRA -# elif defined UCSR0A -# define ODDBG_USR UCSR0A -# endif - -# if defined UDRE -# define ODDBG_UDRE UDRE -# else -# define ODDBG_UDRE UDRE0 -# endif - -# if defined UDR -# define ODDBG_UDR UDR -# elif defined UDR0 -# define ODDBG_UDR UDR0 -# endif - -static inline void odDebugInit(void) { - ODDBG_UCR |= (1 << ODDBG_TXEN); - ODDBG_UBRR = F_CPU / (19200 * 16L) - 1; -} -#else -# define odDebugInit() -#endif - -/* ------------------------------------------------------------------------- */ - -#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 020ea51474e..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/usbconfig-prototype.h +++ /dev/null @@ -1,376 +0,0 @@ -/* Name: usbconfig.h - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2005-04-01 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $ - */ - -#ifndef __usbconfig_h_included__ -#define __usbconfig_h_included__ - -/* -General Description: -This file is an example configuration (with inline documentation) for the USB -driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is -also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may -wire the lines to any other port, as long as D+ is also wired to INT0 (or any -other hardware interrupt, as long as it is the highest level interrupt, see -section at the end of this file). -+ To create your own usbconfig.h file, copy this file to your project's -+ firmware source directory) and rename it to "usbconfig.h". -+ Then edit it accordingly. -*/ - -/* ---------------------------- Hardware Config ---------------------------- */ - -#define USB_CFG_IOPORTNAME D -/* This is the port where the USB bus is connected. When you configure it to - * "B", the registers PORTB, PINB and DDRB will be used. - */ -#define USB_CFG_DMINUS_BIT 4 -/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. - * This may be any bit in the port. - */ -#define USB_CFG_DPLUS_BIT 2 -/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. - * This may be any bit in the port. Please note that D+ must also be connected - * to interrupt pin INT0! [You can also use other interrupts, see section - * "Optional MCU Description" below, or you can connect D- to the interrupt, as - * it is required if you use the USB_COUNT_SOF feature. If you use D- for the - * interrupt, the USB interrupt will also be triggered at Start-Of-Frame - * markers every millisecond.] - */ -#define USB_CFG_CLOCK_KHZ (F_CPU / 1000) -/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000, - * 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code - * require no crystal, they tolerate +/- 1% deviation from the nominal - * frequency. All other rates require a precision of 2000 ppm and thus a - * crystal! - * Since F_CPU should be defined to your actual clock rate anyway, you should - * not need to modify this setting. - */ -#define USB_CFG_CHECK_CRC 0 -/* Define this to 1 if you want that the driver checks integrity of incoming - * data packets (CRC checks). CRC checks cost quite a bit of code size and are - * currently only available for 18 MHz crystal clock. You must choose - * USB_CFG_CLOCK_KHZ = 18000 if you enable this option. - */ - -/* ----------------------- Optional Hardware Config ------------------------ */ - -/* #define USB_CFG_PULLUP_IOPORTNAME D */ -/* If you connect the 1.5k pullup resistor from D- to a port pin instead of - * V+, you can connect and disconnect the device from firmware by calling - * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). - * This constant defines the port on which the pullup resistor is connected. - */ -/* #define USB_CFG_PULLUP_BIT 4 */ -/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined - * above) where the 1.5k pullup resistor is connected. See description - * above for details. - */ - -/* --------------------------- Functional Range ---------------------------- */ - -#define USB_CFG_HAVE_INTRIN_ENDPOINT 0 -/* Define this to 1 if you want to compile a version with two endpoints: The - * default control endpoint 0 and an interrupt-in endpoint (any other endpoint - * number). - */ -#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0 -/* Define this to 1 if you want to compile a version with three endpoints: The - * default control endpoint 0, an interrupt-in endpoint 3 (or the number - * configured below) and a catch-all default interrupt-in endpoint as above. - * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature. - */ -#define USB_CFG_EP3_NUMBER 3 -/* If the so-called endpoint 3 is used, it can now be configured to any other - * endpoint number (except 0) with this macro. Default if undefined is 3. - */ -/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */ -/* The above macro defines the startup condition for data toggling on the - * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1. - * Since the token is toggled BEFORE sending any data, the first packet is - * sent with the oposite value of this configuration! - */ -#define USB_CFG_IMPLEMENT_HALT 0 -/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature - * for endpoint 1 (interrupt endpoint). Although you may not need this feature, - * it is required by the standard. We have made it a config option because it - * bloats the code considerably. - */ -#define USB_CFG_SUPPRESS_INTR_CODE 0 -/* Define this to 1 if you want to declare interrupt-in endpoints, but don't - * want to send any data over them. If this macro is defined to 1, functions - * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if - * you need the interrupt-in endpoints in order to comply to an interface - * (e.g. HID), but never want to send any data. This option saves a couple - * of bytes in flash memory and the transmit buffers in RAM. - */ -#define USB_CFG_INTR_POLL_INTERVAL 10 -/* If you compile a version with endpoint 1 (interrupt-in), this is the poll - * interval. The value is in milliseconds and must not be less than 10 ms for - * low speed devices. - */ -#define USB_CFG_IS_SELF_POWERED 0 -/* Define this to 1 if the device has its own power supply. Set it to 0 if the - * device is powered from the USB bus. - */ -#define USB_CFG_MAX_BUS_POWER 100 -/* Set this variable to the maximum USB bus power consumption of your device. - * The value is in milliamperes. [It will be divided by two since USB - * communicates power requirements in units of 2 mA.] - */ -#define USB_CFG_IMPLEMENT_FN_WRITE 0 -/* Set this to 1 if you want usbFunctionWrite() to be called for control-out - * transfers. Set it to 0 if you don't need it and want to save a couple of - * bytes. - */ -#define USB_CFG_IMPLEMENT_FN_READ 0 -/* Set this to 1 if you need to send control replies which are generated - * "on the fly" when usbFunctionRead() is called. If you only want to send - * data from a static buffer, set it to 0 and return the data from - * usbFunctionSetup(). This saves a couple of bytes. - */ -#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 -/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. - * You must implement the function usbFunctionWriteOut() which receives all - * interrupt/bulk data sent to any endpoint other than 0. The endpoint number - * can be found in 'usbRxToken'. - */ -#define USB_CFG_HAVE_FLOWCONTROL 0 -/* Define this to 1 if you want flowcontrol over USB data. See the definition - * of the macros usbDisableAllRequests() and usbEnableAllRequests() in - * usbdrv.h. - */ -#define USB_CFG_DRIVER_FLASH_PAGE 0 -/* If the device has more than 64 kBytes of flash, define this to the 64 k page - * where the driver's constants (descriptors) are located. Or in other words: - * Define this to 1 for boot loaders on the ATMega128. - */ -#define USB_CFG_LONG_TRANSFERS 0 -/* Define this to 1 if you want to send/receive blocks of more than 254 bytes - * in a single control-in or control-out transfer. Note that the capability - * for long transfers increases the driver size. - */ -/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ -/* This macro is a hook if you want to do unconventional things. If it is - * defined, it's inserted at the beginning of received message processing. - * If you eat the received message and don't want default processing to - * proceed, do a return after doing your things. One possible application - * (besides debugging) is to flash a status LED on each packet. - */ -/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */ -/* This macro is a hook if you need to know when an USB RESET occurs. It has - * one parameter which distinguishes between the start of RESET state and its - * end. - */ -/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */ -/* This macro (if defined) is executed when a USB SET_ADDRESS request was - * received. - */ -#define USB_COUNT_SOF 0 -/* define this macro to 1 if you need the global variable "usbSofCount" which - * counts SOF packets. This feature requires that the hardware interrupt is - * connected to D- instead of D+. - */ -/* #ifdef __ASSEMBLER__ - * macro myAssemblerMacro - * in YL, TCNT0 - * sts timer0Snapshot, YL - * endm - * #endif - * #define USB_SOF_HOOK myAssemblerMacro - * This macro (if defined) is executed in the assembler module when a - * Start Of Frame condition is detected. It is recommended to define it to - * the name of an assembler macro which is defined here as well so that more - * than one assembler instruction can be used. The macro may use the register - * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages - * immediately after an SOF pulse may be lost and must be retried by the host. - * What can you do with this hook? Since the SOF signal occurs exactly every - * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in - * designs running on the internal RC oscillator. - * Please note that Start Of Frame detection works only if D- is wired to the - * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES! - */ -#define USB_CFG_CHECK_DATA_TOGGLING 0 -/* define this macro to 1 if you want to filter out duplicate data packets - * sent by the host. Duplicates occur only as a consequence of communication - * errors, when the host does not receive an ACK. Please note that you need to - * implement the filtering yourself in usbFunctionWriteOut() and - * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable - * for each control- and out-endpoint to check for duplicate packets. - */ -#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 -/* define this macro to 1 if you want the function usbMeasureFrameLength() - * compiled in. This function can be used to calibrate the AVR's RC oscillator. - */ -#define USB_USE_FAST_CRC 0 -/* The assembler module has two implementations for the CRC algorithm. One is - * faster, the other is smaller. This CRC routine is only used for transmitted - * messages where timing is not critical. The faster routine needs 31 cycles - * per byte while the smaller one needs 61 to 69 cycles. The faster routine - * may be worth the 32 bytes bigger code size if you transmit lots of data and - * run the AVR close to its limit. - */ - -/* -------------------------- Device Description --------------------------- */ - -#define USB_CFG_VENDOR_ID 0xc0, 0x16 /* = 0x16c0 = 5824 = voti.nl */ -/* USB vendor ID for the device, low byte first. If you have registered your - * own Vendor ID, define it here. Otherwise you may use one of obdev's free - * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules! - * *** IMPORTANT NOTE *** - * This template uses obdev's shared VID/PID pair for Vendor Class devices - * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand - * the implications! - */ -#define USB_CFG_DEVICE_ID 0xdc, 0x05 /* = 0x05dc = 1500 */ -/* This is the ID of the product, low byte first. It is interpreted in the - * scope of the vendor ID. If you have registered your own VID with usb.org - * or if you have licensed a PID from somebody else, define it here. Otherwise - * you may use one of obdev's free shared VID/PID pairs. See the file - * USB-IDs-for-free.txt for details! - * *** IMPORTANT NOTE *** - * This template uses obdev's shared VID/PID pair for Vendor Class devices - * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand - * the implications! - */ -#define USB_CFG_DEVICE_VERSION 0x00, 0x01 -/* Version number of the device: Minor number first, then major number. - */ -#define USB_CFG_VENDOR_NAME 'o', 'b', 'd', 'e', 'v', '.', 'a', 't' -#define USB_CFG_VENDOR_NAME_LEN 8 -/* These two values define the vendor name returned by the USB device. The name - * must be given as a list of characters under single quotes. The characters - * are interpreted as Unicode (UTF-16) entities. - * If you don't want a vendor name string, undefine these macros. - * ALWAYS define a vendor name containing your Internet domain name if you use - * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for - * details. - */ -#define USB_CFG_DEVICE_NAME 'T', 'e', 'm', 'p', 'l', 'a', 't', 'e' -#define USB_CFG_DEVICE_NAME_LEN 8 -/* Same as above for the device name. If you don't want a device name, undefine - * the macros. See the file USB-IDs-for-free.txt before you assign a name if - * you use a shared VID/PID. - */ -/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ -/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ -/* Same as above for the serial number. If you don't want a serial number, - * undefine the macros. - * It may be useful to provide the serial number through other means than at - * compile time. See the section about descriptor properties below for how - * to fine tune control over USB descriptors such as the string descriptor - * for the serial number. - */ -#define USB_CFG_DEVICE_CLASS 0xff /* set to 0 if deferred to interface */ -#define USB_CFG_DEVICE_SUBCLASS 0 -/* See USB specification if you want to conform to an existing device class. - * Class 0xff is "vendor specific". - */ -#define USB_CFG_INTERFACE_CLASS 0 /* define class here if not at device level */ -#define USB_CFG_INTERFACE_SUBCLASS 0 -#define USB_CFG_INTERFACE_PROTOCOL 0 -/* See USB specification if you want to conform to an existing device class or - * protocol. The following classes must be set at interface level: - * HID class is 3, no subclass and protocol required (but may be useful!) - * CDC class is 2, use subclass 2 and protocol 1 for ACM - */ -/* #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 42 */ -/* Define this to the length of the HID report descriptor, if you implement - * an HID device. Otherwise don't define it or define it to 0. - * If you use this define, you must add a PROGMEM character array named - * "usbHidReportDescriptor" to your code which contains the report descriptor. - * Don't forget to keep the array and this define in sync! - */ - -/* #define USB_PUBLIC static */ -/* Use the define above if you #include usbdrv.c instead of linking against it. - * This technique saves a couple of bytes in flash memory. - */ - -/* ------------------- Fine Control over USB Descriptors ------------------- */ -/* If you don't want to use the driver's default USB descriptors, you can - * provide our own. These can be provided as (1) fixed length static data in - * flash memory, (2) fixed length static data in RAM or (3) dynamically at - * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more - * information about this function. - * Descriptor handling is configured through the descriptor's properties. If - * no properties are defined or if they are 0, the default descriptor is used. - * Possible properties are: - * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched - * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is - * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if - * you want RAM pointers. - * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found - * in static memory is in RAM, not in flash memory. - * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), - * the driver must know the descriptor's length. The descriptor itself is - * found at the address of a well known identifier (see below). - * List of static descriptor names (must be declared PROGMEM if in flash): - * char usbDescriptorDevice[]; - * char usbDescriptorConfiguration[]; - * char usbDescriptorHidReport[]; - * char usbDescriptorString0[]; - * int usbDescriptorStringVendor[]; - * int usbDescriptorStringDevice[]; - * int usbDescriptorStringSerialNumber[]; - * Other descriptors can't be provided statically, they must be provided - * dynamically at runtime. - * - * Descriptor properties are or-ed or added together, e.g.: - * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) - * - * The following descriptors are defined: - * USB_CFG_DESCR_PROPS_DEVICE - * USB_CFG_DESCR_PROPS_CONFIGURATION - * USB_CFG_DESCR_PROPS_STRINGS - * USB_CFG_DESCR_PROPS_STRING_0 - * USB_CFG_DESCR_PROPS_STRING_VENDOR - * USB_CFG_DESCR_PROPS_STRING_PRODUCT - * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER - * USB_CFG_DESCR_PROPS_HID - * USB_CFG_DESCR_PROPS_HID_REPORT - * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) - * - * Note about string descriptors: String descriptors are not just strings, they - * are Unicode strings prefixed with a 2 byte header. Example: - * int serialNumberDescriptor[] = { - * USB_STRING_DESCRIPTOR_HEADER(6), - * 'S', 'e', 'r', 'i', 'a', 'l' - * }; - */ - -#define USB_CFG_DESCR_PROPS_DEVICE 0 -#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 -#define USB_CFG_DESCR_PROPS_STRINGS 0 -#define USB_CFG_DESCR_PROPS_STRING_0 0 -#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 -#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 -#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 -#define USB_CFG_DESCR_PROPS_HID 0 -#define USB_CFG_DESCR_PROPS_HID_REPORT 0 -#define USB_CFG_DESCR_PROPS_UNKNOWN 0 - -/* ----------------------- Optional MCU Description ------------------------ */ - -/* The following configurations have working defaults in usbdrv.h. You - * usually don't need to set them explicitly. Only if you want to run - * the driver on a device which is not yet supported or with a compiler - * which is not fully supported (such as IAR C) or if you use a differnt - * interrupt than INT0, you may have to define some of these. - */ -/* #define USB_INTR_CFG MCUCR */ -/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ -/* #define USB_INTR_CFG_CLR 0 */ -/* #define USB_INTR_ENABLE GIMSK */ -/* #define USB_INTR_ENABLE_BIT INT0 */ -/* #define USB_INTR_PENDING GIFR */ -/* #define USB_INTR_PENDING_BIT INTF0 */ -/* #define USB_INTR_VECTOR INT0_vect */ - -#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 f69198b1b98..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/usbdrv.c +++ /dev/null @@ -1,622 +0,0 @@ -/* Name: usbdrv.c - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2004-12-29 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrv.c 791 2010-07-15 15:56:13Z cs $ - */ - -#include "usbportability.h" -#include "usbdrv.h" -#include "oddebug.h" - -/* -General Description: -This module implements the C-part of the USB driver. See usbdrv.h for a -documentation of the entire driver. -*/ - -/* ------------------------------------------------------------------------- */ - -/* raw USB registers / interface to assembler code: */ -uchar usbRxBuf[2 * USB_BUFSIZE]; /* raw RX buffer: PID, 8 bytes data, 2 bytes CRC */ -uchar usbInputBufOffset; /* offset in usbRxBuf used for low level receiving */ -uchar usbDeviceAddr; /* assigned during enumeration, defaults to 0 */ -uchar usbNewDeviceAddr; /* device ID which should be set after status phase */ -uchar usbConfiguration; /* currently selected configuration. Administered by driver, but not used */ -volatile schar usbRxLen; /* = 0; number of bytes in usbRxBuf; 0 means free, -1 for flow control */ -uchar usbCurrentTok; /* last token received or endpoint number for last OUT token if != 0 */ -uchar usbRxToken; /* token for data we received; or endpont number for last OUT */ -volatile uchar usbTxLen = USBPID_NAK; /* number of bytes to transmit with next IN token or handshake token */ -uchar usbTxBuf[USB_BUFSIZE]; /* data to transmit with next IN, free if usbTxLen contains handshake token */ -#if USB_COUNT_SOF -volatile uchar usbSofCount; /* incremented by assembler module every SOF */ -#endif -#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE -usbTxStatus_t usbTxStatus1; -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 -usbTxStatus_t usbTxStatus3; -# endif -#endif -#if USB_CFG_CHECK_DATA_TOGGLING -uchar usbCurrentDataToken; /* when we check data toggling to ignore duplicate packets */ -#endif - -/* USB status registers / not shared with asm code */ -uchar * usbMsgPtr; /* data to transmit next -- ROM or RAM address */ -static usbMsgLen_t usbMsgLen = USB_NO_MSG; /* remaining number of bytes */ -static uchar usbMsgFlags; /* flag values see below */ - -#define USB_FLG_MSGPTR_IS_ROM (1 << 6) -#define USB_FLG_USE_USER_RW (1 << 7) - -/* -optimizing hints: -- do not post/pre inc/dec integer values in operations -- assign value of USB_READ_FLASH() to register variables and don't use side effects in arg -- use narrow scope for variables which should be in X/Y/Z register -- assign char sized expressions to variables to force 8 bit arithmetics -*/ - -/* -------------------------- String Descriptors --------------------------- */ - -#if USB_CFG_DESCR_PROPS_STRINGS == 0 - -# if USB_CFG_DESCR_PROPS_STRING_0 == 0 -# undef USB_CFG_DESCR_PROPS_STRING_0 -# define USB_CFG_DESCR_PROPS_STRING_0 sizeof(usbDescriptorString0) -const PROGMEM char usbDescriptorString0[] = { - /* language descriptor */ - 4, /* sizeof(usbDescriptorString0): length of descriptor in bytes */ - 3, /* descriptor type */ - 0x09, 0x04, /* language index (0x0409 = US-English) */ -}; -# endif - -# if USB_CFG_DESCR_PROPS_STRING_VENDOR == 0 && USB_CFG_VENDOR_NAME_LEN -# undef USB_CFG_DESCR_PROPS_STRING_VENDOR -# define USB_CFG_DESCR_PROPS_STRING_VENDOR sizeof(usbDescriptorStringVendor) -const PROGMEM int usbDescriptorStringVendor[] = {USB_STRING_DESCRIPTOR_HEADER(USB_CFG_VENDOR_NAME_LEN), USB_CFG_VENDOR_NAME}; -# endif - -# if USB_CFG_DESCR_PROPS_STRING_PRODUCT == 0 && USB_CFG_DEVICE_NAME_LEN -# undef USB_CFG_DESCR_PROPS_STRING_PRODUCT -# define USB_CFG_DESCR_PROPS_STRING_PRODUCT sizeof(usbDescriptorStringDevice) -const PROGMEM int usbDescriptorStringDevice[] = {USB_STRING_DESCRIPTOR_HEADER(USB_CFG_DEVICE_NAME_LEN), USB_CFG_DEVICE_NAME}; -# endif - -# if USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER == 0 && USB_CFG_SERIAL_NUMBER_LEN -# undef USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER -# define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER sizeof(usbDescriptorStringSerialNumber) -const PROGMEM int usbDescriptorStringSerialNumber[] = {USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN), USB_CFG_SERIAL_NUMBER}; -# endif - -#endif /* USB_CFG_DESCR_PROPS_STRINGS == 0 */ - -/* --------------------------- Device Descriptor --------------------------- */ - -#if USB_CFG_DESCR_PROPS_DEVICE == 0 -# undef USB_CFG_DESCR_PROPS_DEVICE -# define USB_CFG_DESCR_PROPS_DEVICE sizeof(usbDescriptorDevice) -const PROGMEM char usbDescriptorDevice[] = { - /* USB device descriptor */ - 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */ - USBDESCR_DEVICE, /* descriptor type */ - 0x10, 0x01, /* USB version supported */ - USB_CFG_DEVICE_CLASS, USB_CFG_DEVICE_SUBCLASS, 0, /* protocol */ - 8, /* max packet size */ - /* the following two casts affect the first byte of the constant only, but - * that's sufficient to avoid a warning with the default values. - */ - (char)USB_CFG_VENDOR_ID, /* 2 bytes */ - (char)USB_CFG_DEVICE_ID, /* 2 bytes */ - USB_CFG_DEVICE_VERSION, /* 2 bytes */ - USB_CFG_DESCR_PROPS_STRING_VENDOR != 0 ? 1 : 0, /* manufacturer string index */ - USB_CFG_DESCR_PROPS_STRING_PRODUCT != 0 ? 2 : 0, /* product string index */ - USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER != 0 ? 3 : 0, /* serial number string index */ - 1, /* number of configurations */ -}; -#endif - -/* ----------------------- Configuration Descriptor ------------------------ */ - -#if USB_CFG_DESCR_PROPS_HID_REPORT != 0 && USB_CFG_DESCR_PROPS_HID == 0 -# undef USB_CFG_DESCR_PROPS_HID -# define USB_CFG_DESCR_PROPS_HID 9 /* length of HID descriptor in config descriptor below */ -#endif - -#if USB_CFG_DESCR_PROPS_CONFIGURATION == 0 -# undef USB_CFG_DESCR_PROPS_CONFIGURATION -# define USB_CFG_DESCR_PROPS_CONFIGURATION sizeof(usbDescriptorConfiguration) -PROGMEM char usbDescriptorConfiguration[] = { - /* USB configuration descriptor */ - 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ - USBDESCR_CONFIG, /* descriptor type */ - 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT3 + (USB_CFG_DESCR_PROPS_HID & 0xff), 0, - /* total length of data returned (including inlined descriptors) */ - 1, /* number of interfaces in this configuration */ - 1, /* index of this configuration */ - 0, /* configuration name string index */ -# if USB_CFG_IS_SELF_POWERED - (1 << 7) | USBATTR_SELFPOWER, /* attributes */ -# else - (1 << 7), /* attributes */ -# endif - USB_CFG_MAX_BUS_POWER / 2, /* max USB current in 2mA units */ - /* interface descriptor follows inline: */ - 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */ - USBDESCR_INTERFACE, /* descriptor type */ - 0, /* index of this interface */ - 0, /* alternate setting for this interface */ - USB_CFG_HAVE_INTRIN_ENDPOINT + USB_CFG_HAVE_INTRIN_ENDPOINT3, /* endpoints excl 0: number of endpoint descriptors to follow */ - USB_CFG_INTERFACE_CLASS, USB_CFG_INTERFACE_SUBCLASS, USB_CFG_INTERFACE_PROTOCOL, 0, /* string index for interface */ -# if (USB_CFG_DESCR_PROPS_HID & 0xff) /* HID descriptor */ - 9, /* sizeof(usbDescrHID): length of descriptor in bytes */ - USBDESCR_HID, /* descriptor type: HID */ - 0x01, 0x01, /* BCD representation of HID version */ - 0x00, /* target country code */ - 0x01, /* number of HID Report (or other HID class) Descriptor infos to follow */ - 0x22, /* descriptor type: report */ - USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0, /* total length of report descriptor */ -# endif -# if USB_CFG_HAVE_INTRIN_ENDPOINT /* endpoint descriptor for endpoint 1 */ - 7, /* sizeof(usbDescrEndpoint) */ - USBDESCR_ENDPOINT, /* descriptor type = endpoint */ - (char)0x81, /* IN endpoint number 1 */ - 0x03, /* attrib: Interrupt endpoint */ - 8, 0, /* maximum packet size */ - USB_CFG_INTR_POLL_INTERVAL, /* in ms */ -# endif -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 /* endpoint descriptor for endpoint 3 */ - 7, /* sizeof(usbDescrEndpoint) */ - USBDESCR_ENDPOINT, /* descriptor type = endpoint */ - (char)(0x80 | USB_CFG_EP3_NUMBER), /* IN endpoint number 3 */ - 0x03, /* attrib: Interrupt endpoint */ - 8, 0, /* maximum packet size */ - USB_CFG_INTR_POLL_INTERVAL, /* in ms */ -# endif -}; -#endif - -/* ------------------------------------------------------------------------- */ - -static inline void usbResetDataToggling(void) { -#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE - USB_SET_DATATOKEN1(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */ -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 - USB_SET_DATATOKEN3(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */ -# endif -#endif -} - -static inline void usbResetStall(void) { -#if USB_CFG_IMPLEMENT_HALT && USB_CFG_HAVE_INTRIN_ENDPOINT - usbTxLen1 = USBPID_NAK; -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 - usbTxLen3 = USBPID_NAK; -# endif -#endif -} - -/* ------------------------------------------------------------------------- */ - -#if !USB_CFG_SUPPRESS_INTR_CODE -# if USB_CFG_HAVE_INTRIN_ENDPOINT -static void usbGenericSetInterrupt(uchar *data, uchar len, usbTxStatus_t *txStatus) { - uchar *p; - char i; - -# if USB_CFG_IMPLEMENT_HALT - if (usbTxLen1 == USBPID_STALL) return; -# endif - if (txStatus->len & 0x10) { /* packet buffer was empty */ - txStatus->buffer[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* toggle token */ - } else { - txStatus->len = USBPID_NAK; /* avoid sending outdated (overwritten) interrupt data */ - } - p = txStatus->buffer + 1; - i = len; - do { /* if len == 0, we still copy 1 byte, but that's no problem */ - *p++ = *data++; - } while (--i > 0); /* loop control at the end is 2 bytes shorter than at beginning */ - usbCrc16Append(&txStatus->buffer[1], len); - txStatus->len = len + 4; /* len must be given including sync byte */ - DBG2(0x21 + (((int)txStatus >> 3) & 3), txStatus->buffer, len + 3); -} - -USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len) { usbGenericSetInterrupt(data, len, &usbTxStatus1); } -# endif - -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 -USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len) { usbGenericSetInterrupt(data, len, &usbTxStatus3); } -# endif -#endif /* USB_CFG_SUPPRESS_INTR_CODE */ - -/* ------------------ utilities for code following below ------------------- */ - -/* Use defines for the switch statement so that we can choose between an - * if()else if() and a switch/case based implementation. switch() is more - * efficient for a LARGE set of sequential choices, if() is better in all other - * cases. - */ -#if USB_CFG_USE_SWITCH_STATEMENT -# define SWITCH_START(cmd) \ - switch (cmd) { \ - { -# define SWITCH_CASE(value) \ - } \ - break; \ - case (value): { -# define SWITCH_CASE2(v1, v2) \ - } \ - break; \ - case (v1): \ - case (v2): { -# define SWITCH_CASE3(v1, v2, v3) \ - } \ - break; \ - case (v1): \ - case (v2): \ - case (v3): { -# define SWITCH_DEFAULT \ - } \ - break; \ - default: { -# define SWITCH_END \ - } \ - } -#else -# define SWITCH_START(cmd) \ - { \ - uchar _cmd = cmd; \ - if (0) { -# define SWITCH_CASE(value) \ - } \ - else if (_cmd == (value)) { -# define SWITCH_CASE2(v1, v2) \ - } \ - else if (_cmd == (v1) || _cmd == (v2)) { -# define SWITCH_CASE3(v1, v2, v3) \ - } \ - else if (_cmd == (v1) || _cmd == (v2) || (_cmd == v3)) { -# define SWITCH_DEFAULT \ - } \ - else { -# define SWITCH_END \ - } \ - } -#endif - -#ifndef USB_RX_USER_HOOK -# define USB_RX_USER_HOOK(data, len) -#endif -#ifndef USB_SET_ADDRESS_HOOK -# define USB_SET_ADDRESS_HOOK() -#endif - -/* ------------------------------------------------------------------------- */ - -/* We use if() instead of #if in the macro below because #if can't be used - * in macros and the compiler optimizes constant conditions anyway. - * This may cause problems with undefined symbols if compiled without - * optimizing! - */ -#define GET_DESCRIPTOR(cfgProp, staticName) \ - if (cfgProp) { \ - if ((cfgProp)&USB_PROP_IS_RAM) flags = 0; \ - if ((cfgProp)&USB_PROP_IS_DYNAMIC) { \ - len = usbFunctionDescriptor(rq); \ - } else { \ - len = USB_PROP_LENGTH(cfgProp); \ - usbMsgPtr = (uchar *)(staticName); \ - } \ - } - -/* usbDriverDescriptor() is similar to usbFunctionDescriptor(), but used - * internally for all types of descriptors. - */ -static inline usbMsgLen_t usbDriverDescriptor(usbRequest_t *rq) { - usbMsgLen_t len = 0; - uchar flags = USB_FLG_MSGPTR_IS_ROM; - - SWITCH_START(rq->wValue.bytes[1]) - SWITCH_CASE(USBDESCR_DEVICE) /* 1 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_DEVICE, usbDescriptorDevice) - SWITCH_CASE(USBDESCR_CONFIG) /* 2 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_CONFIGURATION, usbDescriptorConfiguration) - SWITCH_CASE(USBDESCR_STRING) /* 3 */ -#if USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC - if (USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_RAM) flags = 0; - len = usbFunctionDescriptor(rq); -#else /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ - SWITCH_START(rq->wValue.bytes[0]) - SWITCH_CASE(0) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_0, usbDescriptorString0) - SWITCH_CASE(1) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_VENDOR, usbDescriptorStringVendor) - SWITCH_CASE(2) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_PRODUCT, usbDescriptorStringDevice) - SWITCH_CASE(3) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER, usbDescriptorStringSerialNumber) - SWITCH_DEFAULT - if (USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC) { - len = usbFunctionDescriptor(rq); - } - SWITCH_END -#endif /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ -#if USB_CFG_DESCR_PROPS_HID_REPORT /* only support HID descriptors if enabled */ - SWITCH_CASE(USBDESCR_HID) /* 0x21 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID, usbDescriptorConfiguration + 18) - SWITCH_CASE(USBDESCR_HID_REPORT) /* 0x22 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID_REPORT, usbDescriptorHidReport) -#endif - SWITCH_DEFAULT - if (USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC) { - len = usbFunctionDescriptor(rq); - } - SWITCH_END - usbMsgFlags = flags; - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbDriverSetup() is similar to usbFunctionSetup(), but it's used for - * standard requests instead of class and custom requests. - */ -static inline usbMsgLen_t usbDriverSetup(usbRequest_t *rq) { - uchar len = 0, *dataPtr = usbTxBuf + 9; /* there are 2 bytes free space at the end of the buffer */ - uchar value = rq->wValue.bytes[0]; -#if USB_CFG_IMPLEMENT_HALT - uchar index = rq->wIndex.bytes[0]; -#endif - - dataPtr[0] = 0; /* default reply common to USBRQ_GET_STATUS and USBRQ_GET_INTERFACE */ - SWITCH_START(rq->bRequest) - SWITCH_CASE(USBRQ_GET_STATUS) /* 0 */ - uchar recipient = rq->bmRequestType & USBRQ_RCPT_MASK; /* assign arith ops to variables to enforce byte size */ - if (USB_CFG_IS_SELF_POWERED && recipient == USBRQ_RCPT_DEVICE) dataPtr[0] = USB_CFG_IS_SELF_POWERED; -#if USB_CFG_IMPLEMENT_HALT - if (recipient == USBRQ_RCPT_ENDPOINT && index == 0x81) /* request status for endpoint 1 */ - dataPtr[0] = usbTxLen1 == USBPID_STALL; -#endif - dataPtr[1] = 0; - len = 2; -#if USB_CFG_IMPLEMENT_HALT - SWITCH_CASE2(USBRQ_CLEAR_FEATURE, USBRQ_SET_FEATURE) /* 1, 3 */ - if (value == 0 && index == 0x81) { /* feature 0 == HALT for endpoint == 1 */ - usbTxLen1 = rq->bRequest == USBRQ_CLEAR_FEATURE ? USBPID_NAK : USBPID_STALL; - usbResetDataToggling(); - } -#endif - SWITCH_CASE(USBRQ_SET_ADDRESS) /* 5 */ - usbNewDeviceAddr = value; - USB_SET_ADDRESS_HOOK(); - SWITCH_CASE(USBRQ_GET_DESCRIPTOR) /* 6 */ - len = usbDriverDescriptor(rq); - goto skipMsgPtrAssignment; - SWITCH_CASE(USBRQ_GET_CONFIGURATION) /* 8 */ - dataPtr = &usbConfiguration; /* send current configuration value */ - len = 1; - SWITCH_CASE(USBRQ_SET_CONFIGURATION) /* 9 */ - usbConfiguration = value; - usbResetStall(); - SWITCH_CASE(USBRQ_GET_INTERFACE) /* 10 */ - len = 1; -#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE - SWITCH_CASE(USBRQ_SET_INTERFACE) /* 11 */ - usbResetDataToggling(); - usbResetStall(); -#endif - SWITCH_DEFAULT /* 7=SET_DESCRIPTOR, 12=SYNC_FRAME */ - /* Should we add an optional hook here? */ - SWITCH_END usbMsgPtr = dataPtr; -skipMsgPtrAssignment: - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbProcessRx() is called for every message received by the interrupt - * routine. It distinguishes between SETUP and DATA packets and processes - * them accordingly. - */ -static inline void usbProcessRx(uchar *data, uchar len) { - usbRequest_t *rq = (void *)data; - - /* usbRxToken can be: - * 0x2d 00101101 (USBPID_SETUP for setup data) - * 0xe1 11100001 (USBPID_OUT: data phase of setup transfer) - * 0...0x0f for OUT on endpoint X - */ - DBG2(0x10 + (usbRxToken & 0xf), data, len + 2); /* SETUP=1d, SETUP-DATA=11, OUTx=1x */ - USB_RX_USER_HOOK(data, len) -#if USB_CFG_IMPLEMENT_FN_WRITEOUT - if (usbRxToken < 0x10) { /* OUT to endpoint != 0: endpoint number in usbRxToken */ - usbFunctionWriteOut(data, len); - return; - } -#endif - if (usbRxToken == (uchar)USBPID_SETUP) { - if (len != 8) /* Setup size must be always 8 bytes. Ignore otherwise. */ - return; - usbMsgLen_t replyLen; - usbTxBuf[0] = USBPID_DATA0; /* initialize data toggling */ - usbTxLen = USBPID_NAK; /* abort pending transmit */ - usbMsgFlags = 0; - uchar type = rq->bmRequestType & USBRQ_TYPE_MASK; - if (type != USBRQ_TYPE_STANDARD) { /* standard requests are handled by driver */ - replyLen = usbFunctionSetup(data); - } else { - replyLen = usbDriverSetup(rq); - } -#if USB_CFG_IMPLEMENT_FN_READ || USB_CFG_IMPLEMENT_FN_WRITE - if (replyLen == USB_NO_MSG) { /* use user-supplied read/write function */ - /* do some conditioning on replyLen, but on IN transfers only */ - if ((rq->bmRequestType & USBRQ_DIR_MASK) != USBRQ_DIR_HOST_TO_DEVICE) { - if (sizeof(replyLen) < sizeof(rq->wLength.word)) { /* help compiler with optimizing */ - replyLen = rq->wLength.bytes[0]; - } else { - replyLen = rq->wLength.word; - } - } - usbMsgFlags = USB_FLG_USE_USER_RW; - } else /* The 'else' prevents that we limit a replyLen of USB_NO_MSG to the maximum transfer len. */ -#endif - if (sizeof(replyLen) < sizeof(rq->wLength.word)) { /* help compiler with optimizing */ - if (!rq->wLength.bytes[1] && replyLen > rq->wLength.bytes[0]) /* limit length to max */ - replyLen = rq->wLength.bytes[0]; - } else { - if (replyLen > rq->wLength.word) /* limit length to max */ - replyLen = rq->wLength.word; - } - usbMsgLen = replyLen; - } else { /* usbRxToken must be USBPID_OUT, which means data phase of setup (control-out) */ -#if USB_CFG_IMPLEMENT_FN_WRITE - if (usbMsgFlags & USB_FLG_USE_USER_RW) { - uchar rval = usbFunctionWrite(data, len); - if (rval == 0xff) { /* an error occurred */ - usbTxLen = USBPID_STALL; - } else if (rval != 0) { /* This was the final package */ - usbMsgLen = 0; /* answer with a zero-sized data packet */ - } - } -#endif - } -} - -/* ------------------------------------------------------------------------- */ - -/* This function is similar to usbFunctionRead(), but it's also called for - * data handled automatically by the driver (e.g. descriptor reads). - */ -static uchar usbDeviceRead(uchar *data, uchar len) { - if (len > 0) { /* don't bother app with 0 sized reads */ -#if USB_CFG_IMPLEMENT_FN_READ - if (usbMsgFlags & USB_FLG_USE_USER_RW) { - len = usbFunctionRead(data, len); - } else -#endif - { - uchar i = len, *r = usbMsgPtr; - if (usbMsgFlags & USB_FLG_MSGPTR_IS_ROM) { /* ROM data */ - do { - uchar c = USB_READ_FLASH(r); /* assign to char size variable to enforce byte ops */ - *data++ = c; - r++; - } while (--i); - } else { /* RAM data */ - do { - *data++ = *r++; - } while (--i); - } - usbMsgPtr = r; - } - } - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbBuildTxBlock() is called when we have data to transmit and the - * interrupt routine's transmit buffer is empty. - */ -static inline void usbBuildTxBlock(void) { - usbMsgLen_t wantLen; - uchar len; - - wantLen = usbMsgLen; - if (wantLen > 8) wantLen = 8; - usbMsgLen -= wantLen; - usbTxBuf[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* DATA toggling */ - len = usbDeviceRead(usbTxBuf + 1, wantLen); - if (len <= 8) { /* valid data packet */ - usbCrc16Append(&usbTxBuf[1], len); - len += 4; /* length including sync byte */ - if (len < 12) /* a partial package identifies end of message */ - usbMsgLen = USB_NO_MSG; - } else { - len = USBPID_STALL; /* stall the endpoint */ - usbMsgLen = USB_NO_MSG; - } - usbTxLen = len; - DBG2(0x20, usbTxBuf, len - 1); -} - -/* ------------------------------------------------------------------------- */ - -static inline void usbHandleResetHook(uchar notResetState) { -#ifdef USB_RESET_HOOK - static uchar wasReset; - uchar isReset = !notResetState; - - if (wasReset != isReset) { - USB_RESET_HOOK(isReset); - wasReset = isReset; - } -#endif -} - -/* ------------------------------------------------------------------------- */ - -USB_PUBLIC void usbPoll(void) { - schar len; - uchar i; - - len = usbRxLen - 3; - if (len >= 0) { - /* We could check CRC16 here -- but ACK has already been sent anyway. If you - * need data integrity checks with this driver, check the CRC in your app - * code and report errors back to the host. Since the ACK was already sent, - * retries must be handled on application level. - * unsigned crc = usbCrc16(buffer + 1, usbRxLen - 3); - */ - usbProcessRx(usbRxBuf + USB_BUFSIZE + 1 - usbInputBufOffset, len); -#if USB_CFG_HAVE_FLOWCONTROL - if (usbRxLen > 0) /* only mark as available if not inactivated */ - usbRxLen = 0; -#else - usbRxLen = 0; /* mark rx buffer as available */ -#endif - } - if (usbTxLen & 0x10) { /* transmit system idle */ - if (usbMsgLen != USB_NO_MSG) { /* transmit data pending? */ - usbBuildTxBlock(); - } - } - for (i = 20; i > 0; i--) { - uchar usbLineStatus = USBIN & USBMASK; - if (usbLineStatus != 0) /* SE0 has ended */ - goto isNotReset; - } - /* RESET condition, called multiple times during reset */ - usbNewDeviceAddr = 0; - usbDeviceAddr = 0; - usbResetStall(); - DBG1(0xff, 0, 0); -isNotReset: - usbHandleResetHook(i); -} - -/* ------------------------------------------------------------------------- */ - -USB_PUBLIC void usbInit(void) { -#if USB_INTR_CFG_SET != 0 - USB_INTR_CFG |= USB_INTR_CFG_SET; -#endif -#if USB_INTR_CFG_CLR != 0 - USB_INTR_CFG &= ~(USB_INTR_CFG_CLR); -#endif - USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT); - usbResetDataToggling(); -#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE - usbTxLen1 = USBPID_NAK; -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 - usbTxLen3 = USBPID_NAK; -# endif -#endif -} - -/* ------------------------------------------------------------------------- */ diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrv.h b/tmk_core/protocol/vusb/usbdrv/usbdrv.h deleted file mode 100644 index 88a1bce76ee..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/usbdrv.h +++ /dev/null @@ -1,730 +0,0 @@ -/* Name: usbdrv.h - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2004-12-29 - * Tabsize: 4 - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrv.h 793 2010-07-15 15:58:11Z cs $ - */ - -#ifndef __usbdrv_h_included__ -#define __usbdrv_h_included__ -#include "usbconfig.h" -#include "usbportability.h" - -/* -Hardware Prerequisites: -======================= -USB lines D+ and D- MUST be wired to the same I/O port. We recommend that D+ -triggers the interrupt (best achieved by using INT0 for D+), but it is also -possible to trigger the interrupt from D-. If D- is used, interrupts are also -triggered by SOF packets. D- requires a pull-up of 1.5k to +3.5V (and the -device must be powered at 3.5V) to identify as low-speed USB device. A -pull-down or pull-up of 1M SHOULD be connected from D+ to +3.5V to prevent -interference when no USB master is connected. If you use Zener diodes to limit -the voltage on D+ and D-, you MUST use a pull-down resistor, not a pull-up. -We use D+ as interrupt source and not D- because it does not trigger on -keep-alive and RESET states. If you want to count keep-alive events with -USB_COUNT_SOF, you MUST use D- as an interrupt source. - -As a compile time option, the 1.5k pull-up resistor on D- can be made -switchable to allow the device to disconnect at will. See the definition of -usbDeviceConnect() and usbDeviceDisconnect() further down in this file. - -Please adapt the values in usbconfig.h according to your hardware! - -The device MUST be clocked at exactly 12 MHz, 15 MHz, 16 MHz or 20 MHz -or at 12.8 MHz resp. 16.5 MHz +/- 1%. See usbconfig-prototype.h for details. - - -Limitations: -============ -Robustness with respect to communication errors: -The driver assumes error-free communication. It DOES check for errors in -the PID, but does NOT check bit stuffing errors, SE0 in middle of a byte, -token CRC (5 bit) and data CRC (16 bit). CRC checks can not be performed due -to timing constraints: We must start sending a reply within 7 bit times. -Bit stuffing and misplaced SE0 would have to be checked in real-time, but CPU -performance does not permit that. The driver does not check Data0/Data1 -toggling, but application software can implement the check. - -Input characteristics: -Since no differential receiver circuit is used, electrical interference -robustness may suffer. The driver samples only one of the data lines with -an ordinary I/O pin's input characteristics. However, since this is only a -low speed USB implementation and the specification allows for 8 times the -bit rate over the same hardware, we should be on the safe side. Even the spec -requires detection of asymmetric states at high bit rate for SE0 detection. - -Number of endpoints: -The driver supports the following endpoints: - -- Endpoint 0, the default control endpoint. -- Any number of interrupt- or bulk-out endpoints. The data is sent to - usbFunctionWriteOut() and USB_CFG_IMPLEMENT_FN_WRITEOUT must be defined - to 1 to activate this feature. The endpoint number can be found in the - global variable 'usbRxToken'. -- One default interrupt- or bulk-in endpoint. This endpoint is used for - interrupt- or bulk-in transfers which are not handled by any other endpoint. - You must define USB_CFG_HAVE_INTRIN_ENDPOINT in order to activate this - feature and call usbSetInterrupt() to send interrupt/bulk data. -- One additional interrupt- or bulk-in endpoint. This was endpoint 3 in - previous versions of this driver but can now be configured to any endpoint - number. You must define USB_CFG_HAVE_INTRIN_ENDPOINT3 in order to activate - this feature and call usbSetInterrupt3() to send interrupt/bulk data. The - endpoint number can be set with USB_CFG_EP3_NUMBER. - -Please note that the USB standard forbids bulk endpoints for low speed devices! -Most operating systems allow them anyway, but the AVR will spend 90% of the CPU -time in the USB interrupt polling for bulk data. - -Maximum data payload: -Data payload of control in and out transfers may be up to 254 bytes. In order -to accept payload data of out transfers, you need to implement -'usbFunctionWrite()'. - -USB Suspend Mode supply current: -The USB standard limits power consumption to 500uA when the bus is in suspend -mode. This is not a problem for self-powered devices since they don't need -bus power anyway. Bus-powered devices can achieve this only by putting the -CPU in sleep mode. The driver does not implement suspend handling by itself. -However, the application may implement activity monitoring and wakeup from -sleep. The host sends regular SE0 states on the bus to keep it active. These -SE0 states can be detected by using D- as the interrupt source. Define -USB_COUNT_SOF to 1 and use the global variable usbSofCount to check for bus -activity. - -Operation without an USB master: -The driver behaves neutral without connection to an USB master if D- reads -as 1. To avoid spurious interrupts, we recommend a high impedance (e.g. 1M) -pull-down or pull-up resistor on D+ (interrupt). If Zener diodes are used, -use a pull-down. If D- becomes statically 0, the driver may block in the -interrupt routine. - -Interrupt latency: -The application must ensure that the USB interrupt is not disabled for more -than 25 cycles (this is for 12 MHz, faster clocks allow longer latency). -This implies that all interrupt routines must either have the "ISR_NOBLOCK" -attribute set (see "avr/interrupt.h") or be written in assembler with "sei" -as the first instruction. - -Maximum interrupt duration / CPU cycle consumption: -The driver handles all USB communication during the interrupt service -routine. The routine will not return before an entire USB message is received -and the reply is sent. This may be up to ca. 1200 cycles @ 12 MHz (= 100us) if -the host conforms to the standard. The driver will consume CPU cycles for all -USB messages, even if they address another (low-speed) device on the same bus. - -*/ - -/* ------------------------------------------------------------------------- */ -/* --------------------------- Module Interface ---------------------------- */ -/* ------------------------------------------------------------------------- */ - -#define USBDRV_VERSION 20100715 -/* This define uniquely identifies a driver version. It is a decimal number - * constructed from the driver's release date in the form YYYYMMDD. If the - * driver's behavior or interface changes, you can use this constant to - * distinguish versions. If it is not defined, the driver's release date is - * older than 2006-01-25. - */ - -#ifndef USB_PUBLIC -# define USB_PUBLIC -#endif -/* USB_PUBLIC is used as declaration attribute for all functions exported by - * the USB driver. The default is no attribute (see above). You may define it - * to static either in usbconfig.h or from the command line if you include - * usbdrv.c instead of linking against it. Including the C module of the driver - * directly in your code saves a couple of bytes in flash memory. - */ - -#ifndef __ASSEMBLER__ -# ifndef uchar -# define uchar unsigned char -# endif -# ifndef schar -# define schar signed char -# endif -/* shortcuts for well defined 8 bit integer types */ - -# if USB_CFG_LONG_TRANSFERS /* if more than 254 bytes transfer size required */ -# define usbMsgLen_t unsigned -# else -# define usbMsgLen_t uchar -# endif -/* usbMsgLen_t is the data type used for transfer lengths. By default, it is - * defined to uchar, allowing a maximum of 254 bytes (255 is reserved for - * USB_NO_MSG below). If the usbconfig.h defines USB_CFG_LONG_TRANSFERS to 1, - * a 16 bit data type is used, allowing up to 16384 bytes (the rest is used - * for flags in the descriptor configuration). - */ -# define USB_NO_MSG ((usbMsgLen_t)-1) /* constant meaning "no message" */ - -struct usbRequest; /* forward declaration */ - -USB_PUBLIC void usbInit(void); -/* This function must be called before interrupts are enabled and the main - * loop is entered. We exepct that the PORT and DDR bits for D+ and D- have - * not been changed from their default status (which is 0). If you have changed - * them, set both back to 0 (configure them as input with no internal pull-up). - */ -USB_PUBLIC void usbPoll(void); -/* This function must be called at regular intervals from the main loop. - * Maximum delay between calls is somewhat less than 50ms (USB timeout for - * accepting a Setup message). Otherwise the device will not be recognized. - * Please note that debug outputs through the UART take ~ 0.5ms per byte - * at 19200 bps. - */ -extern uchar *usbMsgPtr; -/* This variable may be used to pass transmit data to the driver from the - * implementation of usbFunctionWrite(). It is also used internally by the - * driver for standard control requests. - */ -USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]); -/* This function is called when the driver receives a SETUP transaction from - * the host which is not answered by the driver itself (in practice: class and - * vendor requests). All control transfers start with a SETUP transaction where - * the host communicates the parameters of the following (optional) data - * transfer. The SETUP data is available in the 'data' parameter which can - * (and should) be casted to 'usbRequest_t *' for a more user-friendly access - * to parameters. - * - * If the SETUP indicates a control-in transfer, you should provide the - * requested data to the driver. There are two ways to transfer this data: - * (1) Set the global pointer 'usbMsgPtr' to the base of the static RAM data - * block and return the length of the data in 'usbFunctionSetup()'. The driver - * will handle the rest. Or (2) return USB_NO_MSG in 'usbFunctionSetup()'. The - * driver will then call 'usbFunctionRead()' when data is needed. See the - * documentation for usbFunctionRead() for details. - * - * If the SETUP indicates a control-out transfer, the only way to receive the - * data from the host is through the 'usbFunctionWrite()' call. If you - * implement this function, you must return USB_NO_MSG in 'usbFunctionSetup()' - * to indicate that 'usbFunctionWrite()' should be used. See the documentation - * of this function for more information. If you just want to ignore the data - * sent by the host, return 0 in 'usbFunctionSetup()'. - * - * Note that calls to the functions usbFunctionRead() and usbFunctionWrite() - * are only done if enabled by the configuration in usbconfig.h. - */ -USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq); -/* You need to implement this function ONLY if you provide USB descriptors at - * runtime (which is an expert feature). It is very similar to - * usbFunctionSetup() above, but it is called only to request USB descriptor - * data. See the documentation of usbFunctionSetup() above for more info. - */ -# if USB_CFG_HAVE_INTRIN_ENDPOINT -USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len); -/* This function sets the message which will be sent during the next interrupt - * IN transfer. The message is copied to an internal buffer and must not exceed - * a length of 8 bytes. The message may be 0 bytes long just to indicate the - * interrupt status to the host. - * If you need to transfer more bytes, use a control read after the interrupt. - */ -# define usbInterruptIsReady() (usbTxLen1 & 0x10) -/* This macro indicates whether the last interrupt message has already been - * sent. If you set a new interrupt message before the old was sent, the - * message already buffered will be lost. - */ -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 -USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len); -# define usbInterruptIsReady3() (usbTxLen3 & 0x10) -/* Same as above for endpoint 3 */ -# endif -# endif /* USB_CFG_HAVE_INTRIN_ENDPOINT */ -# if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* simplified interface for backward compatibility */ -# define usbHidReportDescriptor usbDescriptorHidReport -/* should be declared as: PROGMEM char usbHidReportDescriptor[]; */ -/* If you implement an HID device, you need to provide a report descriptor. - * The HID report descriptor syntax is a bit complex. If you understand how - * report descriptors are constructed, we recommend that you use the HID - * Descriptor Tool from usb.org, see http://www.usb.org/developers/hidpage/. - * Otherwise you should probably start with a working example. - */ -# endif /* USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH */ -# if USB_CFG_IMPLEMENT_FN_WRITE -USB_PUBLIC uchar usbFunctionWrite(uchar *data, uchar len); -/* This function is called by the driver to provide a control transfer's - * payload data (control-out). It is called in chunks of up to 8 bytes. The - * total count provided in the current control transfer can be obtained from - * the 'length' property in the setup data. If an error occurred during - * processing, return 0xff (== -1). The driver will answer the entire transfer - * with a STALL token in this case. If you have received the entire payload - * successfully, return 1. If you expect more data, return 0. If you don't - * know whether the host will send more data (you should know, the total is - * provided in the usbFunctionSetup() call!), return 1. - * NOTE: If you return 0xff for STALL, 'usbFunctionWrite()' may still be called - * for the remaining data. You must continue to return 0xff for STALL in these - * calls. - * In order to get usbFunctionWrite() called, define USB_CFG_IMPLEMENT_FN_WRITE - * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. - */ -# endif /* USB_CFG_IMPLEMENT_FN_WRITE */ -# if USB_CFG_IMPLEMENT_FN_READ -USB_PUBLIC uchar usbFunctionRead(uchar *data, uchar len); -/* This function is called by the driver to ask the application for a control - * transfer's payload data (control-in). It is called in chunks of up to 8 - * bytes each. You should copy the data to the location given by 'data' and - * return the actual number of bytes copied. If you return less than requested, - * the control-in transfer is terminated. If you return 0xff, the driver aborts - * the transfer with a STALL token. - * In order to get usbFunctionRead() called, define USB_CFG_IMPLEMENT_FN_READ - * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. - */ -# endif /* USB_CFG_IMPLEMENT_FN_READ */ - -extern uchar usbRxToken; /* may be used in usbFunctionWriteOut() below */ -# if USB_CFG_IMPLEMENT_FN_WRITEOUT -USB_PUBLIC void usbFunctionWriteOut(uchar *data, uchar len); -/* This function is called by the driver when data is received on an interrupt- - * or bulk-out endpoint. The endpoint number can be found in the global - * variable usbRxToken. You must define USB_CFG_IMPLEMENT_FN_WRITEOUT to 1 in - * usbconfig.h to get this function called. - */ -# endif /* USB_CFG_IMPLEMENT_FN_WRITEOUT */ -# ifdef USB_CFG_PULLUP_IOPORTNAME -# define usbDeviceConnect() ((USB_PULLUP_DDR |= (1 << USB_CFG_PULLUP_BIT)), (USB_PULLUP_OUT |= (1 << USB_CFG_PULLUP_BIT))) -# define usbDeviceDisconnect() ((USB_PULLUP_DDR &= ~(1 << USB_CFG_PULLUP_BIT)), (USB_PULLUP_OUT &= ~(1 << USB_CFG_PULLUP_BIT))) -# else /* USB_CFG_PULLUP_IOPORTNAME */ -# define usbDeviceConnect() (USBDDR &= ~(1 << USBMINUS)) -# define usbDeviceDisconnect() (USBDDR |= (1 << USBMINUS)) -# endif /* USB_CFG_PULLUP_IOPORTNAME */ -/* The macros usbDeviceConnect() and usbDeviceDisconnect() (intended to look - * like a function) connect resp. disconnect the device from the host's USB. - * If the constants USB_CFG_PULLUP_IOPORT and USB_CFG_PULLUP_BIT are defined - * in usbconfig.h, a disconnect consists of removing the pull-up resisitor - * from D-, otherwise the disconnect is done by brute-force pulling D- to GND. - * This does not conform to the spec, but it works. - * Please note that the USB interrupt must be disabled while the device is - * in disconnected state, or the interrupt handler will hang! You can either - * turn off the USB interrupt selectively with - * USB_INTR_ENABLE &= ~(1 << USB_INTR_ENABLE_BIT) - * or use cli() to disable interrupts globally. - */ -extern unsigned usbCrc16(unsigned data, uchar len); -# define usbCrc16(data, len) usbCrc16((unsigned)(data), len) -/* This function calculates the binary complement of the data CRC used in - * USB data packets. The value is used to build raw transmit packets. - * You may want to use this function for data checksums or to verify received - * data. We enforce 16 bit calling conventions for compatibility with IAR's - * tiny memory model. - */ -extern unsigned usbCrc16Append(unsigned data, uchar len); -# define usbCrc16Append(data, len) usbCrc16Append((unsigned)(data), len) -/* This function is equivalent to usbCrc16() above, except that it appends - * the 2 bytes CRC (lowbyte first) in the 'data' buffer after reading 'len' - * bytes. - */ -# if USB_CFG_HAVE_MEASURE_FRAME_LENGTH -extern unsigned usbMeasureFrameLength(void); -/* This function MUST be called IMMEDIATELY AFTER USB reset and measures 1/7 of - * the number of CPU cycles during one USB frame minus one low speed bit - * length. In other words: return value = 1499 * (F_CPU / 10.5 MHz) - * Since this is a busy wait, you MUST disable all interrupts with cli() before - * calling this function. - * This can be used to calibrate the AVR's RC oscillator. - */ -# endif -extern uchar usbConfiguration; -/* This value contains the current configuration set by the host. The driver - * allows setting and querying of this variable with the USB SET_CONFIGURATION - * and GET_CONFIGURATION requests, but does not use it otherwise. - * You may want to reflect the "configured" status with a LED on the device or - * switch on high power parts of the circuit only if the device is configured. - */ -# if USB_COUNT_SOF -extern volatile uchar usbSofCount; -/* This variable is incremented on every SOF packet. It is only available if - * the macro USB_COUNT_SOF is defined to a value != 0. - */ -# endif -# if USB_CFG_CHECK_DATA_TOGGLING -extern uchar usbCurrentDataToken; -/* This variable can be checked in usbFunctionWrite() and usbFunctionWriteOut() - * to ignore duplicate packets. - */ -# endif - -# define USB_STRING_DESCRIPTOR_HEADER(stringLength) ((2 * (stringLength) + 2) | (3 << 8)) -/* This macro builds a descriptor header for a string descriptor given the - * string's length. See usbdrv.c for an example how to use it. - */ -# if USB_CFG_HAVE_FLOWCONTROL -extern volatile schar usbRxLen; -# define usbDisableAllRequests() usbRxLen = -1 -/* Must be called from usbFunctionWrite(). This macro disables all data input - * from the USB interface. Requests from the host are answered with a NAK - * while they are disabled. - */ -# define usbEnableAllRequests() usbRxLen = 0 -/* May only be called if requests are disabled. This macro enables input from - * the USB interface after it has been disabled with usbDisableAllRequests(). - */ -# define usbAllRequestsAreDisabled() (usbRxLen < 0) -/* Use this macro to find out whether requests are disabled. It may be needed - * to ensure that usbEnableAllRequests() is never called when requests are - * enabled. - */ -# endif - -# define USB_SET_DATATOKEN1(token) usbTxBuf1[0] = token -# define USB_SET_DATATOKEN3(token) usbTxBuf3[0] = token -/* These two macros can be used by application software to reset data toggling - * for interrupt-in endpoints 1 and 3. Since the token is toggled BEFORE - * sending data, you must set the opposite value of the token which should come - * first. - */ - -#endif /* __ASSEMBLER__ */ - -/* ------------------------------------------------------------------------- */ -/* ----------------- Definitions for Descriptor Properties ----------------- */ -/* ------------------------------------------------------------------------- */ -/* This is advanced stuff. See usbconfig-prototype.h for more information - * about the various methods to define USB descriptors. If you do nothing, - * the default descriptors will be used. - */ -#define USB_PROP_IS_DYNAMIC (1 << 14) -/* If this property is set for a descriptor, usbFunctionDescriptor() will be - * used to obtain the particular descriptor. Data directly returned via - * usbMsgPtr are FLASH data by default, combine (OR) with USB_PROP_IS_RAM to - * return RAM data. - */ -#define USB_PROP_IS_RAM (1 << 15) -/* If this property is set for a descriptor, the data is read from RAM - * memory instead of Flash. The property is used for all methods to provide - * external descriptors. - */ -#define USB_PROP_LENGTH(len) ((len)&0x3fff) -/* If a static external descriptor is used, this is the total length of the - * descriptor in bytes. - */ - -/* all descriptors which may have properties: */ -#ifndef USB_CFG_DESCR_PROPS_DEVICE -# define USB_CFG_DESCR_PROPS_DEVICE 0 -#endif -#ifndef USB_CFG_DESCR_PROPS_CONFIGURATION -# define USB_CFG_DESCR_PROPS_CONFIGURATION 0 -#endif -#ifndef USB_CFG_DESCR_PROPS_STRINGS -# define USB_CFG_DESCR_PROPS_STRINGS 0 -#endif -#ifndef USB_CFG_DESCR_PROPS_STRING_0 -# define USB_CFG_DESCR_PROPS_STRING_0 0 -#endif -#ifndef USB_CFG_DESCR_PROPS_STRING_VENDOR -# define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 -#endif -#ifndef USB_CFG_DESCR_PROPS_STRING_PRODUCT -# define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 -#endif -#ifndef USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER -# define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 -#endif -#ifndef USB_CFG_DESCR_PROPS_HID -# define USB_CFG_DESCR_PROPS_HID 0 -#endif -#if !(USB_CFG_DESCR_PROPS_HID_REPORT) -# undef USB_CFG_DESCR_PROPS_HID_REPORT -# if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* do some backward compatibility tricks */ -# define USB_CFG_DESCR_PROPS_HID_REPORT USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH -# else -# define USB_CFG_DESCR_PROPS_HID_REPORT 0 -# endif -#endif -#ifndef USB_CFG_DESCR_PROPS_UNKNOWN -# define USB_CFG_DESCR_PROPS_UNKNOWN 0 -#endif - -/* ------------------ forward declaration of descriptors ------------------- */ -/* If you use external static descriptors, they must be stored in global - * arrays as declared below: - */ -#ifndef __ASSEMBLER__ -extern -# if !(USB_CFG_DESCR_PROPS_DEVICE & USB_PROP_IS_RAM) - PROGMEM -# endif - const char usbDescriptorDevice[]; - -extern -# if !(USB_CFG_DESCR_PROPS_CONFIGURATION & USB_PROP_IS_RAM) - PROGMEM -# endif - const char usbDescriptorConfiguration[]; - -extern -# if !(USB_CFG_DESCR_PROPS_HID_REPORT & USB_PROP_IS_RAM) - PROGMEM -# endif - const char usbDescriptorHidReport[]; - -extern -# if !(USB_CFG_DESCR_PROPS_STRING_0 & USB_PROP_IS_RAM) - PROGMEM -# endif - const char usbDescriptorString0[]; - -extern -# if !(USB_CFG_DESCR_PROPS_STRING_VENDOR & USB_PROP_IS_RAM) - PROGMEM -# endif - const int usbDescriptorStringVendor[]; - -extern -# if !(USB_CFG_DESCR_PROPS_STRING_PRODUCT & USB_PROP_IS_RAM) - PROGMEM -# endif - const int usbDescriptorStringDevice[]; - -extern -# if !(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER & USB_PROP_IS_RAM) - PROGMEM -# endif - const int usbDescriptorStringSerialNumber[]; - -#endif /* __ASSEMBLER__ */ - -/* ------------------------------------------------------------------------- */ -/* ------------------------ General Purpose Macros ------------------------- */ -/* ------------------------------------------------------------------------- */ - -#define USB_CONCAT(a, b) a##b -#define USB_CONCAT_EXPANDED(a, b) USB_CONCAT(a, b) - -#define USB_OUTPORT(name) USB_CONCAT(PORT, name) -#define USB_INPORT(name) USB_CONCAT(PIN, name) -#define USB_DDRPORT(name) USB_CONCAT(DDR, name) -/* The double-define trick above lets us concatenate strings which are - * defined by macros. - */ - -/* ------------------------------------------------------------------------- */ -/* ------------------------- Constant definitions -------------------------- */ -/* ------------------------------------------------------------------------- */ - -#if !defined __ASSEMBLER__ && (!defined USB_CFG_VENDOR_ID || !defined USB_CFG_DEVICE_ID) -# warning "You should define USB_CFG_VENDOR_ID and USB_CFG_DEVICE_ID in usbconfig.h" -/* If the user has not defined IDs, we default to obdev's free IDs. - * See USB-IDs-for-free.txt for details. - */ -#endif - -/* make sure we have a VID and PID defined, byte order is lowbyte, highbyte */ -#ifndef USB_CFG_VENDOR_ID -# define USB_CFG_VENDOR_ID 0xc0, 0x16 /* = 0x16c0 = 5824 = voti.nl */ -#endif - -#ifndef USB_CFG_DEVICE_ID -# if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH -# define USB_CFG_DEVICE_ID 0xdf, 0x05 /* = 0x5df = 1503, shared PID for HIDs */ -# elif USB_CFG_INTERFACE_CLASS == 2 -# define USB_CFG_DEVICE_ID 0xe1, 0x05 /* = 0x5e1 = 1505, shared PID for CDC Modems */ -# else -# define USB_CFG_DEVICE_ID 0xdc, 0x05 /* = 0x5dc = 1500, obdev's free PID */ -# endif -#endif - -/* Derive Output, Input and DataDirection ports from port names */ -#ifndef USB_CFG_IOPORTNAME -# error "You must define USB_CFG_IOPORTNAME in usbconfig.h, see usbconfig-prototype.h" -#endif - -#define USBOUT USB_OUTPORT(USB_CFG_IOPORTNAME) -#define USB_PULLUP_OUT USB_OUTPORT(USB_CFG_PULLUP_IOPORTNAME) -#define USBIN USB_INPORT(USB_CFG_IOPORTNAME) -#define USBDDR USB_DDRPORT(USB_CFG_IOPORTNAME) -#define USB_PULLUP_DDR USB_DDRPORT(USB_CFG_PULLUP_IOPORTNAME) - -#define USBMINUS USB_CFG_DMINUS_BIT -#define USBPLUS USB_CFG_DPLUS_BIT -#define USBIDLE (1 << USB_CFG_DMINUS_BIT) /* value representing J state */ -#define USBMASK ((1 << USB_CFG_DPLUS_BIT) | (1 << USB_CFG_DMINUS_BIT)) /* mask for USB I/O bits */ - -/* defines for backward compatibility with older driver versions: */ -#define USB_CFG_IOPORT USB_OUTPORT(USB_CFG_IOPORTNAME) -#ifdef USB_CFG_PULLUP_IOPORTNAME -# define USB_CFG_PULLUP_IOPORT USB_OUTPORT(USB_CFG_PULLUP_IOPORTNAME) -#endif - -#ifndef USB_CFG_EP3_NUMBER /* if not defined in usbconfig.h */ -# define USB_CFG_EP3_NUMBER 3 -#endif - -#ifndef USB_CFG_HAVE_INTRIN_ENDPOINT3 -# define USB_CFG_HAVE_INTRIN_ENDPOINT3 0 -#endif - -#define USB_BUFSIZE 11 /* PID, 8 bytes data, 2 bytes CRC */ - -/* ----- Try to find registers and bits responsible for ext interrupt 0 ----- */ - -#ifndef USB_INTR_CFG /* allow user to override our default */ -# if defined EICRA -# define USB_INTR_CFG EICRA -# else -# define USB_INTR_CFG MCUCR -# endif -#endif -#ifndef USB_INTR_CFG_SET /* allow user to override our default */ -# if defined(USB_COUNT_SOF) || defined(USB_SOF_HOOK) -# define USB_INTR_CFG_SET (1 << ISC01) /* cfg for falling edge */ - /* If any SOF logic is used, the interrupt must be wired to D- where - * we better trigger on falling edge - */ -# else -# define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) /* cfg for rising edge */ -# endif -#endif -#ifndef USB_INTR_CFG_CLR /* allow user to override our default */ -# define USB_INTR_CFG_CLR 0 /* no bits to clear */ -#endif - -#ifndef USB_INTR_ENABLE /* allow user to override our default */ -# if defined GIMSK -# define USB_INTR_ENABLE GIMSK -# elif defined EIMSK -# define USB_INTR_ENABLE EIMSK -# else -# define USB_INTR_ENABLE GICR -# endif -#endif -#ifndef USB_INTR_ENABLE_BIT /* allow user to override our default */ -# define USB_INTR_ENABLE_BIT INT0 -#endif - -#ifndef USB_INTR_PENDING /* allow user to override our default */ -# if defined EIFR -# define USB_INTR_PENDING EIFR -# else -# define USB_INTR_PENDING GIFR -# endif -#endif -#ifndef USB_INTR_PENDING_BIT /* allow user to override our default */ -# define USB_INTR_PENDING_BIT INTF0 -#endif - -/* -The defines above don't work for the following chips -at90c8534: no ISC0?, no PORTB, can't find a data sheet -at86rf401: no PORTB, no MCUCR etc, low clock rate -atmega103: no ISC0? (maybe omission in header, can't find data sheet) -atmega603: not defined in avr-libc -at43usb320, at43usb355, at76c711: have USB anyway -at94k: is different... - -at90s1200, attiny11, attiny12, attiny15, attiny28: these have no RAM -*/ - -/* ------------------------------------------------------------------------- */ -/* ----------------- USB Specification Constants and Types ----------------- */ -/* ------------------------------------------------------------------------- */ - -/* USB Token values */ -#define USBPID_SETUP 0x2d -#define USBPID_OUT 0xe1 -#define USBPID_IN 0x69 -#define USBPID_DATA0 0xc3 -#define USBPID_DATA1 0x4b - -#define USBPID_ACK 0xd2 -#define USBPID_NAK 0x5a -#define USBPID_STALL 0x1e - -#ifndef USB_INITIAL_DATATOKEN -# define USB_INITIAL_DATATOKEN USBPID_DATA1 -#endif - -#ifndef __ASSEMBLER__ - -typedef struct usbTxStatus { - volatile uchar len; - uchar buffer[USB_BUFSIZE]; -} usbTxStatus_t; - -extern usbTxStatus_t usbTxStatus1, usbTxStatus3; -# define usbTxLen1 usbTxStatus1.len -# define usbTxBuf1 usbTxStatus1.buffer -# define usbTxLen3 usbTxStatus3.len -# define usbTxBuf3 usbTxStatus3.buffer - -typedef union usbWord { - unsigned word; - uchar bytes[2]; -} usbWord_t; - -typedef struct usbRequest { - uchar bmRequestType; - uchar bRequest; - usbWord_t wValue; - usbWord_t wIndex; - usbWord_t wLength; -} usbRequest_t; -/* This structure matches the 8 byte setup request */ -#endif - -/* bmRequestType field in USB setup: - * d t t r r r r r, where - * d ..... direction: 0=host->device, 1=device->host - * t ..... type: 0=standard, 1=class, 2=vendor, 3=reserved - * r ..... recipient: 0=device, 1=interface, 2=endpoint, 3=other - */ - -/* USB setup recipient values */ -#define USBRQ_RCPT_MASK 0x1f -#define USBRQ_RCPT_DEVICE 0 -#define USBRQ_RCPT_INTERFACE 1 -#define USBRQ_RCPT_ENDPOINT 2 - -/* USB request type values */ -#define USBRQ_TYPE_MASK 0x60 -#define USBRQ_TYPE_STANDARD (0 << 5) -#define USBRQ_TYPE_CLASS (1 << 5) -#define USBRQ_TYPE_VENDOR (2 << 5) - -/* USB direction values: */ -#define USBRQ_DIR_MASK 0x80 -#define USBRQ_DIR_HOST_TO_DEVICE (0 << 7) -#define USBRQ_DIR_DEVICE_TO_HOST (1 << 7) - -/* USB Standard Requests */ -#define USBRQ_GET_STATUS 0 -#define USBRQ_CLEAR_FEATURE 1 -#define USBRQ_SET_FEATURE 3 -#define USBRQ_SET_ADDRESS 5 -#define USBRQ_GET_DESCRIPTOR 6 -#define USBRQ_SET_DESCRIPTOR 7 -#define USBRQ_GET_CONFIGURATION 8 -#define USBRQ_SET_CONFIGURATION 9 -#define USBRQ_GET_INTERFACE 10 -#define USBRQ_SET_INTERFACE 11 -#define USBRQ_SYNCH_FRAME 12 - -/* USB descriptor constants */ -#define USBDESCR_DEVICE 1 -#define USBDESCR_CONFIG 2 -#define USBDESCR_STRING 3 -#define USBDESCR_INTERFACE 4 -#define USBDESCR_ENDPOINT 5 -#define USBDESCR_HID 0x21 -#define USBDESCR_HID_REPORT 0x22 -#define USBDESCR_HID_PHYS 0x23 - -//#define USBATTR_BUSPOWER 0x80 // USB 1.1 does not define this value any more -#define USBATTR_SELFPOWER 0x40 -#define USBATTR_REMOTEWAKE 0x20 - -/* USB HID Requests */ -#define USBRQ_HID_GET_REPORT 0x01 -#define USBRQ_HID_GET_IDLE 0x02 -#define USBRQ_HID_GET_PROTOCOL 0x03 -#define USBRQ_HID_SET_REPORT 0x09 -#define USBRQ_HID_SET_IDLE 0x0a -#define USBRQ_HID_SET_PROTOCOL 0x0b - -/* ------------------------------------------------------------------------- */ - -#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 2e8097da9c4..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm.S +++ /dev/null @@ -1,393 +0,0 @@ -/* Name: usbdrvasm.S - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2007-06-13 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm.S 785 2010-05-30 17:57:07Z cs $ - */ - -/* -General Description: -This module is the assembler part of the USB driver. This file contains -general code (preprocessor acrobatics and CRC computation) and then includes -the file appropriate for the given clock rate. -*/ - -#define __SFR_OFFSET 0 /* used by avr-libc's register definitions */ -#include "usbportability.h" -#include "usbdrv.h" /* for common defs */ - -/* register names */ -#define x1 r16 -#define x2 r17 -#define shift r18 -#define cnt r19 -#define x3 r20 -#define x4 r21 -#define x5 r22 -#define bitcnt x5 -#define phase x4 -#define leap x4 - -/* Some assembler dependent definitions and declarations: */ - -#ifdef __IAR_SYSTEMS_ASM__ - extern usbRxBuf, usbDeviceAddr, usbNewDeviceAddr, usbInputBufOffset - extern usbCurrentTok, usbRxLen, usbRxToken, usbTxLen - extern usbTxBuf, usbTxStatus1, usbTxStatus3 -# if USB_COUNT_SOF - extern usbSofCount -# endif - public usbCrc16 - public usbCrc16Append - - COMMON INTVEC -# ifndef USB_INTR_VECTOR - ORG INT0_vect -# else /* USB_INTR_VECTOR */ - ORG USB_INTR_VECTOR -# undef USB_INTR_VECTOR -# endif /* USB_INTR_VECTOR */ -# define USB_INTR_VECTOR usbInterruptHandler - rjmp USB_INTR_VECTOR - RSEG CODE - -#else /* __IAR_SYSTEMS_ASM__ */ - -# ifndef USB_INTR_VECTOR /* default to hardware interrupt INT0 */ -# ifdef INT0_vect -# define USB_INTR_VECTOR INT0_vect // this is the "new" define for the vector -# else -# define USB_INTR_VECTOR SIG_INTERRUPT0 // this is the "old" vector -# endif -# endif - .text - .global USB_INTR_VECTOR - .type USB_INTR_VECTOR, @function - .global usbCrc16 - .global usbCrc16Append -#endif /* __IAR_SYSTEMS_ASM__ */ - - -#if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */ -# define USB_LOAD_PENDING(reg) in reg, USB_INTR_PENDING -# define USB_STORE_PENDING(reg) out USB_INTR_PENDING, reg -#else /* It's a memory address, use lds and sts */ -# define USB_LOAD_PENDING(reg) lds reg, USB_INTR_PENDING -# define USB_STORE_PENDING(reg) sts USB_INTR_PENDING, reg -#endif - -#define usbTxLen1 usbTxStatus1 -#define usbTxBuf1 (usbTxStatus1 + 1) -#define usbTxLen3 usbTxStatus3 -#define usbTxBuf3 (usbTxStatus3 + 1) - - -;---------------------------------------------------------------------------- -; Utility functions -;---------------------------------------------------------------------------- - -#ifdef __IAR_SYSTEMS_ASM__ -/* Register assignments for usbCrc16 on IAR cc */ -/* Calling conventions on IAR: - * First parameter passed in r16/r17, second in r18/r19 and so on. - * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) - * Result is passed in r16/r17 - * In case of the "tiny" memory model, pointers are only 8 bit with no - * padding. We therefore pass argument 1 as "16 bit unsigned". - */ -RTMODEL "__rt_version", "3" -/* The line above will generate an error if cc calling conventions change. - * The value "3" above is valid for IAR 4.10B/W32 - */ -# define argLen r18 /* argument 2 */ -# define argPtrL r16 /* argument 1 */ -# define argPtrH r17 /* argument 1 */ - -# define resCrcL r16 /* result */ -# define resCrcH r17 /* result */ - -# define ptrL ZL -# define ptrH ZH -# define ptr Z -# define byte r22 -# define bitCnt r19 -# define polyL r20 -# define polyH r21 -# define scratch r23 - -#else /* __IAR_SYSTEMS_ASM__ */ -/* Register assignments for usbCrc16 on gcc */ -/* Calling conventions on gcc: - * First parameter passed in r24/r25, second in r22/23 and so on. - * Callee must preserve r1-r17, r28/r29 - * Result is passed in r24/r25 - */ -# define argLen r22 /* argument 2 */ -# define argPtrL r24 /* argument 1 */ -# define argPtrH r25 /* argument 1 */ - -# define resCrcL r24 /* result */ -# define resCrcH r25 /* result */ - -# define ptrL XL -# define ptrH XH -# define ptr x -# define byte r18 -# define bitCnt r19 -# define polyL r20 -# define polyH r21 -# define scratch r23 - -#endif - -#if USB_USE_FAST_CRC - -; This implementation is faster, but has bigger code size -; Thanks to Slawomir Fras (BoskiDialer) for this code! -; It implements the following C pseudo-code: -; unsigned table(unsigned char x) -; { -; unsigned value; -; -; value = (unsigned)x << 6; -; value ^= (unsigned)x << 7; -; if(parity(x)) -; value ^= 0xc001; -; return value; -; } -; unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen) -; { -; unsigned crc = 0xffff; -; -; while(argLen--) -; crc = table(lo8(crc) ^ *argPtr++) ^ hi8(crc); -; return ~crc; -; } - -; extern unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen); -; argPtr r24+25 / r16+r17 -; argLen r22 / r18 -; temp variables: -; byte r18 / r22 -; scratch r23 -; resCrc r24+r25 / r16+r17 -; ptr X / Z -usbCrc16: - mov ptrL, argPtrL - mov ptrH, argPtrH - ldi resCrcL, 0xFF - ldi resCrcH, 0xFF - rjmp usbCrc16LoopTest -usbCrc16ByteLoop: - ld byte, ptr+ - eor resCrcL, byte ; resCrcL is now 'x' in table() - mov byte, resCrcL ; compute parity of 'x' - swap byte - eor byte, resCrcL - mov scratch, byte - lsr byte - lsr byte - eor byte, scratch - inc byte - lsr byte - andi byte, 1 ; byte is now parity(x) - mov scratch, resCrcL - mov resCrcL, resCrcH - eor resCrcL, byte ; low byte of if(parity(x)) value ^= 0xc001; - neg byte - andi byte, 0xc0 - mov resCrcH, byte ; high byte of if(parity(x)) value ^= 0xc001; - clr byte - lsr scratch - ror byte - eor resCrcH, scratch - eor resCrcL, byte - lsr scratch - ror byte - eor resCrcH, scratch - eor resCrcL, byte -usbCrc16LoopTest: - subi argLen, 1 - brsh usbCrc16ByteLoop - com resCrcL - com resCrcH - ret - -#else /* USB_USE_FAST_CRC */ - -; This implementation is slower, but has less code size -; -; extern unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen); -; argPtr r24+25 / r16+r17 -; argLen r22 / r18 -; temp variables: -; byte r18 / r22 -; bitCnt r19 -; poly r20+r21 -; scratch r23 -; resCrc r24+r25 / r16+r17 -; ptr X / Z -usbCrc16: - mov ptrL, argPtrL - mov ptrH, argPtrH - ldi resCrcL, 0 - ldi resCrcH, 0 - ldi polyL, lo8(0xa001) - ldi polyH, hi8(0xa001) - com argLen ; argLen = -argLen - 1: modified loop to ensure that carry is set - ldi bitCnt, 0 ; loop counter with starnd condition = end condition - rjmp usbCrcLoopEntry -usbCrcByteLoop: - ld byte, ptr+ - eor resCrcL, byte -usbCrcBitLoop: - ror resCrcH ; carry is always set here (see brcs jumps to here) - ror resCrcL - brcs usbCrcNoXor - eor resCrcL, polyL - eor resCrcH, polyH -usbCrcNoXor: - subi bitCnt, 224 ; (8 * 224) % 256 = 0; this loop iterates 8 times - brcs usbCrcBitLoop -usbCrcLoopEntry: - subi argLen, -1 - brcs usbCrcByteLoop -usbCrcReady: - ret -; Thanks to Reimar Doeffinger for optimizing this CRC routine! - -#endif /* USB_USE_FAST_CRC */ - -; extern unsigned usbCrc16Append(unsigned char *data, unsigned char len); -usbCrc16Append: - rcall usbCrc16 - st ptr+, resCrcL - st ptr+, resCrcH - ret - -#undef argLen -#undef argPtrL -#undef argPtrH -#undef resCrcL -#undef resCrcH -#undef ptrL -#undef ptrH -#undef ptr -#undef byte -#undef bitCnt -#undef polyL -#undef polyH -#undef scratch - - -#if USB_CFG_HAVE_MEASURE_FRAME_LENGTH -#ifdef __IAR_SYSTEMS_ASM__ -/* Register assignments for usbMeasureFrameLength on IAR cc */ -/* Calling conventions on IAR: - * First parameter passed in r16/r17, second in r18/r19 and so on. - * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) - * Result is passed in r16/r17 - * In case of the "tiny" memory model, pointers are only 8 bit with no - * padding. We therefore pass argument 1 as "16 bit unsigned". - */ -# define resL r16 -# define resH r17 -# define cnt16L r30 -# define cnt16H r31 -# define cntH r18 - -#else /* __IAR_SYSTEMS_ASM__ */ -/* Register assignments for usbMeasureFrameLength on gcc */ -/* Calling conventions on gcc: - * First parameter passed in r24/r25, second in r22/23 and so on. - * Callee must preserve r1-r17, r28/r29 - * Result is passed in r24/r25 - */ -# define resL r24 -# define resH r25 -# define cnt16L r24 -# define cnt16H r25 -# define cntH r26 -#endif -# define cnt16 cnt16L - -; extern unsigned usbMeasurePacketLength(void); -; returns time between two idle strobes in multiples of 7 CPU clocks -.global usbMeasureFrameLength -usbMeasureFrameLength: - ldi cntH, 6 ; wait ~ 10 ms for D- == 0 - clr cnt16L - clr cnt16H -usbMFTime16: - dec cntH - breq usbMFTimeout -usbMFWaitStrobe: ; first wait for D- == 0 (idle strobe) - sbiw cnt16, 1 ;[0] [6] - breq usbMFTime16 ;[2] - sbic USBIN, USBMINUS ;[3] - rjmp usbMFWaitStrobe ;[4] -usbMFWaitIdle: ; then wait until idle again - sbis USBIN, USBMINUS ;1 wait for D- == 1 - rjmp usbMFWaitIdle ;2 - ldi cnt16L, 1 ;1 represents cycles so far - clr cnt16H ;1 -usbMFWaitLoop: - in cntH, USBIN ;[0] [7] - adiw cnt16, 1 ;[1] - breq usbMFTimeout ;[3] - andi cntH, USBMASK ;[4] - brne usbMFWaitLoop ;[5] -usbMFTimeout: -#if resL != cnt16L - mov resL, cnt16L - mov resH, cnt16H -#endif - ret - -#undef resL -#undef resH -#undef cnt16 -#undef cnt16L -#undef cnt16H -#undef cntH - -#endif /* USB_CFG_HAVE_MEASURE_FRAME_LENGTH */ - -;---------------------------------------------------------------------------- -; Now include the clock rate specific code -;---------------------------------------------------------------------------- - -#ifndef USB_CFG_CLOCK_KHZ -# ifdef F_CPU -# define USB_CFG_CLOCK_KHZ (F_CPU/1000) -# else -# error "USB_CFG_CLOCK_KHZ not defined in usbconfig.h and no F_CPU set!" -# endif -#endif - -#if USB_CFG_CHECK_CRC /* separate dispatcher for CRC type modules */ -# if USB_CFG_CLOCK_KHZ == 18000 -# include "usbdrvasm18-crc.inc" -# else -# error "USB_CFG_CLOCK_KHZ is not one of the supported crc-rates!" -# endif -#else /* USB_CFG_CHECK_CRC */ -# if USB_CFG_CLOCK_KHZ == 12000 -# include "usbdrvasm12.inc" -# elif USB_CFG_CLOCK_KHZ == 12800 -# include "usbdrvasm128.inc" -# elif USB_CFG_CLOCK_KHZ == 15000 -# include "usbdrvasm15.inc" -# elif USB_CFG_CLOCK_KHZ == 16000 -# include "usbdrvasm16.inc" -# elif USB_CFG_CLOCK_KHZ == 16500 -# include "usbdrvasm165.inc" -# elif USB_CFG_CLOCK_KHZ == 20000 -# include "usbdrvasm20.inc" -# else -# error "USB_CFG_CLOCK_KHZ is not one of the supported non-crc-rates!" -# endif -#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 9cc4e4d739f..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm.asm +++ /dev/null @@ -1,21 +0,0 @@ -/* Name: usbdrvasm.asm - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2006-03-01 - * Tabsize: 4 - * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id$ - */ - -/* -General Description: -The IAR compiler/assembler system prefers assembler files with file extension -".asm". We simply provide this file as an alias for usbdrvasm.S. - -Thanks to Oleg Semyonov for his help with the IAR tools port! -*/ - -#include "usbdrvasm.S" - -end diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc deleted file mode 100644 index c1167584cbd..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc +++ /dev/null @@ -1,393 +0,0 @@ -/* Name: usbdrvasm12.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2004-12-29 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrvasm12.inc 740 2009-04-13 18:23:31Z cs $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 12 MHz version of the asssembler part of the USB driver. It -requires a 12 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! - - -Timing constraints according to spec (in bit times): -timing subject min max CPUcycles ---------------------------------------------------------------------------- -EOP of OUT/SETUP to sync pattern of DATA0 (both rx) 2 16 16-128 -EOP of IN to sync pattern of DATA0 (rx, then tx) 2 7.5 16-60 -DATAx (rx) to ACK/NAK/STALL (tx) 2 7.5 16-60 -*/ - -;Software-receiver engine. Strict timing! Don't change unless you can preserve timing! -;interrupt response time: 4 cycles + insn running = 7 max if interrupts always enabled -;max allowable interrupt latency: 34 cycles -> max 25 cycles interrupt disable -;max stack usage: [ret(2), YL, SREG, YH, shift, x1, x2, x3, cnt, x4] = 11 bytes -;Numbers in brackets are maximum cycles since SOF. -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt - push YL ;2 [35] push only what is necessary to sync with edge ASAP - in YL, SREG ;1 [37] - push YL ;2 [39] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of 1/4 bit which meets the spec. - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push YH ;2 [2] - lds YL, usbInputBufOffset;2 [4] - clr YH ;1 [5] - subi YL, lo8(-(usbRxBuf));1 [6] - sbci YH, hi8(-(usbRxBuf));1 [7] - - sbis USBIN, USBMINUS ;1 [8] we want two bits K [sample 1 cycle too early] - rjmp haveTwoBitsK ;2 [10] - pop YH ;2 [11] undo the push from before - rjmp waitForK ;2 [13] this was not the end of sync, retry -haveTwoBitsK: -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- - push shift ;2 [16] - push x1 ;2 [12] - push x2 ;2 [14] - - in x1, USBIN ;1 [17] <-- sample bit 0 - ldi shift, 0xff ;1 [18] - bst x1, USBMINUS ;1 [19] - bld shift, 0 ;1 [20] - push x3 ;2 [22] - push cnt ;2 [24] - - in x2, USBIN ;1 [25] <-- sample bit 1 - ser x3 ;1 [26] [inserted init instruction] - eor x1, x2 ;1 [27] - bst x1, USBMINUS ;1 [28] - bld shift, 1 ;1 [29] - ldi cnt, USB_BUFSIZE;1 [30] [inserted init instruction] - rjmp rxbit2 ;2 [32] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- - -unstuff0: ;1 (branch taken) - andi x3, ~0x01 ;1 [15] - mov x1, x2 ;1 [16] x2 contains last sampled (stuffed) bit - in x2, USBIN ;1 [17] <-- sample bit 1 again - ori shift, 0x01 ;1 [18] - rjmp didUnstuff0 ;2 [20] - -unstuff1: ;1 (branch taken) - mov x2, x1 ;1 [21] x1 contains last sampled (stuffed) bit - andi x3, ~0x02 ;1 [22] - ori shift, 0x02 ;1 [23] - nop ;1 [24] - in x1, USBIN ;1 [25] <-- sample bit 2 again - rjmp didUnstuff1 ;2 [27] - -unstuff2: ;1 (branch taken) - andi x3, ~0x04 ;1 [29] - ori shift, 0x04 ;1 [30] - mov x1, x2 ;1 [31] x2 contains last sampled (stuffed) bit - nop ;1 [32] - in x2, USBIN ;1 [33] <-- sample bit 3 - rjmp didUnstuff2 ;2 [35] - -unstuff3: ;1 (branch taken) - in x2, USBIN ;1 [34] <-- sample stuffed bit 3 [one cycle too late] - andi x3, ~0x08 ;1 [35] - ori shift, 0x08 ;1 [36] - rjmp didUnstuff3 ;2 [38] - -unstuff4: ;1 (branch taken) - andi x3, ~0x10 ;1 [40] - in x1, USBIN ;1 [41] <-- sample stuffed bit 4 - ori shift, 0x10 ;1 [42] - rjmp didUnstuff4 ;2 [44] - -unstuff5: ;1 (branch taken) - andi x3, ~0x20 ;1 [48] - in x2, USBIN ;1 [49] <-- sample stuffed bit 5 - ori shift, 0x20 ;1 [50] - rjmp didUnstuff5 ;2 [52] - -unstuff6: ;1 (branch taken) - andi x3, ~0x40 ;1 [56] - in x1, USBIN ;1 [57] <-- sample stuffed bit 6 - ori shift, 0x40 ;1 [58] - rjmp didUnstuff6 ;2 [60] - -; extra jobs done during bit interval: -; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs] -; bit 1: se0 check -; bit 2: overflow check -; bit 3: recovery from delay [bit 0 tasks took too long] -; bit 4: none -; bit 5: none -; bit 6: none -; bit 7: jump, eor -rxLoop: - eor x3, shift ;1 [0] reconstruct: x3 is 0 at bit locations we changed, 1 at others - in x1, USBIN ;1 [1] <-- sample bit 0 - st y+, x3 ;2 [3] store data - ser x3 ;1 [4] - nop ;1 [5] - eor x2, x1 ;1 [6] - bst x2, USBMINUS;1 [7] - bld shift, 0 ;1 [8] - in x2, USBIN ;1 [9] <-- sample bit 1 (or possibly bit 0 stuffed) - andi x2, USBMASK ;1 [10] - breq se0 ;1 [11] SE0 check for bit 1 - andi shift, 0xf9 ;1 [12] -didUnstuff0: - breq unstuff0 ;1 [13] - eor x1, x2 ;1 [14] - bst x1, USBMINUS;1 [15] - bld shift, 1 ;1 [16] -rxbit2: - in x1, USBIN ;1 [17] <-- sample bit 2 (or possibly bit 1 stuffed) - andi shift, 0xf3 ;1 [18] - breq unstuff1 ;1 [19] do remaining work for bit 1 -didUnstuff1: - subi cnt, 1 ;1 [20] - brcs overflow ;1 [21] loop control - eor x2, x1 ;1 [22] - bst x2, USBMINUS;1 [23] - bld shift, 2 ;1 [24] - in x2, USBIN ;1 [25] <-- sample bit 3 (or possibly bit 2 stuffed) - andi shift, 0xe7 ;1 [26] - breq unstuff2 ;1 [27] -didUnstuff2: - eor x1, x2 ;1 [28] - bst x1, USBMINUS;1 [29] - bld shift, 3 ;1 [30] -didUnstuff3: - andi shift, 0xcf ;1 [31] - breq unstuff3 ;1 [32] - in x1, USBIN ;1 [33] <-- sample bit 4 - eor x2, x1 ;1 [34] - bst x2, USBMINUS;1 [35] - bld shift, 4 ;1 [36] -didUnstuff4: - andi shift, 0x9f ;1 [37] - breq unstuff4 ;1 [38] - nop2 ;2 [40] - in x2, USBIN ;1 [41] <-- sample bit 5 - eor x1, x2 ;1 [42] - bst x1, USBMINUS;1 [43] - bld shift, 5 ;1 [44] -didUnstuff5: - andi shift, 0x3f ;1 [45] - breq unstuff5 ;1 [46] - nop2 ;2 [48] - in x1, USBIN ;1 [49] <-- sample bit 6 - eor x2, x1 ;1 [50] - bst x2, USBMINUS;1 [51] - bld shift, 6 ;1 [52] -didUnstuff6: - cpi shift, 0x02 ;1 [53] - brlo unstuff6 ;1 [54] - nop2 ;2 [56] - in x2, USBIN ;1 [57] <-- sample bit 7 - eor x1, x2 ;1 [58] - bst x1, USBMINUS;1 [59] - bld shift, 7 ;1 [60] -didUnstuff7: - cpi shift, 0x04 ;1 [61] - brsh rxLoop ;2 [63] loop control -unstuff7: - andi x3, ~0x80 ;1 [63] - ori shift, 0x80 ;1 [64] - in x2, USBIN ;1 [65] <-- sample stuffed bit 7 - nop ;1 [66] - rjmp didUnstuff7 ;2 [68] - -macro POP_STANDARD ; 12 cycles - pop cnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;---------------------------------------------------------------------------- -; Transmitting data -;---------------------------------------------------------------------------- - -txByteLoop: -txBitloop: -stuffN1Delay: ; [03] - ror shift ;[-5] [11] [59] - brcc doExorN1 ;[-4] [60] - subi x4, 1 ;[-3] - brne commonN1 ;[-2] - lsl shift ;[-1] compensate ror after rjmp stuffDelay - nop ;[00] stuffing consists of just waiting 8 cycles - rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear - -sendNakAndReti: ;0 [-19] 19 cycles until SOP - ldi x3, USBPID_NAK ;1 [-18] - rjmp usbSendX3 ;2 [-16] -sendAckAndReti: ;0 [-19] 19 cycles until SOP - ldi x3, USBPID_ACK ;1 [-18] - rjmp usbSendX3 ;2 [-16] -sendCntAndReti: ;0 [-17] 17 cycles until SOP - mov x3, cnt ;1 [-16] -usbSendX3: ;0 [-16] - ldi YL, 20 ;1 [-15] 'x3' is R20 - ldi YH, 0 ;1 [-14] - ldi cnt, 2 ;1 [-13] -; rjmp usbSendAndReti fallthrough - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) or USBOUT = 0x01 -; K = (D+ = 1), (D- = 0) or USBOUT = 0x02 -; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles) - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte -;uses: x1...x2, x4, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x4 = bitstuff cnt] -;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction) -usbSendAndReti: - in x2, USBDDR ;[-12] 12 cycles until SOP - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS ;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - out USBDDR, x2 ;[-8] <--- acquire bus - in x1, USBOUT ;[-7] port mirror for tx loop - ldi shift, 0x40 ;[-6] sync byte is first byte sent (we enter loop after ror) - ldi x2, USBMASK ;[-5] - push x4 ;[-4] -doExorN1: - eor x1, x2 ;[-2] [06] [62] - ldi x4, 6 ;[-1] [07] [63] -commonN1: -stuffN2Delay: - out USBOUT, x1 ;[00] [08] [64] <--- set bit - ror shift ;[01] - brcc doExorN2 ;[02] - subi x4, 1 ;[03] - brne commonN2 ;[04] - lsl shift ;[05] compensate ror after rjmp stuffDelay - rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear -doExorN2: - eor x1, x2 ;[04] [12] - ldi x4, 6 ;[05] [13] -commonN2: - nop ;[06] [14] - subi cnt, 171 ;[07] [15] trick: (3 * 171) & 0xff = 1 - out USBOUT, x1 ;[08] [16] <--- set bit - brcs txBitloop ;[09] [25] [41] - -stuff6Delay: - ror shift ;[42] [50] - brcc doExor6 ;[43] - subi x4, 1 ;[44] - brne common6 ;[45] - lsl shift ;[46] compensate ror after rjmp stuffDelay - nop ;[47] stuffing consists of just waiting 8 cycles - rjmp stuff6Delay ;[48] after ror, C bit is reliably clear -doExor6: - eor x1, x2 ;[45] [53] - ldi x4, 6 ;[46] -common6: -stuff7Delay: - ror shift ;[47] [55] - out USBOUT, x1 ;[48] <--- set bit - brcc doExor7 ;[49] - subi x4, 1 ;[50] - brne common7 ;[51] - lsl shift ;[52] compensate ror after rjmp stuffDelay - rjmp stuff7Delay ;[53] after ror, C bit is reliably clear -doExor7: - eor x1, x2 ;[51] [59] - ldi x4, 6 ;[52] -common7: - ld shift, y+ ;[53] - tst cnt ;[55] - out USBOUT, x1 ;[56] <--- set bit - brne txByteLoop ;[57] - -;make SE0: - cbr x1, USBMASK ;[58] prepare SE0 [spec says EOP may be 15 to 18 cycles] - lds x2, usbNewDeviceAddr;[59] - lsl x2 ;[61] we compare with left shifted address - subi YL, 2 + 20 ;[62] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[63] - out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[01] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 12.5625 MHz -max frequency: 69.286 cycles for 8 bit -> 12.99 MHz -nominal frequency: 12.77 MHz ( = sqrt(min * max)) - -sampling positions: (next even number in range [+/- 0.5]) -cycle index range: 0 ... 66 -bits: -.5, 8.875, 17.25, 25.625, 34, 42.375, 50.75, 59.125 -[0/1], [9], [17], [25/+26], [34], [+42/43], [51], [59] - -bit number: 0 1 2 3 4 5 6 7 -spare cycles 1 2 1 2 1 1 1 0 - -operations to perform: duration cycle - ---------------- - eor fix, shift 1 -> 00 - andi phase, USBMASK 1 -> 08 - breq se0 1 -> 16 (moved to 11) - st y+, data 2 -> 24, 25 - mov data, fix 1 -> 33 - ser data 1 -> 41 - subi cnt, 1 1 -> 49 - brcs overflow 1 -> 50 - -layout of samples and operations: -[##] = sample bit -<##> = sample phase -*##* = operation - -0: *00* [01] 02 03 04 <05> 06 07 -1: *08* [09] 10 11 12 <13> 14 15 *16* -2: [17] 18 19 20 <21> 22 23 -3: *24* *25* [26] 27 28 29 <30> 31 32 -4: *33* [34] 35 36 37 <38> 39 40 -5: *41* [42] 43 44 45 <46> 47 48 -6: *49* *50* [51] 52 53 54 <55> 56 57 58 -7: [59] 60 61 62 <63> 64 65 66 -*****************************************************************************/ - -/* we prefer positive expressions (do if condition) instead of negative - * (skip if condition), therefore use defines for skip instructions: - */ -#define ifioclr sbis -#define ifioset sbic -#define ifrclr sbrs -#define ifrset sbrc - -/* The registers "fix" and "data" swap their meaning during the loop. Use - * defines to keep their name constant. - */ -#define fix x2 -#define data x1 -#undef phase /* phase has a default definition to x4 */ -#define phase x3 - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt, r0 - push YL ;2 push only what is necessary to sync with edge ASAP - in YL, SREG ;1 - push YL ;2 -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of 1/4 bit which meets the spec. - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS ;[0] - rjmp foundK ;[1] -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError - -foundK: -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push YH ;[2] - lds YL, usbInputBufOffset;[4] - clr YH ;[6] - subi YL, lo8(-(usbRxBuf));[7] - sbci YH, hi8(-(usbRxBuf));[8] - - sbis USBIN, USBMINUS ;[9] we want two bits K [we want to sample at 8 + 4 - 1.5 = 10.5] - rjmp haveTwoBitsK ;[10] - pop YH ;[11] undo the push from before - rjmp waitForK ;[13] this was not the end of sync, retry -haveTwoBitsK: -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -#define fix x2 -#define data x1 - - push shift ;[12] - push x1 ;[14] - push x2 ;[16] - ldi shift, 0x80 ;[18] prevent bit-unstuffing but init low bits to 0 - ifioset USBIN, USBMINUS ;[19] [01] <--- bit 0 [10.5 + 8 = 18.5] - ori shift, 1<<0 ;[02] - push x3 ;[03] - push cnt ;[05] - push r0 ;[07] - ifioset USBIN, USBMINUS ;[09] <--- bit 1 - ori shift, 1<<1 ;[10] - ser fix ;[11] - ldi cnt, USB_BUFSIZE ;[12] - mov data, shift ;[13] - lsl shift ;[14] - nop2 ;[15] - ifioset USBIN, USBMINUS ;[17] <--- bit 2 - ori data, 3<<2 ;[18] store in bit 2 AND bit 3 - eor shift, data ;[19] do nrzi decoding - andi data, 1<<3 ;[20] - in phase, USBIN ;[21] <- phase - brne jumpToEntryAfterSet ;[22] if USBMINS at bit 3 was 1 - nop ;[23] - rjmp entryAfterClr ;[24] -jumpToEntryAfterSet: - rjmp entryAfterSet ;[24] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -#undef fix -#define fix x1 -#undef data -#define data x2 - -bit7IsSet: - ifrclr phase, USBMINUS ;[62] check phase only if D- changed - lpm ;[63] - in phase, USBIN ;[64] <- phase (one cycle too late) - ori shift, 1 << 7 ;[65] - nop ;[66] -;;;;rjmp bit0AfterSet ; -> [00] == [67] moved block up to save jump -bit0AfterSet: - eor fix, shift ;[00] -#undef fix -#define fix x2 -#undef data -#define data x1 /* we now have result in data, fix is reset to 0xff */ - ifioclr USBIN, USBMINUS ;[01] <--- sample 0 - rjmp bit0IsClr ;[02] - andi shift, ~(7 << 0) ;[03] - breq unstuff0s ;[04] - in phase, USBIN ;[05] <- phase - rjmp bit1AfterSet ;[06] -unstuff0s: - in phase, USBIN ;[06] <- phase (one cycle too late) - andi fix, ~(1 << 0) ;[07] - ifioclr USBIN, USBMINUS ;[00] - ifioset USBIN, USBPLUS ;[01] - rjmp bit0IsClr ;[02] executed if first expr false or second true -se0AndStore: ; executed only if both bits 0 - st y+, x1 ;[15/17] cycles after start of byte - rjmp se0 ;[17/19] - -bit0IsClr: - ifrset phase, USBMINUS ;[04] check phase only if D- changed - lpm ;[05] - in phase, USBIN ;[06] <- phase (one cycle too late) - ori shift, 1 << 0 ;[07] -bit1AfterClr: - andi phase, USBMASK ;[08] - ifioset USBIN, USBMINUS ;[09] <--- sample 1 - rjmp bit1IsSet ;[10] - breq se0AndStore ;[11] if D- was 0 in bits 0 AND 1 and D+ was 0 in between, we have SE0 - andi shift, ~(7 << 1) ;[12] - in phase, USBIN ;[13] <- phase - breq unstuff1c ;[14] - rjmp bit2AfterClr ;[15] -unstuff1c: - andi fix, ~(1 << 1) ;[16] - nop2 ;[08] - nop2 ;[10] -bit1IsSet: - ifrclr phase, USBMINUS ;[12] check phase only if D- changed - lpm ;[13] - in phase, USBIN ;[14] <- phase (one cycle too late) - ori shift, 1 << 1 ;[15] - nop ;[16] -bit2AfterSet: - ifioclr USBIN, USBMINUS ;[17] <--- sample 2 - rjmp bit2IsClr ;[18] - andi shift, ~(7 << 2) ;[19] - breq unstuff2s ;[20] - in phase, USBIN ;[21] <- phase - rjmp bit3AfterSet ;[22] -unstuff2s: - in phase, USBIN ;[22] <- phase (one cycle too late) - andi fix, ~(1 << 2) ;[23] - nop2 ;[16] - nop2 ;[18] -bit2IsClr: - ifrset phase, USBMINUS ;[20] check phase only if D- changed - lpm ;[21] - in phase, USBIN ;[22] <- phase (one cycle too late) - ori shift, 1 << 2 ;[23] -bit3AfterClr: - st y+, data ;[24] -entryAfterClr: - ifioset USBIN, USBMINUS ;[26] <--- sample 3 - rjmp bit3IsSet ;[27] - andi shift, ~(7 << 3) ;[28] - breq unstuff3c ;[29] - in phase, USBIN ;[30] <- phase - rjmp bit4AfterClr ;[31] -unstuff3c: - in phase, USBIN ;[31] <- phase (one cycle too late) - andi fix, ~(1 << 3) ;[32] - nop2 ;[25] - nop2 ;[27] -bit3IsSet: - ifrclr phase, USBMINUS ;[29] check phase only if D- changed - lpm ;[30] - in phase, USBIN ;[31] <- phase (one cycle too late) - ori shift, 1 << 3 ;[32] -bit4AfterSet: - mov data, fix ;[33] undo this move by swapping defines -#undef fix -#define fix x1 -#undef data -#define data x2 - ifioclr USBIN, USBMINUS ;[34] <--- sample 4 - rjmp bit4IsClr ;[35] - andi shift, ~(7 << 4) ;[36] - breq unstuff4s ;[37] - in phase, USBIN ;[38] <- phase - rjmp bit5AfterSet ;[39] -unstuff4s: - in phase, USBIN ;[39] <- phase (one cycle too late) - andi fix, ~(1 << 4) ;[40] - nop2 ;[33] - nop2 ;[35] -bit4IsClr: - ifrset phase, USBMINUS ;[37] check phase only if D- changed - lpm ;[38] - in phase, USBIN ;[39] <- phase (one cycle too late) - ori shift, 1 << 4 ;[40] -bit5AfterClr: - ser data ;[41] - ifioset USBIN, USBMINUS ;[42] <--- sample 5 - rjmp bit5IsSet ;[43] - andi shift, ~(7 << 5) ;[44] - breq unstuff5c ;[45] - in phase, USBIN ;[46] <- phase - rjmp bit6AfterClr ;[47] -unstuff5c: - in phase, USBIN ;[47] <- phase (one cycle too late) - andi fix, ~(1 << 5) ;[48] - nop2 ;[41] - nop2 ;[43] -bit5IsSet: - ifrclr phase, USBMINUS ;[45] check phase only if D- changed - lpm ;[46] - in phase, USBIN ;[47] <- phase (one cycle too late) - ori shift, 1 << 5 ;[48] -bit6AfterSet: - subi cnt, 1 ;[49] - brcs jumpToOverflow ;[50] - ifioclr USBIN, USBMINUS ;[51] <--- sample 6 - rjmp bit6IsClr ;[52] - andi shift, ~(3 << 6) ;[53] - cpi shift, 2 ;[54] - in phase, USBIN ;[55] <- phase - brlt unstuff6s ;[56] - rjmp bit7AfterSet ;[57] - -jumpToOverflow: - rjmp overflow - -unstuff6s: - andi fix, ~(1 << 6) ;[50] - lpm ;[51] -bit6IsClr: - ifrset phase, USBMINUS ;[54] check phase only if D- changed - lpm ;[55] - in phase, USBIN ;[56] <- phase (one cycle too late) - ori shift, 1 << 6 ;[57] - nop ;[58] -bit7AfterClr: - ifioset USBIN, USBMINUS ;[59] <--- sample 7 - rjmp bit7IsSet ;[60] - andi shift, ~(1 << 7) ;[61] - cpi shift, 4 ;[62] - in phase, USBIN ;[63] <- phase - brlt unstuff7c ;[64] - rjmp bit0AfterClr ;[65] -> [00] == [67] -unstuff7c: - andi fix, ~(1 << 7) ;[58] - nop ;[59] - rjmp bit7IsSet ;[60] - -bit7IsClr: - ifrset phase, USBMINUS ;[62] check phase only if D- changed - lpm ;[63] - in phase, USBIN ;[64] <- phase (one cycle too late) - ori shift, 1 << 7 ;[65] - nop ;[66] -;;;;rjmp bit0AfterClr ; -> [00] == [67] moved block up to save jump -bit0AfterClr: - eor fix, shift ;[00] -#undef fix -#define fix x2 -#undef data -#define data x1 /* we now have result in data, fix is reset to 0xff */ - ifioset USBIN, USBMINUS ;[01] <--- sample 0 - rjmp bit0IsSet ;[02] - andi shift, ~(7 << 0) ;[03] - breq unstuff0c ;[04] - in phase, USBIN ;[05] <- phase - rjmp bit1AfterClr ;[06] -unstuff0c: - in phase, USBIN ;[06] <- phase (one cycle too late) - andi fix, ~(1 << 0) ;[07] - ifioclr USBIN, USBMINUS ;[00] - ifioset USBIN, USBPLUS ;[01] - rjmp bit0IsSet ;[02] executed if first expr false or second true - rjmp se0AndStore ;[03] executed only if both bits 0 -bit0IsSet: - ifrclr phase, USBMINUS ;[04] check phase only if D- changed - lpm ;[05] - in phase, USBIN ;[06] <- phase (one cycle too late) - ori shift, 1 << 0 ;[07] -bit1AfterSet: - andi shift, ~(7 << 1) ;[08] compensated by "ori shift, 1<<1" if bit1IsClr - ifioclr USBIN, USBMINUS ;[09] <--- sample 1 - rjmp bit1IsClr ;[10] - breq unstuff1s ;[11] - nop2 ;[12] do not check for SE0 if bit 0 was 1 - in phase, USBIN ;[14] <- phase (one cycle too late) - rjmp bit2AfterSet ;[15] -unstuff1s: - in phase, USBIN ;[13] <- phase - andi fix, ~(1 << 1) ;[14] - lpm ;[07] - nop2 ;[10] -bit1IsClr: - ifrset phase, USBMINUS ;[12] check phase only if D- changed - lpm ;[13] - in phase, USBIN ;[14] <- phase (one cycle too late) - ori shift, 1 << 1 ;[15] - nop ;[16] -bit2AfterClr: - ifioset USBIN, USBMINUS ;[17] <--- sample 2 - rjmp bit2IsSet ;[18] - andi shift, ~(7 << 2) ;[19] - breq unstuff2c ;[20] - in phase, USBIN ;[21] <- phase - rjmp bit3AfterClr ;[22] -unstuff2c: - in phase, USBIN ;[22] <- phase (one cycle too late) - andi fix, ~(1 << 2) ;[23] - nop2 ;[16] - nop2 ;[18] -bit2IsSet: - ifrclr phase, USBMINUS ;[20] check phase only if D- changed - lpm ;[21] - in phase, USBIN ;[22] <- phase (one cycle too late) - ori shift, 1 << 2 ;[23] -bit3AfterSet: - st y+, data ;[24] -entryAfterSet: - ifioclr USBIN, USBMINUS ;[26] <--- sample 3 - rjmp bit3IsClr ;[27] - andi shift, ~(7 << 3) ;[28] - breq unstuff3s ;[29] - in phase, USBIN ;[30] <- phase - rjmp bit4AfterSet ;[31] -unstuff3s: - in phase, USBIN ;[31] <- phase (one cycle too late) - andi fix, ~(1 << 3) ;[32] - nop2 ;[25] - nop2 ;[27] -bit3IsClr: - ifrset phase, USBMINUS ;[29] check phase only if D- changed - lpm ;[30] - in phase, USBIN ;[31] <- phase (one cycle too late) - ori shift, 1 << 3 ;[32] -bit4AfterClr: - mov data, fix ;[33] undo this move by swapping defines -#undef fix -#define fix x1 -#undef data -#define data x2 - ifioset USBIN, USBMINUS ;[34] <--- sample 4 - rjmp bit4IsSet ;[35] - andi shift, ~(7 << 4) ;[36] - breq unstuff4c ;[37] - in phase, USBIN ;[38] <- phase - rjmp bit5AfterClr ;[39] -unstuff4c: - in phase, USBIN ;[39] <- phase (one cycle too late) - andi fix, ~(1 << 4) ;[40] - nop2 ;[33] - nop2 ;[35] -bit4IsSet: - ifrclr phase, USBMINUS ;[37] check phase only if D- changed - lpm ;[38] - in phase, USBIN ;[39] <- phase (one cycle too late) - ori shift, 1 << 4 ;[40] -bit5AfterSet: - ser data ;[41] - ifioclr USBIN, USBMINUS ;[42] <--- sample 5 - rjmp bit5IsClr ;[43] - andi shift, ~(7 << 5) ;[44] - breq unstuff5s ;[45] - in phase, USBIN ;[46] <- phase - rjmp bit6AfterSet ;[47] -unstuff5s: - in phase, USBIN ;[47] <- phase (one cycle too late) - andi fix, ~(1 << 5) ;[48] - nop2 ;[41] - nop2 ;[43] -bit5IsClr: - ifrset phase, USBMINUS ;[45] check phase only if D- changed - lpm ;[46] - in phase, USBIN ;[47] <- phase (one cycle too late) - ori shift, 1 << 5 ;[48] -bit6AfterClr: - subi cnt, 1 ;[49] - brcs overflow ;[50] - ifioset USBIN, USBMINUS ;[51] <--- sample 6 - rjmp bit6IsSet ;[52] - andi shift, ~(3 << 6) ;[53] - cpi shift, 2 ;[54] - in phase, USBIN ;[55] <- phase - brlt unstuff6c ;[56] - rjmp bit7AfterClr ;[57] -unstuff6c: - andi fix, ~(1 << 6) ;[50] - lpm ;[51] -bit6IsSet: - ifrclr phase, USBMINUS ;[54] check phase only if D- changed - lpm ;[55] - in phase, USBIN ;[56] <- phase (one cycle too late) - ori shift, 1 << 6 ;[57] -bit7AfterSet: - ifioclr USBIN, USBMINUS ;[59] <--- sample 7 - rjmp bit7IsClr ;[60] - andi shift, ~(1 << 7) ;[61] - cpi shift, 4 ;[62] - in phase, USBIN ;[63] <- phase - brlt unstuff7s ;[64] - rjmp bit0AfterSet ;[65] -> [00] == [67] -unstuff7s: - andi fix, ~(1 << 7) ;[58] - nop ;[59] - rjmp bit7IsClr ;[60] - -macro POP_STANDARD ; 14 cycles - pop r0 - pop cnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;---------------------------------------------------------------------------- -; Transmitting data -;---------------------------------------------------------------------------- - -txByteLoop: -txBitloop: -stuffN1Delay: ; [03] - ror shift ;[-5] [11] [63] - brcc doExorN1 ;[-4] [64] - subi x3, 1 ;[-3] - brne commonN1 ;[-2] - lsl shift ;[-1] compensate ror after rjmp stuffDelay - nop ;[00] stuffing consists of just waiting 8 cycles - rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear - -sendNakAndReti: - ldi cnt, USBPID_NAK ;[-19] - rjmp sendCntAndReti ;[-18] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov r0, cnt ;[-16] - ldi YL, 0 ;[-15] R0 address is 0 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) or USBOUT = 0x01 -; K = (D+ = 1), (D- = 0) or USBOUT = 0x02 -; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles) - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte -;uses: x1...x3, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x3 = bitstuff cnt] -;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction) -usbSendAndReti: - in x2, USBDDR ;[-10] 10 cycles until SOP - ori x2, USBMASK ;[-9] - sbi USBOUT, USBMINUS ;[-8] prepare idle state; D+ and D- must have been 0 (no pullups) - out USBDDR, x2 ;[-6] <--- acquire bus - in x1, USBOUT ;[-5] port mirror for tx loop - ldi shift, 0x40 ;[-4] sync byte is first byte sent (we enter loop after ror) - ldi x2, USBMASK ;[-3] -doExorN1: - eor x1, x2 ;[-2] [06] [62] - ldi x3, 6 ;[-1] [07] [63] -commonN1: -stuffN2Delay: - out USBOUT, x1 ;[00] [08] [64] <--- set bit - ror shift ;[01] - brcc doExorN2 ;[02] - subi x3, 1 ;[03] - brne commonN2 ;[04] - lsl shift ;[05] compensate ror after rjmp stuffDelay - rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear -doExorN2: - eor x1, x2 ;[04] [12] - ldi x3, 6 ;[05] [13] -commonN2: - nop2 ;[06] [14] - subi cnt, 171 ;[08] [16] trick: (3 * 171) & 0xff = 1 - out USBOUT, x1 ;[09] [17] <--- set bit - brcs txBitloop ;[10] [27] [44] - -stuff6Delay: - ror shift ;[45] [53] - brcc doExor6 ;[46] - subi x3, 1 ;[47] - brne common6 ;[48] - lsl shift ;[49] compensate ror after rjmp stuffDelay - nop ;[50] stuffing consists of just waiting 8 cycles - rjmp stuff6Delay ;[51] after ror, C bit is reliably clear -doExor6: - eor x1, x2 ;[48] [56] - ldi x3, 6 ;[49] -common6: -stuff7Delay: - ror shift ;[50] [58] - out USBOUT, x1 ;[51] <--- set bit - brcc doExor7 ;[52] - subi x3, 1 ;[53] - brne common7 ;[54] - lsl shift ;[55] compensate ror after rjmp stuffDelay - rjmp stuff7Delay ;[56] after ror, C bit is reliably clear -doExor7: - eor x1, x2 ;[54] [62] - ldi x3, 6 ;[55] -common7: - ld shift, y+ ;[56] - nop ;[58] - tst cnt ;[59] - out USBOUT, x1 ;[60] [00]<--- set bit - brne txByteLoop ;[61] [01] -;make SE0: - cbr x1, USBMASK ;[02] prepare SE0 [spec says EOP may be 15 to 18 cycles] - lds x2, usbNewDeviceAddr;[03] - lsl x2 ;[05] we compare with left shifted address - subi YL, 2 + 0 ;[06] Only assign address on data packets, not ACK/NAK in r0 - sbci YH, 0 ;[07] - out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[01] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 0) - echo "$s\n"; - } -} - -function printBit($isAfterSet, $bitNum) -{ - ob_start(); - if($isAfterSet){ -?> - ifioclr USBIN, USBMINUS ;[00] <--- sample - rjmp bit#IsClr ;[01] - andi shift, ~(7 << #) ;[02] - breq unstuff#s ;[03] - in phase, USBIN ;[04] <- phase - rjmp bit@AfterSet ;[05] -unstuff#s: - in phase, USBIN ;[05] <- phase (one cycle too late) - andi fix, ~(1 << #) ;[06] - nop2 ;[-1] - nop2 ;[01] -bit#IsClr: - ifrset phase, USBMINUS ;[03] check phase only if D- changed - lpm ;[04] - in phase, USBIN ;[05] <- phase (one cycle too late) - ori shift, 1 << # ;[06] - - ifioset USBIN, USBMINUS ;[00] <--- sample - rjmp bit#IsSet ;[01] - andi shift, ~(7 << #) ;[02] - breq unstuff#c ;[03] - in phase, USBIN ;[04] <- phase - rjmp bit@AfterClr ;[05] -unstuff#c: - in phase, USBIN ;[05] <- phase (one cycle too late) - andi fix, ~(1 << #) ;[06] - nop2 ;[-1] - nop2 ;[01] -bit#IsSet: - ifrclr phase, USBMINUS ;[03] check phase only if D- changed - lpm ;[04] - in phase, USBIN ;[05] <- phase (one cycle too late) - ori shift, 1 << # ;[06] - -*****************************************************************************/ diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc deleted file mode 100644 index 401b7f8fff7..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc +++ /dev/null @@ -1,423 +0,0 @@ -/* Name: usbdrvasm15.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: contributed by V. Bosch - * Creation Date: 2007-08-06 - * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm15.inc 740 2009-04-13 18:23:31Z cs $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 15 MHz version of the asssembler part of the USB driver. It -requires a 15 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! -*/ - -;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 15 MHz -> 10.0 cycles per bit, 80.0 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - -;---------------------------------------------------------------------------- -; order of registers pushed: -; YL, SREG [sofError] YH, shift, x1, x2, x3, bitcnt, cnt, x4 -;---------------------------------------------------------------------------- -USB_INTR_VECTOR: - push YL ;2 push only what is necessary to sync with edge ASAP - in YL, SREG ;1 - push YL ;2 -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -; -; sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -; sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -;------------------------------------------------------------------------------- -; The following code results in a sampling window of < 1/4 bit -; which meets the spec. -;------------------------------------------------------------------------------- -waitForK: ;- - sbis USBIN, USBMINUS ;1 [00] <-- sample - rjmp foundK ;2 [01] - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -;------------------------------------------------------------------------------ -; {3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for -; center sampling] -; we have 1 bit time for setup purposes, then sample again. -; Numbers in brackets are cycles from center of first sync (double K) -; bit after the instruction -;------------------------------------------------------------------------------ -foundK: ;- [02] - lds YL, usbInputBufOffset;2 [03+04] tx loop - push YH ;2 [05+06] - clr YH ;1 [07] - subi YL, lo8(-(usbRxBuf)) ;1 [08] [rx loop init] - sbci YH, hi8(-(usbRxBuf)) ;1 [09] [rx loop init] - push shift ;2 [10+11] - ser shift ;1 [12] - sbis USBIN, USBMINUS ;1 [-1] [13] <--sample:we want two bits K (sample 1 cycle too early) - rjmp haveTwoBitsK ;2 [00] [14] - pop shift ;2 [15+16] undo the push from before - pop YH ;2 [17+18] undo the push from before - rjmp waitForK ;2 [19+20] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 20 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: ;- [01] - push x1 ;2 [02+03] - push x2 ;2 [04+05] - push x3 ;2 [06+07] - push bitcnt ;2 [08+09] - in x1, USBIN ;1 [00] [10] <-- sample bit 0 - bst x1, USBMINUS ;1 [01] - bld shift, 0 ;1 [02] - push cnt ;2 [03+04] - ldi cnt, USB_BUFSIZE ;1 [05] - push x4 ;2 [06+07] tx loop - rjmp rxLoop ;2 [08] -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -unstuff0: ;- [07] (branch taken) - andi x3, ~0x01 ;1 [08] - mov x1, x2 ;1 [09] x2 contains last sampled (stuffed) bit - in x2, USBIN ;1 [00] [10] <-- sample bit 1 again - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 1 - ori shift, 0x01 ;1 [03] 0b00000001 - nop ;1 [04] - rjmp didUnstuff0 ;2 [05] -;----------------------------------------------------- -unstuff1: ;- [05] (branch taken) - mov x2, x1 ;1 [06] x1 contains last sampled (stuffed) bit - andi x3, ~0x02 ;1 [07] - ori shift, 0x02 ;1 [08] 0b00000010 - nop ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 2 again - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 2 - rjmp didUnstuff1 ;2 [03] -;----------------------------------------------------- -unstuff2: ;- [05] (branch taken) - andi x3, ~0x04 ;1 [06] - ori shift, 0x04 ;1 [07] 0b00000100 - mov x1, x2 ;1 [08] x2 contains last sampled (stuffed) bit - nop ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample bit 3 - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 3 - rjmp didUnstuff2 ;2 [03] -;----------------------------------------------------- -unstuff3: ;- [00] [10] (branch taken) - in x2, USBIN ;1 [01] [11] <-- sample stuffed bit 3 one cycle too late - andi x2, USBMASK ;1 [02] - breq se0Hop ;1 [03] SE0 check for stuffed bit 3 - andi x3, ~0x08 ;1 [04] - ori shift, 0x08 ;1 [05] 0b00001000 - rjmp didUnstuff3 ;2 [06] -;---------------------------------------------------------------------------- -; extra jobs done during bit interval: -; -; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs], -; overflow check, jump to the head of rxLoop -; bit 1: SE0 check -; bit 2: SE0 check, recovery from delay [bit 0 tasks took too long] -; bit 3: SE0 check, recovery from delay [bit 0 tasks took too long] -; bit 4: SE0 check, none -; bit 5: SE0 check, none -; bit 6: SE0 check, none -; bit 7: SE0 check, reconstruct: x3 is 0 at bit locations we changed, 1 at others -;---------------------------------------------------------------------------- -rxLoop: ;- [09] - in x2, USBIN ;1 [00] [10] <-- sample bit 1 (or possibly bit 0 stuffed) - andi x2, USBMASK ;1 [01] - brne SkipSe0Hop ;1 [02] -se0Hop: ;- [02] - rjmp se0 ;2 [03] SE0 check for bit 1 -SkipSe0Hop: ;- [03] - ser x3 ;1 [04] - andi shift, 0xf9 ;1 [05] 0b11111001 - breq unstuff0 ;1 [06] -didUnstuff0: ;- [06] - eor x1, x2 ;1 [07] - bst x1, USBMINUS ;1 [08] - bld shift, 1 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 2 (or possibly bit 1 stuffed) - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 2 - andi shift, 0xf3 ;1 [03] 0b11110011 - breq unstuff1 ;1 [04] do remaining work for bit 1 -didUnstuff1: ;- [04] - eor x2, x1 ;1 [05] - bst x2, USBMINUS ;1 [06] - bld shift, 2 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 3 (or possibly bit 2 stuffed) - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 3 - andi shift, 0xe7 ;1 [03] 0b11100111 - breq unstuff2 ;1 [04] -didUnstuff2: ;- [04] - eor x1, x2 ;1 [05] - bst x1, USBMINUS ;1 [06] - bld shift, 3 ;1 [07] -didUnstuff3: ;- [07] - andi shift, 0xcf ;1 [08] 0b11001111 - breq unstuff3 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 4 - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 4 - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 4 ;1 [05] -didUnstuff4: ;- [05] - andi shift, 0x9f ;1 [06] 0b10011111 - breq unstuff4 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 5 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 5 - eor x1, x2 ;1 [03] - bst x1, USBMINUS ;1 [04] - bld shift, 5 ;1 [05] -didUnstuff5: ;- [05] - andi shift, 0x3f ;1 [06] 0b00111111 - breq unstuff5 ;1 [07] - nop2 ;2 [08+09] - in x1, USBIN ;1 [00] [10] <-- sample bit 6 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 6 - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 6 ;1 [05] -didUnstuff6: ;- [05] - cpi shift, 0x02 ;1 [06] 0b00000010 - brlo unstuff6 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 7 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 7 - eor x1, x2 ;1 [03] - bst x1, USBMINUS ;1 [04] - bld shift, 7 ;1 [05] -didUnstuff7: ;- [05] - cpi shift, 0x04 ;1 [06] 0b00000100 - brlo unstuff7 ;1 [07] - eor x3, shift ;1 [08] reconstruct: x3 is 0 at bit locations we changed, 1 at others - nop ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 0 - st y+, x3 ;2 [01+02] store data - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 0 ;1 [05] - subi cnt, 1 ;1 [06] - brcs overflow ;1 [07] - rjmp rxLoop ;2 [08] -;----------------------------------------------------- -unstuff4: ;- [08] - andi x3, ~0x10 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 4 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 4 - ori shift, 0x10 ;1 [03] - rjmp didUnstuff4 ;2 [04] -;----------------------------------------------------- -unstuff5: ;- [08] - ori shift, 0x20 ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 5 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 5 - andi x3, ~0x20 ;1 [03] - rjmp didUnstuff5 ;2 [04] -;----------------------------------------------------- -unstuff6: ;- [08] - andi x3, ~0x40 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 6 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 6 - ori shift, 0x40 ;1 [03] - rjmp didUnstuff6 ;2 [04] -;----------------------------------------------------- -unstuff7: ;- [08] - andi x3, ~0x80 ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 7 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 7 - ori shift, 0x80 ;1 [03] - rjmp didUnstuff7 ;2 [04] - -macro POP_STANDARD ; 16 cycles - pop x4 - pop cnt - pop bitcnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;--------------------------------------------------------------------------- -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies -;--------------------------------------------------------------------------- -bitstuffN: ;- [04] - eor x1, x4 ;1 [05] - clr x2 ;1 [06] - nop ;1 [07] - rjmp didStuffN ;1 [08] -;--------------------------------------------------------------------------- -bitstuff6: ;- [04] - eor x1, x4 ;1 [05] - clr x2 ;1 [06] - rjmp didStuff6 ;1 [07] -;--------------------------------------------------------------------------- -bitstuff7: ;- [02] - eor x1, x4 ;1 [03] - clr x2 ;1 [06] - nop ;1 [05] - rjmp didStuff7 ;1 [06] -;--------------------------------------------------------------------------- -sendNakAndReti: ;- [-19] - ldi x3, USBPID_NAK ;1 [-18] - rjmp sendX3AndReti ;1 [-17] -;--------------------------------------------------------------------------- -sendAckAndReti: ;- [-17] - ldi cnt, USBPID_ACK ;1 [-16] -sendCntAndReti: ;- [-16] - mov x3, cnt ;1 [-15] -sendX3AndReti: ;- [-15] - ldi YL, 20 ;1 [-14] x3==r20 address is 20 - ldi YH, 0 ;1 [-13] - ldi cnt, 2 ;1 [-12] -; rjmp usbSendAndReti fallthrough -;--------------------------------------------------------------------------- -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -;We need not to match the transfer rate exactly because the spec demands -;only 1.5% precision anyway. -usbSendAndReti: ;- [-13] 13 cycles until SOP - in x2, USBDDR ;1 [-12] - ori x2, USBMASK ;1 [-11] - sbi USBOUT, USBMINUS ;2 [-09-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;1 [-08] port mirror for tx loop - out USBDDR, x2 ;1 [-07] <- acquire bus - ; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;1 [-06] exor mask - ldi shift, 0x80 ;1 [-05] sync byte is first byte sent - ldi bitcnt, 6 ;1 [-04] -txBitLoop: ;- [-04] [06] - sbrs shift, 0 ;1 [-03] [07] - eor x1, x4 ;1 [-02] [08] - ror shift ;1 [-01] [09] -didStuffN: ;- [09] - out USBOUT, x1 ;1 [00] [10] <-- out N - ror x2 ;1 [01] - cpi x2, 0xfc ;1 [02] - brcc bitstuffN ;1 [03] - dec bitcnt ;1 [04] - brne txBitLoop ;1 [05] - sbrs shift, 0 ;1 [06] - eor x1, x4 ;1 [07] - ror shift ;1 [08] -didStuff6: ;- [08] - nop ;1 [09] - out USBOUT, x1 ;1 [00] [10] <-- out 6 - ror x2 ;1 [01] - cpi x2, 0xfc ;1 [02] - brcc bitstuff6 ;1 [03] - sbrs shift, 0 ;1 [04] - eor x1, x4 ;1 [05] - ror shift ;1 [06] - ror x2 ;1 [07] -didStuff7: ;- [07] - ldi bitcnt, 6 ;1 [08] - cpi x2, 0xfc ;1 [09] - out USBOUT, x1 ;1 [00] [10] <-- out 7 - brcc bitstuff7 ;1 [01] - ld shift, y+ ;2 [02+03] - dec cnt ;1 [04] - brne txBitLoop ;1 [05] -makeSE0: - cbr x1, USBMASK ;1 [06] prepare SE0 [spec says EOP may be 19 to 23 cycles] - lds x2, usbNewDeviceAddr;2 [07+08] - lsl x2 ;1 [09] we compare with left shifted address -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - out USBOUT, x1 ;1 [00] [10] <-- out SE0-- from now 2 bits==20 cycl. until bus idle - subi YL, 20 + 2 ;1 [01] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;1 [02] - breq skipAddrAssign ;1 [03] - sts usbDeviceAddr, x2 ;2 [04+05] if not skipped: SE0 is one cycle longer -;---------------------------------------------------------------------------- -;end of usbDeviceAddress transfer -skipAddrAssign: ;- [03/04] - ldi x2, 1< 10.6666666 cycles per bit, 85.333333333 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt - push YL ;[-25] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-23] - push YL ;[-22] - push YH ;[-20] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-15] - rjmp foundK ;[-14] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-12] -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push bitcnt ;[-12] -; [---] ;[-11] - lds YL, usbInputBufOffset;[-10] -; [---] ;[-9] - clr YH ;[-8] - subi YL, lo8(-(usbRxBuf));[-7] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-6] [rx loop init] - push shift ;[-5] -; [---] ;[-4] - ldi bitcnt, 0x55 ;[-3] [rx loop init] - sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) - rjmp haveTwoBitsK ;[-1] - pop shift ;[0] undo the push from before - pop bitcnt ;[2] undo the push from before - rjmp waitForK ;[4] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 21 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[1] - push x2 ;[3] - push x3 ;[5] - ldi shift, 0 ;[7] - ldi x3, 1<<4 ;[8] [rx loop init] first sample is inverse bit, compensate that - push x4 ;[9] == leap - - in x1, USBIN ;[11] <-- sample bit 0 - andi x1, USBMASK ;[12] - bst x1, USBMINUS ;[13] - bld shift, 7 ;[14] - push cnt ;[15] - ldi leap, 0 ;[17] [rx loop init] - ldi cnt, USB_BUFSIZE;[18] [rx loop init] - rjmp rxbit1 ;[19] arrives at [21] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- - -; duration of unstuffing code should be 10.66666667 cycles. We adjust "leap" -; accordingly to approximate this value in the long run. - -unstuff6: - andi x2, USBMASK ;[03] - ori x3, 1<<6 ;[04] will not be shifted any more - andi shift, ~0x80;[05] - mov x1, x2 ;[06] sampled bit 7 is actually re-sampled bit 6 - subi leap, -1 ;[07] total duration = 11 bits -> subtract 1/3 - rjmp didUnstuff6 ;[08] - -unstuff7: - ori x3, 1<<7 ;[09] will not be shifted any more - in x2, USBIN ;[00] [10] re-sample bit 7 - andi x2, USBMASK ;[01] - andi shift, ~0x80;[02] - subi leap, 2 ;[03] total duration = 10 bits -> add 1/3 - rjmp didUnstuff7 ;[04] - -unstuffEven: - ori x3, 1<<6 ;[09] will be shifted right 6 times for bit 0 - in x1, USBIN ;[00] [10] - andi shift, ~0x80;[01] - andi x1, USBMASK ;[02] - breq se0 ;[03] - subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3 - nop2 ;[05] - rjmp didUnstuffE ;[06] - -unstuffOdd: - ori x3, 1<<5 ;[09] will be shifted right 4 times for bit 1 - in x2, USBIN ;[00] [10] - andi shift, ~0x80;[01] - andi x2, USBMASK ;[02] - breq se0 ;[03] - subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3 - nop2 ;[05] - rjmp didUnstuffO ;[06] - -rxByteLoop: - andi x1, USBMASK ;[03] - eor x2, x1 ;[04] - subi leap, 1 ;[05] - brpl skipLeap ;[06] - subi leap, -3 ;1 one leap cycle every 3rd byte -> 85 + 1/3 cycles per byte - nop ;1 -skipLeap: - subi x2, 1 ;[08] - ror shift ;[09] -didUnstuff6: - cpi shift, 0xfc ;[10] - in x2, USBIN ;[00] [11] <-- sample bit 7 - brcc unstuff6 ;[01] - andi x2, USBMASK ;[02] - eor x1, x2 ;[03] - subi x1, 1 ;[04] - ror shift ;[05] -didUnstuff7: - cpi shift, 0xfc ;[06] - brcc unstuff7 ;[07] - eor x3, shift ;[08] reconstruct: x3 is 1 at bit locations we changed, 0 at others - st y+, x3 ;[09] store data -rxBitLoop: - in x1, USBIN ;[00] [11] <-- sample bit 0/2/4 - andi x1, USBMASK ;[01] - eor x2, x1 ;[02] - andi x3, 0x3f ;[03] topmost two bits reserved for 6 and 7 - subi x2, 1 ;[04] - ror shift ;[05] - cpi shift, 0xfc ;[06] - brcc unstuffEven ;[07] -didUnstuffE: - lsr x3 ;[08] - lsr x3 ;[09] -rxbit1: - in x2, USBIN ;[00] [10] <-- sample bit 1/3/5 - andi x2, USBMASK ;[01] - breq se0 ;[02] - eor x1, x2 ;[03] - subi x1, 1 ;[04] - ror shift ;[05] - cpi shift, 0xfc ;[06] - brcc unstuffOdd ;[07] -didUnstuffO: - subi bitcnt, 0xab;[08] == addi 0x55, 0x55 = 0x100/3 - brcs rxBitLoop ;[09] - - subi cnt, 1 ;[10] - in x1, USBIN ;[00] [11] <-- sample bit 6 - brcc rxByteLoop ;[01] - rjmp overflow - -macro POP_STANDARD ; 14 cycles - pop cnt - pop x4 - pop x3 - pop x2 - pop x1 - pop shift - pop bitcnt - endm -macro POP_RETI ; 7 cycles - pop YH - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies - -bitstuffN: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] - nop2 ;[7] - nop ;[9] - out USBOUT, x1 ;[10] <-- out - rjmp didStuffN ;[0] - -bitstuff6: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] Carry is zero due to brcc - rol shift ;[7] compensate for ror shift at branch destination - rjmp didStuff6 ;[8] - -bitstuff7: - ldi x2, 0 ;[2] Carry is zero due to brcc - rjmp didStuff7 ;[3] - - -sendNakAndReti: - ldi x3, USBPID_NAK ;[-18] - rjmp sendX3AndReti ;[-17] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov x3, cnt ;[-16] -sendX3AndReti: - ldi YL, 20 ;[-15] x3==r20 address is 20 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -;We don't match the transfer rate exactly (don't insert leap cycles every third -;byte) because the spec demands only 1.5% precision anyway. -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-7] <- acquire bus -; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-6] exor mask - ldi shift, 0x80 ;[-5] sync byte is first byte sent -txByteLoop: - ldi bitcnt, 0x35 ;[-4] [6] binary 0011 0101 -txBitLoop: - sbrs shift, 0 ;[-3] [7] - eor x1, x4 ;[-2] [8] - out USBOUT, x1 ;[-1] [9] <-- out N - ror shift ;[0] [10] - ror x2 ;[1] -didStuffN: - cpi x2, 0xfc ;[2] - brcc bitstuffN ;[3] - lsr bitcnt ;[4] - brcc txBitLoop ;[5] - brne txBitLoop ;[6] - - sbrs shift, 0 ;[7] - eor x1, x4 ;[8] -didStuff6: - out USBOUT, x1 ;[-1] [9] <-- out 6 - ror shift ;[0] [10] - ror x2 ;[1] - cpi x2, 0xfc ;[2] - brcc bitstuff6 ;[3] - ror shift ;[4] -didStuff7: - ror x2 ;[5] - sbrs x2, 7 ;[6] - eor x1, x4 ;[7] - nop ;[8] - cpi x2, 0xfc ;[9] - out USBOUT, x1 ;[-1][10] <-- out 7 - brcc bitstuff7 ;[0] [11] - ld shift, y+ ;[1] - dec cnt ;[3] - brne txByteLoop ;[4] -;make SE0: - cbr x1, USBMASK ;[5] prepare SE0 [spec says EOP may be 21 to 25 cycles] - lds x2, usbNewDeviceAddr;[6] - lsl x2 ;[8] we compare with left shifted address - subi YL, 20 + 2 ;[9] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[10] - out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[0] - sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< max 52 cycles interrupt disable -;max stack usage: [ret(2), r0, SREG, YL, YH, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 16.5 MHz -> 11 cycles per bit -; 16.3125 MHz < F_CPU < 16.6875 MHz (+/- 1.1%) -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], r0, YH, shift, x1, x2, x3, x4, cnt - push YL ;[-23] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-21] - push YL ;[-20] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-15] - rjmp foundK ;[-14] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-12] -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push r0 ;[-12] -; [---] ;[-11] - push YH ;[-10] -; [---] ;[-9] - lds YL, usbInputBufOffset;[-8] -; [---] ;[-7] - clr YH ;[-6] - subi YL, lo8(-(usbRxBuf));[-5] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-4] [rx loop init] - mov r0, x2 ;[-3] [rx loop init] - sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) - rjmp haveTwoBitsK ;[-1] - pop YH ;[0] undo the pushes from before - pop r0 ;[2] - rjmp waitForK ;[4] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 22 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: ;[1] - push shift ;[1] - push x1 ;[3] - push x2 ;[5] - push x3 ;[7] - ldi shift, 0xff ;[9] [rx loop init] - ori x3, 0xff ;[10] [rx loop init] == ser x3, clear zero flag - - in x1, USBIN ;[11] <-- sample bit 0 - bst x1, USBMINUS ;[12] - bld shift, 0 ;[13] - push x4 ;[14] == phase -; [---] ;[15] - push cnt ;[16] -; [---] ;[17] - ldi phase, 0 ;[18] [rx loop init] - ldi cnt, USB_BUFSIZE;[19] [rx loop init] - rjmp rxbit1 ;[20] -; [---] ;[21] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -/* -byte oriented operations done during loop: -bit 0: store data -bit 1: SE0 check -bit 2: overflow check -bit 3: catch up -bit 4: rjmp to achieve conditional jump range -bit 5: PLL -bit 6: catch up -bit 7: jump, fixup bitstuff -; 87 [+ 2] cycles ------------------------------------------------------------------- -*/ -continueWithBit5: - in x2, USBIN ;[055] <-- bit 5 - eor r0, x2 ;[056] - or phase, r0 ;[057] - sbrc phase, USBMINUS ;[058] - lpm ;[059] optional nop3; modifies r0 - in phase, USBIN ;[060] <-- phase - eor x1, x2 ;[061] - bst x1, USBMINUS ;[062] - bld shift, 5 ;[063] - andi shift, 0x3f ;[064] - in x1, USBIN ;[065] <-- bit 6 - breq unstuff5 ;[066] *** unstuff escape - eor phase, x1 ;[067] - eor x2, x1 ;[068] - bst x2, USBMINUS ;[069] - bld shift, 6 ;[070] -didUnstuff6: ;[ ] - in r0, USBIN ;[071] <-- phase - cpi shift, 0x02 ;[072] - brlo unstuff6 ;[073] *** unstuff escape -didUnstuff5: ;[ ] - nop2 ;[074] -; [---] ;[075] - in x2, USBIN ;[076] <-- bit 7 - eor x1, x2 ;[077] - bst x1, USBMINUS ;[078] - bld shift, 7 ;[079] -didUnstuff7: ;[ ] - eor r0, x2 ;[080] - or phase, r0 ;[081] - in r0, USBIN ;[082] <-- phase - cpi shift, 0x04 ;[083] - brsh rxLoop ;[084] -; [---] ;[085] -unstuff7: ;[ ] - andi x3, ~0x80 ;[085] - ori shift, 0x80 ;[086] - in x2, USBIN ;[087] <-- sample stuffed bit 7 - nop ;[088] - rjmp didUnstuff7 ;[089] -; [---] ;[090] - ;[080] - -unstuff5: ;[067] - eor phase, x1 ;[068] - andi x3, ~0x20 ;[069] - ori shift, 0x20 ;[070] - in r0, USBIN ;[071] <-- phase - mov x2, x1 ;[072] - nop ;[073] - nop2 ;[074] -; [---] ;[075] - in x1, USBIN ;[076] <-- bit 6 - eor r0, x1 ;[077] - or phase, r0 ;[078] - eor x2, x1 ;[079] - bst x2, USBMINUS ;[080] - bld shift, 6 ;[081] no need to check bitstuffing, we just had one - in r0, USBIN ;[082] <-- phase - rjmp didUnstuff5 ;[083] -; [---] ;[084] - ;[074] - -unstuff6: ;[074] - andi x3, ~0x40 ;[075] - in x1, USBIN ;[076] <-- bit 6 again - ori shift, 0x40 ;[077] - nop2 ;[078] -; [---] ;[079] - rjmp didUnstuff6 ;[080] -; [---] ;[081] - ;[071] - -unstuff0: ;[013] - eor r0, x2 ;[014] - or phase, r0 ;[015] - andi x2, USBMASK ;[016] check for SE0 - in r0, USBIN ;[017] <-- phase - breq didUnstuff0 ;[018] direct jump to se0 would be too long - andi x3, ~0x01 ;[019] - ori shift, 0x01 ;[020] - mov x1, x2 ;[021] mov existing sample - in x2, USBIN ;[022] <-- bit 1 again - rjmp didUnstuff0 ;[023] -; [---] ;[024] - ;[014] - -unstuff1: ;[024] - eor r0, x1 ;[025] - or phase, r0 ;[026] - andi x3, ~0x02 ;[027] - in r0, USBIN ;[028] <-- phase - ori shift, 0x02 ;[029] - mov x2, x1 ;[030] - rjmp didUnstuff1 ;[031] -; [---] ;[032] - ;[022] - -unstuff2: ;[035] - eor r0, x2 ;[036] - or phase, r0 ;[037] - andi x3, ~0x04 ;[038] - in r0, USBIN ;[039] <-- phase - ori shift, 0x04 ;[040] - mov x1, x2 ;[041] - rjmp didUnstuff2 ;[042] -; [---] ;[043] - ;[033] - -unstuff3: ;[043] - in x2, USBIN ;[044] <-- bit 3 again - eor r0, x2 ;[045] - or phase, r0 ;[046] - andi x3, ~0x08 ;[047] - ori shift, 0x08 ;[048] - nop ;[049] - in r0, USBIN ;[050] <-- phase - rjmp didUnstuff3 ;[051] -; [---] ;[052] - ;[042] - -unstuff4: ;[053] - andi x3, ~0x10 ;[054] - in x1, USBIN ;[055] <-- bit 4 again - ori shift, 0x10 ;[056] - rjmp didUnstuff4 ;[057] -; [---] ;[058] - ;[048] - -rxLoop: ;[085] - eor x3, shift ;[086] reconstruct: x3 is 0 at bit locations we changed, 1 at others - in x1, USBIN ;[000] <-- bit 0 - st y+, x3 ;[001] -; [---] ;[002] - eor r0, x1 ;[003] - or phase, r0 ;[004] - eor x2, x1 ;[005] - in r0, USBIN ;[006] <-- phase - ser x3 ;[007] - bst x2, USBMINUS ;[008] - bld shift, 0 ;[009] - andi shift, 0xf9 ;[010] -rxbit1: ;[ ] - in x2, USBIN ;[011] <-- bit 1 - breq unstuff0 ;[012] *** unstuff escape - andi x2, USBMASK ;[013] SE0 check for bit 1 -didUnstuff0: ;[ ] Z only set if we detected SE0 in bitstuff - breq se0 ;[014] - eor r0, x2 ;[015] - or phase, r0 ;[016] - in r0, USBIN ;[017] <-- phase - eor x1, x2 ;[018] - bst x1, USBMINUS ;[019] - bld shift, 1 ;[020] - andi shift, 0xf3 ;[021] -didUnstuff1: ;[ ] - in x1, USBIN ;[022] <-- bit 2 - breq unstuff1 ;[023] *** unstuff escape - eor r0, x1 ;[024] - or phase, r0 ;[025] - subi cnt, 1 ;[026] overflow check - brcs overflow ;[027] - in r0, USBIN ;[028] <-- phase - eor x2, x1 ;[029] - bst x2, USBMINUS ;[030] - bld shift, 2 ;[031] - andi shift, 0xe7 ;[032] -didUnstuff2: ;[ ] - in x2, USBIN ;[033] <-- bit 3 - breq unstuff2 ;[034] *** unstuff escape - eor r0, x2 ;[035] - or phase, r0 ;[036] - eor x1, x2 ;[037] - bst x1, USBMINUS ;[038] - in r0, USBIN ;[039] <-- phase - bld shift, 3 ;[040] - andi shift, 0xcf ;[041] -didUnstuff3: ;[ ] - breq unstuff3 ;[042] *** unstuff escape - nop ;[043] - in x1, USBIN ;[044] <-- bit 4 - eor x2, x1 ;[045] - bst x2, USBMINUS ;[046] - bld shift, 4 ;[047] -didUnstuff4: ;[ ] - eor r0, x1 ;[048] - or phase, r0 ;[049] - in r0, USBIN ;[050] <-- phase - andi shift, 0x9f ;[051] - breq unstuff4 ;[052] *** unstuff escape - rjmp continueWithBit5;[053] -; [---] ;[054] - -macro POP_STANDARD ; 16 cycles - pop cnt - pop x4 - pop x3 - pop x2 - pop x1 - pop shift - pop YH - pop r0 - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies - -bitstuff7: - eor x1, x4 ;[4] - ldi x2, 0 ;[5] - nop2 ;[6] C is zero (brcc) - rjmp didStuff7 ;[8] - -bitstuffN: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] - lpm ;[7] 3 cycle NOP, modifies r0 - out USBOUT, x1 ;[10] <-- out - rjmp didStuffN ;[0] - -#define bitStatus x3 - -sendNakAndReti: - ldi cnt, USBPID_NAK ;[-19] - rjmp sendCntAndReti ;[-18] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov r0, cnt ;[-16] - ldi YL, 0 ;[-15] R0 address is 0 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-7] <- acquire bus -; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-6] exor mask - ldi shift, 0x80 ;[-5] sync byte is first byte sent - ldi bitStatus, 0xff ;[-4] init bit loop counter, works for up to 12 bytes -byteloop: -bitloop: - sbrs shift, 0 ;[8] [-3] - eor x1, x4 ;[9] [-2] - out USBOUT, x1 ;[10] [-1] <-- out - ror shift ;[0] - ror x2 ;[1] -didStuffN: - cpi x2, 0xfc ;[2] - brcc bitstuffN ;[3] - nop ;[4] - subi bitStatus, 37 ;[5] 256 / 7 ~=~ 37 - brcc bitloop ;[6] when we leave the loop, bitStatus has almost the initial value - sbrs shift, 0 ;[7] - eor x1, x4 ;[8] - ror shift ;[9] -didStuff7: - out USBOUT, x1 ;[10] <-- out - ror x2 ;[0] - cpi x2, 0xfc ;[1] - brcc bitstuff7 ;[2] - ld shift, y+ ;[3] - dec cnt ;[5] - brne byteloop ;[6] -;make SE0: - cbr x1, USBMASK ;[7] prepare SE0 [spec says EOP may be 21 to 25 cycles] - lds x2, usbNewDeviceAddr;[8] - lsl x2 ;[10] we compare with left shifted address - out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - subi YL, 2 ;[0] Only assign address on data packets, not ACK/NAK in r0 - sbci YH, 0 ;[1] - breq skipAddrAssign ;[2] - sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 12 cycles per bit -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts -;register use in receive loop to receive the data bytes: -; shift assembles the byte currently being received -; x1 holds the D+ and D- line state -; x2 holds the previous line state -; cnt holds the number of bytes left in the receive buffer -; x3 holds the higher crc byte (see algorithm below) -; x4 is used as temporary register for the crc algorithm -; x5 is used for unstuffing: when unstuffing the last received bit is inverted in shift (to prevent further -; unstuffing calls. In the same time the corresponding bit in x5 is cleared to mark the bit as beening iverted -; zl lower crc value and crc table index -; zh used for crc table accesses - -;-------------------------------------------------------------------------------------------------------------- -; CRC mods: -; table driven crc checker, Z points to table in prog space -; ZL is the lower crc byte, x3 is the higher crc byte -; x4 is used as temp register to store different results -; the initialization of the crc register is not 0xFFFF but 0xFE54. This is because during the receipt of the -; first data byte an virtual zero data byte is added to the crc register, this results in the correct initial -; value of 0xFFFF at beginning of the second data byte before the first data byte is added to the crc. -; The magic number 0xFE54 results form the crc table: At tabH[0x54] = 0xFF = crcH (required) and -; tabL[0x54] = 0x01 -> crcL = 0x01 xor 0xFE = 0xFF -; bitcnt is renamed to x5 and is used for unstuffing purposes, the unstuffing works like in the 12MHz version -;-------------------------------------------------------------------------------------------------------------- -; CRC algorithm: -; The crc register is formed by x3 (higher byte) and ZL (lower byte). The algorithm uses a 'reversed' form -; i.e. that it takes the least significant bit first and shifts to the right. So in fact the highest order -; bit seen from the polynomial devision point of view is the lsb of ZL. (If this sounds strange to you i -; propose a research on CRC :-) ) -; Each data byte received is xored to ZL, the lower crc byte. This byte now builds the crc -; table index. Next the new high byte is loaded from the table and stored in x4 until we have space in x3 -; (its destination). -; Afterwards the lower table is loaded from the table and stored in ZL (the old index is overwritten as -; we don't need it anymore. In fact this is a right shift by 8 bits.) Now the old crc high value is xored -; to ZL, this is the second shift of the old crc value. Now x4 (the temp reg) is moved to x3 and the crc -; calculation is done. -; Prior to the first byte the two CRC register have to be initialized to 0xFFFF (as defined in usb spec) -; however the crc engine also runs during the receipt of the first byte, therefore x3 and zl are initialized -; to a magic number which results in a crc value of 0xFFFF after the first complete byte. -; -; This algorithm is split into the extra cycles of the different bits: -; bit7: XOR the received byte to ZL -; bit5: load the new high byte to x4 -; bit6: load the lower xor byte from the table, xor zl and x3, store result in zl (=the new crc low value) -; move x4 (the new high byte) to x3, the crc value is ready -; - - -macro POP_STANDARD ; 18 cycles - pop ZH - pop ZL - pop cnt - pop x5 - pop x3 - pop x2 - pop x1 - pop shift - pop x4 - endm -macro POP_RETI ; 7 cycles - pop YH - pop YL - out SREG, YL - pop YL - endm - -macro CRC_CLEANUP_AND_CHECK - ; the last byte has already been xored with the lower crc byte, we have to do the table lookup and xor - ; x3 is the higher crc byte, zl the lower one - ldi ZH, hi8(usbCrcTableHigh);[+1] get the new high byte from the table - lpm x2, Z ;[+2][+3][+4] - ldi ZH, hi8(usbCrcTableLow);[+5] get the new low xor byte from the table - lpm ZL, Z ;[+6][+7][+8] - eor ZL, x3 ;[+7] xor the old high byte with the value from the table, x2:ZL now holds the crc value - cpi ZL, 0x01 ;[+8] if the crc is ok we have a fixed remainder value of 0xb001 in x2:ZL (see usb spec) - brne ignorePacket ;[+9] detected a crc fault -> paket is ignored and retransmitted by the host - cpi x2, 0xb0 ;[+10] - brne ignorePacket ;[+11] detected a crc fault -> paket is ignored and retransmitted by the host - endm - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG, YH, [sofError], x4, shift, x1, x2, x3, x5, cnt, ZL, ZH - push YL ;[-28] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-26] - push YL ;[-25] - push YH ;[-23] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-17] - rjmp foundK ;[-16] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-15] -;{3, 5} after falling D- edge, average delay: 4 cycles -;bit0 should be at 30 (2.5 bits) for center sampling. Currently at 4 so 26 cylces till bit 0 sample -;use 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push x4 ;[-14] -; [---] ;[-13] - lds YL, usbInputBufOffset;[-12] used to toggle the two usb receive buffers -; [---] ;[-11] - clr YH ;[-10] - subi YL, lo8(-(usbRxBuf));[-9] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-8] [rx loop init] - push shift ;[-7] -; [---] ;[-6] - ldi shift, 0x80 ;[-5] the last bit is the end of byte marker for the pid receiver loop - clc ;[-4] the carry has to be clear for receipt of pid bit 0 - sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early) - rjmp haveTwoBitsK ;[-2] - pop shift ;[-1] undo the push from before - pop x4 ;[1] - rjmp waitForK ;[3] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 24 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[0] - push x2 ;[2] - push x3 ;[4] crc high byte - ldi x2, 1< jump back and store the byte - ori shift, 0x01 ;[11] invert the last received bit to prevent furhter unstuffing - in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - andi x5, 0xFE ;[1] mark this bit as inverted (will be corrected before storing shift) - eor x1, x2 ;[2] x1 and x2 have to be different because the stuff bit is always a zero - andi x1, USBMASK ;[3] mask the interesting bits - breq stuffErr ;[4] if the stuff bit is a 1-bit something went wrong - mov x1, x2 ;[5] the next bit expects the last state to be in x1 - rjmp didunstuff0 ;[6] - ;[7] jump delay of rjmp didunstuffX - -unstuff1: ;[11] this is the jump delay of breq unstuffX - in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - ori shift, 0x02 ;[1] invert the last received bit to prevent furhter unstuffing - andi x5, 0xFD ;[2] mark this bit as inverted (will be corrected before storing shift) - eor x2, x1 ;[3] x1 and x2 have to be different because the stuff bit is always a zero - andi x2, USBMASK ;[4] mask the interesting bits - breq stuffErr ;[5] if the stuff bit is a 1-bit something went wrong - mov x2, x1 ;[6] the next bit expects the last state to be in x2 - nop2 ;[7] - ;[8] - rjmp didunstuff1 ;[9] - ;[10] jump delay of rjmp didunstuffX - -unstuff2: ;[9] this is the jump delay of breq unstuffX - ori shift, 0x04 ;[10] invert the last received bit to prevent furhter unstuffing - andi x5, 0xFB ;[11] mark this bit as inverted (will be corrected before storing shift) - in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - eor x1, x2 ;[1] x1 and x2 have to be different because the stuff bit is always a zero - andi x1, USBMASK ;[2] mask the interesting bits - breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong - mov x1, x2 ;[4] the next bit expects the last state to be in x1 - nop2 ;[5] - ;[6] - rjmp didunstuff2 ;[7] - ;[8] jump delay of rjmp didunstuffX - -unstuff3: ;[9] this is the jump delay of breq unstuffX - ori shift, 0x08 ;[10] invert the last received bit to prevent furhter unstuffing - andi x5, 0xF7 ;[11] mark this bit as inverted (will be corrected before storing shift) - in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - eor x2, x1 ;[1] x1 and x2 have to be different because the stuff bit is always a zero - andi x2, USBMASK ;[2] mask the interesting bits - breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong - mov x2, x1 ;[4] the next bit expects the last state to be in x2 - nop2 ;[5] - ;[6] - rjmp didunstuff3 ;[7] - ;[8] jump delay of rjmp didunstuffX - - - -; the include has to be here due to branch distance restirctions -#define __USE_CRC__ -#include "asmcommon.inc" - - - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies -; 7.5 bit times is 90 cycles. ...there is plenty of time - - -sendNakAndReti: - ldi x3, USBPID_NAK ;[-18] - rjmp sendX3AndReti ;[-17] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov x3, cnt ;[-16] -sendX3AndReti: - ldi YL, 20 ;[-15] x3==r20 address is 20 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent - -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-6] <- acquire bus - ldi x2, 0 ;[-6] init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-5] exor mask - ldi shift, 0x80 ;[-4] sync byte is first byte sent -txByteLoop: - ldi bitcnt, 0x40 ;[-3]=[9] binary 01000000 -txBitLoop: ; the loop sends the first 7 bits of the byte - sbrs shift, 0 ;[-2]=[10] if we have to send a 1 don't change the line state - eor x1, x4 ;[-1]=[11] - out USBOUT, x1 ;[0] - ror shift ;[1] - ror x2 ;[2] transfers the last sent bit to the stuffing history -didStuffN: - nop ;[3] - nop ;[4] - cpi x2, 0xfc ;[5] if we sent six consecutive ones - brcc bitstuffN ;[6] - lsr bitcnt ;[7] - brne txBitLoop ;[8] restart the loop while the 1 is still in the bitcount - -; transmit bit 7 - sbrs shift, 0 ;[9] - eor x1, x4 ;[10] -didStuff7: - ror shift ;[11] - out USBOUT, x1 ;[0] transfer bit 7 to the pins - ror x2 ;[1] move the bit into the stuffing history - cpi x2, 0xfc ;[2] - brcc bitstuff7 ;[3] - ld shift, y+ ;[4] get next byte to transmit - dec cnt ;[5] decrement byte counter - brne txByteLoop ;[7] if we have more bytes start next one - ;[8] branch delay - -;make SE0: - cbr x1, USBMASK ;[8] prepare SE0 [spec says EOP may be 25 to 30 cycles] - lds x2, usbNewDeviceAddr;[9] - lsl x2 ;[11] we compare with left shifted address - out USBOUT, x1 ;[0] <-- out SE0 -- from now 2 bits = 24 cycles until bus idle - subi YL, 20 + 2 ;[1] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[2] -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[3] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< -int main (int argc, char **argv) -{ - int i, j; - for (i=0; i<512; i++){ - unsigned short crc = i & 0xff; - for(j=0; j<8; j++) crc = (crc >> 1) ^ ((crc & 1) ? 0xa001 : 0); - if((i & 7) == 0) printf("\n.byte "); - printf("0x%02x, ", (i > 0xff ? (crc >> 8) : crc) & 0xff); - if(i == 255) printf("\n"); - } - return 0; -} - -// Use the following algorithm to compute CRC values: -ushort computeCrc(uchar *msg, uchar msgLen) -{ - uchar i; - ushort crc = 0xffff; - for(i = 0; i < msgLen; i++) - crc = usbCrcTable16[lo8(crc) ^ msg[i]] ^ hi8(crc); - return crc; -} -*/ - -.balign 256 -usbCrcTableLow: -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 - -; .balign 256 -usbCrcTableHigh: -.byte 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2 -.byte 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04 -.byte 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E -.byte 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8 -.byte 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A -.byte 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC -.byte 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6 -.byte 0xD2, 0x12, 0x13, 0xD3, 0x11, 0xD1, 0xD0, 0x10 -.byte 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32 -.byte 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4 -.byte 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE -.byte 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38 -.byte 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA -.byte 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C -.byte 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26 -.byte 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0 -.byte 0xA0, 0x60, 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62 -.byte 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4 -.byte 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE -.byte 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68 -.byte 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA -.byte 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C -.byte 0xB4, 0x74, 0x75, 0xB5, 0x77, 0xB7, 0xB6, 0x76 -.byte 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0 -.byte 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92 -.byte 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54 -.byte 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E -.byte 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98 -.byte 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A -.byte 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C -.byte 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86 -.byte 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40 - diff --git a/tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc deleted file mode 100644 index 303abaf64c7..00000000000 --- a/tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc +++ /dev/null @@ -1,360 +0,0 @@ -/* Name: usbdrvasm20.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Jeroen Benschop - * Based on usbdrvasm16.inc from Christian Starkjohann - * Creation Date: 2008-03-05 - * Tabsize: 4 - * Copyright: (c) 2008 by Jeroen Benschop and OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm20.inc 740 2009-04-13 18:23:31Z cs $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 20 MHz version of the asssembler part of the USB driver. It -requires a 20 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! -*/ - -#define leap2 x3 -#ifdef __IAR_SYSTEMS_ASM__ -#define nextInst $+2 -#else -#define nextInst .+0 -#endif - -;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 20 MHz -> 13.333333 cycles per bit, 106.666667 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts -;register use in receive loop: -; shift assembles the byte currently being received -; x1 holds the D+ and D- line state -; x2 holds the previous line state -; x4 (leap) is used to add a leap cycle once every three bytes received -; X3 (leap2) is used to add a leap cycle once every three stuff bits received -; bitcnt is used to determine when a stuff bit is due -; cnt holds the number of bytes left in the receive buffer - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt - push YL ;[-28] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-26] - push YL ;[-25] - push YH ;[-23] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-19] - rjmp foundK ;[-18] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-16] -;{3, 5} after falling D- edge, average delay: 4 cycles -;bit0 should be at 34 for center sampling. Currently at 4 so 30 cylces till bit 0 sample -;use 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push bitcnt ;[-16] -; [---] ;[-15] - lds YL, usbInputBufOffset;[-14] -; [---] ;[-13] - clr YH ;[-12] - subi YL, lo8(-(usbRxBuf));[-11] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-10] [rx loop init] - push shift ;[-9] -; [---] ;[-8] - ldi shift,0x40 ;[-7] set msb to "1" so processing bit7 can be detected - nop2 ;[-6] -; [---] ;[-5] - ldi bitcnt, 5 ;[-4] [rx loop init] - sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early) - rjmp haveTwoBitsK ;[-2] - pop shift ;[-1] undo the push from before - pop bitcnt ;[1] - rjmp waitForK ;[3] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 27 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[0] - push x2 ;[2] - push x3 ;[4] (leap2) - ldi leap2, 0x55 ;[6] add leap cycle on 2nd,5th,8th,... stuff bit - push x4 ;[7] == leap - ldi leap, 0x55 ;[9] skip leap cycle on 2nd,5th,8th,... byte received - push cnt ;[10] - ldi cnt, USB_BUFSIZE ;[12] [rx loop init] - ldi x2, 1< -#ifndef __IAR_SYSTEMS_ASM__ -# include -#endif - -#define __attribute__(arg) /* not supported on IAR */ - -#ifdef __IAR_SYSTEMS_ASM__ -# define __ASSEMBLER__ /* IAR does not define standard macro for asm */ -#endif - -#ifdef __HAS_ELPM__ -# define PROGMEM __farflash -#else -# define PROGMEM __flash -#endif - -#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) - -/* The following definitions are not needed by the driver, but may be of some - * help if you port a gcc based project to IAR. - */ -#define cli() __disable_interrupt() -#define sei() __enable_interrupt() -#define wdt_reset() __watchdog_reset() -#define _BV(x) (1 << (x)) - -/* assembler compatibility macros */ -#define nop2 rjmp $+2 /* jump to next instruction */ -#define XL r26 -#define XH r27 -#define YL r28 -#define YH r29 -#define ZL r30 -#define ZH r31 -#define lo8(x) LOW(x) -#define hi8(x) (((x)>>8) & 0xff) /* not HIGH to allow XLINK to make a proper range check */ - -/* Depending on the device you use, you may get problems with the way usbdrv.h - * handles the differences between devices. Since IAR does not use #defines - * for MCU registers, we can't check for the existence of a particular - * register with an #ifdef. If the autodetection mechanism fails, include - * definitions for the required USB_INTR_* macros in your usbconfig.h. See - * usbconfig-prototype.h and usbdrv.h for details. - */ - -/* ------------------------------------------------------------------------- */ -#elif __CODEVISIONAVR__ /* check for CodeVision AVR */ -/* ------------------------------------------------------------------------- */ -/* This port is not working (yet) */ - -/* #define F_CPU _MCU_CLOCK_FREQUENCY_ seems to be defined automatically */ - -#include -#include - -#define __attribute__(arg) /* not supported on IAR */ - -#define PROGMEM __flash -#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) - -#ifndef __ASSEMBLER__ -static inline void cli(void) -{ - #asm("cli"); -} -static inline void sei(void) -{ - #asm("sei"); -} -#endif -#define _delay_ms(t) delay_ms(t) -#define _BV(x) (1 << (x)) -#define USB_CFG_USE_SWITCH_STATEMENT 1 /* macro for if() cascase fails for unknown reason */ - -#define macro .macro -#define endm .endmacro -#define nop2 rjmp .+0 /* jump to next instruction */ - -/* ------------------------------------------------------------------------- */ -#else /* default development environment is avr-gcc/avr-libc */ -/* ------------------------------------------------------------------------- */ - -#include -#ifdef __ASSEMBLER__ -# define _VECTOR(N) __vector_ ## N /* io.h does not define this for asm */ -#else -# include -#endif - -#if USB_CFG_DRIVER_FLASH_PAGE -# define USB_READ_FLASH(addr) pgm_read_byte_far(((long)USB_CFG_DRIVER_FLASH_PAGE << 16) | (long)(addr)) -#else -# define USB_READ_FLASH(addr) pgm_read_byte(addr) -#endif - -#define macro .macro -#define endm .endm -#define nop2 rjmp .+0 /* jump to next instruction */ - -#endif /* development environment */ - -/* for conveniecne, ensure that PRG_RDB exists */ -#ifndef PRG_RDB -# define PRG_RDB(addr) USB_READ_FLASH(addr) -#endif -#endif /* __usbportability_h_INCLUDED__ */ diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 4c8e6003fe8..5feff889a1a 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 . #include #include #include -#include "usbdrv.h" +#include #include "usbconfig.h" #include "host.h" #include "report.h" @@ -290,12 +290,12 @@ usbMsgLen_t usbFunctionSetup(uchar data[8]) { if (rq->bRequest == USBRQ_HID_GET_REPORT) { debug("GET_REPORT:"); /* we only have one report type, so don't look at wValue */ - usbMsgPtr = (void *)&keyboard_report; + usbMsgPtr = (usbMsgPtr_t)&keyboard_report; return sizeof(keyboard_report); } else if (rq->bRequest == USBRQ_HID_GET_IDLE) { debug("GET_IDLE: "); // debug_hex(vusb_idle_rate); - usbMsgPtr = &vusb_idle_rate; + usbMsgPtr = (usbMsgPtr_t)&vusb_idle_rate; return 1; } else if (rq->bRequest == USBRQ_HID_SET_IDLE) { vusb_idle_rate = rq->wValue.bytes[1]; @@ -815,29 +815,29 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) { */ switch (rq->wValue.bytes[1]) { case USBDESCR_DEVICE: - usbMsgPtr = (unsigned char *)&usbDeviceDescriptor; + usbMsgPtr = (usbMsgPtr_t)&usbDeviceDescriptor; len = sizeof(usbDeviceDescriptor_t); break; case USBDESCR_CONFIG: - usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor; + usbMsgPtr = (usbMsgPtr_t)&usbConfigurationDescriptor; len = sizeof(usbConfigurationDescriptor_t); break; case USBDESCR_STRING: switch (rq->wValue.bytes[0]) { case 0: - usbMsgPtr = (unsigned char *)&usbStringDescriptorZero; + usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorZero; len = usbStringDescriptorZero.header.bLength; break; case 1: // iManufacturer - usbMsgPtr = (unsigned char *)&usbStringDescriptorManufacturer; + usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorManufacturer; len = usbStringDescriptorManufacturer.header.bLength; break; case 2: // iProduct - usbMsgPtr = (unsigned char *)&usbStringDescriptorProduct; + usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorProduct; len = usbStringDescriptorProduct.header.bLength; break; case 3: // iSerialNumber - usbMsgPtr = (unsigned char *)&usbStringDescriptorSerial; + usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorSerial; len = usbStringDescriptorSerial.header.bLength; break; } @@ -845,24 +845,24 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) { case USBDESCR_HID: switch (rq->wValue.bytes[0]) { case KEYBOARD_INTERFACE: - usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.keyboardHID; + usbMsgPtr = (usbMsgPtr_t)&usbConfigurationDescriptor.keyboardHID; len = sizeof(usbHIDDescriptor_t); break; #if defined(RAW_ENABLE) case RAW_INTERFACE: - usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.rawHID; + usbMsgPtr = (usbMsgPtr_t)&usbConfigurationDescriptor.rawHID; len = sizeof(usbHIDDescriptor_t); break; #endif #if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) case MOUSE_EXTRA_INTERFACE: - usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.mouseExtraHID; + usbMsgPtr = (usbMsgPtr_t)&usbConfigurationDescriptor.mouseExtraHID; len = sizeof(usbHIDDescriptor_t); break; #endif #if defined(CONSOLE_ENABLE) case CONSOLE_INTERFACE: - usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.consoleHID; + usbMsgPtr = (usbMsgPtr_t)&usbConfigurationDescriptor.consoleHID; len = sizeof(usbHIDDescriptor_t); break; #endif @@ -872,24 +872,24 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) { /* interface index */ switch (rq->wIndex.word) { case KEYBOARD_INTERFACE: - usbMsgPtr = (unsigned char *)keyboard_hid_report; + usbMsgPtr = (usbMsgPtr_t)keyboard_hid_report; len = sizeof(keyboard_hid_report); break; #if defined(RAW_ENABLE) case RAW_INTERFACE: - usbMsgPtr = (unsigned char *)raw_hid_report; + usbMsgPtr = (usbMsgPtr_t)raw_hid_report; len = sizeof(raw_hid_report); break; #endif #if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) case MOUSE_EXTRA_INTERFACE: - usbMsgPtr = (unsigned char *)mouse_extra_hid_report; + usbMsgPtr = (usbMsgPtr_t)mouse_extra_hid_report; len = sizeof(mouse_extra_hid_report); break; #endif #if defined(CONSOLE_ENABLE) case CONSOLE_INTERFACE: - usbMsgPtr = (unsigned char *)console_hid_report; + usbMsgPtr = (usbMsgPtr_t)console_hid_report; len = sizeof(console_hid_report); break; #endif diff --git a/users/ericgebhart/ericgebhart.c b/users/ericgebhart/ericgebhart.c index 76143c6ed1f..abb87899b7b 100644 --- a/users/ericgebhart/ericgebhart.c +++ b/users/ericgebhart/ericgebhart.c @@ -61,11 +61,6 @@ uint32_t layer_state_set_keymap (uint32_t state) { __attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) {} -// Runs just one time when the keyboard initializes. -void matrix_init_user(void) { - //ACTION_DEFAULT_LAYER_SET(DVORAK) ; -} - // check default layerstate to see which layer we are on. // if (biton32(layer_state) == _DIABLO) { --- current layer // if (biton32(default_layer_state) == _DIABLO) { --- current default layer diff --git a/users/ninjonas/ninjonas.c b/users/ninjonas/ninjonas.c index 7e5afcec87e..d66a5b008ce 100644 --- a/users/ninjonas/ninjonas.c +++ b/users/ninjonas/ninjonas.c @@ -36,4 +36,4 @@ void keyboard_post_init_user() { } #endif layer_state_set_user(layer_state); -} \ No newline at end of file +} diff --git a/users/ridingqwerty/ridingqwerty.c b/users/ridingqwerty/ridingqwerty.c index ee6e7e897a8..19b417a80f4 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) { return state; } -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case RC(ENT): case ED(ESC): diff --git a/users/tominabox1/tominabox1.c b/users/tominabox1/tominabox1.c index 95e6ee78033..d2e9e125812 100644 --- a/users/tominabox1/tominabox1.c +++ b/users/tominabox1/tominabox1.c @@ -106,7 +106,7 @@ qk_tap_dance_action_t tap_dance_actions[] = { #endif // CRKBD -uint16_t get_tapping_term(uint16_t keycode) { +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case LSFT_T(KC_CAPS): return 250;