Merge pull request #47 from algernon/f/LED/crgb-at-pos

Implement Model01::led_set_crgb_at(row, col, color)
pull/46/head
Jesse Vincent 8 years ago committed by GitHub
commit 3c69881157

@ -6,6 +6,9 @@ HARDWARE_IMPLEMENTATION KeyboardHardware;
void led_set_crgb_at(uint8_t i, cRGB crgb) {
KeyboardHardware.led_set_crgb_at(i,crgb);
}
void led_set_crgb_at(byte row, byte col, cRGB color) {
KeyboardHardware.led_set_crgb_at(row,col,color);
}
cRGB led_get_crgb_at(uint8_t i) {
return KeyboardHardware.led_get_crgb_at(i);
}

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

@ -2,6 +2,13 @@
KeyboardioScanner Model01::leftHand(0);
KeyboardioScanner Model01::rightHand(3);
static constexpr uint8_t key_led_map[4][16] = {
{3,4,11,12,19,20,26,27, 36,37,43,44,51,52,59,60},
{2,5,10,13,18,21,31,28, 35,32,42,45,50,53,58,61},
{1,6,9,14, 17,22,25,29, 34,38,41,46,49,54,57,62},
{0,7,8,15,16,23,24,30, 33,39,40,47,48,55,56,63},
};
Model01::Model01(void) {
}
@ -55,6 +62,10 @@ void Model01::led_set_crgb_at(uint8_t i, cRGB crgb) {
}
}
void Model01::led_set_crgb_at(byte row, byte col, cRGB color) {
led_set_crgb_at(key_led_map[row][col], color);
}
cRGB Model01::led_get_crgb_at(uint8_t i) {
if(i<32) {
return leftHand.ledData.leds[i];

@ -37,15 +37,6 @@ class Model01 {
private:
static KeyboardioScanner leftHand;
static KeyboardioScanner rightHand;
static constexpr uint8_t key_led_map[4][16] = {
{3,4,11,12,19,20,26,27, 36,37,43,44,51,52,59,60},
{2,5,10,13,18,21,31,28, 35,32,42,45,50,53,58,61},
{1,6,9,14, 17,22,25,29, 34,38,41,46,49,54,57,62},
{0,7,8,15,16,23,24,30, 33,39,40,47,48,55,56,63},
};
};
#define SCANBIT(row,col) ((uint32_t)1 << (row * 8 + (7 - col)))

Loading…
Cancel
Save