1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

33 Commits

Author SHA1 Message Date
MrKevinWeiss
7a68fb0d5e
*Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
Gunar Schorcht
ebe51e7f51 drivers/stmpe811: introduce coordinate conversion
To obtain coordinates from the touch panel that correspond to the display coordinates, it is often necessary to convert the coordinates from the touch display by swapping and mirroring. For the sake of simplicity, possible rotations are additionally defined.
2023-09-02 17:01:46 +02:00
bors[bot]
8017249bab
Merge #19885
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>
2023-08-31 06:21:40 +00:00
Gunar Schorcht
0382e10e6f drivers/stmpe811: use FIFO thresh interrupt for touch_dev by default 2023-08-30 16:52:25 +02:00
Gunar Schorcht
9aecdaf2f6 drivers/stmpe811: enable FIFO threshold interrupt
For continuous reporting of the touch position the FIFO threshold interrupt is used. This is necessary for example to implement gestures in interrupt mode. To activate the FIFO threshold interrupt and thus continuous reporting, the macro 'STMPE811_FIFO_THRESHOLD_ENABLED' must be set to 1. However, the driver only works reliably with FIFO threshold interrupts if the FIFO threshold value is at least 2. Otherwise the Touch Detect interrupt will not work correctly when a touch is released. Therefore, the FIFO threshold is set to 2 by default when `STMPE811_FIFO_THRESHOLD_ENABLED` is set. This default value can be overwritten by `STMPE811_FIFO_THRESHOLD`.
2023-08-30 16:52:25 +02:00
Gunar Schorcht
3531770689 drivers/stmpe811: reset the FIFO queue after read
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 always only the oldest touch position is read value by value from the FIFO. Gestures, for example, can't be implemented with such a behavior
2023-08-30 16:52:25 +02:00
Gunar Schorcht
b921bf460b drivers/stmpe811: init INT pin only if callback is defined
If the INT pin is initialized if the callback function parameter `cb` is `NULL`, the driver crashes the first time an interrupt is triggered. Therefore, the INT pin must be initialized only if also the callback function parameter `cb` is not `NULL`.

Even if the interrupt pin is not initialized here because the callback function parameter `cb` is NULL, the device interrupts are configured here so that they will work when the interrupt pin is initialized later, as is the case when the Touch Device API is used, for example. Since the interrupt state is cleared on each read, this is not a problem even if the interrupt pin is not used at all.
2023-08-13 17:11:54 +02:00
Karl Fessel
05f114d0af doc: fix unbalaced grouping
- most were trivial
    - missing group close or open
    - extra space
    - no doxygen comment
- name commad might open an implicit group
    this hould also be implicit cosed but does not happen somtimes
- crazy: internal declared groups have to be closed internal
2022-09-14 15:05:25 +02:00
8e56da3658
drivers/stmpe811: don't use a choice to select the bus 2022-01-22 15:14:26 +01:00
240f80e43a
drivers/stmpe811: extend Kconfig 2022-01-22 15:14:17 +01:00
96f338bafc
drivers/stmpe811: cleanup Kconfig 2022-01-22 15:14:17 +01:00
86192de81b
drivers/stmpe811: improve interrupt callback management 2022-01-07 18:30:34 +01:00
34f2cc6083
drivers: make use of new driver_with_{disp,touch}_dev.mk 2022-01-06 12:07:07 +01:00
benpicco
ccc97db715
Merge pull request #17360 from viktorbatista/debug_fixes
core/include/debug.h: minor fix in debug.h
2021-12-09 12:41:33 +01:00
Benjamin Valentin
75a6892480 drivers/stmpe811: add ; after DEBUG() 2021-12-08 21:47:29 +01:00
0076eb83fc
drivers/stmpe811: migrate to ztimer 2021-12-08 15:15:30 +01:00
Francisco Molina
e17fe0aee2 drivers/stmpe811: add spi mode 2021-12-03 17:12:03 +01:00
Francisco Molina
9a2c880a60 drivers/stmpe811: use errno 2021-10-30 23:25:50 +02:00
f9f394c88b
drivers/stmpe811: add touch_dev set event callback wrapper 2021-03-03 18:00:49 +01:00
1362c61abb
drivers/stmpe811: add runtime configurable event callback 2021-03-03 18:00:49 +01:00
7e1d4c323a
drivers/stmpe811: add config for screen identifiers 2021-03-03 18:00:48 +01:00
Leandro Lanzieri
c8cbc2f20e
drivers/stmpe811: add module to Kconfig 2021-01-21 11:22:32 +01:00
Benjamin Valentin
14da3717c1 drivers/stmpe811: convert to xtimer_msleep() 2020-11-05 11:32:41 +01:00
Bas Stottelaar
92b1dfc703 drivers/*: realign ENABLE_DEBUG 2020-10-23 01:26:09 +02:00
Gunar Schorcht
6d61381d2a drivers: use inline functions for GPIO comparisons
The expandable GPIO API requires the comparison of structured GPIO types. This means that inline functions must be used instead of direct comparisons. For the migration process, drivers must first be changed so that they use the inline comparison functions.
2020-08-31 13:10:28 +02:00
f7882f4f2a
drivers/stmpe811: return touch_dev position relative to top left corner 2020-07-29 14:49:17 +02:00
37b096562a
drivers/stmpe811: ensure fifo is not empty before reading touch position 2020-07-22 09:59:18 +02:00
Benjamin Valentin
caead7bb75
drivers/stmpe811: always clear interrupt state 2020-07-22 09:59:11 +02:00
Benjamin Valentin
cbae0186ca
drivers/stmpe811: fix interrupt polarity & type
The Interrupt on the stmpe811 is generated on the falling edge.
By observing the rising edge, we will only get an event if the
interrupt gets cleared.

Also configure the interrupt to be edge triggered instead of
level triggered.
2020-07-21 21:22:42 +02:00
304bce3724
drivers: configure per driver dependency resolution 2020-07-20 14:32:16 +02:00
490126cfa0
drivers: move USEMODULE_INCLUDES in each driver directories 2020-07-15 20:36:27 +02:00
c0f46c06bb
drivers/stmpe811: provide adaption to touch_dev interface 2020-04-28 18:18:01 +02:00
1bc842707a
drivers/stmpe811: add implementation 2020-02-13 09:14:51 +01:00