add P4 & P5
This commit is contained in:
65
P5_SETR2/Components/ft3x67/Release_Notes.html
Normal file
65
P5_SETR2/Components/ft3x67/Release_Notes.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<title>Release Notes for FT3X67 Component Drivers</title>
|
||||
<style type="text/css">
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
span.underline{text-decoration: underline;}
|
||||
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../../../../_htmresc/mini-st.css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-4">
|
||||
<div class="card fluid">
|
||||
<div class="sectione dark">
|
||||
<center>
|
||||
<h1 id="release-notes-for-ft3x67-component-drivers"><small>Release Notes for</small> <mark>FT3X67 Component Drivers</mark></h1>
|
||||
<p>Copyright © 2017 STMicroelectronics<br />
|
||||
</p>
|
||||
<a href="https://www.st.com" class="logo"><img src="../../../../_htmresc/st_logo.png" alt="ST logo" /></a>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<h1 id="license">License</h1>
|
||||
<p>Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:</p>
|
||||
<p><a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a></p>
|
||||
<h1 id="purpose">Purpose</h1>
|
||||
<p>This directory contains the FT3X67 component drivers.</p>
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-8">
|
||||
<h1 id="update-history">Update History</h1>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section22" checked aria-hidden="true"> <label for="collapse-section22" aria-hidden="true">V1.0.1 / 03-April-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Update release notes format</li>
|
||||
<li>Reformat the BSD 3-Clause license declaration in the files header (replace license terms by a web reference to OSI website where those terms lie)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section19" aria-hidden="true"> <label for="collapse-section19" aria-hidden="true">V1.0.0 / 07-August-2017</label>
|
||||
<div>
|
||||
<h2 id="main-changes-1">Main Changes</h2>
|
||||
<ul>
|
||||
<li>First official release of Touch Screen FT3x67 Component driver</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="sticky">
|
||||
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <a href="http://www.st.com/STM32">http://www.st.com/STM32</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
443
P5_SETR2/Components/ft3x67/ft3x67.c
Normal file
443
P5_SETR2/Components/ft3x67/ft3x67.c
Normal file
@@ -0,0 +1,443 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ft3x67.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the FT3X67
|
||||
* touch screen devices.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "ft3x67.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup FT3X67
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Private_Types_Definitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* ft3x67 Handle definition. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t i2cInitialized;
|
||||
|
||||
/* field holding the current number of simultaneous active touches */
|
||||
uint8_t currActiveTouchNb;
|
||||
|
||||
/* field holding the touch index currently managed */
|
||||
uint8_t currActiveTouchIdx;
|
||||
|
||||
} ft3x67_handle_TypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Touch screen driver structure initialization */
|
||||
TS_DrvTypeDef ft3x67_ts_drv =
|
||||
{
|
||||
ft3x67_Init,
|
||||
ft3x67_ReadID,
|
||||
ft3x67_Reset,
|
||||
ft3x67_TS_Start,
|
||||
ft3x67_TS_DetectTouch,
|
||||
ft3x67_TS_GetXY,
|
||||
ft3x67_TS_EnableIT,
|
||||
ft3x67_TS_ClearIT,
|
||||
ft3x67_TS_ITStatus,
|
||||
ft3x67_TS_DisableIT
|
||||
};
|
||||
|
||||
/* Global ft3x67 handle */
|
||||
static ft3x67_handle_TypeDef ft3x67_handle = { FT3X67_I2C_NOT_INITIALIZED, 0U, 0U};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private functions prototypes-----------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
static uint8_t ft3x67_Get_I2C_InitializedStatus(void);
|
||||
static void ft3x67_I2C_InitializeIfRequired(void);
|
||||
static uint32_t ft3x67_TS_Configure(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup FT3X67_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize the ft3x67 communication bus
|
||||
* from MCU to FT3X67 : ie I2C channel initialization (if required).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @retval None
|
||||
*/
|
||||
void ft3x67_Init(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Initialize I2C link if needed */
|
||||
ft3x67_I2C_InitializeIfRequired();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Software Reset the ft3x67.
|
||||
* @note : Not applicable to FT3X67.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @retval None
|
||||
*/
|
||||
void ft3x67_Reset(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Do nothing */
|
||||
/* No software reset sequence available in FT3X67 IC */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the ft3x67 device ID, pre initialize I2C in case of need to be
|
||||
* able to read the FT3X67 device ID, and verify this is a FT3X67.
|
||||
* @param DeviceAddr: I2C FT3X67 Slave address.
|
||||
* @retval The Device ID (two bytes).
|
||||
*/
|
||||
uint16_t ft3x67_ReadID(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Initialize I2C link if needed */
|
||||
ft3x67_I2C_InitializeIfRequired();
|
||||
|
||||
/* Return the device ID value */
|
||||
return(TS_IO_Read(DeviceAddr, FT3X67_CHIP_ID_REG));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the touch Screen IC device to start detecting touches
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address).
|
||||
* @retval None.
|
||||
*/
|
||||
void ft3x67_TS_Start(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Minimum static configuration of FT3X67 */
|
||||
ft3x67_TS_Configure(DeviceAddr);
|
||||
|
||||
/* By default set FT3X67 IC in Polling mode : no INT generation on FT3X67 for new touch available */
|
||||
/* Note TS_INT is active low */
|
||||
ft3x67_TS_DisableIT(DeviceAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return if there is touches detected or not.
|
||||
* Try to detect new touches and forget the old ones (reset internal global
|
||||
* variables).
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval : Number of active touches detected (can be 0, 1 or 2).
|
||||
*/
|
||||
uint8_t ft3x67_TS_DetectTouch(uint16_t DeviceAddr)
|
||||
{
|
||||
volatile uint8_t nbTouch = 0U;
|
||||
|
||||
/* Read register FT3X67_TD_STAT_REG to check number of touches detection */
|
||||
nbTouch = TS_IO_Read(DeviceAddr, FT3X67_TD_STAT_REG);
|
||||
nbTouch &= FT3X67_TD_STAT_MASK;
|
||||
|
||||
if(nbTouch > FT3X67_MAX_DETECTABLE_TOUCH)
|
||||
{
|
||||
/* If invalid number of touch detected, set it to zero */
|
||||
nbTouch = 0U;
|
||||
}
|
||||
|
||||
/* Update ft3x67 driver internal global : current number of active touches */
|
||||
ft3x67_handle.currActiveTouchNb = nbTouch;
|
||||
|
||||
/* Reset current active touch index on which to work on */
|
||||
ft3x67_handle.currActiveTouchIdx = 0U;
|
||||
|
||||
return(nbTouch);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the touch screen X and Y positions values
|
||||
* Manage multi touch thanks to touch Index global
|
||||
* variable 'ft3x67_handle.currActiveTouchIdx'.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param X: Pointer to X position value
|
||||
* @param Y: Pointer to Y position value
|
||||
* @retval None.
|
||||
*/
|
||||
void ft3x67_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
|
||||
{
|
||||
uint8_t regAddress = 0U;
|
||||
uint8_t dataxy[4U];
|
||||
|
||||
if(ft3x67_handle.currActiveTouchIdx < ft3x67_handle.currActiveTouchNb)
|
||||
{
|
||||
switch(ft3x67_handle.currActiveTouchIdx)
|
||||
{
|
||||
case 0U :
|
||||
regAddress = FT3X67_P1_XH_REG;
|
||||
break;
|
||||
|
||||
case 1U :
|
||||
regAddress = FT3X67_P2_XH_REG;
|
||||
break;
|
||||
|
||||
default :
|
||||
break;
|
||||
} /* end switch(ft3x67_handle.currActiveTouchIdx) */
|
||||
|
||||
/* Read X and Y positions */
|
||||
TS_IO_ReadMultiple(DeviceAddr, regAddress, dataxy, sizeof(dataxy));
|
||||
|
||||
/* Send back ready X position to caller */
|
||||
*X = ((dataxy[0U] & FT3X67_TOUCH_POS_MSB_MASK) << 8U) | dataxy[1U];
|
||||
|
||||
/* Send back ready Y position to caller */
|
||||
*Y = ((dataxy[2U] & FT3X67_TOUCH_POS_MSB_MASK) << 8U) | dataxy[3U];
|
||||
|
||||
/* Increment current touch index */
|
||||
ft3x67_handle.currActiveTouchIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the FT3X67 device to generate IT on given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT3X67).
|
||||
* @retval None
|
||||
*/
|
||||
void ft3x67_TS_EnableIT(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Set interrupt trigger mode in FT3X67_GMODE_REG */
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GMODE_REG, FT3X67_G_MODE_INTERRUPT_TRIGGER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the FT3X67 device to stop generating IT on the given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT3X67).
|
||||
* @retval None
|
||||
*/
|
||||
void ft3x67_TS_DisableIT(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Set interrupt polling mode in FT3X67_GMODE_REG */
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GMODE_REG, FT3X67_G_MODE_INTERRUPT_POLLING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get IT status from FT3X67 interrupt status registers
|
||||
* Should be called Following an EXTI coming to the MCU to know the detailed
|
||||
* reason of the interrupt.
|
||||
* @note : This feature is not applicable to FT3X67.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @retval TS interrupts status : always return 0 here
|
||||
*/
|
||||
uint8_t ft3x67_TS_ITStatus(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Always return 0 as feature not applicable to FT3X67 */
|
||||
return 0U;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear IT status in FT3X67 interrupt status clear registers
|
||||
* Should be called Following an EXTI coming to the MCU.
|
||||
* @note : This feature is not applicable to FT3X67.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @retval None
|
||||
*/
|
||||
void ft3x67_TS_ClearIT(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Nothing to be done here for FT3X67 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure gesture feature (enable/disable).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @param Activation : Enable or disable gesture feature. Possible values are
|
||||
* FT3X67_GESTURE_DISABLE or FT3X67_GESTURE_ENABLE.
|
||||
* @retval None.
|
||||
*/
|
||||
void ft3x67_TS_GestureConfig(uint16_t DeviceAddr, uint32_t Activation)
|
||||
{
|
||||
if(Activation == FT3X67_GESTURE_ENABLE)
|
||||
{
|
||||
/* Enable gesture feature. */
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GESTURE_FLAG_REG, FT3X67_GEST_ALL_FLAGS_ENABLE);
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GESTURE_ENABLE_REG, FT3X67_GESTURE_ENABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable gesture feature. */
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GESTURE_FLAG_REG, FT3X67_GEST_ALL_FLAGS_DISABLE);
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GESTURE_ENABLE_REG, FT3X67_GESTURE_DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the last touch gesture identification (zoom, move up/down...).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @param pGestureId : Pointer to get last touch gesture Identification.
|
||||
* @retval None.
|
||||
*/
|
||||
void ft3x67_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId)
|
||||
{
|
||||
volatile uint8_t ucReadData = 0U;
|
||||
|
||||
ucReadData = TS_IO_Read(DeviceAddr, FT3X67_GEST_ID_REG);
|
||||
|
||||
*pGestureId = ucReadData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the touch detailed informations on touch number 'touchIdx' (0..1)
|
||||
* This touch detailed information contains :
|
||||
* - weight that was applied to this touch
|
||||
* - sub-area of the touch in the touch panel
|
||||
* - event of linked to the touch (press down, lift up, ...)
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @param touchIdx : Passed index of the touch (0..1) on which we want to get the
|
||||
* detailed information.
|
||||
* @param pWeight : Pointer to to get the weight information of 'touchIdx'.
|
||||
* @param pArea : Pointer to to get the sub-area information of 'touchIdx'.
|
||||
* @param pEvent : Pointer to to get the event information of 'touchIdx'.
|
||||
* @note Area and Weight features are not supported by FT3X67. Return always 0 value.
|
||||
* @retval None.
|
||||
*/
|
||||
void ft3x67_TS_GetTouchInfo(uint16_t DeviceAddr,
|
||||
uint32_t touchIdx,
|
||||
uint32_t * pWeight,
|
||||
uint32_t * pArea,
|
||||
uint32_t * pEvent)
|
||||
{
|
||||
volatile uint8_t ucReadData = 0U;
|
||||
uint8_t regAddressXHigh = 0U;
|
||||
|
||||
if(touchIdx < ft3x67_handle.currActiveTouchNb)
|
||||
{
|
||||
switch(touchIdx)
|
||||
{
|
||||
case 0U :
|
||||
regAddressXHigh = FT3X67_P1_XH_REG;
|
||||
break;
|
||||
|
||||
case 1U :
|
||||
regAddressXHigh = FT3X67_P2_XH_REG;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
} /* end switch(touchIdx) */
|
||||
|
||||
/* Read Event Id of touch index */
|
||||
ucReadData = TS_IO_Read(DeviceAddr, regAddressXHigh);
|
||||
*pEvent = (ucReadData & FT3X67_TOUCH_EVT_FLAG_MASK) >> FT3X67_TOUCH_EVT_FLAG_SHIFT;
|
||||
|
||||
/* Weight and area of touch index not supported by FT3X67 */
|
||||
*pWeight = 0;
|
||||
*pArea = 0;
|
||||
} /* of if(touchIdx < ft3x67_handle.currActiveTouchNb) */
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private functions bodies---------------------------------------------------*/
|
||||
|
||||
/** @addtogroup FT3X67_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Return the status of I2C was initialized or not.
|
||||
* @param None.
|
||||
* @retval : I2C initialization status.
|
||||
*/
|
||||
static uint8_t ft3x67_Get_I2C_InitializedStatus(void)
|
||||
{
|
||||
return(ft3x67_handle.i2cInitialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief I2C initialize if needed.
|
||||
* @param None.
|
||||
* @retval : None.
|
||||
*/
|
||||
static void ft3x67_I2C_InitializeIfRequired(void)
|
||||
{
|
||||
if(ft3x67_Get_I2C_InitializedStatus() == FT3X67_I2C_NOT_INITIALIZED)
|
||||
{
|
||||
/* Initialize TS IO BUS layer (I2C) */
|
||||
TS_IO_Init();
|
||||
|
||||
/* Set state to initialized */
|
||||
ft3x67_handle.i2cInitialized = FT3X67_I2C_INITIALIZED;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Basic static configuration of TouchScreen
|
||||
* @param DeviceAddr: FT3X67 Device address for communication on I2C Bus.
|
||||
* @retval Status FT3X67_STATUS_OK or FT3X67_STATUS_NOT_OK.
|
||||
*/
|
||||
static uint32_t ft3x67_TS_Configure(uint16_t DeviceAddr)
|
||||
{
|
||||
uint32_t status = FT3X67_STATUS_OK;
|
||||
|
||||
/* Disable gesture feature */
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GESTURE_ENABLE_REG, FT3X67_GESTURE_DISABLE);
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
273
P5_SETR2/Components/ft3x67/ft3x67.h
Normal file
273
P5_SETR2/Components/ft3x67/ft3x67.h
Normal file
@@ -0,0 +1,273 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ft3x67.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* ft3x67.c touch screen driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __FT3X67_H
|
||||
#define __FT3X67_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/ts.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FT3X67
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Maximum border values of the touchscreen pad */
|
||||
#define FT3X67_MAX_WIDTH 390U /* Touchscreen pad max width */
|
||||
#define FT3X67_MAX_HEIGHT 390U /* Touchscreen pad max height */
|
||||
|
||||
/* Possible values of driver functions return status */
|
||||
#define FT3X67_STATUS_OK 0x00U
|
||||
#define FT3X67_STATUS_NOT_OK 0x01U
|
||||
|
||||
/* Possible values of global variable 'TS_I2C_Initialized' */
|
||||
#define FT3X67_I2C_NOT_INITIALIZED 0x00U
|
||||
#define FT3X67_I2C_INITIALIZED 0x01U
|
||||
|
||||
/* Max detectable simultaneous touches */
|
||||
#define FT3X67_MAX_DETECTABLE_TOUCH 0x02U
|
||||
|
||||
/* Definitions for FT3X67 registers */
|
||||
|
||||
/* Current mode register of the FT3X67 (R/W) */
|
||||
#define FT3X67_DEV_MODE_REG 0x00U
|
||||
/* Possible values of FT3X67_DEV_MODE_REG */
|
||||
#define FT3X67_DEV_MODE_WORKING 0x00U
|
||||
#define FT3X67_DEV_MODE_FACTORY 0x40U
|
||||
|
||||
/* Touch Data Status register : gives number of active touch points (0..2) */
|
||||
#define FT3X67_TD_STAT_REG 0x02U
|
||||
/* Values related to FT3X67_TD_STAT_REG */
|
||||
#define FT3X67_TD_STAT_MASK 0x0FU
|
||||
|
||||
/* Values Pn_XH and Pn_YH related */
|
||||
#define FT3X67_TOUCH_EVT_FLAG_PRESS_DOWN 0x00U
|
||||
#define FT3X67_TOUCH_EVT_FLAG_LIFT_UP 0x01U
|
||||
#define FT3X67_TOUCH_EVT_FLAG_CONTACT 0x02U
|
||||
#define FT3X67_TOUCH_EVT_FLAG_NO_EVENT 0x03U
|
||||
#define FT3X67_TOUCH_EVT_FLAG_SHIFT 0x06U
|
||||
#define FT3X67_TOUCH_EVT_FLAG_MASK (3U << FT3X67_TOUCH_EVT_FLAG_SHIFT)
|
||||
#define FT3X67_TOUCH_POS_MSB_MASK 0x0FU
|
||||
|
||||
/* Point 1 registers */
|
||||
#define FT3X67_P1_XH_REG 0x03U
|
||||
#define FT3X67_P1_XL_REG 0x04U
|
||||
#define FT3X67_P1_YH_REG 0x05U
|
||||
#define FT3X67_P1_YL_REG 0x06U
|
||||
#define FT3X67_P1_WEIGHT_REG 0x07U
|
||||
#define FT3X67_P1_MISC_REG 0x08U
|
||||
|
||||
/* Point 2 registers */
|
||||
#define FT3X67_P2_XH_REG 0x09U
|
||||
#define FT3X67_P2_XL_REG 0x0AU
|
||||
#define FT3X67_P2_YH_REG 0x0BU
|
||||
#define FT3X67_P2_YL_REG 0x0CU
|
||||
#define FT3X67_P2_WEIGHT_REG 0x0DU
|
||||
#define FT3X67_P2_MISC_REG 0x0EU
|
||||
|
||||
/* Values related to Pn_MISC register */
|
||||
#define FT3X67_TOUCH_AREA_MASK (0xFU << FT3X67_TOUCH_AREA_SHIFT)
|
||||
#define FT3X67_TOUCH_AREA_SHIFT 0x04U
|
||||
|
||||
/* Threshold for touch detection register */
|
||||
#define FT3X67_TH_GROUP_REG 0x80U
|
||||
|
||||
/* Filter function coefficients register */
|
||||
#define FT3X67_TH_DIFF_REG 0x85U
|
||||
|
||||
/* Control register */
|
||||
#define FT3X67_CTRL_REG 0x86U
|
||||
/* Values related to FT3X67_CTRL_REG */
|
||||
#define FT3X67_CTRL_KEEP_ACTIVE_MODE 0x00U
|
||||
#define FT3X67_CTRL_KEEP_AUTO_SWITCH_MONITOR_MODE 0x01U
|
||||
|
||||
/* The time period of switching from Active mode to Monitor mode when there is no touching */
|
||||
#define FT3X67_TIMEENTERMONITOR_REG 0x87U
|
||||
|
||||
/* Report rate in Active mode */
|
||||
#define FT3X67_PERIODACTIVE_REG 0x88U
|
||||
|
||||
/* Report rate in Monitor mode */
|
||||
#define FT3X67_PERIODMONITOR_REG 0x89U
|
||||
|
||||
/* High 8-bit of LIB Version info */
|
||||
#define FT3X67_LIB_VER_H_REG 0xA1U
|
||||
|
||||
/* Low 8-bit of LIB Version info */
|
||||
#define FT3X67_LIB_VER_L_REG 0xA2U
|
||||
|
||||
/* Chip Selecting */
|
||||
#define FT3X67_CIPHER_REG 0xA3U
|
||||
|
||||
/* Interrupt mode register (used when in interrupt mode) */
|
||||
#define FT3X67_GMODE_REG 0xA4U
|
||||
/* Possible values of FT3X67_GMODE_REG */
|
||||
#define FT3X67_G_MODE_INTERRUPT_POLLING 0x00U
|
||||
#define FT3X67_G_MODE_INTERRUPT_TRIGGER 0x01U
|
||||
|
||||
/* Current power mode */
|
||||
#define FT3X67_PWR_MODE_REG 0xA5U
|
||||
|
||||
/* Firmware version */
|
||||
#define FT3X67_FIRMID_REG 0xA6U
|
||||
|
||||
/* Chip identification register */
|
||||
#define FT3X67_CHIP_ID_REG 0xA8U
|
||||
/* Possible values of FT3X67_CHIP_ID_REG */
|
||||
#define FT3X67_ID_VALUE 0x11U
|
||||
|
||||
/* Release code version */
|
||||
#define FT3X67_RELEASE_CODE_ID_REG 0xAFU
|
||||
|
||||
/* Current operating mode register */
|
||||
#define FT3X67_STATE_REG 0xBCU
|
||||
/* Possible values of FT3X67_STATE_REG */
|
||||
#define FT3X67_STATE_INFO_MODE 0x00U
|
||||
#define FT3X67_STATE_NORMAL_MODE 0x01U
|
||||
#define FT3X67_STATE_FACTORY_MODE 0x03U
|
||||
#define FT3X67_STATE_AUTO_CALIB_MODE 0x04U
|
||||
|
||||
/* Gesture enable register */
|
||||
#define FT3X67_GESTURE_ENABLE_REG 0xD0U
|
||||
/* Possible values of FT3X67_GESTURE_ENABLE_REG */
|
||||
#define FT3X67_GESTURE_DISABLE 0x00U
|
||||
#define FT3X67_GESTURE_ENABLE 0x01U
|
||||
|
||||
/* Gesture flag register */
|
||||
#define FT3X67_GESTURE_FLAG_REG 0xD1U
|
||||
/* Possible values of FT3X67_GESTURE_FLAG_REG can be any combination of following values */
|
||||
#define FT3X67_GEST_LINE_RIGHT_TO_LEFT_ENABLE 0x01U
|
||||
#define FT3X67_GEST_LINE_LEFT_TO_RIGHT_ENABLE 0x02U
|
||||
#define FT3X67_GEST_LINE_DOWN_TO_UP_ENABLE 0x04U
|
||||
#define FT3X67_GEST_LINE_UP_TO_DOWN_ENABLE 0x08U
|
||||
#define FT3X67_GEST_DOUBLE_TAP_ENABLE 0x10U
|
||||
#define FT3X67_GEST_ALL_FLAGS_ENABLE 0x1FU
|
||||
#define FT3X67_GEST_ALL_FLAGS_DISABLE 0x00U
|
||||
|
||||
/* Gesture ID register */
|
||||
#define FT3X67_GEST_ID_REG 0xD3U
|
||||
/* Possible values of FT3X67_GEST_ID_REG */
|
||||
#define FT3X67_GEST_ID_NO_GESTURE 0x00U
|
||||
#define FT3X67_GEST_ID_MOVE_UP 0x22U
|
||||
#define FT3X67_GEST_ID_MOVE_RIGHT 0x21U
|
||||
#define FT3X67_GEST_ID_MOVE_DOWN 0x23U
|
||||
#define FT3X67_GEST_ID_MOVE_LEFT 0x20U
|
||||
#define FT3X67_GEST_ID_DOUBLE_CLICK 0x24U
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
void ft3x67_Init(uint16_t DeviceAddr);
|
||||
void ft3x67_Reset(uint16_t DeviceAddr);
|
||||
uint16_t ft3x67_ReadID(uint16_t DeviceAddr);
|
||||
void ft3x67_TS_Start(uint16_t DeviceAddr);
|
||||
uint8_t ft3x67_TS_DetectTouch(uint16_t DeviceAddr);
|
||||
void ft3x67_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
|
||||
void ft3x67_TS_EnableIT(uint16_t DeviceAddr);
|
||||
void ft3x67_TS_DisableIT(uint16_t DeviceAddr);
|
||||
uint8_t ft3x67_TS_ITStatus (uint16_t DeviceAddr);
|
||||
void ft3x67_TS_ClearIT (uint16_t DeviceAddr);
|
||||
void ft3x67_TS_GestureConfig(uint16_t DeviceAddr, uint32_t Activation);
|
||||
void ft3x67_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId);
|
||||
void ft3x67_TS_GetTouchInfo(uint16_t DeviceAddr,
|
||||
uint32_t touchIdx,
|
||||
uint32_t * pWeight,
|
||||
uint32_t * pArea,
|
||||
uint32_t * pEvent);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Imported TS IO functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Imported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* TouchScreen (TS) external IO functions */
|
||||
extern void TS_IO_Init(void);
|
||||
extern void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
|
||||
extern uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg);
|
||||
extern uint16_t TS_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
extern void TS_IO_Delay(uint32_t Delay);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Imported global variables --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Imported_Globals
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Touch screen driver structure */
|
||||
extern TS_DrvTypeDef ft3x67_ts_drv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __FT3X67_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
Reference in New Issue
Block a user