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,84 @@
<!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 STMPE1600 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-stmpe1600-component-drivers"><small>Release Notes for</small> <mark>STMPE1600 Component Drivers</mark></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>
<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 STMPE1600 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-section22" checked aria-hidden="true"> <label for="collapse-section22" aria-hidden="true">V1.1.1 / 03-April-2019</label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Update release notes format</li>
<li>Reformat the BSD 3-Clause license declaration in the files header (replace license terms by a web reference to OSI website where those terms lie)</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section19" aria-hidden="true"> <label for="collapse-section19" aria-hidden="true">V1.1.0 / 10-February-2015</label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>Update IO_Pin parameter to uint32_t in all IO functionalities functions</li>
<li>This version is to be used with Common V2.0.0 version</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section185" aria-hidden="true"> <label for="collapse-section185" aria-hidden="true">V1.0.1 / 02-December-2014</label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>stmpe1600.h: change “\” by “/” in the include path to fix compilation issue under Linux</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section18" aria-hidden="true"> <label for="collapse-section18" aria-hidden="true">V1.0.0 / 18-February-2014</label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>First official release</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,586 @@
/**
******************************************************************************
* @file stmpe1600.c
* @author MCD Application Team
* @brief This file provides a set of functions needed to manage the STMPE1600
* IO Expander devices.
******************************************************************************
* @attention
*
* <h2><center>&copy; 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 "stmpe1600.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @defgroup STMPE1600
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/** @defgroup STMPE1600_Private_Types_Definitions
* @{
*/
/* Private define ------------------------------------------------------------*/
/** @defgroup STMPE1600_Private_Defines
* @{
*/
#define STMPE1600_MAX_INSTANCE 2
/* Private macro -------------------------------------------------------------*/
/** @defgroup STMPE1600_Private_Macros
* @{
*/
/* Private variables ---------------------------------------------------------*/
static uint16_t tmp = 0;
/** @defgroup STMPE1600_Private_Variables
* @{
*/
/* IO driver structure initialization */
IO_DrvTypeDef stmpe1600_io_drv =
{
stmpe1600_Init,
stmpe1600_ReadID,
stmpe1600_Reset,
stmpe1600_Start,
stmpe1600_IO_Config,
stmpe1600_IO_WritePin,
stmpe1600_IO_ReadPin,
0,
0,
stmpe1600_IO_ITStatus,
stmpe1600_IO_ClearIT,
};
uint8_t stmpe1600[STMPE1600_MAX_INSTANCE] = {0};
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/** @defgroup STMPE1600_Private_Function_Prototypes
* @{
*/
static uint8_t stmpe1600_GetInstance(uint16_t DeviceAddr);
/* Private functions ---------------------------------------------------------*/
/** @defgroup STMPE1600_Private_Functions
* @{
*/
/**
* @brief Initialize the stmpe1600 and configure the needed hardware resources
* @param DeviceAddr: Device address on communication Bus.
* @retval None
*/
void stmpe1600_Init(uint16_t DeviceAddr)
{
uint8_t instance;
uint8_t empty;
/* Check if device instance already exists */
instance = stmpe1600_GetInstance(DeviceAddr);
if(instance == 0xFF)
{
/* Look for empty instance */
empty = stmpe1600_GetInstance(0);
if(empty < STMPE1600_MAX_INSTANCE)
{
/* Register the current device instance */
stmpe1600[empty] = DeviceAddr;
/* Initialize IO BUS layer */
IOE_Init();
/* Generate stmpe1600 Software reset */
stmpe1600_Reset(DeviceAddr);
}
}
}
/**
* @brief Configures the touch Screen Controller (Single point detection)
* @param DeviceAddr: Device address on communication Bus.
* @retval None.
*/
void stmpe1600_Start(uint16_t DeviceAddr, uint32_t IO_Pin)
{
/*Configuration already done during the initialization */
}
/**
* @brief Reset the stmpe1600 by Software.
* @param DeviceAddr: Device address on communication Bus.
* @retval None
*/
void stmpe1600_Reset(uint16_t DeviceAddr)
{
/* Power Down the stmpe1600 */
IOE_Write(DeviceAddr, STMPE1600_REG_SYS_CTRL, (uint16_t)0x80);
/* Wait for a delay to ensure registers erasing */
IOE_Delay(2);
/* Power On the Codec after the power off: all registers are reinitialized */
IOE_Write(DeviceAddr, STMPE1600_REG_SYS_CTRL, (uint16_t)0x00);
/* Wait for a delay to ensure registers erasing */
IOE_Delay(2);
}
/**
* @brief Read the stmpe1600 device ID.
* @param DeviceAddr: Device address on communication Bus.
* @retval The Device ID (two bytes).
*/
uint16_t stmpe1600_ReadID(uint16_t DeviceAddr)
{
uint8_t tmpData[2] = {0 , 0};
/* Initialize IO BUS layer */
IOE_Init();
/* Read the stmpe1600 device ID */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_CHP_ID, tmpData, 2);
/* Return the device ID value */
return((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
}
/**
* @brief Set the global interrupt Polarity.
* @param DeviceAddr: Device address on communication Bus.
* @param Polarity: could be one of these values;
* @arg STMPE1600_POLARITY_LOW: Interrupt line is active Low/Falling edge
* @arg STMPE1600_POLARITY_HIGH: Interrupt line is active High/Rising edge
* @retval None
*/
void stmpe1600_SetITPolarity(uint16_t DeviceAddr, uint8_t Polarity)
{
uint8_t tmp = 0;
/* Get the current register value */
tmp = IOE_Read(DeviceAddr, STMPE1600_REG_SYS_CTRL);
/* Mask the polarity bit */
tmp &= ~(uint16_t)0x01;
/* Set the Interrupt Output line polarity */
tmp |= (uint8_t)Polarity;
/* Set the new register value */
IOE_Write(DeviceAddr, STMPE1600_REG_SYS_CTRL, tmp);
}
/**
* @brief Enable the Global interrupt.
* @param DeviceAddr: Device address on communication Bus.
* @retval None
*/
void stmpe1600_EnableGlobalIT(uint16_t DeviceAddr)
{
uint8_t tmpData[2] = {0 , 0};
/* Configure NVIC IT for IOE */
IOE_ITConfig();
/* Get the current register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_SYS_CTRL, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Set the global interrupts to be Enabled */
tmp |= (uint16_t)STMPE1600_IT_ENABLE;
/* Write Back the Interrupt Control register */
IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_SYS_CTRL, (uint8_t *)&tmp, 2);
}
/**
* @brief Disable the Global interrupt.
* @param DeviceAddr: Device address on communication Bus.
* @retval None
*/
void stmpe1600_DisableGlobalIT(uint16_t DeviceAddr)
{
uint8_t tmpData[2] = {0 , 0};
/* Get the current register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_SYS_CTRL, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Set the global interrupts to be Enabled */
tmp &= ~(uint16_t)STMPE1600_IT_ENABLE;
/* Write Back the Interrupt Control register */
IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_SYS_CTRL, (uint8_t *)&tmp, 2);
}
/**
* @brief Initialize the selected pin(s) direction.
* @param DeviceAddr: Device address on communication Bus.
* @param IO_Pin: IO pin(s) to be configured.
* This parameter could be any combination of the following values:
* @arg STMPE1600_PIN_x: where x can be from 0 to 15.
* @param Direction: could be STMPE1600_DIRECTION_IN or STMPE1600_DIRECTION_OUT.
* @retval None
*/
void stmpe1600_IO_InitPin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Direction)
{
uint8_t tmpData[2] = {0 , 0};
/* Get the current register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPDR, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Set the Pin direction */
if (Direction != STMPE1600_DIRECTION_IN)
{
tmp |= (uint16_t)IO_Pin;
}
else
{
tmp &= ~(uint16_t)IO_Pin;
}
/* Set the new register value */
IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_GPDR, (uint8_t *)&tmp, 2);
}
/**
* @brief Configure the IO pin(s) according to IO mode structure value.
* @param DeviceAddr: Device address on communication Bus.
* @param IO_Pin: The output pin to be set or reset. This parameter can be one
* of the following values:
* @arg STMPE1600_PIN_x: where x can be from 0 to 7.
* @param IO_Mode: The IO pin mode to configure, could be one of the following values:
* @arg IO_MODE_INPUT
* @arg IO_MODE_OUTPUT
* @arg IO_MODE_IT_RISING_EDGE
* @arg IO_MODE_IT_FALLING_EDGE
* @retval 0 if no error, IO_Mode if error
*/
uint8_t stmpe1600_IO_Config(uint16_t DeviceAddr, uint32_t IO_Pin, IO_ModeTypedef IO_Mode)
{
uint8_t error_code = 0;
uint8_t buffer[2] = {0,0};
/* Configure IO pin according to selected IO mode */
switch(IO_Mode)
{
case IO_MODE_INPUT: /* Input mode */
stmpe1600_IO_DisablePinIT(DeviceAddr, IO_Pin);
stmpe1600_IO_InitPin(DeviceAddr, IO_Pin, STMPE1600_DIRECTION_IN);
break;
case IO_MODE_OUTPUT: /* Output mode */
stmpe1600_IO_DisablePinIT(DeviceAddr, IO_Pin);
stmpe1600_IO_InitPin(DeviceAddr, IO_Pin, STMPE1600_DIRECTION_OUT);
break;
case IO_MODE_IT_RISING_EDGE: /* Interrupt rising edge mode */
stmpe1600_SetITPolarity(DeviceAddr, STMPE1600_POLARITY_HIGH);
stmpe1600_IO_EnablePinIT(DeviceAddr, IO_Pin);
stmpe1600_IO_InitPin(DeviceAddr, IO_Pin, STMPE1600_DIRECTION_IN);
/* Clear all IO IT pending bits if any */
stmpe1600_IO_ClearIT(DeviceAddr, IO_Pin);
/* Read GMPR to enable interrupt */
IOE_ReadMultiple(DeviceAddr , STMPE1600_REG_GPMR, buffer, 2);
break;
case IO_MODE_IT_FALLING_EDGE: /* Interrupt falling edge mode */
stmpe1600_SetITPolarity(DeviceAddr, STMPE1600_POLARITY_LOW);
stmpe1600_IO_EnablePinIT(DeviceAddr, IO_Pin);
stmpe1600_IO_InitPin(DeviceAddr, IO_Pin, STMPE1600_DIRECTION_IN);
/* Clear all IO IT pending bits if any */
stmpe1600_IO_ClearIT(DeviceAddr, IO_Pin);
/* Read GMPR to enable interrupt */
IOE_ReadMultiple(DeviceAddr , STMPE1600_REG_GPMR, buffer, 2);
break;
default:
error_code = (uint8_t) IO_Mode;
break;
}
return error_code;
}
/**
* @brief Enable polarity inversion of the selected IO pin(s).
* @param DeviceAddr: Device address on communication Bus.
* @param IO_Pin: IO pin(s) to be configured.
* This parameter could be any combination of the following values:
* @arg STMPE1600_PIN_x: where x can be from 0 to 15.
* @retval None
*/
void stmpe1600_IO_PolarityInv_Enable(uint16_t DeviceAddr, uint32_t IO_Pin)
{
uint8_t tmpData[2] = {0 , 0};
/* Get the current register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPPIR, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Enable pin polarity inversion */
tmp |= (uint16_t)IO_Pin;
/* Set the new register value */
IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_GPPIR, (uint8_t *)&tmp, 2);
}
/**
* @brief Disable polarity inversion of the selected IO pins.
* @param DeviceAddr: Device address on communication Bus.
* @param IO_Pin: IO pin(s) to be configured.
* This parameter could be any combination of the following values:
* @arg STMPE1600_PIN_x: where x can be from 0 to 15.
* @retval None
*/
void stmpe1600_IO_PolarityInv_Disable(uint16_t DeviceAddr, uint32_t IO_Pin)
{
uint8_t tmpData[2] = {0 , 0};
/* Get the current register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPPIR, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Disable pin polarity inversion */
tmp &= ~ (uint16_t)IO_Pin;
/* Set the new register value */
IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_GPPIR, (uint8_t *)&tmp, 2);
}
/**
* @brief Set the value of the selected IO pins.
* @param DeviceAddr: Device address on communication Bus.
* @param IO_Pin: IO pin(s) to be set.
* This parameter could be any combination of the following values:
* @arg STMPE1600_PIN_x: where x can be from 0 to 15.
* @param PinState: The value to be set.
* @retval None
*/
void stmpe1600_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState)
{
uint8_t tmpData[2] = {0 , 0};
/* Get the current register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPMR, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Set the pin state */
if(PinState != 0)
{
tmp |= (uint16_t)IO_Pin;
}
else
{
tmp &= ~(uint16_t)IO_Pin;
}
/* Set the new register value */
IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_GPSR, (uint8_t *)&tmp, 2);
}
/**
* @brief Read the state of the selected IO pin(s).
* @param DeviceAddr: Device address on communication Bus.
* @param IO_Pin: IO pin(s) to be read.
* This parameter could be any combination of the following values:
* @arg STMPE1600_PIN_x: where x can be from 0 to 15.
* @retval State of the selected IO pin(s).
*/
uint32_t stmpe1600_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin)
{
uint8_t tmpData[2] = {0 , 0};
/* Get the register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPMR, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Return the pin(s) state */
return(tmp & IO_Pin);
}
/**
* @brief Enable the interrupt mode for the selected IO pin(s).
* @param DeviceAddr: Device address on communication Bus.
* @param IO_Pin: IO pin(s) to be configured.
* This parameter could be any combination of the following values:
* @arg STMPE1600_PIN_x: where x can be from 0 to 15.
* @retval None
*/
void stmpe1600_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin)
{
uint8_t tmpData[2] = {0 , 0};
/* Enable global interrupt */
stmpe1600_EnableGlobalIT(DeviceAddr);
/* Get the current register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_IEGPIOR, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Put pin in IT mode */
tmp |= (uint16_t)IO_Pin;
/* Write the new register value */
IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_IEGPIOR, (uint8_t *)&tmp, 2);
}
/**
* @brief Disable the interrupt mode for the selected IO pin(s).
* @param DeviceAddr: Device address on communication Bus.
* @param IO_Pin: IO pin(s) to be configured.
* This parameter could be any combination of the following values:
* @arg STMPE1600_PIN_x: where x can be from 0 to 15.
* @retval None
*/
void stmpe1600_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin)
{
uint8_t tmpData[2] = {0 , 0};
/* Get the current register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_IEGPIOR, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Disable the IT pin mode */
tmp &= ~(uint16_t)IO_Pin;
/* Set the new register value */
IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_IEGPIOR, (uint8_t *)&tmp, 2);
}
/**
* @brief Read the IT status of the selected IO pin(s)
* (clears all the pending bits if any).
* @param DeviceAddr: Device address on communication Bus.
* @param IO_Pin: IO pin(s) to be checked.
* This parameter could be any combination of the following values:
* @arg STMPE1600_PIN_x: where x can be from 0 to 15.
* @retval IT Status of the selected IO pin(s).
*/
uint32_t stmpe1600_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin)
{
uint8_t tmpData[2] = {0 , 0};
/* Get the register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_ISGPIOR, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Return the pin IT status */
return((tmp & IO_Pin) == IO_Pin);
}
/**
* @brief Detect an IT pending bit from the selected IO pin(s).
* (clears all the pending bits if any).
* @param DeviceAddr: Device address on communication Bus.
* @param IO_Pin: IO pin(s) to be checked.
* This parameter could be any combination of the following values:
* @arg STMPE1600_PIN_x: where x can be from 0 to 15.
* @retval IT pending bit detection status.
*/
uint8_t stmpe1600_IO_ReadIT(uint16_t DeviceAddr, uint32_t IO_Pin)
{
uint8_t tmpData[2] = {0 , 0};
/* Get the register value */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_ISGPIOR, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
/* Return if there is an IT pending bit or not */
return(tmp & IO_Pin);
}
/**
* @brief Clear all the IT pending bits if any.
* @param DeviceAddr: Device address on communication Bus.
* @retval None
*/
void stmpe1600_IO_ClearIT(uint16_t DeviceAddr, uint32_t IO_Pin)
{
uint8_t tmpData[2] = {0 , 0};
/* Get the register value to clear all pending bits */
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_ISGPIOR, tmpData, 2);
}
/**
* @brief Check if the device instance of the selected address is already registered
* and return its index
* @param DeviceAddr: Device address on communication Bus.
* @retval Index of the device instance if registered, 0xFF if not.
*/
static uint8_t stmpe1600_GetInstance(uint16_t DeviceAddr)
{
uint8_t idx = 0;
/* Check all the registered instances */
for(idx = 0; idx < STMPE1600_MAX_INSTANCE ; idx ++)
{
/* Return index if there is address match */
if(stmpe1600[idx] == DeviceAddr)
{
return idx;
}
}
return 0xFF;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@@ -0,0 +1,195 @@
/**
******************************************************************************
* @file stmpe1600.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the
* stmpe1600.c IO expander driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; 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 __STMPE1600_H
#define __STMPE1600_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "../Common/io.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @defgroup STMPE1600
* @{
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup STMPE1600_Exported_Types
* @{
*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup STMPE1600_Exported_Constants
* @{
*/
/**
* @brief STMPE1600 chip IDs
*/
#define STMPE1600_ID 0x1600
/**
* @brief Interrupt enable
*/
#define STMPE1600_IT_ENABLE 0x04
/**
* @brief Identification registers & System Control
*/
#define STMPE1600_REG_CHP_ID 0x00
#define STMPE1600_REG_ID_VERSION 0x02
#define STMPE1600_REG_SYS_CTRL 0x03
/**
* @brief IO Registers
*/
#define STMPE1600_REG_GPMR 0x10
#define STMPE1600_REG_GPSR 0x12
#define STMPE1600_REG_GPDR 0x14
#define STMPE1600_REG_GPPIR 0x16
/**
* @brief Interrupt Control registers
*/
#define STMPE1600_REG_IEGPIOR 0x08
#define STMPE1600_REG_ISGPIOR 0x0A
/**
* @brief IO Pins direction
*/
#define STMPE1600_DIRECTION_IN 0x00
#define STMPE1600_DIRECTION_OUT 0x01
/**
* @brief IO IT polarity
*/
#define STMPE1600_POLARITY_LOW 0x00
#define STMPE1600_POLARITY_HIGH 0x01
/**
* @brief IO Pins
*/
#define STMPE1600_PIN_0 0x0001
#define STMPE1600_PIN_1 0x0002
#define STMPE1600_PIN_2 0x0004
#define STMPE1600_PIN_3 0x0008
#define STMPE1600_PIN_4 0x0010
#define STMPE1600_PIN_5 0x0020
#define STMPE1600_PIN_6 0x0040
#define STMPE1600_PIN_7 0x0080
#define STMPE1600_PIN_8 0x0100
#define STMPE1600_PIN_9 0x0200
#define STMPE1600_PIN_10 0x0400
#define STMPE1600_PIN_11 0x0800
#define STMPE1600_PIN_12 0x1000
#define STMPE1600_PIN_13 0x2000
#define STMPE1600_PIN_14 0x4000
#define STMPE1600_PIN_15 0x8000
#define STMPE1600_PIN_ALL 0xFFFF
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/** @defgroup STMPE1600_Exported_Macros
* @{
*/
/* Exported functions --------------------------------------------------------*/
/** @defgroup STMPE1600_Exported_Functions
* @{
*/
/**
* @brief STMPE1600 Control functions
*/
void stmpe1600_Init(uint16_t DeviceAddr);
void stmpe1600_Reset(uint16_t DeviceAddr);
uint16_t stmpe1600_ReadID(uint16_t DeviceAddr);
void stmpe1600_SetITPolarity(uint16_t DeviceAddr, uint8_t Polarity);
void stmpe1600_EnableGlobalIT(uint16_t DeviceAddr);
void stmpe1600_DisableGlobalIT(uint16_t DeviceAddr);
/**
* @brief STMPE1600 IO functionalities functions
*/
void stmpe1600_IO_InitPin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Direction);
uint8_t stmpe1600_IO_Config(uint16_t DeviceAddr, uint32_t IO_Pin, IO_ModeTypedef IO_Mode);
void stmpe1600_IO_PolarityInv_Enable(uint16_t DeviceAddr, uint32_t IO_Pin);
void stmpe1600_IO_PolarityInv_Disable(uint16_t DeviceAddr, uint32_t IO_Pin);
void stmpe1600_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState);
uint32_t stmpe1600_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin);
void stmpe1600_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin);
void stmpe1600_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin);
uint32_t stmpe1600_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin);
uint8_t stmpe1600_IO_ReadIT(uint16_t DeviceAddr, uint32_t IO_Pin);
void stmpe1600_IO_ClearIT(uint16_t DeviceAddr, uint32_t IO_Pin);
void stmpe1600_Start(uint16_t DeviceAddr, uint32_t IO_Pin);
void IOE_Init(void);
void IOE_ITConfig (void);
void IOE_Delay(uint32_t delay);
void IOE_Write(uint8_t addr, uint8_t reg, uint8_t value);
uint8_t IOE_Read(uint8_t addr, uint8_t reg);
uint16_t IOE_ReadMultiple(uint8_t addr, uint8_t reg, uint8_t *buffer, uint16_t length);
void IOE_WriteMultiple(uint8_t addr, uint8_t reg, uint8_t *buffer, uint16_t length);
/* STMPE1600 driver structure */
extern IO_DrvTypeDef stmpe1600_io_drv;
#ifdef __cplusplus
}
#endif
#endif /* __STMPE1600_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/