adafruit_airlift

Manage AirLift coprocessors for use with Wifi and Bluetooth

  • Author(s): Dan Halbert

Implementation Notes

Software and Dependencies:

adafruit_airlift.esp32

ESP32 Adapter Support

  • Author(s): Dan Halbert

class adafruit_airlift.esp32.ESP32(*, reset: Pin | None = None, reset_high: bool = False, gpio0: Pin | None = None, busy: Pin | None = None, chip_select: Pin | None = None, tx: Pin | None = None, rx: Pin | None = None, spi: busio.SPI | None = None)

Class to manage ESP32 running NINA firmware for WiFi or Bluetooth.

Create an ESP32 instance, passing the objects needed to reset and communicate with the adapter.

Parameters:
  • reset (Pin) – ESP32 RESET pin. If None, use board.ESP_RESET.

  • reset_high (bool) – True if reset is brought high to reset; False if brought low.

  • gpio0 (Pin) – ESP32 GPIO0 pin. Used for ESP32 boot selection when reset, and as RTS for UART communication. If None, use board.ESP_GPIO0.

  • busy (Pin) – ESP32 BUSY pin (sometimes called READY). Used as CTS indicator for UART communication. If None, use board.ESP_BUSY.

  • chip_select (Pin) – ESP32 CS (chip select) pin. Also used for ESP32 mode selection when reset. If None, use board.ESP_CS.

  • tx (Pin) – ESP32 TX pin for Bluetooth UART communication. If None, use board.ESP_TX when in Bluetooth mode.

  • rx (Pin) – ESP32 RX pin for Bluetooth UART communication. If None, use board.ESP_RX when in Bluetooth mode.

  • spi (busio.SPI) – Used for communication with the ESP32. If not supplied, board.SPI() is used when in WiFi mode.

BLUETOOTH = 2

HCI Bluetooth mode.

BOOTLOADER = 1

Put ESP32 into bootloader mode.

NOT_IN_USE = 0

Not currently being used.

WIFI = 3

WiFi mode.

reset(mode: int, debug: bool = False) None

Do hard reset of the ESP32.

Parameters:

mode – One of ESP32.NOT_IN_USE, ESP32.BOOTLOADER, ESP32.BLUETOOTH, ESP32.WIFI.

start_bluetooth(debug: bool = False) _bleio.Adapter

Set up the ESP32 in HCI Bluetooth mode, if it is not already doing something else.

Parameters:

bool (debug) – Print out some debugging information.

Returns:

A _bleio.Adapter, to be passed to _bleio.set_adapter().

start_wifi(debug: bool = False) busio.SPI

Start WiFi on the ESP32.

Returns:

the busio.SPI object that will be used to communicate with the ESP32.

Return type:

busio.SPI

stop_bluetooth()

Stop Bluetooth on the ESP32. Deinitialize the ~busio.UART used for communication

stop_wifi()

Stop WiFi on the ESP32. The busio.SPI object used is not deinitialized, since it may be in use for other devices.