_airlift – Shared access to an ESP32 co-processor running nina-fw

The _airlift module lets libraries send commands to the ESP32 that the core also uses, so that user code and the core can use the same co-processor. It is meant for libraries such as ESP32SPI, not for user code.

Available on these boards
  • Adafruit Fruit Jam
  • Adafruit PyPortal
  • Adafruit PyPortal Pynt

_airlift.MAX_SOCKETS: int

The number of sockets in nina-fw. Commands naming a higher socket are rejected.

_airlift.MAX_TRANSFER: int

The longest command, in bytes, that the ESP32 receives intact.

_airlift.MAX_READ: int

The largest GET_DATABUF_TCP read the ESP32 can reply to.

_airlift.init() → None

Claim the ESP32’s pins and the board SPI bus, and hard-reset the ESP32. The ESP32 stays claimed across soft reloads. Does nothing if it is already claimed. Raises ValueError if a pin is in use.

Temporary: the core will claim the ESP32 itself when web workflow is configured.

_airlift.active() → bool

True if the core has claimed the ESP32 and transact can be used.

_airlift.reset() → None

Hard-reset the ESP32 through its reset pin. This closes every socket and disconnects from WiFi. Takes about 0.75 seconds.

_airlift.release() → None

Give up the ESP32’s pins, so that code can drive them directly. Does nothing if they aren’t claimed.

_airlift.transact(cmd: int, params: Sequence[circuitpython_typing.ReadableBuffer | Sequence[int]] | None = None, *, reply_params: int | None = 1, sent_param_len_16: bool = False, recv_param_len_16: bool = False) → List[bytearray]

Send one command and return its reply parameters. This has the same contract as ESP32SPI’s ESP_SPIcontrol._send_command_get_response(), and raises the same exceptions.

Parameters:
  • cmd (int) – the nina-fw command

  • params – the parameters, each a buffer or a sequence of byte values

  • reply_params (int) – how many parameters the reply must have, or None to accept any number

  • sent_param_len_16 (bool) – send each parameter length as 16 bits

  • recv_param_len_16 (bool) – read each reply parameter length as 16 bits