|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Multi-touch input driver – GoodIX GT911 backend. More...
#include <stddef.h>#include <stdint.h>#include "ra8_attributes.h"#include "ra8_err.h"#include "ra8_i2c_bus_ops.h"Go to the source code of this file.
Data Structures | |
| struct | ra8_touch_point_t |
| One decoded touch contact. More... | |
| struct | ra8_touch_cfg_t |
| Configuration descriptor for ra8_touch_open. More... | |
Typedefs | |
| typedef void(* | ra8_touch_event_fn_t) (void *ctx) |
| Touch-event callback signature. | |
Enumerations | |
| enum | ra8_touch_limits_t : uint8_t { k_ra8_touch_max_points = 5U , k_ra8_touch_irq_pin_unset = 32U } |
| Static-allocation caps for the touch driver. More... | |
Functions | |
| ra8_err_t | ra8_touch_open (const ra8_touch_cfg_t *cfg) |
| Bring up the touch IC over the injected I2C bus seam. | |
| ra8_err_t | ra8_touch_close (void) |
| Tear the driver down and detach any registered handler. | |
| ra8_err_t | ra8_touch_attach_handler (ra8_touch_event_fn_t fn, void *ctx) |
| Register a touch event callback. | |
| void | ra8_touch_dispatch_irq (void) |
| Test-callable IRQ dispatch shim. | |
| ra8_err_t | ra8_touch_read (ra8_touch_point_t *out_points, uint8_t max_count, uint8_t *got_count) |
| Drain the current touch frame. | |
| ra8_err_t | ra8_touch_calibrate (void) |
| Run any backend-specific calibration routine. | |
Multi-touch input driver – GoodIX GT911 backend.
The RA8D2 has no on-die capacitive touch sensing unit (no CTSU); touch on the EK-RA8D2 ereader carrier is provided by an off-chip GoodIX GT911 IC sitting on the I2C0 bus. ra8_touch exposes a narrow, vendor-agnostic surface so a future FT5x06 / Atmel maXTouch backend can be slotted in without changing application code.
Lifecycle:
Static-allocation footprint:
Definition in file ra8_touch.h.
| typedef void(* ra8_touch_event_fn_t) (void *ctx) |
Touch-event callback signature.
Fired by ra8_touch_dispatch_irq() when the GT911 INT pin asserts. The callback is expected to call ra8_touch_read() to drain the frame; ra8_touch does not pre-decode points before dispatch because the driver does not know how many of them the application actually wants.
| [in] | ctx | Caller-supplied context. |
Definition at line 130 of file ra8_touch.h.
| enum ra8_touch_limits_t : uint8_t |
Static-allocation caps for the touch driver.
| Enumerator | |
|---|---|
| k_ra8_touch_max_points | Hard cap (matches GT911 capacity). |
| k_ra8_touch_irq_pin_unset | Sentinel for "no IRQ pin attached". |
Definition at line 70 of file ra8_touch.h.
|
nodiscard |
Register a touch event callback.
| [in] | fn | Callback fired on GT911 INT assertion. NULL detaches. |
| [in] | ctx | Forwarded to the callback as its only argument. |
| k_ra8_ok | Handler stored. |
| k_ra8_err_not_initialized | Driver is not open. |
Definition at line 424 of file ra8_touch.c.
References k_ra8_err_not_initialized, k_ra8_ok, and s_state.
|
nodiscard |
Run any backend-specific calibration routine.
No-op for GT911 (factory-calibrated). Returns k_ra8_ok so callers can wire it unconditionally; resistive backends added later will actually drive the calibration sequence here.
Definition at line 566 of file ra8_touch.c.
References k_ra8_ok.
|
nodiscard |
Tear the driver down and detach any registered handler.
| k_ra8_ok | Driver closed. |
| k_ra8_err_not_initialized | ra8_touch_open was not called. |
Definition at line 408 of file ra8_touch.c.
References k_ra8_err_not_initialized, k_ra8_ok, and s_state.
| void ra8_touch_dispatch_irq | ( | void | ) |
Test-callable IRQ dispatch shim.
Mirrors the ERI dispatch helper from ra8_i3c_i2c: this is the function the application's IRQ vector should call when the GT911 INT pin fires. The shim simply forwards to the registered handler.
Definition at line 434 of file ra8_touch.c.
References s_state.
|
nodiscard |
Bring up the touch IC over the injected I2C bus seam.
Steps:
The bus peripheral behind cfg->bus (IIC_B in I2C-compat mode at fast-mode speed today) is initialised by the app before this call, typically bound through ra8_io_i2c_bus_as_ops().
| [in] | cfg | Configuration descriptor (non-NULL). |
| k_ra8_ok | IC alive, driver ready. |
| k_ra8_err_null_ptr | cfg is NULL. |
| k_ra8_err_invalid_arg | cfg->bus seam incomplete or cfg->target_7b not 0x5D/0x14. |
| k_ra8_err_invalid_state | ra8_touch_open was already called. |
| k_ra8_err_hw_init_failed | Product-id check failed. |
Definition at line 387 of file ra8_touch.c.
References internal_open_finalise(), internal_stash_state(), internal_validate_cfg(), k_ra8_err_invalid_state, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_log_info, RA8_RETURN_ON_ERROR, s_state, and s_tag.
Referenced by ra8_board_touch_open().
|
nodiscard |
Drain the current touch frame.
Sequence:
| [out] | out_points | Destination buffer (non-NULL, must hold max_count entries). |
| [in] | max_count | Capacity of out_points, in entries. |
| [out] | got_count | Number of valid entries written. |
| k_ra8_ok | Frame drained (possibly empty). |
| k_ra8_err_null_ptr | Any pointer NULL. |
| k_ra8_err_invalid_arg | max_count == 0. |
| k_ra8_err_not_initialized | Driver is not open. |
| k_ra8_err_hw_error | I2C transport failed. |
Definition at line 551 of file ra8_touch.c.
References internal_read_inner(), k_ra8_err_invalid_arg, k_ra8_err_not_initialized, RA8_CHECK_NULL_PTR, s_state, and s_tag.
Referenced by cm_poll_touch(), er_poll_touch(), ez_poll_touch(), internal_tc_read_raw(), internal_td_poll_points(), ls_poll_touch(), mg_poll_touch(), and sh_pump_input().