cleanup
This commit is contained in:
+4
-1
@@ -49,7 +49,10 @@ target_compile_options(${PROJECT} PRIVATE ) #-Wall -Wextra
|
||||
target_compile_definitions(${PROJECT} PRIVATE PIO_USB_USE_TINYUSB)
|
||||
|
||||
# needed so tinyusb can find tusb_config.h
|
||||
target_include_directories(${PROJECT} PRIVATE ${CMAKE_CURRENT_LIST_DIR} ${TUSB_NETWORKING_PATH})
|
||||
target_include_directories(${PROJECT} PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
${TUSB_NETWORKING_PATH}
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT} PRIVATE
|
||||
pico_lwip
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -96,10 +96,6 @@
|
||||
|
||||
#define CFG_TUD_HID_EP_BUFSIZE 64
|
||||
|
||||
// NCM settings
|
||||
//#define CFG_TUD_NCM_OUT_MAX_DATAGRAMS_PER_NTB 1
|
||||
//#define CFG_TUD_NCM_IN_MAX_DATAGRAMS_PER_NTB 1
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// HOST CONFIGURATION
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
+1
-5
@@ -73,6 +73,7 @@ void usb_device_main(void) {
|
||||
device_state = DEVICE_INACTIVE;
|
||||
usb_device_init();
|
||||
|
||||
// start the web server on USB
|
||||
usb_server_init();
|
||||
|
||||
while (true) {
|
||||
@@ -252,8 +253,3 @@ void cdc_print_hex(uint8_t const* msg, uint16_t msg_len) {
|
||||
}
|
||||
tud_cdc_write_str("\n");
|
||||
}
|
||||
|
||||
// print message to CDC
|
||||
void cdc_print(uint8_t const* msg, uint16_t msg_len) {
|
||||
tud_cdc_write(msg, msg_len);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ extern device_state_t device_state;
|
||||
|
||||
void usb_device_main(void);
|
||||
void cdc_print_hex(uint8_t const* msg, uint16_t msg_len);
|
||||
void cdc_print(uint8_t const* msg, uint16_t msg_len);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ static void report_desc_init(struct report_desc *descriptor) {
|
||||
descriptor->next = NULL;
|
||||
}
|
||||
|
||||
// free memory and teardown usb->bt report ID mappings for report descriptor struct
|
||||
// free memory for report descriptor struct
|
||||
static void report_desc_free(struct report_desc *descriptor) {
|
||||
if (descriptor != NULL) {
|
||||
if (descriptors == descriptor) {
|
||||
|
||||
Reference in New Issue
Block a user