diff options
Diffstat (limited to 'keyboards/nebula68b/nebula68b.c')
| -rwxr-xr-x | keyboards/nebula68b/nebula68b.c | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/keyboards/nebula68b/nebula68b.c b/keyboards/nebula68b/nebula68b.c new file mode 100755 index 000000000..4842d9be9 --- /dev/null +++ b/keyboards/nebula68b/nebula68b.c | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | /* Copyright 2021 Yiancar | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "nebula68b.h" | ||
| 18 | #include <lib/lib8tion/lib8tion.h> | ||
| 19 | |||
| 20 | #ifdef RGB_MATRIX_ENABLE | ||
| 21 | // clang-format off | ||
| 22 | led_config_t g_led_config = { { | ||
| 23 | { 0, 1, 2, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 18, 19 }, | ||
| 24 | { 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 16, 22 }, | ||
| 25 | { 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 23, 50, 20 }, | ||
| 26 | { 64, NO_LED, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 21 }, | ||
| 27 | { 65, 66, 68, NO_LED, NO_LED, NO_LED, 70, NO_LED, NO_LED, 72, 73, 74, 76, 77, 78 } | ||
| 28 | }, { | ||
| 29 | { 6, 10}, { 19, 10}, { 32, 10}, { 44, 13}, { 45, 10}, { 58, 10}, { 71, 10}, { 84, 10}, { 88, 13}, { 97, 10}, {110, 10}, {123, 10}, {132, 13}, {136, 10}, {149, 10}, {162, 10}, | ||
| 30 | {175, 10}, {179, 13}, {188, 10}, {205, 10}, {218, 10}, {218, 23}, {205, 23}, {185, 23}, {169, 23}, {156, 23}, {143, 23}, {130, 23}, {117, 23}, {104, 23}, { 91, 23}, { 78, 23}, | ||
| 31 | { 65, 23}, { 52, 23}, { 39, 23}, { 26, 23}, { 10, 23}, { 4, 26}, { 11, 35}, { 29, 35}, { 42, 35}, { 55, 35}, { 68, 35}, { 81, 35}, { 94, 35}, {107, 35}, {120, 35}, {133, 35}, | ||
| 32 | {146, 35}, {159, 35}, {180, 35}, {220, 32}, {205, 48}, {177, 48}, {153, 48}, {140, 48}, {127, 48}, {114, 48}, {101, 48}, { 88, 48}, { 75, 48}, { 62, 48}, { 49, 48}, { 36, 48}, | ||
| 33 | { 15, 48}, { 8, 61}, { 24, 61}, { 32, 52}, { 41, 61}, { 82, 56}, { 89, 61}, {132, 53}, {138, 61}, {154, 61}, {170, 61}, {179, 53}, {192, 61}, {205, 61}, {218, 61} | ||
| 34 | }, { | ||
| 35 | 1, 4, 4, 2, 4, 4, 4, 4, 2, 4, 4, 4, 2, 4, 4, 4, 4, 2, 1, 1, 1, | ||
| 36 | 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 2, | ||
| 37 | 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 2, | ||
| 38 | 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, | ||
| 39 | 1, 1, 2, 1, 2, 4, 2, 1, 1, 1, 2, 1, 1, 1 | ||
| 40 | } }; | ||
| 41 | // clang-format on | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #if defined(RGB_MATRIX_ENABLE) && defined(VIA_ENABLE) | ||
| 45 | void raw_hid_receive_kb(uint8_t *data, uint8_t length) { | ||
| 46 | uint8_t *command_id = &(data[0]); | ||
| 47 | uint8_t *command_data = &(data[1]); | ||
| 48 | switch (*command_id) { | ||
| 49 | case id_lighting_set_value: { | ||
| 50 | uint8_t *value_id = &(command_data[0]); | ||
| 51 | uint8_t *value_data = &(command_data[1]); | ||
| 52 | switch (*value_id) { | ||
| 53 | case id_qmk_rgblight_brightness: { | ||
| 54 | rgb_matrix_sethsv_noeeprom(rgb_matrix_get_hue(), rgb_matrix_get_sat(), scale8(value_data[0], RGB_MATRIX_MAXIMUM_BRIGHTNESS)); | ||
| 55 | break; | ||
| 56 | } | ||
| 57 | case id_qmk_rgblight_effect: { | ||
| 58 | rgb_matrix_mode_noeeprom(value_data[0]); | ||
| 59 | if (value_data[0] == 0) { | ||
| 60 | rgb_matrix_disable_noeeprom(); | ||
| 61 | } else { | ||
| 62 | rgb_matrix_enable_noeeprom(); | ||
| 63 | } | ||
| 64 | break; | ||
| 65 | } | ||
| 66 | case id_qmk_rgblight_effect_speed: { | ||
| 67 | rgb_matrix_set_speed_noeeprom(value_data[0] * 85); | ||
| 68 | break; | ||
| 69 | } | ||
| 70 | case id_qmk_rgblight_color: { | ||
| 71 | rgb_matrix_sethsv_noeeprom(value_data[0], value_data[1], rgb_matrix_get_val()); | ||
| 72 | break; | ||
| 73 | } | ||
| 74 | } | ||
| 75 | break; | ||
| 76 | } | ||
| 77 | case id_lighting_get_value: { | ||
| 78 | uint8_t *value_id = &(command_data[0]); | ||
| 79 | uint8_t *value_data = &(command_data[1]); | ||
| 80 | switch (*value_id) { | ||
| 81 | case id_qmk_rgblight_brightness: { | ||
| 82 | value_data[0] = ((uint16_t)rgb_matrix_get_val() * 255) / RGB_MATRIX_MAXIMUM_BRIGHTNESS; | ||
| 83 | break; | ||
| 84 | } | ||
| 85 | case id_qmk_rgblight_effect: { | ||
| 86 | value_data[0] = rgb_matrix_get_mode(); | ||
| 87 | break; | ||
| 88 | } | ||
| 89 | case id_qmk_rgblight_effect_speed: { | ||
| 90 | value_data[0] = rgb_matrix_get_speed() / 85; | ||
| 91 | break; | ||
| 92 | } | ||
| 93 | case id_qmk_rgblight_color: { | ||
| 94 | value_data[0] = rgb_matrix_get_hue(); | ||
| 95 | value_data[1] = rgb_matrix_get_sat(); | ||
| 96 | break; | ||
| 97 | } | ||
| 98 | } | ||
| 99 | break; | ||
| 100 | } | ||
| 101 | case id_lighting_save: { | ||
| 102 | eeconfig_update_rgb_matrix(); | ||
| 103 | break; | ||
| 104 | } | ||
| 105 | default: { | ||
| 106 | *command_id = id_unhandled; | ||
| 107 | break; | ||
| 108 | } | ||
| 109 | } | ||
| 110 | } | ||
| 111 | #endif | ||
