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=None, reset_high=False, gpio0=None, busy=None, chip_select=None, tx=None, rx=None, spi=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:
  • Pin (rx) – ESP32 RESET pin. If None, use board.ESP_RESET.
  • bool (reset_high) – True if reset is brought high to reset; False if brought low.
  • Pin – ESP32 GPIO0 pin. Used for ESP32 boot selection when reset, and as RTS for UART communication. If None, use board.ESP_GPIO0.
  • Pin – ESP32 BUSY pin (sometimes called READY). Used as CTS indicator for UART communication. If None, use board.ESP_BUSY.
  • Pin – ESP32 CS (chip select) pin. Also used for ESP32 mode selection when reset. If None, use board.ESP_CS.
  • Pin – ESP32 TX pin for Bluetooth UART communication. If None, use board.ESP_TX when in Bluetooth mode.
  • Pin – ESP32 RX pin for Bluetooth UART communication. If None, use board.ESP_RX when in Bluetooth mode.
  • busio.SPI (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, debug=False)

Do hard reset of the ESP32.

Parameters:mode – One of ESP32.NOT_IN_USE, ESP32.BOOTLOADER, ESP32.BLUETOOTH, ESP32.WIFI.
start_bluetooth(debug=False)

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=False)

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.