Skip to content

moved spi block to where it's needed #36

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 6 commits into from
Apr 27, 2021
Merged
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
11 changes: 5 additions & 6 deletions adafruit_portalbase/wifi_coprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import gc
import board
import busio
from digitalio import DigitalInOut
from adafruit_esp32spi import adafruit_esp32spi, adafruit_esp32spi_wifimanager
import adafruit_esp32spi.adafruit_esp32spi_socket as socket
Expand Down Expand Up @@ -54,16 +53,16 @@ def __init__(self, *, status_led=None, esp=None, external_spi=None):

if esp: # If there was a passed ESP Object
self.esp = esp
if external_spi: # If SPI Object Passed
spi = external_spi
else: # Else: Make ESP32 connection
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
else:
esp32_ready = DigitalInOut(board.ESP_BUSY)
esp32_gpio0 = DigitalInOut(board.ESP_GPIO0)
esp32_reset = DigitalInOut(board.ESP_RESET)
esp32_cs = DigitalInOut(board.ESP_CS)
spi = board.SPI()

if external_spi: # If SPI Object Passed
spi = external_spi
else: # Else: Make ESP32 connection
spi = board.SPI()

self.esp = adafruit_esp32spi.ESP_SPIcontrol(
spi, esp32_cs, esp32_ready, esp32_reset, esp32_gpio0
Expand Down