Skip to content

Adding Support for Challenger 2040 WiFi boards. #49

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 10 commits into from
Nov 17, 2021
38 changes: 27 additions & 11 deletions examples/esp_atcontrol_aio_post.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# Note, you must create a feed called "test" in your AdafruitIO account.
# Your secrets file must contain your aio_username and aio_key

import time
import board
import busio
Expand All @@ -21,21 +24,34 @@
print("WiFi secrets are kept in secrets.py, please add them there!")
raise

# Debug Level
# Change the Debug Flag if you have issues with AT commands
debugflag = False

# With a Particle Argon
RX = board.ESP_TX
TX = board.ESP_RX
resetpin = DigitalInOut(board.ESP_WIFI_EN)
rtspin = DigitalInOut(board.ESP_CTS)
uart = busio.UART(TX, RX, timeout=0.1)
esp_boot = DigitalInOut(board.ESP_BOOT_MODE)
esp_boot.direction = Direction.OUTPUT
esp_boot.value = True
status_light = None
if board.board_id == "challenger_rp2040_wifi":
RX = board.ESP_RX
TX = board.ESP_TX
resetpin = DigitalInOut(board.WIFI_RESET)
rtspin = False
uart = busio.UART(TX, RX, baudrate=11520)
esp_boot = DigitalInOut(board.WIFI_MODE)
esp_boot.direction = Direction.OUTPUT
esp_boot.value = True
status_light = None
else:
RX = board.ESP_TX
TX = board.ESP_RX
resetpin = DigitalInOut(board.ESP_WIFI_EN)
rtspin = DigitalInOut(board.ESP_CTS)
uart = busio.UART(TX, RX, timeout=0.1)
esp_boot = DigitalInOut(board.ESP_BOOT_MODE)
esp_boot.direction = Direction.OUTPUT
esp_boot.value = True
status_light = None

print("ESP AT commands")
esp = adafruit_espatcontrol.ESP_ATcontrol(
uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=False
uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=debugflag
)
wifi = adafruit_espatcontrol_wifimanager.ESPAT_WiFiManager(esp, secrets, status_light)

Expand Down
37 changes: 26 additions & 11 deletions examples/esp_atcontrol_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,34 @@
except ImportError:
print("WiFi secrets are kept in secrets.py, please add them there!")
raise
# Debug Level
# Change the Debug Flag if you have issues with AT commands
debugflag = False


# With a Particle Argon
RX = board.ESP_TX
TX = board.ESP_RX
resetpin = DigitalInOut(board.ESP_WIFI_EN)
rtspin = DigitalInOut(board.ESP_CTS)
uart = busio.UART(TX, RX, timeout=0.1)
esp_boot = DigitalInOut(board.ESP_BOOT_MODE)
esp_boot.direction = Direction.OUTPUT
esp_boot.value = True
if board.board_id == "challenger_rp2040_wifi":
RX = board.ESP_RX
TX = board.ESP_TX
resetpin = DigitalInOut(board.WIFI_RESET)
rtspin = False
uart = busio.UART(TX, RX, baudrate=11520)
esp_boot = DigitalInOut(board.WIFI_MODE)
esp_boot.direction = Direction.OUTPUT
esp_boot.value = True
else:
RX = board.ESP_TX
TX = board.ESP_RX
resetpin = DigitalInOut(board.ESP_WIFI_EN)
rtspin = DigitalInOut(board.ESP_CTS)
uart = busio.UART(TX, RX, timeout=0.1)
esp_boot = DigitalInOut(board.ESP_BOOT_MODE)
esp_boot.direction = Direction.OUTPUT
esp_boot.value = True


print("ESP AT commands")
# For Boards that do not have an rtspin like challenger_rp2040_wifi set rtspin to False.
esp = adafruit_espatcontrol.ESP_ATcontrol(
uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=False
uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=debugflag
)
print("Resetting ESP module")
esp.hard_reset()
Expand All @@ -39,6 +51,9 @@
while True:
try:
if first_pass:
# Some ESP do not return OK on AP Scan.
# See https://github.com/adafruit/Adafruit_CircuitPython_ESP_ATcontrol/issues/48
# Comment out the next 3 lines if you get a No OK response to AT+CWLAP
print("Scanning for AP's")
for ap in esp.scan_APs():
print(ap)
Expand Down