Add UDP transport with picomap port 28781, info -udp flag

This commit is contained in:
Ian Gulliver
2026-04-07 21:36:50 +09:00
parent 3d749add7d
commit 9989d8c66a
5 changed files with 185 additions and 13 deletions

View File

@@ -30,6 +30,14 @@ void dispatch_schedule_ms(uint32_t ms, std::function<void()> fn) {
static usb_cdc usb;
static static_vector<uint8_t, 256> usb_rx_buf;
net_set_handler([&](std::span<const uint8_t> payload) -> std::vector<std::vector<uint8_t>> {
auto msg = try_decode(payload.data(), payload.size());
if (!msg) return {};
auto it = handler_map.find(msg->type_id);
if (it == handler_map.end()) return {};
return it->second(msg->message_id, msg->payload);
});
while (true) {
dlog_if_slow("tud_task", 1000, [&]{ tud_task(); });
dlog_if_slow("drain", 1000, [&]{ usb.drain(); });