From 9af995c59b2655fa347e43b1eab2122e72ef7fe3 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Thu, 7 Jul 2016 22:28:28 +0300 Subject: Initial structure for Ergodox as subprojects Only the EZ default keymaps compiles at the moment though. --- keyboards/ergodox/keymaps/jack/keymap.c | 118 ++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 keyboards/ergodox/keymaps/jack/keymap.c (limited to 'keyboards/ergodox/keymaps/jack/keymap.c') diff --git a/keyboards/ergodox/keymaps/jack/keymap.c b/keyboards/ergodox/keymaps/jack/keymap.c new file mode 100644 index 000000000..80bf9d535 --- /dev/null +++ b/keyboards/ergodox/keymaps/jack/keymap.c @@ -0,0 +1,118 @@ +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" + +// TODO: Define layer names that make sense for the ErgoDox EZ. +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[BASE] = KEYMAP( // layer 0 : default + // left hand + KC_NO, KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_NO, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_NO, + KC_NO, KC_LCTL, KC_LALT,KC_LGUI, MO(2), + ALT_T(KC_APP), KC_LGUI, + KC_HOME, + KC_SPC,KC_SPC,KC_END, + // right hand + KC_NO, KC_6, KC_7, KC_8, KC_9, KC_0, KC_NO, + KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT, + MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, + KC_NO, KC_NO, + KC_PGUP, + KC_PGDN, KC_SPC,KC_SPC + ), +[SYMB] = KEYMAP( + // left hand + KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, + KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, + KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + KC_TRNS, KC_F12, KC_NO, KC_NO, KC_NO, RESET, KC_TRNS, + KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +[MDIA] = KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TRNS, + KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, + KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, + KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, + KC_TRNS, KC_F12, KC_NO, KC_NO, KC_NO, RESET, KC_TRNS, + KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; -- cgit v1.2.3 From b0376687f4cc2dc0b5ffd89f3bcb33c873b1f4d3 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Fri, 8 Jul 2016 09:09:31 +0300 Subject: All Ez keymaps compiles --- keyboards/ergodox/config.h | 12 ++++++++++++ keyboards/ergodox/keymaps/ab/keymap.c | 2 +- keyboards/ergodox/keymaps/adnw_k_o_y/keymap.c | 2 +- keyboards/ergodox/keymaps/alexjj/keymap.c | 2 +- keyboards/ergodox/keymaps/algernon/keymap.c | 2 +- keyboards/ergodox/keymaps/andrew_osx/keymap.c | 2 +- keyboards/ergodox/keymaps/bepo/keymap.c | 2 +- keyboards/ergodox/keymaps/coderkun_neo2/keymap.c | 2 +- keyboards/ergodox/keymaps/colemak/keymap.c | 2 +- keyboards/ergodox/keymaps/colemak_osx_pc_no/keymap.c | 2 +- keyboards/ergodox/keymaps/csharp_dev/keymap.c | 2 +- keyboards/ergodox/keymaps/dave/keymap.c | 2 +- keyboards/ergodox/keymaps/default_osx/keymap.c | 2 +- keyboards/ergodox/keymaps/dragon788/keymap.c | 2 +- keyboards/ergodox/keymaps/dvorak/keymap.c | 2 +- keyboards/ergodox/keymaps/dvorak_intl_squisher/keymap.c | 2 +- keyboards/ergodox/keymaps/dvorak_spanish/keymap.c | 2 +- keyboards/ergodox/keymaps/emacs_osx_dk/keymap.c | 2 +- keyboards/ergodox/keymaps/erez_experimental/keymap.c | 2 +- keyboards/ergodox/keymaps/german-kinergo/keymap.c | 2 +- keyboards/ergodox/keymaps/german-manuneo/keymap.c | 2 +- keyboards/ergodox/keymaps/german-manuneo/keymap.md | 2 +- keyboards/ergodox/keymaps/german/keymap.c | 2 +- keyboards/ergodox/keymaps/j3rn/keymap.c | 2 +- keyboards/ergodox/keymaps/jack/keymap.c | 2 +- keyboards/ergodox/keymaps/jacobono/keymap.c | 2 +- keyboards/ergodox/keymaps/jgarr/keymap.c | 2 +- keyboards/ergodox/keymaps/josh/keymap.c | 2 +- keyboards/ergodox/keymaps/kastyle/keymap.c | 2 +- keyboards/ergodox/keymaps/kines-ish/keymap.c | 2 +- keyboards/ergodox/keymaps/maz/keymap.c | 2 +- keyboards/ergodox/keymaps/mpiechotka/keymap.c | 2 +- keyboards/ergodox/keymaps/msc/keymap.c | 2 +- keyboards/ergodox/keymaps/naps62/keymap.c | 2 +- keyboards/ergodox/keymaps/ordinary/keymap.c | 2 +- keyboards/ergodox/keymaps/osx_de/keymap.c | 2 +- keyboards/ergodox/keymaps/osx_de_adnw_koy/keymap.c | 2 +- keyboards/ergodox/keymaps/osx_de_experimental/keymap.c | 2 +- keyboards/ergodox/keymaps/osx_fr/keymap.c | 4 ++-- keyboards/ergodox/keymaps/osx_kinesis_pnut/keymap.c | 2 +- keyboards/ergodox/keymaps/plover/keymap.c | 2 +- keyboards/ergodox/keymaps/plums/keymap.c | 2 +- keyboards/ergodox/keymaps/romanzolotarev-norman-osx/keymap.c | 2 +- .../keymaps/romanzolotarev-norman-plover-osx-hjkl/keymap.c | 2 +- .../keymaps/romanzolotarev-norman-plover-osx/keymap.c | 2 +- .../keymaps/romanzolotarev-norman-qwerty-osx/keymap.c | 2 +- keyboards/ergodox/keymaps/sneako/keymap.c | 2 +- keyboards/ergodox/keymaps/software_neo2/keymap.c | 2 +- keyboards/ergodox/keymaps/supercoder/keymap.c | 2 +- keyboards/ergodox/keymaps/techtomas/keymap.c | 2 +- keyboards/ergodox/keymaps/teckinesis/keymap.c | 2 +- keyboards/ergodox/keymaps/tkuichooseyou/keymap.c | 2 +- keyboards/ergodox/keymaps/tm2030/keymap.c | 2 +- keyboards/ergodox/keymaps/tonyabra_osx/keymap.c | 2 +- keyboards/ergodox/keymaps/townk_osx/keymap.c | 2 +- keyboards/ergodox/keymaps/twey/keymap.c | 2 +- keyboards/ergodox/keymaps/workman_osx_mdw/keymap.c | 2 +- keyboards/ergodox/keymaps/zweihander-osx/keymap.c | 2 +- 58 files changed, 70 insertions(+), 58 deletions(-) create mode 100644 keyboards/ergodox/config.h (limited to 'keyboards/ergodox/keymaps/jack/keymap.c') diff --git a/keyboards/ergodox/config.h b/keyboards/ergodox/config.h new file mode 100644 index 000000000..c37c10e93 --- /dev/null +++ b/keyboards/ergodox/config.h @@ -0,0 +1,12 @@ +#ifndef KEYBOARDS_ERGODOX_CONFIG_H_ +#define KEYBOARDS_ERGODOX_CONFIG_H_ + +#ifdef SUBPROJECT_ez + #include "ez/config.h" +#endif +#ifdef SUBPROJECT_infinity + #include "infinity/config.h" +#endif + + +#endif /* KEYBOARDS_ERGODOX_CONFIG_H_ */ diff --git a/keyboards/ergodox/keymaps/ab/keymap.c b/keyboards/ergodox/keymaps/ab/keymap.c index df6f33460..7938c9da3 100644 --- a/keyboards/ergodox/keymaps/ab/keymap.c +++ b/keyboards/ergodox/keymaps/ab/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/adnw_k_o_y/keymap.c b/keyboards/ergodox/keymaps/adnw_k_o_y/keymap.c index 052517d70..31ae4262b 100644 --- a/keyboards/ergodox/keymaps/adnw_k_o_y/keymap.c +++ b/keyboards/ergodox/keymaps/adnw_k_o_y/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_german.h" diff --git a/keyboards/ergodox/keymaps/alexjj/keymap.c b/keyboards/ergodox/keymaps/alexjj/keymap.c index 448f62da0..ac954ba5b 100644 --- a/keyboards/ergodox/keymaps/alexjj/keymap.c +++ b/keyboards/ergodox/keymaps/alexjj/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/algernon/keymap.c b/keyboards/ergodox/keymaps/algernon/keymap.c index c12087292..1ebcf528b 100644 --- a/keyboards/ergodox/keymaps/algernon/keymap.c +++ b/keyboards/ergodox/keymaps/algernon/keymap.c @@ -2,7 +2,7 @@ * algernon's ErgoDox EZ layout, please see the readme.md file! */ -#include "ergodox_ez.h" +#include "ergodox.h" #include "led.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/andrew_osx/keymap.c b/keyboards/ergodox/keymaps/andrew_osx/keymap.c index 48257d23a..750155d98 100644 --- a/keyboards/ergodox/keymaps/andrew_osx/keymap.c +++ b/keyboards/ergodox/keymaps/andrew_osx/keymap.c @@ -1,7 +1,7 @@ // Netable differences vs. the default firmware for the ErgoDox EZ: // 1. The Cmd key is now on the right side, making Cmd+Space easier. // 2. The media keys work on OSX (But not on Windows). -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/bepo/keymap.c b/keyboards/ergodox/keymaps/bepo/keymap.c index 921a94d63..2d88fc10e 100644 --- a/keyboards/ergodox/keymaps/bepo/keymap.c +++ b/keyboards/ergodox/keymaps/bepo/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_bepo.h" diff --git a/keyboards/ergodox/keymaps/coderkun_neo2/keymap.c b/keyboards/ergodox/keymaps/coderkun_neo2/keymap.c index 8a2ba26d2..2ac06eef8 100644 --- a/keyboards/ergodox/keymaps/coderkun_neo2/keymap.c +++ b/keyboards/ergodox/keymaps/coderkun_neo2/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "led.h" diff --git a/keyboards/ergodox/keymaps/colemak/keymap.c b/keyboards/ergodox/keymaps/colemak/keymap.c index 9601726f7..7ef81ab4b 100644 --- a/keyboards/ergodox/keymaps/colemak/keymap.c +++ b/keyboards/ergodox/keymaps/colemak/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/colemak_osx_pc_no/keymap.c b/keyboards/ergodox/keymaps/colemak_osx_pc_no/keymap.c index a909ed3a4..eb0156c45 100644 --- a/keyboards/ergodox/keymaps/colemak_osx_pc_no/keymap.c +++ b/keyboards/ergodox/keymaps/colemak_osx_pc_no/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_norwegian.h" diff --git a/keyboards/ergodox/keymaps/csharp_dev/keymap.c b/keyboards/ergodox/keymaps/csharp_dev/keymap.c index e9648ede7..e0c66f487 100644 --- a/keyboards/ergodox/keymaps/csharp_dev/keymap.c +++ b/keyboards/ergodox/keymaps/csharp_dev/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/dave/keymap.c b/keyboards/ergodox/keymaps/dave/keymap.c index e9480af3e..32c70097b 100644 --- a/keyboards/ergodox/keymaps/dave/keymap.c +++ b/keyboards/ergodox/keymaps/dave/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/default_osx/keymap.c b/keyboards/ergodox/keymaps/default_osx/keymap.c index c57ffbb88..e9a242e07 100644 --- a/keyboards/ergodox/keymaps/default_osx/keymap.c +++ b/keyboards/ergodox/keymaps/default_osx/keymap.c @@ -1,7 +1,7 @@ // Netable differences vs. the default firmware for the ErgoDox EZ: // 1. The Cmd key is now on the right side, making Cmd+Space easier. // 2. The media keys work on OSX (But not on Windows). -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/dragon788/keymap.c b/keyboards/ergodox/keymaps/dragon788/keymap.c index 3aec8c6cf..d33bc6a25 100644 --- a/keyboards/ergodox/keymaps/dragon788/keymap.c +++ b/keyboards/ergodox/keymaps/dragon788/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/dvorak/keymap.c b/keyboards/ergodox/keymaps/dvorak/keymap.c index 22947327d..d3609c673 100644 --- a/keyboards/ergodox/keymaps/dvorak/keymap.c +++ b/keyboards/ergodox/keymaps/dvorak/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/dvorak_intl_squisher/keymap.c b/keyboards/ergodox/keymaps/dvorak_intl_squisher/keymap.c index 82f55b4bc..89eae5208 100644 --- a/keyboards/ergodox/keymaps/dvorak_intl_squisher/keymap.c +++ b/keyboards/ergodox/keymaps/dvorak_intl_squisher/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/dvorak_spanish/keymap.c b/keyboards/ergodox/keymaps/dvorak_spanish/keymap.c index 6eb864b44..6d7adf907 100755 --- a/keyboards/ergodox/keymaps/dvorak_spanish/keymap.c +++ b/keyboards/ergodox/keymaps/dvorak_spanish/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/emacs_osx_dk/keymap.c b/keyboards/ergodox/keymaps/emacs_osx_dk/keymap.c index 1d8e66a08..e80f08d73 100644 --- a/keyboards/ergodox/keymaps/emacs_osx_dk/keymap.c +++ b/keyboards/ergodox/keymaps/emacs_osx_dk/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/erez_experimental/keymap.c b/keyboards/ergodox/keymaps/erez_experimental/keymap.c index 04ad2a816..47e40aa55 100644 --- a/keyboards/ergodox/keymaps/erez_experimental/keymap.c +++ b/keyboards/ergodox/keymaps/erez_experimental/keymap.c @@ -1,5 +1,5 @@ #include -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/german-kinergo/keymap.c b/keyboards/ergodox/keymaps/german-kinergo/keymap.c index b1cecf0dd..971318d87 100644 --- a/keyboards/ergodox/keymaps/german-kinergo/keymap.c +++ b/keyboards/ergodox/keymaps/german-kinergo/keymap.c @@ -1,7 +1,7 @@ // German keymap derived from "german", but more closely resembling the German layout of the Kinesis Ergo Elan. // // chschmitz, 2016-01-27 -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_german.h" diff --git a/keyboards/ergodox/keymaps/german-manuneo/keymap.c b/keyboards/ergodox/keymaps/german-manuneo/keymap.c index 5fcc14d51..16e92bc23 100644 --- a/keyboards/ergodox/keymaps/german-manuneo/keymap.c +++ b/keyboards/ergodox/keymaps/german-manuneo/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "action_layer.h" #include "keymap.h" #include "keymap_german.h" diff --git a/keyboards/ergodox/keymaps/german-manuneo/keymap.md b/keyboards/ergodox/keymaps/german-manuneo/keymap.md index 2c9e0a837..837b25446 100644 --- a/keyboards/ergodox/keymaps/german-manuneo/keymap.md +++ b/keyboards/ergodox/keymaps/german-manuneo/keymap.md @@ -12,7 +12,7 @@ Tested with python 2.7 and python 3.4 { "layout": "ergodox_ez", "keymaps_includes": [ - "ergodox_ez.h", + "ergodox.h", "action_layer.h", "keymap_common.h", "keymap_extras/keymap_german.h", diff --git a/keyboards/ergodox/keymaps/german/keymap.c b/keyboards/ergodox/keymaps/german/keymap.c index 3eab51f0e..9b2f6ffa2 100644 --- a/keyboards/ergodox/keymaps/german/keymap.c +++ b/keyboards/ergodox/keymaps/german/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_german.h" diff --git a/keyboards/ergodox/keymaps/j3rn/keymap.c b/keyboards/ergodox/keymaps/j3rn/keymap.c index 6e271321d..43c8f30a3 100644 --- a/keyboards/ergodox/keymaps/j3rn/keymap.c +++ b/keyboards/ergodox/keymaps/j3rn/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/jack/keymap.c b/keyboards/ergodox/keymaps/jack/keymap.c index 80bf9d535..dda253fa4 100644 --- a/keyboards/ergodox/keymaps/jack/keymap.c +++ b/keyboards/ergodox/keymaps/jack/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/jacobono/keymap.c b/keyboards/ergodox/keymaps/jacobono/keymap.c index 6b19800af..dc7382bfe 100644 --- a/keyboards/ergodox/keymaps/jacobono/keymap.c +++ b/keyboards/ergodox/keymaps/jacobono/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/jgarr/keymap.c b/keyboards/ergodox/keymaps/jgarr/keymap.c index a3ad2040f..42d58421d 100644 --- a/keyboards/ergodox/keymaps/jgarr/keymap.c +++ b/keyboards/ergodox/keymaps/jgarr/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/josh/keymap.c b/keyboards/ergodox/keymaps/josh/keymap.c index de5664a25..488b21427 100644 --- a/keyboards/ergodox/keymaps/josh/keymap.c +++ b/keyboards/ergodox/keymaps/josh/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/kastyle/keymap.c b/keyboards/ergodox/keymaps/kastyle/keymap.c index 3982e0a19..a92085003 100644 --- a/keyboards/ergodox/keymaps/kastyle/keymap.c +++ b/keyboards/ergodox/keymaps/kastyle/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/kines-ish/keymap.c b/keyboards/ergodox/keymaps/kines-ish/keymap.c index 5063c99f2..83f5b0e2b 100644 --- a/keyboards/ergodox/keymaps/kines-ish/keymap.c +++ b/keyboards/ergodox/keymaps/kines-ish/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/maz/keymap.c b/keyboards/ergodox/keymaps/maz/keymap.c index 7b8f0df74..6378f874b 100644 --- a/keyboards/ergodox/keymaps/maz/keymap.c +++ b/keyboards/ergodox/keymaps/maz/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/mpiechotka/keymap.c b/keyboards/ergodox/keymaps/mpiechotka/keymap.c index 5bfef5995..67aca4479 100644 --- a/keyboards/ergodox/keymaps/mpiechotka/keymap.c +++ b/keyboards/ergodox/keymaps/mpiechotka/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_colemak.h" diff --git a/keyboards/ergodox/keymaps/msc/keymap.c b/keyboards/ergodox/keymaps/msc/keymap.c index e567e513f..c43aecf6b 100644 --- a/keyboards/ergodox/keymaps/msc/keymap.c +++ b/keyboards/ergodox/keymaps/msc/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/naps62/keymap.c b/keyboards/ergodox/keymaps/naps62/keymap.c index d8c28423c..9064053fc 100644 --- a/keyboards/ergodox/keymaps/naps62/keymap.c +++ b/keyboards/ergodox/keymaps/naps62/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/ordinary/keymap.c b/keyboards/ergodox/keymaps/ordinary/keymap.c index 778cbc63c..bf0574ea2 100644 --- a/keyboards/ergodox/keymaps/ordinary/keymap.c +++ b/keyboards/ergodox/keymaps/ordinary/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "led.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/osx_de/keymap.c b/keyboards/ergodox/keymaps/osx_de/keymap.c index 554813d7e..e3b9e11f4 100644 --- a/keyboards/ergodox/keymaps/osx_de/keymap.c +++ b/keyboards/ergodox/keymaps/osx_de/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_german_osx.h" diff --git a/keyboards/ergodox/keymaps/osx_de_adnw_koy/keymap.c b/keyboards/ergodox/keymaps/osx_de_adnw_koy/keymap.c index 687a5cb8b..6c4312a32 100644 --- a/keyboards/ergodox/keymaps/osx_de_adnw_koy/keymap.c +++ b/keyboards/ergodox/keymaps/osx_de_adnw_koy/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/osx_de_experimental/keymap.c b/keyboards/ergodox/keymaps/osx_de_experimental/keymap.c index 21d695894..61b6a4fdb 100644 --- a/keyboards/ergodox/keymaps/osx_de_experimental/keymap.c +++ b/keyboards/ergodox/keymaps/osx_de_experimental/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_neo2.h" diff --git a/keyboards/ergodox/keymaps/osx_fr/keymap.c b/keyboards/ergodox/keymaps/osx_fr/keymap.c index de951666d..7dee284fa 100644 --- a/keyboards/ergodox/keymaps/osx_fr/keymap.c +++ b/keyboards/ergodox/keymaps/osx_fr/keymap.c @@ -1,5 +1,5 @@ // French AZERTY version of the default_osx file -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_french_osx.h" @@ -184,4 +184,4 @@ void matrix_scan_user(void) { break; } -}; \ No newline at end of file +}; diff --git a/keyboards/ergodox/keymaps/osx_kinesis_pnut/keymap.c b/keyboards/ergodox/keymaps/osx_kinesis_pnut/keymap.c index 1032be549..11281df8a 100644 --- a/keyboards/ergodox/keymaps/osx_kinesis_pnut/keymap.c +++ b/keyboards/ergodox/keymaps/osx_kinesis_pnut/keymap.c @@ -5,7 +5,7 @@ // Only default layer was remapped all others layers are standard Ergodox EZ // Very personal mapping of-course, but who knows a starting point for others. -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/plover/keymap.c b/keyboards/ergodox/keymaps/plover/keymap.c index 8a58a37f6..12b3aa212 100644 --- a/keyboards/ergodox/keymaps/plover/keymap.c +++ b/keyboards/ergodox/keymaps/plover/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/plums/keymap.c b/keyboards/ergodox/keymaps/plums/keymap.c index 46eb2e42b..2853455e3 100644 --- a/keyboards/ergodox/keymaps/plums/keymap.c +++ b/keyboards/ergodox/keymaps/plums/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/romanzolotarev-norman-osx/keymap.c b/keyboards/ergodox/keymaps/romanzolotarev-norman-osx/keymap.c index a66971bef..24d0c4ecb 100644 --- a/keyboards/ergodox/keymaps/romanzolotarev-norman-osx/keymap.c +++ b/keyboards/ergodox/keymaps/romanzolotarev-norman-osx/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/romanzolotarev-norman-plover-osx-hjkl/keymap.c b/keyboards/ergodox/keymaps/romanzolotarev-norman-plover-osx-hjkl/keymap.c index 7c9f67381..9f41e5189 100644 --- a/keyboards/ergodox/keymaps/romanzolotarev-norman-plover-osx-hjkl/keymap.c +++ b/keyboards/ergodox/keymaps/romanzolotarev-norman-plover-osx-hjkl/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/romanzolotarev-norman-plover-osx/keymap.c b/keyboards/ergodox/keymaps/romanzolotarev-norman-plover-osx/keymap.c index 9971b834c..563e24872 100644 --- a/keyboards/ergodox/keymaps/romanzolotarev-norman-plover-osx/keymap.c +++ b/keyboards/ergodox/keymaps/romanzolotarev-norman-plover-osx/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/romanzolotarev-norman-qwerty-osx/keymap.c b/keyboards/ergodox/keymaps/romanzolotarev-norman-qwerty-osx/keymap.c index dedac694e..5569f5c74 100644 --- a/keyboards/ergodox/keymaps/romanzolotarev-norman-qwerty-osx/keymap.c +++ b/keyboards/ergodox/keymaps/romanzolotarev-norman-qwerty-osx/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/sneako/keymap.c b/keyboards/ergodox/keymaps/sneako/keymap.c index 0c6863102..08cadd685 100644 --- a/keyboards/ergodox/keymaps/sneako/keymap.c +++ b/keyboards/ergodox/keymaps/sneako/keymap.c @@ -1,7 +1,7 @@ // Based on `default_osx` // Replace left Bksp with Ctrl/Esc // Remove the Ctrl from Z and / -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/software_neo2/keymap.c b/keyboards/ergodox/keymaps/software_neo2/keymap.c index 2eaba0d7d..41ace403d 100644 --- a/keyboards/ergodox/keymaps/software_neo2/keymap.c +++ b/keyboards/ergodox/keymaps/software_neo2/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_neo2.h" diff --git a/keyboards/ergodox/keymaps/supercoder/keymap.c b/keyboards/ergodox/keymaps/supercoder/keymap.c index ca21d30fd..775acf2c9 100644 --- a/keyboards/ergodox/keymaps/supercoder/keymap.c +++ b/keyboards/ergodox/keymaps/supercoder/keymap.c @@ -2,7 +2,7 @@ * SuperCoder 2000 layout */ -#include "ergodox_ez.h" +#include "ergodox.h" /* Layers */ diff --git a/keyboards/ergodox/keymaps/techtomas/keymap.c b/keyboards/ergodox/keymaps/techtomas/keymap.c index 1ff6618b9..93d59d487 100644 --- a/keyboards/ergodox/keymaps/techtomas/keymap.c +++ b/keyboards/ergodox/keymaps/techtomas/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/teckinesis/keymap.c b/keyboards/ergodox/keymaps/teckinesis/keymap.c index ec6ceb96b..2837874f7 100644 --- a/keyboards/ergodox/keymaps/teckinesis/keymap.c +++ b/keyboards/ergodox/keymaps/teckinesis/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "led.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/tkuichooseyou/keymap.c b/keyboards/ergodox/keymaps/tkuichooseyou/keymap.c index 87b77e42e..d1c779186 100644 --- a/keyboards/ergodox/keymaps/tkuichooseyou/keymap.c +++ b/keyboards/ergodox/keymaps/tkuichooseyou/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/tm2030/keymap.c b/keyboards/ergodox/keymaps/tm2030/keymap.c index ca8075226..1d861ee7c 100644 --- a/keyboards/ergodox/keymaps/tm2030/keymap.c +++ b/keyboards/ergodox/keymaps/tm2030/keymap.c @@ -1,5 +1,5 @@ /* TypeMatrix-2030-like keymap */ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "led.h" diff --git a/keyboards/ergodox/keymaps/tonyabra_osx/keymap.c b/keyboards/ergodox/keymaps/tonyabra_osx/keymap.c index 87b9fb676..2a15fcb8d 100644 --- a/keyboards/ergodox/keymaps/tonyabra_osx/keymap.c +++ b/keyboards/ergodox/keymaps/tonyabra_osx/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" diff --git a/keyboards/ergodox/keymaps/townk_osx/keymap.c b/keyboards/ergodox/keymaps/townk_osx/keymap.c index 07e58a491..5043d49a0 100644 --- a/keyboards/ergodox/keymaps/townk_osx/keymap.c +++ b/keyboards/ergodox/keymaps/townk_osx/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "action_util.h" diff --git a/keyboards/ergodox/keymaps/twey/keymap.c b/keyboards/ergodox/keymaps/twey/keymap.c index 019930f2a..5deacd63f 100644 --- a/keyboards/ergodox/keymaps/twey/keymap.c +++ b/keyboards/ergodox/keymaps/twey/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" #include "keymap_plover.h" diff --git a/keyboards/ergodox/keymaps/workman_osx_mdw/keymap.c b/keyboards/ergodox/keymaps/workman_osx_mdw/keymap.c index 8effa53b2..c05a1018d 100644 --- a/keyboards/ergodox/keymaps/workman_osx_mdw/keymap.c +++ b/keyboards/ergodox/keymaps/workman_osx_mdw/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" // readme diff --git a/keyboards/ergodox/keymaps/zweihander-osx/keymap.c b/keyboards/ergodox/keymaps/zweihander-osx/keymap.c index 3444152bc..40b1d7d6d 100644 --- a/keyboards/ergodox/keymaps/zweihander-osx/keymap.c +++ b/keyboards/ergodox/keymaps/zweihander-osx/keymap.c @@ -1,4 +1,4 @@ -#include "ergodox_ez.h" +#include "ergodox.h" #include "debug.h" #include "action_layer.h" -- cgit v1.2.3 From b8679bbe045a2285d6ab6bbc420121b26f516b9a Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Wed, 5 Oct 2016 20:41:33 -0400 Subject: RGBW lights --- keyboards/ergodox/config.h | 2 ++ keyboards/ergodox/keymaps/jack/Makefile | 5 +++++ keyboards/ergodox/keymaps/jack/config.h | 14 ++++++++++++++ keyboards/ergodox/keymaps/jack/keymap.c | 4 ++-- quantum/rgblight.c | 18 +++++++++++++++--- quantum/rgblight.h | 1 + 6 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 keyboards/ergodox/keymaps/jack/Makefile create mode 100644 keyboards/ergodox/keymaps/jack/config.h (limited to 'keyboards/ergodox/keymaps/jack/keymap.c') diff --git a/keyboards/ergodox/config.h b/keyboards/ergodox/config.h index edc60caae..049c707a5 100644 --- a/keyboards/ergodox/config.h +++ b/keyboards/ergodox/config.h @@ -1,6 +1,8 @@ #ifndef KEYBOARDS_ERGODOX_CONFIG_H_ #define KEYBOARDS_ERGODOX_CONFIG_H_ +#include "config_common.h" + #define MOUSEKEY_DELAY 100 #define MOUSEKEY_INTERVAL 20 #define MOUSEKEY_MAX_SPEED 3 diff --git a/keyboards/ergodox/keymaps/jack/Makefile b/keyboards/ergodox/keymaps/jack/Makefile new file mode 100644 index 000000000..1e5761278 --- /dev/null +++ b/keyboards/ergodox/keymaps/jack/Makefile @@ -0,0 +1,5 @@ +RGBLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/ergodox/keymaps/jack/config.h b/keyboards/ergodox/keymaps/jack/config.h new file mode 100644 index 000000000..01ccfb3a2 --- /dev/null +++ b/keyboards/ergodox/keymaps/jack/config.h @@ -0,0 +1,14 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D7 +// #define RGBLIGHT_TIMER +#define RGBLED_NUM 20 // Number of LEDs +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif \ No newline at end of file diff --git a/keyboards/ergodox/keymaps/jack/keymap.c b/keyboards/ergodox/keymaps/jack/keymap.c index dda253fa4..1dd5a7618 100644 --- a/keyboards/ergodox/keymaps/jack/keymap.c +++ b/keyboards/ergodox/keymaps/jack/keymap.c @@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT, MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, - KC_NO, KC_NO, + RGB_TOG, RGB_HUI, KC_PGUP, KC_PGDN, KC_SPC,KC_SPC ), @@ -90,7 +90,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // Runs just one time when the keyboard initializes. void matrix_init_user(void) { - + }; // Runs constantly in the background, in a loop. diff --git a/quantum/rgblight.c b/quantum/rgblight.c index f82e3ec55..801ca1d0d 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -50,7 +50,11 @@ const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {100, 50, 20}; rgblight_config_t rgblight_config; rgblight_config_t inmem_config; -struct cRGB led[RGBLED_NUM]; +#ifdef RGBW + struct cRGBW led[RGBLED_NUM]; +#else + struct cRGB led[RGBLED_NUM]; +#endif uint8_t rgblight_inited = 0; @@ -334,14 +338,22 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { void rgblight_set(void) { if (rgblight_config.enable) { - ws2812_setleds(led, RGBLED_NUM); + #ifdef RGBW + ws2812_setleds_rgbw(led, RGBLED_NUM); + #else + ws2812_setleds(led, RGBLED_NUM); + #endif } else { for (uint8_t i = 0; i < RGBLED_NUM; i++) { led[i].r = 0; led[i].g = 0; led[i].b = 0; } - ws2812_setleds(led, RGBLED_NUM); + #ifdef RGBW + ws2812_setleds_rgbw(led, RGBLED_NUM); + #else + ws2812_setleds(led, RGBLED_NUM); + #endif } } diff --git a/quantum/rgblight.h b/quantum/rgblight.h index def26c428..2a712d8be 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -1,6 +1,7 @@ #ifndef RGBLIGHT_H #define RGBLIGHT_H +#define RGBW 1 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) #define RGBLIGHT_MODES 23 -- cgit v1.2.3 From 5f91fb413624781ac79db641549b9e08753c04b5 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sun, 16 Oct 2016 16:03:33 -0400 Subject: working with power limit --- build_keyboard.mk | 6 ++ keyboards/ergodox/keymaps/jack/config.h | 2 +- keyboards/ergodox/keymaps/jack/keymap.c | 4 +- quantum/keymap.h | 4 + quantum/light_ws2812.c | 137 +++++++++++++++++++++++++++++++- quantum/light_ws2812.h | 7 ++ quantum/quantum.c | 3 + quantum/quantum.h | 4 + 8 files changed, 163 insertions(+), 4 deletions(-) (limited to 'keyboards/ergodox/keymaps/jack/keymap.c') diff --git a/build_keyboard.mk b/build_keyboard.mk index 03a69b146..cd9f44c7b 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -169,6 +169,12 @@ ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c endif +ifeq ($(strip $(PRINTING_ENABLE)), yes) + OPT_DEFS += -DPRINTING_ENABLE + SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c + SRC += $(TMK_DIR)/protocol/serial_uart.c +endif + ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes) SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC)) OPT_DEFS += $(SERIAL_DEFS) diff --git a/keyboards/ergodox/keymaps/jack/config.h b/keyboards/ergodox/keymaps/jack/config.h index 01ccfb3a2..f0932084a 100644 --- a/keyboards/ergodox/keymaps/jack/config.h +++ b/keyboards/ergodox/keymaps/jack/config.h @@ -6,7 +6,7 @@ /* ws2812 RGB LED */ #define RGB_DI_PIN D7 // #define RGBLIGHT_TIMER -#define RGBLED_NUM 20 // Number of LEDs +#define RGBLED_NUM 15 // Number of LEDs #define RGBLIGHT_HUE_STEP 8 #define RGBLIGHT_SAT_STEP 8 #define RGBLIGHT_VAL_STEP 8 diff --git a/keyboards/ergodox/keymaps/jack/keymap.c b/keyboards/ergodox/keymaps/jack/keymap.c index 1dd5a7618..fabd27a61 100644 --- a/keyboards/ergodox/keymaps/jack/keymap.c +++ b/keyboards/ergodox/keymaps/jack/keymap.c @@ -25,7 +25,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT, MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, RGB_TOG, RGB_HUI, - KC_PGUP, + RGB_MOD, KC_PGDN, KC_SPC,KC_SPC ), [SYMB] = KEYMAP( @@ -90,7 +90,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // Runs just one time when the keyboard initializes. void matrix_init_user(void) { - + }; // Runs constantly in the background, in a loop. diff --git a/quantum/keymap.h b/quantum/keymap.h index 98ddfd0c5..41aa11622 100644 --- a/quantum/keymap.h +++ b/quantum/keymap.h @@ -174,6 +174,10 @@ enum quantum_keycodes { // Right shift, close paren KC_RSPC, + // Printing + PRINT_ON, + PRINT_OFF, + // always leave at the end SAFE_RANGE }; diff --git a/quantum/light_ws2812.c b/quantum/light_ws2812.c index 401845e85..d38dac4c6 100755 --- a/quantum/light_ws2812.c +++ b/quantum/light_ws2812.c @@ -16,6 +16,122 @@ #include #include "debug.h" +#define RGBW_BB_TWI 1 + +#ifdef RGBW_BB_TWI + +// Port for the I2C +#define I2C_DDR DDRD +#define I2C_PIN PIND +#define I2C_PORT PORTD + +// Pins to be used in the bit banging +#define I2C_CLK 0 +#define I2C_DAT 1 + +#define I2C_DATA_HI()\ +I2C_DDR &= ~ (1 << I2C_DAT);\ +I2C_PORT |= (1 << I2C_DAT); +#define I2C_DATA_LO()\ +I2C_DDR |= (1 << I2C_DAT);\ +I2C_PORT &= ~ (1 << I2C_DAT); + +#define I2C_CLOCK_HI()\ +I2C_DDR &= ~ (1 << I2C_CLK);\ +I2C_PORT |= (1 << I2C_CLK); +#define I2C_CLOCK_LO()\ +I2C_DDR |= (1 << I2C_CLK);\ +I2C_PORT &= ~ (1 << I2C_CLK); + +#define I2C_DELAY 1 + +void I2C_WriteBit(unsigned char c) +{ + if (c > 0) + { + I2C_DATA_HI(); + } + else + { + I2C_DATA_LO(); + } + + I2C_CLOCK_HI(); + _delay_us(I2C_DELAY); + + I2C_CLOCK_LO(); + _delay_us(I2C_DELAY); + + if (c > 0) + { + I2C_DATA_LO(); + } + + _delay_us(I2C_DELAY); +} + +// Inits bitbanging port, must be called before using the functions below +// +void I2C_Init() +{ + I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); + + I2C_CLOCK_HI(); + I2C_DATA_HI(); + + _delay_us(I2C_DELAY); +} + +// Send a START Condition +// +void I2C_Start() +{ + // set both to high at the same time + I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); + _delay_us(I2C_DELAY); + + I2C_DATA_LO(); + _delay_us(I2C_DELAY); + + I2C_CLOCK_LO(); + _delay_us(I2C_DELAY); +} + +// Send a STOP Condition +// +void I2C_Stop() +{ + I2C_CLOCK_HI(); + _delay_us(I2C_DELAY); + + I2C_DATA_HI(); + _delay_us(I2C_DELAY); +} + +// write a byte to the I2C slave device +// +unsigned char I2C_Write(unsigned char c) +{ + for (char i = 0; i < 8; i++) + { + I2C_WriteBit(c & 128); + + c <<= 1; + } + + + I2C_WriteBit(0); + _delay_us(I2C_DELAY); + _delay_us(I2C_DELAY); + + // _delay_us(I2C_DELAY); + //return I2C_ReadBit(); + return 0; +} + + +#endif + // Setleds for standard RGB void inline ws2812_setleds(struct cRGB *ledarray, uint16_t leds) { @@ -41,6 +157,25 @@ void inline ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t leds) _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF); ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF)); + + #ifdef RGBW_BB_TWI + cli(); + TWCR = 0; + I2C_Init(); + I2C_Start(); + I2C_Write(0x84); + uint16_t datlen = leds<<2; + uint8_t curbyte; + uint8_t * data = (uint8_t*)ledarray; + while (datlen--) { + curbyte=*data++; + I2C_Write(curbyte % 0x10); + } + I2C_Stop(); + sei(); + #endif + + _delay_us(80); } @@ -123,7 +258,7 @@ void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi) cli(); while (datlen--) { - curbyte=*data++; + curbyte=(*data++) % 0x10; asm volatile( " ldi %0,8 \n\t" diff --git a/quantum/light_ws2812.h b/quantum/light_ws2812.h index 54eef22d9..576c3bc48 100755 --- a/quantum/light_ws2812.h +++ b/quantum/light_ws2812.h @@ -16,6 +16,13 @@ #include #include //#include "ws2812_config.h" +#include "i2cmaster.h" + +#define LIGHT_I2C 1 +#define LIGHT_I2C_ADDR 0x84 +#define LIGHT_I2C_ADDR_WRITE ( (LIGHT_I2C_ADDR<<1) | I2C_WRITE ) +#define LIGHT_I2C_ADDR_READ ( (LIGHT_I2C_ADDR<<1) | I2C_READ ) + /* * Structure of the LED array diff --git a/quantum/quantum.c b/quantum/quantum.c index a16bd5443..5fa5e66b3 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -128,6 +128,9 @@ bool process_record_quantum(keyrecord_t *record) { #endif #ifdef UCIS_ENABLE process_ucis(keycode, record) && + #endif + #ifdef PRINTING_ENABLE + process_printer(keycode, record) && #endif true)) { return false; diff --git a/quantum/quantum.h b/quantum/quantum.h index 0c6046649..06a2e049d 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -59,6 +59,10 @@ extern uint32_t default_layer_state; #include "process_tap_dance.h" +#ifdef PRINTING_ENABLE + #include "process_printer.h" +#endif + #define SEND_STRING(str) send_string(PSTR(str)) void send_string(const char *str); -- cgit v1.2.3 From 161bd5596b5d8199f2e56246a27ccbdb8c80bb36 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 18 Nov 2016 22:22:24 -0500 Subject: midi back and forth --- keyboards/ergodox/keymaps/jack/keymap.c | 7 +++- tmk_core/protocol/lufa/lufa.c | 62 ++++++++++++++++++++++++--------- tmk_core/protocol/lufa/lufa.h | 1 + 3 files changed, 52 insertions(+), 18 deletions(-) (limited to 'keyboards/ergodox/keymaps/jack/keymap.c') diff --git a/keyboards/ergodox/keymaps/jack/keymap.c b/keyboards/ergodox/keymaps/jack/keymap.c index 8721b9644..eb41f1212 100644 --- a/keyboards/ergodox/keymaps/jack/keymap.c +++ b/keyboards/ergodox/keymaps/jack/keymap.c @@ -26,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, RGB_TOG, RGB_HUI, RGB_MOD, - KC_PGDN, KC_SPC,KC_SPC + M(2), KC_SPC,KC_SPC ), [SYMB] = KEYMAP( // left hand @@ -89,6 +89,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) eeconfig_init(); } break; + case 2: + if (record->event.pressed) { // For resetting EEPROM + send_unicode_midi(0x0CA0); + } + break; } return MACRO_NONE; }; diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 7eb9be601..ae9cc2f96 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -1161,7 +1161,7 @@ void sysex_callback(MidiDevice * device, // send_byte(*data); midi_buffer[start + place] = *data; if (*data == 0xF7) - sysex_buffer_callback(start + place, &midi_buffer); + sysex_buffer_callback(device, start + place, &midi_buffer); // SEND_STRING(" "); data++; } @@ -1169,7 +1169,24 @@ void sysex_callback(MidiDevice * device, } -void sysex_buffer_callback(uint8_t length, uint8_t * data) { +uint32_t decode_4byte_chunk(uint8_t * data) { + uint32_t part1 = *data++; + uint32_t part2 = *data++; + uint32_t part3 = *data++; + uint32_t part4 = *data++; + uint32_t part5 = *data++; + return ((part1 & 0x1FUL) << 28) | (part2 << 21) | (part3 << 14) | (part4 << 7) | part5; +} + +void encode_4byte_chunk(uint32_t data, uint8_t * pointer) { + *pointer++ = (data >> 28) & 0x7F; + *pointer++ = (data >> 21) & 0x7F; + *pointer++ = (data >> 14) & 0x7F; + *pointer++ = (data >> 7) & 0x7F; + *pointer++ = (data) & 0x7F; +} + +void sysex_buffer_callback(MidiDevice * device, uint8_t length, uint8_t * data) { uint8_t * pointer_copy = data; if (*data++ != 0xF0) @@ -1180,28 +1197,31 @@ void sysex_buffer_callback(uint8_t length, uint8_t * data) { data++; switch (*data++) { + case 0x13: ; // Get info from keyboard + switch (*data++) { + case 0x00: ; // Get layer state + // send_dword(layer_state); + uint8_t chunk[5]; + encode_4byte_chunk(layer_state | default_layer_state, &chunk); + + uint8_t array[] = {0xF0, 0x00, 0x00, 0x00, 0x00, chunk[0], chunk[1], chunk[2], chunk[3], chunk[4], 0xF7}; + midi_send_array(&midi_device, 11, &array); + // midi_send_data(device, 3, 0x00, layer_state >> 24 & 0x7f, layer_state >> 16 & 0x7f); + // midi_send_data(device, 6, layer_state >> 8 & 0x7f, layer_state & 0x7f, 0xF7); + break; + } + #ifdef RGBLIGHT_ENABLE case 0x27: ; // RGB LED functions - switch (*data++) + switch (*data++) { case 0x00: ; // Update HSV - uint32_t part1 = *data++; - uint32_t part2 = *data++; - uint32_t part3 = *data++; - uint32_t part4 = *data++; - uint32_t part5 = *data++; - uint32_t chunk = ((part1 & 0x1FUL) << 28) | (part2 << 21) | (part3 << 14) | (part4 << 7) | part5; - // SEND_STRING("\nCHUNK: "); - // send_dword(chunk); + uint32_t chunk = decode_4byte_chunk(data); rgblight_sethsv(((chunk >> 16) & 0xFFFF) % 360, (chunk >> 8) & 0xFF, chunk & 0xFF); - // SEND_STRING("\nHUE: "); - // send_word(((chunk >> 16) & 0xFFFF) % 360); - // SEND_STRING("\nSAT: "); - // send_word((chunk >> 8) & 0xFF); - // SEND_STRING("\nVAL: "); - // send_word(chunk & 0xFF); break; case 0x01: ; // Update RGB break; + } break; + #endif } // SEND_STRING("\nDATA:\n"); @@ -1212,4 +1232,12 @@ void sysex_buffer_callback(uint8_t length, uint8_t * data) { } +void send_unicode_midi(uint32_t unicode) { + uint8_t chunk[5]; + encode_4byte_chunk(unicode, &chunk); + + uint8_t array[] = {0xF0, 0x00, 0x00, 0x00, 0x05, chunk[0], chunk[1], chunk[2], chunk[3], chunk[4], 0xF7}; + midi_send_array(&midi_device, 11, &array); +} + #endif diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h index aad08d640..3fec797b6 100644 --- a/tmk_core/protocol/lufa/lufa.h +++ b/tmk_core/protocol/lufa/lufa.h @@ -70,6 +70,7 @@ typedef struct { #ifdef MIDI_ENABLE void MIDI_Task(void); MidiDevice midi_device; +void send_unicode_midi(uint32_t unicode); #endif // #if LUFA_VERSION_INTEGER < 0x120730 -- cgit v1.2.3 From 7edac212c8ed8442bf4207e70dc8194631b2bf27 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sat, 26 Nov 2016 15:37:46 -0500 Subject: separated into api files/folder --- build_keyboard.mk | 8 ++ common.mk | 1 + keyboards/ergodox/keymaps/jack/keymap.c | 2 +- keyboards/ergodox/rules.mk | 1 - keyboards/planck/rules.mk | 1 + keyboards/preonic/keymaps/default/Makefile | 22 ---- keyboards/preonic/rules.mk | 3 +- quantum/api.c | 178 +++++++++++++++++++++++++ quantum/api.h | 59 +++++++++ quantum/api/api_sysex.c | 29 +++++ quantum/api/api_sysex.h | 10 ++ quantum/quantum.c | 6 +- quantum/quantum.h | 2 +- tmk_core/protocol/lufa/lufa.c | 203 +---------------------------- tmk_core/protocol/lufa/lufa.h | 61 +-------- 15 files changed, 303 insertions(+), 283 deletions(-) create mode 100644 quantum/api.c create mode 100644 quantum/api.h create mode 100644 quantum/api/api_sysex.c create mode 100644 quantum/api/api_sysex.h (limited to 'keyboards/ergodox/keymaps/jack/keymap.c') diff --git a/build_keyboard.mk b/build_keyboard.mk index 42f8f8ac7..c1e554003 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -131,6 +131,14 @@ ifndef CUSTOM_MATRIX SRC += $(QUANTUM_DIR)/matrix.c endif +ifeq ($(strip $(API_SYSEX_ENABLE)), yes) + OPT_DEFS += -DAPI_SYSEX_ENABLE + SRC += $(QUANTUM_DIR)/api/api_sysex.c + OPT_DEFS += -DAPI_ENABLE + SRC += $(QUANTUM_DIR)/api.c + MIDI_ENABLE=yes +endif + ifeq ($(strip $(MIDI_ENABLE)), yes) OPT_DEFS += -DMIDI_ENABLE SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c diff --git a/common.mk b/common.mk index 18751cd5a..c4b9394a2 100644 --- a/common.mk +++ b/common.mk @@ -23,4 +23,5 @@ COMMON_VPATH += $(QUANTUM_PATH) COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras COMMON_VPATH += $(QUANTUM_PATH)/audio COMMON_VPATH += $(QUANTUM_PATH)/process_keycode +COMMON_VPATH += $(QUANTUM_PATH)/api COMMON_VPATH += $(SERIAL_PATH) \ No newline at end of file diff --git a/keyboards/ergodox/keymaps/jack/keymap.c b/keyboards/ergodox/keymaps/jack/keymap.c index eb41f1212..9cb80c59d 100644 --- a/keyboards/ergodox/keymaps/jack/keymap.c +++ b/keyboards/ergodox/keymaps/jack/keymap.c @@ -91,7 +91,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) break; case 2: if (record->event.pressed) { // For resetting EEPROM - send_unicode_midi(0x0CA0); + api_send_unicode(0x0CA0); } break; } diff --git a/keyboards/ergodox/rules.mk b/keyboards/ergodox/rules.mk index add64ec76..2e501e81b 100644 --- a/keyboards/ergodox/rules.mk +++ b/keyboards/ergodox/rules.mk @@ -24,6 +24,5 @@ COMMAND_ENABLE ?= yes # Commands for debug and configuration CUSTOM_MATRIX ?= yes # Custom matrix file for the ErgoDox EZ 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 -MIDI_ENABLE ?= no # MIDI controls UNICODE_ENABLE ?= yes # Unicode ONEHAND_ENABLE ?= yes # Allow swapping hands of keyboard diff --git a/keyboards/planck/rules.mk b/keyboards/planck/rules.mk index 25db53a31..ccee97271 100644 --- a/keyboards/planck/rules.mk +++ b/keyboards/planck/rules.mk @@ -62,6 +62,7 @@ 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. +API_SYSEX_ENABLE = 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 \ No newline at end of file diff --git a/keyboards/preonic/keymaps/default/Makefile b/keyboards/preonic/keymaps/default/Makefile index 581e08cd0..3d4659ceb 100644 --- a/keyboards/preonic/keymaps/default/Makefile +++ b/keyboards/preonic/keymaps/default/Makefile @@ -1,25 +1,3 @@ - - -# 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 = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) -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 -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. - -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend - ifndef QUANTUM_DIR include ../../../../Makefile endif \ No newline at end of file diff --git a/keyboards/preonic/rules.mk b/keyboards/preonic/rules.mk index d0f3a3a1c..c4ce2aacc 100644 --- a/keyboards/preonic/rules.mk +++ b/keyboards/preonic/rules.mk @@ -53,7 +53,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 # the appropriate keymap folder that will get included automatically # BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) +MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) CONSOLE_ENABLE ?= no # Console for debug(+400) COMMAND_ENABLE ?= yes # Commands for debug and configuration @@ -64,6 +64,7 @@ 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. +API_SYSEX_ENABLE ?= 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 \ No newline at end of file diff --git a/quantum/api.c b/quantum/api.c new file mode 100644 index 000000000..4ca3b9676 --- /dev/null +++ b/quantum/api.c @@ -0,0 +1,178 @@ +#include "api.h" +#include "quantum.h" + +void dword_to_bytes(uint32_t dword, uint8_t * bytes) { + bytes[0] = (dword >> 24) & 0xFF; + bytes[1] = (dword >> 16) & 0xFF; + bytes[2] = (dword >> 8) & 0xFF; + bytes[3] = (dword >> 0) & 0xFF; +} + +uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index) { + return ((uint32_t)bytes[index + 0] << 24) | ((uint32_t)bytes[index + 1] << 16) | ((uint32_t)bytes[index + 2] << 8) | (uint32_t)bytes[index + 3]; +} + +__attribute__ ((weak)) +bool process_api_quantum(uint8_t length, uint8_t * data) { + return process_api_keyboard(length, data); +} + +__attribute__ ((weak)) +bool process_api_keyboard(uint8_t length, uint8_t * data) { + return process_api_user(length, data); +} + +__attribute__ ((weak)) +bool process_api_user(uint8_t length, uint8_t * data) { + return true; +} + +void process_api(uint16_t length, uint8_t * data) { + // SEND_STRING("\nRX: "); + // for (uint8_t i = 0; i < length; i++) { + // send_byte(data[i]); + // SEND_STRING(" "); + // } + if (!process_api_quantum(length, data)) + return; + + switch (data[0]) { + case MT_SET_DATA: + switch (data[1]) { + case DT_DEFAULT_LAYER: { + eeconfig_update_default_layer(data[2]); + default_layer_set((uint32_t)(data[2])); + break; + } + case DT_KEYMAP_OPTIONS: { + eeconfig_update_keymap(data[2]); + break; + } + case DT_RGBLIGHT: { + #ifdef RGBLIGHT_ENABLE + uint32_t rgblight = bytes_to_dword(data, 2); + rgblight_update_dword(rgblight); + #endif + break; + } + } + case MT_GET_DATA: + switch (data[1]) { + case DT_HANDSHAKE: { + MT_GET_DATA_ACK(DT_HANDSHAKE, NULL, 0); + break; + } + case DT_DEBUG: { + uint8_t debug_bytes[1] = { eeprom_read_byte(EECONFIG_DEBUG) }; + MT_GET_DATA_ACK(DT_DEBUG, debug_bytes, 1); + break; + } + case DT_DEFAULT_LAYER: { + uint8_t default_bytes[1] = { eeprom_read_byte(EECONFIG_DEFAULT_LAYER) }; + MT_GET_DATA_ACK(DT_DEFAULT_LAYER, default_bytes, 1); + break; + } + case DT_CURRENT_LAYER: { + uint8_t layer_state_bytes[4]; + dword_to_bytes(layer_state, layer_state_bytes); + MT_GET_DATA_ACK(DT_CURRENT_LAYER, layer_state_bytes, 4); + break; + } + case DT_AUDIO: { + #ifdef AUDIO_ENABLE + uint8_t audio_bytes[1] = { eeprom_read_byte(EECONFIG_AUDIO) }; + MT_GET_DATA_ACK(DT_AUDIO, audio_bytes, 1); + #else + MT_GET_DATA_ACK(DT_AUDIO, NULL, 0); + #endif + break; + } + case DT_BACKLIGHT: { + #ifdef BACKLIGHT_ENABLE + uint8_t backlight_bytes[1] = { eeprom_read_byte(EECONFIG_BACKLIGHT) }; + MT_GET_DATA_ACK(DT_BACKLIGHT, backlight_bytes, 1); + #else + MT_GET_DATA_ACK(DT_BACKLIGHT, NULL, 0); + #endif + break; + } + case DT_RGBLIGHT: { + #ifdef RGBLIGHT_ENABLE + uint8_t rgblight_bytes[4]; + dword_to_bytes(eeconfig_read_rgblight(), rgblight_bytes); + MT_GET_DATA_ACK(DT_RGBLIGHT, rgblight_bytes, 4); + #else + MT_GET_DATA_ACK(DT_RGBLIGHT, NULL, 0); + #endif + break; + } + case DT_KEYMAP_OPTIONS: { + uint8_t keymap_bytes[1] = { eeconfig_read_keymap() }; + MT_GET_DATA_ACK(DT_KEYMAP_OPTIONS, keymap_bytes, 1); + break; + } + case DT_KEYMAP_SIZE: { + uint8_t keymap_size[2] = {MATRIX_ROWS, MATRIX_COLS}; + MT_GET_DATA_ACK(DT_KEYMAP_SIZE, keymap_size, 2); + break; + } + case DT_KEYMAP: { + uint8_t keymap_data[MATRIX_ROWS * MATRIX_COLS * 4 + 3]; + keymap_data[0] = data[2]; + keymap_data[1] = MATRIX_ROWS; + keymap_data[2] = MATRIX_COLS; + for (int i = 0; i < MATRIX_ROWS; i++) { + for (int j = 0; j < MATRIX_COLS; j++) { + keymap_data[3 + (i*MATRIX_COLS*2) + (j*2)] = pgm_read_word(&keymaps[data[2]][i][j]) >> 8; + keymap_data[3 + (i*MATRIX_COLS*2) + (j*2) + 1] = pgm_read_word(&keymaps[data[2]][i][j]) & 0xFF; + } + } + MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, MATRIX_ROWS * MATRIX_COLS * 4 + 3); + // uint8_t keymap_data[5]; + // keymap_data[0] = data[2]; + // keymap_data[1] = data[3]; + // keymap_data[2] = data[4]; + // keymap_data[3] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) >> 8; + // keymap_data[4] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) & 0xFF; + + // MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, 5); + break; + } + default: + break; + } + break; + case MT_SET_DATA_ACK: + case MT_GET_DATA_ACK: + break; + case MT_SEND_DATA: + break; + case MT_SEND_DATA_ACK: + break; + case MT_EXE_ACTION: + break; + case MT_EXE_ACTION_ACK: + break; + case MT_TYPE_ERROR: + break; + default: ; // command not recognised + SEND_BYTES(MT_TYPE_ERROR, DT_NONE, data, length); + break; + + // #ifdef RGBLIGHT_ENABLE + // case 0x27: ; // RGB LED functions + // switch (*data++) { + // case 0x00: ; // Update HSV + // rgblight_sethsv((data[0] << 8 | data[1]) % 360, data[2], data[3]); + // break; + // case 0x01: ; // Update RGB + // break; + // case 0x02: ; // Update mode + // rgblight_mode(data[0]); + // break; + // } + // break; + // #endif + } + +} \ No newline at end of file diff --git a/quantum/api.h b/quantum/api.h new file mode 100644 index 000000000..00dcdb895 --- /dev/null +++ b/quantum/api.h @@ -0,0 +1,59 @@ +#ifndef _API_H_ +#define _API_H_ + +#include "lufa.h" + +enum MESSAGE_TYPE { + MT_GET_DATA = 0x10, // Get data from keyboard + MT_GET_DATA_ACK = 0x11, // returned data to process (ACK) + MT_SET_DATA = 0x20, // Set data on keyboard + MT_SET_DATA_ACK = 0x21, // returned data to confirm (ACK) + MT_SEND_DATA = 0x30, // Sending data/action from keyboard + MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK) + MT_EXE_ACTION = 0x40, // executing actions on keyboard + MT_EXE_ACTION_ACK =0x41, // return confirmation/value (ACK) + MT_TYPE_ERROR = 0x80 // type not recofgnised (ACK) +}; + +enum DATA_TYPE { + DT_NONE = 0x00, + DT_HANDSHAKE, + DT_DEFAULT_LAYER, + DT_CURRENT_LAYER, + DT_KEYMAP_OPTIONS, + DT_BACKLIGHT, + DT_RGBLIGHT, + DT_UNICODE, + DT_DEBUG, + DT_AUDIO, + DT_QUANTUM_ACTION, + DT_KEYBOARD_ACTION, + DT_USER_ACTION, + DT_KEYMAP_SIZE, + DT_KEYMAP +}; + +void dword_to_bytes(uint32_t dword, uint8_t * bytes); +uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index); + +#define MT_GET_DATA(data_type, data, length) SEND_BYTES(MT_GET_DATA, data_type, data, length) +#define MT_GET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_GET_DATA_ACK, data_type, data, length) +#define MT_SET_DATA(data_type, data, length) SEND_BYTES(MT_SET_DATA, data_type, data, length) +#define MT_SET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SET_DATA_ACK, data_type, data, length) +#define MT_SEND_DATA(data_type, data, length) SEND_BYTES(MT_SEND_DATA, data_type, data, length) +#define MT_SEND_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SEND_DATA_ACK, data_type, data, length) +#define MT_EXE_ACTION(data_type, data, length) SEND_BYTES(MT_EXE_ACTION, data_type, data, length) +#define MT_EXE_ACTION_ACK(data_type, data, length) SEND_BYTES(MT_EXE_ACTION_ACK, data_type, data, length) + +void process_api(uint16_t length, uint8_t * data); + +__attribute__ ((weak)) +bool process_api_quantum(uint8_t length, uint8_t * data); + +__attribute__ ((weak)) +bool process_api_keyboard(uint8_t length, uint8_t * data); + +__attribute__ ((weak)) +bool process_api_user(uint8_t length, uint8_t * data); + +#endif \ No newline at end of file diff --git a/quantum/api/api_sysex.c b/quantum/api/api_sysex.c new file mode 100644 index 000000000..a4a554e76 --- /dev/null +++ b/quantum/api/api_sysex.c @@ -0,0 +1,29 @@ +#include "api_sysex.h" + +void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length) { + // SEND_STRING("\nTX: "); + // for (uint8_t i = 0; i < length; i++) { + // send_byte(bytes[i]); + // SEND_STRING(" "); + // } + uint8_t * precode = malloc(sizeof(uint8_t) * (length + 2)); + precode[0] = message_type; + precode[1] = data_type; + memcpy(precode + 2, bytes, length); + uint8_t * encoded = malloc(sizeof(uint8_t) * (sysex_encoded_length(length + 2))); + uint16_t encoded_length = sysex_encode(encoded, precode, length + 2); + uint8_t * array = malloc(sizeof(uint8_t) * (encoded_length + 5)); + array[0] = 0xF0; + array[1] = 0x00; + array[2] = 0x00; + array[3] = 0x00; + array[encoded_length + 4] = 0xF7; + memcpy(array + 4, encoded, encoded_length); + midi_send_array(&midi_device, encoded_length + 5, array); + + // SEND_STRING("\nTD: "); + // for (uint8_t i = 0; i < encoded_length + 5; i++) { + // send_byte(array[i]); + // SEND_STRING(" "); + // } +} \ No newline at end of file diff --git a/quantum/api/api_sysex.h b/quantum/api/api_sysex.h new file mode 100644 index 000000000..b947b60e5 --- /dev/null +++ b/quantum/api/api_sysex.h @@ -0,0 +1,10 @@ +#ifndef _API_SYSEX_H_ +#define _API_SYSEX_H_ + +#include "api.h" + +void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length); + +#define SEND_BYTES(mt, dt, b, l) send_bytes_sysex(mt, dt, b, l) + +#endif \ No newline at end of file diff --git a/quantum/quantum.c b/quantum/quantum.c index 8372a7adc..f653564a6 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -847,12 +847,12 @@ void send_nibble(uint8_t number) { } } -void send_unicode_midi(uint32_t unicode) { - #ifdef MIDI_ENABLE +void api_send_unicode(uint32_t unicode) { +#ifdef API_ENABLE uint8_t chunk[4]; dword_to_bytes(unicode, chunk); MT_SEND_DATA(DT_UNICODE, chunk, 5); - #endif +#endif } __attribute__ ((weak)) diff --git a/quantum/quantum.h b/quantum/quantum.h index 316da15b9..e6adf974a 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -119,6 +119,6 @@ void send_nibble(uint8_t number); void led_set_user(uint8_t usb_led); void led_set_kb(uint8_t usb_led); -void send_unicode_midi(uint32_t unicode); +void api_send_unicode(uint32_t unicode); #endif diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index aa2e781c8..39d4824b6 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -1091,37 +1091,17 @@ void fallthrough_callback(MidiDevice * device, #endif } -#ifdef RGB_MIDI - rgblight_config_t rgblight_config; -#endif void cc_callback(MidiDevice * device, uint8_t chan, uint8_t num, uint8_t val) { //sending it back on the next channel // midi_send_cc(device, (chan + 1) % 16, num, val); - #ifdef RGB_MIDI - rgblight_config.raw = eeconfig_read_rgblight(); - switch (num) { - case 14: - rgblight_config.hue = val * 360 / 127; - break; - case 15: - rgblight_config.sat = val << 1; - break; - case 16: - rgblight_config.val = val << 1; - break; - } - rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); - #endif } uint8_t midi_buffer[MIDI_SYSEX_BUFFER] = {0}; void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data) { - // for (int i = 0; i < length; i++) - // midi_send_cc(device, 15, 0x7F & data[i], 0x7F & (start + i)); - // if (start == 0x27) { + #ifdef API_SYSEX_ENABLE // SEND_STRING("\n"); // send_word(start); // SEND_STRING(": "); @@ -1136,190 +1116,13 @@ void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t // } uint8_t * decoded = malloc(sizeof(uint8_t) * (sysex_decoded_length(start + place - 4))); uint16_t decode_length = sysex_decode(decoded, midi_buffer + 4, start + place - 4); - sysex_buffer_callback(device, decode_length, decoded); + process_api(decode_length, decoded); } // SEND_STRING(" "); data++; } - // } - -} - -void dword_to_bytes(uint32_t dword, uint8_t * bytes) { - bytes[0] = (dword >> 24) & 0xFF; - bytes[1] = (dword >> 16) & 0xFF; - bytes[2] = (dword >> 8) & 0xFF; - bytes[3] = (dword >> 0) & 0xFF; -} - -uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index) { - return ((uint32_t)bytes[index + 0] << 24) | ((uint32_t)bytes[index + 1] << 16) | ((uint32_t)bytes[index + 2] << 8) | (uint32_t)bytes[index + 3]; -} - -void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint8_t length) { - // SEND_STRING("\nTX: "); - // for (uint8_t i = 0; i < length; i++) { - // send_byte(bytes[i]); - // SEND_STRING(" "); - // } - uint8_t * precode = malloc(sizeof(uint8_t) * (length + 2)); - precode[0] = message_type; - precode[1] = data_type; - memcpy(precode + 2, bytes, length); - uint8_t * encoded = malloc(sizeof(uint8_t) * (sysex_encoded_length(length + 2))); - uint16_t encoded_length = sysex_encode(encoded, precode, length + 2); - uint8_t * array = malloc(sizeof(uint8_t) * (encoded_length + 5)); - array[0] = 0xF0; - array[1] = 0x00; - array[2] = 0x00; - array[3] = 0x00; - array[encoded_length + 4] = 0xF7; - memcpy(array + 4, encoded, encoded_length); - midi_send_array(&midi_device, encoded_length + 5, array); - - // SEND_STRING("\nTD: "); - // for (uint8_t i = 0; i < encoded_length + 5; i++) { - // send_byte(array[i]); - // SEND_STRING(" "); - // } -} - -__attribute__ ((weak)) -bool sysex_process_quantum(uint8_t length, uint8_t * data) { - return sysex_process_keyboard(length, data); -} - -__attribute__ ((weak)) -bool sysex_process_keyboard(uint8_t length, uint8_t * data) { - return sysex_process_user(length, data); -} - -__attribute__ ((weak)) -bool sysex_process_user(uint8_t length, uint8_t * data) { - return true; + #endif } -void sysex_buffer_callback(MidiDevice * device, uint8_t length, uint8_t * data) { - // SEND_STRING("\nRX: "); - // for (uint8_t i = 0; i < length; i++) { - // send_byte(data[i]); - // SEND_STRING(" "); - // } - if (!sysex_process_quantum(length, data)) - return; - - switch (data[0]) { - case MT_SET_DATA: - switch (data[1]) { - case DT_DEFAULT_LAYER: { - eeconfig_update_default_layer(data[2]); - default_layer_set((uint32_t)(data[2])); - break; - } - case DT_KEYMAP_OPTIONS: { - eeconfig_update_keymap(data[2]); - break; - } - case DT_RGBLIGHT: { - #ifdef RGBLIGHT_ENABLE - uint32_t rgblight = bytes_to_dword(data, 2); - rgblight_update_dword(rgblight); - #endif - break; - } - } - case MT_GET_DATA: - switch (data[1]) { - case DT_HANDSHAKE: { - MT_GET_DATA_ACK(DT_HANDSHAKE, NULL, 0); - break; - } - case DT_DEBUG: { - uint8_t debug_bytes[1] = { eeprom_read_byte(EECONFIG_DEBUG) }; - MT_GET_DATA_ACK(DT_DEBUG, debug_bytes, 1); - break; - } - case DT_DEFAULT_LAYER: { - uint8_t default_bytes[1] = { eeprom_read_byte(EECONFIG_DEFAULT_LAYER) }; - MT_GET_DATA_ACK(DT_DEFAULT_LAYER, default_bytes, 1); - break; - } - case DT_CURRENT_LAYER: { - uint8_t layer_state_bytes[4]; - dword_to_bytes(layer_state, layer_state_bytes); - MT_GET_DATA_ACK(DT_CURRENT_LAYER, layer_state_bytes, 4); - break; - } - case DT_AUDIO: { - #ifdef AUDIO_ENABLE - uint8_t audio_bytes[1] = { eeprom_read_byte(EECONFIG_AUDIO) }; - MT_GET_DATA_ACK(DT_AUDIO, audio_bytes, 1); - #else - MT_GET_DATA_ACK(DT_AUDIO, NULL, 0); - #endif - break; - } - case DT_BACKLIGHT: { - #ifdef BACKLIGHT_ENABLE - uint8_t backlight_bytes[1] = { eeprom_read_byte(EECONFIG_BACKLIGHT) }; - MT_GET_DATA_ACK(DT_BACKLIGHT, backlight_bytes, 1); - #else - MT_GET_DATA_ACK(DT_BACKLIGHT, NULL, 0); - #endif - break; - } - case DT_RGBLIGHT: { - #ifdef RGBLIGHT_ENABLE - uint8_t rgblight_bytes[4]; - dword_to_bytes(eeconfig_read_rgblight(), rgblight_bytes); - MT_GET_DATA_ACK(DT_RGBLIGHT, rgblight_bytes, 4); - #else - MT_GET_DATA_ACK(DT_RGBLIGHT, NULL, 0); - #endif - break; - } - case DT_KEYMAP_OPTIONS: { - uint8_t keymap_bytes[1] = { eeconfig_read_keymap() }; - MT_GET_DATA_ACK(DT_KEYMAP_OPTIONS, keymap_bytes, 1); - break; - } - default: - break; - } - break; - case MT_SET_DATA_ACK: - case MT_GET_DATA_ACK: - break; - case MT_SEND_DATA: - break; - case MT_SEND_DATA_ACK: - break; - case MT_EXE_ACTION: - break; - case MT_EXE_ACTION_ACK: - break; - case MT_TYPE_ERROR: - break; - default: ; // command not recognised - send_bytes_sysex(MT_TYPE_ERROR, DT_NONE, data, length); - break; - - // #ifdef RGBLIGHT_ENABLE - // case 0x27: ; // RGB LED functions - // switch (*data++) { - // case 0x00: ; // Update HSV - // rgblight_sethsv((data[0] << 8 | data[1]) % 360, data[2], data[3]); - // break; - // case 0x01: ; // Update RGB - // break; - // case 0x02: ; // Update mode - // rgblight_mode(data[0]); - // break; - // } - // break; - // #endif - } - -} #endif diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h index 0962dda8d..b11854101 100644 --- a/tmk_core/protocol/lufa/lufa.h +++ b/tmk_core/protocol/lufa/lufa.h @@ -68,64 +68,17 @@ typedef struct { } __attribute__ ((packed)) report_extra_t; #ifdef MIDI_ENABLE - #define MIDI_SYSEX_BUFFER 16 void MIDI_Task(void); MidiDevice midi_device; + #define MIDI_SYSEX_BUFFER 32 +#endif - void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data); - void sysex_buffer_callback(MidiDevice * device, uint8_t length, uint8_t * data); - void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint8_t length); - void dword_to_bytes(uint32_t dword, uint8_t * bytes); - uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index); - - __attribute__ ((weak)) - bool sysex_process_quantum(uint8_t length, uint8_t * data); - - __attribute__ ((weak)) - bool sysex_process_keyboard(uint8_t length, uint8_t * data); - - __attribute__ ((weak)) - bool sysex_process_user(uint8_t length, uint8_t * data); - - enum MESSAGE_TYPE { - MT_GET_DATA = 0x10, // Get data from keyboard - MT_GET_DATA_ACK = 0x11, // returned data to process (ACK) - MT_SET_DATA = 0x20, // Set data on keyboard - MT_SET_DATA_ACK = 0x21, // returned data to confirm (ACK) - MT_SEND_DATA = 0x30, // Sending data/action from keyboard - MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK) - MT_EXE_ACTION = 0x40, // executing actions on keyboard - MT_EXE_ACTION_ACK =0x41, // return confirmation/value (ACK) - MT_TYPE_ERROR = 0x80 // type not recofgnised (ACK) - }; - - enum DATA_TYPE { - DT_NONE = 0x00, - DT_HANDSHAKE, - DT_DEFAULT_LAYER, - DT_CURRENT_LAYER, - DT_KEYMAP_OPTIONS, - DT_BACKLIGHT, - DT_RGBLIGHT, - DT_UNICODE, - DT_DEBUG, - DT_AUDIO, - DT_QUANTUM_ACTION, - DT_KEYBOARD_ACTION, - DT_USER_ACTION, - - }; - - - #define MT_GET_DATA(data_type, data, length) send_bytes_sysex(MT_GET_DATA, data_type, data, length) - #define MT_GET_DATA_ACK(data_type, data, length) send_bytes_sysex(MT_GET_DATA_ACK, data_type, data, length) - #define MT_SET_DATA(data_type, data, length) send_bytes_sysex(MT_SET_DATA, data_type, data, length) - #define MT_SET_DATA_ACK(data_type, data, length) send_bytes_sysex(MT_SET_DATA_ACK, data_type, data, length) - #define MT_SEND_DATA(data_type, data, length) send_bytes_sysex(MT_SEND_DATA, data_type, data, length) - #define MT_SEND_DATA_ACK(data_type, data, length) send_bytes_sysex(MT_SEND_DATA_ACK, data_type, data, length) - #define MT_EXE_ACTION(data_type, data, length) send_bytes_sysex(MT_EXE_ACTION, data_type, data, length) - #define MT_EXE_ACTION_ACK(data_type, data, length) send_bytes_sysex(MT_EXE_ACTION_ACK, data_type, data, length) +#ifdef API_ENABLE + #include "api.h" +#endif +#ifdef API_SYSEX_ENABLE + #include "api_sysex.h" #endif // #if LUFA_VERSION_INTEGER < 0x120730 -- cgit v1.2.3