add individual LED configuration over USB ethernet

This commit is contained in:
2025-08-27 15:01:11 -04:00
parent c6ac21a15b
commit 2fac602e44
21 changed files with 3139 additions and 132 deletions
+36
View File
@@ -0,0 +1,36 @@
#ifndef WEBSOCKET_H_
#define WEBSOCKET_H_
#define WS_PORT 8080
#define WS_TIMEOUT 10
#define WS_DEBUG LWIP_DBG_ON
#define WS_MAX_RETRIES 10
#define WS_POLL_INTERVAL 60 // WS_POLL_INTERVAL/2 seconds
#define WS_MAX_CONN 4
#define WS_BUFFER_SIZE 512
#define OP_CONT 0x00
#define OP_TEXT 0x01
#define OP_BINARY 0x02
#define OP_CLOSE 0x08
#define OP_PING 0x09
#define OP_PONG 0x0A
struct ws_state {
bool active;
uint8_t retries;
struct altcp_pcb *pcb;
struct ws_state *next;
};
#define WS_ALLOC_WS_STATE() (struct ws_state *)mem_malloc(sizeof(struct ws_state))
typedef void (* tWSHandler ) (uint8_t *data, uint16_t len);
typedef void (* tWSOpenHandler ) (struct ws_state * wss);
void ws_server_init(void);
void ws_send_all(uint8_t *data, uint16_t len);
void ws_set_receive_handler( tWSHandler ws_handler);
void ws_set_open_handler( tWSOpenHandler ws_handler);
#endif