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-25 19:22:35

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

Generated by: LCOV version 2.0-1