Skip to content

Update Ethernet library usage #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions docs/starting_methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ it may not be able to access the internet.
Manual Ethernet
---------------

Most of the time, the WiFi will be a preferred way of connecting to the network.
Nevertheless it is also possible to use Ethernet instead of WiFi.
The only difference in usage is related to configuring the ``socket_source`` differently.
Ethernet can also be used to connect to the location network.

.. literalinclude:: ../examples/httpserver_simpletest_manual_ethernet.py
:caption: examples/httpserver_simpletest_manual_ethernet.py
:emphasize-lines: 7,10,12-24,37
:emphasize-lines: 11-20
:linenos:

Automatic WiFi using ``settings.toml``
Expand Down
7 changes: 3 additions & 4 deletions examples/httpserver_simpletest_manual_ethernet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#
# SPDX-License-Identifier: MIT

import adafruit_connection_manager
import board
import digitalio
from adafruit_wiznet5k import adafruit_wiznet5k_socket as socket
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K

from adafruit_httpserver import Request, Response, Server
Expand All @@ -20,10 +20,9 @@
# Initialize ethernet interface with DHCP
eth = WIZNET5K(spi_bus, cs)

# Set the interface on the socket source
socket.set_interface(eth)
pool = adafruit_connection_manager.get_radio_socketpool(eth)

server = Server(socket, "/static", debug=True)
server = Server(pool, "/static", debug=True)


@server.route("/")
Expand Down