So that was quick! Hot on the heels of the key mapping to the pins, it turns out that the RGB LEDs are WS2812 connected to P3.4, and CH55xduino has some example code for that already!
#include <WS2812.h>
#define NUM_LEDS 3
#define COLOR_PER_LEDS 3
#define NUM_BYTES (NUM_LEDS*COLOR_PER_LEDS)
__xdata uint8_t ledData[NUM_BYTES];
void setup() {
pinMode(34, OUTPUT);
}
void loop() {
for (uint8_t i = 0; i < NUM_LEDS; i++) {
set_pixel_for_GRB_LED(ledData, i, 255, 0, 0);
neopixel_show_P3_4(ledData, NUM_BYTES);
delay(100);
}
for (uint8_t i = 0; i < NUM_LEDS; i++) {
set_pixel_for_GRB_LED(ledData, i, 0, 255, 0);
neopixel_show_P3_4(ledData, NUM_BYTES);
delay(100);
}
for (uint8_t i = 0; i < NUM_LEDS; i++) {
set_pixel_for_GRB_LED(ledData, i, 0, 0, 255);
neopixel_show_P3_4(ledData, NUM_BYTES);
delay(100);
}
}
So only the rotary knob is left to figure out, and after that the HID stuff (but CH55xduino has plenty of examples on that). Pins left are P1.4 P1.5 P3.0 P3.1 P3.2 and P3.3.
This will be my quickest project ever by a long shot.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.