v2.0.0
Modules | Files | Data Structures | Macros | Typedefs | Functions | Variables
cyw43_driver
Networking Libraries » pico_cyw43_arch

Driver used for Pico W wireless. More...

## Modules
| cyw43_ll
| Low Level CYW43 driver interface.

## Files
file | cyw43.h
| CYW43 driver interface.
file | cyw43_country.h
| CYW43 country codes.

## Data Structures
struct | _cyw43_t

## Macros
#define | CYW43_DEFAULT_PM cyw43_pm_value(CYW43_PM2_POWERSAVE_MODE, 200, 1, 1, 10)
| Default power management mode.
#define | CYW43_AGGRESSIVE_PM cyw43_pm_value(CYW43_PM2_POWERSAVE_MODE, 2000, 1, 1, 10)
| Aggressive power management mode for optimal power usage at the cost of performance.
#define | CYW43_PERFORMANCE_PM cyw43_pm_value(CYW43_PM2_POWERSAVE_MODE, 20, 1, 1, 1)
| Performance power management mode where more power is used to increase performance.
#define | CYW43_COUNTRY(A, B, REV) ((unsigned char)(A) | ((unsigned char)(B) << 8) | ((REV) << 16))
| create a country code from the two character country and revision number

## Typedefs
typedef struct _cyw43_t | cyw43_t

## Functions
void | cyw43_init (cyw43_t *self)
| Initialize the driver. More...
void | cyw43_deinit (cyw43_t *self)
| Shut the driver down. More...
int | cyw43_ioctl (cyw43_t *self, uint32_t cmd, size_t len, uint8_t *buf, uint32_t iface)
| Send an ioctl command to cyw43. More...
int | cyw43_send_ethernet (cyw43_t *self, int itf, size_t len, const void *buf, bool is_pbuf)
| Send a raw ethernet packet. More...
int | cyw43_wifi_pm (cyw43_t *self, uint32_t pm)
| Set the wifi power management mode. More...
int | cyw43_wifi_get_pm (cyw43_t *self, uint32_t *pm)
| Get the wifi power management mode. More...
int | cyw43_wifi_link_status (cyw43_t *self, int itf)
| Get the wifi link status. More...
void | cyw43_wifi_set_up (cyw43_t *self, int itf, bool up, uint32_t country)
| Set up and initialise wifi. More...
int | cyw43_wifi_get_mac (cyw43_t *self, int itf, uint8_t mac[6])
| Get the mac address of the device. More...
int | cyw43_wifi_update_multicast_filter (cyw43_t *self, uint8_t *addr, bool add)
| Add/remove multicast group address. More...
int | cyw43_wifi_scan (cyw43_t *self, cyw43_wifi_scan_options_t *opts, void *env, int(*result_cb)(void *, const cyw43_ev_scan_result_t *))
| Perform a wifi scan for wifi networks. More...
static bool | cyw43_wifi_scan_active (cyw43_t *self)
| Determine if a wifi scan is in progress. More...
int | cyw43_wifi_join (cyw43_t *self, size_t ssid_len, const uint8_t *ssid, size_t key_len, const uint8_t *key, uint32_t auth_type, const uint8_t *bssid, uint32_t channel)
| Connect or join a wifi network. More...
int | cyw43_wifi_leave (cyw43_t *self, int itf)
| Disassociate from a wifi network. More...
int | cyw43_wifi_get_rssi (cyw43_t *self, int32_t *rssi)
| Get the signal strength (RSSI) of the wifi network. More...
int | cyw43_wifi_get_bssid (cyw43_t *self, uint8_t bssid[6])
| Get the BSSID of the connected wifi network. More...
static void | cyw43_wifi_ap_get_ssid (cyw43_t *self, size_t *len, const uint8_t **buf)
| Get the ssid for the access point. More...
static uint32_t | cyw43_wifi_ap_get_auth (cyw43_t *self)
| Get the security authorisation used in AP mode. More...
static void | cyw43_wifi_ap_set_channel (cyw43_t *self, uint32_t channel)
| Set the the channel for the access point. More...
static void | cyw43_wifi_ap_set_ssid (cyw43_t *self, size_t len, const uint8_t *buf)
| Set the ssid for the access point. More...
static void | cyw43_wifi_ap_set_password (cyw43_t *self, size_t len, const uint8_t *buf)
| Set the password for the wifi access point. More...
static void | cyw43_wifi_ap_set_auth (cyw43_t *self, uint32_t auth)
| Set the security authorisation used in AP mode. More...
void | cyw43_wifi_ap_get_max_stas (cyw43_t *self, int *max_stas)
| Get the maximum number of devices (STAs) that can be associated with the wifi access point. More...
void | cyw43_wifi_ap_get_stas (cyw43_t *self, int *num_stas, uint8_t *macs)
| Get the number of devices (STAs) associated with the wifi access point. More...
static bool | cyw43_is_initialized (cyw43_t *self)
| Determines if the cyw43 driver been initialised. More...
void | cyw43_cb_tcpip_init (cyw43_t *self, int itf)
| Initialise the IP stack. More...
void | cyw43_cb_tcpip_deinit (cyw43_t *self, int itf)
| Deinitialise the IP stack. More...
void | cyw43_cb_tcpip_set_link_up (cyw43_t *self, int itf)
| Notify the IP stack that the link is up. More...
void | cyw43_cb_tcpip_set_link_down (cyw43_t *self, int itf)
| Notify the IP stack that the link is down. More...
int | cyw43_tcpip_link_status (cyw43_t *self, int itf)
| Get the link status. More...
static uint32_t | cyw43_pm_value (uint8_t pm_mode, uint16_t pm2_sleep_ret_ms, uint8_t li_beacon_period, uint8_t li_dtim_period, uint8_t li_assoc)
| Return a power management value to pass to cyw43_wifi_pm. More...

