mcu_hi3321_watch/tjd/driver/tp/cst820/tp_drv_cst820.h
2025-05-26 20:15:20 +08:00

79 lines
1.9 KiB
C

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
*
* Description: ft6146_touch1.h
*
* Author: luziquan@ss-tjd.com
*
* Create: 2024-04-18
*--------------------------------------------------------------------------*/
#ifndef TP_DRV_CST820_H
#define TP_DRV_CST820_H
#include "soc_osal.h"
#include "touch_screen_def.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
typedef enum {
CST820_PRESS_DOWN = 0x00,
CST820_LIFT_UP = 0x01,
CST820_CONTACT = 0x02,
CST820_NO_EVENT = 0xC0,
} cst820_event_status;
typedef enum {
NOMAL_MODE = 0,
GESTURE_MODE = 1,
LP_MODE = 2,
DEEPSLEEP = 3,
DIFF_MODE = 4,
RAWDATA_MODE = 5,
BASELINE_MODE = 6,
CALIBRATE_MODE = 7,
FAC_TEST_MODE = 8,
ENTER_BOOT_MODE = 0xCA,
}cst820_work_mode;
#define CST8xxT_BIN_SIZE (15 * 1024)
#define U8TO16(x1, x2) ((((x1) & 0xFF) << 8) | ((x2) & 0xFF))
/* CST820 register definitions */
#define REG_CST820_GESTUREID 0x01
#define REG_CST820_FINGERINDEX 0x02
#define REG_CST820_XPOSH 0x03
#define REG_CST820_XPOSL 0x04
#define REG_CST820_YPOSH 0x05
#define REG_CST820_YPOSL 0x06
#define REG_CST820_CHIPID 0xA7
#define REG_CST820_PROJECTNUMBER 0xA8
#define REG_CST820_FIRMWAREVERSION 0xA9
#define REG_CST820_IRQPULSEWIDTH 0xED
#define REG_CST820_IRQCONTROL 0xFA
#define REG_CST820_AUTOSLEEP 0xFE
ext_errno cst820_irq_callback(uint8_t *data_buf, uint8_t data_len);
ext_errno cst820_init(void);
ext_errno cst820_deinit(void);
ext_errno cst820_resume(void);
ext_errno cst820_suspend(void);
ext_errno cst820_sleep(void);
ext_errno cst820_set_power_mode(uint8_t power_mode);
ext_errno cst820_get_rawdata(uint8_t *ret_buf);
ext_errno cst820_get_chip_id(uint8_t *ret_buf);
ext_errno cst820_get_version(uint8_t *ret_buf);
void cst820_set_gesture_wakeup_enable(bool enable);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif