Skip to content

Commit

Permalink
[Keyboard] Switch to RGB Matrix for Super16 (#8305)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored Mar 4, 2020
1 parent 0c9171a commit 0275098
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 40 deletions.
35 changes: 22 additions & 13 deletions keyboards/1upkeyboards/super16/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define MATRIX_ROW_PINS { D1, D0, F4, F5 }
#define MATRIX_COL_PINS { D4, C6, F6, F7 }
*/
#define MATRIX_ROW_PINS \
{ D1, D0, F4, F5 }
#define MATRIX_COL_PINS \
{ D4, C6, F6, F7 }
#define UNUSED_PINS

/* COL2ROW, ROW2COL*/
Expand All @@ -51,23 +53,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
*/
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6

// #define BACKLIGHT_PIN B7
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3

#define RGB_DI_PIN D3
#ifdef RGB_DI_PIN
#define RGBLED_NUM 16 // Add 12 if attaching the RGB LED ring
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
/*== all animations enable ==*/
#define RGBLIGHT_ANIMATIONS
/*== or choose animations ==*/
# define RGBLED_NUM 16 // Add 12 if attaching the RGB LED ring
# define DRIVER_LED_TOTAL RGBLED_NUM
# ifdef RGBLIGHT_ENABLE
# define RGBLIGHT_HUE_STEP 8
# define RGBLIGHT_SAT_STEP 8
# define RGBLIGHT_VAL_STEP 8
# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
/*== all animations enable ==*/
# define RGBLIGHT_ANIMATIONS
/*== or choose animations ==*/
// #define RGBLIGHT_EFFECT_BREATHING
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
Expand All @@ -77,6 +81,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
// #define RGBLIGHT_EFFECT_RGB_TEST
// #define RGBLIGHT_EFFECT_ALTERNATING
# elif defined RGB_MATRIX_ENABLE
# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS // reacts to keyreleases (instead of keypresses)

# endif
#endif

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
Expand Down
3 changes: 2 additions & 1 deletion keyboards/1upkeyboards/super16/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
RGB_MATRIX_ENABLE = WS2812
MIDI_ENABLE = no # MIDI support
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
Expand Down
46 changes: 20 additions & 26 deletions keyboards/1upkeyboards/super16/super16.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,23 @@
*/
#include "super16.h"

void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up

matrix_init_user();
}

void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)

matrix_scan_user();
}

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware

return process_record_user(keycode, record);
}

void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here

led_set_user(usb_led);
}
led_config_t g_led_config = { {
// Key Matrix to LED Index
{ 0, 1, 2, 3 },
{ 7, 6, 5, 4 },
{ 8, 9, 10, 11 },
{ 15, 14, 13, 12 }
}, {
// LED Index to Physical Position
{ 0, 0 }, { 75, 0 }, { 150, 0 }, { 224, 0 },
{ 224, 21 }, { 150, 21 }, { 75, 21 }, { 0, 21 },
{ 0, 43 }, { 75, 43 }, { 150, 43 }, { 224, 43 },
{ 224, 64 }, { 150, 64 }, { 75, 64 }, { 0, 64 },

}, {
// LED Index to Flag
4, 4, 4, 4,
4, 4, 4, 4,
4, 4, 4, 4,
4, 4, 4, 4
} };

0 comments on commit 0275098

Please sign in to comment.