mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-24 20:21:49 +00:00
Change driver API: up(ifp) -> poll(ifp, 1second)
Add misc extras required by Wi-Fi drivers (in progress)
This commit is contained in:
1 parent
8906b1ac0f
commit
065027843e
30 files changed
+359
-248
No files matched your search
@@ -52,9 +52,10 @@ static size_t usb_tx(const void *buf, size_t len, struct mg_tcpip_if *ifp) {
|
||||
return len;
|
||||
}
|
||||
|
||||
static bool usb_up(struct mg_tcpip_if *ifp) {
|
||||
static bool usb_poll(struct mg_tcpip_if *ifp, bool s1) {
|
||||
(void) ifp;
|
||||
return tud_inited() && tud_ready() && tud_connected();
|
||||
tud_task();
|
||||
return s1 ? tud_inited() && tud_ready() && tud_connected() : false;
|
||||
}
|
||||
|
||||
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_dta) {
|
||||
@@ -69,7 +70,7 @@ int main(void) {
|
||||
struct mg_mgr mgr; // Initialise Mongoose event manager
|
||||
mg_mgr_init(&mgr); // and attach it to the interface
|
||||
|
||||
struct mg_tcpip_driver driver = {.tx = usb_tx, .up = usb_up};
|
||||
struct mg_tcpip_driver driver = {.tx = usb_tx, .poll = usb_poll};
|
||||
struct mg_tcpip_if mif = {.mac = {2, 0, 1, 2, 3, 0x77},
|
||||
.ip = mg_htonl(MG_U32(192, 168, 3, 1)),
|
||||
.mask = mg_htonl(MG_U32(255, 255, 255, 0)),
|
||||
@@ -87,7 +88,6 @@ int main(void) {
|
||||
MG_INFO(("Starting event loop"));
|
||||
for (;;) {
|
||||
mg_mgr_poll(&mgr, 0);
|
||||
tud_task();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user