## Variables
cyw43_t | cyw43_state
void(* | cyw43_poll )(void)
uint32_t | cyw43_sleep

## CYW43 driver version as components
Current version of the CYW43 driver as major/minor/micro components
#define | CYW43_VERSION_MAJOR 1
#define | CYW43_VERSION_MINOR 0
#define | CYW43_VERSION_MICRO 3

## CYW43 driver version
Combined CYW43 driver version as a 32-bit number
#define | CYW43_VERSION (CYW43_VERSION_MAJOR << 16 | CYW43_VERSION_MINOR << 8 | CYW43_VERSION_MICRO)

## Trace flags
#define | CYW43_TRACE_ASYNC_EV (0x0001)
#define | CYW43_TRACE_ETH_TX (0x0002)
#define | CYW43_TRACE_ETH_RX (0x0004)
#define | CYW43_TRACE_ETH_FULL (0x0008)
#define | CYW43_TRACE_MAC (0x0010)

## Link status
See also status_name() to get a user readable name of the status for debug cyw43_wifi_link_status() to get the wifi status cyw43_tcpip_link_status() to get the overall link status
#define | CYW43_LINK_DOWN (0)
| link is down
#define | CYW43_LINK_JOIN (1)
| Connected to wifi.
#define | CYW43_LINK_NOIP (2)
| Connected to wifi, but no IP address.
#define | CYW43_LINK_UP (3)
| Connected to wifi with an IP address.
#define | CYW43_LINK_FAIL (-1)
| Connection failed.
#define | CYW43_LINK_NONET (-2)
| No matching SSID found (could be out of range, or down)
#define | CYW43_LINK_BADAUTH (-3)

## Country codes
#define | CYW43_COUNTRY_WORLDWIDE CYW43_COUNTRY('X', 'X', 0)
#define | CYW43_COUNTRY_AUSTRALIA CYW43_COUNTRY('A', 'U', 0)
#define | CYW43_COUNTRY_AUSTRIA CYW43_COUNTRY('A', 'T', 0)
#define | CYW43_COUNTRY_BELGIUM CYW43_COUNTRY('B', 'E', 0)
#define | CYW43_COUNTRY_BRAZIL CYW43_COUNTRY('B', 'R', 0)
#define | CYW43_COUNTRY_CANADA CYW43_COUNTRY('C', 'A', 0)
#define | CYW43_COUNTRY_CHILE CYW43_COUNTRY('C', 'L', 0)
#define | CYW43_COUNTRY_CHINA CYW43_COUNTRY('C', 'N', 0)
#define | CYW43_COUNTRY_COLOMBIA CYW43_COUNTRY('C', 'O', 0)
#define | CYW43_COUNTRY_CZECH_REPUBLIC CYW43_COUNTRY('C', 'Z', 0)
#define | CYW43_COUNTRY_DENMARK CYW43_COUNTRY('D', 'K', 0)
#define | CYW43_COUNTRY_ESTONIA CYW43_COUNTRY('E', 'E', 0)
#define | CYW43_COUNTRY_FINLAND CYW43_COUNTRY('F', 'I', 0)
#define | CYW43_COUNTRY_FRANCE CYW43_COUNTRY('F', 'R', 0)
#define | CYW43_COUNTRY_GERMANY CYW43_COUNTRY('D', 'E', 0)
#define | CYW43_COUNTRY_GREECE CYW43_COUNTRY('G', 'R', 0)
#define | CYW43_COUNTRY_HONG_KONG CYW43_COUNTRY('H', 'K', 0)
#define | CYW43_COUNTRY_HUNGARY CYW43_COUNTRY('H', 'U', 0)
#define | CYW43_COUNTRY_ICELAND CYW43_COUNTRY('I', 'S', 0)
#define | CYW43_COUNTRY_INDIA CYW43_COUNTRY('I', 'N', 0)
#define | CYW43_COUNTRY_ISRAEL CYW43_COUNTRY('I', 'L', 0)
#define | CYW43_COUNTRY_ITALY CYW43_COUNTRY('I', 'T', 0)
#define | CYW43_COUNTRY_JAPAN CYW43_COUNTRY('J', 'P', 0)
#define | CYW43_COUNTRY_KENYA CYW43_COUNTRY('K', 'E', 0)
#define | CYW43_COUNTRY_LATVIA CYW43_COUNTRY('L', 'V', 0)
#define | CYW43_COUNTRY_LIECHTENSTEIN CYW43_COUNTRY('L', 'I', 0)
#define | CYW43_COUNTRY_LITHUANIA CYW43_COUNTRY('L', 'T', 0)
#define | CYW43_COUNTRY_LUXEMBOURG CYW43_COUNTRY('L', 'U', 0)
#define | CYW43_COUNTRY_MALAYSIA CYW43_COUNTRY('M', 'Y', 0)
#define | CYW43_COUNTRY_MALTA CYW43_COUNTRY('M', 'T', 0)
#define | CYW43_COUNTRY_MEXICO CYW43_COUNTRY('M', 'X', 0)
#define | CYW43_COUNTRY_NETHERLANDS CYW43_COUNTRY('N', 'L', 0)
#define | CYW43_COUNTRY_NEW_ZEALAND CYW43_COUNTRY('N', 'Z', 0)
#define | CYW43_COUNTRY_NIGERIA CYW43_COUNTRY('N', 'G', 0)
#define | CYW43_COUNTRY_NORWAY CYW43_COUNTRY('N', 'O', 0)
#define | CYW43_COUNTRY_PERU CYW43_COUNTRY('P', 'E', 0)
#define | CYW43_COUNTRY_PHILIPPINES CYW43_COUNTRY('P', 'H', 0)
#define | CYW43_COUNTRY_POLAND CYW43_COUNTRY('P', 'L', 0)
#define | CYW43_COUNTRY_PORTUGAL CYW43_COUNTRY('P', 'T', 0)
#define | CYW43_COUNTRY_SINGAPORE CYW43_COUNTRY('S', 'G', 0)
#define | CYW43_COUNTRY_SLOVAKIA CYW43_COUNTRY('S', 'K', 0)
#define | CYW43_COUNTRY_SLOVENIA CYW43_COUNTRY('S', 'I', 0)
#define | CYW43_COUNTRY_SOUTH_AFRICA CYW43_COUNTRY('Z', 'A', 0)
#define | CYW43_COUNTRY_SOUTH_KOREA CYW43_COUNTRY('K', 'R', 0)
#define | CYW43_COUNTRY_SPAIN CYW43_COUNTRY('E', 'S', 0)
#define | CYW43_COUNTRY_SWEDEN CYW43_COUNTRY('S', 'E', 0)
#define | CYW43_COUNTRY_SWITZERLAND CYW43_COUNTRY('C', 'H', 0)
#define | CYW43_COUNTRY_TAIWAN CYW43_COUNTRY('T', 'W', 0)
#define | CYW43_COUNTRY_THAILAND CYW43_COUNTRY('T', 'H', 0)
#define | CYW43_COUNTRY_TURKEY CYW43_COUNTRY('T', 'R', 0)
#define | CYW43_COUNTRY_UK CYW43_COUNTRY('G', 'B', 0)
#define | CYW43_COUNTRY_USA CYW43_COUNTRY('U', 'S', 0)

