aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-11-13 23:02:38 -0500
committerJack Humbert <jack.humb@gmail.com>2016-11-13 23:02:38 -0500
commite9f748751808de2f1e85cf7fb670d78773bd5e76 (patch)
tree1e52f15aed8e83f3784a6c10b1a04e3d8b6df4fe /tmk_core
parent33e62c080c9161a0fc921c90ed299a67fc2e1799 (diff)
downloadfirmware-e9f748751808de2f1e85cf7fb670d78773bd5e76.tar.gz
firmware-e9f748751808de2f1e85cf7fb670d78773bd5e76.tar.bz2
firmware-e9f748751808de2f1e85cf7fb670d78773bd5e76.zip
mostly working
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/lufa/lufa.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 01c0e45b0..fe466f604 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -71,6 +71,10 @@
#include "virtser.h"
#endif
+#ifdef RGB_MIDI
+ #include "rgblight.h"
+#endif
+
uint8_t keyboard_idle = 0;
/* 0: Boot Protocol, 1: Report Protocol(default) */
uint8_t keyboard_protocol = 1;
@@ -1045,6 +1049,10 @@ int main(void)
#endif
keyboard_task();
+#ifdef RGBLIGHT_ENABLE
+ rgblight_task();
+#endif
+
#ifdef VIRTSER_ENABLE
virtser_task();
CDC_Device_USBTask(&cdc_device);
@@ -1077,15 +1085,34 @@ void fallthrough_callback(MidiDevice * device,
#endif
}
+#ifdef RGB_MIDI
+ rgblight_config_t rgblight_config;
+#endif
+
void cc_callback(MidiDevice * device,
uint8_t chan, uint8_t num, uint8_t val) {
//sending it back on the next channel
- midi_send_cc(device, (chan + 1) % 16, num, val);
+ // midi_send_cc(device, (chan + 1) % 16, num, val);
+ #ifdef RGB_MIDI
+ rgblight_config.raw = eeconfig_read_rgblight();
+ switch (num) {
+ case 14:
+ rgblight_config.hue = val * 360 / 127;
+ break;
+ case 15:
+ rgblight_config.sat = val << 1;
+ break;
+ case 16:
+ rgblight_config.val = val << 1;
+ break;
+ }
+ rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
+ #endif
}
void sysex_callback(MidiDevice * device,
uint16_t start, uint8_t length, uint8_t * data) {
- for (int i = 0; i < length; i++)
- midi_send_cc(device, 15, 0x7F & data[i], 0x7F & (start + i));
+ // for (int i = 0; i < length; i++)
+ // midi_send_cc(device, 15, 0x7F & data[i], 0x7F & (start + i));
}
#endif