TinyWifiDongle 0.1.0
Header-only USB WiFi dongle for Arduino
Loading...
Searching...
No Matches
twd::Rp2040WifiFrameLink Class Reference

Raw Ethernet access to the WiFi network through the CYW43 chip of the Pico W / Pico 2 W. More...

#include <Rp2040WifiFrameLink.h>

Inheritance diagram for twd::Rp2040WifiFrameLink:
Collaboration diagram for twd::Rp2040WifiFrameLink:

Public Member Functions

bool begin (const char *ssid, const char *password) override
 Start joining the network; returns at once, see connected().
bool connected () override
 True while the station's link is up.
bool sendFrame (const uint8_t *frame, uint16_t len) override
 Sends a frame to the uplink network; false if it was dropped.
void setFrameReceiver (FrameReceiver *receiver) override
 Frames coming from the uplink network are passed to receiver.
const uint8_t * macAddress () override
 The station MAC of the chip; starts the chip on the first call. The result is cached.

Static Public Attributes

static constexpr uint32_t kNotJoinedReportMs = 10000
 While the station is not associated, a warning is logged this often.

Detailed Description

Raw Ethernet access to the WiFi network through the CYW43 chip of the Pico W / Pico 2 W.

Joins the network with the core's WiFi class (which keeps its connect and retry logic) and then takes over the station's lwIP interface: its input function is replaced, so every frame the chip receives goes to the FrameReceiver instead of the IP stack, and its DHCP client is stopped. Frames are sent with cyw43_send_ethernet(). The board has no IP address of its own; the host behind the bridge uses the station's MAC address and asks the network itself.

A worker in the core's lwIP async context re-applies these changes twice a second, because the core may restart DHCP or reset the interface after a reconnect.

Also an Uplink, so the composition can report the association state.

See also
L2Bridge

Definition at line 36 of file Rp2040WifiFrameLink.h.

Member Function Documentation

◆ begin()

bool twd::Rp2040WifiFrameLink::begin ( const char * ssid,
const char * password )
inlineoverridevirtual

Start joining the network; returns at once, see connected().

Implements twd::Uplink.

Definition at line 41 of file Rp2040WifiFrameLink.h.

◆ connected()

bool twd::Rp2040WifiFrameLink::connected ( )
inlineoverridevirtual

True while the station's link is up.

Implements twd::Uplink.

Definition at line 63 of file Rp2040WifiFrameLink.h.

◆ macAddress()

const uint8_t * twd::Rp2040WifiFrameLink::macAddress ( )
inlineoverridevirtual

The station MAC of the chip; starts the chip on the first call. The result is cached.

Implements twd::FrameLink.

Definition at line 73 of file Rp2040WifiFrameLink.h.

◆ sendFrame()

bool twd::Rp2040WifiFrameLink::sendFrame ( const uint8_t * frame,
uint16_t len )
inlineoverridevirtual

Sends a frame to the uplink network; false if it was dropped.

Implements twd::FrameLink.

Definition at line 65 of file Rp2040WifiFrameLink.h.

◆ setFrameReceiver()

void twd::Rp2040WifiFrameLink::setFrameReceiver ( FrameReceiver * receiver)
inlineoverridevirtual

Frames coming from the uplink network are passed to receiver.

Implements twd::FrameLink.

Definition at line 70 of file Rp2040WifiFrameLink.h.

Member Data Documentation

◆ kNotJoinedReportMs

uint32_t twd::Rp2040WifiFrameLink::kNotJoinedReportMs = 10000
staticconstexpr

While the station is not associated, a warning is logged this often.

Definition at line 39 of file Rp2040WifiFrameLink.h.


The documentation for this class was generated from the following file: