Sync inav to Gitea
Make sure docs are updated / settings_md (push) Canceled after 0s
Build firmware / test (push) Canceled after 0s
Build firmware / build-SITL-Windows (push) Canceled after 0s
Build firmware / build-SITL-Mac (push) Canceled after 0s
Build firmware / build-SITL-Linux (push) Canceled after 0s
Build firmware / build-SITL-Linux-arm64 (push) Canceled after 0s
Build firmware / upload-artifacts (push) Canceled after 0s
Build firmware / build-single-target (push) Canceled after 0s
Build firmware / build (9) (push) Canceled after 0s
Build firmware / build (8) (push) Canceled after 0s
Build firmware / build (7) (push) Canceled after 0s
Build firmware / build (6) (push) Canceled after 0s
Build firmware / build (5) (push) Canceled after 0s
Build firmware / build (4) (push) Canceled after 0s
Build firmware / build (3) (push) Canceled after 0s
Build firmware / build (2) (push) Canceled after 0s
Build firmware / build (14) (push) Canceled after 0s
Build firmware / build (13) (push) Canceled after 0s
Build firmware / build (12) (push) Canceled after 0s
Build firmware / build (11) (push) Canceled after 0s
Build firmware / build (10) (push) Canceled after 0s
Build firmware / build (1) (push) Canceled after 0s
Build firmware / build (0) (push) Canceled after 0s
Build firmware / detect (push) Canceled after 0s
Build pre-release / build (push) Canceled after 0s
Build pre-release / Release (push) Canceled after 0s

