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,103 @@
|
||||
<!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 TS3510 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-ts3510-component-driver"><strong>Release Notes for TS3510 Component Driver</strong></h1>
|
||||
<p>Copyright © 2014 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 functions needed to drive TS3510, Touch Screen 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-section6" checked aria-hidden="true"> <label for="collapse-section6" aria-hidden="true">V2.0.0 / 23-November-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<ul>
|
||||
<li>First Official release of component drivers for TS3510 in line with STM32Cube BSP drivers development guidelines (UM2298)</li>
|
||||
<li>The component drivers are composed of
|
||||
<ul>
|
||||
<li>component core drivers files: ts3510.h/.c</li>
|
||||
<li>component register drivers files: ts3510_reg.h/.c<br />
|
||||
</li>
|
||||
<li>component configuration file: ts3510_conf_template.h</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>
|
||||
<ul>
|
||||
<li>This software release is compatible with BSP Common V6.0.0 or above</li>
|
||||
</ul>
|
||||
<h2 id="notes">Notes</h2>
|
||||
<ul>
|
||||
<li>ts3510_conf_template.h file must be copied in user application as ts3510_conf.h with optional configuration update</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true">V1.0.2 / 05-June-2017</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">V1.0.1 / 02-December-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-2">Main Changes</h2>
|
||||
<ul>
|
||||
<li>st7735.h: change “" by”/" in the include path to fix compilation issues under Linux.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true">V1.0.0 / 18-February-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-3">Main Changes</h2>
|
||||
<ul>
|
||||
<li>First official release of <strong>TS3510</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,108 @@
|
||||
---
|
||||
pagetitle: Release Notes for TS3510 Component Driver
|
||||
lang: en
|
||||
---
|
||||
|
||||
::: {.row}
|
||||
::: {.col-sm-12 .col-lg-4}
|
||||
|
||||
::: {.card .fluid}
|
||||
::: {.sectione .dark}
|
||||
<center>
|
||||
# **Release Notes for TS3510 Component Driver**
|
||||
Copyright © 2014 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 functions needed to drive TS3510, Touch Screen component
|
||||
|
||||
:::
|
||||
|
||||
::: {.col-sm-12 .col-lg-8}
|
||||
|
||||
# Update History
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section6" checked aria-hidden="true">
|
||||
<label for="collapse-section6" aria-hidden="true">V2.0.0 / 23-November-2019</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
- First Official release of component drivers for TS3510 in line with STM32Cube BSP drivers development guidelines (UM2298)
|
||||
- The component drivers are composed of
|
||||
- component core drivers files: ts3510.h/.c
|
||||
- component register drivers files: ts3510_reg.h/.c
|
||||
- component configuration file: ts3510_conf_template.h
|
||||
|
||||
## Backward Compatibility
|
||||
|
||||
- This version breaks the compatibility with previous versions
|
||||
|
||||
## Dependencies
|
||||
|
||||
- This software release is compatible with BSP Common V6.0.0 or above
|
||||
|
||||
## Notes
|
||||
|
||||
- ts3510_conf_template.h file must be copied in user application as ts3510_conf.h with optional configuration update
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section3" checked aria-hidden="true">
|
||||
<label for="collapse-section3" aria-hidden="true">V1.0.2 / 05-June-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 / 02-December-2014</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
- st7735.h: change "\" by "/" in the include path to fix compilation issues under Linux.
|
||||
|
||||
</div>
|
||||
:::
|
||||
|
||||
::: {.collapse}
|
||||
<input type="checkbox" id="collapse-section1" checked aria-hidden="true">
|
||||
<label for="collapse-section1" aria-hidden="true">V1.0.0 / 18-February-2014</label>
|
||||
<div>
|
||||
|
||||
## Main Changes
|
||||
|
||||
- First official release of **TS3510** 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,436 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ts3510.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the TS3510
|
||||
* Touch Screen.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2014 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 "ts3510.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup TS3510 TS3510
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/** @defgroup TS3510_Exported_Variables TS3510 Exported Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Touch screen driver structure initialization */
|
||||
TS3510_TS_Drv_t TS3510_TS_Driver =
|
||||
{
|
||||
TS3510_Init,
|
||||
TS3510_DeInit,
|
||||
TS3510_GestureConfig,
|
||||
TS3510_ReadID,
|
||||
TS3510_GetState,
|
||||
TS3510_GetMultiTouchState,
|
||||
TS3510_GetGesture,
|
||||
TS3510_GetCapabilities,
|
||||
TS3510_EnableIT,
|
||||
TS3510_DisableIT,
|
||||
TS3510_ClearIT,
|
||||
TS3510_ITStatus
|
||||
};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TS3510_Private_Function_Prototypes TS3510 Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
static int32_t TS3510_DetectTouch(TS3510_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 TS3510_Exported_Functions TS3510 Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Register IO bus to component object
|
||||
* @param Component object pointer
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t TS3510_RegisterBusIO (TS3510_Object_t *pObj, TS3510_IO_t *pIO)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
if (pObj == NULL)
|
||||
{
|
||||
ret = TS3510_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 = TS3510_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get TS3510 sensor capabilities
|
||||
* @param pObj Component object pointer
|
||||
* @param Capabilities pointer to TS3510 sensor capabilities
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t TS3510_GetCapabilities(TS3510_Object_t *pObj, TS3510_Capabilities_t *Capabilities)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
(void)(pObj);
|
||||
|
||||
/* Store component's capabilities */
|
||||
Capabilities->MultiTouch = 0;
|
||||
Capabilities->Gesture = 0;
|
||||
Capabilities->MaxTouch = TS3510_MAX_NB_TOUCH;
|
||||
Capabilities->MaxXl = TS3510_MAX_X_LENGTH;
|
||||
Capabilities->MaxYl = TS3510_MAX_Y_LENGTH;
|
||||
|
||||
return TS3510_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the TS3510 communication bus
|
||||
* from MCU to TS3510 : ie I2C channel initialization (if required).
|
||||
* @param pObj Component object pointer
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t TS3510_Init(TS3510_Object_t *pObj)
|
||||
{
|
||||
int32_t ret = TS3510_OK;
|
||||
|
||||
if(pObj->IsInitialized == 0U)
|
||||
{
|
||||
/* Initialize IO BUS layer */
|
||||
if(pObj->IO.Init() != TS3510_OK)
|
||||
{
|
||||
ret = TS3510_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
pObj->IsInitialized = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief De-Initialize the TS3510 communication bus
|
||||
* from MCU to TS3510 : ie I2C channel initialization (if required).
|
||||
* @param pObj Component object pointer
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t TS3510_DeInit(TS3510_Object_t *pObj)
|
||||
{
|
||||
int32_t ret = TS3510_OK;
|
||||
|
||||
if(pObj->IsInitialized == 1U)
|
||||
{
|
||||
if(pObj->IO.DeInit() != TS3510_OK)
|
||||
{
|
||||
ret = TS3510_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
pObj->IsInitialized = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the TS3510 gesture
|
||||
* from MCU to TS3510 : ie I2C channel initialization (if required).
|
||||
* @param pObj Component object pointer
|
||||
* @param GestureInit Gesture init structure
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t TS3510_GestureConfig(TS3510_Object_t *pObj, TS3510_Gesture_Init_t *GestureInit)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return TS3510_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the TS3510 device ID, pre initialize I2C in case of need to be
|
||||
* able to read the TS3510 device ID, and verify this is a TS3510.
|
||||
* @param pObj Component object pointer
|
||||
* @param Id Pointer to component ID value
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t TS3510_ReadID(TS3510_Object_t *pObj, uint32_t *Id)
|
||||
{
|
||||
int32_t ret = TS3510_OK;
|
||||
uint8_t aTmpBuffer[2] = {TS3510_READ_CMD, TS3510_WRITE_CMD};
|
||||
uint8_t data;
|
||||
|
||||
/* Prepare for LCD read data */
|
||||
if(ts3510_write_reg(&pObj->Ctx, TS3510_READ_BLOCK_REG, aTmpBuffer, 2) != TS3510_OK)
|
||||
{
|
||||
ret = TS3510_ERROR;
|
||||
}/* Read TS data from LCD */
|
||||
else if(ts3510_read_reg(&pObj->Ctx, TS3510_READ_BLOCK_REG, &data, 1) != TS3510_OK)
|
||||
{
|
||||
ret = TS3510_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
*Id = TS3510_ID;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the touch screen X and Y positions values
|
||||
* @param pObj Component object pointer
|
||||
* @param State Single Touch stucture pointer
|
||||
* @retval Component status.
|
||||
*/
|
||||
int32_t TS3510_GetState(TS3510_Object_t *pObj, TS3510_State_t *State)
|
||||
{
|
||||
int32_t ret = TS3510_OK;
|
||||
uint8_t aTmpBuffer[2] = {TS3510_READ_CMD, TS3510_WRITE_CMD};
|
||||
uint8_t pData[11];
|
||||
|
||||
/* Check if a touch is detected */
|
||||
State->TouchDetected = (uint32_t)TS3510_DetectTouch(pObj);
|
||||
|
||||
if(State->TouchDetected == 1U)
|
||||
{
|
||||
/* Prepare for LCD read data */
|
||||
if(ts3510_write_reg(&pObj->Ctx, TS3510_SEND_CMD_REG, aTmpBuffer, 2) != TS3510_OK)
|
||||
{
|
||||
ret = TS3510_ERROR;
|
||||
}/* Read TS data from LCD */
|
||||
else if(ts3510_read_reg(&pObj->Ctx, TS3510_READ_BLOCK_REG, pData, 11) != TS3510_OK)
|
||||
{
|
||||
ret = TS3510_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Send back first ready X position to caller */
|
||||
State->TouchX = (((pData[1] << 8) | pData[2]) << 12) / 640;
|
||||
/* Send back first ready Y position to caller */
|
||||
State->TouchY = (((pData[3] << 8) | pData[4]) << 12) / 480;
|
||||
}
|
||||
}
|
||||
|
||||
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 stucture pointer
|
||||
* @retval Component status.
|
||||
*/
|
||||
int32_t TS3510_GetMultiTouchState(TS3510_Object_t *pObj, TS3510_MultiTouch_State_t *State)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return TS3510_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get Gesture ID
|
||||
* @param pObj Component object pointer
|
||||
* @param GestureId gesture ID
|
||||
* @retval Component status.
|
||||
*/
|
||||
int32_t TS3510_GetGesture(TS3510_Object_t *pObj, uint8_t *GestureId)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return TS3510_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the TS3510 device to generate IT on given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param pObj Component object pointer
|
||||
* @retval Component status.
|
||||
*/
|
||||
int32_t TS3510_EnableIT(TS3510_Object_t *pObj)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return TS3510_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the TS3510 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 TS3510_DisableIT(TS3510_Object_t *pObj)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return TS3510_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get IT status from TS3510 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 TS3510.
|
||||
* @param pObj Component object pointer
|
||||
* @retval Component status.
|
||||
*/
|
||||
int32_t TS3510_ITStatus(TS3510_Object_t *pObj)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return TS3510_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear IT status in TS3510 interrupt status clear registers
|
||||
* Should be called Following an EXTI coming to the MCU.
|
||||
* @note : This feature is not applicable to TS3510.
|
||||
* @param pObj Component object pointer
|
||||
* @retval Component status.
|
||||
*/
|
||||
int32_t TS3510_ClearIT(TS3510_Object_t *pObj)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return TS3510_ERROR;
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TS3510_Private_Functions TS3510 Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Return if there is touches detected or not.
|
||||
* Get the touch screen X and Y positions values
|
||||
* @param pObj Component object pointer
|
||||
* @retval Number of active touches detected (can be 0 or 1) or TS3510_ERROR
|
||||
* in case of error
|
||||
*/
|
||||
static int32_t TS3510_DetectTouch(TS3510_Object_t *pObj)
|
||||
{
|
||||
int32_t ret;
|
||||
uint8_t aTmpBuffer[2] = {TS3510_READ_CMD, TS3510_WRITE_CMD};
|
||||
uint8_t pData[11];
|
||||
|
||||
/* Prepare for LCD read data */
|
||||
if(ts3510_write_reg(&pObj->Ctx, TS3510_SEND_CMD_REG, aTmpBuffer, 2) != TS3510_OK)
|
||||
{
|
||||
ret = TS3510_ERROR;
|
||||
}/* Read TS data from LCD */
|
||||
else if(ts3510_read_reg(&pObj->Ctx, TS3510_READ_BLOCK_REG, pData, 11) != TS3510_OK)
|
||||
{
|
||||
ret = TS3510_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((pData[1] == 0xFF) && (pData[2] == 0xFF) && (pData[3] == 0xFF) && (pData[4] == 0xFF))
|
||||
{
|
||||
/* If invalid number of touch detected, set it to zero */
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Touch detected */
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
TS3510_Object_t *pObj = (TS3510_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)
|
||||
{
|
||||
TS3510_Object_t *pObj = (TS3510_Object_t *)handle;
|
||||
|
||||
return pObj->IO.WriteReg(pObj->IO.Address, Reg, pData, Length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,193 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ts3510.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* ts3510.c Touch Screen driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2014 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 TS3510_H
|
||||
#define TS3510_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "ts3510_reg.h"
|
||||
#include <stddef.h>
|
||||
#include "ts3510_conf.h"
|
||||
|
||||
/* Macros --------------------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup TS3510
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup TS3510_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
#define TS3510_OK (0)
|
||||
#define TS3510_ERROR (-1)
|
||||
|
||||
/* Max detectable simultaneous touches */
|
||||
#define TS3510_MAX_NB_TOUCH 1U
|
||||
|
||||
/* Touch TS3510 IDs */
|
||||
#define TS3510_ID 0x3510U
|
||||
|
||||
#define TS3510_READ_CMD 0x81U
|
||||
#define TS3510_WRITE_CMD 0x08U
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TS3510_Exported_Types TS3510 Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Radian;
|
||||
uint32_t OffsetLeftRight;
|
||||
uint32_t OffsetUpDown;
|
||||
uint32_t DistanceLeftRight;
|
||||
uint32_t DistanceUpDown;
|
||||
uint32_t DistanceZoom;
|
||||
}TS3510_Gesture_Init_t;
|
||||
|
||||
typedef int32_t (*TS3510_Init_Func) (void);
|
||||
typedef int32_t (*TS3510_DeInit_Func) (void);
|
||||
typedef int32_t (*TS3510_GetTick_Func) (void);
|
||||
typedef int32_t (*TS3510_Delay_Func) (uint32_t);
|
||||
typedef int32_t (*TS3510_WriteReg_Func)(uint16_t, uint16_t, uint8_t*, uint16_t);
|
||||
typedef int32_t (*TS3510_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TS3510_Init_Func Init;
|
||||
TS3510_DeInit_Func DeInit;
|
||||
uint16_t Address;
|
||||
TS3510_WriteReg_Func WriteReg;
|
||||
TS3510_ReadReg_Func ReadReg;
|
||||
TS3510_GetTick_Func GetTick;
|
||||
} TS3510_IO_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t TouchDetected;
|
||||
uint32_t TouchX;
|
||||
uint32_t TouchY;
|
||||
} TS3510_State_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t TouchDetected;
|
||||
uint32_t TouchX[TS3510_MAX_NB_TOUCH];
|
||||
uint32_t TouchY[TS3510_MAX_NB_TOUCH];
|
||||
uint32_t TouchWeight[TS3510_MAX_NB_TOUCH];
|
||||
uint32_t TouchEvent[TS3510_MAX_NB_TOUCH];
|
||||
uint32_t TouchArea[TS3510_MAX_NB_TOUCH];
|
||||
} TS3510_MultiTouch_State_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TS3510_IO_t IO;
|
||||
ts3510_ctx_t Ctx;
|
||||
uint8_t IsInitialized;
|
||||
} TS3510_Object_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t MultiTouch;
|
||||
uint8_t Gesture;
|
||||
uint8_t MaxTouch;
|
||||
uint32_t MaxXl;
|
||||
uint32_t MaxYl;
|
||||
} TS3510_Capabilities_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t ( *Init ) ( TS3510_Object_t *);
|
||||
int32_t ( *DeInit ) ( TS3510_Object_t * );
|
||||
int32_t ( *GestureConfig ) ( TS3510_Object_t *, TS3510_Gesture_Init_t* );
|
||||
int32_t ( *ReadID ) ( TS3510_Object_t *, uint32_t * );
|
||||
int32_t ( *GetState ) ( TS3510_Object_t *, TS3510_State_t* );
|
||||
int32_t ( *GetMultiTouchState ) ( TS3510_Object_t *, TS3510_MultiTouch_State_t* );
|
||||
int32_t ( *GetGesture ) ( TS3510_Object_t *, uint8_t* );
|
||||
int32_t ( *GetCapabilities ) ( TS3510_Object_t *, TS3510_Capabilities_t * );
|
||||
int32_t ( *EnableIT ) ( TS3510_Object_t * );
|
||||
int32_t ( *DisableIT ) ( TS3510_Object_t * );
|
||||
int32_t ( *ClearIT ) ( TS3510_Object_t * );
|
||||
int32_t ( *ITStatus ) ( TS3510_Object_t * );
|
||||
} TS3510_TS_Drv_t;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup TS3510_Exported_Variables
|
||||
* @{
|
||||
*/
|
||||
extern TS3510_TS_Drv_t TS3510_TS_Driver;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup TS3510_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
int32_t TS3510_RegisterBusIO (TS3510_Object_t *pObj, TS3510_IO_t *pIO);
|
||||
int32_t TS3510_Init(TS3510_Object_t *pObj);
|
||||
int32_t TS3510_DeInit(TS3510_Object_t *pObj);
|
||||
int32_t TS3510_GestureConfig(TS3510_Object_t *pObj, TS3510_Gesture_Init_t *GestureInit);
|
||||
int32_t TS3510_ReadID(TS3510_Object_t *pObj, uint32_t *Id);
|
||||
int32_t TS3510_GetState(TS3510_Object_t *pObj, TS3510_State_t *State);
|
||||
int32_t TS3510_GetMultiTouchState(TS3510_Object_t *pObj, TS3510_MultiTouch_State_t *State);
|
||||
int32_t TS3510_GetGesture(TS3510_Object_t *pObj, uint8_t *GestureId);
|
||||
int32_t TS3510_EnableIT(TS3510_Object_t *pObj);
|
||||
int32_t TS3510_DisableIT(TS3510_Object_t *pObj);
|
||||
int32_t TS3510_ITStatus(TS3510_Object_t *pObj);
|
||||
int32_t TS3510_ClearIT(TS3510_Object_t *pObj);
|
||||
int32_t TS3510_GetCapabilities(TS3510_Object_t *pObj, TS3510_Capabilities_t *Capabilities);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* TS3510_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ts3510_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains specific configuration for the
|
||||
* ts3510.c that can be modified by user.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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 TS3510_CONF_H
|
||||
#define TS3510_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Macros --------------------------------------------------------------------*/
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
#define TS3510_MAX_X_LENGTH 4096U
|
||||
#define TS3510_MAX_Y_LENGTH 4096U
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* TS3510_CONF_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ts3510_reg.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides unitary register function to control the ts3510 Touch
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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 "ts3510_reg.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup TS3510
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup TS3510_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Read TS3510 component registers
|
||||
* @param ctx component contex
|
||||
* @param reg Register to read from
|
||||
* @param pdata Pointer to data buffer
|
||||
* @param length Number of data to read
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t ts3510_read_reg(ts3510_ctx_t *ctx, uint8_t reg, uint8_t* pdata, uint16_t length)
|
||||
{
|
||||
return ctx->ReadReg(ctx->handle, reg, pdata, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write TS3510 component registers
|
||||
* @param ctx component contex
|
||||
* @param reg Register to write to
|
||||
* @param pdata Pointer to data buffer
|
||||
* @param length Number of data to write
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t ts3510_write_reg(ts3510_ctx_t *ctx, uint8_t reg, uint8_t *pdata, uint16_t length)
|
||||
{
|
||||
return ctx->WriteReg(ctx->handle, reg, pdata, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ts3510_reg.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header of ts3510_reg.c
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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 TS3510_REG_H
|
||||
#define TS3510_REG_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Macros --------------------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup TS3510
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup TS3510_Exported_Constants Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define TS3510_READ_BLOCK_REG 0x8AU
|
||||
#define TS3510_SEND_CMD_REG 0x00U
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TS3510_Exported_Types TS3510 Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef int32_t (*TS3510_Write_Func)(void *, uint8_t, uint8_t*, uint16_t);
|
||||
typedef int32_t (*TS3510_Read_Func) (void *, uint8_t, uint8_t*, uint16_t);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TS3510_Write_Func WriteReg;
|
||||
TS3510_Read_Func ReadReg;
|
||||
void *handle;
|
||||
} ts3510_ctx_t;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup TS3510_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
int32_t ts3510_write_reg(ts3510_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
|
||||
int32_t ts3510_read_reg(ts3510_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* TS3510_REG_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
Reference in New Issue
Block a user