-
Notifications
You must be signed in to change notification settings - Fork 2.1k
tests/drivers/touch_dev: allow to test a touch device in polling mode #19882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests/drivers/touch_dev: allow to test a touch device in polling mode #19882
Conversation
To be able to test the touch device in polling mode, variable `TOUCH_DEV_POLLING` is introduced. It is set to 0 by default and can be overriden by 1 to use the polling mode. The polling period can be controlled by the `TOUCH_DEV_POLLING_PERIOD` variable.
f6cdd15
to
2dd6457
Compare
bors merge |
👎 Rejected by too few approved reviews |
bors merge |
👎 Rejected by too few approved reviews |
bors merge |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page.
|
@aabadie Thanks for reviewing and merging. |
19885: drivers/stmpe811: changes for interrupt-driven touch handling and gesture recognition r=aabadie a=gschorcht ### Contribution description This PR contains changes needed for the purely interrupt-driven handling of the touch position as `touch_dev` device, which is a prerequisite for the realization of gesture recognition. (PR #19884). The interrupt-driven approach of `touch_dev` devices (PR #19882) and the gesture recognition (PR #19884) need continuous reporting of the touch position as long as there is at least one touch. Since the driver so far only uses the _Touch Detect_ interrupt, only the position at the beginning of a touch is available. All further positions must be polled. Therefore, the changes in this PR additionally enable the _FIFO Threshold_ interrupt when the `touch_dev` module is enabled. However, since the _Touch Detect_ interrupt does not work reliably when the _FIFO Threshold_ interrupt is enabled and the FIFO Threshold is 1, the FIFO Threshold is set to 2 by default when the `touch_dev` module is enabled. Furthermore, the FIFO queue has to be reset after reading one touch position. Otherwise new touch positions are processed with a delay if the rate of calling the function to read the FIFO is slower than the rate at which the FIFO is filled. The reason for this is that with each call of this function only the oldest touch position is read value by value from the FIFO. Gestures can't be implemented with such a behavior. ### Testing procedure 1. `tests/drivers/stmpe811` should work as before (only a single position is shown): ``` BOARD=stm32f429i-disco make -j8 -C tests/drivers/stmpe811 flash ``` ``` main(): This is RIOT! (Version: 2023.10-devel-120-g848d1- drivers/stmpe811_touch_dev_gestures) STMPE811 test application +------------Initializing------------+ Initialization successful Pressed! X: 135, Y:131 Released! ``` 2. `tests/drivers/stmpe811` should work on top of PR #19882 with continuous outputs of touch positions: ``` BOARD=stm32f429i-disco make -j8 -C tests/drivers/touch_dev flash ``` ``` main(): This is RIOT! (Version: 2023.10-devel-121-g38d3db-drivers/stmpe811_touch_dev_gestures) Event: pressed! X: 131, Y:145 X: 133, Y:141 X: 135, Y:138 X: 138, Y:133 X: 141, Y:128 X: 146, Y:122 X: 151, Y:117 Event: released! ``` 3. `tests/driver/touch_dev_gestures` of PR #19884 should work on top of this PR: ``` BOARD=stm32f429i-disco make -j8 -C tests/drivers/touch_dev_gestures flash ``` ``` main(): This is RIOT! (Version: 2023.10-devel-128-g05f690-drivers/touch_dev_gestures_work) Swipe right Swipe left Swipe down Swipe up Single Tap X: 246, Y:148 Single Tap X: 256, Y:139 Double Tap X: 247, Y:136 Pressed X: 246, Y:131 Moving X: 248, Y:132 Moving X: 250, Y:133 Moving X: 258, Y:135 Moving X: 270, Y:136 Moving X: 285, Y:132 Moving X: 300, Y:126 Moving X: 309, Y:122 Moving X: 310, Y:119 Released X: 310, Y:119 ``` ### Issues/PRs references Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
19885: drivers/stmpe811: changes for interrupt-driven touch handling and gesture recognition r=aabadie a=gschorcht ### Contribution description This PR contains changes needed for the purely interrupt-driven handling of the touch position as `touch_dev` device, which is a prerequisite for the realization of gesture recognition. (PR #19884). The interrupt-driven approach of `touch_dev` devices (PR #19882) and the gesture recognition (PR #19884) need continuous reporting of the touch position as long as there is at least one touch. Since the driver so far only uses the _Touch Detect_ interrupt, only the position at the beginning of a touch is available. All further positions must be polled. Therefore, the changes in this PR additionally enable the _FIFO Threshold_ interrupt when the `touch_dev` module is enabled. However, since the _Touch Detect_ interrupt does not work reliably when the _FIFO Threshold_ interrupt is enabled and the FIFO Threshold is 1, the FIFO Threshold is set to 2 by default when the `touch_dev` module is enabled. Furthermore, the FIFO queue has to be reset after reading one touch position. Otherwise new touch positions are processed with a delay if the rate of calling the function to read the FIFO is slower than the rate at which the FIFO is filled. The reason for this is that with each call of this function only the oldest touch position is read value by value from the FIFO. Gestures can't be implemented with such a behavior. ### Testing procedure 1. `tests/drivers/stmpe811` should work as before (only a single position is shown): ``` BOARD=stm32f429i-disco make -j8 -C tests/drivers/stmpe811 flash ``` ``` main(): This is RIOT! (Version: 2023.10-devel-120-g848d1- drivers/stmpe811_touch_dev_gestures) STMPE811 test application +------------Initializing------------+ Initialization successful Pressed! X: 135, Y:131 Released! ``` 2. `tests/drivers/stmpe811` should work on top of PR #19882 with continuous outputs of touch positions: ``` BOARD=stm32f429i-disco make -j8 -C tests/drivers/touch_dev flash ``` ``` main(): This is RIOT! (Version: 2023.10-devel-121-g38d3db-drivers/stmpe811_touch_dev_gestures) Event: pressed! X: 131, Y:145 X: 133, Y:141 X: 135, Y:138 X: 138, Y:133 X: 141, Y:128 X: 146, Y:122 X: 151, Y:117 Event: released! ``` 3. `tests/driver/touch_dev_gestures` of PR #19884 should work on top of this PR: ``` BOARD=stm32f429i-disco make -j8 -C tests/drivers/touch_dev_gestures flash ``` ``` main(): This is RIOT! (Version: 2023.10-devel-128-g05f690-drivers/touch_dev_gestures_work) Swipe right Swipe left Swipe down Swipe up Single Tap X: 246, Y:148 Single Tap X: 256, Y:139 Double Tap X: 247, Y:136 Pressed X: 246, Y:131 Moving X: 248, Y:132 Moving X: 250, Y:133 Moving X: 258, Y:135 Moving X: 270, Y:136 Moving X: 285, Y:132 Moving X: 300, Y:126 Moving X: 309, Y:122 Moving X: 310, Y:119 Released X: 310, Y:119 ``` ### Issues/PRs references Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Contribution description
To be able to test the touch device in polling mode, variable
TOUCH_DEV_POLLING
is introduced. It is set to 0 by default and can be overriden by 1 to use the polling mode. The polling period can be controlled by theTOUCH_DEV_POLLING_PERIOD
variable.To use it for
ft5x06
andstmpe811
drivers, the polling mode has to be fixed for these touch device drivers (PR #19880 respective PR #19881).Testing procedure
Use any board with touch device driver that uses the generic touch device API, for example (PR #19881 is required)
or (PR #19880 is required)
Issues/PRs references
Depends partially on PR #19880
Depends partially on PR #19881