Quantcast
Viewing all articles
Browse latest Browse all 4899

SDK • Re: PicoW: How to get the IP-Address?

I agree, the Pico SDK apparently does not provide a function for returning the IP address, it is necessary to pull the information from the CYW43 state structure.

The code I provided first checks that an IP address has been assigned by calling cyw43_tcpip_link_status. The first parameter for that routine is the global variable cyw43_state (https://www.raspberrypi.com/documentati ... ource.html, line 154), while the second parameter selects either Station or Access Point modes (CYW43_ITF_STA or CYW43_ITF_AP).

Having confirmed that an IP address has been assigned, the actual address is copied from the netif structure in cyw43_state. The IP address is formatted as an LWIP ip_addr_t value.

Therefore the parameters for net_wifi_get_ipaddr are:
  • iface = CYW43_ITF_STA or CYW43_ITF_AP
  • ipaddr = Address to receive the ip_addr_t value.

Statistics: Posted by Memotech Bill — Tue Jul 23, 2024 9:05 am



Viewing all articles
Browse latest Browse all 4899

Trending Articles