1
0

add P4 & P5

This commit is contained in:
2025-11-24 15:44:12 +01:00
parent bd24f1fb79
commit f6fa6d94ce
1120 changed files with 576492 additions and 83 deletions

View File

@@ -0,0 +1,55 @@
<!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 CY8C4014LQI Component Drivers</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<link rel="stylesheet" href="../../../../_htmresc/mini-st.css" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<div class="row">
<div class="col-sm-12 col-lg-4">
<div class="card fluid">
<div class="sectione dark">
<center>
<h1 id="release-notes-for-cy8c4014lqi-component-drivers"><small>Release Notes for</small> <mark>CY8C4014LQI Component Drivers</mark></h1>
<p>Copyright © 2019 STMicroelectronics<br />
</p>
<a href="https://www.st.com" class="logo"><img src="../../../../_htmresc/st_logo.png" alt="ST logo" /></a>
</center>
</div>
</div>
<h1 id="license">License</h1>
<p>Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:</p>
<p><a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a></p>
<h1 id="purpose">Purpose</h1>
<p>This directory contains the CY8C4014LQI component drivers.</p>
</div>
<div class="col-sm-12 col-lg-8">
<h1 id="update-history">Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true">V1.0.0 / 05-July-2019</label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>First official release of CY8C4014LQI Touch Screen Component driver</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <a href="http://www.st.com/STM32">http://www.st.com/STM32</a>
</footer>
</body>
</html>

View File

