Replace serial/Wi-Fi driver transport paths with WebSocket bridge client, binary espnow_wire delivery, device announce registry, and restructured espnow-sender (AP + broadcast passthrough). Includes docs and tests. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
772 B
Python
29 lines
772 B
Python
# aioespnow module for MicroPython on ESP32 and ESP8266
|
|
# MIT license; Copyright (c) 2022 Glenn Moloney @glenn20
|
|
# Vendored from micropython-lib/micropython/aioespnow
|
|
|
|
import asyncio
|
|
import espnow
|
|
|
|
|
|
class AIOESPNow(espnow.ESPNow):
|
|
async def arecv(self):
|
|
yield asyncio.core._io_queue.queue_read(self)
|
|
return self.recv(0)
|
|
|
|
async def airecv(self):
|
|
yield asyncio.core._io_queue.queue_read(self)
|
|
return self.irecv(0)
|
|
|
|
async def asend(self, mac, msg=None, sync=None):
|
|
if msg is None:
|
|
msg, mac = mac, None
|
|
yield asyncio.core._io_queue.queue_write(self)
|
|
return self.send(mac, msg, sync)
|
|
|
|
def __aiter__(self):
|
|
return self
|
|
|
|
async def __anext__(self):
|
|
return await self.airecv()
|