diff options
51 files changed, 1589 insertions, 174 deletions
diff --git a/build_keyboard.mk b/build_keyboard.mk index 61aebf393..42f8f8ac7 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk | |||
| @@ -174,6 +174,12 @@ ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | |||
| 174 | SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c | 174 | SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c |
| 175 | endif | 175 | endif |
| 176 | 176 | ||
| 177 | ifeq ($(strip $(PRINTING_ENABLE)), yes) | ||
| 178 | OPT_DEFS += -DPRINTING_ENABLE | ||
| 179 | SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c | ||
| 180 | SRC += $(TMK_DIR)/protocol/serial_uart.c | ||
| 181 | endif | ||
| 182 | |||
| 177 | ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes) | 183 | ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes) |
| 178 | SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC)) | 184 | SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC)) |
| 179 | OPT_DEFS += $(SERIAL_DEFS) | 185 | OPT_DEFS += $(SERIAL_DEFS) |
diff --git a/keyboards/amj60/config.h b/keyboards/amj60/config.h index d98e0e9f2..7c06f9a6c 100644 --- a/keyboards/amj60/config.h +++ b/keyboards/amj60/config.h | |||
| @@ -67,7 +67,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 67 | */ | 67 | */ |
| 68 | 68 | ||
| 69 | #define RGB_DI_PIN E2 | 69 | #define RGB_DI_PIN E2 |
| 70 | #define RGBLIGHT_TIMER | 70 | #define RGBLIGHT_ANIMATIONS |
| 71 | #define RGBLED_NUM 8 // Number of LEDs | 71 | #define RGBLED_NUM 8 // Number of LEDs |
| 72 | #define RGBLIGHT_HUE_STEP 10 | 72 | #define RGBLIGHT_HUE_STEP 10 |
| 73 | #define RGBLIGHT_SAT_STEP 17 | 73 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/clueboard/rev1/config.h b/keyboards/clueboard/rev1/config.h index 8c9497232..f40876ffb 100644 --- a/keyboards/clueboard/rev1/config.h +++ b/keyboards/clueboard/rev1/config.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | /* Underlight configuration | 26 | /* Underlight configuration |
| 27 | */ | 27 | */ |
| 28 | #define RGB_DI_PIN B2 | 28 | #define RGB_DI_PIN B2 |
| 29 | #define RGBLIGHT_TIMER | 29 | #define RGBLIGHT_ANIMATIONS |
| 30 | #define RGBLED_NUM 14 // Number of LEDs | 30 | #define RGBLED_NUM 14 // Number of LEDs |
| 31 | #define RGBLIGHT_HUE_STEP 10 | 31 | #define RGBLIGHT_HUE_STEP 10 |
| 32 | #define RGBLIGHT_SAT_STEP 17 | 32 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/clueboard/rev2/config.h b/keyboards/clueboard/rev2/config.h index 15ca4ece8..8435fd02b 100644 --- a/keyboards/clueboard/rev2/config.h +++ b/keyboards/clueboard/rev2/config.h | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | /* Underlight configuration | 30 | /* Underlight configuration |
| 31 | */ | 31 | */ |
| 32 | #define RGB_DI_PIN D7 | 32 | #define RGB_DI_PIN D7 |
| 33 | #define RGBLIGHT_TIMER | 33 | #define RGBLIGHT_ANIMATIONS |
| 34 | #define RGBLED_NUM 14 // Number of LEDs | 34 | #define RGBLED_NUM 14 // Number of LEDs |
| 35 | #define RGBLIGHT_HUE_STEP 10 | 35 | #define RGBLIGHT_HUE_STEP 10 |
| 36 | #define RGBLIGHT_SAT_STEP 17 | 36 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/cluecard/config.h b/keyboards/cluecard/config.h index 765347b13..6520eb557 100644 --- a/keyboards/cluecard/config.h +++ b/keyboards/cluecard/config.h | |||
| @@ -140,7 +140,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 140 | /* Underlight configuration | 140 | /* Underlight configuration |
| 141 | */ | 141 | */ |
| 142 | #define RGB_DI_PIN E6 | 142 | #define RGB_DI_PIN E6 |
| 143 | //#define RGBLIGHT_TIMER | 143 | //#define RGBLIGHT_ANIMATIONS |
| 144 | #define RGBLED_NUM 4 // Number of LEDs | 144 | #define RGBLED_NUM 4 // Number of LEDs |
| 145 | #define RGBLIGHT_HUE_STEP 10 | 145 | #define RGBLIGHT_HUE_STEP 10 |
| 146 | #define RGBLIGHT_SAT_STEP 17 | 146 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/cluecard/keymaps/rgb_effects/config.h b/keyboards/cluecard/keymaps/rgb_effects/config.h index e88847df4..c6c9342c8 100644 --- a/keyboards/cluecard/keymaps/rgb_effects/config.h +++ b/keyboards/cluecard/keymaps/rgb_effects/config.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include "../../config.h" | 4 | #include "../../config.h" |
| 5 | 5 | ||
| 6 | // place overrides here | 6 | // place overrides here |
| 7 | #define RGBLIGHT_TIMER | 7 | #define RGBLIGHT_ANIMATIONS |
| 8 | #define RGBLIGHT_EFFECT_SNAKE_LENGTH 3 | 8 | #define RGBLIGHT_EFFECT_SNAKE_LENGTH 3 |
| 9 | #define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 | 9 | #define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 |
| 10 | #define RGBLIGHT_EFFECT_KNIGHT_OFFSET 2 | 10 | #define RGBLIGHT_EFFECT_KNIGHT_OFFSET 2 |
diff --git a/keyboards/cluepad/config.h b/keyboards/cluepad/config.h index bae05fade..bd64dfd27 100644 --- a/keyboards/cluepad/config.h +++ b/keyboards/cluepad/config.h | |||
| @@ -70,7 +70,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 70 | /* Underlight configuration | 70 | /* Underlight configuration |
| 71 | */ | 71 | */ |
| 72 | #define RGB_DI_PIN F6 | 72 | #define RGB_DI_PIN F6 |
| 73 | #define RGBLIGHT_TIMER | 73 | #define RGBLIGHT_ANIMATIONS |
| 74 | #define RGBLED_NUM 4 // Number of LEDs | 74 | #define RGBLED_NUM 4 // Number of LEDs |
| 75 | #define RGBLIGHT_HUE_STEP 10 | 75 | #define RGBLIGHT_HUE_STEP 10 |
| 76 | #define RGBLIGHT_SAT_STEP 17 | 76 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h index 084a044ee..67a856e51 100644 --- a/keyboards/ergodox/ez/config.h +++ b/keyboards/ergodox/ez/config.h | |||
| @@ -21,6 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 21 | 21 | ||
| 22 | #include "../config.h" | 22 | #include "../config.h" |
| 23 | 23 | ||
| 24 | #include "config_common.h" | ||
| 25 | |||
| 24 | /* USB Device descriptor parameter */ | 26 | /* USB Device descriptor parameter */ |
| 25 | #define VENDOR_ID 0xFEED | 27 | #define VENDOR_ID 0xFEED |
| 26 | #define PRODUCT_ID 0x1307 | 28 | #define PRODUCT_ID 0x1307 |
diff --git a/keyboards/ergodox/ez/ez.c b/keyboards/ergodox/ez/ez.c index ddb8ff0cf..039e4c6bb 100644 --- a/keyboards/ergodox/ez/ez.c +++ b/keyboards/ergodox/ez/ez.c | |||
| @@ -16,10 +16,10 @@ void matrix_init_kb(void) { | |||
| 16 | // unused pins - C7, D4, D5, D7, E6 | 16 | // unused pins - C7, D4, D5, D7, E6 |
| 17 | // set as input with internal pull-ip enabled | 17 | // set as input with internal pull-ip enabled |
| 18 | DDRC &= ~(1<<7); | 18 | DDRC &= ~(1<<7); |
| 19 | DDRD &= ~(1<<7 | 1<<5 | 1<<4); | 19 | DDRD &= ~(1<<5 | 1<<4); |
| 20 | DDRE &= ~(1<<6); | 20 | DDRE &= ~(1<<6); |
| 21 | PORTC |= (1<<7); | 21 | PORTC |= (1<<7); |
| 22 | PORTD |= (1<<7 | 1<<5 | 1<<4); | 22 | PORTD |= (1<<5 | 1<<4); |
| 23 | PORTE |= (1<<6); | 23 | PORTE |= (1<<6); |
| 24 | 24 | ||
| 25 | ergodox_blink_all_leds(); | 25 | ergodox_blink_all_leds(); |
| @@ -51,6 +51,10 @@ uint8_t init_mcp23018(void) { | |||
| 51 | mcp23018_status = 0x20; | 51 | mcp23018_status = 0x20; |
| 52 | 52 | ||
| 53 | // I2C subsystem | 53 | // I2C subsystem |
| 54 | |||
| 55 | uint8_t sreg_prev; | ||
| 56 | sreg_prev=SREG; | ||
| 57 | cli(); | ||
| 54 | if (i2c_initialized == 0) { | 58 | if (i2c_initialized == 0) { |
| 55 | i2c_init(); // on pins D(1,0) | 59 | i2c_init(); // on pins D(1,0) |
| 56 | i2c_initialized++; | 60 | i2c_initialized++; |
| @@ -79,6 +83,8 @@ uint8_t init_mcp23018(void) { | |||
| 79 | out: | 83 | out: |
| 80 | i2c_stop(); | 84 | i2c_stop(); |
| 81 | 85 | ||
| 86 | SREG=sreg_prev; | ||
| 87 | |||
| 82 | return mcp23018_status; | 88 | return mcp23018_status; |
| 83 | } | 89 | } |
| 84 | 90 | ||
diff --git a/keyboards/ergodox/ez/matrix.c b/keyboards/ergodox/ez/matrix.c index a19bab90b..43f515259 100644 --- a/keyboards/ergodox/ez/matrix.c +++ b/keyboards/ergodox/ez/matrix.c | |||
| @@ -121,7 +121,7 @@ void matrix_init(void) | |||
| 121 | matrix_scan_count = 0; | 121 | matrix_scan_count = 0; |
| 122 | #endif | 122 | #endif |
| 123 | 123 | ||
| 124 | matrix_init_kb(); | 124 | matrix_init_quantum(); |
| 125 | 125 | ||
| 126 | } | 126 | } |
| 127 | 127 | ||
diff --git a/keyboards/ergodox/keymaps/erez_experimental/Makefile b/keyboards/ergodox/keymaps/erez_experimental/Makefile index b673c5ce5..dbe89d141 100644 --- a/keyboards/ergodox/keymaps/erez_experimental/Makefile +++ b/keyboards/ergodox/keymaps/erez_experimental/Makefile | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 4 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
| 5 | COMMAND_ENABLE = no # Commands for debug and configuration | 5 | COMMAND_ENABLE = no # Commands for debug and configuration |
| 6 | RGBLIGHT_ENABLE = yes | ||
| 7 | MIDI_ENABLE = yes | ||
| 6 | 8 | ||
| 7 | ifndef QUANTUM_DIR | 9 | ifndef QUANTUM_DIR |
| 8 | include ../../../../Makefile | 10 | include ../../../../Makefile |
diff --git a/keyboards/ergodox/keymaps/erez_experimental/config.h b/keyboards/ergodox/keymaps/erez_experimental/config.h index e5d7fe188..fbd12ab79 100644 --- a/keyboards/ergodox/keymaps/erez_experimental/config.h +++ b/keyboards/ergodox/keymaps/erez_experimental/config.h | |||
| @@ -8,5 +8,16 @@ | |||
| 8 | 8 | ||
| 9 | #undef LEADER_TIMEOUT | 9 | #undef LEADER_TIMEOUT |
| 10 | #define LEADER_TIMEOUT 300 | 10 | #define LEADER_TIMEOUT 300 |
| 11 | |||
| 12 | /* ws2812 RGB LED */ | ||
| 13 | #define RGB_DI_PIN D7 | ||
| 14 | #define RGBLIGHT_ANIMATIONS | ||
| 15 | #define RGBLED_NUM 15 // Number of LEDs | ||
| 16 | #define RGBLIGHT_HUE_STEP 12 | ||
| 17 | #define RGBLIGHT_SAT_STEP 255 | ||
| 18 | #define RGBLIGHT_VAL_STEP 12 | ||
| 19 | |||
| 20 | #define RGB_MIDI | ||
| 21 | #define RGBW_BB_TWI | ||
| 11 | 22 | ||
| 12 | #endif | 23 | #endif |
diff --git a/keyboards/ergodox/keymaps/erez_experimental/keymap.c b/keyboards/ergodox/keymaps/erez_experimental/keymap.c index 4804959d6..4a23c7ac5 100644 --- a/keyboards/ergodox/keymaps/erez_experimental/keymap.c +++ b/keyboards/ergodox/keymaps/erez_experimental/keymap.c | |||
| @@ -7,6 +7,12 @@ | |||
| 7 | #define SYMB 1 // symbols | 7 | #define SYMB 1 // symbols |
| 8 | #define MDIA 2 // media keys | 8 | #define MDIA 2 // media keys |
| 9 | 9 | ||
| 10 | enum custom_keycodes { | ||
| 11 | PLACEHOLDER = SAFE_RANGE, // can always be here | ||
| 12 | RGB_FF00BB // always start with RGB_ | ||
| 13 | }; | ||
| 14 | |||
| 15 | |||
| 10 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 16 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 11 | /* Keymap 0: Basic layer | 17 | /* Keymap 0: Basic layer |
| 12 | * | 18 | * |
| @@ -67,22 +73,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 67 | * ,-------------. ,-------------. | 73 | * ,-------------. ,-------------. |
| 68 | * | | | | | | | 74 | * | | | | | | |
| 69 | * ,------|------|------| |------+------+------. | 75 | * ,------|------|------| |------+------+------. |
| 70 | * | | | | | | | | | 76 | * |VAI |VAD |HUI | |SAI |TOG |MOD | |
| 71 | * | | |------| |------| | | | 77 | * | | |------| |------| | | |
| 72 | * | | | | | | | | | 78 | * | | |HUD | |SAD | | | |
| 73 | * `--------------------' `--------------------' | 79 | * `--------------------' `--------------------' |
| 74 | */ | 80 | */ |
| 75 | // SYMBOLS | 81 | // SYMBOLS |
| 76 | [SYMB] = KEYMAP( | 82 | [SYMB] = KEYMAP( |
| 77 | // left hand | 83 | // left hand |
| 78 | KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, | 84 | RGB_FF00BB, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, |
| 79 | KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | 85 | KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, |
| 80 | KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, | 86 | KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, |
| 81 | KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS, | 87 | KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS, |
| 82 | KC_TRNS, KC_TRNS,KC_TRNS,LCTL(KC_PGUP), LCTL(KC_PGDN), | 88 | KC_TRNS, KC_TRNS,KC_TRNS,LCTL(KC_PGUP), LCTL(KC_PGDN), |
| 83 | KC_TRNS,KC_TRNS, | 89 | KC_TRNS,KC_TRNS, |
| 84 | KC_TRNS, | 90 | RGB_HUI, |
| 85 | KC_TRNS,KC_TRNS,KC_TRNS, | 91 | RGB_VAI,RGB_VAD,RGB_HUD, |
| 86 | // right hand | 92 | // right hand |
| 87 | KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, | 93 | KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, |
| 88 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F12, | 94 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F12, |
| @@ -90,8 +96,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 90 | KC_TRNS, KC_PIPE, KC_AT, KC_EQL, KC_PERC, KC_TRNS, KC_TRNS, | 96 | KC_TRNS, KC_PIPE, KC_AT, KC_EQL, KC_PERC, KC_TRNS, KC_TRNS, |
| 91 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | 97 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, |
| 92 | KC_TRNS, KC_TRNS, | 98 | KC_TRNS, KC_TRNS, |
| 93 | KC_TRNS, | 99 | RGB_SAI, |
| 94 | KC_TRNS, KC_TRNS, KC_TRNS | 100 | RGB_SAD, RGB_TOG, RGB_MOD |
| 95 | ), | 101 | ), |
| 96 | /* Keymap 2: Media and mouse keys | 102 | /* Keymap 2: Media and mouse keys |
| 97 | * | 103 | * |
| @@ -152,6 +158,22 @@ void matrix_init_user(void) { | |||
| 152 | 158 | ||
| 153 | }; | 159 | }; |
| 154 | 160 | ||
| 161 | |||
| 162 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 163 | switch (keycode) { | ||
| 164 | // dynamically generate these. | ||
| 165 | case RGB_FF00BB: | ||
| 166 | if (record->event.pressed) { | ||
| 167 | rgblight_enable(); | ||
| 168 | rgblight_mode(1); | ||
| 169 | rgblight_setrgb(0xff,0x00,0xbb); | ||
| 170 | } | ||
| 171 | return false; | ||
| 172 | break; | ||
| 173 | } | ||
| 174 | return true; | ||
| 175 | } | ||
| 176 | |||
| 155 | LEADER_EXTERNS(); | 177 | LEADER_EXTERNS(); |
| 156 | 178 | ||
| 157 | // Runs constantly in the background, in a loop. | 179 | // Runs constantly in the background, in a loop. |
diff --git a/keyboards/ergodox/keymaps/jack/Makefile b/keyboards/ergodox/keymaps/jack/Makefile new file mode 100644 index 000000000..7c257af50 --- /dev/null +++ b/keyboards/ergodox/keymaps/jack/Makefile | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | RGBLIGHT_ENABLE = yes | ||
| 2 | MIDI_ENABLE = yes | ||
| 3 | |||
| 4 | ifndef QUANTUM_DIR | ||
| 5 | include ../../../../Makefile | ||
| 6 | endif | ||
diff --git a/keyboards/ergodox/keymaps/jack/config.h b/keyboards/ergodox/keymaps/jack/config.h new file mode 100644 index 000000000..5c1165226 --- /dev/null +++ b/keyboards/ergodox/keymaps/jack/config.h | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | /* ws2812 RGB LED */ | ||
| 7 | #define RGB_DI_PIN D7 | ||
| 8 | #define RGBLIGHT_ANIMATIONS | ||
| 9 | #define RGBLED_NUM 15 // Number of LEDs | ||
| 10 | #define RGBLIGHT_HUE_STEP 12 | ||
| 11 | #define RGBLIGHT_SAT_STEP 255 | ||
| 12 | #define RGBLIGHT_VAL_STEP 12 | ||
| 13 | |||
| 14 | #define RGB_MIDI | ||
| 15 | #define RGBW_BB_TWI | ||
| 16 | |||
| 17 | #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..eb41f1212 100644 --- a/keyboards/ergodox/keymaps/jack/keymap.c +++ b/keyboards/ergodox/keymaps/jack/keymap.c | |||
| @@ -19,14 +19,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 19 | KC_HOME, | 19 | KC_HOME, |
| 20 | KC_SPC,KC_SPC,KC_END, | 20 | KC_SPC,KC_SPC,KC_END, |
| 21 | // right hand | 21 | // right hand |
| 22 | KC_NO, KC_6, KC_7, KC_8, KC_9, KC_0, KC_NO, | 22 | KC_NO, M(1), KC_7, KC_8, KC_9, KC_0, KC_NO, |
| 23 | KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, | 23 | KC_NO, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, KC_P, KC_BSPC, |
| 24 | KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | 24 | RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_SCLN, KC_QUOT, |
| 25 | KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT, | 25 | KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT, |
| 26 | MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, | 26 | MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, |
| 27 | KC_NO, KC_NO, | 27 | RGB_TOG, RGB_HUI, |
| 28 | KC_PGUP, | 28 | RGB_MOD, |
| 29 | KC_PGDN, KC_SPC,KC_SPC | 29 | M(2), KC_SPC,KC_SPC |
| 30 | ), | 30 | ), |
| 31 | [SYMB] = KEYMAP( | 31 | [SYMB] = KEYMAP( |
| 32 | // left hand | 32 | // left hand |
| @@ -84,6 +84,16 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | |||
| 84 | unregister_code(KC_RSFT); | 84 | unregister_code(KC_RSFT); |
| 85 | } | 85 | } |
| 86 | break; | 86 | break; |
| 87 | case 1: | ||
| 88 | if (record->event.pressed) { // For resetting EEPROM | ||
| 89 | eeconfig_init(); | ||
| 90 | } | ||
| 91 | break; | ||
| 92 | case 2: | ||
| 93 | if (record->event.pressed) { // For resetting EEPROM | ||
| 94 | send_unicode_midi(0x0CA0); | ||
| 95 | } | ||
| 96 | break; | ||
| 87 | } | 97 | } |
| 88 | return MACRO_NONE; | 98 | return MACRO_NONE; |
| 89 | }; | 99 | }; |
diff --git a/keyboards/gh60/keymaps/robotmaxtron/config.h b/keyboards/gh60/keymaps/robotmaxtron/config.h index 6a29e6b8c..bcd753461 100644 --- a/keyboards/gh60/keymaps/robotmaxtron/config.h +++ b/keyboards/gh60/keymaps/robotmaxtron/config.h | |||
| @@ -182,7 +182,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 182 | #define ws2812_pin PF4 | 182 | #define ws2812_pin PF4 |
| 183 | */ | 183 | */ |
| 184 | #define RGB_DI_PIN F4 | 184 | #define RGB_DI_PIN F4 |
| 185 | #define RGBLIGHT_TIMER | 185 | #define RGBLIGHT_ANIMATIONS |
| 186 | #define RGBLED_NUM 8 // Number of LEDs | 186 | #define RGBLED_NUM 8 // Number of LEDs |
| 187 | #define RGBLIGHT_HUE_STEP 8 | 187 | #define RGBLIGHT_HUE_STEP 8 |
| 188 | #define RGBLIGHT_SAT_STEP 8 | 188 | #define RGBLIGHT_SAT_STEP 8 |
diff --git a/keyboards/handwired/minorca/keymaps/rgb/config.h b/keyboards/handwired/minorca/keymaps/rgb/config.h index deaac2e26..43b3c5911 100644 --- a/keyboards/handwired/minorca/keymaps/rgb/config.h +++ b/keyboards/handwired/minorca/keymaps/rgb/config.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | /* ws2812 RGB LED */ | 12 | /* ws2812 RGB LED */ |
| 13 | #define RGB_DI_PIN D5 | 13 | #define RGB_DI_PIN D5 |
| 14 | #define RGBLIGHT_TIMER | 14 | #define RGBLIGHT_ANIMATIONS |
| 15 | #define RGBLED_NUM 13 // Number of LEDs | 15 | #define RGBLED_NUM 13 // Number of LEDs |
| 16 | #define RGBLIGHT_HUE_STEP 10 | 16 | #define RGBLIGHT_HUE_STEP 10 |
| 17 | #define RGBLIGHT_SAT_STEP 17 | 17 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/jd40/config.h b/keyboards/jd40/config.h index e2594f4b3..047be5707 100644 --- a/keyboards/jd40/config.h +++ b/keyboards/jd40/config.h | |||
| @@ -70,7 +70,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 70 | ) | 70 | ) |
| 71 | 71 | ||
| 72 | #define RGB_DI_PIN D3 | 72 | #define RGB_DI_PIN D3 |
| 73 | #define RGBLIGHT_TIMER | 73 | #define RGBLIGHT_ANIMATIONS |
| 74 | #define RGBLED_NUM 12 // Number of LEDs | 74 | #define RGBLED_NUM 12 // Number of LEDs |
| 75 | #define RGBLIGHT_HUE_STEP 8 | 75 | #define RGBLIGHT_HUE_STEP 8 |
| 76 | #define RGBLIGHT_SAT_STEP 8 | 76 | #define RGBLIGHT_SAT_STEP 8 |
diff --git a/keyboards/kc60/keymaps/ws2812/config.h b/keyboards/kc60/keymaps/ws2812/config.h index 2f39ea8e5..43abf6228 100644 --- a/keyboards/kc60/keymaps/ws2812/config.h +++ b/keyboards/kc60/keymaps/ws2812/config.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | /* WS2812B RGB Underglow LED */ | 3 | /* WS2812B RGB Underglow LED */ |
| 4 | #define RGB_DI_PIN F5 // Based on wiring depicted in ws2812_wiring.jpg | 4 | #define RGB_DI_PIN F5 // Based on wiring depicted in ws2812_wiring.jpg |
| 5 | #define RGBLIGHT_TIMER | 5 | #define RGBLIGHT_ANIMATIONS |
| 6 | #define RGBLED_NUM 16 // Number of LEDs. Change this to match your use case. | 6 | #define RGBLED_NUM 16 // Number of LEDs. Change this to match your use case. |
| 7 | #define RGBLIGHT_HUE_STEP 8 | 7 | #define RGBLIGHT_HUE_STEP 8 |
| 8 | #define RGBLIGHT_SAT_STEP 8 | 8 | #define RGBLIGHT_SAT_STEP 8 |
diff --git a/keyboards/lets_split/config.h b/keyboards/lets_split/config.h index 1b7bbcbbb..4db45ab0b 100644 --- a/keyboards/lets_split/config.h +++ b/keyboards/lets_split/config.h | |||
| @@ -49,6 +49,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 49 | #define IS_COMMAND() ( \ | 49 | #define IS_COMMAND() ( \ |
| 50 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | 50 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ |
| 51 | ) | 51 | ) |
| 52 | |||
| 52 | /* disable debug print */ | 53 | /* disable debug print */ |
| 53 | //#define NO_DEBUG | 54 | //#define NO_DEBUG |
| 54 | 55 | ||
| @@ -68,4 +69,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 68 | #ifdef SUBPROJECT_rev2 | 69 | #ifdef SUBPROJECT_rev2 |
| 69 | #include "rev2/config.h" | 70 | #include "rev2/config.h" |
| 70 | #endif | 71 | #endif |
| 71 | #endif \ No newline at end of file | 72 | #endif |
diff --git a/keyboards/lets_split/keymaps/i2c/config.h b/keyboards/lets_split/keymaps/i2c/config.h index 2671fabf6..72e5ae66b 100644 --- a/keyboards/lets_split/keymaps/i2c/config.h +++ b/keyboards/lets_split/keymaps/i2c/config.h | |||
| @@ -75,7 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 75 | 75 | ||
| 76 | /* ws2812 RGB LED */ | 76 | /* ws2812 RGB LED */ |
| 77 | #define RGB_DI_PIN D4 | 77 | #define RGB_DI_PIN D4 |
| 78 | #define RGBLIGHT_TIMER | 78 | #define RGBLIGHT_ANIMATIONS |
| 79 | #define RGBLED_NUM 8 // Number of LEDs | 79 | #define RGBLED_NUM 8 // Number of LEDs |
| 80 | #define RGBLIGHT_HUE_STEP 10 | 80 | #define RGBLIGHT_HUE_STEP 10 |
| 81 | #define RGBLIGHT_SAT_STEP 17 | 81 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/lets_split/keymaps/serial/config.h b/keyboards/lets_split/keymaps/serial/config.h index f4d900acc..b0ad522fc 100644 --- a/keyboards/lets_split/keymaps/serial/config.h +++ b/keyboards/lets_split/keymaps/serial/config.h | |||
| @@ -75,7 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 75 | 75 | ||
| 76 | /* ws2812 RGB LED */ | 76 | /* ws2812 RGB LED */ |
| 77 | #define RGB_DI_PIN D4 | 77 | #define RGB_DI_PIN D4 |
| 78 | #define RGBLIGHT_TIMER | 78 | #define RGBLIGHT_ANIMATIONS |
| 79 | #define RGBLED_NUM 8 // Number of LEDs | 79 | #define RGBLED_NUM 8 // Number of LEDs |
| 80 | #define RGBLIGHT_HUE_STEP 10 | 80 | #define RGBLIGHT_HUE_STEP 10 |
| 81 | #define RGBLIGHT_SAT_STEP 17 | 81 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/phantom/config.h b/keyboards/phantom/config.h index 983a1d73f..71a33498b 100644 --- a/keyboards/phantom/config.h +++ b/keyboards/phantom/config.h | |||
| @@ -63,7 +63,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 63 | /* Underlight configuration | 63 | /* Underlight configuration |
| 64 | */ | 64 | */ |
| 65 | #define RGB_DI_PIN E2 | 65 | #define RGB_DI_PIN E2 |
| 66 | #define RGBLIGHT_TIMER | 66 | #define RGBLIGHT_ANIMATIONS |
| 67 | #define RGBLED_NUM 20 // Number of LEDs | 67 | #define RGBLED_NUM 20 // Number of LEDs |
| 68 | #define RGBLIGHT_HUE_STEP 10 | 68 | #define RGBLIGHT_HUE_STEP 10 |
| 69 | #define RGBLIGHT_SAT_STEP 17 | 69 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/planck/keymaps/default/Makefile b/keyboards/planck/keymaps/default/Makefile index 0f4953888..267a087ea 100644 --- a/keyboards/planck/keymaps/default/Makefile +++ b/keyboards/planck/keymaps/default/Makefile | |||
| @@ -5,17 +5,17 @@ | |||
| 5 | # the appropriate keymap folder that will get included automatically | 5 | # the appropriate keymap folder that will get included automatically |
| 6 | # | 6 | # |
| 7 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | 7 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) |
| 8 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | 8 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) |
| 9 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | 9 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) |
| 10 | CONSOLE_ENABLE = no # Console for debug(+400) | 10 | CONSOLE_ENABLE = no # Console for debug(+400) |
| 11 | COMMAND_ENABLE = yes # Commands for debug and configuration | 11 | COMMAND_ENABLE = no # Commands for debug and configuration |
| 12 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 12 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
| 13 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | 13 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality |
| 14 | MIDI_ENABLE = no # MIDI controls | 14 | MIDI_ENABLE = yes # MIDI controls |
| 15 | AUDIO_ENABLE = yes # Audio output on port C6 | 15 | AUDIO_ENABLE = yes # Audio output on port C6 |
| 16 | UNICODE_ENABLE = no # Unicode | 16 | UNICODE_ENABLE = no # Unicode |
| 17 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | 17 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID |
| 18 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | 18 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight |
| 19 | 19 | ||
| 20 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 20 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE |
| 21 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 21 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
diff --git a/keyboards/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c index 5f71ae7d1..ddbe4d7b2 100644 --- a/keyboards/planck/keymaps/default/keymap.c +++ b/keyboards/planck/keymaps/default/keymap.c | |||
| @@ -107,7 +107,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 107 | [_LOWER] = { | 107 | [_LOWER] = { |
| 108 | {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, | 108 | {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, |
| 109 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, | 109 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, |
| 110 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______}, | 110 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),KC_HOME, KC_END, _______}, |
| 111 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} | 111 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} |
| 112 | }, | 112 | }, |
| 113 | 113 | ||
| @@ -125,7 +125,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 125 | [_RAISE] = { | 125 | [_RAISE] = { |
| 126 | {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, | 126 | {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, |
| 127 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, | 127 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, |
| 128 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______}, | 128 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______}, |
| 129 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} | 129 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} |
| 130 | }, | 130 | }, |
| 131 | 131 | ||
diff --git a/keyboards/planck/keymaps/experimental/config.h b/keyboards/planck/keymaps/experimental/config.h index 52acd1905..cc093bee4 100644 --- a/keyboards/planck/keymaps/experimental/config.h +++ b/keyboards/planck/keymaps/experimental/config.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | /* ws2812 RGB LED */ | 10 | /* ws2812 RGB LED */ |
| 11 | #define RGB_DI_PIN B1 | 11 | #define RGB_DI_PIN B1 |
| 12 | #define RGBLIGHT_TIMER | 12 | #define RGBLIGHT_ANIMATIONS |
| 13 | #define RGBLED_NUM 8 // Number of LEDs | 13 | #define RGBLED_NUM 8 // Number of LEDs |
| 14 | #define RGBLIGHT_HUE_STEP 10 | 14 | #define RGBLIGHT_HUE_STEP 10 |
| 15 | #define RGBLIGHT_SAT_STEP 17 | 15 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/planck/keymaps/thermal_printer/Makefile b/keyboards/planck/keymaps/thermal_printer/Makefile new file mode 100644 index 000000000..3d1d11877 --- /dev/null +++ b/keyboards/planck/keymaps/thermal_printer/Makefile | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | |||
| 2 | |||
| 3 | # Build Options | ||
| 4 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 5 | # the appropriate keymap folder that will get included automatically | ||
| 6 | # | ||
| 7 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 8 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
| 9 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 10 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 11 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
| 12 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 13 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
| 14 | MIDI_ENABLE = no # MIDI controls | ||
| 15 | AUDIO_ENABLE = yes # Audio output on port C6 | ||
| 16 | UNICODE_ENABLE = no # Unicode | ||
| 17 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 18 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 19 | PRINTING_ENABLE = yes | ||
| 20 | |||
| 21 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 22 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 23 | |||
| 24 | ifndef QUANTUM_DIR | ||
| 25 | include ../../../../Makefile | ||
| 26 | endif | ||
diff --git a/keyboards/planck/keymaps/thermal_printer/config.h b/keyboards/planck/keymaps/thermal_printer/config.h new file mode 100644 index 000000000..430b6493c --- /dev/null +++ b/keyboards/planck/keymaps/thermal_printer/config.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | # define SERIAL_UART_BAUD 19200 | ||
| 7 | # define SERIAL_UART_DATA UDR1 | ||
| 8 | # define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1) | ||
| 9 | # define SERIAL_UART_RXD_VECT USART1_RX_vect | ||
| 10 | # define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1)) | ||
| 11 | # define SERIAL_UART_INIT() do { \ | ||
| 12 | /* baud rate */ \ | ||
| 13 | UBRR1L = SERIAL_UART_UBRR; \ | ||
| 14 | /* baud rate */ \ | ||
| 15 | UBRR1H = SERIAL_UART_UBRR >> 8; \ | ||
| 16 | /* enable TX */ \ | ||
| 17 | UCSR1B = _BV(TXEN1); \ | ||
| 18 | /* 8-bit data */ \ | ||
| 19 | UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ | ||
| 20 | sei(); \ | ||
| 21 | } while(0) | ||
| 22 | |||
| 23 | #endif \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/thermal_printer/keymap.c b/keyboards/planck/keymaps/thermal_printer/keymap.c new file mode 100644 index 000000000..e88059731 --- /dev/null +++ b/keyboards/planck/keymaps/thermal_printer/keymap.c | |||
| @@ -0,0 +1,314 @@ | |||
| 1 | // This is the canonical layout file for the Quantum project. If you want to add another keyboard, | ||
| 2 | // this is the style you want to emulate. | ||
| 3 | |||
| 4 | #include "planck.h" | ||
| 5 | #include "action_layer.h" | ||
| 6 | #ifdef AUDIO_ENABLE | ||
| 7 | #include "audio.h" | ||
| 8 | #endif | ||
| 9 | #include "eeconfig.h" | ||
| 10 | |||
| 11 | extern keymap_config_t keymap_config; | ||
| 12 | |||
| 13 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 14 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 15 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 16 | // entirely and just use numbers. | ||
| 17 | #define _QWERTY 0 | ||
| 18 | #define _COLEMAK 1 | ||
| 19 | #define _DVORAK 2 | ||
| 20 | #define _LOWER 3 | ||
| 21 | #define _RAISE 4 | ||
| 22 | #define _PLOVER 5 | ||
| 23 | #define _ADJUST 16 | ||
| 24 | |||
| 25 | enum planck_keycodes { | ||
| 26 | QWERTY = SAFE_RANGE, | ||
| 27 | COLEMAK, | ||
| 28 | DVORAK, | ||
| 29 | PLOVER, | ||
| 30 | LOWER, | ||
| 31 | RAISE, | ||
| 32 | BACKLIT, | ||
| 33 | EXT_PLV | ||
| 34 | }; | ||
| 35 | |||
| 36 | // Fillers to make layering more clear | ||
| 37 | #define _______ KC_TRNS | ||
| 38 | #define XXXXXXX KC_NO | ||
| 39 | |||
| 40 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 41 | |||
| 42 | /* Qwerty | ||
| 43 | * ,-----------------------------------------------------------------------------------. | ||
| 44 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | | ||
| 45 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 46 | * | Esc | A | S | D | F | G | H | J | K | L | ; | " | | ||
| 47 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 48 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
| 49 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 50 | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | ||
| 51 | * `-----------------------------------------------------------------------------------' | ||
| 52 | */ | ||
| 53 | [_QWERTY] = { | ||
| 54 | {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, | ||
| 55 | {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, | ||
| 56 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, | ||
| 57 | {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | ||
| 58 | }, | ||
| 59 | |||
| 60 | /* Colemak | ||
| 61 | * ,-----------------------------------------------------------------------------------. | ||
| 62 | * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | | ||
| 63 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 64 | * | Esc | A | R | S | T | D | H | N | E | I | O | " | | ||
| 65 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 66 | * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | | ||
| 67 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 68 | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | ||
| 69 | * `-----------------------------------------------------------------------------------' | ||
| 70 | */ | ||
| 71 | [_COLEMAK] = { | ||
| 72 | {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, | ||
| 73 | {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, | ||
| 74 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, | ||
| 75 | {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | ||
| 76 | }, | ||
| 77 | |||
| 78 | /* Dvorak | ||
| 79 | * ,-----------------------------------------------------------------------------------. | ||
| 80 | * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | | ||
| 81 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 82 | * | Esc | A | O | E | U | I | D | H | T | N | S | / | | ||
| 83 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 84 | * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | | ||
| 85 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 86 | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | ||
| 87 | * `-----------------------------------------------------------------------------------' | ||
| 88 | */ | ||
| 89 | [_DVORAK] = { | ||
| 90 | {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, | ||
| 91 | {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, | ||
| 92 | {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, | ||
| 93 | {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | ||
| 94 | }, | ||
| 95 | |||
| 96 | /* Lower | ||
| 97 | * ,-----------------------------------------------------------------------------------. | ||
| 98 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
| 99 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 100 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | ||
| 101 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 102 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | | ||
| 103 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 104 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 105 | * `-----------------------------------------------------------------------------------' | ||
| 106 | */ | ||
| 107 | [_LOWER] = { | ||
| 108 | {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, | ||
| 109 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, | ||
| 110 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______}, | ||
| 111 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} | ||
| 112 | }, | ||
| 113 | |||
| 114 | /* Raise | ||
| 115 | * ,-----------------------------------------------------------------------------------. | ||
| 116 | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | | ||
| 117 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 118 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | | ||
| 119 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 120 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | | ||
| 121 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 122 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 123 | * `-----------------------------------------------------------------------------------' | ||
| 124 | */ | ||
| 125 | [_RAISE] = { | ||
| 126 | {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, | ||
| 127 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, | ||
| 128 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______}, | ||
| 129 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} | ||
| 130 | }, | ||
| 131 | |||
| 132 | /* Plover layer (http://opensteno.org) | ||
| 133 | * ,-----------------------------------------------------------------------------------. | ||
| 134 | * | # | # | # | # | # | # | # | # | # | # | # | # | | ||
| 135 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 136 | * | | S | T | P | H | * | * | F | P | L | T | D | | ||
| 137 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 138 | * |TogOut| S | K | W | R | * | * | R | B | G | S | Z | | ||
| 139 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 140 | * | Exit | | | A | O | | E | U | | | | | ||
| 141 | * `-----------------------------------------------------------------------------------' | ||
| 142 | */ | ||
| 143 | |||
| 144 | [_PLOVER] = { | ||
| 145 | {KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 }, | ||
| 146 | {XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC}, | ||
| 147 | {XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, | ||
| 148 | {EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX} | ||
| 149 | }, | ||
| 150 | |||
| 151 | /* Adjust (Lower + Raise) | ||
| 152 | * ,-----------------------------------------------------------------------------------. | ||
| 153 | * | | Reset| | Print|no prnt | | | | | | | Del | | ||
| 154 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 155 | * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | | ||
| 156 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 157 | * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | | ||
| 158 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 159 | * | | | | | | | | | | | | | ||
| 160 | * `-----------------------------------------------------------------------------------' | ||
| 161 | */ | ||
| 162 | [_ADJUST] = { | ||
| 163 | {_______, RESET, _______, PRINT_ON, PRINT_OFF, _______, _______, _______, _______, _______, _______, KC_DEL}, | ||
| 164 | {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______}, | ||
| 165 | {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, | ||
| 166 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} | ||
| 167 | } | ||
| 168 | |||
| 169 | |||
| 170 | }; | ||
| 171 | |||
| 172 | #ifdef AUDIO_ENABLE | ||
| 173 | |||
| 174 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
| 175 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 176 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
| 177 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
| 178 | float tone_plover[][2] = SONG(PLOVER_SOUND); | ||
| 179 | float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); | ||
| 180 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
| 181 | |||
| 182 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
| 183 | #endif | ||
| 184 | |||
| 185 | |||
| 186 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 187 | eeconfig_update_default_layer(default_layer); | ||
| 188 | default_layer_set(default_layer); | ||
| 189 | } | ||
| 190 | |||
| 191 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 192 | switch (keycode) { | ||
| 193 | case QWERTY: | ||
| 194 | if (record->event.pressed) { | ||
| 195 | #ifdef AUDIO_ENABLE | ||
| 196 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
| 197 | #endif | ||
| 198 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 199 | } | ||
| 200 | return false; | ||
| 201 | break; | ||
| 202 | case COLEMAK: | ||
| 203 | if (record->event.pressed) { | ||
| 204 | #ifdef AUDIO_ENABLE | ||
| 205 | PLAY_NOTE_ARRAY(tone_colemak, false, 0); | ||
| 206 | #endif | ||
| 207 | persistant_default_layer_set(1UL<<_COLEMAK); | ||
| 208 | } | ||
| 209 | return false; | ||
| 210 | break; | ||
| 211 | case DVORAK: | ||
| 212 | if (record->event.pressed) { | ||
| 213 | #ifdef AUDIO_ENABLE | ||
| 214 | PLAY_NOTE_ARRAY(tone_dvorak, false, 0); | ||
| 215 | #endif | ||
| 216 | persistant_default_layer_set(1UL<<_DVORAK); | ||
| 217 | } | ||
| 218 | return false; | ||
| 219 | break; | ||
| 220 | case LOWER: | ||
| 221 | if (record->event.pressed) { | ||
| 222 | layer_on(_LOWER); | ||
| 223 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 224 | } else { | ||
| 225 | layer_off(_LOWER); | ||
| 226 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 227 | } | ||
| 228 | return false; | ||
| 229 | break; | ||
| 230 | case RAISE: | ||
| 231 | if (record->event.pressed) { | ||
| 232 | layer_on(_RAISE); | ||
| 233 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 234 | } else { | ||
| 235 | layer_off(_RAISE); | ||
| 236 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 237 | } | ||
| 238 | return false; | ||
| 239 | break; | ||
| 240 | case BACKLIT: | ||
| 241 | if (record->event.pressed) { | ||
| 242 | register_code(KC_RSFT); | ||
| 243 | #ifdef BACKLIGHT_ENABLE | ||
| 244 | backlight_step(); | ||
| 245 | #endif | ||
| 246 | } else { | ||
| 247 | unregister_code(KC_RSFT); | ||
| 248 | } | ||
| 249 | return false; | ||
| 250 | break; | ||
| 251 | case PLOVER: | ||
| 252 | if (record->event.pressed) { | ||
| 253 | #ifdef AUDIO_ENABLE | ||
| 254 | stop_all_notes(); | ||
| 255 | PLAY_NOTE_ARRAY(tone_plover, false, 0); | ||
| 256 | #endif | ||
| 257 | layer_off(_RAISE); | ||
| 258 | layer_off(_LOWER); | ||
| 259 | layer_off(_ADJUST); | ||
| 260 | layer_on(_PLOVER); | ||
| 261 | if (!eeconfig_is_enabled()) { | ||
| 262 | eeconfig_init(); | ||
| 263 | } | ||
| 264 | keymap_config.raw = eeconfig_read_keymap(); | ||
| 265 | keymap_config.nkro = 1; | ||
| 266 | eeconfig_update_keymap(keymap_config.raw); | ||
| 267 | } | ||
| 268 | return false; | ||
| 269 | break; | ||
| 270 | case EXT_PLV: | ||
| 271 | if (record->event.pressed) { | ||
| 272 | #ifdef AUDIO_ENABLE | ||
| 273 | PLAY_NOTE_ARRAY(tone_plover_gb, false, 0); | ||
| 274 | #endif | ||
| 275 | layer_off(_PLOVER); | ||
| 276 | } | ||
| 277 | return false; | ||
| 278 | break; | ||
| 279 | } | ||
| 280 | return true; | ||
| 281 | } | ||
| 282 | |||
| 283 | void matrix_init_user(void) { | ||
| 284 | #ifdef AUDIO_ENABLE | ||
| 285 | startup_user(); | ||
| 286 | #endif | ||
| 287 | } | ||
| 288 | |||
| 289 | #ifdef AUDIO_ENABLE | ||
| 290 | |||
| 291 | void startup_user() | ||
| 292 | { | ||
| 293 | _delay_ms(20); // gets rid of tick | ||
| 294 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
| 295 | } | ||
| 296 | |||
| 297 | void shutdown_user() | ||
| 298 | { | ||
| 299 | PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||
| 300 | _delay_ms(150); | ||
| 301 | stop_all_notes(); | ||
| 302 | } | ||
| 303 | |||
| 304 | void music_on_user(void) | ||
| 305 | { | ||
| 306 | music_scale_user(); | ||
| 307 | } | ||
| 308 | |||
| 309 | void music_scale_user(void) | ||
| 310 | { | ||
| 311 | PLAY_NOTE_ARRAY(music_scale, false, 0); | ||
| 312 | } | ||
| 313 | |||
| 314 | #endif | ||
diff --git a/keyboards/planck/keymaps/thermal_printer/readme.md b/keyboards/planck/keymaps/thermal_printer/readme.md new file mode 100644 index 000000000..de9680b49 --- /dev/null +++ b/keyboards/planck/keymaps/thermal_printer/readme.md | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | # The Default Planck Layout | ||
| 2 | |||
diff --git a/keyboards/planck/keymaps/yang/config.h b/keyboards/planck/keymaps/yang/config.h index feb5a1190..4ed19d76f 100644 --- a/keyboards/planck/keymaps/yang/config.h +++ b/keyboards/planck/keymaps/yang/config.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | /* ws2812 RGB LED */ | 6 | /* ws2812 RGB LED */ |
| 7 | #define RGB_DI_PIN D1 | 7 | #define RGB_DI_PIN D1 |
| 8 | #define RGBLIGHT_TIMER | 8 | #define RGBLIGHT_ANIMATIONS |
| 9 | #define RGBLED_NUM 28 // Number of LEDs | 9 | #define RGBLED_NUM 28 // Number of LEDs |
| 10 | #define RGBLIGHT_HUE_STEP 10 | 10 | #define RGBLIGHT_HUE_STEP 10 |
| 11 | #define RGBLIGHT_SAT_STEP 17 | 11 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/preonic/config.h b/keyboards/preonic/config.h index 3fb978c2f..f88acf211 100644 --- a/keyboards/preonic/config.h +++ b/keyboards/preonic/config.h | |||
| @@ -63,7 +63,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 63 | 63 | ||
| 64 | /* ws2812 RGB LED */ | 64 | /* ws2812 RGB LED */ |
| 65 | #define RGB_DI_PIN D1 | 65 | #define RGB_DI_PIN D1 |
| 66 | #define RGBLIGHT_TIMER | 66 | #define RGBLIGHT_ANIMATIONS |
| 67 | #define RGBLED_NUM 28 // Number of LEDs | 67 | #define RGBLED_NUM 28 // Number of LEDs |
| 68 | #define RGBLIGHT_HUE_STEP 10 | 68 | #define RGBLIGHT_HUE_STEP 10 |
| 69 | #define RGBLIGHT_SAT_STEP 17 | 69 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/preonic/keymaps/kinesis/config.h b/keyboards/preonic/keymaps/kinesis/config.h index 086baa84f..e6099ceb8 100644 --- a/keyboards/preonic/keymaps/kinesis/config.h +++ b/keyboards/preonic/keymaps/kinesis/config.h | |||
| @@ -63,7 +63,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 63 | 63 | ||
| 64 | /* ws2812 RGB LED */ | 64 | /* ws2812 RGB LED */ |
| 65 | #define RGB_DI_PIN D1 | 65 | #define RGB_DI_PIN D1 |
| 66 | #define RGBLIGHT_TIMER | 66 | #define RGBLIGHT_ANIMATIONS |
| 67 | #define RGBLED_NUM 28 // Number of LEDs | 67 | #define RGBLED_NUM 28 // Number of LEDs |
| 68 | #define RGBLIGHT_HUE_STEP 10 | 68 | #define RGBLIGHT_HUE_STEP 10 |
| 69 | #define RGBLIGHT_SAT_STEP 17 | 69 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/satan/config.h b/keyboards/satan/config.h index 7e9f91cc8..eb357b39e 100644 --- a/keyboards/satan/config.h +++ b/keyboards/satan/config.h | |||
| @@ -67,7 +67,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 67 | */ | 67 | */ |
| 68 | 68 | ||
| 69 | #define RGB_DI_PIN E2 | 69 | #define RGB_DI_PIN E2 |
| 70 | #define RGBLIGHT_TIMER | 70 | #define RGBLIGHT_ANIMATIONS |
| 71 | #define RGBLED_NUM 8 // Number of LEDs | 71 | #define RGBLED_NUM 8 // Number of LEDs |
| 72 | #define RGBLIGHT_HUE_STEP 10 | 72 | #define RGBLIGHT_HUE_STEP 10 |
| 73 | #define RGBLIGHT_SAT_STEP 17 | 73 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/keyboards/tada68/config.h b/keyboards/tada68/config.h index 5d8757936..19cf9c9b3 100644 --- a/keyboards/tada68/config.h +++ b/keyboards/tada68/config.h | |||
| @@ -67,7 +67,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 67 | */ | 67 | */ |
| 68 | 68 | ||
| 69 | /*#define RGB_DI_PIN E2 | 69 | /*#define RGB_DI_PIN E2 |
| 70 | #define RGBLIGHT_TIMER | 70 | #define RGBLIGHT_ANIMATIONS |
| 71 | #define RGBLED_NUM 2 // Number of LEDs | 71 | #define RGBLED_NUM 2 // Number of LEDs |
| 72 | #define RGBLIGHT_HUE_STEP 10 | 72 | #define RGBLIGHT_HUE_STEP 10 |
| 73 | #define RGBLIGHT_SAT_STEP 17 | 73 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/quantum/config_common.h b/quantum/config_common.h index 8ed5f4a10..f3897dc2c 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h | |||
| @@ -5,55 +5,56 @@ | |||
| 5 | #define COL2ROW 0 | 5 | #define COL2ROW 0 |
| 6 | #define ROW2COL 1 | 6 | #define ROW2COL 1 |
| 7 | /* I/O pins */ | 7 | /* I/O pins */ |
| 8 | #define B0 0x30 | 8 | #ifndef F0 |
| 9 | #define B1 0x31 | 9 | #define B0 0x30 |
| 10 | #define B2 0x32 | 10 | #define B1 0x31 |
| 11 | #define B3 0x33 | 11 | #define B2 0x32 |
| 12 | #define B4 0x34 | 12 | #define B3 0x33 |
| 13 | #define B5 0x35 | 13 | #define B4 0x34 |
| 14 | #define B6 0x36 | 14 | #define B5 0x35 |
| 15 | #define B7 0x37 | 15 | #define B6 0x36 |
| 16 | #define C0 0x60 | 16 | #define B7 0x37 |
| 17 | #define C1 0x61 | 17 | #define C0 0x60 |
| 18 | #define C2 0x62 | 18 | #define C1 0x61 |
| 19 | #define C3 0x63 | 19 | #define C2 0x62 |
| 20 | #define C4 0x64 | 20 | #define C3 0x63 |
| 21 | #define C5 0x65 | 21 | #define C4 0x64 |
| 22 | #define C6 0x66 | 22 | #define C5 0x65 |
| 23 | #define C7 0x67 | 23 | #define C6 0x66 |
| 24 | #define D0 0x90 | 24 | #define C7 0x67 |
| 25 | #define D1 0x91 | 25 | #define D0 0x90 |
| 26 | #define D2 0x92 | 26 | #define D1 0x91 |
| 27 | #define D3 0x93 | 27 | #define D2 0x92 |
| 28 | #define D4 0x94 | 28 | #define D3 0x93 |
| 29 | #define D5 0x95 | 29 | #define D4 0x94 |
| 30 | #define D6 0x96 | 30 | #define D5 0x95 |
| 31 | #define D7 0x97 | 31 | #define D6 0x96 |
| 32 | #define E0 0xC0 | 32 | #define D7 0x97 |
| 33 | #define E1 0xC1 | 33 | #define E0 0xC0 |
| 34 | #define E2 0xC2 | 34 | #define E1 0xC1 |
| 35 | #define E3 0xC3 | 35 | #define E2 0xC2 |
| 36 | #define E4 0xC4 | 36 | #define E3 0xC3 |
| 37 | #define E5 0xC5 | 37 | #define E4 0xC4 |
| 38 | #define E6 0xC6 | 38 | #define E5 0xC5 |
| 39 | #define E7 0xC7 | 39 | #define E6 0xC6 |
| 40 | #define F0 0xF0 | 40 | #define E7 0xC7 |
| 41 | #define F1 0xF1 | 41 | #define F0 0xF0 |
| 42 | #define F2 0xF2 | 42 | #define F1 0xF1 |
| 43 | #define F3 0xF3 | 43 | #define F2 0xF2 |
| 44 | #define F4 0xF4 | 44 | #define F3 0xF3 |
| 45 | #define F5 0xF5 | 45 | #define F4 0xF4 |
| 46 | #define F6 0xF6 | 46 | #define F5 0xF5 |
| 47 | #define F7 0xF7 | 47 | #define F6 0xF6 |
| 48 | #define A0 0x00 | 48 | #define F7 0xF7 |
| 49 | #define A1 0x01 | 49 | #define A0 0x00 |
| 50 | #define A2 0x02 | 50 | #define A1 0x01 |
| 51 | #define A3 0x03 | 51 | #define A2 0x02 |
| 52 | #define A4 0x04 | 52 | #define A3 0x03 |
| 53 | #define A5 0x05 | 53 | #define A4 0x04 |
| 54 | #define A6 0x06 | 54 | #define A5 0x05 |
| 55 | #define A7 0x07 | 55 | #define A6 0x06 |
| 56 | 56 | #define A7 0x07 | |
| 57 | #endif | ||
| 57 | 58 | ||
| 58 | /* USART configuration */ | 59 | /* USART configuration */ |
| 59 | #ifdef BLUETOOTH_ENABLE | 60 | #ifdef BLUETOOTH_ENABLE |
diff --git a/quantum/keymap.h b/quantum/keymap.h index a01bbfbd1..ae56d16c7 100644 --- a/quantum/keymap.h +++ b/quantum/keymap.h | |||
| @@ -178,6 +178,10 @@ enum quantum_keycodes { | |||
| 178 | // Right shift, close paren | 178 | // Right shift, close paren |
| 179 | KC_RSPC, | 179 | KC_RSPC, |
| 180 | 180 | ||
| 181 | // Printing | ||
| 182 | PRINT_ON, | ||
| 183 | PRINT_OFF, | ||
| 184 | |||
| 181 | // always leave at the end | 185 | // always leave at the end |
| 182 | SAFE_RANGE | 186 | SAFE_RANGE |
| 183 | }; | 187 | }; |
diff --git a/quantum/light_ws2812.c b/quantum/light_ws2812.c index 401845e85..a883b1388 100755 --- a/quantum/light_ws2812.c +++ b/quantum/light_ws2812.c | |||
| @@ -16,14 +16,128 @@ | |||
| 16 | #include <util/delay.h> | 16 | #include <util/delay.h> |
| 17 | #include "debug.h" | 17 | #include "debug.h" |
| 18 | 18 | ||
| 19 | #ifdef RGBW_BB_TWI | ||
| 20 | |||
| 21 | // Port for the I2C | ||
| 22 | #define I2C_DDR DDRD | ||
| 23 | #define I2C_PIN PIND | ||
| 24 | #define I2C_PORT PORTD | ||
| 25 | |||
| 26 | // Pins to be used in the bit banging | ||
| 27 | #define I2C_CLK 0 | ||
| 28 | #define I2C_DAT 1 | ||
| 29 | |||
| 30 | #define I2C_DATA_HI()\ | ||
| 31 | I2C_DDR &= ~ (1 << I2C_DAT);\ | ||
| 32 | I2C_PORT |= (1 << I2C_DAT); | ||
| 33 | #define I2C_DATA_LO()\ | ||
| 34 | I2C_DDR |= (1 << I2C_DAT);\ | ||
| 35 | I2C_PORT &= ~ (1 << I2C_DAT); | ||
| 36 | |||
| 37 | #define I2C_CLOCK_HI()\ | ||
| 38 | I2C_DDR &= ~ (1 << I2C_CLK);\ | ||
| 39 | I2C_PORT |= (1 << I2C_CLK); | ||
| 40 | #define I2C_CLOCK_LO()\ | ||
| 41 | I2C_DDR |= (1 << I2C_CLK);\ | ||
| 42 | I2C_PORT &= ~ (1 << I2C_CLK); | ||
| 43 | |||
| 44 | #define I2C_DELAY 1 | ||
| 45 | |||
| 46 | void I2C_WriteBit(unsigned char c) | ||
| 47 | { | ||
| 48 | if (c > 0) | ||
| 49 | { | ||
| 50 | I2C_DATA_HI(); | ||
| 51 | } | ||
| 52 | else | ||
| 53 | { | ||
| 54 | I2C_DATA_LO(); | ||
| 55 | } | ||
| 56 | |||
| 57 | I2C_CLOCK_HI(); | ||
| 58 | _delay_us(I2C_DELAY); | ||
| 59 | |||
| 60 | I2C_CLOCK_LO(); | ||
| 61 | _delay_us(I2C_DELAY); | ||
| 62 | |||
| 63 | if (c > 0) | ||
| 64 | { | ||
| 65 | I2C_DATA_LO(); | ||
| 66 | } | ||
| 67 | |||
| 68 | _delay_us(I2C_DELAY); | ||
| 69 | } | ||
| 70 | |||
| 71 | // Inits bitbanging port, must be called before using the functions below | ||
| 72 | // | ||
| 73 | void I2C_Init() | ||
| 74 | { | ||
| 75 | I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); | ||
| 76 | |||
| 77 | I2C_CLOCK_HI(); | ||
| 78 | I2C_DATA_HI(); | ||
| 79 | |||
| 80 | _delay_us(I2C_DELAY); | ||
| 81 | } | ||
| 82 | |||
| 83 | // Send a START Condition | ||
| 84 | // | ||
| 85 | void I2C_Start() | ||
| 86 | { | ||
| 87 | // set both to high at the same time | ||
| 88 | I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); | ||
| 89 | _delay_us(I2C_DELAY); | ||
| 90 | |||
| 91 | I2C_DATA_LO(); | ||
| 92 | _delay_us(I2C_DELAY); | ||
| 93 | |||
| 94 | I2C_CLOCK_LO(); | ||
| 95 | _delay_us(I2C_DELAY); | ||
| 96 | } | ||
| 97 | |||
| 98 | // Send a STOP Condition | ||
| 99 | // | ||
| 100 | void I2C_Stop() | ||
| 101 | { | ||
| 102 | I2C_CLOCK_HI(); | ||
| 103 | _delay_us(I2C_DELAY); | ||
| 104 | |||
| 105 | I2C_DATA_HI(); | ||
| 106 | _delay_us(I2C_DELAY); | ||
| 107 | } | ||
| 108 | |||
| 109 | // write a byte to the I2C slave device | ||
| 110 | // | ||
| 111 | unsigned char I2C_Write(unsigned char c) | ||
| 112 | { | ||
| 113 | for (char i = 0; i < 8; i++) | ||
| 114 | { | ||
| 115 | I2C_WriteBit(c & 128); | ||
| 116 | |||
| 117 | c <<= 1; | ||
| 118 | } | ||
| 119 | |||
| 120 | |||
| 121 | I2C_WriteBit(0); | ||
| 122 | _delay_us(I2C_DELAY); | ||
| 123 | _delay_us(I2C_DELAY); | ||
| 124 | |||
| 125 | // _delay_us(I2C_DELAY); | ||
| 126 | //return I2C_ReadBit(); | ||
| 127 | return 0; | ||
| 128 | } | ||
| 129 | |||
| 130 | |||
| 131 | #endif | ||
| 132 | |||
| 19 | // Setleds for standard RGB | 133 | // Setleds for standard RGB |
| 20 | void inline ws2812_setleds(struct cRGB *ledarray, uint16_t leds) | 134 | void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) |
| 21 | { | 135 | { |
| 22 | // ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin)); | 136 | // ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin)); |
| 23 | ws2812_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF)); | 137 | ws2812_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF)); |
| 24 | } | 138 | } |
| 25 | 139 | ||
| 26 | void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pinmask) | 140 | void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask) |
| 27 | { | 141 | { |
| 28 | // ws2812_DDRREG |= pinmask; // Enable DDR | 142 | // ws2812_DDRREG |= pinmask; // Enable DDR |
| 29 | // new universal format (DDR) | 143 | // new universal format (DDR) |
| @@ -34,14 +148,41 @@ void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pin | |||
| 34 | } | 148 | } |
| 35 | 149 | ||
| 36 | // Setleds for SK6812RGBW | 150 | // Setleds for SK6812RGBW |
| 37 | void inline ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t leds) | 151 | void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) |
| 38 | { | 152 | { |
| 153 | |||
| 154 | #ifdef RGBW_BB_TWI | ||
| 155 | uint8_t sreg_prev, twcr_prev; | ||
| 156 | sreg_prev=SREG; | ||
| 157 | twcr_prev=TWCR; | ||
| 158 | cli(); | ||
| 159 | TWCR &= ~(1<<TWEN); | ||
| 160 | I2C_Init(); | ||
| 161 | I2C_Start(); | ||
| 162 | I2C_Write(0x84); | ||
| 163 | uint16_t datlen = leds<<2; | ||
| 164 | uint8_t curbyte; | ||
| 165 | uint8_t * data = (uint8_t*)ledarray; | ||
| 166 | while (datlen--) { | ||
| 167 | curbyte=*data++; | ||
| 168 | I2C_Write(curbyte); | ||
| 169 | } | ||
| 170 | I2C_Stop(); | ||
| 171 | SREG=sreg_prev; | ||
| 172 | TWCR=twcr_prev; | ||
| 173 | #endif | ||
| 174 | |||
| 175 | |||
| 39 | // ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR | 176 | // ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR |
| 40 | // new universal format (DDR) | 177 | // new universal format (DDR) |
| 41 | _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF); | 178 | _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF); |
| 42 | 179 | ||
| 43 | ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF)); | 180 | ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF)); |
| 44 | _delay_us(80); | 181 | |
| 182 | |||
| 183 | #ifndef RGBW_BB_TWI | ||
| 184 | _delay_us(80); | ||
| 185 | #endif | ||
| 45 | } | 186 | } |
| 46 | 187 | ||
| 47 | void ws2812_sendarray(uint8_t *data,uint16_t datlen) | 188 | void ws2812_sendarray(uint8_t *data,uint16_t datlen) |
| @@ -123,7 +264,7 @@ void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi) | |||
| 123 | cli(); | 264 | cli(); |
| 124 | 265 | ||
| 125 | while (datlen--) { | 266 | while (datlen--) { |
| 126 | curbyte=*data++; | 267 | curbyte=(*data++); |
| 127 | 268 | ||
| 128 | asm volatile( | 269 | asm volatile( |
| 129 | " ldi %0,8 \n\t" | 270 | " ldi %0,8 \n\t" |
diff --git a/quantum/light_ws2812.h b/quantum/light_ws2812.h index 54eef22d9..9498e550e 100755 --- a/quantum/light_ws2812.h +++ b/quantum/light_ws2812.h | |||
| @@ -16,6 +16,21 @@ | |||
| 16 | #include <avr/io.h> | 16 | #include <avr/io.h> |
| 17 | #include <avr/interrupt.h> | 17 | #include <avr/interrupt.h> |
| 18 | //#include "ws2812_config.h" | 18 | //#include "ws2812_config.h" |
| 19 | //#include "i2cmaster.h" | ||
| 20 | |||
| 21 | #define LIGHT_I2C 1 | ||
| 22 | #define LIGHT_I2C_ADDR 0x84 | ||
| 23 | #define LIGHT_I2C_ADDR_WRITE ( (LIGHT_I2C_ADDR<<1) | I2C_WRITE ) | ||
| 24 | #define LIGHT_I2C_ADDR_READ ( (LIGHT_I2C_ADDR<<1) | I2C_READ ) | ||
| 25 | |||
| 26 | #define RGBW 1 | ||
| 27 | |||
| 28 | #ifdef RGBW | ||
| 29 | #define LED_TYPE struct cRGBW | ||
| 30 | #else | ||
| 31 | #define LED_TYPE struct cRGB | ||
| 32 | #endif | ||
| 33 | |||
| 19 | 34 | ||
| 20 | /* | 35 | /* |
| 21 | * Structure of the LED array | 36 | * Structure of the LED array |
| @@ -42,9 +57,9 @@ struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;}; | |||
| 42 | * - Wait 50�s to reset the LEDs | 57 | * - Wait 50�s to reset the LEDs |
| 43 | */ | 58 | */ |
| 44 | 59 | ||
| 45 | void ws2812_setleds (struct cRGB *ledarray, uint16_t number_of_leds); | 60 | void ws2812_setleds (LED_TYPE *ledarray, uint16_t number_of_leds); |
| 46 | void ws2812_setleds_pin (struct cRGB *ledarray, uint16_t number_of_leds,uint8_t pinmask); | 61 | void ws2812_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask); |
| 47 | void ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t number_of_leds); | 62 | void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds); |
| 48 | 63 | ||
| 49 | /* | 64 | /* |
| 50 | * Old interface / Internal functions | 65 | * Old interface / Internal functions |
diff --git a/quantum/process_keycode/process_printer.c b/quantum/process_keycode/process_printer.c new file mode 100644 index 000000000..2e11dd366 --- /dev/null +++ b/quantum/process_keycode/process_printer.c | |||
| @@ -0,0 +1,254 @@ | |||
| 1 | #include "process_printer.h" | ||
| 2 | #include "action_util.h" | ||
| 3 | |||
| 4 | bool printing_enabled = false; | ||
| 5 | uint8_t character_shift = 0; | ||
| 6 | |||
| 7 | void enabled_printing() { | ||
| 8 | printing_enabled = true; | ||
| 9 | serial_init(); | ||
| 10 | } | ||
| 11 | |||
| 12 | void disable_printing() { | ||
| 13 | printing_enabled = false; | ||
| 14 | } | ||
| 15 | |||
| 16 | uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29}; | ||
| 17 | |||
| 18 | // uint8_t keycode_to_ascii[0xFF][2]; | ||
| 19 | |||
| 20 | // keycode_to_ascii[KC_MINS] = {0x2D, 0x5F}; | ||
| 21 | |||
| 22 | void print_char(char c) { | ||
| 23 | USB_Disable(); | ||
| 24 | serial_send(c); | ||
| 25 | USB_Init(); | ||
| 26 | } | ||
| 27 | |||
| 28 | void print_box_string(uint8_t text[]) { | ||
| 29 | uint8_t len = strlen(text); | ||
| 30 | uint8_t out[len * 3 + 8]; | ||
| 31 | out[0] = 0xDA; | ||
| 32 | for (uint8_t i = 0; i < len; i++) { | ||
| 33 | out[i+1] = 0xC4; | ||
| 34 | } | ||
| 35 | out[len + 1] = 0xBF; | ||
| 36 | out[len + 2] = '\n'; | ||
| 37 | |||
| 38 | out[len + 3] = 0xB3; | ||
| 39 | for (uint8_t i = 0; i < len; i++) { | ||
| 40 | out[len + 4 + i] = text[i]; | ||
| 41 | } | ||
| 42 | out[len * 2 + 4] = 0xB3; | ||
| 43 | out[len * 2 + 5] = '\n'; | ||
| 44 | |||
| 45 | |||
| 46 | out[len * 2 + 6] = 0xC0; | ||
| 47 | for (uint8_t i = 0; i < len; i++) { | ||
| 48 | out[len * 2 + 7 + i] = 0xC4; | ||
| 49 | } | ||
| 50 | out[len * 3 + 7] = 0xD9; | ||
| 51 | out[len * 3 + 8] = '\n'; | ||
| 52 | |||
| 53 | print_string(out); | ||
| 54 | } | ||
| 55 | |||
| 56 | void print_string(char c[]) { | ||
| 57 | for(uint8_t i = 0; i < strlen(c); i++) | ||
| 58 | print_char(c[i]); | ||
| 59 | } | ||
| 60 | |||
| 61 | bool process_printer(uint16_t keycode, keyrecord_t *record) { | ||
| 62 | if (keycode == PRINT_ON) { | ||
| 63 | enabled_printing(); | ||
| 64 | return false; | ||
| 65 | } | ||
| 66 | if (keycode == PRINT_OFF) { | ||
| 67 | disable_printing(); | ||
| 68 | return false; | ||
| 69 | } | ||
| 70 | |||
| 71 | if (printing_enabled) { | ||
| 72 | switch(keycode) { | ||
| 73 | case KC_EXLM ... KC_RPRN: | ||
| 74 | case KC_UNDS: | ||
| 75 | case KC_PLUS: | ||
| 76 | case KC_LCBR: | ||
| 77 | case KC_RCBR: | ||
| 78 | case KC_PIPE: | ||
| 79 | case KC_TILD: | ||
| 80 | keycode &= 0xFF; | ||
| 81 | case KC_LSFT: | ||
| 82 | case KC_RSFT: | ||
| 83 | if (record->event.pressed) { | ||
| 84 | character_shift++; | ||
| 85 | } else { | ||
| 86 | character_shift--; | ||
| 87 | } | ||
| 88 | return false; | ||
| 89 | break; | ||
| 90 | } | ||
| 91 | |||
| 92 | switch(keycode) { | ||
| 93 | case KC_F1: | ||
| 94 | if (record->event.pressed) { | ||
| 95 | print_box_string("This is a line of text!"); | ||
| 96 | } | ||
| 97 | return false; | ||
| 98 | case KC_ESC: | ||
| 99 | if (record->event.pressed) { | ||
| 100 | print_char(0x1B); | ||
| 101 | } | ||
| 102 | return false; | ||
| 103 | break; | ||
| 104 | case KC_SPC: | ||
| 105 | if (record->event.pressed) { | ||
| 106 | print_char(0x20); | ||
| 107 | } | ||
| 108 | return false; | ||
| 109 | break; | ||
| 110 | case KC_A ... KC_Z: | ||
| 111 | if (record->event.pressed) { | ||
| 112 | if (character_shift) { | ||
| 113 | print_char(0x41 + (keycode - KC_A)); | ||
| 114 | } else { | ||
| 115 | print_char(0x61 + (keycode - KC_A)); | ||
| 116 | } | ||
| 117 | } | ||
| 118 | return false; | ||
| 119 | break; | ||
| 120 | case KC_1 ... KC_0: | ||
| 121 | if (record->event.pressed) { | ||
| 122 | if (character_shift) { | ||
| 123 | print_char(shifted_numbers[keycode - KC_1]); | ||
| 124 | } else { | ||
| 125 | print_char(0x30 + ((keycode - KC_1 + 1) % 10)); | ||
| 126 | } | ||
| 127 | } | ||
| 128 | return false; | ||
| 129 | break; | ||
| 130 | case KC_ENT: | ||
| 131 | if (record->event.pressed) { | ||
| 132 | if (character_shift) { | ||
| 133 | print_char(0x0C); | ||
| 134 | } else { | ||
| 135 | print_char(0x0A); | ||
| 136 | } | ||
| 137 | } | ||
| 138 | return false; | ||
| 139 | break; | ||
| 140 | case KC_BSPC: | ||
| 141 | if (record->event.pressed) { | ||
| 142 | if (character_shift) { | ||
| 143 | print_char(0x18); | ||
| 144 | } else { | ||
| 145 | print_char(0x1A); | ||
| 146 | } | ||
| 147 | } | ||
| 148 | return false; | ||
| 149 | break; | ||
| 150 | case KC_DOT: | ||
| 151 | if (record->event.pressed) { | ||
| 152 | if (character_shift) { | ||
| 153 | print_char(0x3E); | ||
| 154 | } else { | ||
| 155 | print_char(0x2E); | ||
| 156 | } | ||
| 157 | } | ||
| 158 | return false; | ||
| 159 | break; | ||
| 160 | case KC_COMM: | ||
| 161 | if (record->event.pressed) { | ||
| 162 | if (character_shift) { | ||
| 163 | print_char(0x3C); | ||
| 164 | } else { | ||
| 165 | print_char(0x2C); | ||
| 166 | } | ||
| 167 | } | ||
| 168 | return false; | ||
| 169 | break; | ||
| 170 | case KC_SLSH: | ||
| 171 | if (record->event.pressed) { | ||
| 172 | if (character_shift) { | ||
| 173 | print_char(0x3F); | ||
| 174 | } else { | ||
| 175 | print_char(0x2F); | ||
| 176 | } | ||
| 177 | } | ||
| 178 | return false; | ||
| 179 | break; | ||
| 180 | case KC_QUOT: | ||
| 181 | if (record->event.pressed) { | ||
| 182 | if (character_shift) { | ||
| 183 | print_char(0x22); | ||
| 184 | } else { | ||
| 185 | print_char(0x27); | ||
| 186 | } | ||
| 187 | } | ||
| 188 | return false; | ||
| 189 | break; | ||
| 190 | case KC_GRV: | ||
| 191 | if (record->event.pressed) { | ||
| 192 | if (character_shift) { | ||
| 193 | print_char(0x7E); | ||
| 194 | } else { | ||
| 195 | print_char(0x60); | ||
| 196 | } | ||
| 197 | } | ||
| 198 | return false; | ||
| 199 | break; | ||
| 200 | case KC_MINS: | ||
| 201 | if (record->event.pressed) { | ||
| 202 | if (character_shift) { | ||
| 203 | print_char(0x5F); | ||
| 204 | } else { | ||
| 205 | print_char(0x2D); | ||
| 206 | } | ||
| 207 | } | ||
| 208 | return false; | ||
| 209 | break; | ||
| 210 | case KC_EQL: | ||
| 211 | if (record->event.pressed) { | ||
| 212 | if (character_shift) { | ||
| 213 | print_char(0x2B); | ||
| 214 | } else { | ||
| 215 | print_char(0x3D); | ||
| 216 | } | ||
| 217 | } | ||
| 218 | return false; | ||
| 219 | break; | ||
| 220 | case KC_LBRC: | ||
| 221 | if (record->event.pressed) { | ||
| 222 | if (character_shift) { | ||
| 223 | print_char(0x7B); | ||
| 224 | } else { | ||
| 225 | print_char(0x5B); | ||
| 226 | } | ||
| 227 | } | ||
| 228 | return false; | ||
| 229 | break; | ||
| 230 | case KC_RBRC: | ||
| 231 | if (record->event.pressed) { | ||
| 232 | if (character_shift) { | ||
| 233 | print_char(0x7D); | ||
| 234 | } else { | ||
| 235 | print_char(0x5D); | ||
| 236 | } | ||
| 237 | } | ||
| 238 | return false; | ||
| 239 | break; | ||
| 240 | case KC_BSLS: | ||
| 241 | if (record->event.pressed) { | ||
| 242 | if (character_shift) { | ||
| 243 | print_char(0x7C); | ||
| 244 | } else { | ||
| 245 | print_char(0x5C); | ||
| 246 | } | ||
| 247 | } | ||
| 248 | return false; | ||
| 249 | break; | ||
| 250 | } | ||
| 251 | } | ||
| 252 | return true; | ||
| 253 | |||
| 254 | } \ No newline at end of file | ||
diff --git a/quantum/process_keycode/process_printer.h b/quantum/process_keycode/process_printer.h new file mode 100644 index 000000000..fdd36d75a --- /dev/null +++ b/quantum/process_keycode/process_printer.h | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #ifndef PROCESS_PRINTER_H | ||
| 2 | #define PROCESS_PRINTER_H | ||
| 3 | |||
| 4 | #include "quantum.h" | ||
| 5 | |||
| 6 | #include "protocol/serial.h" | ||
| 7 | |||
| 8 | #endif \ No newline at end of file | ||
diff --git a/quantum/process_keycode/process_printer_bb.c b/quantum/process_keycode/process_printer_bb.c new file mode 100644 index 000000000..1924d0377 --- /dev/null +++ b/quantum/process_keycode/process_printer_bb.c | |||
| @@ -0,0 +1,260 @@ | |||
| 1 | #include "process_printer.h" | ||
| 2 | #include "action_util.h" | ||
| 3 | |||
| 4 | bool printing_enabled = false; | ||
| 5 | uint8_t character_shift = 0; | ||
| 6 | |||
| 7 | #define SERIAL_PIN_DDR DDRD | ||
| 8 | #define SERIAL_PIN_PORT PORTD | ||
| 9 | #define SERIAL_PIN_MASK _BV(PD3) | ||
| 10 | #define SERIAL_DELAY 52 | ||
| 11 | |||
| 12 | inline static | ||
| 13 | void serial_delay(void) { | ||
| 14 | _delay_us(SERIAL_DELAY); | ||
| 15 | } | ||
| 16 | |||
| 17 | inline static | ||
| 18 | void serial_high(void) { | ||
| 19 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
| 20 | } | ||
| 21 | |||
| 22 | inline static | ||
| 23 | void serial_low(void) { | ||
| 24 | SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; | ||
| 25 | } | ||
| 26 | |||
| 27 | inline static | ||
| 28 | void serial_output(void) { | ||
| 29 | SERIAL_PIN_DDR |= SERIAL_PIN_MASK; | ||
| 30 | } | ||
| 31 | |||
| 32 | |||
| 33 | void enabled_printing() { | ||
| 34 | printing_enabled = true; | ||
| 35 | serial_output(); | ||
| 36 | serial_high(); | ||
| 37 | } | ||
| 38 | |||
| 39 | void disable_printing() { | ||
| 40 | printing_enabled = false; | ||
| 41 | } | ||
| 42 | |||
| 43 | uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29}; | ||
| 44 | |||
| 45 | // uint8_t keycode_to_ascii[0xFF][2]; | ||
| 46 | |||
| 47 | // keycode_to_ascii[KC_MINS] = {0x2D, 0x5F}; | ||
| 48 | |||
| 49 | void print_char(char c) { | ||
| 50 | uint8_t b = 8; | ||
| 51 | serial_output(); | ||
| 52 | while( b-- ) { | ||
| 53 | if(c & (1 << b)) { | ||
| 54 | serial_high(); | ||
| 55 | } else { | ||
| 56 | serial_low(); | ||
| 57 | } | ||
| 58 | serial_delay(); | ||
| 59 | } | ||
| 60 | } | ||
| 61 | |||
| 62 | void print_string(char c[]) { | ||
| 63 | for(uint8_t i = 0; i < strlen(c); i++) | ||
| 64 | print_char(c[i]); | ||
| 65 | } | ||
| 66 | |||
| 67 | bool process_printer(uint16_t keycode, keyrecord_t *record) { | ||
| 68 | if (keycode == PRINT_ON) { | ||
| 69 | enabled_printing(); | ||
| 70 | return false; | ||
| 71 | } | ||
| 72 | if (keycode == PRINT_OFF) { | ||
| 73 | disable_printing(); | ||
| 74 | return false; | ||
| 75 | } | ||
| 76 | |||
| 77 | if (printing_enabled) { | ||
| 78 | switch(keycode) { | ||
| 79 | case KC_EXLM ... KC_RPRN: | ||
| 80 | case KC_UNDS: | ||
| 81 | case KC_PLUS: | ||
| 82 | case KC_LCBR: | ||
| 83 | case KC_RCBR: | ||
| 84 | case KC_PIPE: | ||
| 85 | case KC_TILD: | ||
| 86 | keycode &= 0xFF; | ||
| 87 | case KC_LSFT: | ||
| 88 | case KC_RSFT: | ||
| 89 | if (record->event.pressed) { | ||
| 90 | character_shift++; | ||
| 91 | } else { | ||
| 92 | character_shift--; | ||
| 93 | } | ||
| 94 | return false; | ||
| 95 | break; | ||
| 96 | } | ||
| 97 | |||
| 98 | switch(keycode) { | ||
| 99 | case KC_F1: | ||
| 100 | if (record->event.pressed) { | ||
| 101 | print_string("This is a line of text!\n\n\n"); | ||
| 102 | } | ||
| 103 | return false; | ||
| 104 | case KC_ESC: | ||
| 105 | if (record->event.pressed) { | ||
| 106 | print_char(0x1B); | ||
| 107 | } | ||
| 108 | return false; | ||
| 109 | break; | ||
| 110 | case KC_SPC: | ||
| 111 | if (record->event.pressed) { | ||
| 112 | print_char(0x20); | ||
| 113 | } | ||
| 114 | return false; | ||
| 115 | break; | ||
| 116 | case KC_A ... KC_Z: | ||
| 117 | if (record->event.pressed) { | ||
| 118 | if (character_shift) { | ||
| 119 | print_char(0x41 + (keycode - KC_A)); | ||
| 120 | } else { | ||
| 121 | print_char(0x61 + (keycode - KC_A)); | ||
| 122 | } | ||
| 123 | } | ||
| 124 | return false; | ||
| 125 | break; | ||
| 126 | case KC_1 ... KC_0: | ||
| 127 | if (record->event.pressed) { | ||
| 128 | if (character_shift) { | ||
| 129 | print_char(shifted_numbers[keycode - KC_1]); | ||
| 130 | } else { | ||
| 131 | print_char(0x30 + ((keycode - KC_1 + 1) % 10)); | ||
| 132 | } | ||
| 133 | } | ||
| 134 | return false; | ||
| 135 | break; | ||
| 136 | case KC_ENT: | ||
| 137 | if (record->event.pressed) { | ||
| 138 | if (character_shift) { | ||
| 139 | print_char(0x0C); | ||
| 140 | } else { | ||
| 141 | print_char(0x0A); | ||
| 142 | } | ||
| 143 | } | ||
| 144 | return false; | ||
| 145 | break; | ||
| 146 | case KC_BSPC: | ||
| 147 | if (record->event.pressed) { | ||
| 148 | if (character_shift) { | ||
| 149 | print_char(0x18); | ||
| 150 | } else { | ||
| 151 | print_char(0x1A); | ||
| 152 | } | ||
| 153 | } | ||
| 154 | return false; | ||
| 155 | break; | ||
| 156 | case KC_DOT: | ||
| 157 | if (record->event.pressed) { | ||
| 158 | if (character_shift) { | ||
| 159 | print_char(0x3E); | ||
| 160 | } else { | ||
| 161 | print_char(0x2E); | ||
| 162 | } | ||
| 163 | } | ||
| 164 | return false; | ||
| 165 | break; | ||
| 166 | case KC_COMM: | ||
| 167 | if (record->event.pressed) { | ||
| 168 | if (character_shift) { | ||
| 169 | print_char(0x3C); | ||
| 170 | } else { | ||
| 171 | print_char(0x2C); | ||
| 172 | } | ||
| 173 | } | ||
| 174 | return false; | ||
| 175 | break; | ||
| 176 | case KC_SLSH: | ||
| 177 | if (record->event.pressed) { | ||
| 178 | if (character_shift) { | ||
| 179 | print_char(0x3F); | ||
| 180 | } else { | ||
| 181 | print_char(0x2F); | ||
| 182 | } | ||
| 183 | } | ||
| 184 | return false; | ||
| 185 | break; | ||
| 186 | case KC_QUOT: | ||
| 187 | if (record->event.pressed) { | ||
| 188 | if (character_shift) { | ||
| 189 | print_char(0x22); | ||
| 190 | } else { | ||
| 191 | print_char(0x27); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | return false; | ||
| 195 | break; | ||
| 196 | case KC_GRV: | ||
| 197 | if (record->event.pressed) { | ||
| 198 | if (character_shift) { | ||
| 199 | print_char(0x7E); | ||
| 200 | } else { | ||
| 201 | print_char(0x60); | ||
| 202 | } | ||
| 203 | } | ||
| 204 | return false; | ||
| 205 | break; | ||
| 206 | case KC_MINS: | ||
| 207 | if (record->event.pressed) { | ||
| 208 | if (character_shift) { | ||
| 209 | print_char(0x5F); | ||
| 210 | } else { | ||
| 211 | print_char(0x2D); | ||
| 212 | } | ||
| 213 | } | ||
| 214 | return false; | ||
| 215 | break; | ||
| 216 | case KC_EQL: | ||
| 217 | if (record->event.pressed) { | ||
| 218 | if (character_shift) { | ||
| 219 | print_char(0x2B); | ||
| 220 | } else { | ||
| 221 | print_char(0x3D); | ||
| 222 | } | ||
| 223 | } | ||
| 224 | return false; | ||
| 225 | break; | ||
| 226 | case KC_LBRC: | ||
| 227 | if (record->event.pressed) { | ||
| 228 | if (character_shift) { | ||
| 229 | print_char(0x7B); | ||
| 230 | } else { | ||
| 231 | print_char(0x5B); | ||
| 232 | } | ||
| 233 | } | ||
| 234 | return false; | ||
| 235 | break; | ||
| 236 | case KC_RBRC: | ||
| 237 | if (record->event.pressed) { | ||
| 238 | if (character_shift) { | ||
| 239 | print_char(0x7D); | ||
| 240 | } else { | ||
| 241 | print_char(0x5D); | ||
| 242 | } | ||
| 243 | } | ||
| 244 | return false; | ||
| 245 | break; | ||
| 246 | case KC_BSLS: | ||
| 247 | if (record->event.pressed) { | ||
| 248 | if (character_shift) { | ||
| 249 | print_char(0x7C); | ||
| 250 | } else { | ||
| 251 | print_char(0x5C); | ||
| 252 | } | ||
| 253 | } | ||
| 254 | return false; | ||
| 255 | break; | ||
| 256 | } | ||
| 257 | } | ||
| 258 | return true; | ||
| 259 | |||
| 260 | } \ No newline at end of file | ||
diff --git a/quantum/quantum.c b/quantum/quantum.c index b5e2d60b9..f9f1ef22d 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -134,6 +134,9 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 134 | #ifdef UCIS_ENABLE | 134 | #ifdef UCIS_ENABLE |
| 135 | process_ucis(keycode, record) && | 135 | process_ucis(keycode, record) && |
| 136 | #endif | 136 | #endif |
| 137 | #ifdef PRINTING_ENABLE | ||
| 138 | process_printer(keycode, record) && | ||
| 139 | #endif | ||
| 137 | #ifdef UNICODEMAP_ENABLE | 140 | #ifdef UNICODEMAP_ENABLE |
| 138 | process_unicode_map(keycode, record) && | 141 | process_unicode_map(keycode, record) && |
| 139 | #endif | 142 | #endif |
| @@ -806,6 +809,46 @@ void backlight_set(uint8_t level) | |||
| 806 | #endif // backlight | 809 | #endif // backlight |
| 807 | 810 | ||
| 808 | 811 | ||
| 812 | // Functions for spitting out values | ||
| 813 | // | ||
| 814 | |||
| 815 | void send_dword(uint32_t number) { // this might not actually work | ||
| 816 | uint16_t word = (number >> 16); | ||
| 817 | send_word(word); | ||
| 818 | send_word(number & 0xFFFFUL); | ||
| 819 | } | ||
| 820 | |||
| 821 | void send_word(uint16_t number) { | ||
| 822 | uint8_t byte = number >> 8; | ||
| 823 | send_byte(byte); | ||
| 824 | send_byte(number & 0xFF); | ||
| 825 | } | ||
| 826 | |||
| 827 | void send_byte(uint8_t number) { | ||
| 828 | uint8_t nibble = number >> 4; | ||
| 829 | send_nibble(nibble); | ||
| 830 | send_nibble(number & 0xF); | ||
| 831 | } | ||
| 832 | |||
| 833 | void send_nibble(uint8_t number) { | ||
| 834 | switch (number) { | ||
| 835 | case 0: | ||
| 836 | register_code(KC_0); | ||
| 837 | unregister_code(KC_0); | ||
| 838 | break; | ||
| 839 | case 1 ... 9: | ||
| 840 | register_code(KC_1 + (number - 1)); | ||
| 841 | unregister_code(KC_1 + (number - 1)); | ||
| 842 | break; | ||
| 843 | case 0xA ... 0xF: | ||
| 844 | register_code(KC_A + (number - 0xA)); | ||
| 845 | unregister_code(KC_A + (number - 0xA)); | ||
| 846 | break; | ||
| 847 | } | ||
| 848 | } | ||
| 849 | |||
| 850 | |||
| 851 | |||
| 809 | 852 | ||
| 810 | __attribute__ ((weak)) | 853 | __attribute__ ((weak)) |
| 811 | void led_set_user(uint8_t usb_led) { | 854 | void led_set_user(uint8_t usb_led) { |
diff --git a/quantum/quantum.h b/quantum/quantum.h index 0c6046649..3d35f11fa 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
| @@ -59,6 +59,10 @@ extern uint32_t default_layer_state; | |||
| 59 | 59 | ||
| 60 | #include "process_tap_dance.h" | 60 | #include "process_tap_dance.h" |
| 61 | 61 | ||
| 62 | #ifdef PRINTING_ENABLE | ||
| 63 | #include "process_printer.h" | ||
| 64 | #endif | ||
| 65 | |||
| 62 | #define SEND_STRING(str) send_string(PSTR(str)) | 66 | #define SEND_STRING(str) send_string(PSTR(str)) |
| 63 | void send_string(const char *str); | 67 | void send_string(const char *str); |
| 64 | 68 | ||
| @@ -106,6 +110,11 @@ void breathing_speed_dec(uint8_t value); | |||
| 106 | #endif | 110 | #endif |
| 107 | 111 | ||
| 108 | #endif | 112 | #endif |
| 113 | void send_dword(uint32_t number); | ||
| 114 | void send_word(uint16_t number); | ||
| 115 | void send_byte(uint8_t number); | ||
| 116 | void send_nibble(uint8_t number); | ||
| 117 | |||
| 109 | 118 | ||
| 110 | void led_set_user(uint8_t usb_led); | 119 | void led_set_user(uint8_t usb_led); |
| 111 | void led_set_kb(uint8_t usb_led); | 120 | void led_set_kb(uint8_t usb_led); |
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index d550c5866..00620da58 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
| @@ -69,11 +69,12 @@ const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {100, 50, 20}; | |||
| 69 | 69 | ||
| 70 | rgblight_config_t rgblight_config; | 70 | rgblight_config_t rgblight_config; |
| 71 | rgblight_config_t inmem_config; | 71 | rgblight_config_t inmem_config; |
| 72 | struct cRGB led[RGBLED_NUM]; | ||
| 73 | uint8_t rgblight_inited = 0; | ||
| 74 | 72 | ||
| 73 | LED_TYPE led[RGBLED_NUM]; | ||
| 74 | uint8_t rgblight_inited = 0; | ||
| 75 | bool rgblight_timer_enabled = false; | ||
| 75 | 76 | ||
| 76 | void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) { | 77 | void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { |
| 77 | uint8_t r = 0, g = 0, b = 0, base, color; | 78 | uint8_t r = 0, g = 0, b = 0, base, color; |
| 78 | 79 | ||
| 79 | if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. | 80 | if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. |
| @@ -124,7 +125,7 @@ void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) { | |||
| 124 | setrgb(r, g, b, led1); | 125 | setrgb(r, g, b, led1); |
| 125 | } | 126 | } |
| 126 | 127 | ||
| 127 | void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1) { | 128 | void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1) { |
| 128 | (*led1).r = r; | 129 | (*led1).r = r; |
| 129 | (*led1).g = g; | 130 | (*led1).g = g; |
| 130 | (*led1).b = b; | 131 | (*led1).b = b; |
| @@ -141,9 +142,9 @@ void eeconfig_update_rgblight_default(void) { | |||
| 141 | dprintf("eeconfig_update_rgblight_default\n"); | 142 | dprintf("eeconfig_update_rgblight_default\n"); |
| 142 | rgblight_config.enable = 1; | 143 | rgblight_config.enable = 1; |
| 143 | rgblight_config.mode = 1; | 144 | rgblight_config.mode = 1; |
| 144 | rgblight_config.hue = 200; | 145 | rgblight_config.hue = 0; |
| 145 | rgblight_config.sat = 204; | 146 | rgblight_config.sat = 255; |
| 146 | rgblight_config.val = 204; | 147 | rgblight_config.val = 255; |
| 147 | eeconfig_update_rgblight(rgblight_config.raw); | 148 | eeconfig_update_rgblight(rgblight_config.raw); |
| 148 | } | 149 | } |
| 149 | void eeconfig_debug_rgblight(void) { | 150 | void eeconfig_debug_rgblight(void) { |
| @@ -173,7 +174,7 @@ void rgblight_init(void) { | |||
| 173 | } | 174 | } |
| 174 | eeconfig_debug_rgblight(); // display current eeprom values | 175 | eeconfig_debug_rgblight(); // display current eeprom values |
| 175 | 176 | ||
| 176 | #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) | 177 | #ifdef RGBLIGHT_ANIMATIONS |
| 177 | rgblight_timer_init(); // setup the timer | 178 | rgblight_timer_init(); // setup the timer |
| 178 | #endif | 179 | #endif |
| 179 | 180 | ||
| @@ -220,7 +221,7 @@ void rgblight_mode(uint8_t mode) { | |||
| 220 | eeconfig_update_rgblight(rgblight_config.raw); | 221 | eeconfig_update_rgblight(rgblight_config.raw); |
| 221 | xprintf("rgblight mode: %u\n", rgblight_config.mode); | 222 | xprintf("rgblight mode: %u\n", rgblight_config.mode); |
| 222 | if (rgblight_config.mode == 1) { | 223 | if (rgblight_config.mode == 1) { |
| 223 | #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) | 224 | #ifdef RGBLIGHT_ANIMATIONS |
| 224 | rgblight_timer_disable(); | 225 | rgblight_timer_disable(); |
| 225 | #endif | 226 | #endif |
| 226 | } else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 23) { | 227 | } else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 23) { |
| @@ -230,7 +231,7 @@ void rgblight_mode(uint8_t mode) { | |||
| 230 | // MODE 15-20, snake | 231 | // MODE 15-20, snake |
| 231 | // MODE 21-23, knight | 232 | // MODE 21-23, knight |
| 232 | 233 | ||
| 233 | #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) | 234 | #ifdef RGBLIGHT_ANIMATIONS |
| 234 | rgblight_timer_enable(); | 235 | rgblight_timer_enable(); |
| 235 | #endif | 236 | #endif |
| 236 | } | 237 | } |
| @@ -244,7 +245,7 @@ void rgblight_toggle(void) { | |||
| 244 | if (rgblight_config.enable) { | 245 | if (rgblight_config.enable) { |
| 245 | rgblight_mode(rgblight_config.mode); | 246 | rgblight_mode(rgblight_config.mode); |
| 246 | } else { | 247 | } else { |
| 247 | #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) | 248 | #ifdef RGBLIGHT_ANIMATIONS |
| 248 | rgblight_timer_disable(); | 249 | rgblight_timer_disable(); |
| 249 | #endif | 250 | #endif |
| 250 | _delay_ms(50); | 251 | _delay_ms(50); |
| @@ -252,6 +253,13 @@ void rgblight_toggle(void) { | |||
| 252 | } | 253 | } |
| 253 | } | 254 | } |
| 254 | 255 | ||
| 256 | void rgblight_enable(void) { | ||
| 257 | rgblight_config.enable = 1; | ||
| 258 | eeconfig_update_rgblight(rgblight_config.raw); | ||
| 259 | xprintf("rgblight enable: rgblight_config.enable = %u\n", rgblight_config.enable); | ||
| 260 | rgblight_mode(rgblight_config.mode); | ||
| 261 | } | ||
| 262 | |||
| 255 | 263 | ||
| 256 | void rgblight_increase_hue(void) { | 264 | void rgblight_increase_hue(void) { |
| 257 | uint16_t hue; | 265 | uint16_t hue; |
| @@ -307,7 +315,7 @@ void rgblight_decrease_val(void) { | |||
| 307 | void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { | 315 | void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { |
| 308 | inmem_config.raw = rgblight_config.raw; | 316 | inmem_config.raw = rgblight_config.raw; |
| 309 | if (rgblight_config.enable) { | 317 | if (rgblight_config.enable) { |
| 310 | struct cRGB tmp_led; | 318 | LED_TYPE tmp_led; |
| 311 | sethsv(hue, sat, val, &tmp_led); | 319 | sethsv(hue, sat, val, &tmp_led); |
| 312 | inmem_config.hue = hue; | 320 | inmem_config.hue = hue; |
| 313 | inmem_config.sat = sat; | 321 | inmem_config.sat = sat; |
| @@ -351,66 +359,78 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { | |||
| 351 | 359 | ||
| 352 | void rgblight_set(void) { | 360 | void rgblight_set(void) { |
| 353 | if (rgblight_config.enable) { | 361 | if (rgblight_config.enable) { |
| 354 | ws2812_setleds(led, RGBLED_NUM); | 362 | #ifdef RGBW |
| 363 | ws2812_setleds_rgbw(led, RGBLED_NUM); | ||
| 364 | #else | ||
| 365 | ws2812_setleds(led, RGBLED_NUM); | ||
| 366 | #endif | ||
| 355 | } else { | 367 | } else { |
| 356 | for (uint8_t i = 0; i < RGBLED_NUM; i++) { | 368 | for (uint8_t i = 0; i < RGBLED_NUM; i++) { |
| 357 | led[i].r = 0; | 369 | led[i].r = 0; |
| 358 | led[i].g = 0; | 370 | led[i].g = 0; |
| 359 | led[i].b = 0; | 371 | led[i].b = 0; |
| 360 | } | 372 | } |
| 361 | ws2812_setleds(led, RGBLED_NUM); | 373 | #ifdef RGBW |
| 374 | ws2812_setleds_rgbw(led, RGBLED_NUM); | ||
| 375 | #else | ||
| 376 | ws2812_setleds(led, RGBLED_NUM); | ||
| 377 | #endif | ||
| 362 | } | 378 | } |
| 363 | } | 379 | } |
| 364 | 380 | ||
| 365 | #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) | 381 | #ifdef RGBLIGHT_ANIMATIONS |
| 366 | 382 | ||
| 367 | // Animation timer -- AVR Timer3 | 383 | // Animation timer -- AVR Timer3 |
| 368 | void rgblight_timer_init(void) { | 384 | void rgblight_timer_init(void) { |
| 369 | static uint8_t rgblight_timer_is_init = 0; | 385 | // static uint8_t rgblight_timer_is_init = 0; |
| 370 | if (rgblight_timer_is_init) { | 386 | // if (rgblight_timer_is_init) { |
| 371 | return; | 387 | // return; |
| 372 | } | 388 | // } |
| 373 | rgblight_timer_is_init = 1; | 389 | // rgblight_timer_is_init = 1; |
| 374 | /* Timer 3 setup */ | 390 | // /* Timer 3 setup */ |
| 375 | TCCR3B = _BV(WGM32) //CTC mode OCR3A as TOP | 391 | // TCCR3B = _BV(WGM32) // CTC mode OCR3A as TOP |
| 376 | | _BV(CS30); //Clock selelct: clk/1 | 392 | // | _BV(CS30); // Clock selelct: clk/1 |
| 377 | /* Set TOP value */ | 393 | // /* Set TOP value */ |
| 378 | uint8_t sreg = SREG; | 394 | // uint8_t sreg = SREG; |
| 379 | cli(); | 395 | // cli(); |
| 380 | OCR3AH = (RGBLED_TIMER_TOP >> 8) & 0xff; | 396 | // OCR3AH = (RGBLED_TIMER_TOP >> 8) & 0xff; |
| 381 | OCR3AL = RGBLED_TIMER_TOP & 0xff; | 397 | // OCR3AL = RGBLED_TIMER_TOP & 0xff; |
| 382 | SREG = sreg; | 398 | // SREG = sreg; |
| 399 | |||
| 400 | rgblight_timer_enabled = true; | ||
| 383 | } | 401 | } |
| 384 | void rgblight_timer_enable(void) { | 402 | void rgblight_timer_enable(void) { |
| 385 | TIMSK3 |= _BV(OCIE3A); | 403 | rgblight_timer_enabled = true; |
| 386 | dprintf("TIMER3 enabled.\n"); | 404 | dprintf("TIMER3 enabled.\n"); |
| 387 | } | 405 | } |
| 388 | void rgblight_timer_disable(void) { | 406 | void rgblight_timer_disable(void) { |
| 389 | TIMSK3 &= ~_BV(OCIE3A); | 407 | rgblight_timer_enabled = false; |
| 390 | dprintf("TIMER3 disabled.\n"); | 408 | dprintf("TIMER3 disabled.\n"); |
| 391 | } | 409 | } |
| 392 | void rgblight_timer_toggle(void) { | 410 | void rgblight_timer_toggle(void) { |
| 393 | TIMSK3 ^= _BV(OCIE3A); | 411 | rgblight_timer_enabled ^= rgblight_timer_enabled; |
| 394 | dprintf("TIMER3 toggled.\n"); | 412 | dprintf("TIMER3 toggled.\n"); |
| 395 | } | 413 | } |
| 396 | 414 | ||
| 397 | ISR(TIMER3_COMPA_vect) { | 415 | void rgblight_task(void) { |
| 398 | // mode = 1, static light, do nothing here | 416 | if (rgblight_timer_enabled) { |
| 399 | if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) { | 417 | // mode = 1, static light, do nothing here |
| 400 | // mode = 2 to 5, breathing mode | 418 | if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) { |
| 401 | rgblight_effect_breathing(rgblight_config.mode - 2); | 419 | // mode = 2 to 5, breathing mode |
| 402 | } else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) { | 420 | rgblight_effect_breathing(rgblight_config.mode - 2); |
| 403 | // mode = 6 to 8, rainbow mood mod | 421 | } else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) { |
| 404 | rgblight_effect_rainbow_mood(rgblight_config.mode - 6); | 422 | // mode = 6 to 8, rainbow mood mod |
| 405 | } else if (rgblight_config.mode >= 9 && rgblight_config.mode <= 14) { | 423 | rgblight_effect_rainbow_mood(rgblight_config.mode - 6); |
| 406 | // mode = 9 to 14, rainbow swirl mode | 424 | } else if (rgblight_config.mode >= 9 && rgblight_config.mode <= 14) { |
| 407 | rgblight_effect_rainbow_swirl(rgblight_config.mode - 9); | 425 | // mode = 9 to 14, rainbow swirl mode |
| 408 | } else if (rgblight_config.mode >= 15 && rgblight_config.mode <= 20) { | 426 | rgblight_effect_rainbow_swirl(rgblight_config.mode - 9); |
| 409 | // mode = 15 to 20, snake mode | 427 | } else if (rgblight_config.mode >= 15 && rgblight_config.mode <= 20) { |
| 410 | rgblight_effect_snake(rgblight_config.mode - 15); | 428 | // mode = 15 to 20, snake mode |
| 411 | } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) { | 429 | rgblight_effect_snake(rgblight_config.mode - 15); |
| 412 | // mode = 21 to 23, knight mode | 430 | } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) { |
| 413 | rgblight_effect_knight(rgblight_config.mode - 21); | 431 | // mode = 21 to 23, knight mode |
| 432 | rgblight_effect_knight(rgblight_config.mode - 21); | ||
| 433 | } | ||
| 414 | } | 434 | } |
| 415 | } | 435 | } |
| 416 | 436 | ||
| @@ -449,7 +469,7 @@ void rgblight_effect_rainbow_swirl(uint8_t interval) { | |||
| 449 | last_timer = timer_read(); | 469 | last_timer = timer_read(); |
| 450 | for (i = 0; i < RGBLED_NUM; i++) { | 470 | for (i = 0; i < RGBLED_NUM; i++) { |
| 451 | hue = (360 / RGBLED_NUM * i + current_hue) % 360; | 471 | hue = (360 / RGBLED_NUM * i + current_hue) % 360; |
| 452 | sethsv(hue, rgblight_config.sat, rgblight_config.val, &led[i]); | 472 | sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); |
| 453 | } | 473 | } |
| 454 | rgblight_set(); | 474 | rgblight_set(); |
| 455 | 475 | ||
| @@ -486,7 +506,7 @@ void rgblight_effect_snake(uint8_t interval) { | |||
| 486 | k = k + RGBLED_NUM; | 506 | k = k + RGBLED_NUM; |
| 487 | } | 507 | } |
| 488 | if (i == k) { | 508 | if (i == k) { |
| 489 | sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), &led[i]); | 509 | sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), (LED_TYPE *)&led[i]); |
| 490 | } | 510 | } |
| 491 | } | 511 | } |
| 492 | } | 512 | } |
| @@ -506,7 +526,7 @@ void rgblight_effect_knight(uint8_t interval) { | |||
| 506 | static uint16_t last_timer = 0; | 526 | static uint16_t last_timer = 0; |
| 507 | uint8_t i, j, cur; | 527 | uint8_t i, j, cur; |
| 508 | int8_t k; | 528 | int8_t k; |
| 509 | struct cRGB preled[RGBLED_NUM]; | 529 | LED_TYPE preled[RGBLED_NUM]; |
| 510 | static int8_t increment = -1; | 530 | static int8_t increment = -1; |
| 511 | if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) { | 531 | if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) { |
| 512 | return; | 532 | return; |
| @@ -525,7 +545,7 @@ void rgblight_effect_knight(uint8_t interval) { | |||
| 525 | k = RGBLED_NUM - 1; | 545 | k = RGBLED_NUM - 1; |
| 526 | } | 546 | } |
| 527 | if (i == k) { | 547 | if (i == k) { |
| 528 | sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, &preled[i]); | 548 | sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&preled[i]); |
| 529 | } | 549 | } |
| 530 | } | 550 | } |
| 531 | } | 551 | } |
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 17f04ffcf..a3673348e 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | #ifndef RGBLIGHT_H | 1 | #ifndef RGBLIGHT_H |
| 2 | #define RGBLIGHT_H | 2 | #define RGBLIGHT_H |
| 3 | 3 | ||
| 4 | 4 | #ifdef RGBLIGHT_ANIMATIONS | |
| 5 | #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) | ||
| 6 | #define RGBLIGHT_MODES 23 | 5 | #define RGBLIGHT_MODES 23 |
| 7 | #else | 6 | #else |
| 8 | #define RGBLIGHT_MODES 1 | 7 | #define RGBLIGHT_MODES 1 |
| @@ -34,6 +33,7 @@ | |||
| 34 | #endif | 33 | #endif |
| 35 | 34 | ||
| 36 | #define RGBLED_TIMER_TOP F_CPU/(256*64) | 35 | #define RGBLED_TIMER_TOP F_CPU/(256*64) |
| 36 | // #define RGBLED_TIMER_TOP 0xFF10 | ||
| 37 | 37 | ||
| 38 | #include <stdint.h> | 38 | #include <stdint.h> |
| 39 | #include <stdbool.h> | 39 | #include <stdbool.h> |
| @@ -61,6 +61,7 @@ void rgblight_init(void); | |||
| 61 | void rgblight_increase(void); | 61 | void rgblight_increase(void); |
| 62 | void rgblight_decrease(void); | 62 | void rgblight_decrease(void); |
| 63 | void rgblight_toggle(void); | 63 | void rgblight_toggle(void); |
| 64 | void rgblight_enable(void); | ||
| 64 | void rgblight_step(void); | 65 | void rgblight_step(void); |
| 65 | void rgblight_mode(uint8_t mode); | 66 | void rgblight_mode(uint8_t mode); |
| 66 | void rgblight_set(void); | 67 | void rgblight_set(void); |
| @@ -78,10 +79,13 @@ void eeconfig_update_rgblight(uint32_t val); | |||
| 78 | void eeconfig_update_rgblight_default(void); | 79 | void eeconfig_update_rgblight_default(void); |
| 79 | void eeconfig_debug_rgblight(void); | 80 | void eeconfig_debug_rgblight(void); |
| 80 | 81 | ||
| 81 | void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1); | 82 | void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); |
| 82 | void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1); | 83 | void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); |
| 83 | void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); | 84 | void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); |
| 84 | 85 | ||
| 86 | |||
| 87 | void rgblight_task(void); | ||
| 88 | |||
| 85 | void rgblight_timer_init(void); | 89 | void rgblight_timer_init(void); |
| 86 | void rgblight_timer_enable(void); | 90 | void rgblight_timer_enable(void); |
| 87 | void rgblight_timer_disable(void); | 91 | void rgblight_timer_disable(void); |
| @@ -1136,12 +1136,12 @@ For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring | |||
| 1136 | 1136 | ||
| 1137 | RGBLIGHT_ENABLE = yes | 1137 | RGBLIGHT_ENABLE = yes |
| 1138 | 1138 | ||
| 1139 | In order to use the underglow timer functions, you need to have `#define RGBLIGHT_TIMER` in your `config.h`, and have audio disabled (`AUDIO_ENABLE = no` in your Makefile). | 1139 | In order to use the underglow animation functions, you need to have `#define RGBLIGHT_ANIMATIONS` in your `config.h`. |
| 1140 | 1140 | ||
| 1141 | Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default: | 1141 | Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default: |
| 1142 | 1142 | ||
| 1143 | #define RGB_DI_PIN F4 // The pin your RGB strip is wired to | 1143 | #define RGB_DI_PIN F4 // The pin your RGB strip is wired to |
| 1144 | #define RGBLIGHT_TIMER // Require for fancier stuff (not compatible with audio) | 1144 | #define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio) |
| 1145 | #define RGBLED_NUM 14 // Number of LEDs | 1145 | #define RGBLED_NUM 14 // Number of LEDs |
| 1146 | #define RGBLIGHT_HUE_STEP 10 | 1146 | #define RGBLIGHT_HUE_STEP 10 |
| 1147 | #define RGBLIGHT_SAT_STEP 17 | 1147 | #define RGBLIGHT_SAT_STEP 17 |
diff --git a/tmk_core/common/host_driver.h b/tmk_core/common/host_driver.h index edb9e5dd9..588d1c0be 100644 --- a/tmk_core/common/host_driver.h +++ b/tmk_core/common/host_driver.h | |||
| @@ -20,7 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 20 | 20 | ||
| 21 | #include <stdint.h> | 21 | #include <stdint.h> |
| 22 | #include "report.h" | 22 | #include "report.h" |
| 23 | 23 | #ifdef MIDI_ENABLE | |
| 24 | #include "midi.h" | ||
| 25 | #endif | ||
| 24 | 26 | ||
| 25 | typedef struct { | 27 | typedef struct { |
| 26 | uint8_t (*keyboard_leds)(void); | 28 | uint8_t (*keyboard_leds)(void); |
| @@ -28,6 +30,11 @@ typedef struct { | |||
| 28 | void (*send_mouse)(report_mouse_t *); | 30 | void (*send_mouse)(report_mouse_t *); |
| 29 | void (*send_system)(uint16_t); | 31 | void (*send_system)(uint16_t); |
| 30 | void (*send_consumer)(uint16_t); | 32 | void (*send_consumer)(uint16_t); |
| 33 | #ifdef MIDI_ENABLE | ||
| 34 | void (*usb_send_func)(MidiDevice *, uint16_t, uint8_t, uint8_t, uint8_t); | ||
| 35 | void (*usb_get_midi)(MidiDevice *); | ||
| 36 | void (*midi_usb_init)(MidiDevice *); | ||
| 37 | #endif | ||
| 31 | } host_driver_t; | 38 | } host_driver_t; |
| 32 | 39 | ||
| 33 | #endif | 40 | #endif |
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 01c0e45b0..a33a16599 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
| @@ -51,6 +51,7 @@ | |||
| 51 | 51 | ||
| 52 | #include "descriptor.h" | 52 | #include "descriptor.h" |
| 53 | #include "lufa.h" | 53 | #include "lufa.h" |
| 54 | #include "quantum.h" | ||
| 54 | 55 | ||
| 55 | #ifdef NKRO_ENABLE | 56 | #ifdef NKRO_ENABLE |
| 56 | #include "keycode_config.h" | 57 | #include "keycode_config.h" |
| @@ -71,6 +72,10 @@ | |||
| 71 | #include "virtser.h" | 72 | #include "virtser.h" |
| 72 | #endif | 73 | #endif |
| 73 | 74 | ||
| 75 | #ifdef RGB_MIDI | ||
| 76 | #include "rgblight.h" | ||
| 77 | #endif | ||
| 78 | |||
| 74 | uint8_t keyboard_idle = 0; | 79 | uint8_t keyboard_idle = 0; |
| 75 | /* 0: Boot Protocol, 1: Report Protocol(default) */ | 80 | /* 0: Boot Protocol, 1: Report Protocol(default) */ |
| 76 | uint8_t keyboard_protocol = 1; | 81 | uint8_t keyboard_protocol = 1; |
| @@ -79,9 +84,9 @@ static uint8_t keyboard_led_stats = 0; | |||
| 79 | static report_keyboard_t keyboard_report_sent; | 84 | static report_keyboard_t keyboard_report_sent; |
| 80 | 85 | ||
| 81 | #ifdef MIDI_ENABLE | 86 | #ifdef MIDI_ENABLE |
| 82 | void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2); | 87 | static void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2); |
| 83 | void usb_get_midi(MidiDevice * device); | 88 | static void usb_get_midi(MidiDevice * device); |
| 84 | void midi_usb_init(MidiDevice * device); | 89 | static void midi_usb_init(MidiDevice * device); |
| 85 | #endif | 90 | #endif |
| 86 | 91 | ||
| 87 | /* Host driver */ | 92 | /* Host driver */ |
| @@ -709,7 +714,7 @@ int8_t sendchar(uint8_t c) | |||
| 709 | ******************************************************************************/ | 714 | ******************************************************************************/ |
| 710 | 715 | ||
| 711 | #ifdef MIDI_ENABLE | 716 | #ifdef MIDI_ENABLE |
| 712 | void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2) { | 717 | static void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2) { |
| 713 | MIDI_EventPacket_t event; | 718 | MIDI_EventPacket_t event; |
| 714 | event.Data1 = byte0; | 719 | event.Data1 = byte0; |
| 715 | event.Data2 = byte1; | 720 | event.Data2 = byte1; |
| @@ -769,7 +774,7 @@ void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byt | |||
| 769 | USB_USBTask(); | 774 | USB_USBTask(); |
| 770 | } | 775 | } |
| 771 | 776 | ||
| 772 | void usb_get_midi(MidiDevice * device) { | 777 | static void usb_get_midi(MidiDevice * device) { |
| 773 | MIDI_EventPacket_t event; | 778 | MIDI_EventPacket_t event; |
| 774 | while (MIDI_Device_ReceiveEventPacket(&USB_MIDI_Interface, &event)) { | 779 | while (MIDI_Device_ReceiveEventPacket(&USB_MIDI_Interface, &event)) { |
| 775 | 780 | ||
| @@ -799,12 +804,12 @@ void usb_get_midi(MidiDevice * device) { | |||
| 799 | USB_USBTask(); | 804 | USB_USBTask(); |
| 800 | } | 805 | } |
| 801 | 806 | ||
| 802 | void midi_usb_init(MidiDevice * device){ | 807 | static void midi_usb_init(MidiDevice * device){ |
| 803 | midi_device_init(device); | 808 | midi_device_init(device); |
| 804 | midi_device_set_send_func(device, usb_send_func); | 809 | midi_device_set_send_func(device, usb_send_func); |
| 805 | midi_device_set_pre_input_process_func(device, usb_get_midi); | 810 | midi_device_set_pre_input_process_func(device, usb_get_midi); |
| 806 | 811 | ||
| 807 | SetupHardware(); | 812 | // SetupHardware(); |
| 808 | sei(); | 813 | sei(); |
| 809 | } | 814 | } |
| 810 | 815 | ||
| @@ -1039,11 +1044,16 @@ int main(void) | |||
| 1039 | } | 1044 | } |
| 1040 | #endif | 1045 | #endif |
| 1041 | 1046 | ||
| 1047 | keyboard_task(); | ||
| 1048 | |||
| 1042 | #ifdef MIDI_ENABLE | 1049 | #ifdef MIDI_ENABLE |
| 1043 | midi_device_process(&midi_device); | 1050 | midi_device_process(&midi_device); |
| 1044 | // MIDI_Task(); | 1051 | // MIDI_Task(); |
| 1045 | #endif | 1052 | #endif |
| 1046 | keyboard_task(); | 1053 | |
| 1054 | #ifdef RGBLIGHT_ANIMATIONS | ||
| 1055 | rgblight_task(); | ||
| 1056 | #endif | ||
| 1047 | 1057 | ||
| 1048 | #ifdef VIRTSER_ENABLE | 1058 | #ifdef VIRTSER_ENABLE |
| 1049 | virtser_task(); | 1059 | virtser_task(); |
| @@ -1077,15 +1087,196 @@ void fallthrough_callback(MidiDevice * device, | |||
| 1077 | #endif | 1087 | #endif |
| 1078 | } | 1088 | } |
| 1079 | 1089 | ||
| 1090 | #ifdef RGB_MIDI | ||
| 1091 | rgblight_config_t rgblight_config; | ||
| 1092 | #endif | ||
| 1093 | |||
| 1080 | void cc_callback(MidiDevice * device, | 1094 | void cc_callback(MidiDevice * device, |
| 1081 | uint8_t chan, uint8_t num, uint8_t val) { | 1095 | uint8_t chan, uint8_t num, uint8_t val) { |
| 1082 | //sending it back on the next channel | 1096 | //sending it back on the next channel |
| 1083 | midi_send_cc(device, (chan + 1) % 16, num, val); | 1097 | // midi_send_cc(device, (chan + 1) % 16, num, val); |
| 1098 | #ifdef RGB_MIDI | ||
| 1099 | rgblight_config.raw = eeconfig_read_rgblight(); | ||
| 1100 | switch (num) { | ||
| 1101 | case 14: | ||
| 1102 | rgblight_config.hue = val * 360 / 127; | ||
| 1103 | break; | ||
| 1104 | case 15: | ||
| 1105 | rgblight_config.sat = val << 1; | ||
| 1106 | break; | ||
| 1107 | case 16: | ||
| 1108 | rgblight_config.val = val << 1; | ||
| 1109 | break; | ||
| 1110 | } | ||
| 1111 | rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); | ||
| 1112 | #endif | ||
| 1084 | } | 1113 | } |
| 1085 | 1114 | ||
| 1086 | void sysex_callback(MidiDevice * device, | 1115 | uint8_t midi_buffer[MIDI_SYSEX_BUFFER] = {0}; |
| 1087 | uint16_t start, uint8_t length, uint8_t * data) { | 1116 | |
| 1088 | for (int i = 0; i < length; i++) | 1117 | void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data) { |
| 1089 | midi_send_cc(device, 15, 0x7F & data[i], 0x7F & (start + i)); | 1118 | // for (int i = 0; i < length; i++) |
| 1119 | // midi_send_cc(device, 15, 0x7F & data[i], 0x7F & (start + i)); | ||
| 1120 | // if (start == 0x27) { | ||
| 1121 | // SEND_STRING("\n"); | ||
| 1122 | // send_word(start); | ||
| 1123 | // SEND_STRING(": "); | ||
| 1124 | for (uint8_t place = 0; place < length; place++) { | ||
| 1125 | // send_byte(*data); | ||
| 1126 | midi_buffer[start + place] = *data; | ||
| 1127 | if (*data == 0xF7 && midi_buffer[0] == 0xF0) | ||
| 1128 | sysex_buffer_callback(device, start + place, midi_buffer); | ||
| 1129 | // SEND_STRING(" "); | ||
| 1130 | data++; | ||
| 1131 | } | ||
| 1132 | // } | ||
| 1133 | |||
| 1134 | } | ||
| 1135 | |||
| 1136 | uint32_t decode_uint32_chunk(uint8_t * data) { | ||
| 1137 | uint32_t part1 = *data++; | ||
| 1138 | uint32_t part2 = *data++; | ||
| 1139 | uint32_t part3 = *data++; | ||
| 1140 | uint32_t part4 = *data++; | ||
| 1141 | uint32_t part5 = *data++; | ||
| 1142 | return ((part1 & 0x1FUL) << 28) | (part2 << 21) | (part3 << 14) | (part4 << 7) | part5; | ||
| 1143 | } | ||
| 1144 | |||
| 1145 | uint32_t decode_uint8_chunk(uint8_t * data) { | ||
| 1146 | uint32_t part4 = *data++; | ||
| 1147 | uint32_t part5 = *data++; | ||
| 1148 | return (part4 << 7) | part5; | ||
| 1149 | } | ||
| 1150 | |||
| 1151 | void encode_uint32_chunk(uint32_t data, uint8_t * pointer) { | ||
| 1152 | *pointer++ = (data >> 28) & 0x7F; | ||
| 1153 | *pointer++ = (data >> 21) & 0x7F; | ||
| 1154 | *pointer++ = (data >> 14) & 0x7F; | ||
| 1155 | *pointer++ = (data >> 7) & 0x7F; | ||
| 1156 | *pointer++ = (data) & 0x7F; | ||
| 1157 | } | ||
| 1158 | |||
| 1159 | void encode_uint8_chunk(uint8_t data, uint8_t * pointer) { | ||
| 1160 | *pointer++ = (data >> 7) & 0x7F; | ||
| 1161 | *pointer++ = (data) & 0x7F; | ||
| 1162 | } | ||
| 1163 | |||
| 1164 | void sysex_buffer_callback(MidiDevice * device, uint8_t length, uint8_t * data) { | ||
| 1165 | // uint8_t * pointer_copy = data; // use for debugging | ||
| 1166 | |||
| 1167 | //data++; // i'm 98% sure there's a better way to do this | ||
| 1168 | data++; | ||
| 1169 | data++; | ||
| 1170 | data++; | ||
| 1171 | data++; | ||
| 1172 | |||
| 1173 | switch (*data++) { | ||
| 1174 | case 0x07: ; // Quantum action | ||
| 1175 | break; | ||
| 1176 | case 0x08: ; // Keyboard acion | ||
| 1177 | break; | ||
| 1178 | case 0x09: ; // User action | ||
| 1179 | break; | ||
| 1180 | case 0x12: ; // Set info on keyboard | ||
| 1181 | switch (*data++) { | ||
| 1182 | case 0x02: ; // set default layer | ||
| 1183 | uint8_t default_layer = decode_uint8_chunk(data); | ||
| 1184 | eeconfig_update_default_layer(default_layer); | ||
| 1185 | default_layer_set((uint32_t)default_layer); | ||
| 1186 | break; | ||
| 1187 | case 0x08: ; // set keymap options | ||
| 1188 | uint8_t keymap_options = decode_uint8_chunk(data); | ||
| 1189 | eeconfig_update_keymap(keymap_options); | ||
| 1190 | break; | ||
| 1191 | } | ||
| 1192 | break; | ||
| 1193 | case 0x13: ; // Get info from keyboard | ||
| 1194 | switch (*data++) { | ||
| 1195 | case 0x00: ; // Handshake | ||
| 1196 | send_bytes_sysex(0x00, NULL, 0); | ||
| 1197 | break; | ||
| 1198 | case 0x01: ; // Get debug state | ||
| 1199 | uint8_t debug[2]; | ||
| 1200 | encode_uint8_chunk(eeprom_read_byte(EECONFIG_DEBUG), debug); | ||
| 1201 | send_bytes_sysex(0x01, debug, 2); | ||
| 1202 | break; | ||
| 1203 | case 0x02: ; // Get default layer | ||
| 1204 | uint8_t default_layer[2]; | ||
| 1205 | encode_uint8_chunk(eeprom_read_byte(EECONFIG_DEFAULT_LAYER), default_layer); | ||
| 1206 | send_bytes_sysex(0x02, default_layer, 2); | ||
| 1207 | break; | ||
| 1208 | #ifdef AUDIO_ENABLE | ||
| 1209 | case 0x03: ; // Get backlight state | ||
| 1210 | uint8_t audio[2]; | ||
| 1211 | encode_uint8_chunk(eeprom_read_byte(EECONFIG_AUDIO), audio); | ||
| 1212 | send_bytes_sysex(0x03, audio, 2); | ||
| 1213 | #endif | ||
| 1214 | case 0x04: ; // Get layer state | ||
| 1215 | uint8_t layers[5]; | ||
| 1216 | encode_uint32_chunk(layer_state, layers); | ||
| 1217 | send_bytes_sysex(0x04, layers, 5); | ||
| 1218 | break; | ||
| 1219 | #ifdef BACKLIGHT_ENABLE | ||
| 1220 | case 0x06: ; // Get backlight state | ||
| 1221 | uint8_t backlight[2]; | ||
| 1222 | encode_uint8_chunk(eeprom_read_byte(EECONFIG_BACKLIGHT), backlight); | ||
| 1223 | send_bytes_sysex(0x06, backlight, 2); | ||
| 1224 | #endif | ||
| 1225 | #ifdef RGBLIGHT_ENABLE | ||
| 1226 | case 0x07: ; // Get rgblight state | ||
| 1227 | uint8_t rgblight[2]; | ||
| 1228 | encode_uint32_chunk(eeprom_read_dword(EECONFIG_RGBLIGHT), rgblight); | ||
| 1229 | send_bytes_sysex(0x07, rgblight, 5); | ||
| 1230 | #endif | ||
| 1231 | case 0x08: ; // Keymap options | ||
| 1232 | uint8_t keymap_options[2]; | ||
| 1233 | encode_uint8_chunk(eeconfig_read_keymap(), keymap_options); | ||
| 1234 | send_bytes_sysex(0x08, keymap_options, 2); | ||
| 1235 | break; | ||
| 1236 | } | ||
| 1237 | break; | ||
| 1238 | #ifdef RGBLIGHT_ENABLE | ||
| 1239 | case 0x27: ; // RGB LED functions | ||
| 1240 | switch (*data++) { | ||
| 1241 | case 0x00: ; // Update HSV | ||
| 1242 | uint32_t hsv = decode_uint32_chunk(data); | ||
| 1243 | rgblight_sethsv(((hsv >> 16) & 0xFFFF) % 360, (hsv >> 8) & 0xFF, hsv & 0xFF); | ||
| 1244 | break; | ||
| 1245 | case 0x01: ; // Update RGB | ||
| 1246 | break; | ||
| 1247 | case 0x02: ; // Update mode | ||
| 1248 | uint8_t rgb_mode = decode_uint8_chunk(data); | ||
| 1249 | rgblight_mode(rgb_mode); | ||
| 1250 | break; | ||
| 1251 | } | ||
| 1252 | break; | ||
| 1253 | #endif | ||
| 1254 | } | ||
| 1255 | |||
| 1256 | // SEND_STRING("\nDATA:\n"); | ||
| 1257 | // while (*pointer_copy != 0xF7) { | ||
| 1258 | // send_byte(*pointer_copy++); | ||
| 1259 | // SEND_STRING(" "); | ||
| 1260 | // } | ||
| 1261 | |||
| 1262 | } | ||
| 1263 | |||
| 1264 | void send_unicode_midi(uint32_t unicode) { | ||
| 1265 | uint8_t chunk[5]; | ||
| 1266 | encode_uint32_chunk(unicode, chunk); | ||
| 1267 | send_bytes_sysex(0x05, chunk, 5); | ||
| 1090 | } | 1268 | } |
| 1269 | |||
| 1270 | void send_bytes_sysex(uint8_t type, uint8_t * bytes, uint8_t length) { | ||
| 1271 | uint8_t * array = malloc(sizeof(uint8_t) * (length + 6)); | ||
| 1272 | array[0] = 0xF0; | ||
| 1273 | array[1] = 0x00; | ||
| 1274 | array[2] = 0x00; | ||
| 1275 | array[3] = 0x00; | ||
| 1276 | array[4] = type; | ||
| 1277 | array[length + 5] = 0xF7; | ||
| 1278 | memcpy(array + 5, bytes, length); | ||
| 1279 | midi_send_array(&midi_device, length + 6, array); | ||
| 1280 | } | ||
| 1281 | |||
| 1091 | #endif | 1282 | #endif |
diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h index aad08d640..198964f90 100644 --- a/tmk_core/protocol/lufa/lufa.h +++ b/tmk_core/protocol/lufa/lufa.h | |||
| @@ -68,8 +68,18 @@ typedef struct { | |||
| 68 | } __attribute__ ((packed)) report_extra_t; | 68 | } __attribute__ ((packed)) report_extra_t; |
| 69 | 69 | ||
| 70 | #ifdef MIDI_ENABLE | 70 | #ifdef MIDI_ENABLE |
| 71 | void MIDI_Task(void); | 71 | #define MIDI_SYSEX_BUFFER 16 |
| 72 | MidiDevice midi_device; | 72 | void MIDI_Task(void); |
| 73 | MidiDevice midi_device; | ||
| 74 | |||
| 75 | void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data); | ||
| 76 | uint32_t decode_uint32_chunk(uint8_t * data); | ||
| 77 | uint32_t decode_uint8_chunk(uint8_t * data); | ||
| 78 | void encode_uint32_chunk(uint32_t data, uint8_t * pointer); | ||
| 79 | void encode_uint8_chunk(uint8_t data, uint8_t * pointer); | ||
| 80 | void sysex_buffer_callback(MidiDevice * device, uint8_t length, uint8_t * data); | ||
| 81 | void send_unicode_midi(uint32_t unicode); | ||
| 82 | void send_bytes_sysex(uint8_t type, uint8_t * bytes, uint8_t length); | ||
| 73 | #endif | 83 | #endif |
| 74 | 84 | ||
| 75 | // #if LUFA_VERSION_INTEGER < 0x120730 | 85 | // #if LUFA_VERSION_INTEGER < 0x120730 |