## Detailed Description

Driver used for Pico W wireless.

## Macro Definition Documentation

## ◆ CYW43_LINK_BADAUTH

#define CYW43_LINK_BADAUTH (-3)

Authenticatation failure

## Function Documentation

## ◆ cyw43_cb_tcpip_deinit()

void cyw43_cb_tcpip_deinit | ( | cyw43_t * | self,
|  | int | itf
| ) |  |

Deinitialise the IP stack.

This method must be provided by the network stack interface It is called to close the IP stack and free resources.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  itf | the interface used, either CYW43_ITF_STA or CYW43_ITF_AP

## ◆ cyw43_cb_tcpip_init()

void cyw43_cb_tcpip_init | ( | cyw43_t * | self,
|  | int | itf
| ) |  |

Initialise the IP stack.

This method must be provided by the network stack interface It is called to initialise the IP stack.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  itf | the interface used, either CYW43_ITF_STA or CYW43_ITF_AP

## ◆ cyw43_cb_tcpip_set_link_down()

void cyw43_cb_tcpip_set_link_down | ( | cyw43_t * | self,
|  | int | itf
| ) |  |

Notify the IP stack that the link is down.

This method must be provided by the network stack interface It is called to notify the IP stack that the link is down.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  itf | the interface used, either CYW43_ITF_STA or CYW43_ITF_AP

## ◆ cyw43_cb_tcpip_set_link_up()

void cyw43_cb_tcpip_set_link_up | ( | cyw43_t * | self,
|  | int | itf
| ) |  |

Notify the IP stack that the link is up.

This method must be provided by the network stack interface It is called to notify the IP stack that the link is up. This can, for example be used to request an IP address via DHCP.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  itf | the interface used, either CYW43_ITF_STA or CYW43_ITF_AP

## ◆ cyw43_deinit()

void cyw43_deinit | ( | cyw43_t * | self | ) |

Shut the driver down.

This method will close the network interfaces, and free up resources

Parameters

  self | the driver state object. This should always be `&cyw43_state`

## ◆ cyw43_init()

void cyw43_init | ( | cyw43_t * | self | ) |

Initialize the driver.

This method must be called before using the driver

Parameters

  self | the driver state object. This should always be `&cyw43_state`

## ◆ cyw43_ioctl()

int cyw43_ioctl | ( | cyw43_t * | self,
|  | uint32_t | cmd,
|  | size_t | len,
|  | uint8_t * | buf,
|  | uint32_t | iface
| ) |  |

Send an ioctl command to cyw43.

This method sends a command to cyw43.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  cmd | the command to send
  len | the amount of data to send with the command
  buf | a buffer containing the data to send
  iface | the interface to use, either CYW43_ITF_STA or CYW43_ITF_AP

Returns
  0 on success

## ◆ cyw43_is_initialized()

static bool cyw43_is_initialized | ( | cyw43_t * | self | ) |
| inlinestatic

Determines if the cyw43 driver been initialised.

Returns true if the cyw43 driver has been initialised with a call to cyw43_init

Parameters

  self | the driver state object. This should always be `&cyw43_state`

Returns
  True if the cyw43 driver has been initialised

## ◆ cyw43_pm_value()

static uint32_t cyw43_pm_value | ( | uint8_t | pm_mode,
|  | uint16_t | pm2_sleep_ret_ms,
|  | uint8_t | li_beacon_period,
|  | uint8_t | li_dtim_period,
|  | uint8_t | li_assoc
| ) |  |
| inlinestatic

Return a power management value to pass to cyw43_wifi_pm.

Generate the power management (PM) value to pass to cyw43_wifi_pm

pm_mode | Meaning
--- | ---
CYW43_NO_POWERSAVE_MODE | No power saving
CYW43_PM1_POWERSAVE_MODE | Aggressive power saving which reduces wifi throughput
CYW43_PM2_POWERSAVE_MODE | Power saving with High throughput (preferred). Saves power when there is no wifi activity for some time.

See also
  CYW43_DEFAULT_PM
  CYW43_AGGRESSIVE_PM
  CYW43_PERFORMANCE_PM

