This module provides a device-level API for STMPE610 resistive touch controllers over SPI (e.g.
More...
|
| struct | dev_stmpe610_config_t |
| | Optional STMPE610 initialization options. More...
|
| |
| struct | dev_stmpe610_touch_t |
| | The single touch contact reported to a dev_stmpe610_callback_t - unlike a capacitive controller, STMPE610 is resistive and only ever reports one point at a time. More...
|
| |
This module provides a device-level API for STMPE610 resistive touch controllers over SPI (e.g.
Adafruit's 2.8" PiTFT resistive touch display, which pairs it with an ILI9341 display controller on the same SPI bus but a separate chip-select).
◆ dev_stmpe610_callback_t
◆ dev_stmpe610_touch_event_t
Touch contact state reported to a dev_stmpe610_callback_t.
| Enumerator |
|---|
| dev_stmpe610_touch_up | Contact lifted - no longer touching.
|
| dev_stmpe610_touch_down | A new contact.
|
| dev_stmpe610_touch_move | An existing contact moved.
|
Definition at line 39 of file stmpe610.h.
dev_stmpe610_touch_event_t
Touch contact state reported to a dev_stmpe610_callback_t.
Contact lifted - no longer touching.
An existing contact moved.
◆ dev_stmpe610_default_config()
Fill an STMPE610 config struct with safe defaults.
- Parameters
-
| config | Config structure to initialize. |
◆ dev_stmpe610_deinit()
Deinitialize an STMPE610 controller.
- Parameters
-
Passing NULL is safe and is a no-op.
◆ dev_stmpe610_init()
Initialize an STMPE610 resistive touch controller over SPI.
- Parameters
-
| device | SPI device handle from hw_spi_init() / hw_spi_init_default() / hw_spi_init_device(), already opened on the controller's own chip-select (separate from any display sharing the same bus). |
| int_pin | Optional interrupt GPIO handle. Pass NULL to always poll. |
| callback | Optional callback invoked from dev_stmpe610_poll() each time the touch state actually changes. Pass NULL if only dev_stmpe610_irq_active() or the interrupt pin's own level matters. |
| userdata | User-defined data pointer passed to callback. |
| config | Optional pointer to initialization options. Pass NULL to use default values. |
- Returns
- STMPE610 handle, or
NULL on failure (including a chip ID mismatch - nothing responding correctly at the given chip-select).
◆ dev_stmpe610_irq_active()
Report whether the STMPE610 interrupt line is currently asserted.
- Parameters
-
- Return values
-
| true | The controller is signalling a pending update. |
| false | No pending update is signalled, or no interrupt pin exists. |
◆ dev_stmpe610_poll()
Poll the controller, invoking the callback if the touch state changed.
- Parameters
-
When an interrupt pin is configured, this function skips the SPI transaction entirely when no touch is pending and the previous sample was already idle. The callback registered with dev_stmpe610_init() (if any) is invoked only when a new contact, a moved contact, or a lifted contact is actually detected - never for an unchanged, still-idle, or still-touching-with-nothing-new poll.