From a5a08f0d6384717fe2e957d6feaf0300fa2a8337 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 14 Aug 2023 17:48:51 +0200 Subject: [PATCH] drivers/touch_dev: add a function to get the maximum number of touches --- drivers/include/touch_dev.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/include/touch_dev.h b/drivers/include/touch_dev.h index 8d2c38636c..4d0b898521 100644 --- a/drivers/include/touch_dev.h +++ b/drivers/include/touch_dev.h @@ -76,6 +76,18 @@ typedef struct { */ uint16_t (*width)(const touch_dev_t *dev); + /** + * @brief Get the maximum number of touches the touch device supports + * + * This function pointer can be NULL. In this case, the maximum number of + * touches is assumed to be 1. + * + * @param[in] dev Pointer to the touch device + * + * @return number of touches + */ + uint8_t (*max_numof)(const touch_dev_t *dev); + /** * @brief Get the current touches on the touch device * @@ -157,6 +169,19 @@ uint16_t touch_dev_height(const touch_dev_t *dev); */ uint16_t touch_dev_width(const touch_dev_t *dev); +/** + * @brief Get the maximum number of touches the touch device supports + * + * @param[in] dev Pointer to the touch device + * + * @return number of touches + */ +static inline uint8_t touch_dev_max_numof(const touch_dev_t *dev) +{ + assert(dev); + return (dev->driver->max_numof) ? dev->driver->max_numof(dev) : 1; +} + /** * @brief Get the current touches on the touch device *