diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2016-11-29 11:22:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-29 11:22:31 -0500 |
| commit | 81ea909467c8a5bfbd803c58e685c5de74dbc249 (patch) | |
| tree | 68f0649a449fda9c65c3f1f0d9d1de0c5a43ff46 | |
| parent | 51ae6da99edd732ccdec6e102bd757e08950d23b (diff) | |
| parent | 4094544d41450617bc21ab58646603b8964eae0e (diff) | |
| download | qmk_firmware-81ea909467c8a5bfbd803c58e685c5de74dbc249.tar.gz qmk_firmware-81ea909467c8a5bfbd803c58e685c5de74dbc249.zip | |
Merge pull request #919 from jackhumbert/hf/robot_test_layout
Test layout for ErgoDox EZ manufacturing robot
| -rw-r--r-- | keyboards/ergodox/keymaps/robot_test_layout/keymap.c | 130 | ||||
| -rw-r--r-- | keyboards/ergodox/keymaps/robot_test_layout/readme.md | 5 | ||||
| -rw-r--r-- | quantum/rgblight.c | 6 | ||||
| -rw-r--r-- | quantum/rgblight.h | 2 |
4 files changed, 143 insertions, 0 deletions
diff --git a/keyboards/ergodox/keymaps/robot_test_layout/keymap.c b/keyboards/ergodox/keymaps/robot_test_layout/keymap.c new file mode 100644 index 000000000..0363eedc2 --- /dev/null +++ b/keyboards/ergodox/keymaps/robot_test_layout/keymap.c | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | #include "ergodox.h" | ||
| 2 | #include "debug.h" | ||
| 3 | #include "action_layer.h" | ||
| 4 | #include "version.h" | ||
| 5 | |||
| 6 | enum custom_keycodes { | ||
| 7 | PLACEHOLDER = SAFE_RANGE, // can always be here | ||
| 8 | RGB_FF0000, | ||
| 9 | RGB_00FF00, | ||
| 10 | RGB_0000FF, | ||
| 11 | RGB_FFFFFF, | ||
| 12 | RGB_TOGGLE | ||
| 13 | }; | ||
| 14 | |||
| 15 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 16 | |||
| 17 | [0] = KEYMAP( | ||
| 18 | RGB_TOGGLE,RGB_FF0000,RGB_00FF00,RGB_0000FF,RGB_FFFFFF,RGB_TOGGLE,KC_6, | ||
| 19 | KC_A,KC_Q,KC_W,KC_E,KC_R,KC_T,KC_E,KC_A,KC_A,KC_S,KC_D,KC_F,KC_G,KC_A,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_L,KC_Z,KC_QUOTE,KC_N,KC_U,KC_C,KC_E,KC_8,KC_9,KC_Y,KC_COMMA,KC_6,KC_7,KC_6,KC_7,KC_8,KC_9,KC_0,KC_MINUS,KC_J,KC_Y,KC_U,KC_I,KC_O,KC_P,KC_BSLASH,KC_H,KC_J,KC_K,KC_L,KC_J,KC_K,KC_Z,KC_N,KC_M,KC_COMMA,KC_DOT,KC_E,KC_QUOTE,KC_8,KC_7,KC_LBRACKET,KC_RBRACKET,KC_H,KC_9,KC_7,KC_8,KC_7,KC_6,KC_9), | ||
| 20 | }; | ||
| 21 | |||
| 22 | const uint16_t PROGMEM fn_actions[] = { | ||
| 23 | [1] = ACTION_LAYER_TAP_TOGGLE(1) | ||
| 24 | }; | ||
| 25 | |||
| 26 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 27 | { | ||
| 28 | switch(id) { | ||
| 29 | case 0: | ||
| 30 | if (record->event.pressed) { | ||
| 31 | SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | ||
| 32 | } | ||
| 33 | break; | ||
| 34 | } | ||
| 35 | return MACRO_NONE; | ||
| 36 | }; | ||
| 37 | |||
| 38 | |||
| 39 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 40 | switch (keycode) { | ||
| 41 | // dynamically generate these. | ||
| 42 | case RGB_FF0000: | ||
| 43 | if (record->event.pressed) { | ||
| 44 | #ifdef RGBLIGHT_ENABLE | ||
| 45 | EZ_RGB(0xff0000); | ||
| 46 | register_code(KC_A); unregister_code(KC_A); | ||
| 47 | #endif | ||
| 48 | } | ||
| 49 | return false; | ||
| 50 | break; | ||
| 51 | case RGB_00FF00: | ||
| 52 | if (record->event.pressed) { | ||
| 53 | #ifdef RGBLIGHT_ENABLE | ||
| 54 | EZ_RGB(0x00ff00); | ||
| 55 | register_code(KC_B); unregister_code(KC_B); | ||
| 56 | #endif | ||
| 57 | } | ||
| 58 | return false; | ||
| 59 | break; | ||
| 60 | case RGB_0000FF: | ||
| 61 | if (record->event.pressed) { | ||
| 62 | #ifdef RGBLIGHT_ENABLE | ||
| 63 | EZ_RGB(0x0000ff); | ||
| 64 | register_code(KC_C); unregister_code(KC_C); | ||
| 65 | #endif | ||
| 66 | } | ||
| 67 | return false; | ||
| 68 | break; | ||
| 69 | case RGB_FFFFFF: | ||
| 70 | if (record->event.pressed) { | ||
| 71 | #ifdef RGBLIGHT_ENABLE | ||
| 72 | EZ_RGB(0xffffff); | ||
| 73 | register_code(KC_D); unregister_code(KC_D); | ||
| 74 | #endif | ||
| 75 | } | ||
| 76 | return false; | ||
| 77 | break; | ||
| 78 | case RGB_TOGGLE: | ||
| 79 | if (record->event.pressed) { | ||
| 80 | #ifdef RGBLIGHT_ENABLE | ||
| 81 | rgblight_toggle(); | ||
| 82 | register_code(KC_F); unregister_code(KC_F); | ||
| 83 | #endif | ||
| 84 | } | ||
| 85 | return false; | ||
| 86 | break; | ||
| 87 | } | ||
| 88 | return true; | ||
| 89 | } | ||
| 90 | |||
| 91 | void matrix_scan_user(void) { | ||
| 92 | |||
| 93 | uint8_t layer = biton32(layer_state); | ||
| 94 | |||
| 95 | ergodox_board_led_off(); | ||
| 96 | ergodox_right_led_1_off(); | ||
| 97 | ergodox_right_led_2_off(); | ||
| 98 | ergodox_right_led_3_off(); | ||
| 99 | switch (layer) { | ||
| 100 | case 1: | ||
| 101 | ergodox_right_led_1_on(); | ||
| 102 | break; | ||
| 103 | case 2: | ||
| 104 | ergodox_right_led_2_on(); | ||
| 105 | break; | ||
| 106 | case 3: | ||
| 107 | ergodox_right_led_3_on(); | ||
| 108 | break; | ||
| 109 | case 4: | ||
| 110 | ergodox_right_led_1_on(); | ||
| 111 | ergodox_right_led_2_on(); | ||
| 112 | break; | ||
| 113 | case 5: | ||
| 114 | ergodox_right_led_1_on(); | ||
| 115 | ergodox_right_led_3_on(); | ||
| 116 | break; | ||
| 117 | case 6: | ||
| 118 | ergodox_right_led_2_on(); | ||
| 119 | ergodox_right_led_3_on(); | ||
| 120 | break; | ||
| 121 | case 7: | ||
| 122 | ergodox_right_led_1_on(); | ||
| 123 | ergodox_right_led_2_on(); | ||
| 124 | ergodox_right_led_3_on(); | ||
| 125 | break; | ||
| 126 | default: | ||
| 127 | break; | ||
| 128 | } | ||
| 129 | |||
| 130 | }; | ||
diff --git a/keyboards/ergodox/keymaps/robot_test_layout/readme.md b/keyboards/ergodox/keymaps/robot_test_layout/readme.md new file mode 100644 index 000000000..45dc2aa76 --- /dev/null +++ b/keyboards/ergodox/keymaps/robot_test_layout/readme.md | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # Robot test layout | ||
| 2 | |||
| 3 | Use this layout if you like to pretend you're [Norman](https://www.youtube.com/watch?v=-sbxFBay-tg), the ErgoDox EZ manufacturing robot. | ||
| 4 | |||
| 5 | It's really meant just for internal use, but we're posting it on GitHub anyway, because hurray to open source. :) | ||
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index bb03d6e91..625971e0f 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
| @@ -425,6 +425,12 @@ void rgblight_timer_toggle(void) { | |||
| 425 | dprintf("TIMER3 toggled.\n"); | 425 | dprintf("TIMER3 toggled.\n"); |
| 426 | } | 426 | } |
| 427 | 427 | ||
| 428 | void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) { | ||
| 429 | rgblight_enable(); | ||
| 430 | rgblight_mode(1); | ||
| 431 | rgblight_setrgb(r, g, b); | ||
| 432 | } | ||
| 433 | |||
| 428 | void rgblight_task(void) { | 434 | void rgblight_task(void) { |
| 429 | if (rgblight_timer_enabled) { | 435 | if (rgblight_timer_enabled) { |
| 430 | // mode = 1, static light, do nothing here | 436 | // mode = 1, static light, do nothing here |
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 28a410e48..aa1d026e0 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h | |||
| @@ -84,6 +84,8 @@ void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); | |||
| 84 | void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); | 84 | void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); |
| 85 | void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); | 85 | void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); |
| 86 | 86 | ||
| 87 | #define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) | ||
| 88 | void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); | ||
| 87 | 89 | ||
| 88 | void rgblight_task(void); | 90 | void rgblight_task(void); |
| 89 | 91 | ||
