Port Soft-AP web UI and LED engine onto Pico 2 W C firmware.
Serve the ESP32 frontend over httpserver/WebSocket, drive eight WS2812 strips with PIO/DMA patterns on core1, and keep Wi-Fi control on core0. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
b783d97f13
commit
b3e9fc9663
28 files changed
+5123
-14
No files matched your search
@@ -0,0 +1,53 @@
|
||||
#ifndef HTTPSERVER_H
|
||||
#define HTTPSERVER_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct httpserver httpserver_t;
|
||||
typedef struct httpserver_conn httpserver_conn_t;
|
||||
|
||||
typedef void (*httpserver_handler_t)(httpserver_conn_t *conn, const char *path, const char *query);
|
||||
typedef void (*httpserver_ws_open_t)(httpserver_conn_t *ws);
|
||||
typedef void (*httpserver_ws_msg_t)(httpserver_conn_t *ws, const uint8_t *data, size_t len, bool text);
|
||||
typedef void (*httpserver_ws_close_t)(httpserver_conn_t *ws);
|
||||
|
||||
httpserver_t *httpserver_create(void);
|
||||
|
||||
void httpserver_route(httpserver_t *s, const char *method, const char *path, httpserver_handler_t fn);
|
||||
|
||||
void httpserver_websocket(httpserver_t *s, const char *path,
|
||||
httpserver_ws_open_t on_open,
|
||||
httpserver_ws_msg_t on_msg,
|
||||
httpserver_ws_close_t on_close);
|
||||
|
||||
bool httpserver_listen(httpserver_t *s, uint16_t port);
|
||||
|
||||
void httpserver_send(httpserver_conn_t *conn, int status, const char *content_type,
|
||||
const void *body, size_t body_len);
|
||||
|
||||
/* Stream a large const body (no copy of entire file into conn buffer). */
|
||||
void httpserver_send_static(httpserver_conn_t *conn, int status, const char *content_type,
|
||||
const uint8_t *body, size_t body_len);
|
||||
|
||||
void httpserver_send_html(httpserver_conn_t *conn, const char *html);
|
||||
|
||||
/* POST/PUT body after headers (points into connection buffer). */
|
||||
const char *httpserver_request_body(httpserver_conn_t *conn, size_t *len_out);
|
||||
|
||||
bool httpserver_ws_send(httpserver_conn_t *ws, const void *data, size_t len, bool text);
|
||||
|
||||
void httpserver_ws_broadcast(httpserver_t *s, const void *data, size_t len, bool text);
|
||||
|
||||
httpserver_t *httpserver_conn_server(httpserver_conn_t *conn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user