37 usb_.setHostMac(link_.macAddress());
44 stats_.user_data =
this;
45 stats_.do_work = &Rp2040Dongle::statsCb;
46 if (!async_context_add_at_time_worker_in_ms(__getEthernetContext(), &stats_, statsMs_)) {
47 TWD_LOGGER.warning(
"status line: could not start its worker");
67 async_at_time_worker_t stats_ = {};
68 uint32_t statsMs_ = 0;
70 static void statsCb(async_context_t*, async_at_time_worker_t* w) {
72 L2Bridge::Stats b = s->bridge_.stats();
73 Rp2040UsbNcm::Stats u = s->usb_.stats();
74 TWD_LOGGER.info(
"w%d toL=%u toH=%u rf=%u dr=%u | u rx=%u tx=%u td=%u rd=%u q=%u", (
int)s->link_.connected(),
75 (
unsigned)b.toLink, (
unsigned)b.toHost, (
unsigned)b.reflected, (
unsigned)b.dropped,
76 (
unsigned)u.rxFrames, (
unsigned)u.txFrames, (
unsigned)u.txDrops, (
unsigned)u.rxDrops,
77 (
unsigned)s->usb_.txQueued());
78 w->next_time = make_timeout_time_ms(s->statsMs_);
static twd::LoggerClass TWD_LOGGER
The logger used by all components; configure it in the sketch with TWD_LOGGER.begin(Serial).
Layer-2 bridge between the USB host and the uplink network.
bool uplinkConnected()
True while the board is associated with the access point.
bool begin(const TinyWifiDongleConfig &cfg)
Start USB and WiFi and bridge them; false if a part could not be started.
bool usbReady()
True once the USB host has configured the adapter.
L2Bridge::Stats bridgeStats() const
Counters of the bridge since start.
Rp2040UsbNcm::Stats usbStats() const
Counters of the USB side since start.
USB CDC-NCM network device for the Raspberry Pi Pico W / Pico 2 W.
Raw Ethernet access to the WiFi network through the CYW43 chip of the Pico W / Pico 2 W.
Settings of the dongle; every field has a usable default except the SSID.
const char * productName
USB product string shown on the host.
const char * password
Password of the network (nullptr for an open network).
const char * ssid
WiFi network the MCU joins (the "uplink").