mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/ft5x06: 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`.
This commit is contained in:
parent
4af04c846f
commit
7ac2865f7e
@ -80,7 +80,7 @@ int ft5x06_init(ft5x06_t *dev, const ft5x06_params_t *params, ft5x06_event_cb_t
|
||||
}
|
||||
|
||||
/* Configure interrupt */
|
||||
if (gpio_is_valid(dev->params->int_pin)) {
|
||||
if (gpio_is_valid(dev->params->int_pin) && cb) {
|
||||
DEBUG("[ft5x06] init: configuring touchscreen interrupt\n");
|
||||
gpio_init_int(dev->params->int_pin, GPIO_IN, GPIO_RISING, cb, arg);
|
||||
i2c_write_reg(FT5X06_BUS, FT5X06_ADDR, FT5X06_G_MODE_REG, FT5X06_G_MODE_INTERRUPT_TRIGGER & 0x01, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user