Add a 'get_crgb_at' API

pull/18/head
Jesse Vincent 9 years ago
parent 0cfef37d44
commit ec40cfbbfb

@ -6,6 +6,9 @@ HARDWARE_IMPLEMENTATION KeyboardHardware;
void led_set_crgb_at(uint8_t i, cRGB crgb) { void led_set_crgb_at(uint8_t i, cRGB crgb) {
KeyboardHardware.led_set_crgb_at(i,crgb); KeyboardHardware.led_set_crgb_at(i,crgb);
} }
cRGB led_get_crgb_at(uint8_t i){
KeyboardHardware.led_get_crgb_at(i);
}
void led_sync(void) { void led_sync(void) {
KeyboardHardware.led_sync(); KeyboardHardware.led_sync();
} }

@ -10,6 +10,7 @@
// and the 'userspace' LED implementation. If my C++ were stronger, there woudl // and the 'userspace' LED implementation. If my C++ were stronger, there woudl
// certainly be a better way -JV 2016-02-01 // certainly be a better way -JV 2016-02-01
void led_set_crgb_at(uint8_t i, cRGB crgb); void led_set_crgb_at(uint8_t i, cRGB crgb);
cRGB led_get_crgb_at(uint8_t i);
void led_sync(void); void led_sync(void);

@ -45,6 +45,14 @@ void Model01::led_set_crgb_at(uint8_t i, cRGB crgb) {
} }
} }
cRGB Model01::led_get_crgb_at(uint8_t i) {
if(i<32) {
return leftHand.ledData.leds[i];
} else if (i<64) {
return rightHand.ledData.leds[i-32] ;
}
}
void Model01::led_sync() { void Model01::led_sync() {
rightHand.sendLEDData(); rightHand.sendLEDData();
rightHand.sendLEDData(); rightHand.sendLEDData();

@ -20,6 +20,7 @@ class Model01 {
void led_sync(void); void led_sync(void);
void led_set_crgb_at(byte row, byte col, cRGB color); void led_set_crgb_at(byte row, byte col, cRGB color);
void led_set_crgb_at(uint8_t i, cRGB crgb); void led_set_crgb_at(uint8_t i, cRGB crgb);
cRGB led_get_crgb_at(uint8_t i);
cRGB get_key_color(byte row, byte col); cRGB get_key_color(byte row, byte col);
void scan_matrix(void); void scan_matrix(void);

Loading…
Cancel
Save