Skip to content
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
6 changes: 5 additions & 1 deletion adafruit_esp32spi/adafruit_esp32spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
WL_AP_FAILED = const(9)
# pylint: enable=bad-whitespace

class ESP_SPIcontrol: # pylint: disable=too-many-public-methods
class ESP_SPIcontrol: # pylint: disable=too-many-public-methods, too-many-instance-attributes
"""A class that will talk to an ESP32 module programmed with special firmware
that lets it act as a fast an efficient WiFi co-processor"""
TCP_MODE = const(0)
Expand All @@ -143,6 +143,8 @@ class ESP_SPIcontrol: # pylint: disable=too-many-public-methods
# pylint: disable=too-many-arguments
def __init__(self, spi, cs_pin, ready_pin, reset_pin, gpio0_pin=None, *, debug=False):
self._debug = debug
self.set_psk = False
self.set_crt = False
self._buffer = bytearray(10)
self._pbuf = bytearray(1) # buffer for param read
self._sendbuf = bytearray(256) # buffer for command sending
Expand Down Expand Up @@ -805,6 +807,7 @@ def set_certificate(self, client_certificate):
resp = self._send_command_get_response(_SET_CLI_CERT, (client_certificate,))
if resp[0][0] != 1:
raise RuntimeError("Failed to set client certificate")
self.set_crt = True
return resp[0]

def set_private_key(self, private_key):
Expand All @@ -822,4 +825,5 @@ def set_private_key(self, private_key):
resp = self._send_command_get_response(_SET_PK, (private_key,))
if resp[0][0] != 1:
raise RuntimeError("Failed to set private key.")
self.set_psk = True
return resp[0]