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,27 @@
|
||||
Copyright 2023 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,50 @@
|
||||
<!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 EXC80W32 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_2020.css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="icon" type="image/x-icon" href="_htmresc/favicon.png" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-4">
|
||||
<center>
|
||||
<h1 id="release-notes-for">Release Notes for</h1>
|
||||
<h1 id="exc80w32-component-driver"><mark>EXC80W32 Component Driver </mark></h1>
|
||||
<p>Copyright © 2024 STMicroelectronics<br />
|
||||
</p>
|
||||
<a href="https://www.st.com" class="logo"><img src="_htmresc/st_logo_2020.png" alt="ST logo" /></a>
|
||||
</center>
|
||||
<h1 id="purpose">Purpose</h1>
|
||||
<p>This driver provides a set of functions offered by EXC80W32 TS component.</p>
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-8">
|
||||
<h1 id="update-history"><strong>Update History</strong></h1>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section1_0_0" checked aria-hidden="true"> <label for="collapse-section1_0_0" aria-hidden="true"><strong>V1.0.0 / 03-July-2024</strong></label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<ul>
|
||||
<li>First official release of <strong>EXC80W32</strong> Touch Screen component 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,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><g fill="#13254a"><path d="M100 .212C44.868.212 0 44.889 0 99.788c0 55.132 44.868 100 100 100s100-44.868 100-100C200 44.889 155.132.212 100 .212zm0 181.164c-44.974 0-81.587-36.614-81.587-81.587 0-44.762 36.614-81.164 81.587-81.164 44.995 0 81.587 36.402 81.587 81.164 0 44.973-36.592 81.587-81.587 81.587z" style="fill: #e6007e;"/><path d="M141.1 88.127h-29.439V58.688c0-6.392-5.185-11.598-11.598-11.598-6.413 0-11.619 5.206-11.619 11.598v29.439H58.476c-6.392 0-11.598 5.185-11.598 11.598 0 6.413 5.206 11.619 11.598 11.619h29.968v29.968c0 6.392 5.206 11.598 11.619 11.598 6.413 0 11.598-5.206 11.598-11.598v-29.968H141.1c6.392 0 11.598-5.206 11.598-11.619 0-6.413-5.206-11.598-11.598-11.598z" style="fill: #e6007e;"/></g></svg>
|
||||
|
After Width: | Height: | Size: 830 B |
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><g fill="#03234b"><path d="M170.934 64.569l-.04-.055-29.049 40.038-.057.079h14.867a59.366 59.366 0 0 1-1.488 15.615c-1.158 5.318-3.807 13.448-9.848 21.977-2.766 4.118-6.375 7.726-9.208 10.408-3.426 2.857-7.461 6.095-12 8.376-8.121 4.568-17.881 7.138-28.225 7.432-10.907.248-20.201-2.61-26.072-5.052-8.283-3.479-14.111-7.807-16.85-10.078-1.254-.956-2.25-1.907-3.057-2.676a28.662 28.662 0 0 0-1.157-1.069 158.874 158.874 0 0 0-1.479-1.362l-4.435-3.956 3.569 4.81.183.243c.2.263.548.722 1.048 1.389.276.334.579.747.93 1.226l.008.01c.689.939 1.546 2.107 2.664 3.322 3 3.536 8.178 8.801 15.808 13.801 5.969 3.866 15.672 8.901 28.001 10.935a79.05 79.05 0 0 0 12.485.998c7.97 0 15.651-1.228 22.828-3.649 6.366-1.877 12.192-4.981 17.053-7.771 6.16-3.936 10.817-7.586 14.654-11.488 8.084-7.899 14.884-17.913 19.15-28.199 3.259-7.594 5.456-15.727 6.529-24.175l.055-.425.083-.641H200l-29.066-40.063zM58.159 99.232l-12.655.563c-.097-.881-.159-1.986-.227-3.474a59.184 59.184 0 0 1 1.446-16.56c1.157-5.316 3.804-13.444 9.848-21.977 2.168-3.228 5.009-6.44 9.208-10.415 3.41-2.849 7.432-6.08 12.005-8.375 8.114-4.568 17.87-7.138 28.213-7.432 10.9-.25 20.196 2.607 26.072 5.045 8.258 3.473 14.105 7.812 16.857 10.091 1.257.951 2.253 1.904 3.057 2.673l.017.016c.43.411.801.766 1.136 1.051.475.438.841.777 1.091 1.01l.138.128.248.229 4.04 3.613-3.165-4.456c-.058-.083-.312-.417-.73-.971l-.507-.67a28.922 28.922 0 0 1-.901-1.192l-.02-.027c-.69-.945-1.548-2.121-2.677-3.346-3.002-3.537-8.182-8.803-15.813-13.801-5.964-3.865-15.662-8.9-27.997-10.935-8.484-1.363-21.496-2.009-35.313 2.651-6.355 1.88-12.186 4.983-17.054 7.772-6.163 3.944-10.82 7.595-14.654 11.488-8.079 7.894-14.882 17.909-19.155 28.2-3.268 7.624-5.463 15.757-6.523 24.173-.436 3.281-.642 5.421-.664 6.926L0 101.831l30.683 38.727.042.053 27.38-41.298.054-.081z" style="fill: #e6007e;"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
@@ -0,0 +1,437 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file exc80w32.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the EXC80W32
|
||||
* devices.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "exc80w32.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup EXC80W32 EXC80W32
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/** @defgroup EXC80W32_Exported_Variables EXC80W32 Exported Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Touch screen driver structure initialization */
|
||||
EXC80W32_TS_Drv_t EXC80W32_TS_Driver =
|
||||
{
|
||||
EXC80W32_Init,
|
||||
EXC80W32_DeInit,
|
||||
EXC80W32_GestureConfig,
|
||||
EXC80W32_ReadID,
|
||||
EXC80W32_GetState,
|
||||
EXC80W32_GetMultiTouchState,
|
||||
EXC80W32_GetGesture,
|
||||
EXC80W32_GetCapabilities,
|
||||
EXC80W32_EnableIT,
|
||||
EXC80W32_DisableIT,
|
||||
EXC80W32_ClearIT,
|
||||
EXC80W32_ITStatus
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup EXC80W32_Private_Function_Prototypes EXC80W32 Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
static int32_t EXC80W32_DetectTouch(EXC80W32_Object_t *pObj, uint8_t *pData, uint32_t Length);
|
||||
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 EXC80W32_Exported_Functions EXC80W32 Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Register IO bus to component object
|
||||
* @param Component object pointer
|
||||
* @retval error status
|
||||
*/
|
||||
int32_t EXC80W32_RegisterBusIO (EXC80W32_Object_t *pObj, EXC80W32_IO_t *pIO)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
if (pObj == NULL)
|
||||
{
|
||||
ret = EXC80W32_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 = EXC80W32_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get EXC80W32 sensor capabilities
|
||||
* @param pObj Component object pointer
|
||||
* @param Capabilities pointer to EXC80W32 sensor capabilities
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t EXC80W32_GetCapabilities(EXC80W32_Object_t *pObj, EXC80W32_Capabilities_t *Capabilities)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
(void)(pObj);
|
||||
|
||||
/* Store component's capabilities */
|
||||
Capabilities->MultiTouch = 0;
|
||||
Capabilities->Gesture = 0;
|
||||
Capabilities->MaxTouch = EXC80W32_MAX_NB_TOUCH;
|
||||
Capabilities->MaxXl = EXC80W32_MAX_X_LENGTH;
|
||||
Capabilities->MaxYl = EXC80W32_MAX_Y_LENGTH;
|
||||
|
||||
return EXC80W32_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the EXC80W32 communication bus
|
||||
* from MCU to EXC80W32 : ie I2C channel initialization (if required).
|
||||
* @param pObj Component object pointer
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t EXC80W32_Init(EXC80W32_Object_t *pObj)
|
||||
{
|
||||
int32_t ret = EXC80W32_OK;
|
||||
|
||||
if(pObj->IsInitialized == 0U)
|
||||
{
|
||||
/* Initialize IO BUS layer */
|
||||
if(pObj->IO.Init() != EXC80W32_OK)
|
||||
{
|
||||
ret = EXC80W32_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
pObj->IsInitialized = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief De-Initialize the EXC80W32 communication bus
|
||||
* from MCU to EXC80W32 : ie I2C channel de-initialization.
|
||||
* @param pObj Component object pointer
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t EXC80W32_DeInit(EXC80W32_Object_t *pObj)
|
||||
{
|
||||
int32_t ret = EXC80W32_OK;
|
||||
|
||||
if(pObj->IsInitialized == 1U)
|
||||
{
|
||||
if(pObj->IO.DeInit() != EXC80W32_OK)
|
||||
{
|
||||
ret = EXC80W32_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
pObj->IsInitialized = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the EXC80W32 gesture
|
||||
* from MCU to EXC80W32 : ie I2C channel initialization (if required).
|
||||
* @param pObj Component object pointer
|
||||
* @param GestureInit Gesture init structure
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t EXC80W32_GestureConfig(EXC80W32_Object_t *pObj, EXC80W32_Gesture_Init_t *GestureInit)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return EXC80W32_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the EXC80W32 device ID, pre initialize I2C in case of need to be
|
||||
* able to read the EXC80W32 device ID, and verify this is a EXC80W32.
|
||||
* @param pObj Component object pointer
|
||||
* @param Id Pointer to component ID value
|
||||
* @retval Component status
|
||||
*/
|
||||
int32_t EXC80W32_ReadID(EXC80W32_Object_t *pObj, uint32_t *Id)
|
||||
{
|
||||
int32_t ret = EXC80W32_ERROR;
|
||||
uint8_t data;
|
||||
|
||||
if(exc80w32_read_reg(&pObj->Ctx, EXC80W32_READ_REG, &data, 1) == EXC80W32_OK)
|
||||
{
|
||||
*Id = EXC80W32_ID;
|
||||
ret = EXC80W32_OK;
|
||||
}
|
||||
|
||||
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 EXC80W32_GetState(EXC80W32_Object_t *pObj, EXC80W32_State_t *State)
|
||||
{
|
||||
uint8_t data[10];
|
||||
|
||||
State->TouchDetected = (uint32_t)EXC80W32_DetectTouch(pObj, data, (uint32_t)sizeof(data));
|
||||
if (State->TouchDetected == 1)
|
||||
{
|
||||
/* Send back first ready X position to caller */
|
||||
State->TouchX = (((data[6] & 0x00FFU) << 0U) | ((data[7] & 0x00FFU) << 8U)) >>2;
|
||||
/* Send back first ready Y position to caller */
|
||||
State->TouchY = (((data[8] & 0x00FFU) << 0U) | ((data[9] & 0x00FFU) << 8U)) >>2;
|
||||
}
|
||||
return EXC80W32_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 EXC80W32_GetMultiTouchState(EXC80W32_Object_t *pObj, EXC80W32_MultiTouch_State_t *State)
|
||||
{
|
||||
uint8_t data[54];
|
||||
uint8_t TouchNb;
|
||||
State->TouchDetected = (uint32_t)EXC80W32_DetectTouch(pObj, data, (uint32_t)sizeof(data));
|
||||
if (State->TouchDetected == 1)
|
||||
{
|
||||
if (data[2] == EXC80W32_MULTITOUCH_ID)
|
||||
{
|
||||
if (data[3] <= EXC80W32_MAX_NB_TOUCH)
|
||||
{
|
||||
for (TouchNb=0;TouchNb<=data[3];TouchNb++)
|
||||
{
|
||||
/* Send back X positions to caller */
|
||||
State->TouchX[TouchNb] = (((data[6 + 10 * TouchNb] & 0x00FFU) << 0U) |
|
||||
((data[7 + 10 * TouchNb] & 0x00FFU) << 8U)) >>2;
|
||||
/* Send back Y positions to caller */
|
||||
State->TouchY[TouchNb] = (((data[8 + 10 * TouchNb] & 0x00FFU) << 0U) |
|
||||
((data[9 + 10 * TouchNb] & 0x00FFU) << 8U)) >>2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (TouchNb=0;TouchNb<EXC80W32_MAX_NB_TOUCH;TouchNb++)
|
||||
{
|
||||
/* Send back X positions to caller */
|
||||
State->TouchX[TouchNb] = (((data[6 + 10 * TouchNb] & 0x00FFU) << 0U) |
|
||||
((data[7 + 10 * TouchNb] & 0x00FFU) << 8U)) >>2;
|
||||
/* Send back Y positions to caller */
|
||||
State->TouchY[TouchNb] = (((data[8 + 10 * TouchNb] & 0x00FFU) << 0U) |
|
||||
((data[9 + 10 * TouchNb] & 0x00FFU) << 8U)) >>2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return EXC80W32_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get Gesture ID
|
||||
* @param pObj Component object pointer
|
||||
* @param GestureId gesture ID
|
||||
* @retval Component status.
|
||||
*/
|
||||
int32_t EXC80W32_GetGesture(EXC80W32_Object_t *pObj, uint8_t *GestureId)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return EXC80W32_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the EXC80W32 device to generate IT on given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param pObj Component object pointer
|
||||
* @retval Component status.
|
||||
*/
|
||||
int32_t EXC80W32_EnableIT(EXC80W32_Object_t *pObj)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return EXC80W32_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the EXC80W32 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 EXC80W32_DisableIT(EXC80W32_Object_t *pObj)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return EXC80W32_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get IT status from EXC80W32 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 EXC80W32.
|
||||
* @param pObj Component object pointer
|
||||
* @retval Component status.
|
||||
*/
|
||||
int32_t EXC80W32_ITStatus(EXC80W32_Object_t *pObj)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return EXC80W32_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear IT status in EXC80W32 interrupt status clear registers
|
||||
* Should be called Following an EXTI coming to the MCU.
|
||||
* @note : This feature is not applicable to EXC80W32.
|
||||
* @param pObj Component object pointer
|
||||
* @retval Component status.
|
||||
*/
|
||||
int32_t EXC80W32_ClearIT(EXC80W32_Object_t *pObj)
|
||||
{
|
||||
/* Feature not supported */
|
||||
return EXC80W32_ERROR;
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup EXC80W32_Private_Functions EXC80W32 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
|
||||
* @param pData Pointer to data buffer
|
||||
* @param Length Number of data to read
|
||||
* @retval Number of active touches detected (can be 0 or 1) or EXC80W32_ERROR
|
||||
* in case of error
|
||||
*/
|
||||
static int32_t EXC80W32_DetectTouch(EXC80W32_Object_t *pObj, uint8_t *pData, uint32_t Length)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
/* Read TS data */
|
||||
if(exc80w32_read_reg(&pObj->Ctx, EXC80W32_READ_REG, pData, Length) != EXC80W32_OK)
|
||||
{
|
||||
ret = EXC80W32_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pData[4] != 0xFFU)
|
||||
{
|
||||
/* Touch detected */
|
||||
ret = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If invalid number of touch detected, set it to zero */
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wrap IO bus read function to component register read 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)
|
||||
{
|
||||
EXC80W32_Object_t *pObj = (EXC80W32_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)
|
||||
{
|
||||
EXC80W32_Object_t *pObj = (EXC80W32_Object_t *)handle;
|
||||
|
||||
return pObj->IO.WriteReg(pObj->IO.Address, Reg, pData, Length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file exc80w32.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* exc80w32.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef EXC80W32_H
|
||||
#define EXC80W32_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "exc80w32_reg.h"
|
||||
#include <stddef.h>
|
||||
#include "exc80w32_conf.h"
|
||||
|
||||
/* Macros --------------------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup EXC80W32
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup EXC80W32_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
#define EXC80W32_OK (0)
|
||||
#define EXC80W32_ERROR (-1)
|
||||
|
||||
/* Max detectable simultaneous touches */
|
||||
#define EXC80W32_MAX_NB_TOUCH 1U
|
||||
|
||||
/* Touch EXC80W32 IDs */
|
||||
#define EXC80W32_ID 0x8032U
|
||||
|
||||
/* EXC80W32 Multitouch state Report ID*/
|
||||
#define EXC80W32_MULTITOUCH_ID 0x18U
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup EXC80W32_Exported_Types EXC80W32 Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Radian;
|
||||
uint32_t OffsetLeftRight;
|
||||
uint32_t OffsetUpDown;
|
||||
uint32_t DistanceLeftRight;
|
||||
uint32_t DistanceUpDown;
|
||||
uint32_t DistanceZoom;
|
||||
}EXC80W32_Gesture_Init_t;
|
||||
|
||||
typedef int32_t (*EXC80W32_Init_Func) (void);
|
||||
typedef int32_t (*EXC80W32_DeInit_Func) (void);
|
||||
typedef int32_t (*EXC80W32_GetTick_Func) (void);
|
||||
typedef int32_t (*EXC80W32_Delay_Func) (uint32_t);
|
||||
typedef int32_t (*EXC80W32_WriteReg_Func)(uint16_t, uint16_t, uint8_t*, uint16_t);
|
||||
typedef int32_t (*EXC80W32_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
EXC80W32_Init_Func Init;
|
||||
EXC80W32_DeInit_Func DeInit;
|
||||
uint16_t Address;
|
||||
EXC80W32_WriteReg_Func WriteReg;
|
||||
EXC80W32_ReadReg_Func ReadReg;
|
||||
EXC80W32_GetTick_Func GetTick;
|
||||
} EXC80W32_IO_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t TouchDetected;
|
||||
uint32_t TouchX;
|
||||
uint32_t TouchY;
|
||||
} EXC80W32_State_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t TouchDetected;
|
||||
uint32_t TouchX[EXC80W32_MAX_NB_TOUCH];
|
||||
uint32_t TouchY[EXC80W32_MAX_NB_TOUCH];
|
||||
uint32_t TouchWeight[EXC80W32_MAX_NB_TOUCH];
|
||||
uint32_t TouchEvent[EXC80W32_MAX_NB_TOUCH];
|
||||
uint32_t TouchArea[EXC80W32_MAX_NB_TOUCH];
|
||||
} EXC80W32_MultiTouch_State_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
EXC80W32_IO_t IO;
|
||||
exc80w32_ctx_t Ctx;
|
||||
uint8_t IsInitialized;
|
||||
} EXC80W32_Object_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t MultiTouch;
|
||||
uint8_t Gesture;
|
||||
uint8_t MaxTouch;
|
||||
uint32_t MaxXl;
|
||||
uint32_t MaxYl;
|
||||
} EXC80W32_Capabilities_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t ( *Init ) ( EXC80W32_Object_t *);
|
||||
int32_t ( *DeInit ) ( EXC80W32_Object_t * );
|
||||
int32_t ( *GestureConfig ) ( EXC80W32_Object_t *, EXC80W32_Gesture_Init_t* );
|
||||
int32_t ( *ReadID ) ( EXC80W32_Object_t *, uint32_t * );
|
||||
int32_t ( *GetState ) ( EXC80W32_Object_t *, EXC80W32_State_t* );
|
||||
int32_t ( *GetMultiTouchState ) ( EXC80W32_Object_t *, EXC80W32_MultiTouch_State_t* );
|
||||
int32_t ( *GetGesture ) ( EXC80W32_Object_t *, uint8_t* );
|
||||
int32_t ( *GetCapabilities ) ( EXC80W32_Object_t *, EXC80W32_Capabilities_t * );
|
||||
int32_t ( *EnableIT ) ( EXC80W32_Object_t * );
|
||||
int32_t ( *DisableIT ) ( EXC80W32_Object_t * );
|
||||
int32_t ( *ClearIT ) ( EXC80W32_Object_t * );
|
||||
int32_t ( *ITStatus ) ( EXC80W32_Object_t * );
|
||||
} EXC80W32_TS_Drv_t;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup EXC80W32_Exported_Variables
|
||||
* @{
|
||||
*/
|
||||
extern EXC80W32_TS_Drv_t EXC80W32_TS_Driver;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup EXC80W32_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
int32_t EXC80W32_RegisterBusIO (EXC80W32_Object_t *pObj, EXC80W32_IO_t *pIO);
|
||||
int32_t EXC80W32_Init(EXC80W32_Object_t *pObj);
|
||||
int32_t EXC80W32_DeInit(EXC80W32_Object_t *pObj);
|
||||
int32_t EXC80W32_GestureConfig(EXC80W32_Object_t *pObj, EXC80W32_Gesture_Init_t *GestureInit);
|
||||
int32_t EXC80W32_ReadID(EXC80W32_Object_t *pObj, uint32_t *Id);
|
||||
int32_t EXC80W32_GetState(EXC80W32_Object_t *pObj, EXC80W32_State_t *State);
|
||||
int32_t EXC80W32_GetMultiTouchState(EXC80W32_Object_t *pObj, EXC80W32_MultiTouch_State_t *State);
|
||||
int32_t EXC80W32_GetGesture(EXC80W32_Object_t *pObj, uint8_t *GestureId);
|
||||
int32_t EXC80W32_EnableIT(EXC80W32_Object_t *pObj);
|
||||
int32_t EXC80W32_DisableIT(EXC80W32_Object_t *pObj);
|
||||
int32_t EXC80W32_ITStatus(EXC80W32_Object_t *pObj);
|
||||
int32_t EXC80W32_ClearIT(EXC80W32_Object_t *pObj);
|
||||
int32_t EXC80W32_GetCapabilities(EXC80W32_Object_t *pObj, EXC80W32_Capabilities_t *Capabilities);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* EXC80W32_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file exc80w32_conf_template.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains specific configuration for the
|
||||
* exc80w32.c that can be modified by user.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef EXC80W32_CONF_H
|
||||
#define EXC80W32_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Macros --------------------------------------------------------------------*/
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
#define EXC80W32_MAX_X_LENGTH 4096U
|
||||
#define EXC80W32_MAX_Y_LENGTH 4096U
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* EXC80W32_CONF_H */
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file exc80w32_reg.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides unitary register function to control the exc80w32 Touch
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "exc80w32_reg.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup EXC80W32
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup EXC80W32_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Read EXC80W32 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 exc80w32_read_reg(exc80w32_ctx_t *ctx, uint8_t reg, uint8_t* pdata, uint16_t length)
|
||||
{
|
||||
return ctx->ReadReg(ctx->handle, reg, pdata, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write EXC80W32 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 exc80w32_write_reg(exc80w32_ctx_t *ctx, uint8_t reg, uint8_t *pdata, uint16_t length)
|
||||
{
|
||||
return ctx->WriteReg(ctx->handle, reg, pdata, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file exc80w32_reg.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header of exc80w32_reg.c
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef EXC80W32_REG_H
|
||||
#define EXC80W32_REG_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Macros --------------------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup EXC80W32
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup EXC80W32_Exported_Constants Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* */
|
||||
#define EXC80W32_READ_REG 0x0FU
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup EXC80W32_Exported_Types EXC80W32 Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef int32_t (*EXC80W32_Write_Func)(void *, uint8_t, uint8_t*, uint16_t);
|
||||
typedef int32_t (*EXC80W32_Read_Func) (void *, uint8_t, uint8_t*, uint16_t);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
EXC80W32_Write_Func WriteReg;
|
||||
EXC80W32_Read_Func ReadReg;
|
||||
void *handle;
|
||||
} exc80w32_ctx_t;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup EXC80W32_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
int32_t exc80w32_write_reg(exc80w32_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
|
||||
int32_t exc80w32_read_reg(exc80w32_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* EXC80W32_REG_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user