Parameters

  pm_mode | Power management mode
  pm2_sleep_ret_ms | The maximum time to wait before going back to sleep for CYW43_PM2_POWERSAVE_MODE mode. Value measured in milliseconds and must be between 10 and 2000ms and divisible by 10
  li_beacon_period | Wake period is measured in beacon periods
  li_dtim_period | Wake interval measured in DTIMs. If this is set to 0, the wake interval is measured in beacon periods
  li_assoc | Wake interval sent to the access point

## ◆ cyw43_send_ethernet()

int cyw43_send_ethernet | ( | cyw43_t * | self,
|  | int | itf,
|  | size_t | len,
|  | const void * | buf,
|  | bool | is_pbuf
| ) |  |

Send a raw ethernet packet.

This method sends a raw ethernet packet.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  itf | interface to use, either CYW43_ITF_STA or CYW43_ITF_AP
  len | the amount of data to send
  buf | the data to send
  is_pbuf | true if buf points to an lwip struct pbuf

Returns
  0 on success

## ◆ cyw43_tcpip_link_status()

int cyw43_tcpip_link_status | ( | cyw43_t * | self,
|  | int | itf
| ) |  |

Get the link status.

Returns the status of the link which is a superset of the wifi link status returned by cyw43_wifi_link_status

Note
  If the link status is negative it indicates an error

link status | Meaning
--- | ---
CYW43_LINK_DOWN | Wifi down
CYW43_LINK_JOIN | Connected to wifi
CYW43_LINK_NOIP | Connected to wifi, but no IP address
CYW43_LINK_UP | Connect to wifi with an IP address
CYW43_LINK_FAIL | Connection failed
CYW43_LINK_NONET | No matching SSID found (could be out of range, or down)
CYW43_LINK_BADAUTH | Authenticatation failure

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  itf | the interface for which to return the link status, should be CYW43_ITF_STA or CYW43_ITF_AP

Returns
  A value representing the link status

## ◆ cyw43_wifi_ap_get_auth()

static uint32_t cyw43_wifi_ap_get_auth | ( | cyw43_t * | self | ) |
| inlinestatic

Get the security authorisation used in AP mode.

For access point (AP) mode, this method can be used to get the security authorisation mode.

Parameters

  self | the driver state object. This should always be `&cyw43_state`

Returns
  the current security authorisation mode for the access point

## ◆ cyw43_wifi_ap_get_max_stas()

void cyw43_wifi_ap_get_max_stas | ( | cyw43_t * | self,
|  | int * | max_stas
| ) |  |

Get the maximum number of devices (STAs) that can be associated with the wifi access point.

For access point (AP) mode, this method can be used to get the maximum number of devices that can be connected to the wifi access point.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  max_stas | Returns the maximum number of devices (STAs) that can be connected to the access point (set to 0 on error)

## ◆ cyw43_wifi_ap_get_ssid()

static void cyw43_wifi_ap_get_ssid | ( | cyw43_t * | self,
|  | size_t * | len,
|  | const uint8_t ** | buf
| ) |  |
| inlinestatic

Get the ssid for the access point.

For access point (AP) mode, this method can be used to get the SSID name of the wifi access point.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  len | Returns the length of the AP SSID name
  buf | Returns a pointer to an internal buffer containing the AP SSID name

## ◆ cyw43_wifi_ap_get_stas()

void cyw43_wifi_ap_get_stas | ( | cyw43_t * | self,
|  | int * | num_stas,
|  | uint8_t * | macs
| ) |  |

Get the number of devices (STAs) associated with the wifi access point.

For access point (AP) mode, this method can be used to get the number of devices and mac addresses of devices connected to the wifi access point.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  num_stas | Caller must provide the number of MACs that will fit in the macs buffer; The supplied buffer should have enough room for 6 bytes per MAC address. Returns the number of devices (STA) connected to the access point.
  macs | Returns up to num_stas MAC addresses of devices (STA) connected to the access point. Call cyw43_wifi_ap_get_max_stas to determine how many mac addresses can be returned.

## ◆ cyw43_wifi_ap_set_auth()

static void cyw43_wifi_ap_set_auth | ( | cyw43_t * | self,
|  | uint32_t | auth
| ) |  |
| inlinestatic

