VSF Documented
vsf_input_gt9xx.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2026 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * You may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 *****************************************************************************/
16
17#ifndef __VSF_INPUT_GT9XX_H__
18#define __VSF_INPUT_GT9XX_H__
19
20/* Driver for GT9xx series from Goodix(GT911/GT9147/GT9157/GT1151...) */
21
22/*============================ INCLUDES ======================================*/
23
25
26#if VSF_USE_INPUT == ENABLED && VSF_INPUT_USE_GT9XX == ENABLED
27
28#include "hal/vsf_hal.h"
29#include "kernel/vsf_kernel.h"
30
31#if defined(__VSF_INPUT_GT9XX_CLASS_IMPLEMENT)
32# undef __VSF_INPUT_GT9XX_CLASS_IMPLEMENT
33# define __VSF_CLASS_IMPLEMENT__
34#endif
35
36#include "utilities/ooc_class.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42/*============================ MACROS ========================================*/
43
44#if VSF_HAL_USE_I2C != ENABLED
45# error Touch Screen chip GT9xx series need I2C enabled
46#endif
47
48// frame trigger selection: with EXTI support compiled in, a board whose
49// TP_INT pad is wired sets gpio_int and runs interrupt driven; gpio_int
50// NULL(boards without a routed data-ready pad) makes the driver poll with
51// an internal callback timer instead
52#ifndef VSF_INPUT_GT9XX_CFG_SUPPORT_EXTI
53# define VSF_INPUT_GT9XX_CFG_SUPPORT_EXTI VSF_HAL_USE_GPIO
54#endif
55
56// poll period in milliseconds(poll mode only)
57#ifndef VSF_INPUT_GT9XX_CFG_POLL_MS
58# define VSF_INPUT_GT9XX_CFG_POLL_MS 15
59#endif
60
61/*============================ MACROFIED FUNCTIONS ===========================*/
62/*============================ TYPES =========================================*/
63
65 public_member(
66 union {
67 vsf_i2c_regacc_t regacc;
69 };
70
71#if VSF_INPUT_GT9XX_CFG_SUPPORT_EXTI == ENABLED
72 // data-ready interrupt pad. NULL selects poll mode. the driver does
73 // not run the vendor power-on sequence itself: the reset rising
74 // edge latches one of the two slave addresses with the int pad
75 // level, so boards that wire the reset output run their sequence
76 // BEFORE vk_input_gt9xx_init and the driver probes both latched
77 // addresses instead
78 vsf_gpio_t *gpio_int;
79 uint8_t gpio_int_pin;
80#endif
81
82 uint16_t width;
83 uint16_t height;
84
85 // probe outcome, polled from THREAD context: the driver NEVER
86 // traces from its interrupt paths - vsf_trace is not isr-safe on
87 // every config, so consumers read these flags instead.
88 // is_ready=1 after a product-id match, probe_failed=1 after both
89 // latched slave addresses stayed silent
90 uint8_t is_ready;
91 uint8_t probe_failed;
92 )
93 private_member(
94 // status byte + up to 5 points x 8 bytes, one regacc read from
95 // the status register(the point fifo sits right behind it)
96 uint8_t buffer[1 + 5 * 8];
97 uint8_t last_down;
98 uint8_t addr_idx;
100 vsf_arch_prio_t prio;
101 vsf_callback_timer_t poll_timer;
102 )
103};
104
105/*============================ GLOBAL VARIABLES ==============================*/
106/*============================ LOCAL VARIABLES ===============================*/
107/*============================ PROTOTYPES ====================================*/
108
109// asynchronous init: i2c master + product-id probe over both latched slave
110// addresses, then arms the frame trigger - the int pad EXTI when wired, a
111// periodic timer otherwise(all flow afterwards is interrupt driven)
113
114#ifdef __cplusplus
115}
116#endif
117
118#endif // VSF_USE_INPUT && VSF_INPUT_USE_GT9XX
119#endif // __VSF_INPUT_GT9XX_H__
vsf_err_t
Definition __type.h:42
Definition vsf_input_gt9xx.h:64
Task-independent timer; when it expires the kernel task invokes the user callback.
Definition vsf_eda.h:1937
Definition vsf_i2c_util.h:42
vsf_arch_prio_t
Definition cortex_a_generic.h:85
#define vsf_class(__name)
Definition ooc_class.h:52
unsigned short uint16_t
Definition stdint.h:7
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_template_gpio.h:942
vsf_err_t vk_input_gt9xx_init(vk_input_gt9xx_t *gt9xx, vsf_arch_prio_t prio)
Definition vsf_input_gt9xx.c:297
uint8_t state
Definition vsf_msg_tree.h:247
Generated from commit: vsfteam/vsf@37e3cbb