cleanup
This commit is contained in:
@@ -29,7 +29,6 @@ static void send_color(uint8_t dev_addr);
|
||||
static void send_initial(uint8_t dev_addr);
|
||||
static struct key * find_key(char * name);
|
||||
static void set_color(char * name, uint8_t red, uint8_t green, uint8_t blue, uint8_t mode);
|
||||
static void set_color_all(uint8_t red, uint8_t green, uint8_t blue, uint8_t mode);
|
||||
|
||||
static struct key key_list[NUM_KEYS] =
|
||||
{
|
||||
@@ -144,7 +143,6 @@ static struct key key_list[NUM_KEYS] =
|
||||
|
||||
void get_light() {
|
||||
// get ADC reading from LDR every 500ms
|
||||
// if above threshold, set backlight to off
|
||||
if ( absolute_time_diff_us(lastRead, get_absolute_time()) >= 500000) {
|
||||
adc_value = adc_read();
|
||||
}
|
||||
@@ -316,20 +314,6 @@ static void set_color(char * name, uint8_t red, uint8_t green, uint8_t blue, uin
|
||||
}
|
||||
}
|
||||
|
||||
// set RGB color for all keys
|
||||
static void set_color_all(uint8_t red, uint8_t green, uint8_t blue, uint8_t mode) {
|
||||
for (uint8_t i=0; i<NUM_KEYS; i++) {
|
||||
key_list[i].red = red;
|
||||
key_list[i].green = green;
|
||||
key_list[i].blue = blue;
|
||||
// don't change modes on MUTE only to preserve toggling behavior
|
||||
// user can set manually from GUI if desired
|
||||
if (key_list[i].val != KEY_MUTE) {
|
||||
key_list[i].mode = mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// parse color request from webpage and update keyboard colors
|
||||
void parse_colors(char * data, uint16_t len) {
|
||||
(void) len;
|
||||
@@ -341,7 +325,7 @@ void parse_colors(char * data, uint16_t len) {
|
||||
if (token != NULL) {
|
||||
// first string is the RGB color code
|
||||
uint8_t red, green, blue;
|
||||
sscanf(token, "%02x%02x%02x", &red, &green, &blue);
|
||||
sscanf(token, "%2x%2x%2x", &red, &green, &blue);
|
||||
|
||||
token = strtok(NULL, ",");
|
||||
if (token != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user