@@ -0,0 +1,359 @@
/**
******************************************************************************
* @file cy8c4014lqi.c
* @author MCD Application Team
* @brief This file provides a set of functions needed to manage the CY8C4014LQI
* touch screen devices.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* 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 STMicroelectronics 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "cy8c4014lqi.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup CY8C4014LQI
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/** @defgroup CY8C4014LQI_Private_Types_Definitions
* @{
*/
/* cy8c4014lqi Handle definition. */
typedef struct
{
uint8_t i2cInitialized;
/* field holding the current number of simultaneous active touches */
uint8_t currActiveTouchNb;
/* field holding the touch index currently managed */
uint8_t currActiveTouchIdx;
} cy8c4014lqi_handle_TypeDef;
/**
* @}
*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
volatile uint8_t is_touch = 0;
/** @defgroup CY8C4014LQI_Private_Variables
* @{
*/
/* Touch screen driver structure initialization */
TS_DrvTypeDef cy8c4014lqi_ts_drv =
{
cy8c4014lqi_Init,
cy8c4014lqi_ReadID,
cy8c4014lqi_Reset,
cy8c4014lqi_TS_Start,
cy8c4014lqi_TS_DetectTouch,
cy8c4014lqi_TS_GetXY,
cy8c4014lqi_TS_EnableIT,
cy8c4014lqi_TS_ClearIT,
cy8c4014lqi_TS_ITStatus,
cy8c4014lqi_TS_DisableIT
};
/* Global cy8c4014lqi handle */
static cy8c4014lqi_handle_TypeDef cy8c4014lqi_handle = { CY8C4014LQI_I2C_NOT_INITIALIZED, 0U, 0U};
/**
* @}
*/
/* Private functions prototypes-----------------------------------------------*/
/** @defgroup CY8C4014LQI_Private_Functions
* @{
*/
static uint8_t cy8c4014lqi_Get_I2C_InitializedStatus(void);
static void cy8c4014lqi_I2C_InitializeIfRequired(void);
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup CY8C4014LQI_Exported_Functions
* @{
*/
/**
* @brief Initialize the cy8c4014lqi communication bus
* from MCU to CY8C4014LQI : ie I2C channel initialization (if required).
* @param DeviceAddr: Device address on communication Bus (I2C slave address of CY8C4014LQI).
* @retval None
*/
void cy8c4014lqi_Init(uint16_t DeviceAddr)
{
/* Initialize I2C link if needed */
cy8c4014lqi_I2C_InitializeIfRequired();
}
/**
* @brief Software Reset the cy8c4014lqi.
* @note : Not applicable to CY8C4014LQI.
* @param DeviceAddr: Device address on communication Bus (I2C slave address of CY8C4014LQI).
* @retval None
*/
void cy8c4014lqi_Reset(uint16_t DeviceAddr)
{
/* Do nothing */
/* No software reset sequence available in CY8C4014LQI IC */
}
/**
* @brief Read the cy8c4014lqi device ID, pre initialize I2C in case of need to be
* able to read the CY8C4014LQI device ID, and verify this is a CY8C4014LQI.
* @param DeviceAddr: I2C CY8C4014LQI Slave address.
* @retval The Device ID (two bytes).
*/
uint16_t cy8c4014lqi_ReadID(uint16_t DeviceAddr)
{
/* Initialize I2C link if needed */
cy8c4014lqi_I2C_InitializeIfRequired();
/* Return the device ID value */
return(TS_IO_Read(DeviceAddr, CY8C4014LQI_ADEVICE_ID));
}
/**
* @brief Configures the touch Screen IC device to start detecting touches
* @param DeviceAddr: Device address on communication Bus (I2C slave address).
* @retval None.
*/
void cy8c4014lqi_TS_Start(uint16_t DeviceAddr)
{
/* Do nothing */
/* No software available in CY8C4014LQI IC */
}
/**
* @brief Return if there is touches detected or not.
* Try to detect new touches and forget the old ones (reset internal global
* variables).
* @param DeviceAddr: Device address on communication Bus.
* @retval : Number of active touches detected (can be 0, 1 or 2).
*/
uint8_t cy8c4014lqi_TS_DetectTouch(uint16_t DeviceAddr)
{
return is_touch;
}
/**
* @brief Get the touch screen X and Y positions values
* Manage multi touch thanks to touch Index global
* variable 'cy8c4014lqi_handle.currActiveTouchIdx'.
* @param DeviceAddr: Device address on communication Bus.
* @param X: Pointer to X position value
* @param Y: Pointer to Y position value
* @retval None.
*/
void cy8c4014lqi_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
{
*X = TS_IO_Read(CY8C4014LQI_ADDR, CY8C4014LQI_POS_X);
*Y = TS_IO_Read(CY8C4014LQI_ADDR, CY8C4014LQI_POS_Y);
}
/**
* @brief Configure the CY8C4014LQI device to generate IT on given INT pin
* connected to MCU as EXTI.
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of CY8C4014LQI).
* @retval None
*/
void cy8c4014lqi_TS_EnableIT(uint16_t DeviceAddr)
{
/* Do nothing */
/* Action done by BSP software */
}
/**
* @brief Configure the CY8C4014LQI device to stop generating IT on the given INT pin
* connected to MCU as EXTI.
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of CY8C4014LQI).
* @retval None
*/
void cy8c4014lqi_TS_DisableIT(uint16_t DeviceAddr)
{
/* Do nothing */
/* Action done by BSP software */
}
/**
* @brief Get IT status from CY8C4014LQI 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 CY8C4014LQI.
* @param DeviceAddr: Device address on communication Bus (I2C slave address of CY8C4014LQI).
* @retval TS interrupts status : always return 0 here
*/
uint8_t cy8c4014lqi_TS_ITStatus(uint16_t DeviceAddr)
{
/* Always return 0 as feature not applicable to CY8C4014LQI */
return 0U;
}
/**
* @brief Clear IT status in CY8C4014LQI interrupt status clear registers
* Should be called Following an EXTI coming to the MCU.
* @note : This feature is not applicable to CY8C4014LQI.
* @param DeviceAddr: Device address on communication Bus (I2C slave address of CY8C4014LQI).
* @retval None
*/
void cy8c4014lqi_TS_ClearIT(uint16_t DeviceAddr)
{
/* Do nothing */
/* Action done by BSP software */
}
/**
* @brief Configure gesture feature (enable/disable).
* @param DeviceAddr: Device address on communication Bus (I2C slave address of CY8C4014LQI).
* @param Activation : Enable or disable gesture feature. Possible values are
* CY8C4014LQI_GESTURE_DISABLE or CY8C4014LQI_GESTURE_ENABLE.
* @retval None.
*/
void cy8c4014lqi_TS_GestureConfig(uint16_t DeviceAddr, uint32_t Activation)
{
/* Do nothing */
/* No software available in CY8C4014LQI IC */
}
/**
* @brief Get the last touch gesture identification (zoom, move up/down...).
* @param DeviceAddr: Device address on communication Bus (I2C slave address of CY8C4014LQI).
* @param pGestureId : Pointer to get last touch gesture Identification.
* @retval None.
*/
void cy8c4014lqi_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId)
{
/* Do nothing */
/* No software available in CY8C4014LQI IC */
}
/**
* @brief Get the touch detailed informations on touch number 'touchIdx' (0..1)
* This touch detailed information contains :
* - weight that was applied to this touch
* - sub-area of the touch in the touch panel
* - event of linked to the touch (press down, lift up, ...)
* @param DeviceAddr: Device address on communication Bus (I2C slave address of CY8C4014LQI).
* @param touchIdx : Passed index of the touch (0..1) on which we want to get the
* detailed information.
* @param pWeight : Pointer to to get the weight information of 'touchIdx'.
* @param pArea : Pointer to to get the sub-area information of 'touchIdx'.
* @param pEvent : Pointer to to get the event information of 'touchIdx'.
* @note Area and Weight features are not supported by CY8C4014LQI. Return always 0 value.
* @retval None.
*/
void cy8c4014lqi_TS_GetTouchInfo(uint16_t DeviceAddr,
uint32_t touchIdx,
uint32_t * pWeight,
uint32_t * pArea,
uint32_t * pEvent)
{
/* Do nothing */
/* No software available in CY8C4014LQI IC */
}
/**
* @}
*/
/* Private functions bodies---------------------------------------------------*/
/** @addtogroup CY8C4014LQI_Private_Functions
* @{
*/
/**
* @brief Return the status of I2C was initialized or not.
* @param None.
* @retval : I2C initialization status.
*/
static uint8_t cy8c4014lqi_Get_I2C_InitializedStatus(void)
{
return(cy8c4014lqi_handle.i2cInitialized);
}
/**
* @brief I2C initialize if needed.
* @param None.
* @retval : None.
*/
static void cy8c4014lqi_I2C_InitializeIfRequired(void)
{
if(cy8c4014lqi_Get_I2C_InitializedStatus() == CY8C4014LQI_I2C_NOT_INITIALIZED)
{
/* Initialize TS IO BUS layer (I2C) */
TS_IO_Init();
/* Set state to initialized */
cy8c4014lqi_handle.i2cInitialized = CY8C4014LQI_I2C_INITIALIZED;
}
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@@ -0,0 +1,165 @@
/**
******************************************************************************
* @file cy8c4014lqi.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the
* cy8c4014lqi.c touch screen driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* 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 STMicroelectronics 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.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CY8C4014LQI_H
#define __CY8C4014LQI_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "../Common/ts.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @defgroup CY8C4014LQI
* @{
*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup CY8C4014LQI_Exported_Constants
* @{
*/
#define CY8C4014LQI_ADDR (0x08<<1)
#define CY8C4014LQI_ADEVICE_ID (0x00)
#define CY8C4014LQI_VERSION (0x01)
#define CY8C4014LQI_SYSMODE (0x03)
#define CY8C4014LQI_TOUCH_EVENT (0x04)
#define CY8C4014LQI_POS_X (0x06)
#define CY8C4014LQI_POS_Y (0x07)
#define CY8C4014LQI_GESTURE (0x08)
#define CY8C4014LQI_DISTENCE_X (0x09)
#define CY8C4014LQI_DISTENCE_Y (0x0A)
#define DATA_VALUE_FLAG (0x0B)
/* Possible values of global variable 'TS_I2C_Initialized' */
#define CY8C4014LQI_I2C_NOT_INITIALIZED 0x00U
#define CY8C4014LQI_I2C_INITIALIZED 0x01U
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @defgroup CY8C4014LQI_Exported_Functions
* @{
*/
void cy8c4014lqi_Init(uint16_t DeviceAddr);
void cy8c4014lqi_Reset(uint16_t DeviceAddr);
uint16_t cy8c4014lqi_ReadID(uint16_t DeviceAddr);
void cy8c4014lqi_TS_Start(uint16_t DeviceAddr);
uint8_t cy8c4014lqi_TS_DetectTouch(uint16_t DeviceAddr);
void cy8c4014lqi_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
void cy8c4014lqi_TS_EnableIT(uint16_t DeviceAddr);
void cy8c4014lqi_TS_DisableIT(uint16_t DeviceAddr);
uint8_t cy8c4014lqi_TS_ITStatus (uint16_t DeviceAddr);
void cy8c4014lqi_TS_ClearIT (uint16_t DeviceAddr);
void cy8c4014lqi_TS_GestureConfig(uint16_t DeviceAddr, uint32_t Activation);
void cy8c4014lqi_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId);
void cy8c4014lqi_TS_GetTouchInfo(uint16_t DeviceAddr,
uint32_t touchIdx,
uint32_t * pWeight,
uint32_t * pArea,
uint32_t * pEvent);
/**
* @}
*/
/* Imported TS IO functions --------------------------------------------------------*/
/** @defgroup CY8C4014LQI_Imported_Functions
* @{
*/
/* TouchScreen (TS) external IO functions */
extern void TS_IO_Init(void);
extern void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
extern uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg);
extern uint16_t TS_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
extern void TS_IO_Delay(uint32_t Delay);
/**
* @}
*/
/* Imported global variables --------------------------------------------------------*/
/** @defgroup CY8C4014LQI_Imported_Globals
* @{
*/
/* Touch screen driver structure */
extern TS_DrvTypeDef cy8c4014lqi_ts_drv;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __CY8C4014LQI_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/