NXP
/
rt1050_emwin_gui_demo
RT1050 GUI demo using emWin library
source/fsl_ft5406_rt.h@0:dd702039127a, 2018-09-20 (annotated)
- Committer:
- alejandroRL
- Date:
- Thu Sep 20 19:16:34 2018 +0000
- Revision:
- 0:dd702039127a
emWin GUI Demo for RT1050
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
alejandroRL | 0:dd702039127a | 1 | /* |
alejandroRL | 0:dd702039127a | 2 | * The Clear BSD License |
alejandroRL | 0:dd702039127a | 3 | * Copyright (c) 2016, Freescale Semiconductor, Inc. |
alejandroRL | 0:dd702039127a | 4 | * Copyright 2016-2017 NXP |
alejandroRL | 0:dd702039127a | 5 | * All rights reserved. |
alejandroRL | 0:dd702039127a | 6 | * |
alejandroRL | 0:dd702039127a | 7 | * Redistribution and use in source and binary forms, with or without modification, |
alejandroRL | 0:dd702039127a | 8 | * are permitted (subject to the limitations in the disclaimer below) provided |
alejandroRL | 0:dd702039127a | 9 | * that the following conditions are met: |
alejandroRL | 0:dd702039127a | 10 | * |
alejandroRL | 0:dd702039127a | 11 | * o Redistributions of source code must retain the above copyright notice, this list |
alejandroRL | 0:dd702039127a | 12 | * of conditions and the following disclaimer. |
alejandroRL | 0:dd702039127a | 13 | * |
alejandroRL | 0:dd702039127a | 14 | * o Redistributions in binary form must reproduce the above copyright notice, this |
alejandroRL | 0:dd702039127a | 15 | * list of conditions and the following disclaimer in the documentation and/or |
alejandroRL | 0:dd702039127a | 16 | * other materials provided with the distribution. |
alejandroRL | 0:dd702039127a | 17 | * |
alejandroRL | 0:dd702039127a | 18 | * o Neither the name of the copyright holder nor the names of its |
alejandroRL | 0:dd702039127a | 19 | * contributors may be used to endorse or promote products derived from this |
alejandroRL | 0:dd702039127a | 20 | * software without specific prior written permission. |
alejandroRL | 0:dd702039127a | 21 | * |
alejandroRL | 0:dd702039127a | 22 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. |
alejandroRL | 0:dd702039127a | 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
alejandroRL | 0:dd702039127a | 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
alejandroRL | 0:dd702039127a | 25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
alejandroRL | 0:dd702039127a | 26 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
alejandroRL | 0:dd702039127a | 27 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
alejandroRL | 0:dd702039127a | 28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
alejandroRL | 0:dd702039127a | 29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
alejandroRL | 0:dd702039127a | 30 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
alejandroRL | 0:dd702039127a | 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
alejandroRL | 0:dd702039127a | 32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
alejandroRL | 0:dd702039127a | 33 | */ |
alejandroRL | 0:dd702039127a | 34 | |
alejandroRL | 0:dd702039127a | 35 | #ifndef _FSL_FT5406_RT_H_ |
alejandroRL | 0:dd702039127a | 36 | #define _FSL_FT5406_RT_H_ |
alejandroRL | 0:dd702039127a | 37 | |
alejandroRL | 0:dd702039127a | 38 | #include "fsl_common.h" |
alejandroRL | 0:dd702039127a | 39 | |
alejandroRL | 0:dd702039127a | 40 | /*! |
alejandroRL | 0:dd702039127a | 41 | * @addtogroup ft5406_rt |
alejandroRL | 0:dd702039127a | 42 | * @{ |
alejandroRL | 0:dd702039127a | 43 | */ |
alejandroRL | 0:dd702039127a | 44 | |
alejandroRL | 0:dd702039127a | 45 | /******************************************************************************* |
alejandroRL | 0:dd702039127a | 46 | * Definitions |
alejandroRL | 0:dd702039127a | 47 | ******************************************************************************/ |
alejandroRL | 0:dd702039127a | 48 | |
alejandroRL | 0:dd702039127a | 49 | /*! @brief FT5406_RT I2C address. */ |
alejandroRL | 0:dd702039127a | 50 | #define FT5406_RT_I2C_ADDRESS (0x38) |
alejandroRL | 0:dd702039127a | 51 | |
alejandroRL | 0:dd702039127a | 52 | /*! @brief FT5406_RT maximum number of simultaneously detected touches. */ |
alejandroRL | 0:dd702039127a | 53 | #define FT5406_RT_MAX_TOUCHES (5U) |
alejandroRL | 0:dd702039127a | 54 | |
alejandroRL | 0:dd702039127a | 55 | /*! @brief FT5406_RT register address where touch data begin. */ |
alejandroRL | 0:dd702039127a | 56 | #define FT5406_RT_TOUCH_DATA_SUBADDR (1) |
alejandroRL | 0:dd702039127a | 57 | |
alejandroRL | 0:dd702039127a | 58 | /*! @brief FT5406_RT raw touch data length. */ |
alejandroRL | 0:dd702039127a | 59 | #define FT5406_RT_TOUCH_DATA_LEN (0x20) |
alejandroRL | 0:dd702039127a | 60 | |
alejandroRL | 0:dd702039127a | 61 | typedef enum _touch_event |
alejandroRL | 0:dd702039127a | 62 | { |
alejandroRL | 0:dd702039127a | 63 | kTouch_Down = 0, /*!< The state changed to touched. */ |
alejandroRL | 0:dd702039127a | 64 | kTouch_Up = 1, /*!< The state changed to not touched. */ |
alejandroRL | 0:dd702039127a | 65 | kTouch_Contact = 2, /*!< There is a continuous touch being detected. */ |
alejandroRL | 0:dd702039127a | 66 | kTouch_Reserved = 3 /*!< No touch information available. */ |
alejandroRL | 0:dd702039127a | 67 | } touch_event_t; |
alejandroRL | 0:dd702039127a | 68 | |
alejandroRL | 0:dd702039127a | 69 | typedef struct _touch_point |
alejandroRL | 0:dd702039127a | 70 | { |
alejandroRL | 0:dd702039127a | 71 | touch_event_t TOUCH_EVENT; /*!< Indicates the state or event of the touch point. */ |
alejandroRL | 0:dd702039127a | 72 | uint8_t TOUCH_ID; /*!< Id of the touch point. This numeric value stays constant between down and up event. */ |
alejandroRL | 0:dd702039127a | 73 | uint16_t TOUCH_X; /*!< X coordinate of the touch point */ |
alejandroRL | 0:dd702039127a | 74 | uint16_t TOUCH_Y; /*!< Y coordinate of the touch point */ |
alejandroRL | 0:dd702039127a | 75 | } touch_point_t; |
alejandroRL | 0:dd702039127a | 76 | |
alejandroRL | 0:dd702039127a | 77 | typedef struct _ft5406_rt_handle |
alejandroRL | 0:dd702039127a | 78 | { |
alejandroRL | 0:dd702039127a | 79 | LPI2C_Type *base; |
alejandroRL | 0:dd702039127a | 80 | lpi2c_master_transfer_t xfer; |
alejandroRL | 0:dd702039127a | 81 | uint8_t touch_buf[FT5406_RT_TOUCH_DATA_LEN]; |
alejandroRL | 0:dd702039127a | 82 | } ft5406_rt_handle_t; |
alejandroRL | 0:dd702039127a | 83 | |
alejandroRL | 0:dd702039127a | 84 | status_t FT5406_RT_Init(ft5406_rt_handle_t *handle, LPI2C_Type *base); |
alejandroRL | 0:dd702039127a | 85 | |
alejandroRL | 0:dd702039127a | 86 | status_t FT5406_RT_Denit(ft5406_rt_handle_t *handle); |
alejandroRL | 0:dd702039127a | 87 | |
alejandroRL | 0:dd702039127a | 88 | status_t FT5406_RT_GetSingleTouch(ft5406_rt_handle_t *handle, touch_event_t *touch_event, int *touch_x, int *touch_y); |
alejandroRL | 0:dd702039127a | 89 | |
alejandroRL | 0:dd702039127a | 90 | status_t FT5406_RT_GetMultiTouch(ft5406_rt_handle_t *handle, |
alejandroRL | 0:dd702039127a | 91 | int *touch_count, |
alejandroRL | 0:dd702039127a | 92 | touch_point_t touch_array[FT5406_RT_MAX_TOUCHES]); |
alejandroRL | 0:dd702039127a | 93 | |
alejandroRL | 0:dd702039127a | 94 | #endif |