Set the security authorisation used in AP mode.

For access point (AP) mode, this method can be used to set how access to the access point is authorised.

Auth mode | Meaning
--- | ---
CYW43_AUTH_OPEN | Use an open access point with no authorisation required
CYW43_AUTH_WPA_TKIP_PSK | Use WPA authorisation
CYW43_AUTH_WPA2_AES_PSK | Use WPA2 (preferred)
CYW43_AUTH_WPA2_MIXED_PSK | Use WPA2/WPA mixed (currently treated the same as CYW43_AUTH_WPA2_AES_PSK)

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  auth | Auth mode for the access point

## ◆ cyw43_wifi_ap_set_channel()

static void cyw43_wifi_ap_set_channel | ( | cyw43_t * | self,
|  | uint32_t | channel
| ) |  |
| inlinestatic

Set the the channel for the access point.

For access point (AP) mode, this method can be used to set the channel used for the wifi access point.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  channel | Wifi channel to use for the wifi access point

## ◆ cyw43_wifi_ap_set_password()

static void cyw43_wifi_ap_set_password | ( | cyw43_t * | self,
|  | size_t | len,
|  | const uint8_t * | buf
| ) |  |
| inlinestatic

Set the password for the wifi access point.

For access point (AP) mode, this method can be used to set the password for the wifi access point.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  len | The length of the AP password
  buf | A buffer containing the AP password

## ◆ cyw43_wifi_ap_set_ssid()

static void cyw43_wifi_ap_set_ssid | ( | cyw43_t * | self,
|  | size_t | len,
|  | const uint8_t * | buf
| ) |  |
| inlinestatic

Set the ssid for the access point.

For access point (AP) mode, this method can be used to set the SSID name of the wifi access point.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  len | The length of the AP SSID name
  buf | A buffer containing the AP SSID name

## ◆ cyw43_wifi_get_bssid()

int cyw43_wifi_get_bssid | ( | cyw43_t * | self,
|  | uint8_t | bssid[6]
| ) |  |

Get the BSSID of the connected wifi network.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  bssid | a buffer to receive the BSSID

Returns
  0 on success

## ◆ cyw43_wifi_get_mac()

int cyw43_wifi_get_mac | ( | cyw43_t * | self,
|  | int | itf,
|  | uint8_t | mac[6]
| ) |  |

Get the mac address of the device.

This method returns the mac address of the interface.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  itf | the interface to use, either CYW43_ITF_STA or CYW43_ITF_AP
  mac | a buffer to receive the mac address

Returns
  0 on success

## ◆ cyw43_wifi_get_pm()

int cyw43_wifi_get_pm | ( | cyw43_t * | self,
|  | uint32_t * | pm
| ) |  |

Get the wifi power management mode.

This method gets the power management mode used by cyw43. The value is expressed as an unsigned integer 0x00adbrrm where, m = pm_mode Power management mode rr = pm2_sleep_ret (in units of 10ms) b = li_beacon_period d = li_dtim_period a = li_assoc

See also
  cyw43_pm_value for an explanation of these values This should be called after cyw43_wifi_set_up

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  pm | Power management value

Returns
  0 on success

## ◆ cyw43_wifi_get_rssi()

int cyw43_wifi_get_rssi | ( | cyw43_t * | self,
|  | int32_t * | rssi
| ) |  |

Get the signal strength (RSSI) of the wifi network.

For STA (client) mode, returns the signal strength or RSSI of the wifi network. An RSSI value of zero is returned if you call this function before a network is connected.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  rssi | a pointer to which the returned RSSI value is stored.

Returns
  0 on success

## ◆ cyw43_wifi_join()

int cyw43_wifi_join | ( | cyw43_t * | self,
|  | size_t | ssid_len,
|  | const uint8_t * | ssid,
|  | size_t | key_len,
|  | const uint8_t * | key,
|  | uint32_t | auth_type,
|  | const uint8_t * | bssid,
|  | uint32_t | channel
| ) |  |

Connect or join a wifi network.

Connect to a wifi network in STA (client) mode After success is returned, periodically call cyw43_wifi_link_status or cyw43_tcpip_link_status, to query the status of the link. It can take a many seconds to connect to fully join a network.

