CamelCaseifcation of LED related functions

s/led_set_crgb_at/setCrgbAt/
s/hsv_to_rgb/hsvToRgb/
s/led_get_crgb_at/getCrgbAt/
s/led_sync/syncLeds/
s/get_led_index/getLedIndex/
s/send_led_data/sendLedData/
s/led_power_fault/ledPowerFault/
pull/365/head
Jesse Vincent 7 years ago
parent a8faa2d594
commit a84060e8d1
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -4,11 +4,11 @@
#ifdef ARDUINO_AVR_MODEL01 #ifdef ARDUINO_AVR_MODEL01
static void static void
type_letter(uint8_t letter) { type_letter(uint8_t letter) {
LEDControl.led_set_crgb_at(letter, {255, 0, 0}); LEDControl.setCrgbAt(letter, {255, 0, 0});
LEDControl.led_sync(); LEDControl.syncLeds();
delay(250); delay(250);
LEDControl.led_set_crgb_at(letter, {0, 0, 0}); LEDControl.setCrgbAt(letter, {0, 0, 0});
LEDControl.led_sync(); LEDControl.syncLeds();
delay(10); delay(10);
} }
#endif #endif

@ -100,28 +100,28 @@ LEDControl_::set_all_leds_to(uint8_t r, uint8_t g, uint8_t b) {
void void
LEDControl_::set_all_leds_to(cRGB color) { LEDControl_::set_all_leds_to(cRGB color) {
for (uint8_t i = 0; i < LED_COUNT; i++) { for (uint8_t i = 0; i < LED_COUNT; i++) {
led_set_crgb_at(i, color); setCrgbAt(i, color);
} }
} }
void void
LEDControl_::led_set_crgb_at(uint8_t i, cRGB crgb) { LEDControl_::setCrgbAt(uint8_t i, cRGB crgb) {
KeyboardHardware.led_set_crgb_at(i, crgb); KeyboardHardware.setCrgbAt(i, crgb);
} }
void void
LEDControl_::led_set_crgb_at(byte row, byte col, cRGB color) { LEDControl_::setCrgbAt(byte row, byte col, cRGB color) {
KeyboardHardware.led_set_crgb_at(row, col, color); KeyboardHardware.setCrgbAt(row, col, color);
} }
cRGB cRGB
LEDControl_::led_get_crgb_at(uint8_t i) { LEDControl_::getCrgbAt(uint8_t i) {
return KeyboardHardware.led_get_crgb_at(i); return KeyboardHardware.getCrgbAt(i);
} }
void void
LEDControl_::led_sync(void) { LEDControl_::syncLeds(void) {
KeyboardHardware.led_sync(); KeyboardHardware.syncLeds();
} }
void void
@ -156,7 +156,7 @@ LEDControl_::loopHook(bool postClear) {
return; return;
if (millis() > syncTimer) { if (millis() > syncTimer) {
led_sync(); syncLeds();
syncTimer = millis() + syncDelay; syncTimer = millis() + syncDelay;
} }
update(); update();
@ -189,7 +189,7 @@ LEDControl_::focusHook(const char *command) {
uint8_t idx = Serial.parseInt(); uint8_t idx = Serial.parseInt();
if (Serial.peek() == '\n') { if (Serial.peek() == '\n') {
cRGB c = LEDControl.led_get_crgb_at(idx); cRGB c = LEDControl.getCrgbAt(idx);
Focus.printColor(c.r, c.g, c.b); Focus.printColor(c.r, c.g, c.b);
Serial.println(); Serial.println();
@ -200,7 +200,7 @@ LEDControl_::focusHook(const char *command) {
c.g = Serial.parseInt(); c.g = Serial.parseInt();
c.b = Serial.parseInt(); c.b = Serial.parseInt();
LEDControl.led_set_crgb_at(idx, c); LEDControl.setCrgbAt(idx, c);
} }
break; break;
} }
@ -235,7 +235,7 @@ LEDControl_::focusHook(const char *command) {
case THEME: { case THEME: {
if (Serial.peek() == '\n') { if (Serial.peek() == '\n') {
for (uint8_t idx = 0; idx < LED_COUNT; idx++) { for (uint8_t idx = 0; idx < LED_COUNT; idx++) {
cRGB c = LEDControl.led_get_crgb_at(idx); cRGB c = LEDControl.getCrgbAt(idx);
Focus.printColor(c.r, c.g, c.b); Focus.printColor(c.r, c.g, c.b);
Focus.printSpace(); Focus.printSpace();
@ -252,7 +252,7 @@ LEDControl_::focusHook(const char *command) {
color.g = Serial.parseInt(); color.g = Serial.parseInt();
color.b = Serial.parseInt(); color.b = Serial.parseInt();
LEDControl.led_set_crgb_at(idx, color); LEDControl.setCrgbAt(idx, color);
idx++; idx++;
} }
break; break;

@ -32,10 +32,10 @@ class LEDControl_ : public KaleidoscopePlugin {
static int8_t mode_add(LEDMode *mode); static int8_t mode_add(LEDMode *mode);
static void led_set_crgb_at(uint8_t i, cRGB crgb); static void setCrgbAt(uint8_t i, cRGB crgb);
static void led_set_crgb_at(byte row, byte col, cRGB color); static void setCrgbAt(byte row, byte col, cRGB color);
static cRGB led_get_crgb_at(uint8_t i); static cRGB getCrgbAt(uint8_t i);
static void led_sync(void); static void syncLeds(void);
static void set_all_leds_to(uint8_t r, uint8_t g, uint8_t b); static void set_all_leds_to(uint8_t r, uint8_t g, uint8_t b);
static void set_all_leds_to(cRGB color); static void set_all_leds_to(cRGB color);

@ -17,14 +17,14 @@ breath_compute() {
i = (((3 * (uint16_t)(ii)) - (2 * (uint16_t)(iii))) / 2) + 2; i = (((3 * (uint16_t)(ii)) - (2 * (uint16_t)(iii))) / 2) + 2;
return hsv_to_rgb(200, 255, i); return hsvToRgb(200, 255, i);
} }
// From http://web.mit.edu/storborg/Public/hsvtorgb.c - talk to Scott about licensing // From http://web.mit.edu/storborg/Public/hsvtorgb.c - talk to Scott about licensing
cRGB cRGB
hsv_to_rgb(uint16_t h, uint16_t s, uint16_t v) { hsvToRgb(uint16_t h, uint16_t s, uint16_t v) {
cRGB color; cRGB color;
/* HSV to RGB conversion function with only integer /* HSV to RGB conversion function with only integer

@ -3,4 +3,4 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
cRGB breath_compute(void); cRGB breath_compute(void);
cRGB hsv_to_rgb(uint16_t h, uint16_t s, uint16_t v); cRGB hsvToRgb(uint16_t h, uint16_t s, uint16_t v);

Loading…
Cancel
Save