This commit is contained in:
2026-08-03 16:37:40 +08:00
commit dac37fd077
14095 changed files with 5603119 additions and 0 deletions
@@ -0,0 +1,99 @@
<!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 FT6X06 Component Driver</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-ft6x06-ts-component-driver"><strong>Release Notes for FT6X06 TS Component Driver</strong></h1>
<p>Copyright © 2015 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>
This software component is licensed by ST under BSD 3-Clause license, the “License”; You may not use this component except in compliance with the License. You may obtain a copy of the License at:
<center>
<a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a>
</center>
<h1 id="purpose">Purpose</h1>
<p>This driver provides a set of Touch Screen functions offered by FT6X06 component</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-section4" checked aria-hidden="true"> <label for="collapse-section4" aria-hidden="true"><strong>V2.0.0 / 23-November-2019</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>First Official Release of FT6X06 Touch Screen Component Drivers in line with STM32Cube BSP drivers development guidelines (UM2298)</li>
<li>The component drivers are composed of
<ul>
<li>component core drivers files: ft6X06.h/.c</li>
<li>component register drivers files: ft6X06_reg.h/.c</li>
<li>component configuration file ft6X06_conf_template.h file</li>
</ul></li>
</ul>
<h2 id="backward-compatibility">Backward Compatibility</h2>
<ul>
<li>This version breaks the compatibility with previous versions</li>
</ul>
<h2 id="dependencies">Dependencies</h2>
<p>This software release is compatible with:</p>
<ul>
<li>BSP Common v6.0.0 or above</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V1.0.2 / 07-April-2017</strong></label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>Update comments to be used for PDSC generation</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" checked aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V1.0.1 / 03-Mai-2016</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>Add support of FT6x36 Touch controller</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 03-August-2015</strong></label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>First official release of <strong>FT6X06</strong> TS driver</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <span style="font-color: blue;"><a href="http://www.st.com/STM32">www.st.com</a></span>
</footer>
</body>
</html>
@@ -0,0 +1,104 @@
---
pagetitle: Release Notes for FT6X06 Component Driver
lang: en
---
::: {.row}
::: {.col-sm-12 .col-lg-4}
::: {.card .fluid}
::: {.sectione .dark}
<center>
# **Release Notes for FT6X06 TS Component Driver**
Copyright &copy; 2015 STMicroelectronics\
[![ST logo](_htmresc/st_logo.png)](https://www.st.com){.logo}
</center>
:::
:::
# License
This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this component except in
compliance with the License. You may obtain a copy of the License at:
<center>
[https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)
</center>
# Purpose
This driver provides a set of Touch Screen functions offered by FT6X06 component
:::
::: {.col-sm-12 .col-lg-8}
# Update History
::: {.collapse}
<input type="checkbox" id="collapse-section4" checked aria-hidden="true">
<label for="collapse-section4" aria-hidden="true">__V2.0.0 / 23-November-2019__</label>
<div>
## Main Changes
- First Official Release of FT6X06 Touch Screen Component Drivers in line with STM32Cube BSP drivers development guidelines (UM2298)
- The component drivers are composed of
- component core drivers files: ft6X06.h/.c
- component register drivers files: ft6X06_reg.h/.c
- component configuration file ft6X06_conf_template.h file
## Backward Compatibility
- This version breaks the compatibility with previous versions
## Dependencies
This software release is compatible with:
- BSP Common v6.0.0 or above
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section3" checked aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">__V1.0.2 / 07-April-2017__</label>
<div>
## Main Changes
- Update comments to be used for PDSC generation
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section2" checked aria-hidden="true">
<label for="collapse-section2" aria-hidden="true">__V1.0.1 / 03-Mai-2016__</label>
<div>
## Main Changes
- Add support of FT6x36 Touch controller
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section1" checked aria-hidden="true">
<label for="collapse-section1" aria-hidden="true">__V1.0.0 / 03-August-2015__</label>
<div>
## Main Changes
- First official release of **FT6X06** TS driver
</div>
:::
:::
:::
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> ,
visit: [[www.st.com](http://www.st.com/STM32)]{style="font-color: blue;"}
</footer>
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@@ -0,0 +1,543 @@
/**
******************************************************************************
* @file ft6x06.c
* @author MCD Application Team
* @brief This file provides a set of functions needed to manage the FT6X06
* IO Expander devices.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 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 "ft6x06.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @defgroup FT6X06 FT6X06
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/** @defgroup FT6X06_Exported_Variables FT6X06 Exported Variables
* @{
*/
/* Touch screen driver structure initialization */
FT6X06_TS_Drv_t FT6X06_TS_Driver =
{
FT6X06_Init,
FT6X06_DeInit,
FT6X06_GestureConfig,
FT6X06_ReadID,
FT6X06_GetState,
FT6X06_GetMultiTouchState,
FT6X06_GetGesture,
FT6X06_GetCapabilities,
FT6X06_EnableIT,
FT6X06_DisableIT,
FT6X06_ClearIT,
FT6X06_ITStatus
};
/**
* @}
*/
/** @defgroup FT6X06_Private_Function_Prototypes FT6X06 Private Function Prototypes
* @{
*/
#if (FT6X06_AUTO_CALIBRATION_ENABLED == 1)
static int32_t FT6X06_TS_Calibration(FT6X06_Object_t *pObj);
static int32_t FT6X06_Delay(FT6X06_Object_t *pObj, uint32_t Delay);
#endif /* FT6X06_AUTO_CALIBRATION_ENABLED == 1 */
static int32_t FT6X06_DetectTouch(FT6X06_Object_t *pObj);
static int32_t ReadRegWrap(void *handle, uint8_t Reg, uint8_t* Data, uint16_t Length);
static int32_t WriteRegWrap(void *handle, uint8_t Reg, uint8_t* Data, uint16_t Length);
/**
* @}
*/
/** @defgroup FT6X06_Exported_Functions FT6X06 Exported Functions
* @{
*/
/**
* @brief Register IO bus to component object
* @param Component object pointer
* @retval error status
*/
int32_t FT6X06_RegisterBusIO (FT6X06_Object_t *pObj, FT6X06_IO_t *pIO)
{
int32_t ret;
if (pObj == NULL)
{
ret = FT6X06_ERROR;
}
else
{
pObj->IO.Init = pIO->Init;
pObj->IO.DeInit = pIO->DeInit;
pObj->IO.Address = pIO->Address;
pObj->IO.WriteReg = pIO->WriteReg;
pObj->IO.ReadReg = pIO->ReadReg;
pObj->IO.GetTick = pIO->GetTick;
pObj->Ctx.ReadReg = ReadRegWrap;
pObj->Ctx.WriteReg = WriteRegWrap;
pObj->Ctx.handle = pObj;
if(pObj->IO.Init != NULL)
{
ret = pObj->IO.Init();
}
else
{
ret = FT6X06_ERROR;
}
}
return ret;
}
/**
* @brief Get FT6X06 sensor capabilities
* @param pObj Component object pointer
* @param Capabilities pointer to FT6X06 sensor capabilities
* @retval Component status
*/
int32_t FT6X06_GetCapabilities(FT6X06_Object_t *pObj, FT6X06_Capabilities_t *Capabilities)
{
/* Prevent unused argument(s) compilation warning */
(void)(pObj);
/* Store component's capabilities */
Capabilities->MultiTouch = 1;
Capabilities->Gesture = 0; /* Gesture feature is currently not activated on FW chipset */
Capabilities->MaxTouch = FT6X06_MAX_NB_TOUCH;
Capabilities->MaxXl = FT6X06_MAX_X_LENGTH;
Capabilities->MaxYl = FT6X06_MAX_Y_LENGTH;
return FT6X06_OK;
}
/**
* @brief Initialize the FT6X06 communication bus
* from MCU to FT6X06 : ie I2C channel initialization (if required).
* @param pObj Component object pointer
* @retval Component status
*/
int32_t FT6X06_Init(FT6X06_Object_t *pObj)
{
int32_t ret = FT6X06_OK;
if(pObj->IsInitialized == 0U)
{
/* Initialize IO BUS layer */
pObj->IO.Init();
#if (FT6X06_AUTO_CALIBRATION_ENABLED == 1)
/* Hw Calibration sequence start : should be done once after each power up */
/* This is called internal calibration of the touch screen */
ret += FT6X06_TS_Calibration(pObj);
#endif /* (FT6X06_AUTO_CALIBRATION_ENABLED == 1) */
/* By default set FT6X06 IC in Polling mode : no INT generation on FT6X06 for new touch available */
/* Note TS_INT is active low */
ret += FT6X06_DisableIT(pObj);
pObj->IsInitialized = 1;
}
if(ret != FT6X06_OK)
{
ret = FT6X06_ERROR;
}
return ret;
}
/**
* @brief De-Initialize the FT6X06 communication bus
* from MCU to FT6X06 : ie I2C channel initialization (if required).
* @param pObj Component object pointer
* @retval Component status
*/
int32_t FT6X06_DeInit(FT6X06_Object_t *pObj)
{
if(pObj->IsInitialized == 1U)
{
pObj->IsInitialized = 0;
}
return FT6X06_OK;
}
/**
* @brief Configure the FT6X06 gesture
* from MCU to FT6X06 : ie I2C channel initialization (if required).
* @param pObj Component object pointer
* @param GestureInit Gesture init structure
* @retval Component status
*/
int32_t FT6X06_GestureConfig(FT6X06_Object_t *pObj, FT6X06_Gesture_Init_t *GestureInit)
{
int32_t ret;
ret = ft6x06_radian_value(&pObj->Ctx, (uint8_t)GestureInit->Radian);
ret += ft6x06_offset_left_right(&pObj->Ctx, (uint8_t)GestureInit->OffsetLeftRight);
ret += ft6x06_offset_up_down(&pObj->Ctx, (uint8_t)GestureInit->OffsetUpDown);
ret += ft6x06_disatnce_left_right(&pObj->Ctx, (uint8_t)GestureInit->DistanceLeftRight);
ret += ft6x06_distance_up_down(&pObj->Ctx, (uint8_t)GestureInit->DistanceUpDown);
ret += ft6x06_distance_zoom(&pObj->Ctx, (uint8_t)GestureInit->DistanceZoom);
if(ret != FT6X06_OK)
{
ret = FT6X06_ERROR;
}
return ret;
}
/**
* @brief Read the FT6X06 device ID, pre initialize I2C in case of need to be
* able to read the FT6X06 device ID, and verify this is a FT6X06.
* @param pObj Component object pointer
* @param Id Pointer to component's ID
* @retval Component status
*/
int32_t FT6X06_ReadID(FT6X06_Object_t *pObj, uint32_t *Id)
{
int32_t ret;
uint8_t ft6x06_id;
ret = ft6x06_chip_id(&pObj->Ctx, &ft6x06_id);
*Id = (uint32_t) ft6x06_id;
return ret;
}
/**
* @brief Get the touch screen X and Y positions values
* @param pObj Component object pointer
* @param State Single Touch structure pointer
* @retval Component status.
*/
int32_t FT6X06_GetState(FT6X06_Object_t *pObj, FT6X06_State_t *State)
{
int32_t ret = FT6X06_OK;
uint8_t data[4];
State->TouchDetected = (uint32_t)FT6X06_DetectTouch(pObj);
if(ft6x06_read_reg(&pObj->Ctx, FT6X06_P1_XH_REG, data, (uint16_t)sizeof(data)) != FT6X06_OK)
{
ret = FT6X06_ERROR;
}
else
{
/* Send back first ready X position to caller */
State->TouchX = (((uint32_t)data[0] & FT6X06_P1_XH_TP_BIT_MASK) << 8) | ((uint32_t)data[1] & FT6X06_P1_XL_TP_BIT_MASK);
/* Send back first ready Y position to caller */
State->TouchY = (((uint32_t)data[2] & FT6X06_P1_YH_TP_BIT_MASK) << 8) | ((uint32_t)data[3] & FT6X06_P1_YL_TP_BIT_MASK);
}
return ret;
}
/**
* @brief Get the touch screen Xn and Yn positions values in multi-touch mode
* @param pObj Component object pointer
* @param State Multi Touch structure pointer
* @retval Component status.
*/
int32_t FT6X06_GetMultiTouchState(FT6X06_Object_t *pObj, FT6X06_MultiTouch_State_t *State)
{
int32_t ret = FT6X06_OK;
uint8_t data[12];
State->TouchDetected = (uint32_t)FT6X06_DetectTouch(pObj);
if(ft6x06_read_reg(&pObj->Ctx, FT6X06_P1_XH_REG, data, (uint16_t)sizeof(data)) != FT6X06_OK)
{
ret = FT6X06_ERROR;
}
else
{
/* Send back first ready X position to caller */
State->TouchX[0] = (((uint32_t)data[0] & FT6X06_P1_XH_TP_BIT_MASK) << 8) | ((uint32_t)data[1] & FT6X06_P1_XL_TP_BIT_MASK);
/* Send back first ready Y position to caller */
State->TouchY[0] = (((uint32_t)data[2] & FT6X06_P1_YH_TP_BIT_MASK) << 8) | ((uint32_t)data[3] & FT6X06_P1_YL_TP_BIT_MASK);
/* Send back first ready Event to caller */
State->TouchEvent[0] = (((uint32_t)data[0] & FT6X06_P1_XH_EF_BIT_MASK) >> FT6X06_P1_XH_EF_BIT_POSITION);
/* Send back first ready Weight to caller */
State->TouchWeight[0] = ((uint32_t)data[4] & FT6X06_P1_WEIGHT_BIT_MASK);
/* Send back first ready Area to caller */
State->TouchArea[0] = ((uint32_t)data[5] & FT6X06_P1_MISC_BIT_MASK) >> FT6X06_P1_MISC_BIT_POSITION;
/* Send back first ready X position to caller */
State->TouchX[1] = (((uint32_t)data[6] & FT6X06_P2_XH_TP_BIT_MASK) << 8) | ((uint32_t)data[7] & FT6X06_P2_XL_TP_BIT_MASK);
/* Send back first ready Y position to caller */
State->TouchY[1] = (((uint32_t)data[8] & FT6X06_P2_YH_TP_BIT_MASK) << 8) | ((uint32_t)data[9] & FT6X06_P2_YL_TP_BIT_MASK);
/* Send back first ready Event to caller */
State->TouchEvent[1] = (((uint32_t)data[6] & FT6X06_P2_XH_EF_BIT_MASK) >> FT6X06_P2_XH_EF_BIT_POSITION);
/* Send back first ready Weight to caller */
State->TouchWeight[1] = ((uint32_t)data[10] & FT6X06_P2_WEIGHT_BIT_MASK);
/* Send back first ready Area to caller */
State->TouchArea[1] = ((uint32_t)data[11] & FT6X06_P2_MISC_BIT_MASK) >> FT6X06_P2_MISC_BIT_POSITION;
}
return ret;
}
/**
* @brief Get Gesture ID
* @param pObj Component object pointer
* @param GestureId gesture ID
* @retval Component status
*/
int32_t FT6X06_GetGesture(FT6X06_Object_t *pObj, uint8_t *GestureId)
{
return ft6x06_gest_id(&pObj->Ctx, GestureId);
}
/**
* @brief Configure the FT6X06 device to generate IT on given INT pin
* connected to MCU as EXTI.
* @param pObj Component object pointer
* @retval Component status
*/
int32_t FT6X06_EnableIT(FT6X06_Object_t *pObj)
{
return ft6x06_g_mode(&pObj->Ctx, FT6X06_G_MODE_INTERRUPT_TRIGGER);
}
/**
* @brief Configure the FT6X06 device to stop generating IT on the given INT pin
* connected to MCU as EXTI.
* @param pObj Component object pointer
* @retval Component status
*/
int32_t FT6X06_DisableIT(FT6X06_Object_t *pObj)
{
return ft6x06_g_mode(&pObj->Ctx, FT6X06_G_MODE_INTERRUPT_POLLING);
}
/**
* @brief Get IT status from FT6X06 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 supported by FT6X06.
* @param pObj Component object pointer
* @retval Component status
*/
int32_t FT6X06_ITStatus(FT6X06_Object_t *pObj)
{
/* Prevent unused argument(s) compilation warning */
(void)(pObj);
/* Always return FT6X06_OK as feature not supported by FT6X06 */
return FT6X06_OK;
}
/**
* @brief Clear IT status in FT6X06 interrupt status clear registers
* Should be called Following an EXTI coming to the MCU.
* @note : This feature is not supported by FT6X06.
* @param pObj Component object pointer
* @retval Component status
*/
int32_t FT6X06_ClearIT(FT6X06_Object_t *pObj)
{
/* Prevent unused argument(s) compilation warning */
(void)(pObj);
/* Always return FT6X06_OK as feature not supported by FT6X06 */
return FT6X06_OK;
}
/**
* @}
*/
/** @defgroup FT6X06_Private_Functions FT6X06 Private Functions
* @{
*/
#if (FT6X06_AUTO_CALIBRATION_ENABLED == 1)
/**
* @brief This function provides accurate delay (in milliseconds)
* @param pObj pointer to component object
* @param Delay specifies the delay time length, in milliseconds
* @retval Component status
*/
static int32_t FT6X06_Delay(FT6X06_Object_t *pObj, uint32_t Delay)
{
uint32_t tickstart;
tickstart = pObj->IO.GetTick();
while((pObj->IO.GetTick() - tickstart) < Delay)
{
}
return FT6X06_OK;
}
/**
* @brief Start TouchScreen calibration phase
* @param pObj pointer to component object
* @retval Component status
*/
static int32_t FT6X06_TS_Calibration(FT6X06_Object_t *pObj)
{
int32_t ret = FT6X06_OK;
uint32_t nbr_attempt;
uint8_t read_data;
uint8_t end_calibration = 0;
/* Switch FT6X06 back to factory mode to calibrate */
if(ft6x06_dev_mode_w(&pObj->Ctx, FT6X06_DEV_MODE_FACTORY) != FT6X06_OK)
{
ret = FT6X06_ERROR;
}/* Read back the same register FT6X06_DEV_MODE_REG */
else if(ft6x06_dev_mode_r(&pObj->Ctx, &read_data) != FT6X06_OK)
{
ret = FT6X06_ERROR;
}
else
{
(void)FT6X06_Delay(pObj, 300); /* Wait 300 ms */
if(read_data != FT6X06_DEV_MODE_FACTORY )
{
/* Return error to caller */
ret = FT6X06_ERROR;
}
else
{
/* Start calibration command */
read_data= 0x04;
if(ft6x06_write_reg(&pObj->Ctx, FT6X06_TD_STAT_REG, &read_data, 1) != FT6X06_OK)
{
ret = FT6X06_ERROR;
}
else
{
(void)FT6X06_Delay(pObj, 300); /* Wait 300 ms */
/* 100 attempts to wait switch from factory mode (calibration) to working mode */
for (nbr_attempt=0; ((nbr_attempt < 100U) && (end_calibration == 0U)) ; nbr_attempt++)
{
if(ft6x06_dev_mode_r(&pObj->Ctx, &read_data) != FT6X06_OK)
{
ret = FT6X06_ERROR;
break;
}
if(read_data == FT6X06_DEV_MODE_WORKING)
{
/* Auto Switch to FT6X06_DEV_MODE_WORKING : means calibration have ended */
end_calibration = 1; /* exit for loop */
}
(void)FT6X06_Delay(pObj, 200); /* Wait 200 ms */
}
}
}
}
return ret;
}
#endif /* FT6X06_AUTO_CALIBRATION_ENABLED == 1 */
/**
* @brief Return if there is touches detected or not.
* Try to detect new touches and forget the old ones (reset internal global
* variables).
* @param pObj Component object pointer
* @retval Number of active touches detected (can be 0, 1 or 2) or FT6X06_ERROR
* in case of error
*/
static int32_t FT6X06_DetectTouch(FT6X06_Object_t *pObj)
{
int32_t ret;
uint8_t nb_touch;
/* Read register FT6X06_TD_STAT_REG to check number of touches detection */
if(ft6x06_td_status(&pObj->Ctx, &nb_touch) != FT6X06_OK)
{
ret = FT6X06_ERROR;
}
else
{
if(nb_touch > FT6X06_MAX_NB_TOUCH)
{
/* If invalid number of touch detected, set it to zero */
ret = 0;
}
else
{
ret = (int32_t)nb_touch;
}
}
return ret;
}
/**
* @brief Wrap IO bus read function to component register red function
* @param handle Component object handle
* @param Reg The target register address to read
* @param pData The target register value to be read
* @param Length buffer size to be read
* @retval Component status.
*/
static int32_t ReadRegWrap(void *handle, uint8_t Reg, uint8_t* pData, uint16_t Length)
{
FT6X06_Object_t *pObj = (FT6X06_Object_t *)handle;
return pObj->IO.ReadReg(pObj->IO.Address, Reg, pData, Length);
}
/**
* @brief Wrap IO bus write function to component register write function
* @param handle Component object handle
* @param Reg The target register address to write
* @param pData The target register value to be written
* @param Length buffer size to be written
* @retval Component status.
*/
static int32_t WriteRegWrap(void *handle, uint8_t Reg, uint8_t* pData, uint16_t Length)
{
FT6X06_Object_t *pObj = (FT6X06_Object_t *)handle;
return pObj->IO.WriteReg(pObj->IO.Address, Reg, pData, Length);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,221 @@
/**
******************************************************************************
* @file ft6x06.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the
* ft6x06.c IO expander driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 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 FT6X06_H
#define FT6X06_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "ft6x06_reg.h"
#include <stddef.h>
#include "ft6x06_conf.h"
/* Macros --------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup FT6X06
* @{
*/
/** @defgroup FT6X06_Exported_Constants FT6X06 Exported Constants
* @{
*/
#define FT6X06_OK (0)
#define FT6X06_ERROR (-1)
/* Max detectable simultaneous touches */
#define FT6X06_MAX_NB_TOUCH 2U
/* Touch FT6XX6 IDs */
#define FT6X06_ID 0x11U
#define FT6X36_ID 0xCDU
/* Possible values of FT6X06_DEV_MODE_REG */
#define FT6X06_DEV_MODE_WORKING 0x00U
#define FT6X06_DEV_MODE_FACTORY 0x04U
/* Possible values of FT6X06_GEST_ID_REG */
#define FT6X06_GEST_ID_NO_GESTURE 0x00U
#define FT6X06_GEST_ID_MOVE_UP 0x10U
#define FT6X06_GEST_ID_MOVE_RIGHT 0x14U
#define FT6X06_GEST_ID_MOVE_DOWN 0x18U
#define FT6X06_GEST_ID_MOVE_LEFT 0x1CU
#define FT6X06_GEST_ID_ZOOM_IN 0x48U
#define FT6X06_GEST_ID_ZOOM_OUT 0x49U
/* Values Pn_XH and Pn_YH related */
#define FT6X06_TOUCH_EVT_FLAG_PRESS_DOWN 0x00U
#define FT6X06_TOUCH_EVT_FLAG_LIFT_UP 0x01U
#define FT6X06_TOUCH_EVT_FLAG_CONTACT 0x02U
#define FT6X06_TOUCH_EVT_FLAG_NO_EVENT 0x03U
/* Possible values of FT6X06_GMODE_REG */
#define FT6X06_G_MODE_INTERRUPT_POLLING 0x00U
#define FT6X06_G_MODE_INTERRUPT_TRIGGER 0x01U
/**
* @}
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup FT6X06_Exported_Types FT6X06 Exported Types
* @{
*/
typedef struct
{
uint32_t Radian;
uint32_t OffsetLeftRight;
uint32_t OffsetUpDown;
uint32_t DistanceLeftRight;
uint32_t DistanceUpDown;
uint32_t DistanceZoom;
}FT6X06_Gesture_Init_t;
typedef int32_t (*FT6X06_Init_Func) (void);
typedef int32_t (*FT6X06_DeInit_Func) (void);
typedef int32_t (*FT6X06_GetTick_Func) (void);
typedef int32_t (*FT6X06_Delay_Func) (uint32_t);
typedef int32_t (*FT6X06_WriteReg_Func)(uint16_t, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*FT6X06_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
typedef struct
{
FT6X06_Init_Func Init;
FT6X06_DeInit_Func DeInit;
uint16_t Address;
FT6X06_WriteReg_Func WriteReg;
FT6X06_ReadReg_Func ReadReg;
FT6X06_GetTick_Func GetTick;
} FT6X06_IO_t;
typedef struct
{
uint32_t TouchDetected;
uint32_t TouchX;
uint32_t TouchY;
} FT6X06_State_t;
typedef struct
{
uint32_t TouchDetected;
uint32_t TouchX[FT6X06_MAX_NB_TOUCH];
uint32_t TouchY[FT6X06_MAX_NB_TOUCH];
uint32_t TouchWeight[FT6X06_MAX_NB_TOUCH];
uint32_t TouchEvent[FT6X06_MAX_NB_TOUCH];
uint32_t TouchArea[FT6X06_MAX_NB_TOUCH];
} FT6X06_MultiTouch_State_t;
typedef struct
{
FT6X06_IO_t IO;
ft6x06_ctx_t Ctx;
uint8_t IsInitialized;
} FT6X06_Object_t;
typedef struct
{
uint8_t MultiTouch;
uint8_t Gesture;
uint8_t MaxTouch;
uint32_t MaxXl;
uint32_t MaxYl;
} FT6X06_Capabilities_t;
typedef struct
{
int32_t ( *Init ) ( FT6X06_Object_t *);
int32_t ( *DeInit ) ( FT6X06_Object_t * );
int32_t ( *GestureConfig ) ( FT6X06_Object_t *, FT6X06_Gesture_Init_t* );
int32_t ( *ReadID ) ( FT6X06_Object_t *, uint32_t * );
int32_t ( *GetState ) ( FT6X06_Object_t *, FT6X06_State_t* );
int32_t ( *GetMultiTouchState ) ( FT6X06_Object_t *, FT6X06_MultiTouch_State_t* );
int32_t ( *GetGesture ) ( FT6X06_Object_t *, uint8_t* );
int32_t ( *GetCapabilities ) ( FT6X06_Object_t *, FT6X06_Capabilities_t * );
int32_t ( *EnableIT ) ( FT6X06_Object_t * );
int32_t ( *DisableIT ) ( FT6X06_Object_t * );
int32_t ( *ClearIT ) ( FT6X06_Object_t * );
int32_t ( *ITStatus ) ( FT6X06_Object_t * );
} FT6X06_TS_Drv_t;
/**
* @}
*/
/** @addtogroup FT6X06_Exported_Variables
* @{
*/
extern FT6X06_TS_Drv_t FT6X06_TS_Driver;
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup FT6X06_Exported_Functions
* @{
*/
int32_t FT6X06_RegisterBusIO (FT6X06_Object_t *pObj, FT6X06_IO_t *pIO);
int32_t FT6X06_Init(FT6X06_Object_t *pObj);
int32_t FT6X06_DeInit(FT6X06_Object_t *pObj);
int32_t FT6X06_GestureConfig(FT6X06_Object_t *pObj, FT6X06_Gesture_Init_t *GestureInit);
int32_t FT6X06_ReadID(FT6X06_Object_t *pObj, uint32_t *Id);
int32_t FT6X06_GetState(FT6X06_Object_t *pObj, FT6X06_State_t *State);
int32_t FT6X06_GetMultiTouchState(FT6X06_Object_t *pObj, FT6X06_MultiTouch_State_t *State);
int32_t FT6X06_GetGesture(FT6X06_Object_t *pObj, uint8_t *GestureId);
int32_t FT6X06_EnableIT(FT6X06_Object_t *pObj);
int32_t FT6X06_DisableIT(FT6X06_Object_t *pObj);
int32_t FT6X06_ITStatus(FT6X06_Object_t *pObj);
int32_t FT6X06_ClearIT(FT6X06_Object_t *pObj);
int32_t FT6X06_GetCapabilities(FT6X06_Object_t *pObj, FT6X06_Capabilities_t *Capabilities);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* FT6X06_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,42 @@
/**
******************************************************************************
* @file ft6x06_conf.h
* @author MCD Application Team
* @brief This file contains specific configuration for the
* ft6x06.c that can be modified by user.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 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 FT6X06_CONF_H
#define FT6X06_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Macros --------------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
#define FT6X06_AUTO_CALIBRATION_ENABLED 0U
#define FT6X06_MAX_X_LENGTH 800U
#define FT6X06_MAX_Y_LENGTH 480U
#ifdef __cplusplus
}
#endif
#endif /* FT6X06_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,710 @@
/**
******************************************************************************
* @file ft6x06_reg.c
* @author MCD Application Team
* @brief This file provides unitary register function to control the ft6x06 Touch
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 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 "ft6x06_reg.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @defgroup FT6X06
* @{
*/
/*******************************************************************************
* Function Name : ft6x06_read_reg
* Description : Generic Reading function. It must be full-filled with either
* I2C or SPI reading functions
* Input : Register Address, length of buffer
* Output : pdata Read
*******************************************************************************/
int32_t ft6x06_read_reg(ft6x06_ctx_t *ctx, uint8_t reg, uint8_t* pdata, uint16_t length)
{
return ctx->ReadReg(ctx->handle, reg, pdata, length);
}
/*******************************************************************************
* Function Name : ft6x06_write_reg
* Description : Generic Writing function. It must be full-filled with either
* I2C or SPI writing function
* Input : Register Address, pdata to be written, length of buffer
* Output : None
*******************************************************************************/
int32_t ft6x06_write_reg(ft6x06_ctx_t *ctx, uint8_t reg, uint8_t *pdata, uint16_t length)
{
return ctx->WriteReg(ctx->handle, reg, pdata, length);
}
/**************** Base Function *******************/
/*******************************************************************************
* Function Name : ft6x06_dev_mode_w
* Description : Write Device Mode
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_dev_mode_w(ft6x06_ctx_t *ctx, uint8_t value)
{
int32_t ret;
uint8_t tmp;
ret = ft6x06_read_reg(ctx, FT6X06_DEV_MODE_REG, &tmp, 1);
if(ret == 0)
{
tmp &= ~FT6X06_DEV_MODE_BIT_MASK;
tmp |= value << FT6X06_DEV_MODE_BIT_POSITION;
ret = ft6x06_write_reg(ctx, FT6X06_DEV_MODE_REG, &tmp, 1);
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_dev_mode_r
* Description : Read Device Mode
* Input : Pointer to uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_dev_mode_r(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_DEV_MODE_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_DEV_MODE_BIT_MASK;
*value = *value >> FT6X06_DEV_MODE_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_gest_id
* Description : Read Gesture ID
* Input : Pointer to uint8_t
* Output : Status of GEST_ID register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_gest_id(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_GEST_ID_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_td_status
* Description : Read Number of Touch Points
* Input : Pointer to uint8_t
* Output : Status of TD_STATUS register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_td_status(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_TD_STAT_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_TD_STATUS_BIT_MASK;
*value = *value >> FT6X06_TD_STATUS_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_p1_xh_ef
* Description : Read First X Event Flag
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P1_XH[7:6] bits
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p1_xh_ef(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_P1_XH_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_P1_XH_EF_BIT_MASK;
*value = *value >> FT6X06_P1_XH_EF_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_p1_xh_tp
* Description : Read First X High Touch Position
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P1_XH[3:0] bits
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p1_xh_tp(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_P1_XH_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_P1_XH_TP_BIT_MASK;
*value = *value >> FT6X06_P1_XH_TP_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_p1_xl_tp
* Description : Read First X Low Touch Position
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P1_XL register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p1_xl_tp(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_P1_XL_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_p1_yh_tid
* Description : Read First Touch ID
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P1_YH[7:4] bits
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p1_yh_tid(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_P1_YH_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_P1_YH_TID_BIT_MASK;
*value = *value >> FT6X06_P1_YH_TID_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_p1_yh_tp
* Description : Read First Y High Touch Position
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P1_YH[3:0] bits
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p1_yh_tp(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_P1_YH_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_P1_YH_TP_BIT_MASK;
*value = *value >> FT6X06_P1_YH_TP_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_p1_yl_tp
* Description : Read First Y Low Touch Position
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P1_YL register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p1_yl_tp(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_P1_YL_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_p1_weight
* Description : Read First Touch Weight
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P1_WEIGHT register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p1_weight(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_P1_WEIGHT_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_p1_misc
* Description : Read First Touch Area
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P1_MISC register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p1_misc(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_P1_MISC_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_P1_MISC_BIT_MASK;
*value = *value >> FT6X06_P1_MISC_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_p2_xh_ef
* Description : Read Second X Event Flag
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P2_XH[7:6] bits
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p2_xh_ef(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_P2_XH_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_P2_XH_EF_BIT_MASK;
*value = *value >> FT6X06_P2_XH_EF_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_p2_xh_tp
* Description : Read Second X High Touch Position
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P2_XH[3:0] bits
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p2_xh_tp(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_P2_XH_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_P2_XH_TP_BIT_MASK;
*value = *value >> FT6X06_P2_XH_TP_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_p2_xl_tp
* Description : Read Second X Low Touch Position
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P2_XL register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p2_xl_tp(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_P2_XL_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_p2_yh_tid
* Description : Read Second Touch ID
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P2_YH[7:4] bits
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p2_yh_tid(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_P2_YH_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_P2_YH_TID_BIT_MASK;
*value = *value >> FT6X06_P2_YH_TID_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_p2_yh_tp
* Description : Read Second Y High Touch Position
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P2_YH[3:0] bits
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p2_yh_tp(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_P2_YH_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_P2_YH_TP_BIT_MASK;
*value = *value >> FT6X06_P2_YH_TP_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_p2_yl_tp
* Description : Read Second Y Low Touch Position
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P2_YL register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p2_yl_tp(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_P2_YL_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_p2_weight
* Description : Read Second Touch Weight
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P2_WEIGHT register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p2_weight(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_P2_WEIGHT_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_p2_misc
* Description : Read Second Touch Area
* Input : Pointer to uint8_t
* Output : Status of FT6X06_P2_MISC register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_p2_misc(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_P2_MISC_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_P2_MISC_BIT_MASK;
*value = *value >> FT6X06_P2_MISC_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : ft6x06_th_group
* Description : Set Threshold for touch detection
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_th_group(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_TH_GROUP_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_th_diff
* Description : Set Filter function coefficient
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_th_diff(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_TH_DIFF_REG, &value, 1);
}
/*******************************************************************************
* Function Name : FT6X06_CTRL
* Description : Control the Switch between Active and Monitoring Mode
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_ctrl(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_CTRL_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_time_enter_monitor
* Description : Set the time period of switching from Active mode to Monitor
* mode when there is no touching.
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_time_enter_monitor(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_TIMEENTERMONITOR_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_period_active
* Description : Report rate in Active mode
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_period_active(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_PERIODACTIVE_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_period_monitor
* Description : Report rate in Monitor mode
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_period_monitor(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_PERIODMONITOR_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_radian_value
* Description : Set the value of the minimum allowed angle while Rotating
* gesture mode
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_radian_value(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_RADIAN_VALUE_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_offset_left_right
* Description : Set Maximum offset while Moving Left and Moving Right gesture
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_offset_left_right(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_OFFSET_LR_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_offset_up_down
* Description : Set Maximum offset while Moving Up and Moving Down gesture
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_offset_up_down(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_OFFSET_UD_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_disatnce_left_right
* Description : Set Minimum distance while Moving Left and Moving Right gesture
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_disatnce_left_right(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_DISTANCE_LR_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_offset_up_down
* Description : Set Minimum distance while Moving Up and Moving Down gesture
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_distance_up_down(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_DISTANCE_UD_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_distance_zoom
* Description : Set Maximum distance while Zoom In and Zoom Out gesture
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_distance_zoom(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_DISTANCE_ZOOM_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_lib_ver_high
* Description : Read High 8-bit of LIB Version info
* Input : Pointer to uint8_t
* Output : Status of FT6X06_LIB_VER_H register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_lib_ver_high(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_LIB_VER_H_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_lib_ver_low
* Description : Read Low 8-bit of LIB Version info
* Input : Pointer to uint8_t
* Output : Status of FT6X06_LIB_VER_L register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_lib_ver_low(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_LIB_VER_L_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_cipher
* Description : Chip Selecting
* Input : Pointer to uint8_t
* Output : Status of FT6X06_CIPHER register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_cipher(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_CIPHER_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_g_mode
* Description : Select Interrupt (polling or trigger) mode
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_g_mode(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_GMODE_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_pwd_mode
* Description : Select Interrupt (polling or trigger) mode
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_pwr_mode(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_PWR_MODE_REG, &value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_firm_id
* Description : Firmware Version
* Input : Pointer to uint8_t
* Output : Status of FT6X06_FIRMID register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_firm_id(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_FIRMID_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_chip_id
* Description : FocalTech's Panel ID
* Input : Pointer to uint8_t
* Output : Status of FT6X06_CHIP_ID register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_chip_id(ft6x06_ctx_t *ctx, uint8_t *value)
{
int32_t ret;
ret = ft6x06_read_reg(ctx, FT6X06_CHIP_ID_REG, (uint8_t *)value, 1);
if(ret == 0)
{
*value &= FT6X06_CHIP_ID_BIT_MASK;
*value = *value >> FT6X06_CHIP_ID_BIT_POSITION;
}
return ret;
}
/*******************************************************************************
* Function Name : release_code_id
* Description : Release code version
* Input : Pointer to uint8_t
* Output : Status of FT6X06_RELEASE_CODE_ID register
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_release_code_id(ft6x06_ctx_t *ctx, uint8_t *value)
{
return ft6x06_read_reg(ctx, FT6X06_RELEASE_CODE_ID_REG, (uint8_t *)value, 1);
}
/*******************************************************************************
* Function Name : ft6x06_state
* Description : Select Current Operating mode
* Input : uint8_t
* Output : None
* Return : Status [FT6X06_ERROR, FT6X06_OK]
*******************************************************************************/
int32_t ft6x06_state(ft6x06_ctx_t *ctx, uint8_t value)
{
return ft6x06_write_reg(ctx, FT6X06_STATE_REG, &value, 1);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,643 @@
/**
******************************************************************************
* @file ft6x06_reg.h
* @author MCD Application Team
* @brief Header of ft6x06_reg.c
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 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 FT6X06_REG_H
#define FT6X06_REG_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Macros --------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup FT6X06
* @{
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup FT6X06_Exported_Types FT6X06 Exported Types
* @{
*/
/************** Generic Function *******************/
typedef int32_t (*FT6X06_Write_Func)(void *, uint8_t, uint8_t*, uint16_t);
typedef int32_t (*FT6X06_Read_Func) (void *, uint8_t, uint8_t*, uint16_t);
/**
* @}
*/
/** @defgroup FT6X06_Imported_Globals FT6X06 Imported Globals
* @{
*/
typedef struct
{
FT6X06_Write_Func WriteReg;
FT6X06_Read_Func ReadReg;
void *handle;
} ft6x06_ctx_t;
/**
* @}
*/
/** @defgroup FT6X06_Exported_Constants FT6X06 Exported Constants
* @{
*/
/* Current mode register of the FT6X06 (R/W) */
#define FT6X06_DEV_MODE_REG 0x00U
/* Gesture ID register */
#define FT6X06_GEST_ID_REG 0x01U
/* Touch Data Status register : gives number of active touch points (0..2) */
#define FT6X06_TD_STAT_REG 0x02U
/* P1 X, Y coordinates, weight and misc registers */
#define FT6X06_P1_XH_REG 0x03U
#define FT6X06_P1_XL_REG 0x04U
#define FT6X06_P1_YH_REG 0x05U
#define FT6X06_P1_YL_REG 0x06U
#define FT6X06_P1_WEIGHT_REG 0x07U
#define FT6X06_P1_MISC_REG 0x08U
/* P2 X, Y coordinates, weight and misc registers */
#define FT6X06_P2_XH_REG 0x09U
#define FT6X06_P2_XL_REG 0x0AU
#define FT6X06_P2_YH_REG 0x0BU
#define FT6X06_P2_YL_REG 0x0CU
#define FT6X06_P2_WEIGHT_REG 0x0DU
#define FT6X06_P2_MISC_REG 0x0EU
/* Threshold for touch detection */
#define FT6X06_TH_GROUP_REG 0x80U
/* Filter function coefficients */
#define FT6X06_TH_DIFF_REG 0x85U
/* Control register */
#define FT6X06_CTRL_REG 0x86U
/* The time period of switching from Active mode to Monitor mode when there is no touching */
#define FT6X06_TIMEENTERMONITOR_REG 0x87U
/* Report rate in Active mode */
#define FT6X06_PERIODACTIVE_REG 0x88U
/* Report rate in Monitor mode */
#define FT6X06_PERIODMONITOR_REG 0x89U
/* The value of the minimum allowed angle while Rotating gesture mode */
#define FT6X06_RADIAN_VALUE_REG 0x91U
/* Maximum offset while Moving Left and Moving Right gesture */
#define FT6X06_OFFSET_LR_REG 0x92U
/* Maximum offset while Moving Up and Moving Down gesture */
#define FT6X06_OFFSET_UD_REG 0x93U
/* Minimum distance while Moving Left and Moving Right gesture */
#define FT6X06_DISTANCE_LR_REG 0x94U
/* Minimum distance while Moving Up and Moving Down gesture */
#define FT6X06_DISTANCE_UD_REG 0x95U
/* Maximum distance while Zoom In and Zoom Out gesture */
#define FT6X06_DISTANCE_ZOOM_REG 0x96U
/* High 8-bit of LIB Version info */
#define FT6X06_LIB_VER_H_REG 0xA1U
/* Low 8-bit of LIB Version info */
#define FT6X06_LIB_VER_L_REG 0xA2U
/* Chip Selecting */
#define FT6X06_CIPHER_REG 0xA3U
/* Interrupt mode register (used when in interrupt mode) */
#define FT6X06_GMODE_REG 0xA4U
/* Current power mode the FT6X06 system is in (R) */
#define FT6X06_PWR_MODE_REG 0xA5U
/* FT6X06 firmware version */
#define FT6X06_FIRMID_REG 0xA6U
/* FT6X06 Chip identification register */
#define FT6X06_CHIP_ID_REG 0xA8U
/* Release code version */
#define FT6X06_RELEASE_CODE_ID_REG 0xAFU
/* Current operating mode the FT6X06 system is in (R) */
#define FT6X06_STATE_REG 0xBCU
/**
* @}
*/
/*******************************************************************************
* Register : Generic - All
* Address : Generic - All
* Bit Group Name: None
* Permission : W
*******************************************************************************/
int32_t ft6x06_write_reg(ft6x06_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
int32_t ft6x06_read_reg(ft6x06_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
/**************** Base Function *******************/
/*******************************************************************************
* Register : DEV_MODE
* Address : 0X00
* Bit Group Name: DEVICE_MODE
* Permission : RW
*******************************************************************************/
#define FT6X06_DEV_MODE_BIT_MASK 0x70U
#define FT6X06_DEV_MODE_BIT_POSITION 4U
int32_t ft6x06_dev_mode_w(ft6x06_ctx_t *ctx, uint8_t value);
int32_t ft6x06_dev_mode_r(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : GEST_ID
* Address : 0X01
* Bit Group Name: Gesture ID
* Permission : R
*******************************************************************************/
#define FT6X06_GEST_ID_BIT_MASK 0xFFU
#define FT6X06_GEST_ID_BIT_POSITION 0U
int32_t ft6x06_gest_id(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : TD_STATUS
* Address : 0X02
* Bit Group Name:
* Permission : R
*******************************************************************************/
#define FT6X06_TD_STATUS_BIT_MASK 0x0FU
#define FT6X06_TD_STATUS_BIT_POSITION 0U
int32_t ft6x06_td_status(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_XH
* Address : 0X03
* Bit Group Name: First Event Flag
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT6X06_P1_XH_EF_BIT_MASK 0xC0U
#define FT6X06_P1_XH_EF_BIT_POSITION 6U
int32_t ft6x06_p1_xh_ef(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_XH
* Address : 0X03
* Bit Group Name: First Touch X Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT6X06_P1_XH_TP_BIT_MASK 0x0FU
#define FT6X06_P1_XH_TP_BIT_POSITION 0U
int32_t ft6x06_p1_xh_tp(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_XL
* Address : 0X04
* Bit Group Name: First Touch X Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT6X06_P1_XL_TP_BIT_MASK 0xFFU
#define FT6X06_P1_XL_TP_BIT_POSITION 0U
int32_t ft6x06_p1_xl_tp(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_YH
* Address : 0X05
* Bit Group Name: First Touch ID
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT6X06_P1_YH_TID_BIT_MASK 0xF0U
#define FT6X06_P1_YH_TID_BIT_POSITION 4U
int32_t ft6x06_p1_yh_tid(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_YH
* Address : 0x06
* Bit Group Name: First Touch Y Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT6X06_P1_YH_TP_BIT_MASK 0x0FU
#define FT6X06_P1_YH_TP_BIT_POSITION 0U
int32_t ft6x06_p1_yh_tp(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_YL
* Address : 0X06
* Bit Group Name: First Touch Y Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT6X06_P1_YL_TP_BIT_MASK 0xFFU
#define FT6X06_P1_YL_TP_BIT_POSITION 0U
int32_t ft6x06_p1_yl_tp(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_WEIGHT
* Address : 0X07
* Bit Group Name: First Touch Weight(pressure)
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT6X06_P1_WEIGHT_BIT_MASK 0xFFU
#define FT6X06_P1_WEIGHT_BIT_POSITION 0U
int32_t ft6x06_p1_weight(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_MISC
* Address : 0X08
* Bit Group Name: First Touch Area
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT6X06_P1_MISC_BIT_MASK 0xF0U
#define FT6X06_P1_MISC_BIT_POSITION 4U
int32_t ft6x06_p1_misc(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_XH
* Address : 0X09
* Bit Group Name: Second Event Flag
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT6X06_P2_XH_EF_BIT_MASK 0xC0U
#define FT6X06_P2_XH_EF_BIT_POSITION 6U
int32_t ft6x06_p2_xh_ef(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_XH
* Address : 0X09
* Bit Group Name: Second Touch X Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT6X06_P2_XH_TP_BIT_MASK 0x0FU
#define FT6X06_P2_XH_TP_BIT_POSITION 0U
int32_t ft6x06_p2_xh_tp(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_XL
* Address : 0X0A
* Bit Group Name: Second Touch X Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT6X06_P2_XL_TP_BIT_MASK 0xFFU
#define FT6X06_P2_XL_TP_BIT_POSITION 0U
int32_t ft6x06_p2_xl_tp(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_YH
* Address : 0X0B
* Bit Group Name: Second Touch ID
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT6X06_P2_YH_TID_BIT_MASK 0xF0U
#define FT6X06_P2_YH_TID_BIT_POSITION 4U
int32_t ft6x06_p2_yh_tid(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_YH
* Address : 0x0B
* Bit Group Name: Second Touch Y Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT6X06_P2_YH_TP_BIT_MASK 0x0FU
#define FT6X06_P2_YH_TP_BIT_POSITION 0U
int32_t ft6x06_p2_yh_tp(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_YL
* Address : 0X0C
* Bit Group Name: Second Touch Y Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT6X06_P2_YL_TP_BIT_MASK 0xFFU
#define FT6X06_P2_YL_TP_BIT_POSITION 0U
int32_t ft6x06_p2_yl_tp(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_WEIGHT
* Address : 0X0D
* Bit Group Name: Second Touch Weight(pressure)
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT6X06_P2_WEIGHT_BIT_MASK 0xFFU
#define FT6X06_P2_WEIGHT_BIT_POSITION 0U
int32_t ft6x06_p2_weight(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_MISC
* Address : 0X0E
* Bit Group Name: Second Touch Area
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT6X06_P2_MISC_BIT_MASK 0xF0U
#define FT6X06_P2_MISC_BIT_POSITION 4U
int32_t ft6x06_p2_misc(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : TH_GROUP
* Address : 0X80
* Bit Group Name: Threshold for touch detection
* Permission : RW
* Default value : None
*******************************************************************************/
#define FT6X06_TH_GROUP_BIT_MASK 0xFFU
#define FT6X06_TH_GROUP_BIT_POSITION 0U
int32_t ft6x06_th_group(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : TH_DIFF
* Address : 0X85
* Bit Group Name: Filter function coefficient
* Permission : RW
* Default value : None
*******************************************************************************/
#define FT6X06_TH_DIFF_BIT_MASK 0xFFU
#define FT6X06_TH_DIFF_BIT_POSITION 0U
int32_t ft6x06_th_diff(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : CTRL
* Address : 0X86
* Bit Group Name:
* Permission : RW
* Default value : 0x01
*******************************************************************************/
#define FT6X06_CTRL_BIT_MASK 0xFFU
#define FT6X06_CTRL_BIT_POSITION 0U
int32_t ft6x06_ctrl(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : TIMEENTERMONITOR
* Address : 0X87
* Bit Group Name:
* Permission : RW
* Default value : 0x0A
*******************************************************************************/
#define FT6X06_TIMEENTERMONITOR_BIT_MASK 0xFFU
#define FT6X06_TIMEENTERMONITOR_BIT_POSITION 0U
int32_t ft6x06_time_enter_monitor(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : PERIODACTIVE
* Address : 0X88
* Bit Group Name:
* Permission : RW
* Default value : None
*******************************************************************************/
#define FT6X06_PERIODACTIVE_BIT_MASK 0xFFU
#define FT6X06_PERIODACTIVE_BIT_POSITION 0U
int32_t ft6x06_period_active(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : PERIODMONITOR
* Address : 0X89
* Bit Group Name:
* Permission : RW
* Default value : 0x28
*******************************************************************************/
#define FT6X06_PERIODMONITOR_BIT_MASK 0xFFU
#define FT6X06_PERIODMONITOR_BIT_POSITION 0U
int32_t ft6x06_period_monitor(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : RADIAN_VALUE
* Address : 0X91
* Bit Group Name:
* Permission : RW
* Default value : 0x0A
*******************************************************************************/
#define FT6X06_RADIAN_VALUE_BIT_MASK 0xFFU
#define FT6X06_RADIAN_VALUE_BIT_POSITION 0U
int32_t ft6x06_radian_value(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : OFFSET_LEFT_RIGHT
* Address : 0X92
* Bit Group Name:
* Permission : RW
* Default value : 0x19
*******************************************************************************/
#define FT6X06_OFFSET_LR_BIT_MASK 0xFFU
#define FT6X06_OFFSET_LR_BIT_POSITION 0U
int32_t ft6x06_offset_left_right(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : OFFSET_UP_DOWN
* Address : 0X93
* Bit Group Name:
* Permission : RW
* Default value : 0x19
*******************************************************************************/
#define FT6X06_OFFSET_UD_BIT_MASK 0xFFU
#define FT6X06_OFFSET_UD_BIT_POSITION 0U
int32_t ft6x06_offset_up_down(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : DISTANCE_LEFT_RIGHT
* Address : 0X94
* Bit Group Name:
* Permission : RW
* Default value : 0x19
*******************************************************************************/
#define FT6X06_DISTANCE_LR_BIT_MASK 0xFFU
#define FT6X06_DISTANCE_LR_BIT_POSITION 0U
int32_t ft6x06_disatnce_left_right(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : DISTANCE_UP_DOWN
* Address : 0X95
* Bit Group Name:
* Permission : RW
* Default value : 0x19
*******************************************************************************/
#define FT6X06_DISTANCE_UD_BIT_MASK 0xFFU
#define FT6X06_DISTANCE_UD_BIT_POSITION 0U
int32_t ft6x06_distance_up_down(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : DISTANCE_ZOOM
* Address : 0X96
* Bit Group Name:
* Permission : RW
* Default value : 0x32
*******************************************************************************/
#define FT6X06_DISTANCE_ZOOM_BIT_MASK 0xFFU
#define FT6X06_DISTANCE_ZOOM_BIT_POSITION 0U
int32_t ft6x06_distance_zoom(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : LIB_VER_H
* Address : 0XA1
* Bit Group Name:
* Permission : R
* Default value : None
*******************************************************************************/
#define FT6X06_LIB_VER_H_BIT_MASK 0xFFU
#define FT6X06_LIB_VER_H_BIT_POSITION 0U
int32_t ft6x06_lib_ver_high(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : LIB_VER_L
* Address : 0XA2
* Bit Group Name:
* Permission : R
* Default value : None
*******************************************************************************/
#define FT6X06_LIB_VER_L_BIT_MASK 0xFFU
#define FT6X06_LIB_VER_L_BIT_POSITION 0U
int32_t ft6x06_lib_ver_low(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : CIPHER
* Address : 0XA3
* Bit Group Name:
* Permission : R
* Default value : 0x06
*******************************************************************************/
#define FT6X06_CIPHER_BIT_MASK 0xFFU
#define FT6X06_CIPHER_BIT_POSITION 0U
int32_t ft6x06_cipher(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : G_MODE
* Address : 0XA4
* Bit Group Name:
* Permission : RW
* Default value : 0x01
*******************************************************************************/
#define FT6X06_G_MODE_BIT_MASK 0xFFU
#define FT6X06_G_MODE_BIT_POSITION 0U
int32_t ft6x06_g_mode(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : PWR_MODE
* Address : 0XA5
* Bit Group Name:
* Permission : RW
* Default value : 0x00
*******************************************************************************/
#define FT6X06_PWR_MODE_BIT_MASK 0xFFU
#define FT6X06_PWR_MODE_BIT_POSITION 0U
int32_t ft6x06_pwr_mode(ft6x06_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : FIRMID
* Address : 0XA6
* Bit Group Name:
* Permission : R
* Default value : None
*******************************************************************************/
#define FT6X06_FIRMID_BIT_MASK 0xFFU
#define FT6X06_FIRMID_BIT_POSITION 0U
int32_t ft6x06_firm_id(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : FOCALTECH_ID
* Address : 0XA8
* Bit Group Name:
* Permission : R
* Default value : 0x11
*******************************************************************************/
#define FT6X06_CHIP_ID_BIT_MASK 0xFFU
#define FT6X06_CHIP_ID_BIT_POSITION 0U
int32_t ft6x06_chip_id(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : RELEASE_CODE_ID
* Address : 0XAF
* Bit Group Name:
* Permission : R
* Default value : 0x001
*******************************************************************************/
#define FT6X06_RC_ID_BIT_MASK 0xFFU
#define FT6X06_RC_ID_BIT_POSITION 0U
int32_t ft6x06_release_code_id(ft6x06_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : STATE
* Address : 0XBC
* Bit Group Name:
* Permission : RW
* Default value : 0x01
*******************************************************************************/
#define FT6X06_STATE_BIT_MASK 0xFFU
#define FT6X06_STATE_BIT_POSITION 0U
int32_t ft6x06_state(ft6x06_ctx_t *ctx, uint8_t value);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* FT6X06_REG_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/