docs: Specify the recommended network.WLAN.IF_[AP|STA] constants.

Removes the deprecated network.[AP|STA]_IF form from the docs.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
Angus Gratton
2024-11-05 11:17:32 +11:00
committed by Damien George
parent df6b40a87f
commit 48f96e9660
6 changed files with 34 additions and 32 deletions

View File

@@ -79,11 +79,11 @@ Networking
WLAN
^^^^
The :mod:`network` module::
The :class:`network.WLAN` class in the :mod:`network` module::
import network
wlan = network.WLAN(network.STA_IF) # create station interface
wlan = network.WLAN(network.WLAN.IF_STA) # create station interface
wlan.active(True) # activate the interface
wlan.scan() # scan for access points
wlan.isconnected() # check if the station is connected to an AP
@@ -91,7 +91,7 @@ The :mod:`network` module::
wlan.config('mac') # get the interface's MAC address
wlan.ipconfig('addr4') # get the interface's IPv4 addresses
ap = network.WLAN(network.AP_IF) # create access-point interface
ap = network.WLAN(network.WLAN.IF_AP) # create access-point interface
ap.config(ssid='ESP-AP') # set the SSID of the access point
ap.config(max_clients=10) # set how many clients can connect to the network
ap.active(True) # activate the interface
@@ -100,7 +100,7 @@ A useful function for connecting to your local WiFi network is::
def do_connect():
import network
wlan = network.WLAN(network.STA_IF)
wlan = network.WLAN(network.WLAN.IF_STA)
wlan.active(True)
if not wlan.isconnected():
print('connecting to network...')
@@ -124,7 +124,8 @@ to reconnect forever).
LAN
^^^
To use the wired interfaces one has to specify the pins and mode ::
To use the wired interfaces via :class:`network.LAN` one has to specify the pins
and mode ::
import network