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 *