diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/components/ft5406/fsl_ft5406.h')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/components/ft5406/fsl_ft5406.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/components/ft5406/fsl_ft5406.h b/lib/chibios-contrib/ext/mcux-sdk/components/ft5406/fsl_ft5406.h new file mode 100644 index 000000000..bc356ea40 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/components/ft5406/fsl_ft5406.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2017 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #ifndef _FSL_FT5406_H_ | ||
10 | #define _FSL_FT5406_H_ | ||
11 | |||
12 | #include "fsl_common.h" | ||
13 | |||
14 | /*! | ||
15 | * @addtogroup ft5406 | ||
16 | * @{ | ||
17 | */ | ||
18 | |||
19 | /******************************************************************************* | ||
20 | * Definitions | ||
21 | ******************************************************************************/ | ||
22 | |||
23 | /*! @brief FT5406 I2C address. */ | ||
24 | #define FT5406_I2C_ADDRESS (0x38) | ||
25 | |||
26 | /*! @brief FT5406 maximum number of simultaneously detected touches. */ | ||
27 | #define FT5406_MAX_TOUCHES (5U) | ||
28 | |||
29 | /*! @brief FT5406 register address where touch data begin. */ | ||
30 | #define FT5406_TOUCH_DATA_SUBADDR (1) | ||
31 | |||
32 | /*! @brief FT5406 raw touch data length. */ | ||
33 | #define FT5406_TOUCH_DATA_LEN (0x20) | ||
34 | |||
35 | typedef enum _touch_event | ||
36 | { | ||
37 | kTouch_Down = 0, /*!< The state changed to touched. */ | ||
38 | kTouch_Up = 1, /*!< The state changed to not touched. */ | ||
39 | kTouch_Contact = 2, /*!< There is a continuous touch being detected. */ | ||
40 | kTouch_Reserved = 3 /*!< No touch information available. */ | ||
41 | } touch_event_t; | ||
42 | |||
43 | typedef struct _touch_point | ||
44 | { | ||
45 | touch_event_t TOUCH_EVENT; /*!< Indicates the state or event of the touch point. */ | ||
46 | uint8_t TOUCH_ID; /*!< Id of the touch point. This numeric value stays constant between down and up event. */ | ||
47 | uint16_t TOUCH_X; /*!< X coordinate of the touch point */ | ||
48 | uint16_t TOUCH_Y; /*!< Y coordinate of the touch point */ | ||
49 | } touch_point_t; | ||
50 | |||
51 | typedef struct _ft5406_handle | ||
52 | { | ||
53 | I2C_Type *base; | ||
54 | i2c_master_transfer_t xfer; | ||
55 | uint8_t touch_buf[FT5406_TOUCH_DATA_LEN]; | ||
56 | } ft5406_handle_t; | ||
57 | |||
58 | status_t FT5406_Init(ft5406_handle_t *handle, I2C_Type *base); | ||
59 | |||
60 | status_t FT5406_Denit(ft5406_handle_t *handle); | ||
61 | |||
62 | status_t FT5406_GetSingleTouch(ft5406_handle_t *handle, touch_event_t *touch_event, int *touch_x, int *touch_y); | ||
63 | |||
64 | status_t FT5406_GetMultiTouch(ft5406_handle_t *handle, int *touch_count, touch_point_t touch_array[FT5406_MAX_TOUCHES]); | ||
65 | |||
66 | #endif | ||