diff options
| author | XScorpion2 <rcalt2vt@gmail.com> | 2021-06-26 00:00:21 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-25 22:00:21 -0700 |
| commit | 8b059088ba9c310d3790d2839027e966f1082393 (patch) | |
| tree | 535432b0969c2b4d27201c2b99cd3c63978817d3 | |
| parent | f8c01a8e5ad3cf85157d53d4718d80f194bb61cd (diff) | |
| download | qmk_firmware-8b059088ba9c310d3790d2839027e966f1082393.tar.gz qmk_firmware-8b059088ba9c310d3790d2839027e966f1082393.zip | |
Keyboards/RGBKB/Mün (#13239)
27 files changed, 2049 insertions, 0 deletions
diff --git a/keyboards/rgbkb/common/common_oled.c b/keyboards/rgbkb/common/common_oled.c new file mode 100644 index 000000000..b6ea6b20a --- /dev/null +++ b/keyboards/rgbkb/common/common_oled.c | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include "common_oled.h" | ||
| 11 | #include "oled_driver.h" | ||
| 12 | #include "rgb_matrix.h" | ||
| 13 | |||
| 14 | // for memcpy | ||
| 15 | #include <string.h> | ||
| 16 | #include <transactions.h> | ||
| 17 | |||
| 18 | typedef struct { | ||
| 19 | bool selecting; | ||
| 20 | uint8_t selection; | ||
| 21 | } kb_menu_status_t; | ||
| 22 | |||
| 23 | static kb_menu_status_t rgb_menu = { false, 4 }; | ||
| 24 | static bool rgb_menu_changed = false; | ||
| 25 | |||
| 26 | void render_logo(void) { | ||
| 27 | static const char PROGMEM font_logo[] = { | ||
| 28 | 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, | ||
| 29 | 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, | ||
| 30 | 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0}; | ||
| 31 | oled_write_P(font_logo, false); | ||
| 32 | } | ||
| 33 | |||
| 34 | void render_icon(void) { | ||
| 35 | static const char PROGMEM font_icon[] = { | ||
| 36 | 0x9b,0x9c,0x9d,0x9e,0x9f, | ||
| 37 | 0xbb,0xbc,0xbd,0xbe,0xbf, | ||
| 38 | 0xdb,0xdc,0xdd,0xde,0xdf,0 | ||
| 39 | }; | ||
| 40 | oled_write_P(font_icon, false); | ||
| 41 | } | ||
| 42 | |||
| 43 | #define RGB_FUNCTION_COUNT 6 | ||
| 44 | typedef void (*rgb_matrix_f)(void); | ||
| 45 | const rgb_matrix_f rgb_matrix_functions[RGB_FUNCTION_COUNT][2] = { | ||
| 46 | { rgb_matrix_increase_hue, rgb_matrix_decrease_hue }, | ||
| 47 | { rgb_matrix_increase_sat, rgb_matrix_decrease_sat }, | ||
| 48 | { rgb_matrix_increase_val, rgb_matrix_decrease_val }, | ||
| 49 | { rgb_matrix_increase_speed, rgb_matrix_decrease_speed }, | ||
| 50 | { rgb_matrix_step, rgb_matrix_step_reverse }, | ||
| 51 | { rgb_matrix_toggle, rgb_matrix_toggle } | ||
| 52 | }; | ||
| 53 | |||
| 54 | void render_rgb_menu(void) { | ||
| 55 | static char buffer[63] = {0}; | ||
| 56 | snprintf(buffer, sizeof(buffer), "Hue %3dSatrn %3dValue %3dSpeed %3dMode %3dEnbld %3d", | ||
| 57 | rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, rgb_matrix_config.speed, rgb_matrix_config.mode, rgb_matrix_config.enable); | ||
| 58 | |||
| 59 | if (rgb_menu.selecting) { | ||
| 60 | buffer[5 + rgb_menu.selection * 10] = '*'; | ||
| 61 | } | ||
| 62 | else { | ||
| 63 | buffer[5 + rgb_menu.selection * 10] = '>'; | ||
| 64 | } | ||
| 65 | oled_write(buffer, false); | ||
| 66 | } | ||
| 67 | |||
| 68 | void rgb_menu_selection(void) { | ||
| 69 | if (!is_keyboard_master()) return; | ||
| 70 | rgb_menu.selecting = !rgb_menu.selecting; | ||
| 71 | rgb_menu_changed = true; | ||
| 72 | } | ||
| 73 | |||
| 74 | void rgb_menu_action(bool clockwise) { | ||
| 75 | if (!is_keyboard_master()) return; | ||
| 76 | if (rgb_menu.selecting) { | ||
| 77 | if (!clockwise) { | ||
| 78 | rgb_menu.selection = (rgb_menu.selection - 1); | ||
| 79 | if (rgb_menu.selection >= RGB_FUNCTION_COUNT) | ||
| 80 | rgb_menu.selection = RGB_FUNCTION_COUNT - 1; | ||
| 81 | } | ||
| 82 | else { | ||
| 83 | rgb_menu.selection = (rgb_menu.selection + 1) % RGB_FUNCTION_COUNT; | ||
| 84 | } | ||
| 85 | } | ||
| 86 | else { | ||
| 87 | (*rgb_matrix_functions[rgb_menu.selection][clockwise])(); | ||
| 88 | } | ||
| 89 | rgb_menu_changed = true; | ||
| 90 | } | ||
| 91 | |||
| 92 | void rgb_menu_update(int8_t transaction_id) { | ||
| 93 | if (!is_keyboard_master()) return; | ||
| 94 | if (!rgb_menu_changed) return; | ||
| 95 | rgb_menu_changed = false; | ||
| 96 | transaction_rpc_send(transaction_id, sizeof(kb_menu_status_t), &rgb_menu); | ||
| 97 | } | ||
| 98 | |||
| 99 | void rgb_menu_slave_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { | ||
| 100 | memcpy(&rgb_menu, initiator2target_buffer, sizeof(kb_menu_status_t)); | ||
| 101 | } \ No newline at end of file | ||
diff --git a/keyboards/rgbkb/common/common_oled.h b/keyboards/rgbkb/common/common_oled.h new file mode 100644 index 000000000..a99988b2a --- /dev/null +++ b/keyboards/rgbkb/common/common_oled.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #pragma once | ||
| 11 | |||
| 12 | #include <stdint.h> | ||
| 13 | #include <stdbool.h> | ||
| 14 | |||
| 15 | void render_logo(void); | ||
| 16 | void render_icon(void); | ||
| 17 | void render_rgb_menu(void); | ||
| 18 | void rgb_menu_selection(void); | ||
| 19 | void rgb_menu_action(bool clockwise); | ||
| 20 | void rgb_menu_update(int8_t transaction_id); | ||
| 21 | void rgb_menu_slave_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer); \ No newline at end of file | ||
diff --git a/keyboards/rgbkb/common/glcdfont.c b/keyboards/rgbkb/common/glcdfont.c new file mode 100644 index 000000000..320925a8f --- /dev/null +++ b/keyboards/rgbkb/common/glcdfont.c | |||
| @@ -0,0 +1,240 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include "progmem.h" | ||
| 11 | |||
| 12 | // Helidox 8x6 font with RGBKB SOL Logo | ||
| 13 | // Online editor: http://teripom.x0.com/ | ||
| 14 | |||
| 15 | static const unsigned char font[] PROGMEM = { | ||
| 16 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 17 | 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, | ||
| 18 | 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, | ||
| 19 | 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, | ||
| 20 | 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, | ||
| 21 | 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, | ||
| 22 | 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, | ||
| 23 | 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, | ||
| 24 | 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, | ||
| 25 | 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, | ||
| 26 | 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, | ||
| 27 | 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, | ||
| 28 | 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, | ||
| 29 | 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, | ||
| 30 | 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, | ||
| 31 | 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, | ||
| 32 | 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, | ||
| 33 | 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, | ||
| 34 | 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, | ||
| 35 | 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, | ||
| 36 | 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, | ||
| 37 | 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, | ||
| 38 | 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, | ||
| 39 | 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, | ||
| 40 | 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, | ||
| 41 | 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, | ||
| 42 | 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, | ||
| 43 | 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, | ||
| 44 | 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, | ||
| 45 | 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, | ||
| 46 | 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, | ||
| 47 | 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, | ||
| 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 49 | 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, | ||
| 50 | 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, | ||
| 51 | 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, | ||
| 52 | 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, | ||
| 53 | 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, | ||
| 54 | 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, | ||
| 55 | 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, | ||
| 56 | 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, | ||
| 57 | 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, | ||
| 58 | 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, | ||
| 59 | 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, | ||
| 60 | 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, | ||
| 61 | 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, | ||
| 62 | 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, | ||
| 63 | 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, | ||
| 64 | 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, | ||
| 65 | 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, | ||
| 66 | 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, | ||
| 67 | 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, | ||
| 68 | 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, | ||
| 69 | 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, | ||
| 70 | 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, | ||
| 71 | 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, | ||
| 72 | 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, | ||
| 73 | 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, | ||
| 74 | 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, | ||
| 75 | 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, | ||
| 76 | 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, | ||
| 77 | 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, | ||
| 78 | 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, | ||
| 79 | 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, | ||
| 80 | 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, | ||
| 81 | 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, | ||
| 82 | 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, | ||
| 83 | 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, | ||
| 84 | 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, | ||
| 85 | 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, | ||
| 86 | 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, | ||
| 87 | 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, | ||
| 88 | 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, | ||
| 89 | 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, | ||
| 90 | 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, | ||
| 91 | 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, | ||
| 92 | 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, | ||
| 93 | 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, | ||
| 94 | 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, | ||
| 95 | 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, | ||
| 96 | 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, | ||
| 97 | 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, | ||
| 98 | 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, | ||
| 99 | 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, | ||
| 100 | 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, | ||
| 101 | 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, | ||
| 102 | 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, | ||
| 103 | 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, | ||
| 104 | 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, | ||
| 105 | 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, | ||
| 106 | 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, | ||
| 107 | 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, | ||
| 108 | 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, | ||
| 109 | 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, | ||
| 110 | 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, | ||
| 111 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, | ||
| 112 | 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, | ||
| 113 | 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, | ||
| 114 | 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, | ||
| 115 | 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, | ||
| 116 | 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, | ||
| 117 | 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, | ||
| 118 | 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, | ||
| 119 | 0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00, | ||
| 120 | 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, | ||
| 121 | 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, | ||
| 122 | 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, | ||
| 123 | 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, | ||
| 124 | 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, | ||
| 125 | 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, | ||
| 126 | 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, | ||
| 127 | 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, | ||
| 128 | 0xFC, 0x18, 0x24, 0x24, 0x18, 0x00, | ||
| 129 | 0x18, 0x24, 0x24, 0x18, 0xFC, 0x00, | ||
| 130 | 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, | ||
| 131 | 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, | ||
| 132 | 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, | ||
| 133 | 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, | ||
| 134 | 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, | ||
| 135 | 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, | ||
| 136 | 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, | ||
| 137 | 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, | ||
| 138 | 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, | ||
| 139 | 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, | ||
| 140 | 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, | ||
| 141 | 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, | ||
| 142 | 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, | ||
| 143 | 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, | ||
| 144 | 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, | ||
| 145 | 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, | ||
| 146 | 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, | ||
| 147 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, | ||
| 148 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 149 | 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, | ||
| 150 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 151 | 0x00, 0x80, 0x00, 0x00, 0x0C, 0x90, | ||
| 152 | 0xB0, 0xE0, 0x72, 0x31, 0x9B, 0xDE, | ||
| 153 | 0xCE, 0xEC, 0xEE, 0xE9, 0xE9, 0xEC, | ||
| 154 | 0xCF, 0xDA, 0x99, 0x3E, 0x62, 0xE4, | ||
| 155 | 0xC4, 0x70, 0x10, 0x10, 0x00, 0x00, | ||
| 156 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, | ||
| 157 | 0xC0, 0xC0, 0x80, 0x80, 0x02, 0x85, | ||
| 158 | 0x85, 0x87, 0x85, 0x89, 0x89, 0x92, | ||
| 159 | 0xEA, 0xC6, 0xC4, 0x48, 0x50, 0x60, | ||
| 160 | 0x40, 0x40, 0x40, 0x40, 0xC0, 0xE0, | ||
| 161 | 0x50, 0x28, 0x10, 0x10, 0x60, 0xC0, | ||
| 162 | 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, | ||
| 163 | 0x80, 0x80, 0x80, 0xE0, 0xF8, 0xFC, | ||
| 164 | 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00, | ||
| 165 | 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, | ||
| 166 | 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, | ||
| 167 | 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, | ||
| 168 | 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, | ||
| 169 | 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, | ||
| 170 | 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, | ||
| 171 | 0x00, 0x00, 0xF0, 0xF4, 0xEC, 0xDE, | ||
| 172 | 0xDE, 0xBE, 0x3E, 0x3E, 0x3F, 0x3F, | ||
| 173 | 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x3F, | ||
| 174 | 0x3F, 0x3E, 0x3E, 0xBE, 0xDE, 0xDE, | ||
| 175 | 0xEC, 0xF4, 0xF0, 0x00, 0x00, 0x00, | ||
| 176 | 0x00, 0x00, 0x00, 0x7F, 0x80, 0x80, | ||
| 177 | 0x80, 0x70, 0x0F, 0x00, 0x00, 0x80, | ||
| 178 | 0x7F, 0x00, 0x00, 0x7F, 0x80, 0x80, | ||
| 179 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x7F, | ||
| 180 | 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, | ||
| 181 | 0x80, 0x80, 0x80, 0xFF, 0x00, 0x00, | ||
| 182 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 183 | 0x00, 0x40, 0x21, 0x33, 0x3B, 0x7B, | ||
| 184 | 0xFF, 0x00, 0x7C, 0xFF, 0xFF, 0xFF, | ||
| 185 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 186 | 0xFF, 0xFF, 0xFF, 0xFF, 0x7C, 0x01, | ||
| 187 | 0xFF, 0xDE, 0x8C, 0x04, 0x0C, 0x08, | ||
| 188 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 189 | 0x00, 0x01, 0x01, 0x01, 0x7F, 0x80, | ||
| 190 | 0x80, 0xBE, 0xBE, 0x80, 0x80, 0x80, | ||
| 191 | 0xC1, 0xFF, 0x80, 0x04, 0x32, 0x5E, | ||
| 192 | 0x1C, 0x3D, 0x26, 0x10, 0xC1, 0xFF, | ||
| 193 | 0x3E, 0x00, 0x00, 0x08, 0x36, 0xC1, | ||
| 194 | 0x08, 0x08, 0x14, 0x77, 0x94, 0x94, | ||
| 195 | 0x94, 0xF7, 0x94, 0xF7, 0x9C, 0x9C, | ||
| 196 | 0xFF, 0xFF, 0x1E, 0x00, 0x00, 0x00, | ||
| 197 | 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, | ||
| 198 | 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, | ||
| 199 | 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, | ||
| 200 | 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, | ||
| 201 | 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, | ||
| 202 | 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, | ||
| 203 | 0x00, 0x00, 0x01, 0x0F, 0x3F, 0xFF, | ||
| 204 | 0xFF, 0xFF, 0xFC, 0xE0, 0x80, 0x00, | ||
| 205 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 206 | 0x80, 0xE0, 0xFC, 0xFF, 0xFF, 0xFF, | ||
| 207 | 0x3F, 0x0F, 0x01, 0x00, 0x00, 0x00, | ||
| 208 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 209 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 210 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 211 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 212 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 213 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 214 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 215 | 0x00, 0x00, 0x00, 0x06, 0x02, 0x06, | ||
| 216 | 0x4D, 0x4F, 0x8C, 0xF9, 0x73, 0x37, | ||
| 217 | 0x27, 0x2F, 0x2F, 0xAF, 0xEF, 0x6F, | ||
| 218 | 0x77, 0x17, 0x33, 0x79, 0xCC, 0x1F, | ||
| 219 | 0x31, 0x20, 0x21, 0x02, 0x02, 0x00, | ||
| 220 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 221 | 0x00, 0x00, 0x00, 0x00, 0x40, 0xE0, | ||
| 222 | 0xA0, 0xA0, 0xD0, 0x90, 0x48, 0x48, | ||
| 223 | 0x25, 0x2B, 0x11, 0x09, 0x05, 0x03, | ||
| 224 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, | ||
| 225 | 0x01, 0x03, 0x02, 0x04, 0x03, 0x01, | ||
| 226 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, | ||
| 227 | 0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F, | ||
| 228 | 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, | ||
| 229 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 230 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 231 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 232 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 233 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 234 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 235 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 236 | 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, | ||
| 237 | 0xFE, 0xFC, 0x00, 0xFC, 0xFE, 0x7F, | ||
| 238 | 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x00, | ||
| 239 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 240 | }; | ||
diff --git a/keyboards/rgbkb/common/touch_encoder.c b/keyboards/rgbkb/common/touch_encoder.c new file mode 100644 index 000000000..6293739ec --- /dev/null +++ b/keyboards/rgbkb/common/touch_encoder.c | |||
| @@ -0,0 +1,310 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/XScorpion2> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. Ryan Caltabiano | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include "i2c_master.h" | ||
| 11 | #include "keyboard.h" | ||
| 12 | #include "touch_encoder.h" | ||
| 13 | #include "print.h" | ||
| 14 | #include "wait.h" | ||
| 15 | #include "timer.h" | ||
| 16 | |||
| 17 | // for memcpy | ||
| 18 | #include <string.h> | ||
| 19 | #include <transactions.h> | ||
| 20 | |||
| 21 | #define I2C_ADDRESS 0x1C | ||
| 22 | #define CALIBRATION_BIT 0x80 | ||
| 23 | #define OVERFLOW_BIT 0x40 | ||
| 24 | #define SLIDER_BIT 0x02 | ||
| 25 | |||
| 26 | #ifndef TOUCH_UPDATE_INTERVAL | ||
| 27 | # define TOUCH_UPDATE_INTERVAL 33 | ||
| 28 | #endif | ||
| 29 | |||
| 30 | enum { // QT2120 registers | ||
| 31 | QT_CHIP_ID = 0, | ||
| 32 | QT_FIRMWARE_VERSION, | ||
| 33 | QT_DETECTION_STATUS, | ||
| 34 | QT_KEY_STATUS, | ||
| 35 | QT_SLIDER_POSITION = 5, | ||
| 36 | QT_CALIBRATE, | ||
| 37 | QT_RESET, | ||
| 38 | QT_LP, | ||
| 39 | QT_TTD, | ||
| 40 | QT_ATD, | ||
| 41 | QT_DI, | ||
| 42 | QT_TRD, | ||
| 43 | QT_DHT, | ||
| 44 | QT_SLIDER_OPTION, | ||
| 45 | QT_CHARDE_TIME, | ||
| 46 | QT_KEY0_DTHR, | ||
| 47 | QT_KEY1_DTHR, | ||
| 48 | QT_KEY2_DTHR, | ||
| 49 | QT_KEY3_DTHR, | ||
| 50 | QT_KEY4_DTHR, | ||
| 51 | QT_KEY5_DTHR, | ||
| 52 | QT_KEY6_DTHR, | ||
| 53 | QT_KEY7_DTHR, | ||
| 54 | QT_KEY8_DTHR, | ||
| 55 | QT_KEY9_DTHR, | ||
| 56 | QT_KEY10_DTHR, | ||
| 57 | QT_KEY11_DTHR, | ||
| 58 | QT_KEY0_CTRL, | ||
| 59 | QT_KEY1_CTRL, | ||
| 60 | QT_KEY2_CTRL, | ||
| 61 | QT_KEY3_CTRL, | ||
| 62 | QT_KEY4_CTRL, | ||
| 63 | QT_KEY5_CTRL, | ||
| 64 | QT_KEY6_CTRL, | ||
| 65 | QT_KEY7_CTRL, | ||
| 66 | QT_KEY8_CTRL, | ||
| 67 | QT_KEY9_CTRL, | ||
| 68 | QT_KEY10_CTRL, | ||
| 69 | QT_KEY11_CTRL, | ||
| 70 | QT_KEY0_PULSE_SCALE, | ||
| 71 | QT_KEY1_PULSE_SCALE, | ||
| 72 | QT_KEY2_PULSE_SCALE, | ||
| 73 | QT_KEY3_PULSE_SCALE, | ||
| 74 | QT_KEY4_PULSE_SCALE, | ||
| 75 | QT_KEY5_PULSE_SCALE, | ||
| 76 | QT_KEY6_PULSE_SCALE, | ||
| 77 | QT_KEY7_PULSE_SCALE, | ||
| 78 | QT_KEY8_PULSE_SCALE, | ||
| 79 | QT_KEY9_PULSE_SCALE, | ||
| 80 | QT_KEY10_PULSE_SCALE, | ||
| 81 | QT_KEY11_PULSE_SCALE, | ||
| 82 | QT_KEY0_SIGNAL, | ||
| 83 | QT_KEY1_SIGNAL = 54, | ||
| 84 | QT_KEY2_SIGNAL = 56, | ||
| 85 | QT_KEY3_SIGNAL = 58, | ||
| 86 | QT_KEY4_SIGNAL = 60, | ||
| 87 | QT_KEY5_SIGNAL = 62, | ||
| 88 | QT_KEY6_SIGNAL = 64, | ||
| 89 | QT_KEY7_SIGNAL = 66, | ||
| 90 | QT_KEY8_SIGNAL = 68, | ||
| 91 | QT_KEY9_SIGNAL = 70, | ||
| 92 | QT_KEY10_SIGNAL = 72, | ||
| 93 | QT_KEY11_SIGNAL = 74, | ||
| 94 | QT_KEY0_REFERENCE = 76, | ||
| 95 | QT_KEY1_REFERENCE = 78, | ||
| 96 | QT_KEY2_REFERENCE = 80, | ||
| 97 | QT_KEY3_REFERENCE = 82, | ||
| 98 | QT_KEY4_REFERENCE = 84, | ||
| 99 | QT_KEY5_REFERENCE = 86, | ||
| 100 | QT_KEY6_REFERENCE = 88, | ||
| 101 | QT_KEY7_REFERENCE = 90, | ||
| 102 | QT_KEY8_REFERENCE = 92, | ||
| 103 | QT_KEY9_REFERENCE = 94, | ||
| 104 | QT_KEY10_REFERENCE = 96, | ||
| 105 | QT_KEY11_REFERENCE = 98, | ||
| 106 | }; | ||
| 107 | |||
| 108 | bool touch_initialized = false; | ||
| 109 | bool touch_disabled = false; | ||
| 110 | uint8_t touch_handness = 0; | ||
| 111 | // touch_raw & touch_processed store the Detection Status, Key Status (x2), and Slider Position values | ||
| 112 | uint8_t touch_raw[4] = { 0 }; | ||
| 113 | uint8_t touch_processed[4] = { 0 }; | ||
| 114 | |||
| 115 | uint16_t touch_timer = 0; | ||
| 116 | uint16_t touch_update_timer = 0; | ||
| 117 | |||
| 118 | // For split transport only | ||
| 119 | typedef struct { | ||
| 120 | uint8_t position; | ||
| 121 | uint8_t taps; | ||
| 122 | } slave_touch_status_t; | ||
| 123 | |||
| 124 | bool touch_slave_init = false; | ||
| 125 | slave_touch_status_t touch_slave_state = { 0, 0 }; | ||
| 126 | |||
| 127 | static bool write_register8(uint8_t address, uint8_t data) { | ||
| 128 | i2c_status_t status = i2c_writeReg((I2C_ADDRESS << 1), address, &data, sizeof(data), I2C_TIMEOUT); | ||
| 129 | if (status != I2C_STATUS_SUCCESS) { | ||
| 130 | xprintf("write_register8 %d failed %d\n", address, status); | ||
| 131 | } | ||
| 132 | return status == I2C_STATUS_SUCCESS; | ||
| 133 | } | ||
| 134 | |||
| 135 | static bool read_register(uint8_t address, uint8_t* data, uint16_t length) { | ||
| 136 | i2c_status_t status = i2c_readReg((I2C_ADDRESS << 1), address, data, length, I2C_TIMEOUT); | ||
| 137 | if (status != I2C_STATUS_SUCCESS) { | ||
| 138 | xprintf("read_register %d failed %d\n", address, status); | ||
| 139 | return false; | ||
| 140 | } | ||
| 141 | return true; | ||
| 142 | } | ||
| 143 | |||
| 144 | void touch_encoder_init(void) { | ||
| 145 | i2c_init(); | ||
| 146 | |||
| 147 | touch_handness = is_keyboard_left() ? 0 : 1; | ||
| 148 | |||
| 149 | // Set QT to slider mode | ||
| 150 | touch_initialized = write_register8(QT_SLIDER_OPTION, 0x80); | ||
| 151 | touch_initialized &= write_register8(QT_TTD, 4); // Toward Drift - 20 @ 3.2s | ||
| 152 | touch_initialized &= write_register8(QT_ATD, 1); // Away Drift - 5 @ 0.8s | ||
| 153 | touch_initialized &= write_register8(QT_DI, 4); // Detection Integrator - 4 | ||
| 154 | touch_initialized &= write_register8(QT_TRD, 0); // Touch Recall - 48 | ||
| 155 | touch_encoder_calibrate(); | ||
| 156 | } | ||
| 157 | |||
| 158 | __attribute__((weak)) bool touch_encoder_tapped_kb(uint8_t index, uint8_t section) { return touch_encoder_tapped_user(index, section); } | ||
| 159 | __attribute__((weak)) bool touch_encoder_update_kb(uint8_t index, bool clockwise) { return touch_encoder_update_user(index, clockwise); } | ||
| 160 | |||
| 161 | __attribute__((weak)) bool touch_encoder_tapped_user(uint8_t index, uint8_t section) { return true; } | ||
| 162 | __attribute__((weak)) bool touch_encoder_update_user(uint8_t index, bool clockwise) { return true; } | ||
| 163 | |||
| 164 | static void touch_encoder_update_tapped(void) { | ||
| 165 | // Started touching, being counter for TOUCH_TERM | ||
| 166 | if (touch_processed[0] & SLIDER_BIT) { | ||
| 167 | touch_timer = timer_read() + TOUCH_TERM; | ||
| 168 | return; | ||
| 169 | } | ||
| 170 | |||
| 171 | // Touch held too long, bail | ||
| 172 | if (timer_expired(timer_read(), touch_timer)) return; | ||
| 173 | |||
| 174 | uint8_t section = touch_processed[3] / (UINT8_MAX / TOUCH_SEGMENTS + 1); | ||
| 175 | xprintf("tap %d %d\n", touch_handness, section); | ||
| 176 | if (is_keyboard_master()) { | ||
| 177 | if (!touch_disabled) { | ||
| 178 | touch_encoder_tapped_kb(touch_handness, section); | ||
| 179 | } | ||
| 180 | } | ||
| 181 | else { | ||
| 182 | touch_slave_state.taps ^= (1 << section); | ||
| 183 | } | ||
| 184 | } | ||
| 185 | |||
| 186 | static void touch_encoder_update_position_common(uint8_t* position, uint8_t raw, uint8_t index) { | ||
| 187 | int8_t delta = (*position - raw) / TOUCH_RESOLUTION; | ||
| 188 | bool clockwise = raw > *position; | ||
| 189 | if (delta == 0) return; | ||
| 190 | |||
| 191 | // Don't store raw directly, as we want to ensure any remainder is kept and used next time this is called | ||
| 192 | *position -= delta * TOUCH_RESOLUTION; | ||
| 193 | xprintf("pos %d %d\n", index, raw); | ||
| 194 | //uint8_t u_delta = delta < 0 ? -delta : delta; | ||
| 195 | if (!touch_disabled) { | ||
| 196 | //for (uint8_t i = 0; i < u_delta; i++) | ||
| 197 | touch_encoder_update_kb(index, clockwise); | ||
| 198 | } | ||
| 199 | } | ||
| 200 | |||
| 201 | static void touch_encoder_update_position(void) { | ||
| 202 | // If the user touchs and moves enough, expire touch_timer faster and do encoder position logic instead | ||
| 203 | if (!timer_expired(timer_read(), touch_timer)) { | ||
| 204 | if ((uint8_t)(touch_raw[3] - touch_processed[3]) <= TOUCH_DEADZONE) return; | ||
| 205 | touch_timer = timer_read(); | ||
| 206 | } | ||
| 207 | |||
| 208 | if (is_keyboard_master()) { | ||
| 209 | touch_encoder_update_position_common(&touch_processed[3], touch_raw[3], touch_handness); | ||
| 210 | } | ||
| 211 | else { | ||
| 212 | touch_slave_state.position = touch_raw[3]; | ||
| 213 | } | ||
| 214 | } | ||
| 215 | |||
| 216 | void touch_encoder_update_slave(slave_touch_status_t slave_state) { | ||
| 217 | if (!touch_slave_init) { | ||
| 218 | touch_slave_state = slave_state; | ||
| 219 | touch_slave_init = true; | ||
| 220 | return; | ||
| 221 | } | ||
| 222 | |||
| 223 | if (touch_slave_state.position != slave_state.position) { | ||
| 224 | // Did a new slide event start? | ||
| 225 | uint8_t mask = (1 << 7); | ||
| 226 | if ((touch_slave_state.taps & mask) != (slave_state.taps & mask)) { | ||
| 227 | touch_slave_state.position = slave_state.position; | ||
| 228 | } | ||
| 229 | touch_encoder_update_position_common(&touch_slave_state.position, slave_state.position, !touch_handness); | ||
| 230 | } | ||
| 231 | |||
| 232 | if (touch_slave_state.taps != slave_state.taps) { | ||
| 233 | if (!touch_disabled) { | ||
| 234 | for (uint8_t section = 0; section < TOUCH_SEGMENTS; section++) { | ||
| 235 | uint8_t mask = (1 << section); | ||
| 236 | if ((touch_slave_state.taps & mask) != (slave_state.taps & mask)) { | ||
| 237 | xprintf("tap %d %d\n", !touch_handness, section); | ||
| 238 | touch_encoder_tapped_kb(!touch_handness, section); | ||
| 239 | } | ||
| 240 | } | ||
| 241 | } | ||
| 242 | touch_slave_state.taps = slave_state.taps; | ||
| 243 | } | ||
| 244 | } | ||
| 245 | |||
| 246 | void touch_encoder_update(int8_t transaction_id) { | ||
| 247 | if (!touch_initialized) return; | ||
| 248 | #if TOUCH_UPDATE_INTERVAL > 0 | ||
| 249 | if (!timer_expired(timer_read(), touch_update_timer)) return; | ||
| 250 | touch_update_timer = timer_read() + TOUCH_UPDATE_INTERVAL; | ||
| 251 | #endif | ||
| 252 | |||
| 253 | read_register(QT_DETECTION_STATUS, &touch_raw[0], sizeof(touch_raw)); | ||
| 254 | touch_processed[1] = touch_raw[1]; | ||
| 255 | touch_processed[2] = touch_raw[2]; | ||
| 256 | |||
| 257 | if (touch_raw[0] != touch_processed[0]) { | ||
| 258 | uint8_t delta = touch_raw[0] ^ touch_processed[0]; | ||
| 259 | touch_processed[0] = touch_raw[0]; | ||
| 260 | // When calibrating, normal sensor behavior is supended | ||
| 261 | if (delta & CALIBRATION_BIT) { | ||
| 262 | xprintf("calibration %d\n", touch_processed[0] >> 7 & 1); | ||
| 263 | } | ||
| 264 | if (delta & OVERFLOW_BIT) { | ||
| 265 | xprintf("overflow %d\n", touch_processed[0] >> 6 & 1); | ||
| 266 | } | ||
| 267 | if (delta & SLIDER_BIT) { | ||
| 268 | touch_processed[3] = touch_raw[3]; | ||
| 269 | if (!is_keyboard_master()) { | ||
| 270 | touch_slave_state.position = touch_raw[3]; | ||
| 271 | touch_slave_state.taps ^= (1 << 7); | ||
| 272 | } | ||
| 273 | touch_encoder_update_tapped(); | ||
| 274 | } | ||
| 275 | } | ||
| 276 | |||
| 277 | if ((touch_raw[0] & SLIDER_BIT) && touch_processed[3] != touch_raw[3]) { | ||
| 278 | touch_encoder_update_position(); | ||
| 279 | } | ||
| 280 | |||
| 281 | if (is_keyboard_master()) { | ||
| 282 | slave_touch_status_t slave_state; | ||
| 283 | if (transaction_rpc_exec(transaction_id, sizeof(bool), &touch_disabled, sizeof(slave_touch_status_t), &slave_state)) { | ||
| 284 | if (memcmp(&touch_slave_state, &slave_state, sizeof(slave_touch_status_t))) | ||
| 285 | touch_encoder_update_slave(slave_state); | ||
| 286 | } | ||
| 287 | } | ||
| 288 | } | ||
| 289 | |||
| 290 | void touch_encoder_calibrate(void) { | ||
| 291 | if (!touch_initialized) return; | ||
| 292 | write_register8(QT_CALIBRATE, 0x01); | ||
| 293 | } | ||
| 294 | |||
| 295 | bool touch_encoder_calibrating(void) { | ||
| 296 | return touch_raw[0] & CALIBRATION_BIT; | ||
| 297 | } | ||
| 298 | |||
| 299 | void touch_encoder_toggle(void) { | ||
| 300 | touch_disabled = !touch_disabled; | ||
| 301 | } | ||
| 302 | |||
| 303 | bool touch_encoder_toggled(void) { | ||
| 304 | return touch_disabled; | ||
| 305 | } | ||
| 306 | |||
| 307 | void touch_encoder_slave_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { | ||
| 308 | touch_disabled = *(bool*)initiator2target_buffer; | ||
| 309 | memcpy(target2initiator_buffer, &touch_slave_state, sizeof(slave_touch_status_t)); | ||
| 310 | } | ||
diff --git a/keyboards/rgbkb/common/touch_encoder.h b/keyboards/rgbkb/common/touch_encoder.h new file mode 100644 index 000000000..022f61906 --- /dev/null +++ b/keyboards/rgbkb/common/touch_encoder.h | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/XScorpion2> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. Ryan Caltabiano | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #pragma once | ||
| 11 | |||
| 12 | #include <stdint.h> | ||
| 13 | #include <stdbool.h> | ||
| 14 | |||
| 15 | #ifndef TOUCH_TERM | ||
| 16 | # define TOUCH_TERM 350 | ||
| 17 | #endif | ||
| 18 | |||
| 19 | #ifndef TOUCH_SEGMENTS | ||
| 20 | # define TOUCH_SEGMENTS 3 | ||
| 21 | #elif TOUCH_SEGMENTS < 1 || TOUCH_SEGMENTS > 5 | ||
| 22 | # error TOUCH_SEGMENTS must be between 1 and 5. | ||
| 23 | #endif | ||
| 24 | |||
| 25 | #ifndef TOUCH_DEADZONE | ||
| 26 | # define TOUCH_DEADZONE 50 | ||
| 27 | #endif | ||
| 28 | |||
| 29 | #ifndef TOUCH_RESOLUTION | ||
| 30 | # define TOUCH_RESOLUTION 25 | ||
| 31 | #endif | ||
| 32 | |||
| 33 | void touch_encoder_init(void); | ||
| 34 | void touch_encoder_update(int8_t transaction_id); | ||
| 35 | |||
| 36 | void touch_encoder_calibrate(void); | ||
| 37 | bool touch_encoder_calibrating(void); | ||
| 38 | |||
| 39 | void touch_encoder_toggle(void); | ||
| 40 | bool touch_encoder_toggled(void); | ||
| 41 | |||
| 42 | // Called when touch encoder is tapped, weak function overridable by the kb | ||
| 43 | bool touch_encoder_tapped_kb(uint8_t index, uint8_t section); | ||
| 44 | |||
| 45 | // Called when touch encoder is slid, weak function overridable by the kb | ||
| 46 | bool touch_encoder_update_kb(uint8_t index, bool clockwise); | ||
| 47 | |||
| 48 | // Called when touch encoder is tapped, weak function overridable by the user | ||
| 49 | bool touch_encoder_tapped_user(uint8_t index, uint8_t section); | ||
| 50 | |||
| 51 | // Called when touch encoder is slid, weak function overridable by the user | ||
| 52 | bool touch_encoder_update_user(uint8_t index, bool clockwise); | ||
| 53 | |||
| 54 | void touch_encoder_slave_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer); | ||
diff --git a/keyboards/rgbkb/mun/.noci b/keyboards/rgbkb/mun/.noci new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/rgbkb/mun/.noci | |||
diff --git a/keyboards/rgbkb/mun/config.h b/keyboards/rgbkb/mun/config.h new file mode 100644 index 000000000..802672e14 --- /dev/null +++ b/keyboards/rgbkb/mun/config.h | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #pragma once | ||
| 11 | |||
| 12 | #include "config_common.h" | ||
| 13 | |||
| 14 | /* USB Device descriptor parameter */ | ||
| 15 | #define VENDOR_ID 0x3535 | ||
| 16 | #define PRODUCT_ID 0x3505 | ||
| 17 | #define MANUFACTURER RGBKB | ||
| 18 | #define PRODUCT Mün | ||
| 19 | |||
| 20 | #define USB_POLLING_INTERVAL_MS 1 | ||
| 21 | |||
| 22 | /* Matrix Configuration - Rows are doubled up */ | ||
| 23 | #define MATRIX_ROWS 14 | ||
| 24 | // B1, A2 reserved for encoder / touch encoder support | ||
| 25 | #define MATRIX_ROW_PINS { A1, A3, B3, A13, B15, B1, A2 } | ||
| 26 | #define MATRIX_COLS 7 | ||
| 27 | #define MATRIX_COL_PINS { A0, B11, B0, B10, B12, B2, A8 } | ||
| 28 | #define MATRIX_IO_DELAY 5 | ||
| 29 | |||
| 30 | #define BUSY_WAIT | ||
| 31 | #define BUSY_WAIT_INSTRUCTIONS 35 // Increase if two rows are pressed at the same time. | ||
| 32 | #define GPIO_INPUT_PIN_DELAY 10 | ||
| 33 | |||
| 34 | /* Touchbar adjustments */ | ||
| 35 | #define TOUCH_DEADZONE 50 // width of a "button", wider inputs will be interpreted as a swipe | ||
| 36 | #define TOUCH_TERM 350 // time of a "button" touch, longer inputs will be a swipe | ||
| 37 | #define TOUCH_RESOLUTION 25 // sensitivity of swipes, lower=faster | ||
| 38 | |||
| 39 | /* Encoder Configuration */ | ||
| 40 | #define ENCODERS_PAD_A { B8, B9 } | ||
| 41 | #define ENCODERS_PAD_B { A14, A15 } | ||
| 42 | #define TOUCH_SEGMENTS 3 | ||
| 43 | |||
| 44 | /* COL2ROW or ROW2COL */ | ||
| 45 | #define DIODE_DIRECTION COL2ROW | ||
| 46 | |||
| 47 | /* CRC Configuration */ | ||
| 48 | #define CRC8_OPTIMIZE_SPEED | ||
| 49 | #define CRC8_USE_TABLE | ||
| 50 | |||
| 51 | /* Split Keyboard Configuration */ | ||
| 52 | #define EE_HANDS | ||
| 53 | #define SPLIT_USB_DETECT | ||
| 54 | // also handles the SERIAL_USART_TX_PIN define | ||
| 55 | #define SOFT_SERIAL_PIN A9 | ||
| 56 | #define SERIAL_USART_TX_PAL_MODE 7 | ||
| 57 | #define SERIAL_USART_TIMEOUT 5 | ||
| 58 | #define SERIAL_USART_DRIVER SD1 | ||
| 59 | //#define SERIAL_USART_FULL_DUPLEX - Waiting on reunification pr | ||
| 60 | #if SERIAL_USART_FULL_DUPLEX | ||
| 61 | #define SERIAL_USART_RX_PIN A10 | ||
| 62 | #define SERIAL_USART_RX_PAL_MODE 7 | ||
| 63 | // Mun connects TX to TX and RX to RX as we were planning on i2c split, so we need pin swap for full duplex | ||
| 64 | #define SERIAL_USART_PIN_SWAP | ||
| 65 | #define SERIAL_USART_SPEED (2 * 1024 * 1024) | ||
| 66 | #else | ||
| 67 | #define SERIAL_USART_SPEED (1 * 1024 * 1024) | ||
| 68 | #endif | ||
| 69 | |||
| 70 | /* Split Transport Features */ | ||
| 71 | #define SPLIT_TRANSPORT_MIRROR | ||
| 72 | #define SPLIT_LAYER_STATE_ENABLE | ||
| 73 | #define SPLIT_LED_STATE_ENABLE | ||
| 74 | #define SPLIT_TRANSACTION_IDS_KB TOUCH_ENCODER_SYNC, RGB_MENU_SYNC | ||
| 75 | |||
| 76 | /* RGB LED Configuration */ | ||
| 77 | #define RGB_DI_PIN B5 | ||
| 78 | #define RGBLED_NUM 98 | ||
| 79 | #define RGBLED_SPLIT { 49, 49 } | ||
| 80 | #define RGBLIGHT_ANIMATIONS | ||
| 81 | |||
| 82 | #define DRIVER_LED_TOTAL RGBLED_NUM | ||
| 83 | #define RGB_MATRIX_SPLIT RGBLED_SPLIT | ||
| 84 | #define RGB_MATRIX_CENTER { 128, 34 } | ||
| 85 | #define RGB_MATRIX_LED_FLUSH_LIMIT 33 | ||
| 86 | #define RGB_MATRIX_LED_PROCESS_LIMIT 10 | ||
| 87 | #define RGB_MATRIX_KEYPRESSES | ||
| 88 | #define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||
| 89 | #define RGB_DISABLE_WHEN_USB_SUSPENDED true | ||
| 90 | |||
| 91 | #if RGB_UNLIMITED_POWER | ||
| 92 | #define RGBLIGHT_LIMIT_VAL 255 | ||
| 93 | #else | ||
| 94 | #define RGBLIGHT_LIMIT_VAL 127 | ||
| 95 | #endif | ||
| 96 | #define RGB_MATRIX_MAXIMUM_BRIGHTNESS RGBLIGHT_LIMIT_VAL | ||
| 97 | |||
| 98 | #define WS2812_PWM_DRIVER PWMD3 | ||
| 99 | #define WS2812_PWM_CHANNEL 2 | ||
| 100 | #define WS2812_PWM_PAL_MODE 2 | ||
| 101 | #define WS2812_DMA_STREAM STM32_DMA1_STREAM3 | ||
| 102 | #define WS2812_DMA_CHANNEL 3 | ||
| 103 | |||
| 104 | #define TOUCH_UPDATE_INTERVAL 33 | ||
| 105 | #define OLED_UPDATE_INTERVAL 33 | ||
| 106 | #define TAP_CODE_DELAY 5 | ||
diff --git a/keyboards/rgbkb/mun/halconf.h b/keyboards/rgbkb/mun/halconf.h new file mode 100644 index 000000000..c8d832a81 --- /dev/null +++ b/keyboards/rgbkb/mun/halconf.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #pragma once | ||
| 11 | |||
| 12 | //#define HAL_USE_DAC TRUE | ||
| 13 | |||
| 14 | //#define HAL_USE_GPT TRUE | ||
| 15 | |||
| 16 | #define HAL_USE_I2C TRUE | ||
| 17 | |||
| 18 | #define HAL_USE_PWM TRUE | ||
| 19 | |||
| 20 | #define HAL_USE_SERIAL TRUE | ||
| 21 | |||
| 22 | #define HAL_USE_SERIAL_USB TRUE | ||
| 23 | |||
| 24 | #include_next <halconf.h> | ||
diff --git a/keyboards/rgbkb/mun/keymaps/default/config.h b/keyboards/rgbkb/mun/keymaps/default/config.h new file mode 100644 index 000000000..3d9aff94a --- /dev/null +++ b/keyboards/rgbkb/mun/keymaps/default/config.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #pragma once | ||
| 11 | |||
| 12 | // No need for the single versions when multi performance isn't a problem =D | ||
| 13 | #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE | ||
| 14 | #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS | ||
| 15 | #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS | ||
| 16 | #define DISABLE_RGB_MATRIX_SPLASH | ||
| 17 | #define DISABLE_RGB_MATRIX_SOLID_SPLASH | ||
| 18 | |||
| 19 | // 20m timeout (20m * 60s * 1000mil) | ||
| 20 | // #define RGB_DISABLE_TIMEOUT 1200000 | ||
| 21 | #define RGB_DISABLE_WHEN_USB_SUSPENDED true | ||
| 22 | |||
| 23 | |||
| 24 | #define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 2 | ||
| 25 | // 224B per layer right now | ||
| 26 | #define DYNAMIC_KEYMAP_LAYER_COUNT 8 | ||
| 27 | #define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047 | ||
| 28 | |||
| 29 | #define VIA_QMK_RGBLIGHT_ENABLE | ||
| 30 | |||
| 31 | #define STM32_ONBOARD_EEPROM_SIZE 2048 | ||
| 32 | |||
diff --git a/keyboards/rgbkb/mun/keymaps/default/keymap.c b/keyboards/rgbkb/mun/keymaps/default/keymap.c new file mode 100644 index 000000000..b120c3a37 --- /dev/null +++ b/keyboards/rgbkb/mun/keymaps/default/keymap.c | |||
| @@ -0,0 +1,252 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include QMK_KEYBOARD_H | ||
| 11 | #include "common_oled.h" | ||
| 12 | |||
| 13 | enum keymap_layers { | ||
| 14 | _QWERTY, | ||
| 15 | _COLEMAK, | ||
| 16 | _GAME, | ||
| 17 | _FN, | ||
| 18 | _ADJUST, | ||
| 19 | _VIA1, | ||
| 20 | _VIA2, | ||
| 21 | _VIA3 | ||
| 22 | }; | ||
| 23 | |||
| 24 | enum keymap_keycodes { | ||
| 25 | // Disables touch processing | ||
| 26 | TCH_TOG = SAFE_RANGE, | ||
| 27 | MENU_BTN, | ||
| 28 | MENU_UP, | ||
| 29 | MENU_DN | ||
| 30 | }; | ||
| 31 | |||
| 32 | // Default Layers | ||
| 33 | #define QWERTY DF(_QWERTY) | ||
| 34 | #define COLEMAK DF(_COLEMAK) | ||
| 35 | #define GAME DF(_GAME) | ||
| 36 | |||
| 37 | // Momentary Layers | ||
| 38 | #define FN MO(_FN) | ||
| 39 | #define ADJUST MO(_ADJUST) | ||
| 40 | |||
| 41 | #define FN_CAPS LT(_FN, KC_CAPS) | ||
| 42 | #define FN_ESC LT(_FN, KC_ESC) | ||
| 43 | |||
| 44 | /* This keyboard is enabled with an RGB Menu Control system. | ||
| 45 | This functionality is enabled, but still requires a little configuration based on your exact setup. | ||
| 46 | The RGB Menu will appear on the Right Half's OLED and can be controlled by the MENU keycodes: | ||
| 47 | MENU_BTN - Triggers a button action for the menu | ||
| 48 | MENU_UP - Triggers an increase action for the menu | ||
| 49 | MENU_DN - Triggers a decrease action for the menu | ||
| 50 | |||
| 51 | To finish configuration for your board, you will want to change the default keycodes for an encoder on the right half. | ||
| 52 | Encoder press keycode should be set to MENU_BTN, Clockwise should be MENU_UP, and Counter Clockwise should be MENU_DN. | ||
| 53 | Depending on where you add an encoder to the right half will determin in the default keymap where you should put those keycodes. | ||
| 54 | */ | ||
| 55 | |||
| 56 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 57 | /* QWERTY | ||
| 58 | * .--------------------------------------------------------------. .--------------------------------------------------------------. | ||
| 59 | * | `~/ESC | 1 | 2 | 3 | 4 | 5 | - | | = | 6 | 7 | 8 | 9 | 0 | Bckspc | | ||
| 60 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 61 | * | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ | | ||
| 62 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 63 | * | FN/Caps| A | S | D | F | G | ( | | ) | H | J | K | L | : | ' | | ||
| 64 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 65 | * | Shift | Z | X | C | V | B | { | | } | N | M | , | . | / |Shft/Ent| | ||
| 66 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 67 | * | Ctrl | Win | Alt | RGBTOG | Adjust | Space | Bksp | | Enter | Space | Left | Down | Up | Right | Ctrl | | ||
| 68 | * '--------+--------+--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------+--------+--------' | ||
| 69 | * Encoder 1 Encoder 2 Encoder 3 Encoder 4 | ||
| 70 | * .-----------------------------------. .-----------------------------------. | ||
| 71 | * | VolUp | VolDn | VolUp | VolDn | | PgUp | PgDn | PgUp | PgDn | | ||
| 72 | * |--------+--------+--------+--------+--------. .--------+--------+--------+--------+--------| | ||
| 73 | * | VolDn | VolUp | Next | Play | Prev | Touch Encoder Touch Encoder | RgbHuI | RgbHuD | RgbMdD | RgbTog | RgbMdI | | ||
| 74 | * '--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------' | ||
| 75 | */ | ||
| 76 | [_QWERTY] = LAYOUT( | ||
| 77 | KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_MINS, KC_EQL, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, | ||
| 78 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, | ||
| 79 | FN_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LPRN, KC_RPRN, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
| 80 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LCBR, KC_RCBR, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_SFTENT, | ||
| 81 | KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, ADJUST, KC_SPC, KC_DEL, KC_ENT, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,KC_RCTL, | ||
| 82 | |||
| 83 | KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_PGDN, KC_PGUP, KC_PGDN, KC_PGUP, | ||
| 84 | KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, KC_MPRV, RGB_HUI, RGB_HUD, RGB_RMOD,RGB_TOG, RGB_MOD | ||
| 85 | ), | ||
| 86 | |||
| 87 | [_COLEMAK] = LAYOUT( | ||
| 88 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 89 | _______, KC_Q, KC_W, KC_F, KC_P, KC_G, _______, _______, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, _______, | ||
| 90 | _______, KC_A, KC_R, KC_S, KC_T, KC_D, _______, _______, KC_H, KC_N, KC_E, KC_I, KC_O, _______, | ||
| 91 | _______, KC_Z, KC_X, KC_C, KC_V, KC_B, _______, _______, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, | ||
| 92 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 93 | |||
| 94 | _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 95 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 96 | ), | ||
| 97 | |||
| 98 | [_GAME] = LAYOUT( | ||
| 99 | _______, _______, _______, _______, _______, _______, KC_F1, KC_F5, _______, _______, _______, _______, _______, _______, | ||
| 100 | _______, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_F2, KC_F6, KC_Y, KC_U, KC_I, KC_O, KC_P, _______, | ||
| 101 | _______, KC_A, KC_S, KC_D, KC_F, KC_G, KC_F3, KC_F7, KC_H, KC_J, KC_K, KC_L, KC_SCLN, _______, | ||
| 102 | _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_F4, KC_F8, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, | ||
| 103 | _______, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 104 | |||
| 105 | _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 106 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 107 | ), | ||
| 108 | |||
| 109 | [_FN] = LAYOUT( | ||
| 110 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, | ||
| 111 | _______, KC_HOME, KC_UP, KC_END, _______, _______, _______, _______, _______, KC_HOME, KC_UP, KC_END, KC_PSCR, KC_PGUP, | ||
| 112 | _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_INS, KC_PGDN, | ||
| 113 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 114 | _______, _______, _______, TCH_TOG, _______, _______, _______, _______, _______, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, | ||
| 115 | |||
| 116 | _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 117 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 118 | ), | ||
| 119 | |||
| 120 | [_ADJUST] = LAYOUT( | ||
| 121 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, | ||
| 122 | _______, RGB_SAD, RGB_VAI, RGB_SAI, RESET, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, _______, _______, | ||
| 123 | _______, RGB_HUD, RGB_VAD, RGB_HUI, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, | ||
| 124 | _______, RGB_SPD, _______, RGB_SPI, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, _______, GAME, | ||
| 125 | _______, RGB_RMOD,_______, RGB_MOD, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_NLCK, QWERTY, COLEMAK, | ||
| 126 | |||
| 127 | _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 128 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 129 | ), | ||
| 130 | |||
| 131 | [_VIA1] = LAYOUT( | ||
| 132 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 133 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 134 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 135 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 136 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 137 | |||
| 138 | _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 139 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 140 | ), | ||
| 141 | |||
| 142 | [_VIA2] = LAYOUT( | ||
| 143 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 144 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 145 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 146 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 147 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 148 | |||
| 149 | _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 150 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 151 | ), | ||
| 152 | |||
| 153 | [_VIA3] = LAYOUT( | ||
| 154 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 155 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 156 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 157 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 158 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 159 | |||
| 160 | _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 161 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 162 | ), | ||
| 163 | }; | ||
| 164 | |||
| 165 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 166 | switch (keycode) | ||
| 167 | { | ||
| 168 | case MENU_BTN: | ||
| 169 | if (record->event.pressed) { | ||
| 170 | rgb_menu_selection(); | ||
| 171 | } | ||
| 172 | return false; | ||
| 173 | case MENU_UP: | ||
| 174 | if (record->event.pressed) { | ||
| 175 | rgb_menu_action(true); | ||
| 176 | } | ||
| 177 | return false; | ||
| 178 | case MENU_DN: | ||
| 179 | if (record->event.pressed) { | ||
| 180 | rgb_menu_action(false); | ||
| 181 | } | ||
| 182 | return false; | ||
| 183 | case TCH_TOG: | ||
| 184 | if (record->event.pressed) { | ||
| 185 | touch_encoder_toggle(); | ||
| 186 | } | ||
| 187 | return false; // Skip all further processing of this key | ||
| 188 | default: | ||
| 189 | return true; | ||
| 190 | } | ||
| 191 | } | ||
| 192 | |||
| 193 | static void render_layer(void) { | ||
| 194 | // Host Keyboard Layer Status | ||
| 195 | oled_write_P(PSTR("Layer"), false); | ||
| 196 | switch (get_highest_layer(layer_state)) { | ||
| 197 | case _QWERTY: | ||
| 198 | oled_write_ln_P(PSTR("QWRTY"), false); | ||
| 199 | break; | ||
| 200 | case _COLEMAK: | ||
| 201 | oled_write_ln_P(PSTR("Colemk"), false); | ||
| 202 | break; | ||
| 203 | case _GAME: | ||
| 204 | oled_write_ln_P(PSTR("Game "), false); | ||
| 205 | break; | ||
| 206 | case _FN: | ||
| 207 | oled_write_ln_P(PSTR("FN "), false); | ||
| 208 | break; | ||
| 209 | case _ADJUST: | ||
| 210 | oled_write_ln_P(PSTR("Adjst"), false); | ||
| 211 | break; | ||
| 212 | default: | ||
| 213 | oled_write_ln_P(PSTR("Undef"), false); | ||
| 214 | } | ||
| 215 | } | ||
| 216 | |||
| 217 | static void render_leds(void) | ||
| 218 | { | ||
| 219 | // Host Keyboard LED Status | ||
| 220 | led_t led_state = host_keyboard_led_state(); | ||
| 221 | oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false); | ||
| 222 | oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false); | ||
| 223 | oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false); | ||
| 224 | } | ||
| 225 | |||
| 226 | static void render_touch(void) | ||
| 227 | { | ||
| 228 | // Host Touch LED Status | ||
| 229 | oled_write_P(!touch_encoder_toggled() ? PSTR("TOUCH") : PSTR(" "), false); | ||
| 230 | oled_write_P(touch_encoder_calibrating() ? PSTR("CLBRT") : PSTR(" "), false); | ||
| 231 | } | ||
| 232 | |||
| 233 | void oled_task_user(void) { | ||
| 234 | if (is_keyboard_left()) { | ||
| 235 | render_icon(); | ||
| 236 | oled_write_P(PSTR(" "), false); | ||
| 237 | render_layer(); | ||
| 238 | oled_write_P(PSTR(" "), false); | ||
| 239 | render_leds(); | ||
| 240 | oled_write_P(PSTR(" "), false); | ||
| 241 | render_touch(); | ||
| 242 | } | ||
| 243 | else { | ||
| 244 | render_icon(); | ||
| 245 | oled_write_P(PSTR(" "), false); | ||
| 246 | render_rgb_menu(); | ||
| 247 | } | ||
| 248 | } | ||
| 249 | |||
| 250 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 251 | return OLED_ROTATION_270; | ||
| 252 | } | ||
diff --git a/keyboards/rgbkb/mun/keymaps/default/rules.mk b/keyboards/rgbkb/mun/keymaps/default/rules.mk new file mode 100644 index 000000000..1e5b99807 --- /dev/null +++ b/keyboards/rgbkb/mun/keymaps/default/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| VIA_ENABLE = yes | |||
diff --git a/keyboards/rgbkb/mun/keymaps/xulkal2/config.h b/keyboards/rgbkb/mun/keymaps/xulkal2/config.h new file mode 100644 index 000000000..f78d0103c --- /dev/null +++ b/keyboards/rgbkb/mun/keymaps/xulkal2/config.h | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #pragma once | ||
| 11 | |||
| 12 | // Xulkal custom stuff | ||
| 13 | #undef TAPPING_FORCE_HOLD | ||
| 14 | |||
| 15 | #undef TAPPING_TERM | ||
| 16 | #define TAPPING_TERM 175 | ||
| 17 | |||
| 18 | #define SPACE_CADET_MODIFIER_CARRYOVER | ||
| 19 | #define LSPO_KEYS KC_LSFT, KC_TRNS, KC_LBRC | ||
| 20 | #define RSPC_KEYS KC_RSFT, KC_TRNS, KC_RBRC | ||
| 21 | #define LCPO_KEYS KC_LCTL, KC_TRNS, KC_MINS | ||
| 22 | #define RCPC_KEYS KC_RCTL, KC_TRNS, KC_EQL | ||
| 23 | |||
| 24 | // No need for the single versions when multi performance isn't a problem =D | ||
| 25 | #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE | ||
| 26 | #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS | ||
| 27 | #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS | ||
| 28 | #define DISABLE_RGB_MATRIX_SPLASH | ||
| 29 | #define DISABLE_RGB_MATRIX_SOLID_SPLASH | ||
| 30 | |||
| 31 | // 20m timeout (20m * 60s * 1000mil) | ||
| 32 | // #define RGB_DISABLE_TIMEOUT 1200000 | ||
| 33 | #define RGB_DISABLE_WHEN_USB_SUSPENDED true | ||
| 34 | #define OLED_SCROLL_TIMEOUT 20000 | ||
| 35 | #define ONESHOT_TAP_TOGGLE 2 | ||
| 36 | |||
| 37 | #define RGB_MATRIX_HUE_STEP 8 | ||
| 38 | #define RGB_MATRIX_SAT_STEP 8 | ||
| 39 | #define RGB_MATRIX_VAL_STEP 8 | ||
| 40 | #define RGB_MATRIX_SPD_STEP 8 | ||
| 41 | |||
| 42 | #define ENCODER_RESOLUTION 2 \ No newline at end of file | ||
diff --git a/keyboards/rgbkb/mun/keymaps/xulkal2/keymap.c b/keyboards/rgbkb/mun/keymaps/xulkal2/keymap.c new file mode 100644 index 000000000..2de5888f1 --- /dev/null +++ b/keyboards/rgbkb/mun/keymaps/xulkal2/keymap.c | |||
| @@ -0,0 +1,246 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include QMK_KEYBOARD_H | ||
| 11 | #include "common_oled.h" | ||
| 12 | |||
| 13 | enum keymap_layers { | ||
| 14 | _QWERTY, | ||
| 15 | _FUNCTION, | ||
| 16 | _ADJUST | ||
| 17 | }; | ||
| 18 | |||
| 19 | enum keymap_keycodes { | ||
| 20 | // Disables touch processing | ||
| 21 | TCH_TOG = SAFE_RANGE, | ||
| 22 | MENU_BTN, | ||
| 23 | MENU_UP, | ||
| 24 | MENU_DN, | ||
| 25 | RGB_RST | ||
| 26 | }; | ||
| 27 | |||
| 28 | // Default Layers | ||
| 29 | #define QWERTY DF(_QWERTY) | ||
| 30 | |||
| 31 | // Momentary Layers | ||
| 32 | #define FN OSL(_FUNCTION) | ||
| 33 | #define ADJ OSL(_ADJUST) | ||
| 34 | |||
| 35 | // clang-format off | ||
| 36 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 37 | /* QWERTY | ||
| 38 | * .--------------------------------------------------------------. .--------------------------------------------------------------. | ||
| 39 | * | `~/ESC | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | Bckspc | | ||
| 40 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 41 | * | Tab | Q | W | E | R | T | | | | Y | U | I | O | P | \ | | ||
| 42 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 43 | * | Caps | A | S | D | F | G | Play | | MN BTN | H | J | K | L | : | Enter | | ||
| 44 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 45 | * | Shft[ | Z | X | C | V | B | { | | } | N | M | , | . | / | Shft] | | ||
| 46 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 47 | * | Ctrl- | Win | Alt | Del | Space | | ADJ | | FN | | Space | '" | Alt | App | Ctrl= | | ||
| 48 | * '--------+--------+--------+--------|--------+--------+--------' '--------+--------+--------+--------+--------+--------+--------' | ||
| 49 | * Encoder 1 Encoder 2 Encoder 3 Encoder 4 | ||
| 50 | * .-----------------------------------. .-----------------------------------. | ||
| 51 | * | VolUp | VolDn | VolUp | VolDn | | PgUp | PgDn | PgUp | PgDn | | ||
| 52 | * |--------+--------+--------+--------+--------. .--------+--------+--------+--------+--------| | ||
| 53 | * | VolDn | VolUp | Next | Play | Prev | Touch Encoder Touch Encoder | RgbHuI | RgbHuD | RgbMdD | RgbTog | RgbMdI | | ||
| 54 | * '--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------' | ||
| 55 | */ | ||
| 56 | [_QWERTY] = LAYOUT( | ||
| 57 | KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO, KC_NO, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, | ||
| 58 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_NO, KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, | ||
| 59 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_MPLY, MENU_BTN,KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, | ||
| 60 | KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LCBR, KC_RCBR, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, | ||
| 61 | KC_LCPO, KC_LGUI, KC_LALT, KC_DEL, KC_SPC, KC_NO, ADJ, FN, KC_NO, KC_SPC, KC_QUOTE,KC_RALT, KC_APP, KC_RCPC, | ||
| 62 | |||
| 63 | KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, MENU_DN, MENU_UP, MENU_DN, MENU_UP, | ||
| 64 | KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, KC_MPRV, RGB_HUI, RGB_HUD, RGB_RMOD,RGB_TOG, RGB_MOD | ||
| 65 | ), | ||
| 66 | |||
| 67 | /* Function | ||
| 68 | * .--------------------------------------------------------------. .--------------------------------------------------------------. | ||
| 69 | * | F12 | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | | ||
| 70 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 71 | * | | SPDI | SAI | VAI | HUI | RGBMD | | | | | | PrtScr | ScrLck | PseBrk | | | ||
| 72 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 73 | * | | SPDD | SAD | VAD | HUD | RGBRMD | | | | | | Ins | Home | PgUp | | | ||
| 74 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 75 | * | | RGBRST | | | | RGBTOG | | | | | | Del | End | PgDn | | | ||
| 76 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 77 | * | | | | | | | | | | | Play | Prev | Next | VolUp | VolDn | | ||
| 78 | * '--------+--------+--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------+--------+--------' | ||
| 79 | * Encoder 1 Encoder 2 Encoder 3 Encoder 4 | ||
| 80 | * .-----------------------------------. .-----------------------------------. | ||
| 81 | * | | | | | | | | | | | ||
| 82 | * |--------+--------+--------+--------+--------. .--------+--------+--------+--------+--------| | ||
| 83 | * | | | | | | Touch Encoder Touch Encoder | | | | | | | ||
| 84 | * '--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------' | ||
| 85 | */ | ||
| 86 | [_FUNCTION] = LAYOUT( | ||
| 87 | KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, | ||
| 88 | _______, RGB_SPI, RGB_SAI, RGB_VAI, RGB_HUI, RGB_MOD, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______, | ||
| 89 | _______, RGB_SPD, RGB_SAD, RGB_VAD, RGB_HUD, RGB_RMOD,_______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, _______, | ||
| 90 | _______, RGB_RST, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, _______, | ||
| 91 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MPRV, KC_MNXT, KC_VOLU, KC_VOLD, | ||
| 92 | |||
| 93 | _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 94 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 95 | ), | ||
| 96 | |||
| 97 | /* Adjust | ||
| 98 | * .--------------------------------------------------------------. .--------------------------------------------------------------. | ||
| 99 | * | | | | | | | | | | | NumLck | / | * | - | Del | | ||
| 100 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 101 | * | | Home | Up | End | Reset | T_TOG | | | | | 7 | 8 | 9 | + | | | ||
| 102 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 103 | * | | Left | Down | Right | | | | | | | 4 | 5 | 6 | + | | | ||
| 104 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 105 | * | | | | | | EepRst | | | | | 1 | 2 | 3 | Enter | | | ||
| 106 | * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| | ||
| 107 | * | | | | | | | | | | | | 0 | . | Enter | | | ||
| 108 | * '--------+--------+--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------+--------+--------' | ||
| 109 | * Encoder 1 Encoder 2 Encoder 3 Encoder 4 | ||
| 110 | * .-----------------------------------. .-----------------------------------. | ||
| 111 | * | | | | | | | | | | | ||
| 112 | * |--------+--------+--------+--------+--------. .--------+--------+--------+--------+--------| | ||
| 113 | * | | | | | | Touch Encoder Touch Encoder | | | | | | | ||
| 114 | * '--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------' | ||
| 115 | */ | ||
| 116 | [_ADJUST] = LAYOUT( | ||
| 117 | KC_GRV, _______, _______, _______, _______, _______, _______, _______, _______, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_DEL, | ||
| 118 | _______, KC_HOME, KC_UP, KC_END, RESET, TCH_TOG, _______, _______, _______, KC_KP_7, KC_KP_8, KC_KP_9, KC_PPLS, _______, | ||
| 119 | _______, KC_LEFT, KC_DOWN, KC_RIGHT,_______, _______, _______, _______, _______, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, _______, | ||
| 120 | _______, _______, _______, _______, _______, EEP_RST, _______, _______, _______, KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT, _______, | ||
| 121 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_KP_0, KC_PDOT, KC_PENT, _______, | ||
| 122 | |||
| 123 | _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 124 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 125 | ) | ||
| 126 | }; | ||
| 127 | // clang-format on | ||
| 128 | |||
| 129 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 130 | switch (keycode) | ||
| 131 | { | ||
| 132 | case MENU_BTN: | ||
| 133 | if (record->event.pressed) { | ||
| 134 | rgb_menu_selection(); | ||
| 135 | } | ||
| 136 | return false; | ||
| 137 | case MENU_UP: | ||
| 138 | if (record->event.pressed) { | ||
| 139 | rgb_menu_action(true); | ||
| 140 | } | ||
| 141 | return false; | ||
| 142 | case MENU_DN: | ||
| 143 | if (record->event.pressed) { | ||
| 144 | rgb_menu_action(false); | ||
| 145 | } | ||
| 146 | return false; | ||
| 147 | case RGB_RST: | ||
| 148 | if (record->event.pressed) { | ||
| 149 | eeconfig_update_rgb_matrix_default(); | ||
| 150 | } | ||
| 151 | return false; | ||
| 152 | case TCH_TOG: | ||
| 153 | if (record->event.pressed) { | ||
| 154 | touch_encoder_toggle(); | ||
| 155 | } | ||
| 156 | return false; // Skip all further processing of this key | ||
| 157 | default: | ||
| 158 | return true; | ||
| 159 | } | ||
| 160 | } | ||
| 161 | |||
| 162 | static void render_layer(void) { | ||
| 163 | // Host Keyboard Layer Status | ||
| 164 | oled_write_P(PSTR("Layer"), false); | ||
| 165 | switch (get_highest_layer(layer_state)) { | ||
| 166 | case _QWERTY: | ||
| 167 | oled_write_ln_P(PSTR("BASE "), false); | ||
| 168 | break; | ||
| 169 | case _FUNCTION: | ||
| 170 | oled_write_ln_P(PSTR("FUNC "), false); | ||
| 171 | break; | ||
| 172 | case _ADJUST: | ||
| 173 | oled_write_ln_P(PSTR("ADJS "), false); | ||
| 174 | break; | ||
| 175 | } | ||
| 176 | } | ||
| 177 | |||
| 178 | static void render_leds(void) | ||
| 179 | { | ||
| 180 | // Host Keyboard LED Status | ||
| 181 | led_t led_state = host_keyboard_led_state(); | ||
| 182 | oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false); | ||
| 183 | oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false); | ||
| 184 | oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false); | ||
| 185 | } | ||
| 186 | |||
| 187 | static void render_touch(void) | ||
| 188 | { | ||
| 189 | // Host Touch LED Status | ||
| 190 | oled_write_P(!touch_encoder_toggled() ? PSTR("TOUCH") : PSTR(" "), false); | ||
| 191 | oled_write_P(touch_encoder_calibrating() ? PSTR("CLBRT") : PSTR(" "), false); | ||
| 192 | } | ||
| 193 | |||
| 194 | /*static uint32_t scan_counter = 0; | ||
| 195 | static uint32_t scan_value = 0; | ||
| 196 | static uint16_t scan_timer = 1000; | ||
| 197 | |||
| 198 | void do_counters(void) { | ||
| 199 | scan_counter++; | ||
| 200 | uint16_t now = sync_timer_read(); | ||
| 201 | if (timer_expired(now, scan_timer)) | ||
| 202 | { | ||
| 203 | scan_timer += 1000; | ||
| 204 | scan_value = (scan_value + scan_counter) / 2; | ||
| 205 | scan_counter = 0; | ||
| 206 | } | ||
| 207 | } | ||
| 208 | |||
| 209 | void matrix_scan_user(void) { | ||
| 210 | do_counters(); | ||
| 211 | } | ||
| 212 | |||
| 213 | void matrix_slave_scan_user(void) { | ||
| 214 | do_counters(); | ||
| 215 | } | ||
| 216 | |||
| 217 | void render_debug_scan(void) { | ||
| 218 | static char buffer[6] = {0}; | ||
| 219 | snprintf(buffer, sizeof(buffer), "%5d", scan_value); | ||
| 220 | oled_write_ln_P(buffer, false); | ||
| 221 | }*/ | ||
| 222 | |||
| 223 | void oled_task_user(void) { | ||
| 224 | if (is_keyboard_left()) { | ||
| 225 | render_layer(); | ||
| 226 | oled_write_P(PSTR(" "), false); | ||
| 227 | render_leds(); | ||
| 228 | oled_write_P(PSTR(" "), false); | ||
| 229 | render_touch(); | ||
| 230 | //oled_write_P(PSTR(" "), false); | ||
| 231 | //render_debug_scan(); | ||
| 232 | oled_set_cursor(0, 12); | ||
| 233 | render_icon(); | ||
| 234 | } | ||
| 235 | else { | ||
| 236 | render_rgb_menu(); | ||
| 237 | //oled_write_P(PSTR(" "), false); | ||
| 238 | //render_debug_scan(); | ||
| 239 | oled_set_cursor(0, 12); | ||
| 240 | render_icon(); | ||
| 241 | } | ||
| 242 | } | ||
| 243 | |||
| 244 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 245 | return OLED_ROTATION_270; | ||
| 246 | } \ No newline at end of file | ||
diff --git a/keyboards/rgbkb/mun/keymaps/xulkal2/rules.mk b/keyboards/rgbkb/mun/keymaps/xulkal2/rules.mk new file mode 100644 index 000000000..b62630516 --- /dev/null +++ b/keyboards/rgbkb/mun/keymaps/xulkal2/rules.mk | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | MOUSEKEY_ENABLE = yes # using for mouse wheel up and down, more granular than page up/down | ||
| 2 | |||
| 3 | OPT_DEFS += -DRGB_UNLIMITED_POWER | ||
| 4 | DEBOUNCE_TYPE = sym_eager_pk \ No newline at end of file | ||
diff --git a/keyboards/rgbkb/mun/matrix.c b/keyboards/rgbkb/mun/matrix.c new file mode 100644 index 000000000..a0cb7df51 --- /dev/null +++ b/keyboards/rgbkb/mun/matrix.c | |||
| @@ -0,0 +1,156 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/KarlK90> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. KarlK90 | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <stdint.h> | ||
| 11 | #include <stdbool.h> | ||
| 12 | #include <string.h> | ||
| 13 | #include "util.h" | ||
| 14 | #include "matrix.h" | ||
| 15 | #include "debounce.h" | ||
| 16 | #include "quantum.h" | ||
| 17 | #include "split_util.h" | ||
| 18 | #include "config.h" | ||
| 19 | #include "transactions.h" | ||
| 20 | |||
| 21 | #define ERROR_DISCONNECT_COUNT 5 | ||
| 22 | #define ROWS_PER_HAND (MATRIX_ROWS / 2) | ||
| 23 | |||
| 24 | static const pin_t row_pins[ROWS_PER_HAND] = MATRIX_ROW_PINS; | ||
| 25 | static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | ||
| 26 | |||
| 27 | /* matrix state(1:on, 0:off) */ | ||
| 28 | extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values | ||
| 29 | extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values | ||
| 30 | |||
| 31 | // row offsets for each hand | ||
| 32 | uint8_t thisHand, thatHand; | ||
| 33 | |||
| 34 | // user-defined overridable functions | ||
| 35 | __attribute__((weak)) void matrix_slave_scan_kb(void) { matrix_slave_scan_user(); } | ||
| 36 | __attribute__((weak)) void matrix_slave_scan_user(void) {} | ||
| 37 | |||
| 38 | static void init_pins(void) { | ||
| 39 | for (size_t i = 0; i < MATRIX_COLS; i++) { | ||
| 40 | setPinInputHigh(col_pins[i]); | ||
| 41 | } | ||
| 42 | for (size_t i = 0; i < ROWS_PER_HAND; i++) { | ||
| 43 | setPinOutput(row_pins[i]); | ||
| 44 | writePinHigh(row_pins[i]); | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | void matrix_init(void) { | ||
| 49 | split_pre_init(); | ||
| 50 | |||
| 51 | thisHand = isLeftHand ? 0 : (ROWS_PER_HAND); | ||
| 52 | thatHand = ROWS_PER_HAND - thisHand; | ||
| 53 | |||
| 54 | // initialize key pins | ||
| 55 | init_pins(); | ||
| 56 | |||
| 57 | // initialize matrix state: all keys off | ||
| 58 | memset(raw_matrix, 0, sizeof(raw_matrix)); | ||
| 59 | memset(matrix, 0, sizeof(matrix)); | ||
| 60 | |||
| 61 | debounce_init(ROWS_PER_HAND); | ||
| 62 | |||
| 63 | matrix_init_quantum(); | ||
| 64 | |||
| 65 | split_post_init(); | ||
| 66 | } | ||
| 67 | |||
| 68 | bool matrix_post_scan(void) { | ||
| 69 | bool changed = false; | ||
| 70 | if (is_keyboard_master()) { | ||
| 71 | static uint8_t error_count; | ||
| 72 | |||
| 73 | matrix_row_t slave_matrix[ROWS_PER_HAND] = {0}; | ||
| 74 | if (!transport_master(matrix + thisHand, slave_matrix)) { | ||
| 75 | error_count++; | ||
| 76 | |||
| 77 | if (error_count > ERROR_DISCONNECT_COUNT) { | ||
| 78 | // reset other half if disconnected | ||
| 79 | memset(&matrix[thatHand], 0, sizeof(slave_matrix)); | ||
| 80 | memset(slave_matrix, 0, sizeof(slave_matrix)); | ||
| 81 | |||
| 82 | changed = true; | ||
| 83 | } | ||
| 84 | } else { | ||
| 85 | error_count = 0; | ||
| 86 | |||
| 87 | if (memcmp(&matrix[thatHand], slave_matrix, sizeof(slave_matrix)) != 0) { | ||
| 88 | memcpy(&matrix[thatHand], slave_matrix, sizeof(slave_matrix)); | ||
| 89 | changed = true; | ||
| 90 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | matrix_scan_quantum(); | ||
| 94 | } else { | ||
| 95 | transport_slave(matrix + thatHand, matrix + thisHand); | ||
| 96 | |||
| 97 | matrix_slave_scan_kb(); | ||
| 98 | } | ||
| 99 | |||
| 100 | return changed; | ||
| 101 | } | ||
| 102 | |||
| 103 | uint8_t matrix_scan(void) { | ||
| 104 | bool local_changed = false; | ||
| 105 | matrix_row_t current_matrix[ROWS_PER_HAND]; | ||
| 106 | |||
| 107 | for (size_t row_idx = 0; row_idx < ROWS_PER_HAND; row_idx++) { | ||
| 108 | /* Drive row pin low. */ | ||
| 109 | ATOMIC_BLOCK_FORCEON { writePinLow(row_pins[row_idx]); } | ||
| 110 | matrix_output_select_delay(); | ||
| 111 | |||
| 112 | /* Read all columns in one go, aka port scanning. */ | ||
| 113 | uint16_t porta = palReadPort(GPIOA); | ||
| 114 | uint16_t portb = palReadPort(GPIOB); | ||
| 115 | |||
| 116 | /* Order of pins on the mun is: A0, B11, B0, B10, B12, B2, A8 | ||
| 117 | Pin is active low, therefore we have to invert the result. */ | ||
| 118 | matrix_row_t cols = ~(((porta & (0x1 << 0)) >> 0) // A0 (0) | ||
| 119 | | ((portb & (0x1 << 11)) >> 10) // B11 (1) | ||
| 120 | | ((portb & (0x1 << 0)) << 2) // B0 (2) | ||
| 121 | | ((portb & (0x1 << 10)) >> 7) // B10 (3) | ||
| 122 | | ((portb & (0x1 << 12)) >> 8) // B12 (4) | ||
| 123 | | ((portb & (0x1 << 2)) << 3) // B2 (5) | ||
| 124 | | ((porta & (0x1 << 8)) >> 2)); // A8 (6) | ||
| 125 | |||
| 126 | /* Reverse the order of columns for left hand as the board is flipped. */ | ||
| 127 | // if (isLeftHand) { | ||
| 128 | // #if defined(__arm__) | ||
| 129 | // /* rbit assembly reverses bit order of 32bit registers. */ | ||
| 130 | // uint32_t temp = cols; | ||
| 131 | // __asm__("rbit %0, %1" : "=r"(temp) : "r"(temp)); | ||
| 132 | // cols = temp >> 24; | ||
| 133 | // #else | ||
| 134 | // /* RISC-V bit manipulation extension not present. Use bit-hack. | ||
| 135 | // https://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits */ | ||
| 136 | // cols = (matrix_row_t)(((cols * 0x0802LU & 0x22110LU) | (cols * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16); | ||
| 137 | // #endif | ||
| 138 | // } | ||
| 139 | |||
| 140 | current_matrix[row_idx] = cols; | ||
| 141 | |||
| 142 | /* Drive row pin high again. */ | ||
| 143 | ATOMIC_BLOCK_FORCEON { writePinHigh(row_pins[row_idx]); } | ||
| 144 | matrix_output_unselect_delay(); | ||
| 145 | } | ||
| 146 | |||
| 147 | if (memcmp(raw_matrix, current_matrix, sizeof(current_matrix)) != 0) { | ||
| 148 | memcpy(raw_matrix, current_matrix, sizeof(current_matrix)); | ||
| 149 | local_changed = true; | ||
| 150 | } | ||
| 151 | |||
| 152 | debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, local_changed); | ||
| 153 | |||
| 154 | bool remote_changed = matrix_post_scan(); | ||
| 155 | return (uint8_t)(local_changed || remote_changed); | ||
| 156 | } \ No newline at end of file | ||
diff --git a/keyboards/rgbkb/mun/mcuconf.h b/keyboards/rgbkb/mun/mcuconf.h new file mode 100644 index 000000000..acc083d8a --- /dev/null +++ b/keyboards/rgbkb/mun/mcuconf.h | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #pragma once | ||
| 11 | |||
| 12 | #include_next <mcuconf.h> | ||
| 13 | |||
| 14 | #undef STM32_DAC_USE_DAC1_CH1 | ||
| 15 | #define STM32_DAC_USE_DAC1_CH1 TRUE | ||
| 16 | |||
| 17 | #undef STM32_DAC_USE_DAC1_CH2 | ||
| 18 | #define STM32_DAC_USE_DAC1_CH2 TRUE | ||
| 19 | |||
| 20 | #undef STM32_GPT_USE_TIM6 | ||
| 21 | #define STM32_GPT_USE_TIM6 TRUE | ||
| 22 | |||
| 23 | #undef STM32_GPT_USE_TIM7 | ||
| 24 | #define STM32_GPT_USE_TIM7 TRUE | ||
| 25 | |||
| 26 | #undef STM32_GPT_USE_TIM8 | ||
| 27 | #define STM32_GPT_USE_TIM8 TRUE | ||
| 28 | |||
| 29 | #undef STM32_GPT_USE_TIM15 | ||
| 30 | #define STM32_GPT_USE_TIM15 TRUE | ||
| 31 | |||
| 32 | #undef STM32_I2C_USE_I2C1 | ||
| 33 | #define STM32_I2C_USE_I2C1 TRUE | ||
| 34 | |||
| 35 | #undef STM32_PWM_USE_TIM3 | ||
| 36 | #define STM32_PWM_USE_TIM3 TRUE | ||
| 37 | |||
| 38 | #undef STM32_PWM_USE_TIM4 | ||
| 39 | #define STM32_PWM_USE_TIM4 TRUE | ||
| 40 | |||
| 41 | #undef STM32_SERIAL_USE_USART1 | ||
| 42 | #define STM32_SERIAL_USE_USART1 TRUE \ No newline at end of file | ||
diff --git a/keyboards/rgbkb/mun/mun.c b/keyboards/rgbkb/mun/mun.c new file mode 100644 index 000000000..5dabecc13 --- /dev/null +++ b/keyboards/rgbkb/mun/mun.c | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include "mun.h" | ||
| 11 | #include "touch_encoder.h" | ||
| 12 | #include "common_oled.h" | ||
| 13 | #include <transactions.h> | ||
| 14 | |||
| 15 | void keyboard_post_init_kb(void) | ||
| 16 | { | ||
| 17 | touch_encoder_init(); | ||
| 18 | transaction_register_rpc(TOUCH_ENCODER_SYNC, touch_encoder_slave_sync); | ||
| 19 | transaction_register_rpc(RGB_MENU_SYNC, rgb_menu_slave_sync); | ||
| 20 | keyboard_post_init_user(); | ||
| 21 | } | ||
| 22 | |||
| 23 | void housekeeping_task_kb(void) | ||
| 24 | { | ||
| 25 | touch_encoder_update(TOUCH_ENCODER_SYNC); | ||
| 26 | rgb_menu_update(RGB_MENU_SYNC); | ||
| 27 | } | ||
| 28 | |||
| 29 | #if defined(BUSY_WAIT) | ||
| 30 | void matrix_output_unselect_delay(void) { | ||
| 31 | for (int32_t i = 0; i < BUSY_WAIT_INSTRUCTIONS; i++) { | ||
| 32 | __asm__ volatile("nop" ::: "memory"); | ||
| 33 | } | ||
| 34 | } | ||
| 35 | #endif \ No newline at end of file | ||
diff --git a/keyboards/rgbkb/mun/mun.h b/keyboards/rgbkb/mun/mun.h new file mode 100644 index 000000000..beb132f0e --- /dev/null +++ b/keyboards/rgbkb/mun/mun.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #pragma once | ||
| 11 | |||
| 12 | #if defined(KEYBOARD_rgbkb_mun_rev1) | ||
| 13 | # include "rev1.h" | ||
| 14 | #endif | ||
| 15 | |||
| 16 | #include "quantum.h" \ No newline at end of file | ||
diff --git a/keyboards/rgbkb/mun/readme.md b/keyboards/rgbkb/mun/readme.md new file mode 100644 index 000000000..6a1861153 --- /dev/null +++ b/keyboards/rgbkb/mun/readme.md | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # Mün | ||
| 2 | |||
| 3 |  | ||
| 4 | |||
| 5 | Mün is powered by STM32 with full QMK support. Each key has super-bright RGB backlighting and MX Kailh hotswap sockets. No soldering is required to get a fully functioning keyboard. There are an additional 14 rear-facing RGB LEDs on each side. Each half can be configured to run as master or slave with the two USB-C ports. They also support up to two rotary encoders and one OLED panel per half. | ||
| 6 | |||
| 7 | Keyboard Maintainer: [Legonut](https://github.com/Legonut) | ||
| 8 | Hardware Supported: Mün PCB R1.0, R1.1, R1.2 | ||
| 9 | Hardware Availability: [RGBKB](https://www.rgbkb.net) | ||
| 10 | |||
| 11 | Make example for this keyboard (after setting up your build environment): | ||
| 12 | |||
| 13 | make rgbkb/mun:default | ||
| 14 | |||
| 15 | See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | ||
diff --git a/keyboards/rgbkb/mun/rev1/config.h b/keyboards/rgbkb/mun/rev1/config.h new file mode 100644 index 000000000..7ff0b5490 --- /dev/null +++ b/keyboards/rgbkb/mun/rev1/config.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #pragma once | ||
| 11 | |||
| 12 | #define DEVICE_VER 0x0001 | ||
diff --git a/keyboards/rgbkb/mun/rev1/info.json b/keyboards/rgbkb/mun/rev1/info.json new file mode 100644 index 000000000..c644b9bdc --- /dev/null +++ b/keyboards/rgbkb/mun/rev1/info.json | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | { | ||
| 2 | "keyboard_name": "Mun", | ||
| 3 | "url": "https://www.rgbkb.net/products/mun", | ||
| 4 | "maintainer": "Legonut", | ||
| 5 | "width": 13.5, | ||
| 6 | "height": 6.5, | ||
| 7 | "layouts": { | ||
| 8 | "LAYOUT": { | ||
| 9 | "layout": [ | ||
| 10 | {"label":"L00", "x":0, "y":0}, | ||
| 11 | {"label":"L01", "x":1, "y":0}, | ||
| 12 | {"label":"L02", "x":2, "y":0}, | ||
| 13 | {"label":"L03", "x":3, "y":0}, | ||
| 14 | {"label":"L04", "x":4, "y":0}, | ||
| 15 | {"label":"L05", "x":5, "y":0}, | ||
| 16 | {"label":"L06", "x":6, "y":0}, | ||
| 17 | {"label":"R00", "x":7.5, "y":0}, | ||
| 18 | {"label":"R01", "x":8.5, "y":0}, | ||
| 19 | {"label":"R02", "x":9.5, "y":0}, | ||
| 20 | {"label":"R03", "x":10.5, "y":0}, | ||
| 21 | {"label":"R04", "x":11.5, "y":0}, | ||
| 22 | {"label":"R05", "x":12.5, "y":0}, | ||
| 23 | {"label":"R06", "x":13.5, "y":0}, | ||
| 24 | {"label":"L10", "x":0, "y":1}, | ||
| 25 | {"label":"L11", "x":1, "y":1}, | ||
| 26 | {"label":"L12", "x":2, "y":1}, | ||
| 27 | {"label":"L13", "x":3, "y":1}, | ||
| 28 | {"label":"L14", "x":4, "y":1}, | ||
| 29 | {"label":"L15", "x":5, "y":1}, | ||
| 30 | {"label":"L16", "x":6, "y":1}, | ||
| 31 | {"label":"R10", "x":7.5, "y":1}, | ||
| 32 | {"label":"R11", "x":8.5, "y":1}, | ||
| 33 | {"label":"R12", "x":9.5, "y":1}, | ||
| 34 | {"label":"R13", "x":10.5, "y":1}, | ||
| 35 | {"label":"R14", "x":11.5, "y":1}, | ||
| 36 | {"label":"R15", "x":12.5, "y":1}, | ||
| 37 | {"label":"R16", "x":13.5, "y":1}, | ||
| 38 | {"label":"L20", "x":0, "y":2}, | ||
| 39 | {"label":"L21", "x":1, "y":2}, | ||
| 40 | {"label":"L22", "x":2, "y":2}, | ||
| 41 | {"label":"L23", "x":3, "y":2}, | ||
| 42 | {"label":"L24", "x":4, "y":2}, | ||
| 43 | {"label":"L25", "x":5, "y":2}, | ||
| 44 | {"label":"L26", "x":6, "y":2}, | ||
| 45 | {"label":"R20", "x":7.5, "y":2}, | ||
| 46 | {"label":"R21", "x":8.5, "y":2}, | ||
| 47 | {"label":"R22", "x":9.5, "y":2}, | ||
| 48 | {"label":"R23", "x":10.5, "y":2}, | ||
| 49 | {"label":"R24", "x":11.5, "y":2}, | ||
| 50 | {"label":"R25", "x":12.5, "y":2}, | ||
| 51 | {"label":"R26", "x":13.5, "y":2}, | ||
| 52 | {"label":"L30", "x":0, "y":3}, | ||
| 53 | {"label":"L31", "x":1, "y":3}, | ||
| 54 | {"label":"L32", "x":2, "y":3}, | ||
| 55 | {"label":"L33", "x":3, "y":3}, | ||
| 56 | {"label":"L34", "x":4, "y":3}, | ||
| 57 | {"label":"L35", "x":5, "y":3}, | ||
| 58 | {"label":"L36", "x":6, "y":3}, | ||
| 59 | {"label":"R30", "x":7.5, "y":3}, | ||
| 60 | {"label":"R21", "x":8.5, "y":3}, | ||
| 61 | {"label":"R32", "x":9.5, "y":3}, | ||
| 62 | {"label":"R33", "x":10.5, "y":3}, | ||
| 63 | {"label":"R34", "x":11.5, "y":3}, | ||
| 64 | {"label":"R35", "x":12.5, "y":3}, | ||
| 65 | {"label":"R36", "x":13.5, "y":3}, | ||
| 66 | {"label":"L40", "x":0, "y":4}, | ||
| 67 | {"label":"L41", "x":1, "y":4}, | ||
| 68 | {"label":"L42", "x":2, "y":4}, | ||
| 69 | {"label":"L43", "x":3, "y":4}, | ||
| 70 | {"label":"L44", "x":4, "y":4}, | ||
| 71 | {"label":"L45", "x":5, "y":4}, | ||
| 72 | {"label":"L46", "x":6, "y":4}, | ||
| 73 | {"label":"R40", "x":7.5, "y":4}, | ||
| 74 | {"label":"R41", "x":8.5, "y":4}, | ||
| 75 | {"label":"R42", "x":9.5, "y":4}, | ||
| 76 | {"label":"R43", "x":10.5, "y":4}, | ||
| 77 | {"label":"R44", "x":11.5, "y":4}, | ||
| 78 | {"label":"R45", "x":12.5, "y":4}, | ||
| 79 | {"label":"R46", "x":13.5, "y":4}, | ||
| 80 | {"label":"E00", "x":0, "y":5.5}, | ||
| 81 | {"label":"E01", "x":1, "y":5.5}, | ||
| 82 | {"label":"E10", "x":2, "y":5.5}, | ||
| 83 | {"label":"E11", "x":3, "y":5.5}, | ||
| 84 | {"label":"E20", "x":10.5, "y":5.5}, | ||
| 85 | {"label":"E21", "x":11.5, "y":5.5}, | ||
| 86 | {"label":"E30", "x":12.5, "y":5.5}, | ||
| 87 | {"label":"E31", "x":13.5, "y":5.5}, | ||
| 88 | {"label":"T00", "x":0, "y":6.5}, | ||
| 89 | {"label":"T01", "x":1, "y":6.5}, | ||
| 90 | {"label":"T02", "x":2, "y":6.5}, | ||
| 91 | {"label":"T03", "x":3, "y":6.5}, | ||
| 92 | {"label":"T04", "x":4, "y":6.5}, | ||
| 93 | {"label":"T10", "x":9.5, "y":6.5}, | ||
| 94 | {"label":"T11", "x":10.5, "y":6.5}, | ||
| 95 | {"label":"T12", "x":11.5, "y":6.5}, | ||
| 96 | {"label":"T13", "x":12.5, "y":6.5}, | ||
| 97 | {"label":"T14", "x":13.5, "y":6.5} | ||
| 98 | ] | ||
| 99 | } | ||
| 100 | } | ||
| 101 | } | ||
diff --git a/keyboards/rgbkb/mun/rev1/readme.md b/keyboards/rgbkb/mun/rev1/readme.md new file mode 100644 index 000000000..6a1861153 --- /dev/null +++ b/keyboards/rgbkb/mun/rev1/readme.md | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # Mün | ||
| 2 | |||
| 3 |  | ||
| 4 | |||
| 5 | Mün is powered by STM32 with full QMK support. Each key has super-bright RGB backlighting and MX Kailh hotswap sockets. No soldering is required to get a fully functioning keyboard. There are an additional 14 rear-facing RGB LEDs on each side. Each half can be configured to run as master or slave with the two USB-C ports. They also support up to two rotary encoders and one OLED panel per half. | ||
| 6 | |||
| 7 | Keyboard Maintainer: [Legonut](https://github.com/Legonut) | ||
| 8 | Hardware Supported: Mün PCB R1.0, R1.1, R1.2 | ||
| 9 | Hardware Availability: [RGBKB](https://www.rgbkb.net) | ||
| 10 | |||
| 11 | Make example for this keyboard (after setting up your build environment): | ||
| 12 | |||
| 13 | make rgbkb/mun:default | ||
| 14 | |||
| 15 | See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | ||
diff --git a/keyboards/rgbkb/mun/rev1/rev1.c b/keyboards/rgbkb/mun/rev1/rev1.c new file mode 100644 index 000000000..28ad843b5 --- /dev/null +++ b/keyboards/rgbkb/mun/rev1/rev1.c | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include "rev1.h" | ||
| 11 | |||
| 12 | #define NUMBER_OF_TOUCH_ENCODERS 2 | ||
| 13 | #define TOUCH_ENCODER_OPTIONS TOUCH_SEGMENTS + 2 | ||
| 14 | |||
| 15 | #define NUMBER_OF_ENCODERS 4 | ||
| 16 | #define ENCODER_OPTIONS 2 | ||
| 17 | |||
| 18 | typedef struct PACKED { | ||
| 19 | uint8_t r; | ||
| 20 | uint8_t c; | ||
| 21 | } encodermap_t; | ||
| 22 | |||
| 23 | // this maps encoders and then touch encoders to their respective electrical matrix entry | ||
| 24 | // mapping is row (y) then column (x) when looking at the electrical layout | ||
| 25 | const encodermap_t encoder_map[NUMBER_OF_ENCODERS][ENCODER_OPTIONS] = | ||
| 26 | { | ||
| 27 | { { 5, 0 }, { 5, 1 } }, // Encoder 1 matrix entries | ||
| 28 | { { 5, 2 }, { 5, 3 } }, // Encoder 2 matrix entries | ||
| 29 | { { 12, 0 }, { 12, 1 } }, // Encoder 3 matrix entries | ||
| 30 | { { 12, 2 }, { 12, 3 } }, // Encoder 4 matrix entries | ||
| 31 | }; | ||
| 32 | |||
| 33 | const encodermap_t touch_encoder_map[NUMBER_OF_TOUCH_ENCODERS][TOUCH_ENCODER_OPTIONS] = | ||
| 34 | { | ||
| 35 | { { 6, 0 }, { 6, 1 }, { 6, 2 }, { 6, 3 }, { 6, 4 } }, // Touch Encoder 1 matrix entries | ||
| 36 | { { 13, 0 }, { 13, 1 }, { 13, 2 }, { 13, 3 }, { 13, 4 } } // Touch Encoder 2 matrix entries | ||
| 37 | }; | ||
| 38 | |||
| 39 | static void process_encoder_matrix(encodermap_t pos) { | ||
| 40 | action_exec((keyevent_t){ | ||
| 41 | .key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = true, .time = (timer_read() | 1) /* time should not be 0 */ | ||
| 42 | }); | ||
| 43 | #if TAP_CODE_DELAY > 0 | ||
| 44 | wait_ms(TAP_CODE_DELAY); | ||
| 45 | #endif | ||
| 46 | action_exec((keyevent_t){ | ||
| 47 | .key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = false, .time = (timer_read() | 1) /* time should not be 0 */ | ||
| 48 | }); | ||
| 49 | } | ||
| 50 | |||
| 51 | bool encoder_update_kb(uint8_t index, bool clockwise) { | ||
| 52 | if (!encoder_update_user(index, clockwise)) | ||
| 53 | return false; | ||
| 54 | |||
| 55 | // Mapping clockwise (typically increase) to zero, and counter clockwise (decrease) to 1 | ||
| 56 | process_encoder_matrix(encoder_map[index][clockwise ? 0 : 1]); | ||
| 57 | return false; | ||
| 58 | } | ||
| 59 | |||
| 60 | bool touch_encoder_update_kb(uint8_t index, bool clockwise) { | ||
| 61 | if (!touch_encoder_update_user(index, clockwise)) | ||
| 62 | return false; | ||
| 63 | |||
| 64 | // Mapping clockwise (typically increase) to zero, and counter clockwise (decrease) to 1 | ||
| 65 | process_encoder_matrix(touch_encoder_map[index][clockwise ? 0 : 1]); | ||
| 66 | return false; | ||
| 67 | } | ||
| 68 | |||
| 69 | bool touch_encoder_tapped_kb(uint8_t index, uint8_t section) { | ||
| 70 | if (!touch_encoder_tapped_user(index, section)) | ||
| 71 | return false; | ||
| 72 | |||
| 73 | process_encoder_matrix(touch_encoder_map[index][section + 2]); | ||
| 74 | return false; | ||
| 75 | } | ||
| 76 | |||
| 77 | #ifdef RGB_MATRIX_ENABLE | ||
| 78 | // clang-format off | ||
| 79 | led_config_t g_led_config = { { | ||
| 80 | { 0, 1, 2, 3, 4, 5, 6 }, | ||
| 81 | { 13, 12, 11, 10, 9, 8, 7 }, | ||
| 82 | { 14, 15, 16, 17, 18, 19, 20 }, | ||
| 83 | { 27, 26, 25, 24, 23, 22, 21 }, | ||
| 84 | { 28, 29, 30, 31, 32, 33, 34 }, | ||
| 85 | { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | ||
| 86 | { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | ||
| 87 | { 49, 50, 51, 52, 53, 54, 55 }, | ||
| 88 | { 62, 61, 60, 59, 58, 57, 56 }, | ||
| 89 | { 63, 64, 65, 66, 67, 68, 69 }, | ||
| 90 | { 76, 75, 74, 73, 72, 71, 70 }, | ||
| 91 | { 77, 78, 79, 80, 81, 82, 83 }, | ||
| 92 | { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | ||
| 93 | { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED } | ||
| 94 | }, { | ||
| 95 | { 16, 16},{ 34, 16},{ 49, 16},{ 64, 16},{ 79, 16},{ 94, 16},{ 109, 16}, | ||
| 96 | { 109, 31},{ 94, 31},{ 79, 31},{ 64, 31},{ 49, 31},{ 34, 31},{ 16, 31}, | ||
| 97 | { 16, 46},{ 34, 46},{ 49, 46},{ 64, 46},{ 79, 46},{ 94, 46},{ 109, 46}, | ||
| 98 | { 109, 61},{ 94, 61},{ 79, 61},{ 64, 61},{ 49, 61},{ 34, 61},{ 16, 61}, | ||
| 99 | { 16, 76},{ 34, 76},{ 49, 76},{ 64, 76},{ 83, 72},{ 98, 72},{ 113, 72}, | ||
| 100 | { 97, 5},{ 91, 5},{ 86, 5},{ 80, 5},{ 75, 5},{ 69, 5},{ 63, 5},{ 58, 5},{ 52, 5},{ 46, 5},{ 41, 5},{ 35, 5},{ 30, 5},{ 24, 5}, | ||
| 101 | { 240, 16},{ 222, 16},{ 207, 16},{ 192, 16},{ 177, 16},{ 162, 16},{ 147, 16}, | ||
| 102 | { 147, 31},{ 162, 31},{ 177, 31},{ 192, 31},{ 207, 31},{ 222, 31},{ 240, 31}, | ||
| 103 | { 240, 46},{ 222, 46},{ 207, 46},{ 192, 46},{ 177, 46},{ 162, 46},{ 147, 46}, | ||
| 104 | { 147, 61},{ 162, 61},{ 177, 61},{ 192, 61},{ 207, 61},{ 222, 61},{ 240, 61}, | ||
| 105 | { 240, 76},{ 222, 76},{ 207, 76},{ 192, 76},{ 180, 72},{ 165, 72},{ 150, 72}, | ||
| 106 | { 159, 5},{ 164, 5},{ 170, 5},{ 176, 5},{ 181, 5},{ 187, 5},{ 192, 5},{ 198, 5},{ 204, 5},{ 209, 5},{ 215, 5},{ 221, 5},{ 226, 5},{ 232, 5}, | ||
| 107 | }, { | ||
| 108 | 1, 4, 4, 4, 4, 4, 4, | ||
| 109 | 4, 4, 4, 4, 4, 4, 1, | ||
| 110 | 1, 4, 4, 4, 4, 4, 4, | ||
| 111 | 4, 4, 4, 4, 4, 4, 1, | ||
| 112 | 1, 1, 1, 1, 1, 1, 1, | ||
| 113 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 114 | 1, 4, 4, 4, 4, 4, 4, | ||
| 115 | 4, 4, 4, 4, 4, 4, 1, | ||
| 116 | 1, 4, 4, 4, 4, 4, 4, | ||
| 117 | 4, 4, 4, 4, 4, 4, 1, | ||
| 118 | 1, 1, 1, 1, 1, 1, 1, | ||
| 119 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 | ||
| 120 | } }; | ||
| 121 | // clang-format on | ||
| 122 | #endif | ||
diff --git a/keyboards/rgbkb/mun/rev1/rev1.h b/keyboards/rgbkb/mun/rev1/rev1.h new file mode 100644 index 000000000..8e7b65f45 --- /dev/null +++ b/keyboards/rgbkb/mun/rev1/rev1.h | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | /* | ||
| 2 | * ---------------------------------------------------------------------------- | ||
| 3 | * "THE BEER-WARE LICENSE" (Revision 42): | ||
| 4 | * <https://github.com/Legonut> wrote this file. As long as you retain this | ||
| 5 | * notice you can do whatever you want with this stuff. If we meet some day, and | ||
| 6 | * you think this stuff is worth it, you can buy me a beer in return. David Rauseo | ||
| 7 | * ---------------------------------------------------------------------------- | ||
| 8 | */ | ||
| 9 | |||
| 10 | #pragma once | ||
| 11 | |||
| 12 | #include "mun.h" | ||
| 13 | #include "touch_encoder.h" | ||
| 14 | |||
| 15 | // clang-format off | ||
| 16 | #define LAYOUT( \ | ||
| 17 | L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ | ||
| 18 | L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \ | ||
| 19 | L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, \ | ||
| 20 | L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, \ | ||
| 21 | L40, L41, L42, L43, L44, L45, L46, R40, R41, R42, R43, R44, R45, R46, \ | ||
| 22 | E00, E01, E10, E11, E20, E21, E30, E31, \ | ||
| 23 | T00, T01, T02, T03, T04, T10, T11, T12, T13, T14 \ | ||
| 24 | ) \ | ||
| 25 | { \ | ||
| 26 | /* Left Half */ \ | ||
| 27 | { L00, L01, L02, L03, L04, L05, L06 }, \ | ||
| 28 | { L10, L11, L12, L13, L14, L15, L16 }, \ | ||
| 29 | { L20, L21, L22, L23, L24, L25, L26 }, \ | ||
| 30 | { L30, L31, L32, L33, L34, L35, L36 }, \ | ||
| 31 | { L40, L41, L42, L43, L44, L45, L46 }, \ | ||
| 32 | { E00, E01, E10, E11, KC_NO, KC_NO, KC_NO }, \ | ||
| 33 | { T00, T01, T02, T03, T04, KC_NO, KC_NO }, \ | ||
| 34 | /* Right Half */ \ | ||
| 35 | { R06, R05, R04, R03, R02, R01, R00 }, \ | ||
| 36 | { R16, R15, R14, R13, R12, R11, R10 }, \ | ||
| 37 | { R26, R25, R24, R23, R22, R21, R20 }, \ | ||
| 38 | { R36, R35, R34, R33, R32, R31, R30 }, \ | ||
| 39 | { R46, R45, R44, R43, R42, R41, R40 }, \ | ||
| 40 | { E20, E21, E30, E31, KC_NO, KC_NO, KC_NO }, \ | ||
| 41 | { T10, T11, T12, T13, T14, KC_NO, KC_NO } \ | ||
| 42 | } | ||
| 43 | // clang-format on | ||
diff --git a/keyboards/rgbkb/mun/rev1/rgbkb_mun_rev1_default.json b/keyboards/rgbkb/mun/rev1/rgbkb_mun_rev1_default.json new file mode 100644 index 000000000..ccf70ef5f --- /dev/null +++ b/keyboards/rgbkb/mun/rev1/rgbkb_mun_rev1_default.json | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | { | ||
| 2 | "keyboard": "rgbkb/mun/rev1", | ||
| 3 | "keymap": "default", | ||
| 4 | "commit": "xxxxxxxxxxxxxxxxxxxxx", | ||
| 5 | "layout": "LAYOUT", | ||
| 6 | "layers": [ | ||
| 7 | ["KC_GESC","KC_1","KC_2","KC_3","KC_4","KC_5","KC_MINS","KC_EQL","KC_6","KC_7","KC_8","KC_9","KC_0","KC_BSPC","KC_TAB","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_LBRC","KC_RBRC","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_BSLS","LT(3,KC_CAPS)","KC_A","KC_S","KC_D","KC_F","KC_G","KC_LPRN","KC_RPRN","KC_H","KC_J","KC_K","KC_L","KC_SCLN","KC_QUOT","KC_LSFT","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_LCBR","KC_RCBR","KC_N","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_SFTENT","KC_LCTL","KC_LGUI","KC_LALT","RGB_TOG","MO(4)","KC_SPC","KC_BSPC","KC_ENT","KC_SPC","KC_LEFT","KC_DOWN","KC_UP","KC_RGHT","KC_RCTL","KC_VOLU","KC_VOLD","KC_VOLU","KC_VOLD","KC_PGUP","KC_PGDN","KC_PGUP","KC_PGDN","KC_VOLD","KC_VOLU","KC_MRWD","KC_MPLY","KC_MFFD","RGB_HUI","RGB_HUD","RGB_RMOD","RGB_TOG","RGB_MOD"], | ||
| 8 | ["KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_Q","KC_W","KC_F","KC_P","KC_G","KC_TRNS","KC_TRNS","KC_J","KC_L","KC_U","KC_Y","KC_SCLN","KC_TRNS","KC_TRNS","KC_A","KC_R","KC_S","KC_T","KC_D","KC_TRNS","KC_TRNS","KC_H","KC_N","KC_E","KC_I","KC_O","KC_TRNS","KC_TRNS","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_TRNS","KC_TRNS","KC_K","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS"], | ||
| 9 | ["KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_F1","KC_F5","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_F2","KC_F6","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_TRNS","KC_TRNS","KC_A","KC_S","KC_D","KC_F","KC_G","KC_F3","KC_F7","KC_H","KC_J","KC_K","KC_L","KC_SCLN","KC_TRNS","KC_TRNS","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_F4","KC_F8","KC_N","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_TRNS","KC_TRNS","KC_NO","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS"], | ||
| 10 | ["KC_TRNS","KC_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_F11","KC_F12","KC_F6","KC_F7","KC_F8","KC_F9","KC_F10","KC_TRNS","KC_TRNS","KC_HOME","KC_UP","KC_END","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_HOME","KC_UP","KC_END","KC_PSCR","KC_PGUP","KC_TRNS","KC_LEFT","KC_DOWN","KC_RGHT","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_LEFT","KC_DOWN","KC_RGHT","KC_INS","KC_PGDN","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","ANY(TCH_TOG)","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_MPLY","KC_MNXT","KC_MUTE","KC_VOLD","KC_VOLU","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS"], | ||
| 11 | ["KC_TRNS","KC_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_F11","KC_F12","KC_F6","KC_F7","KC_F8","KC_F9","KC_F10","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P7","KC_P8","KC_P9","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P4","KC_P5","KC_P6","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P1","KC_P2","KC_P3","KC_TRNS","DF(2)","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P0","KC_PDOT","KC_NLCK","DF(0)","DF(1)","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS"] | ||
| 12 | ] | ||
| 13 | } \ No newline at end of file | ||
diff --git a/keyboards/rgbkb/mun/rev1/rules.mk b/keyboards/rgbkb/mun/rev1/rules.mk new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/rgbkb/mun/rev1/rules.mk | |||
diff --git a/keyboards/rgbkb/mun/rules.mk b/keyboards/rgbkb/mun/rules.mk new file mode 100644 index 000000000..f016c6c71 --- /dev/null +++ b/keyboards/rgbkb/mun/rules.mk | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | # MCU name | ||
| 2 | MCU = STM32F303 | ||
| 3 | |||
| 4 | # Touch encoder needs | ||
| 5 | SRC += ../common/touch_encoder.c | ||
| 6 | SRC += ../common/common_oled.c | ||
| 7 | QUANTUM_LIB_SRC += i2c_master.c | ||
| 8 | |||
| 9 | # Build Options | ||
| 10 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 11 | # the appropriate keymap folder that will get included automatically | ||
| 12 | # | ||
| 13 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration | ||
| 14 | ## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) | ||
| 15 | MOUSEKEY_ENABLE = no # Mouse keys | ||
| 16 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
| 17 | CONSOLE_ENABLE = yes # Console for debug | ||
| 18 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 19 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 20 | MIDI_ENABLE = no # MIDI controls | ||
| 21 | AUDIO_ENABLE = no # Audio output | ||
| 22 | UNICODE_ENABLE = no # Unicode | ||
| 23 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 24 | |||
| 25 | WS2812_DRIVER = pwm | ||
| 26 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. | ||
| 27 | RGB_MATRIX_ENABLE = yes | ||
| 28 | RGB_MATRIX_DRIVER = WS2812 | ||
| 29 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 30 | |||
| 31 | OLED_DRIVER_ENABLE = yes # Enable the OLED Driver | ||
| 32 | |||
| 33 | ENCODER_ENABLE = yes | ||
| 34 | |||
| 35 | SPLIT_KEYBOARD = yes | ||
| 36 | SERIAL_DRIVER = usart | ||
| 37 | LTO_ENABLE = yes | ||
| 38 | OPT = 3 | ||
| 39 | |||
| 40 | OPT_DEFS += -DOLED_FONT_H=\"../common/glcdfont.c\" | ||
| 41 | OPT_DEFS += -Ikeyboards/rgbkb/common | ||
| 42 | |||
| 43 | CUSTOM_MATRIX = yes | ||
| 44 | SRC += matrix.c matrix_common.c | ||
| 45 | |||
| 46 | DEFAULT_FOLDER = rgbkb/mun/rev1 \ No newline at end of file | ||
