Added fft visualizer
This commit is contained in:
@ -12,6 +12,9 @@
|
||||
//#define RGBLIGHT_EFFECT_TWINKLE
|
||||
|
||||
|
||||
// Custom effects
|
||||
#define RGB_MATRIX_DATAPOINTER_ENABLED
|
||||
|
||||
|
||||
// Normal matrix effects
|
||||
//#define DISABLE_RGB_MATRIX_SOLID_COLOR
|
||||
|
@ -1,92 +1,6 @@
|
||||
#include "keymap.h"
|
||||
|
||||
|
||||
// -1 => skip
|
||||
int8_t col_to_array[10][5] = {
|
||||
{ 47, 43, 38, 33, 28 },
|
||||
{ 46, 42, 37, 32, 27 },
|
||||
{ 45, 41, 36, 31, 26 },
|
||||
{ 44, 40, 35, 30, 25 },
|
||||
{ -1, 39, 34, 29, 24 },
|
||||
{ -1, 15, 10, 5, 0 },
|
||||
{ 20, 16, 11, 6, 1 },
|
||||
{ 21, 17, 12, 7, 2 },
|
||||
{ 22, 18, 13, 8, 3 },
|
||||
{ 23, 19, 14, 9, 4 }
|
||||
};
|
||||
|
||||
void cmd_animation(uint8_t *data, uint8_t length) {
|
||||
uint8_t subcmd = data[1];
|
||||
|
||||
|
||||
switch (subcmd) {
|
||||
case 0x02: // Data input (fft)
|
||||
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
// Turn off all LEDs
|
||||
rgb_matrix_set_color(
|
||||
i,
|
||||
0x00, 0x00, 0x00
|
||||
);
|
||||
}
|
||||
|
||||
for (uint8_t bin = 0; bin < 10; bin++) {
|
||||
uint8_t d = data[bin + 2];
|
||||
uint8_t bin_height = d / 20;
|
||||
uint8_t last_brightness = ((d % 20)/20.0) * 0xFF;
|
||||
|
||||
|
||||
if (bin_height == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < bin_height; i++) {
|
||||
if (col_to_array[bin][i] < 0) {
|
||||
continue;
|
||||
}
|
||||
if (i == bin_height - 1) {
|
||||
rgb_matrix_set_color(
|
||||
col_to_array[bin][i],
|
||||
last_brightness, 0x00, last_brightness
|
||||
);
|
||||
} else {
|
||||
rgb_matrix_set_color(
|
||||
col_to_array[bin][i],
|
||||
0x00, 0x00, 0xFF
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
||||
uint8_t cmd = data[0];
|
||||
|
||||
switch (cmd) {
|
||||
case 0x01: // animation
|
||||
cmd_animation(data, length);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
raw_hid_send(data, length);
|
||||
|
||||
ergodox_right_led_1_on();
|
||||
_delay_ms(10);
|
||||
ergodox_right_led_1_off();
|
||||
|
||||
i2c_start(0x14, ERGODOX_EZ_I2C_TIMEOUT);
|
||||
i2c_write(0, ERGODOX_EZ_I2C_TIMEOUT);
|
||||
i2c_stop();
|
||||
*/
|
||||
}
|
||||
|
||||
// Define custom keys
|
||||
// (Must be done BEFORE keymaps)
|
||||
enum custom_keycodes {
|
||||
@ -157,10 +71,7 @@ const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = {
|
||||
|
||||
int current_lang = LANG_EN;
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
//set_lang(LANG_EN);
|
||||
}
|
||||
|
||||
void keyboard_post_init_user(void) {}
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
# Set any rules.mk overrides for your specific keymap here.
|
||||
# See rules at https://docs.qmk.fm/#/config_options?id=the-rulesmk-file
|
||||
CONSOLE_ENABLE = no
|
||||
COMMAND_ENABLE = no
|
||||
# rules.mk overrides
|
||||
|
||||
TAP_DANCE_ENABLE = yes
|
||||
SRC = \
|
||||
matrix.c \
|
||||
|
||||
SRC += \
|
||||
tapdance/wmlayout.c \
|
||||
tapdance/tapdance.c
|
||||
|
Reference in New Issue
Block a user