Skip to content

drives/input: support ST7123 touchscreen controller - #19674

Open
fdcavalcanti wants to merge 2 commits into
apache:masterfrom
fdcavalcanti:feature/st7123-touch
Open

drives/input: support ST7123 touchscreen controller#19674
fdcavalcanti wants to merge 2 commits into
apache:masterfrom
fdcavalcanti:feature/st7123-touch

Conversation

@fdcavalcanti

@fdcavalcanti fdcavalcanti commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Add support for ST7123 touchscreen controller (I2C only).
It requires board level init to register a callback, as polling mode is not supported.

  • Add an I2C lower-half driver for the ST7123 capacitive touchscreen (drivers/input/st7123.c)
  • Interrupt-driven only: board GPIO ISR calls st7123_interrupt_callback(), HPWORK reads the full touch frame and reports contacts via touch_event()
  • Exposes /dev/inputN through the standard touchscreen upper half (multi-touch, DOWN/MOVE/UP, pressure, basic gestures)
  • Document board integration under Documentation/components/drivers/character/input/st7123.rst

Datasheet: link

AI Disclaimer

AI agents used for code documentation only.

Impact

  • New optional Kconfig: CONFIG_INPUT_ST7123 (default off); no effect unless selected
  • Boards must wire I2C + INT and call st7123_register() / st7123_interrupt_callback(); polling is not supported
  • Apps read struct touch_sample_s; multi-touch needs a buffer sized with SIZEOF_TOUCH_SAMPLE_S(n)

Testing

Tested on esp32p4-tab5.
Device is working as expected. Here's the output from tc_main (touchscreen example):

nsh> tc
tc_main: nsamples: 0
tc_main: Opening /dev/input0
`

Touching corner:

Sample     :
   npoints : 1
Point 1    :
        id : 0
     flags : 39
         x : 66
         y : 58
         h : 0
         w : 0
  pressure : 46
  gesture  : ff
 timestamp : 5680000

Touch middle:

Sample     :
   npoints : 1
Point 1    :
        id : 0
     flags : 1c
         x : 380
         y : 597
         h : 0
         w : 0
  pressure : 15
  gesture  : 00
 timestamp : 88860000

@github-actions github-actions Bot added Area: Drivers Drivers issues Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. labels Aug 3, 2026
@acassis

acassis commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi @fdcavalcanti please fix this CI issue:

❌ Missing git commit message
Used config files:
    1: .codespellrc
Some checks failed. For contributing guidelines, see:
  https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@fdcavalcanti
fdcavalcanti force-pushed the feature/st7123-touch branch from a4f749f to 35380f0 Compare August 3, 2026 23:37
Comment thread drivers/input/st7123.c Outdated
Comment thread drivers/input/st7123.c Outdated
Comment thread drivers/input/st7123.c Outdated
Comment thread drivers/input/st7123.c Outdated
Comment thread drivers/input/st7123.c Outdated
Comment thread include/nuttx/input/st7123.h
eren-terzioglu
eren-terzioglu previously approved these changes Aug 4, 2026
Add support for ST7123 touchscreen controller (I2C only).
It requires board level init to register a callback, as polling
mode is not supported.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
Adds documentation to input and touchscreen controller files, regarding
support for ST7123 IC.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
@fdcavalcanti

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 all fixes applied, thanks for the review!

Comment thread drivers/input/st7123.c

/* Registered device instance used by st7123_interrupt_callback(). */

static FAR struct st7123_dev_t *g_st7123_dev;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to support the multiple instances? let's remove this global variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Drivers Drivers issues Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants