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
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:
@@ -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 FT5336 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-ft5336-ts-component-driver"><strong>Release Notes for FT5336 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 FT5336 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.1 / 30-October-2019</strong></label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Update st_logo.png inclusion path in Release notes.</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>V2.0.0 / 14-October-2019</strong></label>
|
||||
<div>
|
||||
<h2 id="main-changes-1">Main Changes</h2>
|
||||
<ul>
|
||||
<li>First Official Release of FT5336 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: ft5336.h/.c</li>
|
||||
<li>component register drivers files: ft5336_regs.h/.c</li>
|
||||
<li>component configuration file ft5336_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.1 or above</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 / 07-April-2017</strong></label>
|
||||
<div>
|
||||
<h2 id="main-changes-2">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-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 25-June-2015</strong></label>
|
||||
<div>
|
||||
<h2 id="main-changes-3">Main Changes</h2>
|
||||
<ul>
|
||||
<li>First official release of <strong>FT5336</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 FT5336 Component Driver
|
||||
lang: en
|
||||
---
|
||||
::: {.row}
|
||||
::: {.col-sm-12 .col-lg-4}
|
||||
|
||||
::: {.card .fluid}
|
||||
::: {.sectione .dark}
|
||||
<center>
|
||||
# **Release Notes for FT5336 TS Component Driver**
|
||||
Copyright © 2015 STMicroelectronics\
|
||||
|
||||
[](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 FT5336 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.1 / 30-October-2019__</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
- Update st_logo.png inclusion path in Release notes.
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section3" checked aria-hidden="true">
|
||||
<label for="collapse-section3" aria-hidden="true">__V2.0.0 / 14-October-2019__</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
- First Official Release of FT5336 Touch Screen Component Drivers in line with STM32Cube BSP drivers development guidelines (UM2298)
|
||||
- The component drivers are composed of
|
||||
- component core drivers files: ft5336.h/.c
|
||||
- component register drivers files: ft5336_regs.h/.c
|
||||
- component configuration file ft5336_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.1 or above
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section2" checked aria-hidden="true">
|
||||
<label for="collapse-section2" aria-hidden="true">__V1.0.1 / 07-April-2017__</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
- Update comments to be used for PDSC generation
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section1" checked aria-hidden="true">
|
||||
<label for="collapse-section1" aria-hidden="true">__V1.0.0 / 25-June-2015__</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
- First official release of **FT5336** 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,525 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ft5336.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the FT5336
|
||||
* IO Expander devices.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2015 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 "ft5336.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FT5336 FT5336
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/** @defgroup FT5336_Exported_Variables FT5336 Exported Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Touch screen driver structure initialization */
|
||||
FT5336_TS_Drv_t FT5336_TS_Driver =
|
||||
{
|
||||
FT5336_Init,
|
||||
FT5336_DeInit,
|
||||
FT5336_GestureConfig,
|
||||
FT5336_ReadID,
|
||||
FT5336_GetState,
|
||||
FT5336_GetMultiTouchState,
|
||||
FT5336_GetGesture,
|
||||
FT5336_GetCapabilities,
|
||||
FT5336_EnableIT,
|
||||
FT5336_DisableIT,
|
||||
FT5336_ClearIT,
|
||||
FT5336_ITStatus
|
||||
};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup FT5336_Private_Function_Prototypes FT5336 Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
#if (FT5336_AUTO_CALIBRATION_ENABLED == 1)
|
||||
static int32_t FT5336_TS_Calibration(FT5336_Object_t *pObj);
|
||||
static int32_t FT5336_Delay(FT5336_Object_t *pObj, uint32_t Delay);
|
||||
#endif /* FT5336_AUTO_CALIBRATION_ENABLED == 1 */
|
||||
static int32_t FT5336_DetectTouch(FT5336_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 FT5336_Exported_Functions FT5336 Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Register IO bus to component object
|
||||
* @param Component object pointer
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t FT5336_RegisterBusIO (FT5336_Object_t *pObj, FT5336_IO_t *pIO)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
if (pObj == NULL)
|
||||
{
|
||||
ret = FT5336_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 = FT5336_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get FT5336 sensor capabilities
|
||||
* @param pObj Component object pointer
|
||||
* @param Capabilities pointer to FT5336 sensor capabilities
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t FT5336_GetCapabilities(FT5336_Object_t *pObj, FT5336_Capabilities_t *Capabilities)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
(void)(pObj);
|
||||
|
||||
/* Store component's capabilities */
|
||||
Capabilities->MultiTouch = 1;
|
||||
Capabilities->Gesture = 1;
|
||||
Capabilities->MaxTouch = FT5336_MAX_NB_TOUCH;
|
||||
Capabilities->MaxXl = FT5336_MAX_X_LENGTH;
|
||||
Capabilities->MaxYl = FT5336_MAX_Y_LENGTH;
|
||||
|
||||
return FT5336_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the FT5336 communication bus
|
||||
* from MCU to FT5336 : ie I2C channel initialization (if required).
|
||||
* @param pObj Component object pointer
|
||||
* @param GestureInit: Gesture init structure
|
||||
* @retval FT5336_OK
|
||||
*/
|
||||
int32_t FT5336_Init(FT5336_Object_t *pObj)
|
||||
{
|
||||
int32_t ret = FT5336_OK;
|
||||
|
||||
if(pObj->IsInitialized == 0U)
|
||||
{
|
||||
/* Initialize IO BUS layer */
|
||||
pObj->IO.Init();
|
||||
|
||||
#if (FT5336_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 += FT5336_TS_Calibration(pObj);
|
||||
#endif /* (FT5336_AUTO_CALIBRATION_ENABLED == 1) */
|
||||
/* By default set FT5336 IC in Polling mode : no INT generation on FT5336 for new touch available */
|
||||
/* Note TS_INT is active low */
|
||||
ret += FT5336_DisableIT(pObj);
|
||||
|
||||
pObj->IsInitialized = 1;
|
||||
}
|
||||
|
||||
if(ret != FT5336_OK)
|
||||
{
|
||||
ret = FT5336_ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief De-Initialize the FT5336 communication bus
|
||||
* from MCU to FT5336 : ie I2C channel initialization (if required).
|
||||
* @param pObj Component object pointer
|
||||
* @retval FT5336_OK
|
||||
*/
|
||||
int32_t FT5336_DeInit(FT5336_Object_t *pObj)
|
||||
{
|
||||
int32_t ret = FT5336_OK;
|
||||
|
||||
if(pObj->IsInitialized == 1U)
|
||||
{
|
||||
pObj->IsInitialized = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the FT5336 gesture
|
||||
* @param pObj Component object pointer
|
||||
* @param GestureInit Gesture init structure
|
||||
* @retval FT5336_OK
|
||||
*/
|
||||
int32_t FT5336_GestureConfig(FT5336_Object_t *pObj, FT5336_Gesture_Init_t *GestureInit)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
ret = ft5336_radian_value(&pObj->Ctx, (uint8_t)GestureInit->Radian);
|
||||
ret += ft5336_offset_left_right(&pObj->Ctx, (uint8_t)GestureInit->OffsetLeftRight);
|
||||
ret += ft5336_offset_up_down(&pObj->Ctx, (uint8_t)GestureInit->OffsetUpDown);
|
||||
ret += ft5336_disatnce_left_right(&pObj->Ctx, (uint8_t)GestureInit->DistanceLeftRight);
|
||||
ret += ft5336_distance_up_down(&pObj->Ctx, (uint8_t)GestureInit->DistanceUpDown);
|
||||
ret += ft5336_distance_zoom(&pObj->Ctx, (uint8_t)GestureInit->DistanceZoom);
|
||||
|
||||
if(ret != FT5336_OK)
|
||||
{
|
||||
ret = FT5336_ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the FT5336 device ID, pre initialize I2C in case of need to be
|
||||
* able to read the FT5336 device ID, and verify this is a FT5336.
|
||||
* @param pObj Component object pointer
|
||||
* @retval The Device ID (two bytes).
|
||||
*/
|
||||
int32_t FT5336_ReadID(FT5336_Object_t *pObj, uint32_t *Id)
|
||||
{
|
||||
return ft5336_chip_id(&pObj->Ctx, (uint8_t *)Id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the touch screen X and Y positions values
|
||||
* @param pObj Component object pointer
|
||||
* @param State: Single Touch stucture pointer
|
||||
* @retval FT5336_OK.
|
||||
*/
|
||||
int32_t FT5336_GetState(FT5336_Object_t *pObj, FT5336_State_t *State)
|
||||
{
|
||||
int32_t ret = FT5336_OK;
|
||||
uint8_t data[4];
|
||||
|
||||
State->TouchDetected = (uint32_t)FT5336_DetectTouch(pObj);
|
||||
if(ft5336_read_reg(&pObj->Ctx, FT5336_P1_XH_REG, data, (uint16_t)sizeof(data)) != FT5336_OK)
|
||||
{
|
||||
ret = FT5336_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Send back first ready X position to caller */
|
||||
State->TouchX = (((uint32_t)data[0] & FT5336_P1_XH_TP_BIT_MASK) << 8) | ((uint32_t)data[1] & FT5336_P1_XL_TP_BIT_MASK);
|
||||
/* Send back first ready Y position to caller */
|
||||
State->TouchY = (((uint32_t)data[2] & FT5336_P1_YH_TP_BIT_MASK) << 8) | ((uint32_t)data[3] & FT5336_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 FT5336_OK.
|
||||
*/
|
||||
int32_t FT5336_GetMultiTouchState(FT5336_Object_t *pObj, FT5336_MultiTouch_State_t *State)
|
||||
{
|
||||
int32_t ret = FT5336_OK;
|
||||
uint8_t data[30];
|
||||
uint32_t i;
|
||||
|
||||
State->TouchDetected = (uint32_t)FT5336_DetectTouch(pObj);
|
||||
|
||||
if(ft5336_read_reg(&pObj->Ctx, FT5336_P1_XH_REG, data, (uint16_t)sizeof(data)) != FT5336_OK)
|
||||
{
|
||||
ret = FT5336_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i = 0; i < FT5336_MAX_NB_TOUCH; i++)
|
||||
{
|
||||
/* Send back first ready X position to caller */
|
||||
State->TouchX[i] = (((uint32_t)data[i*6U] & FT5336_P1_XH_TP_BIT_MASK) << 8U) | ((uint32_t)data[(i*6U) + 1U] & FT5336_P1_XL_TP_BIT_MASK);
|
||||
/* Send back first ready Y position to caller */
|
||||
State->TouchY[i] = (((uint32_t)data[(i*6U) + 2U] & FT5336_P1_YH_TP_BIT_MASK) << 8U) | ((uint32_t)data[(i*6U) + 3U] & FT5336_P1_YL_TP_BIT_MASK);
|
||||
/* Send back first ready Event to caller */
|
||||
State->TouchEvent[i] = (((uint32_t)data[i*6U] & FT5336_P1_XH_EF_BIT_MASK) >> FT5336_P1_XH_EF_BIT_POSITION);
|
||||
/* Send back first ready Weight to caller */
|
||||
State->TouchWeight[i] = ((uint32_t)data[(i*6U) + 4U] & FT5336_P1_WEIGHT_BIT_MASK);
|
||||
/* Send back first ready Area to caller */
|
||||
State->TouchArea[i] = ((uint32_t)data[(i*6U) + 5U] & FT5336_P1_MISC_BIT_MASK) >> FT5336_P1_MISC_BIT_POSITION;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get Gesture ID
|
||||
* @param pObj Component object pointer
|
||||
* @param GestureId: gesture ID
|
||||
* @retval Gesture ID.
|
||||
*/
|
||||
int32_t FT5336_GetGesture(FT5336_Object_t *pObj, uint8_t *GestureId)
|
||||
{
|
||||
return ft5336_gest_id(&pObj->Ctx, GestureId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the FT5336 device to generate IT on given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param pObj Component object pointer
|
||||
* @retval None
|
||||
*/
|
||||
int32_t FT5336_EnableIT(FT5336_Object_t *pObj)
|
||||
{
|
||||
return ft5336_g_mode(&pObj->Ctx, FT5336_G_MODE_INTERRUPT_TRIGGER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the FT5336 device to stop generating IT on the given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param pObj Component object pointer
|
||||
* @retval None
|
||||
*/
|
||||
int32_t FT5336_DisableIT(FT5336_Object_t *pObj)
|
||||
{
|
||||
return ft5336_g_mode(&pObj->Ctx, FT5336_G_MODE_INTERRUPT_POLLING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get IT status from FT5336 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 FT5336.
|
||||
* @param pObj Component object pointer
|
||||
* @retval TS interrupts status : always return 0 here
|
||||
*/
|
||||
int32_t FT5336_ITStatus(FT5336_Object_t *pObj)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
(void)(pObj);
|
||||
|
||||
/* Always return FT5336_OK as feature not applicable to FT5336 */
|
||||
return FT5336_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear IT status in FT5336 interrupt status clear registers
|
||||
* Should be called Following an EXTI coming to the MCU.
|
||||
* @note : This feature is not applicable to FT5336.
|
||||
* @param pObj Component object pointer
|
||||
* @retval None
|
||||
*/
|
||||
int32_t FT5336_ClearIT(FT5336_Object_t *pObj)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
(void)(pObj);
|
||||
|
||||
/* Always return FT5336_OK as feature not applicable to FT5336 */
|
||||
return FT5336_OK;
|
||||
}
|
||||
|
||||
/******************** Static functions ****************************************/
|
||||
#if (FT5336_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 WM8994_OK
|
||||
*/
|
||||
static int32_t FT5336_Delay(FT5336_Object_t *pObj, uint32_t Delay)
|
||||
{
|
||||
uint32_t tickstart;
|
||||
tickstart = pObj->IO.GetTick();
|
||||
while((pObj->IO.GetTick() - tickstart) < Delay)
|
||||
{
|
||||
}
|
||||
return FT5336_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start TouchScreen calibration phase
|
||||
* @param DeviceAddr: FT5336 Device address for communication on I2C Bus.
|
||||
* @retval Status FT5336_OK or FT5336_ERROR.
|
||||
*/
|
||||
static int32_t FT5336_TS_Calibration(FT5336_Object_t *pObj)
|
||||
{
|
||||
int32_t ret = FT5336_OK;
|
||||
uint32_t nbr_attempt;
|
||||
uint8_t read_data;
|
||||
uint8_t end_calibration = 0;
|
||||
|
||||
/* Switch FT5336 back to factory mode to calibrate */
|
||||
if(ft5336_dev_mode_w(&pObj->Ctx, FT5336_DEV_MODE_FACTORY) != FT5336_OK)
|
||||
{
|
||||
ret = FT5336_ERROR;
|
||||
}/* Read back the same register FT5336_DEV_MODE_REG */
|
||||
else if(ft5336_dev_mode_r(&pObj->Ctx, &read_data) != FT5336_OK)
|
||||
{
|
||||
ret = FT5336_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)FT5336_Delay(pObj, 300); /* Wait 300 ms */
|
||||
|
||||
if(read_data != FT5336_DEV_MODE_FACTORY )
|
||||
{
|
||||
/* Return error to caller */
|
||||
ret = FT5336_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Start calibration command */
|
||||
read_data= 0x04;
|
||||
if(ft5336_write_reg(&pObj->Ctx, FT5336_TD_STAT_REG, &read_data, 1) != FT5336_OK)
|
||||
{
|
||||
ret = FT5336_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)FT5336_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(ft5336_dev_mode_r(&pObj->Ctx, &read_data) != FT5336_OK)
|
||||
{
|
||||
ret = FT5336_ERROR;
|
||||
break;
|
||||
}
|
||||
if(read_data == FT5336_DEV_MODE_WORKING)
|
||||
{
|
||||
/* Auto Switch to FT5336_DEV_MODE_WORKING : means calibration have ended */
|
||||
end_calibration = 1; /* exit for loop */
|
||||
}
|
||||
|
||||
(void)FT5336_Delay(pObj, 200); /* Wait 200 ms */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* FT5336_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 FT5336_ERROR
|
||||
* in case of error
|
||||
*/
|
||||
static int32_t FT5336_DetectTouch(FT5336_Object_t *pObj)
|
||||
{
|
||||
int32_t ret;
|
||||
uint8_t nb_touch;
|
||||
|
||||
/* Read register FT5336_TD_STAT_REG to check number of touches detection */
|
||||
if(ft5336_td_status(&pObj->Ctx, &nb_touch) != FT5336_OK)
|
||||
{
|
||||
ret = FT5336_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nb_touch > FT5336_MAX_NB_TOUCH)
|
||||
{
|
||||
/* If invalid number of touch detected, set it to zero */
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = (int32_t)nb_touch;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 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 error status
|
||||
*/
|
||||
static int32_t ReadRegWrap(void *handle, uint8_t Reg, uint8_t* pData, uint16_t Length)
|
||||
{
|
||||
FT5336_Object_t *pObj = (FT5336_Object_t *)handle;
|
||||
|
||||
return pObj->IO.ReadReg(pObj->IO.Address, Reg, pData, Length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 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 error status
|
||||
*/
|
||||
static int32_t WriteRegWrap(void *handle, uint8_t Reg, uint8_t* pData, uint16_t Length)
|
||||
{
|
||||
FT5336_Object_t *pObj = (FT5336_Object_t *)handle;
|
||||
|
||||
return pObj->IO.WriteReg(pObj->IO.Address, Reg, pData, Length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,220 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ft5336.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* ft5336.c IO expander driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2015 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 FT5336_H
|
||||
#define FT5336_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "ft5336_reg.h"
|
||||
#include <stddef.h>
|
||||
#include "ft5336_conf.h"
|
||||
|
||||
/* Macros --------------------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup FT5336
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FT5336_Exported_Constants FT5336 Exported Constants
|
||||
* @{
|
||||
*/
|
||||
#define FT5336_OK (0)
|
||||
#define FT5336_ERROR (-1)
|
||||
|
||||
/* Max detectable simultaneous touches */
|
||||
#define FT5336_MAX_NB_TOUCH 5U
|
||||
|
||||
/* Touch FT5336 IDs */
|
||||
#define FT5336_ID 0x51U
|
||||
|
||||
/* Possible values of FT5336_DEV_MODE_REG */
|
||||
#define FT5336_DEV_MODE_WORKING 0x00U
|
||||
#define FT5336_DEV_MODE_FACTORY 0x04U
|
||||
|
||||
/* Possible values of FT5336_GEST_ID_REG */
|
||||
#define FT5336_GEST_ID_NO_GESTURE 0x00U
|
||||
#define FT5336_GEST_ID_MOVE_UP 0x10U
|
||||
#define FT5336_GEST_ID_MOVE_RIGHT 0x14U
|
||||
#define FT5336_GEST_ID_MOVE_DOWN 0x18U
|
||||
#define FT5336_GEST_ID_MOVE_LEFT 0x1CU
|
||||
#define FT5336_GEST_ID_ZOOM_IN 0x48U
|
||||
#define FT5336_GEST_ID_ZOOM_OUT 0x49U
|
||||
|
||||
/* Values Pn_XH and Pn_YH related */
|
||||
#define FT5336_TOUCH_EVT_FLAG_PRESS_DOWN 0x00U
|
||||
#define FT5336_TOUCH_EVT_FLAG_LIFT_UP 0x01U
|
||||
#define FT5336_TOUCH_EVT_FLAG_CONTACT 0x02U
|
||||
#define FT5336_TOUCH_EVT_FLAG_NO_EVENT 0x03U
|
||||
|
||||
/* Possible values of FT5336_GMODE_REG */
|
||||
#define FT5336_G_MODE_INTERRUPT_POLLING 0x00U
|
||||
#define FT5336_G_MODE_INTERRUPT_TRIGGER 0x01U
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT5336_Exported_Types FT5336 Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Radian;
|
||||
uint32_t OffsetLeftRight;
|
||||
uint32_t OffsetUpDown;
|
||||
uint32_t DistanceLeftRight;
|
||||
uint32_t DistanceUpDown;
|
||||
uint32_t DistanceZoom;
|
||||
}FT5336_Gesture_Init_t;
|
||||
|
||||
typedef int32_t (*FT5336_Init_Func) (void);
|
||||
typedef int32_t (*FT5336_DeInit_Func) (void);
|
||||
typedef int32_t (*FT5336_GetTick_Func) (void);
|
||||
typedef int32_t (*FT5336_Delay_Func) (uint32_t);
|
||||
typedef int32_t (*FT5336_WriteReg_Func)(uint16_t, uint16_t, uint8_t*, uint16_t);
|
||||
typedef int32_t (*FT5336_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FT5336_Init_Func Init;
|
||||
FT5336_DeInit_Func DeInit;
|
||||
uint16_t Address;
|
||||
FT5336_WriteReg_Func WriteReg;
|
||||
FT5336_ReadReg_Func ReadReg;
|
||||
FT5336_GetTick_Func GetTick;
|
||||
} FT5336_IO_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t TouchDetected;
|
||||
uint32_t TouchX;
|
||||
uint32_t TouchY;
|
||||
} FT5336_State_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t TouchDetected;
|
||||
uint32_t TouchX[FT5336_MAX_NB_TOUCH];
|
||||
uint32_t TouchY[FT5336_MAX_NB_TOUCH];
|
||||
uint32_t TouchWeight[FT5336_MAX_NB_TOUCH];
|
||||
uint32_t TouchEvent[FT5336_MAX_NB_TOUCH];
|
||||
uint32_t TouchArea[FT5336_MAX_NB_TOUCH];
|
||||
} FT5336_MultiTouch_State_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FT5336_IO_t IO;
|
||||
ft5336_ctx_t Ctx;
|
||||
uint8_t IsInitialized;
|
||||
} FT5336_Object_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t MultiTouch;
|
||||
uint8_t Gesture;
|
||||
uint8_t MaxTouch;
|
||||
uint32_t MaxXl;
|
||||
uint32_t MaxYl;
|
||||
} FT5336_Capabilities_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t ( *Init ) ( FT5336_Object_t *);
|
||||
int32_t ( *DeInit ) ( FT5336_Object_t * );
|
||||
int32_t ( *GestureConfig ) ( FT5336_Object_t *, FT5336_Gesture_Init_t* );
|
||||
int32_t ( *ReadID ) ( FT5336_Object_t *, uint32_t * );
|
||||
int32_t ( *GetState ) ( FT5336_Object_t *, FT5336_State_t* );
|
||||
int32_t ( *GetMultiTouchState ) ( FT5336_Object_t *, FT5336_MultiTouch_State_t* );
|
||||
int32_t ( *GetGesture ) ( FT5336_Object_t *, uint8_t* );
|
||||
int32_t ( *GetCapabilities ) ( FT5336_Object_t *, FT5336_Capabilities_t * );
|
||||
int32_t ( *EnableIT ) ( FT5336_Object_t * );
|
||||
int32_t ( *DisableIT ) ( FT5336_Object_t * );
|
||||
int32_t ( *ClearIT ) ( FT5336_Object_t * );
|
||||
int32_t ( *ITStatus ) ( FT5336_Object_t * );
|
||||
} FT5336_TS_Drv_t;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup FT5336_Exported_Variables
|
||||
* @{
|
||||
*/
|
||||
extern FT5336_TS_Drv_t FT5336_TS_Driver;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup FT5336_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
int32_t FT5336_RegisterBusIO (FT5336_Object_t *pObj, FT5336_IO_t *pIO);
|
||||
int32_t FT5336_Init(FT5336_Object_t *pObj);
|
||||
int32_t FT5336_DeInit(FT5336_Object_t *pObj);
|
||||
int32_t FT5336_GestureConfig(FT5336_Object_t *pObj, FT5336_Gesture_Init_t *GestureInit);
|
||||
int32_t FT5336_ReadID(FT5336_Object_t *pObj, uint32_t *Id);
|
||||
int32_t FT5336_GetState(FT5336_Object_t *pObj, FT5336_State_t *State);
|
||||
int32_t FT5336_GetMultiTouchState(FT5336_Object_t *pObj, FT5336_MultiTouch_State_t *State);
|
||||
int32_t FT5336_GetGesture(FT5336_Object_t *pObj, uint8_t *GestureId);
|
||||
int32_t FT5336_EnableIT(FT5336_Object_t *pObj);
|
||||
int32_t FT5336_DisableIT(FT5336_Object_t *pObj);
|
||||
int32_t FT5336_ITStatus(FT5336_Object_t *pObj);
|
||||
int32_t FT5336_ClearIT(FT5336_Object_t *pObj);
|
||||
int32_t FT5336_GetCapabilities(FT5336_Object_t *pObj, FT5336_Capabilities_t *Capabilities);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* FT5336_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ft5336_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains specific configuration for the
|
||||
* ft5336.c that can be modified by user.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2015 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 FT5336_CONF_H
|
||||
#define FT5336_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Macros --------------------------------------------------------------------*/
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
#define FT5336_AUTO_CALIBRATION_ENABLED 0U
|
||||
#define FT5336_MAX_X_LENGTH 800U
|
||||
#define FT5336_MAX_Y_LENGTH 480U
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* FT5336_CONF_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,971 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ft5336_reg.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header of ft5336_reg.c
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2015 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 FT5336_REG_H
|
||||
#define FT5336_REG_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Macros --------------------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup FT5336
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT5336_Exported_Types FT5336 Exported Types
|
||||
* @{
|
||||
*/
|
||||
/************** Generic Function *******************/
|
||||
|
||||
typedef int32_t (*FT5336_Write_Func)(void *, uint8_t, uint8_t*, uint16_t);
|
||||
typedef int32_t (*FT5336_Read_Func) (void *, uint8_t, uint8_t*, uint16_t);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup FT5336_Imported_Globals FT5336 Imported Globals
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
FT5336_Write_Func WriteReg;
|
||||
FT5336_Read_Func ReadReg;
|
||||
void *handle;
|
||||
} ft5336_ctx_t;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup FT5336_Exported_Constants FT5336 Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Current mode register of the FT5336 (R/W) */
|
||||
#define FT5336_DEV_MODE_REG 0x00
|
||||
|
||||
/* Gesture ID register */
|
||||
#define FT5336_GEST_ID_REG 0x01
|
||||
|
||||
/* Touch Data Status register : gives number of active touch points (0..2) */
|
||||
#define FT5336_TD_STAT_REG 0x02
|
||||
|
||||
/* P1 X, Y coordinates, weight and misc registers */
|
||||
#define FT5336_P1_XH_REG 0x03U
|
||||
#define FT5336_P1_XL_REG 0x04U
|
||||
#define FT5336_P1_YH_REG 0x05U
|
||||
#define FT5336_P1_YL_REG 0x06U
|
||||
#define FT5336_P1_WEIGHT_REG 0x07U
|
||||
#define FT5336_P1_MISC_REG 0x08U
|
||||
|
||||
/* P2 X, Y coordinates, weight and misc registers */
|
||||
#define FT5336_P2_XH_REG 0x09U
|
||||
#define FT5336_P2_XL_REG 0x0AU
|
||||
#define FT5336_P2_YH_REG 0x0BU
|
||||
#define FT5336_P2_YL_REG 0x0CU
|
||||
#define FT5336_P2_WEIGHT_REG 0x0DU
|
||||
#define FT5336_P2_MISC_REG 0x0EU
|
||||
|
||||
/* P3 X, Y coordinates, weight and misc registers */
|
||||
#define FT5336_P3_XH_REG 0x0FU
|
||||
#define FT5336_P3_XL_REG 0x10U
|
||||
#define FT5336_P3_YH_REG 0x11U
|
||||
#define FT5336_P3_YL_REG 0x12U
|
||||
#define FT5336_P3_WEIGHT_REG 0x13U
|
||||
#define FT5336_P3_MISC_REG 0x14U
|
||||
|
||||
/* P4 X, Y coordinates, weight and misc registers */
|
||||
#define FT5336_P4_XH_REG 0x15U
|
||||
#define FT5336_P4_XL_REG 0x16U
|
||||
#define FT5336_P4_YH_REG 0x17U
|
||||
#define FT5336_P4_YL_REG 0x18U
|
||||
#define FT5336_P4_WEIGHT_REG 0x19U
|
||||
#define FT5336_P4_MISC_REG 0x1AU
|
||||
|
||||
/* P5 X, Y coordinates, weight and misc registers */
|
||||
#define FT5336_P5_XH_REG 0x1BU
|
||||
#define FT5336_P5_XL_REG 0x1CU
|
||||
#define FT5336_P5_YH_REG 0x1DU
|
||||
#define FT5336_P5_YL_REG 0x1EU
|
||||
#define FT5336_P5_WEIGHT_REG 0x1FU
|
||||
#define FT5336_P5_MISC_REG 0x20U
|
||||
|
||||
/* P6 X, Y coordinates, weight and misc registers */
|
||||
#define FT5336_P6_XH_REG 0x21U
|
||||
#define FT5336_P6_XL_REG 0x22U
|
||||
#define FT5336_P6_YH_REG 0x23U
|
||||
#define FT5336_P6_YL_REG 0x24U
|
||||
#define FT5336_P6_WEIGHT_REG 0x25U
|
||||
#define FT5336_P6_MISC_REG 0x26U
|
||||
|
||||
/* P7 X, Y coordinates, weight and misc registers */
|
||||
#define FT5336_P7_XH_REG 0x27U
|
||||
#define FT5336_P7_XL_REG 0x28U
|
||||
#define FT5336_P7_YH_REG 0x29U
|
||||
#define FT5336_P7_YL_REG 0x2AU
|
||||
#define FT5336_P7_WEIGHT_REG 0x2BU
|
||||
#define FT5336_P7_MISC_REG 0x2CU
|
||||
|
||||
/* P8 X, Y coordinates, weight and misc registers */
|
||||
#define FT5336_P8_XH_REG 0x2DU
|
||||
#define FT5336_P8_XL_REG 0x2EU
|
||||
#define FT5336_P8_YH_REG 0x2FU
|
||||
#define FT5336_P8_YL_REG 0x30U
|
||||
#define FT5336_P8_WEIGHT_REG 0x31U
|
||||
#define FT5336_P8_MISC_REG 0x32U
|
||||
|
||||
/* P9 X, Y coordinates, weight and misc registers */
|
||||
#define FT5336_P9_XH_REG 0x33U
|
||||
#define FT5336_P9_XL_REG 0x34U
|
||||
#define FT5336_P9_YH_REG 0x35U
|
||||
#define FT5336_P9_YL_REG 0x36U
|
||||
#define FT5336_P9_WEIGHT_REG 0x37U
|
||||
#define FT5336_P9_MISC_REG 0x38U
|
||||
|
||||
/* P10 X, Y coordinates, weight and misc registers */
|
||||
#define FT5336_P10_XH_REG 0x39U
|
||||
#define FT5336_P10_XL_REG 0x3AU
|
||||
#define FT5336_P10_YH_REG 0x3BU
|
||||
#define FT5336_P10_YL_REG 0x3CU
|
||||
#define FT5336_P10_WEIGHT_REG 0x3DU
|
||||
#define FT5336_P10_MISC_REG 0x3EU
|
||||
|
||||
/* Threshold for touch detection */
|
||||
#define FT5336_TH_GROUP_REG 0x80
|
||||
|
||||
/* Filter function coefficients */
|
||||
#define FT5336_TH_DIFF_REG 0x85
|
||||
|
||||
/* Control register */
|
||||
#define FT5336_CTRL_REG 0x86
|
||||
|
||||
/* The time period of switching from Active mode to Monitor mode when there is no touching */
|
||||
#define FT5336_TIMEENTERMONITOR_REG 0x87
|
||||
|
||||
/* Report rate in Active mode */
|
||||
#define FT5336_PERIODACTIVE_REG 0x88
|
||||
|
||||
/* Report rate in Monitor mode */
|
||||
#define FT5336_PERIODMONITOR_REG 0x89
|
||||
|
||||
/* The value of the minimum allowed angle while Rotating gesture mode */
|
||||
#define FT5336_RADIAN_VALUE_REG 0x91
|
||||
|
||||
/* Maximum offset while Moving Left and Moving Right gesture */
|
||||
#define FT5336_OFFSET_LR_REG 0x92
|
||||
|
||||
/* Maximum offset while Moving Up and Moving Down gesture */
|
||||
#define FT5336_OFFSET_UD_REG 0x93
|
||||
|
||||
/* Minimum distance while Moving Left and Moving Right gesture */
|
||||
#define FT5336_DISTANCE_LR_REG 0x94
|
||||
|
||||
/* Minimum distance while Moving Up and Moving Down gesture */
|
||||
#define FT5336_DISTANCE_UD_REG 0x95
|
||||
|
||||
/* Maximum distance while Zoom In and Zoom Out gesture */
|
||||
#define FT5336_DISTANCE_ZOOM_REG 0x96
|
||||
|
||||
/* High 8-bit of LIB Version info */
|
||||
#define FT5336_LIB_VER_H_REG 0xA1
|
||||
|
||||
/* Low 8-bit of LIB Version info */
|
||||
#define FT5336_LIB_VER_L_REG 0xA2
|
||||
|
||||
/* Chip Selecting */
|
||||
#define FT5336_CIPHER_REG 0xA3
|
||||
|
||||
/* Interrupt mode register (used when in interrupt mode) */
|
||||
#define FT5336_GMODE_REG 0xA4
|
||||
|
||||
/* Current power mode the FT5336 system is in (R) */
|
||||
#define FT5336_PWR_MODE_REG 0xA5
|
||||
|
||||
/* FT5336 firmware version */
|
||||
#define FT5336_FIRMID_REG 0xA6
|
||||
|
||||
/* FT5336 Chip identification register */
|
||||
#define FT5336_CHIP_ID_REG 0xA8
|
||||
|
||||
/* Release code version */
|
||||
#define FT5336_RELEASE_CODE_ID_REG 0xAF
|
||||
|
||||
/* Current operating mode the FT5336 system is in (R) */
|
||||
#define FT5336_STATE_REG 0xBC
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : Generic - All
|
||||
* Address : Generic - All
|
||||
* Bit Group Name: None
|
||||
* Permission : W
|
||||
*******************************************************************************/
|
||||
int32_t ft5336_write_reg(ft5336_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
|
||||
int32_t ft5336_read_reg(ft5336_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 FT5336_DEV_MODE_BIT_MASK 0x70U
|
||||
#define FT5336_DEV_MODE_BIT_POSITION 4
|
||||
int32_t ft5336_dev_mode_w(ft5336_ctx_t *ctx, uint8_t value);
|
||||
int32_t ft5336_dev_mode_r(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : GEST_ID
|
||||
* Address : 0X01
|
||||
* Bit Group Name: Gesture ID
|
||||
* Permission : R
|
||||
*******************************************************************************/
|
||||
#define FT5336_GEST_ID_BIT_MASK 0xFFU
|
||||
#define FT5336_GEST_ID_BIT_POSITION 0
|
||||
int32_t ft5336_gest_id(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : TD_STATUS
|
||||
* Address : 0X02
|
||||
* Bit Group Name:
|
||||
* Permission : R
|
||||
*******************************************************************************/
|
||||
#define FT5336_TD_STATUS_BIT_MASK 0x0FU
|
||||
#define FT5336_TD_STATUS_BIT_POSITION 0
|
||||
int32_t ft5336_td_status(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P1_XH
|
||||
* Address : 0X03
|
||||
* Bit Group Name: First Event Flag
|
||||
* Permission : R
|
||||
* Default value : 0xF0U
|
||||
*******************************************************************************/
|
||||
#define FT5336_P1_XH_EF_BIT_MASK 0xC0U
|
||||
#define FT5336_P1_XH_EF_BIT_POSITION 6
|
||||
int32_t ft5336_p1_xh_ef(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P1_XH
|
||||
* Address : 0X03
|
||||
* Bit Group Name: First Touch X Position
|
||||
* Permission : R
|
||||
* Default value : 0x0FU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P1_XH_TP_BIT_MASK 0x0FU
|
||||
#define FT5336_P1_XH_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p1_xh_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P1_XL
|
||||
* Address : 0X04
|
||||
* Bit Group Name: First Touch X Position
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P1_XL_TP_BIT_MASK 0xFFU
|
||||
#define FT5336_P1_XL_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p1_xl_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P1_YH
|
||||
* Address : 0X05
|
||||
* Bit Group Name: First Touch ID
|
||||
* Permission : R
|
||||
* Default value : 0xF0U
|
||||
*******************************************************************************/
|
||||
#define FT5336_P1_YH_TID_BIT_MASK 0xF0U
|
||||
#define FT5336_P1_YH_TID_BIT_POSITION 4
|
||||
int32_t ft5336_p1_yh_tid(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P1_YH
|
||||
* Address : 0x06
|
||||
* Bit Group Name: First Touch Y Position
|
||||
* Permission : R
|
||||
* Default value : 0x0FU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P1_YH_TP_BIT_MASK 0x0FU
|
||||
#define FT5336_P1_YH_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p1_yh_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P1_YL
|
||||
* Address : 0X06
|
||||
* Bit Group Name: First Touch Y Position
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P1_YL_TP_BIT_MASK 0xFFU
|
||||
#define FT5336_P1_YL_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p1_yl_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P1_WEIGHT
|
||||
* Address : 0X07
|
||||
* Bit Group Name: First Touch Weight(pressure)
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P1_WEIGHT_BIT_MASK 0xFFU
|
||||
#define FT5336_P1_WEIGHT_BIT_POSITION 0
|
||||
int32_t ft5336_p1_weight(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P1_MISC
|
||||
* Address : 0X08
|
||||
* Bit Group Name: First Touch Area
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P1_MISC_BIT_MASK 0xF0U
|
||||
#define FT5336_P1_MISC_BIT_POSITION 4
|
||||
int32_t ft5336_p1_misc(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P2_XH
|
||||
* Address : 0X09
|
||||
* Bit Group Name: Second Event Flag
|
||||
* Permission : R
|
||||
* Default value : 0xF0U
|
||||
*******************************************************************************/
|
||||
#define FT5336_P2_XH_EF_BIT_MASK 0xC0U
|
||||
#define FT5336_P2_XH_EF_BIT_POSITION 6
|
||||
int32_t ft5336_p2_xh_ef(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P2_XH
|
||||
* Address : 0X09
|
||||
* Bit Group Name: Second Touch X Position
|
||||
* Permission : R
|
||||
* Default value : 0x0FU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P2_XH_TP_BIT_MASK 0x0FU
|
||||
#define FT5336_P2_XH_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p2_xh_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P2_XL
|
||||
* Address : 0X0A
|
||||
* Bit Group Name: Second Touch X Position
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P2_XL_TP_BIT_MASK 0xFFU
|
||||
#define FT5336_P2_XL_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p2_xl_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P2_YH
|
||||
* Address : 0X0B
|
||||
* Bit Group Name: Second Touch ID
|
||||
* Permission : R
|
||||
* Default value : 0xF0U
|
||||
*******************************************************************************/
|
||||
#define FT5336_P2_YH_TID_BIT_MASK 0xF0U
|
||||
#define FT5336_P2_YH_TID_BIT_POSITION 4
|
||||
int32_t ft5336_p2_yh_tid(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P2_YH
|
||||
* Address : 0x0B
|
||||
* Bit Group Name: Second Touch Y Position
|
||||
* Permission : R
|
||||
* Default value : 0x0FU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P2_YH_TP_BIT_MASK 0x0FU
|
||||
#define FT5336_P2_YH_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p2_yh_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P2_YL
|
||||
* Address : 0X0C
|
||||
* Bit Group Name: Second Touch Y Position
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P2_YL_TP_BIT_MASK 0xFFU
|
||||
#define FT5336_P2_YL_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p2_yl_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P2_WEIGHT
|
||||
* Address : 0X0D
|
||||
* Bit Group Name: Second Touch Weight(pressure)
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P2_WEIGHT_BIT_MASK 0xFFU
|
||||
#define FT5336_P2_WEIGHT_BIT_POSITION 0
|
||||
int32_t ft5336_p2_weight(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P2_MISC
|
||||
* Address : 0X0E
|
||||
* Bit Group Name: Second Touch Area
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P2_MISC_BIT_MASK 0xF0U
|
||||
#define FT5336_P2_MISC_BIT_POSITION 4
|
||||
int32_t ft5336_p2_misc(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P3_XH
|
||||
* Address : 0X0F
|
||||
* Bit Group Name: Third Event Flag
|
||||
* Permission : R
|
||||
* Default value : 0xF0U
|
||||
*******************************************************************************/
|
||||
#define FT5336_P3_XH_EF_BIT_MASK 0xC0U
|
||||
#define FT5336_P3_XH_EF_BIT_POSITION 6
|
||||
int32_t ft5336_p3_xh_ef(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P3_XH
|
||||
* Address : 0X0F
|
||||
* Bit Group Name: Third Touch X High Position
|
||||
* Permission : R
|
||||
* Default value : 0x0FU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P3_XH_TP_BIT_MASK 0x0FU
|
||||
#define FT5336_P3_XH_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p3_xh_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P3_XL
|
||||
* Address : 0X10
|
||||
* Bit Group Name: Third Touch X Low Position
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P3_XL_TP_BIT_MASK 0xFFU
|
||||
#define FT5336_P3_XL_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p3_xl_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P3_YH
|
||||
* Address : 0X11
|
||||
* Bit Group Name: Third Touch ID
|
||||
* Permission : R
|
||||
* Default value : 0xF0U
|
||||
*******************************************************************************/
|
||||
#define FT5336_P3_YH_TID_BIT_MASK 0xF0U
|
||||
#define FT5336_P3_YH_TID_BIT_POSITION 4
|
||||
int32_t ft5336_p3_yh_tid(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P3_YH
|
||||
* Address : 0x11
|
||||
* Bit Group Name: Third Touch Y High Position
|
||||
* Permission : R
|
||||
* Default value : 0x0FU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P3_YH_TP_BIT_MASK 0x0FU
|
||||
#define FT5336_P3_YH_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p3_yh_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P3_YL
|
||||
* Address : 0X12
|
||||
* Bit Group Name: Third Touch Y Low Position
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P3_YL_TP_BIT_MASK 0xFFU
|
||||
#define FT5336_P3_YL_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p3_yl_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P3_WEIGHT
|
||||
* Address : 0X13
|
||||
* Bit Group Name: Third Touch Weight(pressure)
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P3_WEIGHT_BIT_MASK 0xFFU
|
||||
#define FT5336_P3_WEIGHT_BIT_POSITION 0
|
||||
int32_t ft5336_p3_weight(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P3_MISC
|
||||
* Address : 0X14
|
||||
* Bit Group Name: Third Touch Area
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P3_MISC_BIT_MASK 0xF0U
|
||||
#define FT5336_P3_MISC_BIT_POSITION 4
|
||||
int32_t ft5336_p3_misc(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P4_XH
|
||||
* Address : 0X15
|
||||
* Bit Group Name: Fourth Event Flag
|
||||
* Permission : R
|
||||
* Default value : 0xF0U
|
||||
*******************************************************************************/
|
||||
#define FT5336_P4_XH_EF_BIT_MASK 0xC0U
|
||||
#define FT5336_P4_XH_EF_BIT_POSITION 6
|
||||
int32_t ft5336_p4_xh_ef(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P4_XH
|
||||
* Address : 0X15
|
||||
* Bit Group Name: Fourth Touch X High Position
|
||||
* Permission : R
|
||||
* Default value : 0x0FU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P4_XH_TP_BIT_MASK 0x0FU
|
||||
#define FT5336_P4_XH_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p4_xh_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P4_XL
|
||||
* Address : 0X16
|
||||
* Bit Group Name: Fourth Touch X Low Position
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P4_XL_TP_BIT_MASK 0xFFU
|
||||
#define FT5336_P4_XL_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p4_xl_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P4_YH
|
||||
* Address : 0X17
|
||||
* Bit Group Name: Fourth Touch ID
|
||||
* Permission : R
|
||||
* Default value : 0xF0U
|
||||
*******************************************************************************/
|
||||
#define FT5336_P4_YH_TID_BIT_MASK 0xF0U
|
||||
#define FT5336_P4_YH_TID_BIT_POSITION 4
|
||||
int32_t ft5336_p4_yh_tid(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P4_YH
|
||||
* Address : 0x17
|
||||
* Bit Group Name: Fourth Touch Y High Position
|
||||
* Permission : R
|
||||
* Default value : 0x0FU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P4_YH_TP_BIT_MASK 0x0FU
|
||||
#define FT5336_P4_YH_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p4_yh_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P4_YL
|
||||
* Address : 0X18
|
||||
* Bit Group Name: Fourth Touch Y Low Position
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P4_YL_TP_BIT_MASK 0xFFU
|
||||
#define FT5336_P4_YL_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p4_yl_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P4_WEIGHT
|
||||
* Address : 0X19
|
||||
* Bit Group Name: Fourth Touch Weight(pressure)
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P4_WEIGHT_BIT_MASK 0xFFU
|
||||
#define FT5336_P4_WEIGHT_BIT_POSITION 0
|
||||
int32_t ft5336_p4_weight(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P4_MISC
|
||||
* Address : 0X1A
|
||||
* Bit Group Name: Fourth Touch Area
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P4_MISC_BIT_MASK 0xF0U
|
||||
#define FT5336_P4_MISC_BIT_POSITION 4
|
||||
int32_t ft5336_p4_misc(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P5_XH
|
||||
* Address : 0X1B
|
||||
* Bit Group Name: Fifth Event Flag
|
||||
* Permission : R
|
||||
* Default value : 0xF0U
|
||||
*******************************************************************************/
|
||||
#define FT5336_P5_XH_EF_BIT_MASK 0xC0U
|
||||
#define FT5336_P5_XH_EF_BIT_POSITION 6
|
||||
int32_t ft5336_p5_xh_ef(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P5_XH
|
||||
* Address : 0X1B
|
||||
* Bit Group Name: Fifth Touch X High Position
|
||||
* Permission : R
|
||||
* Default value : 0x0FU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P5_XH_TP_BIT_MASK 0x0FU
|
||||
#define FT5336_P5_XH_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p5_xh_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P5_XL
|
||||
* Address : 0X1C
|
||||
* Bit Group Name: Fifth Touch X Low Position
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P5_XL_TP_BIT_MASK 0xFFU
|
||||
#define FT5336_P5_XL_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p5_xl_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P5_YH
|
||||
* Address : 0X1D
|
||||
* Bit Group Name: Fifth Touch ID
|
||||
* Permission : R
|
||||
* Default value : 0xF0U
|
||||
*******************************************************************************/
|
||||
#define FT5336_P5_YH_TID_BIT_MASK 0xF0U
|
||||
#define FT5336_P5_YH_TID_BIT_POSITION 4
|
||||
int32_t ft5336_p5_yh_tid(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P5_YH
|
||||
* Address : 0x1D
|
||||
* Bit Group Name: Fifth Touch Y High Position
|
||||
* Permission : R
|
||||
* Default value : 0x0FU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P5_YH_TP_BIT_MASK 0x0FU
|
||||
#define FT5336_P5_YH_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p5_yh_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P5_YL
|
||||
* Address : 0X1E
|
||||
* Bit Group Name: Fifth Touch Y Low Position
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P5_YL_TP_BIT_MASK 0xFFU
|
||||
#define FT5336_P5_YL_TP_BIT_POSITION 0
|
||||
int32_t ft5336_p5_yl_tp(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P5_WEIGHT
|
||||
* Address : 0X1F
|
||||
* Bit Group Name: Fifth Touch Weight(pressure)
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P5_WEIGHT_BIT_MASK 0xFFU
|
||||
#define FT5336_P5_WEIGHT_BIT_POSITION 0
|
||||
int32_t ft5336_p5_weight(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : P5_MISC
|
||||
* Address : 0X20
|
||||
* Bit Group Name: Fifth Touch Area
|
||||
* Permission : R
|
||||
* Default value : 0xFFU
|
||||
*******************************************************************************/
|
||||
#define FT5336_P5_MISC_BIT_MASK 0xF0U
|
||||
#define FT5336_P5_MISC_BIT_POSITION 4
|
||||
int32_t ft5336_p5_misc(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : TH_GROUP
|
||||
* Address : 0X80
|
||||
* Bit Group Name: Threshold for touch detection
|
||||
* Permission : RW
|
||||
* Default value : None
|
||||
*******************************************************************************/
|
||||
#define FT5336_TH_GROUP_BIT_MASK 0xFFU
|
||||
#define FT5336_TH_GROUP_BIT_POSITION 0
|
||||
int32_t ft5336_th_group(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : TH_DIFF
|
||||
* Address : 0X85
|
||||
* Bit Group Name: Filter function coefficient
|
||||
* Permission : RW
|
||||
* Default value : None
|
||||
*******************************************************************************/
|
||||
#define FT5336_TH_DIFF_BIT_MASK 0xFFU
|
||||
#define FT5336_TH_DIFF_BIT_POSITION 0
|
||||
int32_t ft5336_th_diff(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : CTRL
|
||||
* Address : 0X86
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x01
|
||||
*******************************************************************************/
|
||||
#define FT5336_CTRL_BIT_MASK 0xFFU
|
||||
#define FT5336_CTRL_BIT_POSITION 0
|
||||
int32_t ft5336_ctrl(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : TIMEENTERMONITOR
|
||||
* Address : 0X87
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x0A
|
||||
*******************************************************************************/
|
||||
#define FT5336_TIMEENTERMONITOR_BIT_MASK 0xFFU
|
||||
#define FT5336_TIMEENTERMONITOR_BIT_POSITION 0
|
||||
int32_t ft5336_time_enter_monitor(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : PERIODACTIVE
|
||||
* Address : 0X88
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : None
|
||||
*******************************************************************************/
|
||||
#define FT5336_PERIODACTIVE_BIT_MASK 0xFFU
|
||||
#define FT5336_PERIODACTIVE_BIT_POSITION 0
|
||||
int32_t ft5336_period_active(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : PERIODMONITOR
|
||||
* Address : 0X89
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x28
|
||||
*******************************************************************************/
|
||||
#define FT5336_PERIODMONITOR_BIT_MASK 0xFFU
|
||||
#define FT5336_PERIODMONITOR_BIT_POSITION 0
|
||||
int32_t ft5336_period_monitor(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : RADIAN_VALUE
|
||||
* Address : 0X91
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x0A
|
||||
*******************************************************************************/
|
||||
#define FT5336_RADIAN_VALUE_BIT_MASK 0xFFU
|
||||
#define FT5336_RADIAN_VALUE_BIT_POSITION 0
|
||||
int32_t ft5336_radian_value(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : OFFSET_LEFT_RIGHT
|
||||
* Address : 0X92
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x19
|
||||
*******************************************************************************/
|
||||
#define FT5336_OFFSET_LR_BIT_MASK 0xFFU
|
||||
#define FT5336_OFFSET_LR_BIT_POSITION 0
|
||||
int32_t ft5336_offset_left_right(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : OFFSET_UP_DOWN
|
||||
* Address : 0X93
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x19
|
||||
*******************************************************************************/
|
||||
#define FT5336_OFFSET_UD_BIT_MASK 0xFFU
|
||||
#define FT5336_OFFSET_UD_BIT_POSITION 0
|
||||
int32_t ft5336_offset_up_down(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : DISTANCE_LEFT_RIGHT
|
||||
* Address : 0X94
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x19
|
||||
*******************************************************************************/
|
||||
#define FT5336_DISTANCE_LR_BIT_MASK 0xFFU
|
||||
#define FT5336_DISTANCE_LR_BIT_POSITION 0
|
||||
int32_t ft5336_disatnce_left_right(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : DISTANCE_UP_DOWN
|
||||
* Address : 0X95
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x19
|
||||
*******************************************************************************/
|
||||
#define FT5336_DISTANCE_UD_BIT_MASK 0xFFU
|
||||
#define FT5336_DISTANCE_UD_BIT_POSITION 0
|
||||
int32_t ft5336_distance_up_down(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : DISTANCE_ZOOM
|
||||
* Address : 0X96
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x32
|
||||
*******************************************************************************/
|
||||
#define FT5336_DISTANCE_ZOOM_BIT_MASK 0xFFU
|
||||
#define FT5336_DISTANCE_ZOOM_BIT_POSITION 0
|
||||
int32_t ft5336_distance_zoom(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : LIB_VER_H
|
||||
* Address : 0XA1
|
||||
* Bit Group Name:
|
||||
* Permission : R
|
||||
* Default value : None
|
||||
*******************************************************************************/
|
||||
#define FT5336_LIB_VER_H_BIT_MASK 0xFFU
|
||||
#define FT5336_LIB_VER_H_BIT_POSITION 0
|
||||
int32_t ft5336_lib_ver_high(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : LIB_VER_L
|
||||
* Address : 0XA2
|
||||
* Bit Group Name:
|
||||
* Permission : R
|
||||
* Default value : None
|
||||
*******************************************************************************/
|
||||
#define FT5336_LIB_VER_L_BIT_MASK 0xFFU
|
||||
#define FT5336_LIB_VER_L_BIT_POSITION 0
|
||||
int32_t ft5336_lib_ver_low(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : CIPHER
|
||||
* Address : 0XA3
|
||||
* Bit Group Name:
|
||||
* Permission : R
|
||||
* Default value : 0x06
|
||||
*******************************************************************************/
|
||||
#define FT5336_CIPHER_BIT_MASK 0xFFU
|
||||
#define FT5336_CIPHER_BIT_POSITION 0
|
||||
int32_t ft5336_cipher(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : G_MODE
|
||||
* Address : 0XA4
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x01
|
||||
*******************************************************************************/
|
||||
#define FT5336_G_MODE_BIT_MASK 0xFFU
|
||||
#define FT5336_G_MODE_BIT_POSITION 0
|
||||
int32_t ft5336_g_mode(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : PWR_MODE
|
||||
* Address : 0XA5
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x00
|
||||
*******************************************************************************/
|
||||
#define FT5336_PWR_MODE_BIT_MASK 0xFFU
|
||||
#define FT5336_PWR_MODE_BIT_POSITION 0
|
||||
int32_t ft5336_pwr_mode(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : FIRMID
|
||||
* Address : 0XA6
|
||||
* Bit Group Name:
|
||||
* Permission : R
|
||||
* Default value : None
|
||||
*******************************************************************************/
|
||||
#define FT5336_FIRMID_BIT_MASK 0xFFU
|
||||
#define FT5336_FIRMID_BIT_POSITION 0
|
||||
int32_t ft5336_firm_id(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : FOCALTECH_ID
|
||||
* Address : 0XA8
|
||||
* Bit Group Name:
|
||||
* Permission : R
|
||||
* Default value : 0x11
|
||||
*******************************************************************************/
|
||||
#define FT5336_CHIP_ID_BIT_MASK 0xFFU
|
||||
#define FT5336_CHIP_ID_BIT_POSITION 0
|
||||
int32_t ft5336_chip_id(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : RELEASE_CODE_ID
|
||||
* Address : 0XAF
|
||||
* Bit Group Name:
|
||||
* Permission : R
|
||||
* Default value : 0x001
|
||||
*******************************************************************************/
|
||||
#define FT5336_RC_ID_BIT_MASK 0xFFU
|
||||
#define FT5336_RC_ID_BIT_POSITION 0
|
||||
int32_t ft5336_release_code_id(ft5336_ctx_t *ctx, uint8_t *value);
|
||||
|
||||
/*******************************************************************************
|
||||
* Register : STATE
|
||||
* Address : 0XBC
|
||||
* Bit Group Name:
|
||||
* Permission : RW
|
||||
* Default value : 0x01
|
||||
*******************************************************************************/
|
||||
#define FT5336_STATE_BIT_MASK 0xFFU
|
||||
#define FT5336_STATE_BIT_POSITION 0
|
||||
int32_t ft5336_state(ft5336_ctx_t *ctx, uint8_t value);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* FT5336_REG_H */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
Reference in New Issue
Block a user