Touch Example#
Overview#
This sample demonstrates the RT-Smart touch HAL read flow in two modes:
reading points from an already registered touch device
creating the touch device dynamically from configuration, then reading points
Source file:
src/rtsmart/examples/peripheral/touch/test_touch.c
Sample Capabilities#
print touch events:
DOWN,MOVE, andUPsupport multi-touch reads, with a sample buffer size of 5 points
print device capabilities and current configuration
support clean exit with
Ctrl+C
Key APIs (matching the current code)#
drv_touch_inst_create()drv_touch_read()drv_touch_get_info()drv_touch_get_config()drv_touch_get_default_rotate()drv_touch_inst_destroy()canmv_misc_create_touch_device()canmv_misc_delete_touch_device()
Build and Run#
Build#
cd src/rtsmart/examples/peripheral/touch
make
Run Mode 1: Test an Existing Device#
Run the sample directly to read points from an existing touch device.
Run Mode 2: Create the Device Dynamically and Test#
Use the dynamic-create path when the touch device needs to be created from configuration before reading events.
Common Parameters#
Use the device path and related touch configuration that match your board setup.
Output Interpretation#
The sample prints touch points, event type, and device information so you can confirm whether the touch input path is working correctly.
