Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: adafruit/Adafruit_CircuitPython_Wiznet5k
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.1.0
Choose a base ref
...
head repository: adafruit/Adafruit_CircuitPython_Wiznet5k
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -4,21 +4,21 @@

repos:
- repo: https://github.com/python/black
rev: 22.3.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: v0.14.0
rev: v1.1.2
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/pylint
rev: v2.15.5
rev: v2.17.4
hooks:
- id: pylint
name: pylint (library code)
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
@@ -396,4 +396,4 @@ min-public-methods=1

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception
3 changes: 3 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@
# Required
version: 2

sphinx:
configuration: docs/conf.py

build:
os: ubuntu-20.04
tools:
74 changes: 6 additions & 68 deletions README.rst
Original file line number Diff line number Diff line change
@@ -64,9 +64,9 @@ wifitest.adafruit.com.
import board
import busio
import digitalio
import adafruit_requests as requests
import adafruit_connection_manager
import adafruit_requests
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_wiznet5k.adafruit_wiznet5k_socket as socket
print("Wiznet5k WebClient Test")
@@ -79,8 +79,10 @@ wifitest.adafruit.com.
# Initialize ethernet interface with DHCP
eth = WIZNET5K(spi_bus, cs)
# Initialize a requests object with a socket and ethernet interface
requests.set_socket(socket, eth)
# Initialize a requests session
pool = adafruit_connection_manager.get_radio_socketpool(eth)
ssl_context = adafruit_connection_manager.get_radio_ssl_context(eth)
requests = adafruit_requests.Session(pool, ssl_context)
print("Chip Version:", eth.chip)
print("MAC Address:", [hex(i) for i in eth.mac_address])
@@ -106,70 +108,6 @@ wifitest.adafruit.com.
print("Done!")
This example demonstrates a simple web server that allows setting the Neopixel color.

.. code-block:: python
import board
import busio
import digitalio
import neopixel
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_wiznet5k.adafruit_wiznet5k_wsgiserver as server
from adafruit_wsgi.wsgi_app import WSGIApp
print("Wiznet5k Web Server Test")
# Status LED
led = neopixel.NeoPixel(board.NEOPIXEL, 1)
led.brightness = 0.3
led[0] = (0, 0, 255)
# W5500 connections
cs = digitalio.DigitalInOut(board.D10)
spi_bus = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
# Initialize Ethernet interface with DHCP
eth = WIZNET5K(spi_bus, cs)
# Here we create our application, registering the
# following functions to be called on specific HTTP GET requests routes
web_app = WSGIApp()
@web_app.route("/led/<r>/<g>/<b>")
def led_on(request, r, g, b):
print("LED handler")
led.fill((int(r), int(g), int(b)))
return ("200 OK", [], ["LED set!"])
@web_app.route("/")
def root(request):
print("Root handler")
return ("200 OK", [], ["Root document"])
@web_app.route("/large")
def large(request):
print("Large pattern handler")
return ("200 OK", [], ["*-.-" * 2000])
# Here we setup our server, passing in our web_app as the application
server.set_interface(eth)
wsgiServer = server.WSGIServer(80, application=web_app)
print("Open this IP in your browser: ", eth.pretty_ip(eth.ip_address))
# Start the server
wsgiServer.start()
while True:
# Our main loop where we have the server poll for incoming requests
wsgiServer.update_poll()
# Maintain DHCP lease
eth.maintain_dhcp_lease()
# Could do any other background tasks here, like reading sensors
Documentation
=============

Loading