53 lines
1.0 KiB
C
53 lines
1.0 KiB
C
#include "betalupi_ergodox.h"
|
|
|
|
void raw_hid_receive(uint8_t *data, uint8_t length);
|
|
|
|
#ifdef RGB_MATRIX_DATAPOINTER_ENABLED
|
|
void cmd_animation(uint8_t *data, uint8_t length);
|
|
|
|
// Animation data.
|
|
// Data received from host is saved here,
|
|
// and rgb_matrix_anim_data points to this array when necessary.
|
|
uint8_t hid_anim_data[32];
|
|
|
|
// Datapointer
|
|
extern void* rgb_matrix_anim_data;
|
|
#endif
|
|
|
|
// END HEADERS
|
|
|
|
|
|
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
|
uint8_t cmd = data[0];
|
|
|
|
switch (cmd) {
|
|
#ifdef RGB_MATRIX_DATAPOINTER_ENABLED
|
|
case 0x01: // Animation
|
|
cmd_animation(data, length);
|
|
break;
|
|
#endif
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
// raw_hid_send(data, length);
|
|
}
|
|
|
|
#ifdef RGB_MATRIX_DATAPOINTER_ENABLED
|
|
void cmd_animation(uint8_t *data, uint8_t length) {
|
|
uint8_t subcmd = data[1];
|
|
|
|
switch (subcmd) {
|
|
case 0x02: // Data input (fft)
|
|
|
|
// TODO: assign pointer smartly.
|
|
rgb_matrix_anim_data = hid_anim_data;
|
|
|
|
for (uint8_t bin = 0; bin < 10; bin++) {
|
|
hid_anim_data[bin] = data[bin + 2];
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
#endif |