|
TinyWifiDongle 0.1.0
Header-only USB WiFi dongle for Arduino
|
USB CDC-NCM network device for the Raspberry Pi Pico W / Pico 2 W. More...
#include <Rp2040UsbNcm.h>


Classes | |
| struct | Stats |
| Counters since start. More... | |
Public Member Functions | |
| bool | begin (const char *productName) override |
| Registers the USB network interface (before the USB stack is started). | |
| bool | ready () override |
| The host has enumerated and configured the device. | |
| void | setReceiver (FrameReceiver *receiver) override |
| Frames coming from the host are passed to receiver. | |
| void | setHostMac (const uint8_t mac[6]) override |
| void | setBuffers (uint8_t toHost, uint8_t fromHost) |
| bool | send (const uint8_t *frame, uint16_t len) override |
| Queues the frame; never blocks. Returns false if it was dropped. | |
| Stats | stats () const |
| Current counters. | |
| uint32_t | txQueued () |
| Number of frames waiting to be sent to the host. | |
| bool | onNcmReceive (const uint8_t *src, uint16_t size) |
| A frame from the host. May run in interrupt context: copy and queue only. | |
| Public Member Functions inherited from twd::UsbTransport | |
| virtual | ~UsbTransport ()=default |
Static Public Member Functions | |
| static Rp2040UsbNcm * | instance_ () |
| The instance that receives the TinyUSB callbacks. | |
| static uint16_t | copyFrame (uint8_t *dst, void *ref) |
| Copies the frame ref (as passed to tud_network_xmit()) to dst; returns its length. | |
USB CDC-NCM network device for the Raspberry Pi Pico W / Pico 2 W.
Implements UsbTransport on top of the TinyUSB NCM class of the arduino-pico core (USB stack "Pico SDK"). Frames from the host are queued by the TinyUSB receive callback and handed to the FrameReceiver by a worker in the core's lwIP async context; frames to the host are queued by send() and pushed into the USB stack by the same worker, which holds the USB mutex while it does so. The frame buffers are allocated by begin(); their number per direction is set with setBuffers() (TinyWifiDongleConfig::framesToHost and framesFromHost).
The TinyUSB callbacks are C functions, so the instance that ran begin() receives them.
Definition at line 45 of file Rp2040UsbNcm.h.
|
inlineoverridevirtual |
Registers the USB network interface (before the USB stack is started).
Implements twd::UsbTransport.
Definition at line 55 of file Rp2040UsbNcm.h.
|
inlinestatic |
Copies the frame ref (as passed to tud_network_xmit()) to dst; returns its length.
Definition at line 153 of file Rp2040UsbNcm.h.
|
inlinestatic |
The instance that receives the TinyUSB callbacks.
Definition at line 150 of file Rp2040UsbNcm.h.
|
inline |
A frame from the host. May run in interrupt context: copy and queue only.
Definition at line 160 of file Rp2040UsbNcm.h.
|
inlineoverridevirtual |
The host has enumerated and configured the device.
Implements twd::UsbTransport.
Definition at line 110 of file Rp2040UsbNcm.h.
|
inlineoverridevirtual |
Queues the frame; never blocks. Returns false if it was dropped.
Implements twd::UsbTransport.
Definition at line 124 of file Rp2040UsbNcm.h.
|
inline |
Number of frame buffers for frames to the host and from the host; 0 = the default of the chip. Call before begin().
Definition at line 118 of file Rp2040UsbNcm.h.
|
inlineoverridevirtual |
MAC address of the adapter as the host sees it (default: derived from the chip id). Call before begin().
Implements twd::UsbTransport.
Definition at line 114 of file Rp2040UsbNcm.h.
|
inlineoverridevirtual |
Frames coming from the host are passed to receiver.
Implements twd::UsbTransport.
Definition at line 112 of file Rp2040UsbNcm.h.
|
inline |
Current counters.
Definition at line 143 of file Rp2040UsbNcm.h.
|
inline |
Number of frames waiting to be sent to the host.
Definition at line 146 of file Rp2040UsbNcm.h.