LCOV - code coverage report
Current view: top level - zephyr/drivers/misc/ft8xx - ft8xx.h Hit Total Coverage
Test: new.info Lines: 7 13 53.8 %
Date: 2024-12-22 00:14:23

          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             : 
      17             : #ifdef __cplusplus
      18             : extern "C" {
      19             : #endif
      20             : 
      21             : /**
      22             :  * @brief FT8xx driver public APIs
      23             :  * @defgroup ft8xx_interface FT8xx driver APIs
      24             :  * @ingroup misc_interfaces
      25             :  * @{
      26             :  */
      27             : 
      28             : /**
      29             :  * @struct ft8xx_touch_transform
      30             :  * @brief Structure holding touchscreen calibration data
      31             :  *
      32             :  * The content of this structure is filled by ft8xx_calibrate().
      33             :  */
      34           1 : struct ft8xx_touch_transform {
      35           0 :         uint32_t a;
      36           0 :         uint32_t b;
      37           0 :         uint32_t c;
      38           0 :         uint32_t d;
      39           0 :         uint32_t e;
      40           0 :         uint32_t f;
      41             : };
      42             : 
      43             : /**
      44             :  * @typedef ft8xx_int_callback
      45             :  * @brief Callback API to inform API user that FT8xx triggered interrupt
      46             :  *
      47             :  * This callback is called from IRQ context.
      48             :  */
      49           1 : typedef void (*ft8xx_int_callback)(void);
      50             : 
      51             : /**
      52             :  * @brief Calibrate touchscreen
      53             :  *
      54             :  * Run touchscreen calibration procedure that collects three touches from touch
      55             :  * screen. Computed calibration result is automatically applied to the
      56             :  * touchscreen processing and returned with @p data.
      57             :  *
      58             :  * The content of @p data may be stored and used after reset in
      59             :  * ft8xx_touch_transform_set() to avoid calibrating touchscreen after each
      60             :  * device reset.
      61             :  *
      62             :  * @param data Pointer to touchscreen transform structure to populate
      63             :  */
      64           1 : void ft8xx_calibrate(struct ft8xx_touch_transform *data);
      65             : 
      66             : /**
      67             :  * @brief Set touchscreen calibration data
      68             :  *
      69             :  * Apply given touchscreen transform data to the touchscreen processing.
      70             :  * Data is to be obtained from calibration procedure started with
      71             :  * ft8xx_calibrate().
      72             :  *
      73             :  * @param data Pointer to touchscreen transform structure to apply
      74             :  */
      75           1 : void ft8xx_touch_transform_set(const struct ft8xx_touch_transform *data);
      76             : 
      77             : /**
      78             :  * @brief Get tag of recently touched element
      79             :  *
      80             :  * @return Tag value 0-255 of recently touched element
      81             :  */
      82           1 : int ft8xx_get_touch_tag(void);
      83             : 
      84             : /**
      85             :  * @brief Set callback executed when FT8xx triggers interrupt
      86             :  *
      87             :  * This function configures FT8xx to trigger interrupt when touch event changes
      88             :  * tag value.
      89             :  *
      90             :  * When touch event changes tag value, FT8xx activates INT line. The line is
      91             :  * kept active until ft8xx_get_touch_tag() is called. It results in single
      92             :  * execution of @p callback until ft8xx_get_touch_tag() is called.
      93             :  *
      94             :  * @param callback Pointer to function called when FT8xx triggers interrupt
      95             :  */
      96           1 : void ft8xx_register_int(ft8xx_int_callback callback);
      97             : 
      98             : /**
      99             :  * @}
     100             :  */
     101             : 
     102             : #ifdef __cplusplus
     103             : }
     104             : #endif
     105             : 
     106             : #endif /* ZEPHYR_DRIVERS_MISC_FT8XX_FT8XX_H_ */

Generated by: LCOV version 1.14