1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/drivers/ft5x06
bors[bot] 5cf32002f5
Merge #19880
19880: drivers/ft5x06: fix initialization if callback function parameter is NULL r=aabadie a=gschorcht

### Contribution description

This PR fixes the `ft5x06` driver initialization if the callback function parameter `cb` is `NULL. This might be the case for example if the application uses the touch device in polling mode.

If the interrupt 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`.

To be able to test the polling mode, this PR also includes a change of the `tests/drivers/ft5x06` application which introduces the environment variables `FT5X06_POLLING_MODE` `FT5X06_POLLING_PERIOD` and in the makefile.

### Testing procedure

1. Use any board with a FTXXXX touch device and test it in polling mode, for example:
   ```
   FT5X06_POLLING_MODE=1 BOARD=stm32f746g-disco make -C tests/drivers/ft5x06 flash term
   ```
   It should work as expected.
   ```
   main(): This is RIOT! (Version: 2023.10-devel-119-g92a44a-drivers/ft5x06_fix_cb_null)
   FT5x06 test application
   +------------Initializing------------+
   Initialization successful
   1 touch detected
   Touch 1 - X: 236, Y:111
   Touch 1 - X: 236, Y:111
   ...
   Touch 1 - X: 236, Y:111
   Released!
   ```

2. Checkout master branch and cerry-pick commit 691a5e6308426ddc685e5a2c297238529211c258. The test application `tests/drivers/ft5x06` will crash once a touch event occur:
   ```
   +------------Initializing------------+
   Initialization successful
   1 touch detected
   Context before hardfault:
   ```

### Issues/PRs references

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-08-29 08:19:52 +00:00
..
include drivers/ft5x06: introduce coordinate conversions 2023-08-26 17:49:29 +02:00
ft5x06_internal.c drivers/ft5x06: use a const pointer to params instead of a copy 2023-08-23 23:36:39 +02:00
ft5x06_touch_dev.c drivers/ft5x06: use a const pointer to params instead of a copy 2023-08-23 23:36:39 +02:00
ft5x06.c Merge #19880 2023-08-29 08:19:52 +00:00
Kconfig drivers/ft5x06: remove unnecessary pseudomodules 2022-01-21 14:13:49 +01:00
Makefile drivers/ft5x06: add touch panel driver 2022-01-08 15:08:05 +01:00
Makefile.dep drivers/ft5x06: add touch panel driver 2022-01-08 15:08:05 +01:00
Makefile.include drivers/ft5x06: remove unnecessary pseudomodules 2022-01-21 14:13:49 +01:00