diff options
| -rw-r--r-- | keyboards/steelseries/prime/board.h | 9 | ||||
| -rw-r--r-- | keyboards/steelseries/prime/config.h | 23 | ||||
| -rw-r--r-- | keyboards/steelseries/prime/halconf.h | 9 | ||||
| -rw-r--r-- | keyboards/steelseries/prime/keyboard.json | 58 | ||||
| -rw-r--r-- | keyboards/steelseries/prime/keymaps/default/keymap.c | 29 | ||||
| -rw-r--r-- | keyboards/steelseries/prime/keymaps/default/rules.mk | 1 | ||||
| -rw-r--r-- | keyboards/steelseries/prime/mcuconf.h | 15 | ||||
| -rw-r--r-- | keyboards/steelseries/prime/prime.c | 16 | ||||
| -rw-r--r-- | keyboards/steelseries/prime/readme.md | 41 | ||||
| -rw-r--r-- | keyboards/steelseries/prime/rgblight_custom.c | 65 | ||||
| -rw-r--r-- | keyboards/steelseries/prime/rules.mk | 5 |
11 files changed, 271 insertions, 0 deletions
diff --git a/keyboards/steelseries/prime/board.h b/keyboards/steelseries/prime/board.h new file mode 100644 index 0000000000..edb9e1072c --- /dev/null +++ b/keyboards/steelseries/prime/board.h | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | // Copyright 2024 Dasky (@daskygit) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include_next <board.h> | ||
| 7 | |||
| 8 | #undef STM32_HSECLK | ||
| 9 | #define STM32_HSECLK 12000000 | ||
diff --git a/keyboards/steelseries/prime/config.h b/keyboards/steelseries/prime/config.h new file mode 100644 index 0000000000..2e041f4a46 --- /dev/null +++ b/keyboards/steelseries/prime/config.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | // Copyright 2024 Dasky (@daskygit) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #define POINTING_DEVICE_CS_PIN A4 | ||
| 7 | #define POINTING_DEVICE_MOTION_PIN B0 | ||
| 8 | #define POINTING_DEVICE_TASK_THROTTLE_MS 1 | ||
| 9 | |||
| 10 | #define SPI_DRIVER SPID1 | ||
| 11 | #define SPI_SCK_PIN A5 | ||
| 12 | #define SPI_MOSI_PIN A7 | ||
| 13 | #define SPI_MISO_PIN A6 | ||
| 14 | |||
| 15 | #define RGB_PWM_DRIVER PWMD1 | ||
| 16 | #define RGB_BLUE_PIN A10 | ||
| 17 | #define RGB_BLUE_PWM_CHANNEL 3 | ||
| 18 | #define RGB_GREEN_PIN A8 | ||
| 19 | #define RGB_GREEN_PWM_CHANNEL 1 | ||
| 20 | #define RGB_RED_PIN A9 | ||
| 21 | #define RGB_RED_PWM_CHANNEL 2 | ||
| 22 | |||
| 23 | #define OPTICAL_SW_PWR A2 | ||
diff --git a/keyboards/steelseries/prime/halconf.h b/keyboards/steelseries/prime/halconf.h new file mode 100644 index 0000000000..e1498a877a --- /dev/null +++ b/keyboards/steelseries/prime/halconf.h | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | // Copyright 2024 Dasky (@daskygit) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #define HAL_USE_SPI TRUE | ||
| 7 | #define HAL_USE_PWM TRUE | ||
| 8 | |||
| 9 | #include_next <halconf.h> | ||
diff --git a/keyboards/steelseries/prime/keyboard.json b/keyboards/steelseries/prime/keyboard.json new file mode 100644 index 0000000000..e267b7506a --- /dev/null +++ b/keyboards/steelseries/prime/keyboard.json | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | { | ||
| 2 | "manufacturer": "SteelSeries", | ||
| 3 | "keyboard_name": "Prime", | ||
| 4 | "maintainer": "Dasky", | ||
| 5 | "bootloader": "uf2boot", | ||
| 6 | "build": { | ||
| 7 | "debounce_type": "asym_eager_defer_pk", | ||
| 8 | "lto": true | ||
| 9 | }, | ||
| 10 | "encoder": { | ||
| 11 | "rotary": [ | ||
| 12 | {"pin_a": "B5", "pin_b": "B4", "resolution": 2} | ||
| 13 | ] | ||
| 14 | }, | ||
| 15 | "features": { | ||
| 16 | "bootmagic": true, | ||
| 17 | "encoder": true, | ||
| 18 | "extrakey": true, | ||
| 19 | "mousekey": true, | ||
| 20 | "pointing_device": true, | ||
| 21 | "rgblight": true | ||
| 22 | }, | ||
| 23 | "matrix_pins": { | ||
| 24 | "direct": [ | ||
| 25 | ["A0", "C15", "A1", "C13", "C14", "A3"] | ||
| 26 | ] | ||
| 27 | }, | ||
| 28 | "processor": "STM32F103", | ||
| 29 | "rgblight": { | ||
| 30 | "animations": { | ||
| 31 | "breathing": true, | ||
| 32 | "rainbow_mood": true | ||
| 33 | }, | ||
| 34 | "default": { | ||
| 35 | "animation": "rainbow_mood" | ||
| 36 | }, | ||
| 37 | "driver": "custom", | ||
| 38 | "led_count": 1 | ||
| 39 | }, | ||
| 40 | "url": "https://steelseries.com/gaming-mice/prime", | ||
| 41 | "usb": { | ||
| 42 | "device_version": "1.0.0", | ||
| 43 | "pid": "0x0000", | ||
| 44 | "vid": "0xFEED" | ||
| 45 | }, | ||
| 46 | "layouts": { | ||
| 47 | "LAYOUT": { | ||
| 48 | "layout": [ | ||
| 49 | {"label": "Left Click", "matrix": [0, 0], "x": 0, "y": 0}, | ||
| 50 | {"label": "Middle Click", "matrix": [0, 1], "x": 1, "y": 0}, | ||
| 51 | {"label": "Right Click", "matrix": [0, 2], "x": 2, "y": 0}, | ||
| 52 | {"label": "Side forward", "matrix": [0, 3], "x": 0, "y": 2}, | ||
| 53 | {"label": "Side back", "matrix": [0, 4], "x": 0, "y": 3}, | ||
| 54 | {"label": "boot", "matrix": [0, 5], "x": 1, "y": 1} | ||
| 55 | ] | ||
| 56 | } | ||
| 57 | } | ||
| 58 | } | ||
diff --git a/keyboards/steelseries/prime/keymaps/default/keymap.c b/keyboards/steelseries/prime/keymaps/default/keymap.c new file mode 100644 index 0000000000..803f6b47da --- /dev/null +++ b/keyboards/steelseries/prime/keymaps/default/keymap.c | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | // Copyright 2024 Dasky (@daskygit) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include QMK_KEYBOARD_H | ||
| 5 | |||
| 6 | // clang-format off | ||
| 7 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 8 | // Left, Middle, Right, | ||
| 9 | // Forward | ||
| 10 | // Back | ||
| 11 | // Underneath | ||
| 12 | [0] = LAYOUT( | ||
| 13 | MS_BTN1, MS_BTN3, MS_BTN2, | ||
| 14 | MS_BTN5, | ||
| 15 | MS_BTN4, | ||
| 16 | QK_BOOT | ||
| 17 | ) | ||
| 18 | }; | ||
| 19 | // clang-format on | ||
| 20 | |||
| 21 | void pointing_device_init_kb(void) { | ||
| 22 | pointing_device_set_cpi(1600); | ||
| 23 | } | ||
| 24 | |||
| 25 | #if defined(ENCODER_MAP_ENABLE) | ||
| 26 | const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | ||
| 27 | [0] = {ENCODER_CCW_CW(MS_WHLU, MS_WHLD)}, | ||
| 28 | }; | ||
| 29 | #endif | ||
diff --git a/keyboards/steelseries/prime/keymaps/default/rules.mk b/keyboards/steelseries/prime/keymaps/default/rules.mk new file mode 100644 index 0000000000..ee32568148 --- /dev/null +++ b/keyboards/steelseries/prime/keymaps/default/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| ENCODER_MAP_ENABLE = yes | |||
diff --git a/keyboards/steelseries/prime/mcuconf.h b/keyboards/steelseries/prime/mcuconf.h new file mode 100644 index 0000000000..f49ef0edf7 --- /dev/null +++ b/keyboards/steelseries/prime/mcuconf.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | // Copyright 2024 Dasky (@daskygit) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include_next <mcuconf.h> | ||
| 7 | |||
| 8 | #undef STM32_PWM_USE_TIM1 | ||
| 9 | #define STM32_PWM_USE_TIM1 TRUE | ||
| 10 | |||
| 11 | #undef STM32_SPI_USE_SPI1 | ||
| 12 | #define STM32_SPI_USE_SPI1 TRUE | ||
| 13 | |||
| 14 | #undef STM32_PLLMUL_VALUE | ||
| 15 | #define STM32_PLLMUL_VALUE 6 | ||
diff --git a/keyboards/steelseries/prime/prime.c b/keyboards/steelseries/prime/prime.c new file mode 100644 index 0000000000..11c528eea8 --- /dev/null +++ b/keyboards/steelseries/prime/prime.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | // Copyright 2024 Dasky (@daskygit) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "quantum.h" | ||
| 5 | |||
| 6 | |||
| 7 | void board_init(void) { | ||
| 8 | |||
| 9 | gpio_set_pin_output(A15); | ||
| 10 | gpio_write_pin_high(A15); // Activate D+ pullup | ||
| 11 | |||
| 12 | gpio_set_pin_output(OPTICAL_SW_PWR); | ||
| 13 | gpio_write_pin_low(OPTICAL_SW_PWR); // Enable power for optical switches | ||
| 14 | |||
| 15 | } | ||
| 16 | |||
diff --git a/keyboards/steelseries/prime/readme.md b/keyboards/steelseries/prime/readme.md new file mode 100644 index 0000000000..e5a70afd4c --- /dev/null +++ b/keyboards/steelseries/prime/readme.md | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | # SteelSeries Prime | ||
| 2 | |||
| 3 |  | ||
| 4 | |||
| 5 | Erase with an stlink and flash this [uf2boot bootloader](https://github.com/daskygit/uf2-prime-plus), this is a a one way procedure voiding any warranty so be sure you don't want to use the original manufacturers firmware. | ||
| 6 | |||
| 7 | you may need to remove write protection to flash, e.g. with openocd in linux | ||
| 8 | |||
| 9 | ```sh | ||
| 10 | openocd -f interface/stlink.cfg -f target/stm32f1x.cfg -c "init; reset halt; stm32f1x unlock 0; flash protect 0 0 last off; reset halt; exit" | ||
| 11 | |||
| 12 | ``` | ||
| 13 | |||
| 14 | and write the new bootloader | ||
| 15 | |||
| 16 | ```sh | ||
| 17 | |||
| 18 | openocd -f interface/stlink.cfg -f target/stm32f1x.cfg -c "program build/PRIME_PLUS/uf2boot.bin verify reset exit 0x8000000" | ||
| 19 | |||
| 20 | ``` | ||
| 21 | |||
| 22 | * Keyboard Maintainer: [Dasky](https://github.com/daskygit) | ||
| 23 | * Hardware Supported: SteelSeries Prime | ||
| 24 | * Hardware Availability: https://steelseries.com/gaming-mice/prime | ||
| 25 | |||
| 26 | Make example for this keyboard (after setting up your build environment): | ||
| 27 | |||
| 28 | make steelseries/prime:default | ||
| 29 | |||
| 30 | Flashing example for this keyboard: | ||
| 31 | |||
| 32 | make steelseries/prime:default:flash | ||
| 33 | |||
| 34 | 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). | ||
| 35 | |||
| 36 | ## Bootloader | ||
| 37 | |||
| 38 | Enter the bootloader in 2 ways: | ||
| 39 | |||
| 40 | * **Bootmagic reset**: Hold down left mouse button and plug in. | ||
| 41 | * **Bootloader entry**: Hold the underneath button while plugging in. | ||
diff --git a/keyboards/steelseries/prime/rgblight_custom.c b/keyboards/steelseries/prime/rgblight_custom.c new file mode 100644 index 0000000000..2736052587 --- /dev/null +++ b/keyboards/steelseries/prime/rgblight_custom.c | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | // Copyright 2024 Dasky (@daskygit) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include <hal.h> | ||
| 5 | #include "chibios_config.h" | ||
| 6 | #include "gpio.h" | ||
| 7 | #include "color.h" | ||
| 8 | #include "rgblight_drivers.h" | ||
| 9 | |||
| 10 | static PWMConfig pwmCFG = { | ||
| 11 | .frequency = 0xFFFF, | ||
| 12 | .period = 256, | ||
| 13 | }; | ||
| 14 | |||
| 15 | rgb_t prime_leds[RGBLIGHT_LED_COUNT]; | ||
| 16 | |||
| 17 | void init_custom(void) { | ||
| 18 | palSetPadMode(PAL_PORT(RGB_RED_PIN), PAL_PAD(RGB_RED_PIN), PAL_MODE_ALTERNATE_PUSHPULL); | ||
| 19 | palSetPadMode(PAL_PORT(RGB_GREEN_PIN), PAL_PAD(RGB_GREEN_PIN), PAL_MODE_ALTERNATE_PUSHPULL); | ||
| 20 | palSetPadMode(PAL_PORT(RGB_BLUE_PIN), PAL_PAD(RGB_BLUE_PIN), PAL_MODE_ALTERNATE_PUSHPULL); | ||
| 21 | pwmCFG.channels[RGB_RED_PWM_CHANNEL - 1].mode = PWM_OUTPUT_ACTIVE_HIGH; | ||
| 22 | pwmCFG.channels[RGB_GREEN_PWM_CHANNEL - 1].mode = PWM_OUTPUT_ACTIVE_HIGH; | ||
| 23 | pwmCFG.channels[RGB_BLUE_PWM_CHANNEL - 1].mode = PWM_OUTPUT_ACTIVE_HIGH; | ||
| 24 | pwmStart(&RGB_PWM_DRIVER, &pwmCFG); | ||
| 25 | } | ||
| 26 | |||
| 27 | void set_color_custom(int index, uint8_t red, uint8_t green, uint8_t blue) { | ||
| 28 | prime_leds[index].r = red; | ||
| 29 | prime_leds[index].g = green; | ||
| 30 | prime_leds[index].b = blue; | ||
| 31 | } | ||
| 32 | |||
| 33 | void set_color_all_custom(uint8_t red, uint8_t green, uint8_t blue) { | ||
| 34 | for (int i = 0; i < RGBLIGHT_LED_COUNT; i++) { | ||
| 35 | set_color_custom(i, red, green, blue); | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | void flush_custom(void) { | ||
| 40 | if (prime_leds[0].r == 0) { | ||
| 41 | pwmDisableChannel(&RGB_PWM_DRIVER, RGB_RED_PWM_CHANNEL - 1); | ||
| 42 | } else { | ||
| 43 | uint32_t duty = ((uint32_t)0xFFFF * prime_leds[0].r) / 0xFF; | ||
| 44 | pwmEnableChannel(&RGB_PWM_DRIVER, RGB_RED_PWM_CHANNEL - 1, PWM_FRACTION_TO_WIDTH(&RGB_PWM_DRIVER, 0xFFFF, duty)); | ||
| 45 | } | ||
| 46 | if (prime_leds[0].g == 0) { | ||
| 47 | pwmDisableChannel(&RGB_PWM_DRIVER, RGB_GREEN_PWM_CHANNEL - 1); | ||
| 48 | } else { | ||
| 49 | uint32_t duty = ((uint32_t)0xFFFF * prime_leds[0].g) / 0xFF; | ||
| 50 | pwmEnableChannel(&RGB_PWM_DRIVER, RGB_GREEN_PWM_CHANNEL - 1, PWM_FRACTION_TO_WIDTH(&RGB_PWM_DRIVER, 0xFFFF, duty)); | ||
| 51 | } | ||
| 52 | if (prime_leds[0].b == 0) { | ||
| 53 | pwmDisableChannel(&RGB_PWM_DRIVER, RGB_BLUE_PWM_CHANNEL - 1); | ||
| 54 | } else { | ||
| 55 | uint32_t duty = ((uint32_t)0xFFFF * prime_leds[0].b) / 0xFF; | ||
| 56 | pwmEnableChannel(&RGB_PWM_DRIVER, RGB_BLUE_PWM_CHANNEL - 1, PWM_FRACTION_TO_WIDTH(&RGB_PWM_DRIVER, 0xFFFF, duty)); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | const rgblight_driver_t rgblight_driver = { | ||
| 61 | .init = init_custom, | ||
| 62 | .set_color = set_color_custom, | ||
| 63 | .set_color_all = set_color_all_custom, | ||
| 64 | .flush = flush_custom, | ||
| 65 | }; | ||
diff --git a/keyboards/steelseries/prime/rules.mk b/keyboards/steelseries/prime/rules.mk new file mode 100644 index 0000000000..5ab86b1b69 --- /dev/null +++ b/keyboards/steelseries/prime/rules.mk | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | MCU_LDSCRIPT = STM32F103xB_uf2boot | ||
| 2 | |||
| 3 | POINTING_DEVICE_DRIVER = pmw3389 | ||
| 4 | |||
| 5 | SRC += rgblight_custom.c | ||