Note
  Call cyw43_wifi_leave to disassociate from a wifi network.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  ssid_len | the length of the wifi network name
  ssid | A buffer containing the wifi network name
  key_len | The length of the wifi password
  key | A buffer containing the wifi password
  auth_type | Auth type,

See also
  CYW43_AUTH_

Parameters

  bssid | the mac address of the access point to connect to. This can be NULL.
  channel | Used to set the band of the connection. This is only used if bssid is non NULL.

Returns
  0 on success

## ◆ cyw43_wifi_leave()

int cyw43_wifi_leave | ( | cyw43_t * | self,
|  | int | itf
| ) |  |

Disassociate from a wifi network.

This method disassociates from a wifi network.

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  itf | The interface to disconnect, either CYW43_ITF_STA or CYW43_ITF_AP

Returns
  0 on success

## ◆ cyw43_wifi_link_status()

int cyw43_wifi_link_status | ( | cyw43_t * | self,
|  | int | itf
| ) |  |

Get the wifi link status.

Returns the status of the wifi link.

link status | Meaning
--- | ---
CYW43_LINK_DOWN | Wifi down
CYW43_LINK_JOIN | Connected to wifi
CYW43_LINK_FAIL | Connection failed
CYW43_LINK_NONET | No matching SSID found (could be out of range, or down)
CYW43_LINK_BADAUTH | Authenticatation failure

Note
  If the link status is negative it indicates an error The wifi link status for the interface CYW43_ITF_AP is always CYW43_LINK_DOWN

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  itf | the interface to use, should be CYW43_ITF_STA or CYW43_ITF_AP

Returns
  A integer value representing the link status

## ◆ cyw43_wifi_pm()

int cyw43_wifi_pm | ( | cyw43_t * | self,
|  | uint32_t | pm
| ) |  |

Set the wifi power management mode.

This method sets the power management mode used by cyw43. This should be called after cyw43_wifi_set_up

See also
  cyw43_pm_value
  CYW43_DEFAULT_PM
  CYW43_AGGRESSIVE_PM
  CYW43_PERFORMANCE_PM

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  pm | Power management value

Returns
  0 on success

## ◆ cyw43_wifi_scan()

int cyw43_wifi_scan | ( | cyw43_t * | self,
|  | cyw43_wifi_scan_options_t * | opts,
|  | void * | env,
|  | int(*)(void *, const cyw43_ev_scan_result_t *) | result_cb
| ) |  |

Perform a wifi scan for wifi networks.

Start a scan for wifi networks. Results are returned via the callback.

Note
  The scan is complete when cyw43_wifi_scan_active return false

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  opts | An instance of cyw43_wifi_scan_options_t. Values in here are currently ignored.
  env | Pointer passed back in the callback
  result_cb | Callback for wifi scan results, see cyw43_ev_scan_result_t

Returns
  0 on success

## ◆ cyw43_wifi_scan_active()

static bool cyw43_wifi_scan_active | ( | cyw43_t * | self | ) |
| inlinestatic

Determine if a wifi scan is in progress.

This method tells you if the scan is still in progress

Parameters

  self | the driver state object. This should always be `&cyw43_state`

Returns
  true if a wifi scan is in progress

## ◆ cyw43_wifi_set_up()

void cyw43_wifi_set_up | ( | cyw43_t * | self,
|  | int | itf,
|  | bool | up,
|  | uint32_t | country
| ) |  |

Set up and initialise wifi.

This method turns on wifi and sets the country for regulation purposes. The power management mode is initialised to CYW43_DEFAULT_PM For CYW43_ITF_AP, the access point is enabled. For CYW43_ITF_STA, the TCP/IP stack is reinitialised

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  itf | the interface to use either CYW43_ITF_STA or CYW43_ITF_AP
  up | true to enable the link. Set to false to disable AP mode. Setting the up parameter to false for CYW43_ITF_STA is ignored.
  country | the country code, see CYW43_COUNTRY_

## ◆ cyw43_wifi_update_multicast_filter()

int cyw43_wifi_update_multicast_filter | ( | cyw43_t * | self,
|  | uint8_t * | addr,
|  | bool | add
| ) |  |

Add/remove multicast group address.

This method adds/removes an address from the multicast filter, allowing frames sent to this group to be received

Parameters

  self | the driver state object. This should always be `&cyw43_state`
  addr | a buffer containing a group mac address
  add | true to add the address, false to remove it

Returns
  0 on success