LCOV - code coverage report
Current view: top level - zephyr/drivers/misc/ft8xx - ft8xx.h Coverage Total Hit
Test: new.info Lines: 53.8 % 13 7
Test Date: 2025-09-05 16:43:28

            Line data    Source code
       1            1 : /*
       2              :  * Copyright (c) 2020 Hubert Miś
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : /**
       8              :  * @file
       9              :  * @brief FT8XX public API
      10              :  */
      11              : 
      12              : #ifndef ZEPHYR_DRIVERS_MISC_FT8XX_FT8XX_H_
      13              : #define ZEPHYR_DRIVERS_MISC_FT8XX_FT8XX_H_
      14              : 
      15              : #include <stdint.h>
      16              : #include <zephyr/device.h>
      17              : 
      18              : #ifdef __cplusplus
      19              : extern "C" {
      20              : #endif
      21              : 
      22              : /**
      23              :  * @brief FT8xx driver public APIs
      24              :  * @defgroup ft8xx_interface FT8xx driver APIs
      25              :  * @ingroup misc_interfaces
      26              :  * @{
      27              :  */
      28              : 
      29              : /**
      30              :  * @struct ft8xx_touch_transform
      31              :  * @brief Structure holding touchscreen calibration data
      32              :  *
      33              :  * The content of this structure is filled by ft8xx_calibrate().
      34              :  */
      35            1 : struct ft8xx_touch_transform {
      36            0 :         uint32_t a; /*< Coefficient A of the bitmap transform matrix */
      37            0 :         uint32_t b; /*< Coefficient B of the bitmap transform matrix */
      38            0 :         uint32_t c; /*< Coefficient C of the bitmap transform matrix */
      39            0 :         uint32_t d; /*< Coefficient D of the bitmap transform matrix */
      40            0 :         uint32_t e; /*< Coefficient E of the bitmap transform matrix */
      41            0 :         uint32_t f; /*< Coefficient F of the bitmap transform matrix */
      42              : };
      43              : 
      44              : /**
      45              :  * @typedef ft8xx_int_callback
      46              :  * @brief Callback API to inform API user that FT8xx triggered interrupt
      47              :  *
      48              :  * This callback is called from IRQ context.
      49              :  *
      50              :  * @param dev Pointer to the device structure for the driver instance
      51              :  * @param user_data Pointer to user data provided during callback registration
      52              :  */
      53            1 : typedef void (*ft8xx_int_callback)(const struct device *dev, void *user_data);
      54              : 
      55              : /**
      56              :  * @brief Calibrate touchscreen
      57              :  *
      58              :  * Run touchscreen calibration procedure that collects three touches from touch
      59              :  * screen. Computed calibration result is automatically applied to the
      60              :  * touchscreen processing and returned with @p data.
      61              :  *
      62              :  * The content of @p data may be stored and used after reset in
      63              :  * ft8xx_touch_transform_set() to avoid calibrating touchscreen after each
      64              :  * device reset.
      65              :  *
      66              :  * @param dev  Pointer to the device structure for the driver instance
      67              :  * @param data Pointer to touchscreen transform structure to populate
      68              :  */
      69            1 : void ft8xx_calibrate(const struct device *dev,
      70              :                      struct ft8xx_touch_transform *data);
      71              : 
      72              : /**
      73              :  * @brief Set touchscreen calibration data
      74              :  *
      75              :  * Apply given touchscreen transform data to the touchscreen processing.
      76              :  * Data is to be obtained from calibration procedure started with
      77              :  * ft8xx_calibrate().
      78              :  *
      79              :  * @param dev  Pointer to the device structure for the driver instance
      80              :  * @param data Pointer to touchscreen transform structure to apply
      81              :  */
      82            1 : void ft8xx_touch_transform_set(const struct device *dev,
      83              :                                const struct ft8xx_touch_transform *data);
      84              : 
      85              : /**
      86              :  * @brief Get tag of recently touched element
      87              :  *
      88              :  * @param dev Pointer to the device structure for the driver instance
      89              :  *
      90              :  * @return Tag value 0-255 of recently touched element
      91              :  */
      92            1 : int ft8xx_get_touch_tag(const struct device *dev);
      93              : 
      94              : /**
      95              :  * @brief Set callback executed when FT8xx triggers interrupt
      96              :  *
      97              :  * This function configures FT8xx to trigger interrupt when touch event changes
      98              :  * tag value.
      99              :  *
     100              :  * When touch event changes tag value, FT8xx activates INT line. The line is
     101              :  * kept active until ft8xx_get_touch_tag() is called. It results in single
     102              :  * execution of @p callback until ft8xx_get_touch_tag() is called.
     103              :  *
     104              :  * @param dev       Pointer to the device structure for the driver instance
     105              :  * @param callback  Pointer to function called when FT8xx triggers interrupt
     106              :  * @param user_data Pointer to user data to be passed to the @p callback
     107              :  */
     108            1 : void ft8xx_register_int(const struct device *dev,
     109              :                         ft8xx_int_callback callback,
     110              :                         void *user_data);
     111              : 
     112              : /**
     113              :  * @}
     114              :  */
     115              : 
     116              : #ifdef __cplusplus
     117              : }
     118              : #endif
     119              : 
     120              : #endif /* ZEPHYR_DRIVERS_MISC_FT8XX_FT8XX_H_ */
        

Generated by: LCOV version 2.0-1