From 6c8e205fc0e5bc6372f057a257937ec3f88d5b8d Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Mon, 6 Apr 2020 21:31:34 +0100 Subject: [PATCH] Remove keyboard level ws2812 spi drivers (#7694) --- keyboards/cannonkeys/an_c/config.h | 7 ++----- keyboards/cannonkeys/an_c/rules.mk | 1 + keyboards/cannonkeys/bluepill/keyboard.c | 13 ------------- keyboards/cannonkeys/bluepill/ws2812.h | 20 -------------------- keyboards/cannonkeys/instant60/config.h | 7 ++----- keyboards/cannonkeys/instant60/rules.mk | 1 + keyboards/cannonkeys/ortho48/config.h | 8 ++------ keyboards/cannonkeys/ortho48/rules.mk | 1 + keyboards/cannonkeys/ortho60/config.h | 8 ++------ keyboards/cannonkeys/ortho60/rules.mk | 1 + keyboards/cannonkeys/ortho75/config.h | 8 ++------ keyboards/cannonkeys/ortho75/rules.mk | 1 + keyboards/cannonkeys/practice60/config.h | 8 ++------ keyboards/cannonkeys/practice60/rules.mk | 1 + keyboards/cannonkeys/practice65/config.h | 8 ++------ keyboards/cannonkeys/practice65/rules.mk | 2 +- keyboards/cannonkeys/savage65/config.h | 7 ++----- keyboards/cannonkeys/savage65/rules.mk | 2 +- keyboards/cannonkeys/stm32f072/keyboard.c | 16 ---------------- keyboards/cannonkeys/stm32f072/ws2812.h | 19 ------------------- keyboards/cannonkeys/tmov2/config.h | 8 +++----- keyboards/cannonkeys/tmov2/rules.mk | 2 +- keyboards/projectkb/alice/config.h | 7 ++----- keyboards/projectkb/alice/rules.mk | 1 + 24 files changed, 31 insertions(+), 126 deletions(-) delete mode 100644 keyboards/cannonkeys/bluepill/ws2812.h delete mode 100644 keyboards/cannonkeys/stm32f072/ws2812.h diff --git a/keyboards/cannonkeys/an_c/config.h b/keyboards/cannonkeys/an_c/config.h index 7f8d7e8ff..fd73aad8b 100644 --- a/keyboards/cannonkeys/an_c/config.h +++ b/keyboards/cannonkeys/an_c/config.h @@ -49,11 +49,8 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE #define RGBLIGHT_ANIMATIONS - -#define WS2812_LED_N 14 -#define RGBLED_NUM WS2812_LED_N -#define PORT_WS2812 GPIOB -#define PIN_WS2812 15 +#define RGB_DI_PIN B15 +#define RGBLED_NUM 14 #define WS2812_SPI SPID2 // Backlight config starts after VIA's EEPROM usage, diff --git a/keyboards/cannonkeys/an_c/rules.mk b/keyboards/cannonkeys/an_c/rules.mk index 7ae14c498..4c432cf98 100644 --- a/keyboards/cannonkeys/an_c/rules.mk +++ b/keyboards/cannonkeys/an_c/rules.mk @@ -21,6 +21,7 @@ NKRO_ENABLE = yes # USB Nkey Rollover CUSTOM_MATRIX = no # Custom matrix file # BACKLIGHT_ENABLE = yes # This is broken on 072 for some reason RGBLIGHT_ENABLE = yes +WS2812_DRIVER = spi LAYOUTS = 60_ansi 60_tsangan_hhkb diff --git a/keyboards/cannonkeys/bluepill/keyboard.c b/keyboards/cannonkeys/bluepill/keyboard.c index de0015881..c2e5946d4 100644 --- a/keyboards/cannonkeys/bluepill/keyboard.c +++ b/keyboards/cannonkeys/bluepill/keyboard.c @@ -14,20 +14,7 @@ #endif void matrix_init_kb(void){ - /* MOSI pin*/ - palSetPadMode(GPIOB, 15, PAL_MODE_STM32_ALTERNATE_PUSHPULL); LED_ON(); wait_ms(500); LED_OFF(); - -#ifdef RGBLIGHT_ENABLE - leds_init(); -#endif -} - -void matrix_scan_kb(void) -{ - #ifdef RGBLIGHT_ENABLE - rgblight_task(); - #endif } diff --git a/keyboards/cannonkeys/bluepill/ws2812.h b/keyboards/cannonkeys/bluepill/ws2812.h deleted file mode 100644 index be37df766..000000000 --- a/keyboards/cannonkeys/bluepill/ws2812.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "hal.h" -#include "color.h" - - -void set_leds_color_rgb(LED_TYPE color); -void set_led_color_rgb(LED_TYPE color, int pos); -void leds_init(void); - - - // This is what users will use to interface with this -void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds); -void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds); - - -void WS2812_init(void); -void WS2812_set_color( uint8_t index, uint8_t red, uint8_t green, uint8_t blue ); -void WS2812_set_color_all( uint8_t red, uint8_t green, uint8_t blue ); -void WS2812_send_colors(void); diff --git a/keyboards/cannonkeys/instant60/config.h b/keyboards/cannonkeys/instant60/config.h index 6f8f6bd01..1c4325187 100644 --- a/keyboards/cannonkeys/instant60/config.h +++ b/keyboards/cannonkeys/instant60/config.h @@ -49,11 +49,8 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE #define RGBLIGHT_ANIMATIONS - -#define WS2812_LED_N 14 -#define RGBLED_NUM WS2812_LED_N -#define PORT_WS2812 GPIOB -#define PIN_WS2812 15 +#define RGB_DI_PIN B15 +#define RGBLED_NUM 14 #define WS2812_SPI SPID2 // Backlight config starts after VIA's EEPROM usage, diff --git a/keyboards/cannonkeys/instant60/rules.mk b/keyboards/cannonkeys/instant60/rules.mk index 7ae14c498..4c432cf98 100644 --- a/keyboards/cannonkeys/instant60/rules.mk +++ b/keyboards/cannonkeys/instant60/rules.mk @@ -21,6 +21,7 @@ NKRO_ENABLE = yes # USB Nkey Rollover CUSTOM_MATRIX = no # Custom matrix file # BACKLIGHT_ENABLE = yes # This is broken on 072 for some reason RGBLIGHT_ENABLE = yes +WS2812_DRIVER = spi LAYOUTS = 60_ansi 60_tsangan_hhkb diff --git a/keyboards/cannonkeys/ortho48/config.h b/keyboards/cannonkeys/ortho48/config.h index bab0b95c0..c3b9dee18 100644 --- a/keyboards/cannonkeys/ortho48/config.h +++ b/keyboards/cannonkeys/ortho48/config.h @@ -52,14 +52,10 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE #define RGBLIGHT_ANIMATIONS - -#define WS2812_LED_N 9 -#define RGBLED_NUM WS2812_LED_N -#define PORT_WS2812 GPIOB -#define PIN_WS2812 15 +#define RGB_DI_PIN B15 +#define RGBLED_NUM 9 #define WS2812_SPI SPID2 - /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/cannonkeys/ortho48/rules.mk b/keyboards/cannonkeys/ortho48/rules.mk index 9c9b79e42..f2fc3e128 100644 --- a/keyboards/cannonkeys/ortho48/rules.mk +++ b/keyboards/cannonkeys/ortho48/rules.mk @@ -22,6 +22,7 @@ SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes +WS2812_DRIVER = spi LAYOUTS = ortho_4x12 diff --git a/keyboards/cannonkeys/ortho60/config.h b/keyboards/cannonkeys/ortho60/config.h index acfc2b53a..7e3ef879b 100644 --- a/keyboards/cannonkeys/ortho60/config.h +++ b/keyboards/cannonkeys/ortho60/config.h @@ -52,14 +52,10 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE #define RGBLIGHT_ANIMATIONS - -#define WS2812_LED_N 16 -#define RGBLED_NUM WS2812_LED_N -#define PORT_WS2812 GPIOB -#define PIN_WS2812 15 +#define RGB_DI_PIN B15 +#define RGBLED_NUM 16 #define WS2812_SPI SPID2 - /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/cannonkeys/ortho60/rules.mk b/keyboards/cannonkeys/ortho60/rules.mk index 7355fbf93..aaa14c2db 100644 --- a/keyboards/cannonkeys/ortho60/rules.mk +++ b/keyboards/cannonkeys/ortho60/rules.mk @@ -22,6 +22,7 @@ SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes +WS2812_DRIVER = spi LAYOUTS = ortho_5x12 diff --git a/keyboards/cannonkeys/ortho75/config.h b/keyboards/cannonkeys/ortho75/config.h index 6e3651a83..8c1882e65 100644 --- a/keyboards/cannonkeys/ortho75/config.h +++ b/keyboards/cannonkeys/ortho75/config.h @@ -55,14 +55,10 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE #define RGBLIGHT_ANIMATIONS - -#define WS2812_LED_N 16 -#define RGBLED_NUM WS2812_LED_N -#define PORT_WS2812 GPIOB -#define PIN_WS2812 15 +#define RGB_DI_PIN B15 +#define RGBLED_NUM 16 #define WS2812_SPI SPID2 - /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/cannonkeys/ortho75/rules.mk b/keyboards/cannonkeys/ortho75/rules.mk index 8acb50d0c..fe9cec84c 100644 --- a/keyboards/cannonkeys/ortho75/rules.mk +++ b/keyboards/cannonkeys/ortho75/rules.mk @@ -22,6 +22,7 @@ SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes +WS2812_DRIVER = spi ENCODER_ENABLE = yes LAYOUTS = ortho_5x15 diff --git a/keyboards/cannonkeys/practice60/config.h b/keyboards/cannonkeys/practice60/config.h index ec16e39b3..d17b7f04d 100644 --- a/keyboards/cannonkeys/practice60/config.h +++ b/keyboards/cannonkeys/practice60/config.h @@ -52,14 +52,10 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE #define RGBLIGHT_ANIMATIONS - -#define WS2812_LED_N 9 -#define RGBLED_NUM WS2812_LED_N -#define PORT_WS2812 GPIOB -#define PIN_WS2812 15 +#define RGB_DI_PIN B15 +#define RGBLED_NUM 9 #define WS2812_SPI SPID2 - /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/cannonkeys/practice60/rules.mk b/keyboards/cannonkeys/practice60/rules.mk index 0eacb9c7b..395913736 100644 --- a/keyboards/cannonkeys/practice60/rules.mk +++ b/keyboards/cannonkeys/practice60/rules.mk @@ -22,6 +22,7 @@ SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes +WS2812_DRIVER = spi LAYOUTS = 60_ansi diff --git a/keyboards/cannonkeys/practice65/config.h b/keyboards/cannonkeys/practice65/config.h index 346af8ff3..d08d92e4c 100644 --- a/keyboards/cannonkeys/practice65/config.h +++ b/keyboards/cannonkeys/practice65/config.h @@ -52,14 +52,10 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE #define RGBLIGHT_ANIMATIONS - -#define WS2812_LED_N 20 -#define RGBLED_NUM WS2812_LED_N -#define PORT_WS2812 GPIOB -#define PIN_WS2812 15 +#define RGB_DI_PIN B15 +#define RGBLED_NUM 20 #define WS2812_SPI SPID2 - /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/cannonkeys/practice65/rules.mk b/keyboards/cannonkeys/practice65/rules.mk index 90a339bb3..d6d2b3fe7 100644 --- a/keyboards/cannonkeys/practice65/rules.mk +++ b/keyboards/cannonkeys/practice65/rules.mk @@ -22,7 +22,7 @@ SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes - +WS2812_DRIVER = spi # Enter lower-power sleep mode when on the ChibiOS idle thread OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE diff --git a/keyboards/cannonkeys/savage65/config.h b/keyboards/cannonkeys/savage65/config.h index 0839c0111..9c4dbdec4 100644 --- a/keyboards/cannonkeys/savage65/config.h +++ b/keyboards/cannonkeys/savage65/config.h @@ -49,11 +49,8 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE #define RGBLIGHT_ANIMATIONS - -#define WS2812_LED_N 20 -#define RGBLED_NUM WS2812_LED_N -#define PORT_WS2812 GPIOB -#define PIN_WS2812 15 +#define RGB_DI_PIN B15 +#define RGBLED_NUM 20 #define WS2812_SPI SPID2 // Backlight config starts after VIA's EEPROM usage, diff --git a/keyboards/cannonkeys/savage65/rules.mk b/keyboards/cannonkeys/savage65/rules.mk index bf4b9a289..86f6b4e0f 100644 --- a/keyboards/cannonkeys/savage65/rules.mk +++ b/keyboards/cannonkeys/savage65/rules.mk @@ -21,7 +21,7 @@ NKRO_ENABLE = yes # USB Nkey Rollover CUSTOM_MATRIX = no # Custom matrix file # BACKLIGHT_ENABLE = yes # This is broken on 072 for some reason RGBLIGHT_ENABLE = yes - +WS2812_DRIVER = spi # Enter lower-power sleep mode when on the ChibiOS idle thread OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE diff --git a/keyboards/cannonkeys/stm32f072/keyboard.c b/keyboards/cannonkeys/stm32f072/keyboard.c index fdda018fc..39f912506 100644 --- a/keyboards/cannonkeys/stm32f072/keyboard.c +++ b/keyboards/cannonkeys/stm32f072/keyboard.c @@ -5,8 +5,6 @@ #include "util.h" #include "quantum.h" -#include "ws2812.h" - #include "raw_hid.h" #include "dynamic_keymap.h" #include "tmk_core/common/eeprom.h" @@ -58,25 +56,11 @@ void matrix_init_kb(void){ via_init_kb(); via_eeprom_set_valid(true); #endif // VIA_ENABLE - /* MOSI pin*/ -#ifdef RGBLIGHT_ENABLE - palSetPadMode(PORT_WS2812, PIN_WS2812, PAL_MODE_ALTERNATE(0)); - wait_ms(500); - leds_init(); -#endif backlight_init_ports(); matrix_init_board(); } -void matrix_scan_kb(void) -{ - #ifdef RGBLIGHT_ENABLE - rgblight_task(); - #endif - matrix_scan_user(); -} - bool process_record_kb(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case BL_INC: diff --git a/keyboards/cannonkeys/stm32f072/ws2812.h b/keyboards/cannonkeys/stm32f072/ws2812.h deleted file mode 100644 index 9b545fcd5..000000000 --- a/keyboards/cannonkeys/stm32f072/ws2812.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "hal.h" -#include "color.h" - -void set_leds_color_rgb(LED_TYPE color); -void set_led_color_rgb(LED_TYPE color, int pos); -void leds_init(void); - - - // This is what users will use to interface with this -void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds); -void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds); - - -void WS2812_init(void); -void WS2812_set_color( uint8_t index, uint8_t red, uint8_t green, uint8_t blue ); -void WS2812_set_color_all( uint8_t red, uint8_t green, uint8_t blue ); -void WS2812_send_colors(void); diff --git a/keyboards/cannonkeys/tmov2/config.h b/keyboards/cannonkeys/tmov2/config.h index d8d95ae55..ef8d768f6 100644 --- a/keyboards/cannonkeys/tmov2/config.h +++ b/keyboards/cannonkeys/tmov2/config.h @@ -49,12 +49,10 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE #define RGBLIGHT_ANIMATIONS - -#define WS2812_LED_N 22 -#define RGBLED_NUM WS2812_LED_N -#define PORT_WS2812 GPIOB -#define PIN_WS2812 15 +#define RGB_DI_PIN B15 +#define RGBLED_NUM 22 #define WS2812_SPI SPID2 +#define WS2812_SPI_MOSI_PAL_MODE 0 // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. diff --git a/keyboards/cannonkeys/tmov2/rules.mk b/keyboards/cannonkeys/tmov2/rules.mk index 7d29079c3..686970ef8 100644 --- a/keyboards/cannonkeys/tmov2/rules.mk +++ b/keyboards/cannonkeys/tmov2/rules.mk @@ -21,7 +21,7 @@ NKRO_ENABLE = yes # USB Nkey Rollover CUSTOM_MATRIX = no # Custom matrix file # BACKLIGHT_ENABLE = yes # This is broken on 072 right now RGBLIGHT_ENABLE = yes - +WS2812_DRIVER = spi # Enter lower-power sleep mode when on the ChibiOS idle thread OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE diff --git a/keyboards/projectkb/alice/config.h b/keyboards/projectkb/alice/config.h index 262abdeb1..61648dc7d 100644 --- a/keyboards/projectkb/alice/config.h +++ b/keyboards/projectkb/alice/config.h @@ -49,11 +49,8 @@ along with this program. If not, see . #define LOCKING_RESYNC_ENABLE #define RGBLIGHT_ANIMATIONS - -#define WS2812_LED_N 14 -#define RGBLED_NUM WS2812_LED_N -#define PORT_WS2812 GPIOB -#define PIN_WS2812 15 +#define RGB_DI_PIN B15 +#define RGBLED_NUM 14 #define WS2812_SPI SPID2 // Backlight config starts after VIA's EEPROM usage, diff --git a/keyboards/projectkb/alice/rules.mk b/keyboards/projectkb/alice/rules.mk index 503bc7ad7..3bb6531af 100644 --- a/keyboards/projectkb/alice/rules.mk +++ b/keyboards/projectkb/alice/rules.mk @@ -21,6 +21,7 @@ NKRO_ENABLE = yes # USB Nkey Rollover CUSTOM_MATRIX = no # Custom matrix file # BACKLIGHT_ENABLE = yes # This is broken on 072 for some reason RGBLIGHT_ENABLE = yes +WS2812_DRIVER = spi # RAW_ENABLE = yes # DYNAMIC_KEYMAP_ENABLE = yes