adafruit_esp32s2tft

Helper library for the Adafruit ESP32-S2 TFT Feather.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_esp32s2tft.ESP32S2TFT(*, url: str | None = None, headers: Dict[str, str] = None, json_path: List[str] | List[List[str]] | None = None, regexp_path: Sequence[str] | None = None, default_bg: int = 0, status_neopixel: NeoPixel | None = None, json_transform: Callable | List[Callable] | None = None, rotation: int = 0, scale: int = 1, debug: bool = False, use_network: bool = True)

Class representing the Adafruit ESP32-S2 TFT Feather.

Parameters:
  • url – The URL of your data source. Defaults to None.

  • headers – The headers for authentication, typically used by Azure API’s.

  • json_path – The list of json traversal to get data out of. Can be list of lists for multiple data points. Defaults to None to not use json.

  • regexp_path – The list of regexp strings to get data out (use a single regexp group). Can be list of regexps for multiple data points. Defaults to None to not use regexp.

  • default_bg – The path to your default background image file or a hex color. Defaults to 0x000000.

  • status_dotstar – The initialized object for status DotStar. Defaults to None, to not use the status LED

  • json_transform – A function or a list of functions to call with the parsed JSON. Changes and additions are permitted for the dict object.

  • rotation – Default rotation is landscape (270) but can be 0, 90, or 180 for portrait/rotated

  • scale – Default scale is 1, but can be an integer of 1 or greater

  • debug – Turn on debug print outs. Defaults to False.

  • use_network – Enable network initialization. Defaults to True. Setting to False will allow you to use the library without a secrets.py file with wifi configuration in it.

enter_light_sleep(sleep_time: float) None

Enter light sleep and resume the program after a certain period of time.

See https://circuitpython.readthedocs.io/en/latest/shared-bindings/alarm/index.html for more details.

Parameters:

sleep_time (float) – The amount of time to sleep in seconds

adafruit_esp32s2tft.graphics

Helper library for the Adafruit ESP32-S2 TFT Feather.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_esp32s2tft.graphics.Graphics(*, default_bg: int = 0, rotation: int = 0, scale: int = 1, debug: bool = False)

Graphics Helper Class for the ESP32S2TFT Library

Parameters:
  • default_bg – The path to your default background image file or a hex color. Defaults to 0x000000.

  • rotation – Default rotation is landscape (270) but can be 0, 90, 180 for portrait/rotated

  • debug – Turn on debug print outs. Defaults to False.

adafruit_esp32s2tft.network

Helper library for the Adafruit ESP32-S2 TFT Feather.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_esp32s2tft.network.Network(*, status_neopixel: NeoPixel | None = None, extract_values: bool = True, debug: bool = False)

Network Helper Class for the ESP32S2TFT Library

Parameters:
  • status_neopixel – The initialized object for status DotStar. Defaults to None, to not use the status LED

  • extract_values (bool) – If true, single-length fetched values are automatically extracted from lists and tuples. Defaults to True.

  • debug – Turn on debug print outs. Defaults to False.

property enabled: bool

Get or Set whether the WiFi is enabled

init_io_mqtt() IO_MQTT

Initialize MQTT for Adafruit IO

init_mqtt(broker: str, port: int = 8883, username: str = None, password: str = None, use_io: bool = False) MQTT | IO_MQTT

Initialize MQTT

mqtt_connect(*args: bool | str | int, **kwargs: bool | str | int) None

Connect to MQTT

mqtt_loop(*args: int, suppress_mqtt_errors: bool = True, **kwargs: int) None

Run the MQTT Loop

mqtt_publish(*args: str | int | float, suppress_mqtt_errors: bool = True, **kwargs: str | int | float) None

Publish to MQTT

property on_mqtt_connect: Callable | None

Get or Set the MQTT Connect Handler

property on_mqtt_disconnect: Callable | None

Get or Set the MQTT Disconnect Handler

property on_mqtt_message: Callable | None

Get or Set the MQTT Message Handler

property on_mqtt_subscribe: Callable | None

Get or Set the MQTT Subscribe Handler

property on_mqtt_unsubscribe: Callable | None

Get or Set the MQTT Unsubscribe Handler

adafruit_esp32s2tft.peripherals

Helper library for the Adafruit ESP32-S2 TFT Feather.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_esp32s2tft.peripherals.Peripherals

Peripherals Helper Class for the ESP32S2TFT Library

neopixel

The on-board NeoPixel. See https://circuitpython.readthedocs.io/projects/neopixel/en/latest/api.html

Type:

Neopixel

property button: bool

Return whether Down Button is pressed

deinit() None

Call deinit on all resources to free them

property led: bool

Return or set the value of the LED