1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-12 19:10:27 +03:00

Merge pull request #10593 from iNavFlight/mmosca-h7a3

Update libraries - pre-req for H7A3
This commit is contained in:
Marcelo Bezerra 2025-01-22 17:46:23 +01:00
parent 4034a33565
commit 16ebb27c8b
No known key found for this signature in database
GPG key ID: 718A5AC065848530
10619 changed files with 2797309 additions and 51476 deletions

View file

@ -222,3 +222,4 @@ macro(define_target_stm32h7 subfamily size)
endmacro()
define_target_stm32h7(43 i)
define_target_stm32h7(A3 i)

View file

@ -0,0 +1,186 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_nucleo_conf.h"
#include "stm32f4xx_nucleo_errno.h"
#include "stm32f4xx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
#if !defined (USE_NUCLEO_64) && !defined (USE_NUCLEO_144)
#error "Board Pin number not defined"
#endif
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#if defined (USE_NUCLEO_64)
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC1_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC1_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_8
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOB
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_0
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#else /* USE_NUCLEO_144 */
#if defined(ADC3)
#define ADAFRUIT_802_ADCx ADC3
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC3_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC3_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_9
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOF
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_3
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#else
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC1_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC1_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_11
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOC
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_1
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
#endif
#endif
#define ADAFRUIT_802_ADCx_RANK 1U
#define ADAFRUIT_802_ADCx_SAMPLETIME ADC_SAMPLETIME_3CYCLES
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCKPRESCALER_PCLK_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
#if defined (USE_NUCLEO_64)
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_5
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_6
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_9
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOA
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#else /* USE_NUCLEO_144 */
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_14
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOF
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_14
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOD
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_12
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOF
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
/**
* @brief SD Control Lines management
*/
#define ADAFRUIT_802_SD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_SD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define ADAFRUIT_802_LCD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_SET)
#define ADAFRUIT_802_LCD_DC_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_DC_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,138 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f7xx_nucleo_conf.h"
#include "stm32f7xx_nucleo_errno.h"
#include "stm32f7xx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
#if !defined (USE_NUCLEO_144)
#error "Board Pin number not defined"
#endif
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#if defined (USE_NUCLEO_144)
#define NUCLEO_ADCx ADC3
#define NUCLEO_ADCx_CLK_ENABLE() __HAL_RCC_ADC3_CLK_ENABLE()
#define NUCLEO_ADCx_CLK_DISABLE() __HAL_RCC_ADC3_CLK_DISABLE()
#define NUCLEO_ADCx_CHANNEL ADC_CHANNEL_9
#define NUCLEO_ADCx_GPIO_PORT GPIOF
#define NUCLEO_ADCx_GPIO_PIN GPIO_PIN_3
#define NUCLEO_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define NUCLEO_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_RANK 1U
#define ADAFRUIT_802_ADCx_SAMPLETIME ADC_SAMPLETIME_3CYCLES
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCK_SYNC_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
/**
* @brief SD Control Interface pins (shield D4)
*/
#define NUCLEO_SD_CS_PIN GPIO_PIN_14
#define NUCLEO_SD_CS_GPIO_PORT GPIOF
#define NUCLEO_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define NUCLEO_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define NUCLEO_LCD_CS_PIN GPIO_PIN_14
#define NUCLEO_LCD_CS_GPIO_PORT GPIOD
#define NUCLEO_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define NUCLEO_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define NUCLEO_LCD_DC_PIN GPIO_PIN_12
#define NUCLEO_LCD_DC_GPIO_PORT GPIOF
#define NUCLEO_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define NUCLEO_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
/**
* @brief SD Control Lines management
*/
#define SD_CS_LOW() HAL_GPIO_WritePin(NUCLEO_SD_CS_GPIO_PORT, NUCLEO_SD_CS_PIN, GPIO_PIN_RESET)
#define SD_CS_HIGH() HAL_GPIO_WritePin(NUCLEO_SD_CS_GPIO_PORT, NUCLEO_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define LCD_CS_LOW() HAL_GPIO_WritePin(NUCLEO_LCD_CS_GPIO_PORT, NUCLEO_LCD_CS_PIN, GPIO_PIN_RESET)
#define LCD_CS_HIGH() HAL_GPIO_WritePin(NUCLEO_LCD_CS_GPIO_PORT, NUCLEO_LCD_CS_PIN, GPIO_PIN_SET)
#define LCD_DC_LOW() HAL_GPIO_WritePin(NUCLEO_LCD_DC_GPIO_PORT, NUCLEO_LCD_DC_PIN, GPIO_PIN_RESET)
#define LCD_DC_HIGH() HAL_GPIO_WritePin(NUCLEO_LCD_DC_GPIO_PORT, NUCLEO_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,136 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32g4xx_nucleo_conf.h"
#include "stm32g4xx_nucleo_errno.h"
#include "stm32g4xx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
#if !defined (USE_NUCLEO_64)
#error "Board Pin number not defined"
#endif
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC12_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC12_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_15
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOB
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_0
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_RANK ADC_REGULAR_RANK_1
#define ADAFRUIT_802_ADCx_SAMPLETIME ADC_SAMPLETIME_24CYCLES_5
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCK_SYNC_PCLK_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_5
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_6
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_9
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOA
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
/**
* @brief SD Control Lines management
*/
#define ADAFRUIT_802_SD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_SD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define ADAFRUIT_802_LCD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_SET)
#define ADAFRUIT_802_LCD_DC_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_DC_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,161 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_nucleo_conf.h"
#include "stm32h7xx_nucleo_errno.h"
#include "stm32h7xx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#if defined (USE_NUCLEO_H745ZI_Q) || defined (USE_NUCLEO_H743ZI2) || defined (USE_NUCLEO_H7A3ZI_Q)
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC12_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC12_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_5
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOB
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_1
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#else /* USE_NUCLEO_H743ZI */
#define ADAFRUIT_802_ADCx ADC3
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC3_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC3_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_5
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOF
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_3
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
#define ADAFRUIT_802_ADCx_RANK ADC_REGULAR_RANK_1
#define ADAFRUIT_802_ADCx_SAMPLETIME ADC_SAMPLETIME_2CYCLES_5
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCKPRESCALER_PCLK_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_14
#if defined (USE_NUCLEO_H745ZI_Q) || defined (USE_NUCLEO_H743ZI2) || defined (USE_NUCLEO_H7A3ZI_Q)
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOE
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
#else /* USE_NUCLEO_H743ZI */
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOF
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_14
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOD
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#if defined (USE_NUCLEO_H743ZI2)
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_3
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOF
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#elif defined (USE_NUCLEO_H745ZI_Q) || defined (USE_NUCLEO_H7A3ZI_Q)
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_9
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOG
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
#else /* USE_NUCLEO_H743ZI */
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_12
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOF
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
/**
* @brief SD Control Lines management
*/
#define ADAFRUIT_802_SD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_SD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define ADAFRUIT_802_LCD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_SET)
#define ADAFRUIT_802_LCD_DC_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_DC_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,172 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32l4xx_nucleo_conf.h"
#include "stm32l4xx_nucleo_errno.h"
#include "stm32l4xx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
#if !defined (USE_NUCLEO_64) && !defined (USE_NUCLEO_144)
#error "Board Pin number not defined"
#endif
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC_CLK_DISABLE()
#if defined (USE_NUCLEO_64)
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_15
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOB
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_0
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#else /* USE_NUCLEO_144 */
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_2
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOC
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_1
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
#endif
#define ADAFRUIT_802_ADCx_RANK 1U
#define ADAFRUIT_802_ADCx_SAMPLETIME ADC_SAMPLETIME_24CYCLES_5
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCK_SYNC_PCLK_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
#if defined (USE_NUCLEO_64)
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_5
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_6
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_9
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOA
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#else /* USE_NUCLEO_144 */
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_14
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOF
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_14
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOD
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_12
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOF
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
/**
* @brief SD Control Lines management
*/
#define ADAFRUIT_802_SD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_SD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define ADAFRUIT_802_LCD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_SET)
#define ADAFRUIT_802_LCD_DC_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_DC_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,133 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32wlxx_nucleo_conf.h"
#include "stm32wlxx_nucleo_errno.h"
#include "stm32wlxx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_3
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOB
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_4
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_RANK ADC_REGULAR_RANK_1
#define ADAFRUIT_802_ADCx_SAMPLETIME LL_ADC_SAMPLINGTIME_COMMON_1
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCK_SYNC_PCLK_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_5
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_4
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOA
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_2
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOC
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
/**
* @brief SD Control Lines management
*/
#define ADAFRUIT_802_SD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_SD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define ADAFRUIT_802_LCD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_SET)
#define ADAFRUIT_802_LCD_DC_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_DC_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,273 @@
<!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 Adafruit_Shield 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-adafruit_shield-driver"><strong>Release Notes for Adafruit_Shield 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>The BSP (Board Specific Package) drivers are parts of the STM32Cube package based on the HAL drivers and provide a set of high level APIs relative to the hardware components and features in the evaluation boards, discovery kits and nucleo boards coming with the STM32Cube package for a given STM32 serie.</p>
<p>The BSP drivers allow a quick access to the boards services using high level APIs and without any specific configuration as the link with the HAL and the external components is done in intrinsic within the drivers.</p>
<p>From project settings points of view, user has only to add the necessary drivers files in the workspace and call the needed functions from examples. However some low level configuration functions are weak and can be overridden by the applications if user wants to change some BSP drivers default behavior.</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-section18" checked aria-hidden="true"> <label for="collapse-section18" aria-hidden="true"><strong>V5.0.1 / 13-March-2020</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Minor changes to fix typos</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section17" aria-hidden="true"> <label for="collapse-section17" aria-hidden="true"><strong>V5.0.0 / 25-February-2020</strong></label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>Rename GUI_Drv_t into UTILS_LCD_Drv_t</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>Components/common v7.0.0</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section16" aria-hidden="true"> <label for="collapse-section16" aria-hidden="true"><strong>V4.0.4 / 15-October-2019</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>adafruit_802.c
<ul>
<li>Updated to support STM32WLxx devices</li>
</ul></li>
<li>Add Adafruit_Config/adafruit_802_conf_STM32WLxx_Nucleo.h
<ul>
<li>Remove support of USE_NUCLEO_H7A3ZI nucleo board</li>
</ul></li>
<li>Update st_logo.png inclusion path in Release notes</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section15" aria-hidden="true"> <label for="collapse-section15" aria-hidden="true"><strong>V4.0.3 / 25-June-2019</strong></label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>adafruit_802_sd.c
<ul>
<li>Update SD token for Start Multiple Block Write operation to 0xFC instead of 0xFD</li>
</ul></li>
<li>Adafruit_Config/adafruit_802_conf_STM32H7xx_Nucleo.h
<ul>
<li>Remove support of USE_NUCLEO_H7A3ZI nucleo board</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section14" aria-hidden="true"> <label for="collapse-section14" aria-hidden="true"><strong>V4.0.2 / 30-May-2019</strong></label>
<div>
<h2 id="main-changes-4">Main Changes</h2>
<ul>
<li>stm32_adafruit_sd.h
<ul>
<li>Remove volatile qualification for SD_CID structures fields</li>
</ul></li>
<li>Adafruit_Config/adafruit_802_conf_STM32H7xx_Nucleo.h
<ul>
<li>Add support of USE_NUCLEO_H7A3ZI_Q nucleo board</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section13" aria-hidden="true"> <label for="collapse-section13" aria-hidden="true"><strong>V4.0.1 / 25-April-2019</strong></label>
<div>
<h2 id="main-changes-5">Main Changes</h2>
<ul>
<li>Add adafruit_802_conf_STM32H7xx_Nucleo.h file under Adafruit_Config folder</li>
<li>adafruit_802_lcd.c/.h:
<ul>
<li>Update context content</li>
<li>Update checks on functions returned value</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section12" aria-hidden="true"> <label for="collapse-section12" aria-hidden="true"><strong>V4.0.0 / 12-April-2019</strong></label>
<div>
<h2 id="main-changes-6">Main Changes</h2>
<ul>
<li>Official release of component drivers for Adafruit_Shield in line with STM32Cube BSP drivers development guidelines (UM2298)</li>
</ul>
<h2 id="backward-compatibility-1">Backward Compatibility</h2>
<p>This version breaks the compatibility with previous versions</p>
<h2 id="dependencies-1">Dependencies</h2>
<ul>
<li>Components/common v6.0.0</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section9" aria-hidden="true"> <label for="collapse-section9" aria-hidden="true"><strong>V3.0.3 / 30-April-2018</strong></label>
<div>
<h2 id="main-changes-7">Main Changes</h2>
<ul>
<li>stm32_adafruit_sd.c:
<ul>
<li>Fix BSP_SD_ReadBlocks and BSP_SD_WriteBlocks to support SDHC cards</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section8" aria-hidden="true"> <label for="collapse-section8" aria-hidden="true"><strong>V3.0.2 / 24-August-2017</strong></label>
<div>
<h2 id="main-changes-8">Main Changes</h2>
<ul>
<li>stm32_adafruit_lcd.c:
<ul>
<li>Fix compilation errors with SW4STM32 toolchain</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section7" aria-hidden="true"> <label for="collapse-section7" aria-hidden="true"><strong>V3.0.1 / 02-June-2017</strong></label>
<div>
<h2 id="main-changes-9">Main Changes</h2>
<ul>
<li>Add general description of BSP drivers</li>
<li>Add Dependencies section</li>
<li>Support of PDSC</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section6" aria-hidden="true"> <label for="collapse-section6" aria-hidden="true"><strong>V3.0.0 / 23-December-2016</strong></label>
<div>
<h2 id="main-changes-10">Main Changes</h2>
<ul>
<li>Update BSP_SD_ReadBlocks and BSP_SD_WriteBlocks following new HAL SD drivers implementation</li>
<li>Update BSP_SD_Erase implementation to manage SDHC and SDSC cards</li>
<li>Fix block size to 512 bytes for all card types</li>
</ul>
<h2 id="backward-compatibility-2">Backward Compatibility</h2>
<p>These Adafruit BSP drivers break the compatibility with previous versions.</p>
<h2 id="dependencies-2">Dependencies</h2>
<p>If FatFs is required, “FatFS R0.11 ST modified 20161223” must be used with this version of Adafruit BSP drivers.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section5" aria-hidden="true"> <label for="collapse-section5" aria-hidden="true"><strong>V2.0.1 / 04-November-2015</strong></label>
<div>
<h2 id="main-changes-11">Main Changes</h2>
<ul>
<li>Fix GNU GCC warning on missing break instruction in SD_GetDataResponse()</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section4" aria-hidden="true"> <label for="collapse-section4" aria-hidden="true"><strong>V2.0.0 / 10-September-2015</strong></label>
<div>
<h2 id="main-changes-12">Main Changes</h2>
<ul>
<li>Improve SD over SPI protocol implementation</li>
<li><strong>Note</strong>
<ul>
<li>This new implementation requires to increase Heap_Size by 0x200</li>
</ul></li>
</ul>
<h2 id="dependencies-3">Dependencies</h2>
<ul>
<li>This driver version needs BSP Nucleo driver V2.0.0 and later</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V1.1.1 / 21-November-2014</strong></label>
<div>
<h2 id="main-changes-13">Main Changes</h2>
<ul>
<li>stm32_adafruit_sd.c
<ul>
<li>Add workaround for the issue seen on some STM32 Nucleo boards; reading the SD card status will return an error</li>
<li>A fix will be implemented in next release</li>
</ul></li>
<li>stm32_adafruit_lcd.h:
<ul>
<li>Change “" by”/" in the include path to fix compilation issue under Linux</li>
</ul></li>
<li>Miscellaneous:
<ul>
<li>Comments update</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V1.1.0 / 22-July-2014</strong></label>
<div>
<h2 id="main-changes-14">Main Changes</h2>
<ul>
<li>Add new user API BSP_LCD_DrawBitmap() to draw a bitmap picture loaded in the STM32 MCU internal memory</li>
<li>Add new static API SetDisplayWindow(), needed by BSP_LCD_DrawBitmap()</li>
<li>Update static API DrawChar()</li>
</ul>
<h2 id="dependencies-4">Dependencies</h2>
<p>This driver version needs ST7735 component driver V1.1.0 and later.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 22-April-2014</strong></label>
<div>
<h2 id="main-changes-15">Main Changes</h2>
<ul>
<li>First official release of <strong>Adafruit Shield</strong> 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>

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

View file

@ -0,0 +1,468 @@
/**
******************************************************************************
* @file adafruit_802.c
* @author MCD Application Team
* @brief This file provides set of firmware functions to manage:
* - Joystick available on Adafruit 1.8" TFT LCD shield (reference ID 802)
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 "adafruit_802.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @addtogroup ADAFRUIT_802_LOW_LEVEL
* @{
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL_Private_Variables LOW LEVEL Private Variables
* @{
*/
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
static uint32_t IsJoyMspCbValid = 0;
#endif
static ADC_HandleTypeDef hJoyHandle;
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL_Private_FunctionPrototypes LOW LEVEL Private FunctionPrototypes
* @{
*/
static void JOY1_MspInit(ADC_HandleTypeDef *hadc);
static void JOY1_MspDeInit(ADC_HandleTypeDef *hadc);
/**
* @}
*/
/** @addtogroup ADAFRUIT_802_LOW_LEVEL_Exported_Functions
* @{
*/
/**
* @brief Configures the joystick.
* @param JOY Joystick to be initialized
* @param JoyMode Button mode.
* This parameter is not used as the ADC pin should be always configured
* in analog mode.
* @param JoyPins There are no physical pins but voltage levels
* @retval BSP status
*/
int32_t ADAFRUIT_802_JOY_Init(JOY_TypeDef JOY, JOYMode_TypeDef JoyMode, JOYPin_TypeDef JoyPins)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(JoyPins);
UNUSED(JoyMode);
int32_t ret = BSP_ERROR_NONE;
if(JOY >= JOYn)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 0)
/* Init the UART Msp */
JOY1_MspInit(&hJoyHandle);
#else
if(IsJoyMspCbValid == 0U)
{
if(ADAFRUIT_802_JOY_RegisterDefaultMspCallbacks(JOY) != BSP_ERROR_NONE)
{
return BSP_ERROR_MSP_FAILURE;
}
}
#endif
if(MX_ADAFRUIT_802_ADC_Init(&hJoyHandle) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else
{
#if defined(ADC_CALFACT_CALFACT_S)
/* Run ADC calibration */
#if defined(ADC_CR_ADCALLIN)
if(HAL_ADCEx_Calibration_Start(&hJoyHandle, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else
{
if(HAL_ADCEx_Calibration_Start(&hJoyHandle, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
}
#else
if(HAL_ADCEx_Calibration_Start(&hJoyHandle, ADC_SINGLE_ENDED) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
#endif
#endif /* defined(ADC_CALFACT_CALFACT_S) */
}
}
return ret;
}
/**
* @brief DeInit joystick GPIOs.
* @param JOY Joystick to be de-initialized
* @param JoyPins There are no physical pins but voltage levels
* @retval BSP status
*/
int32_t ADAFRUIT_802_JOY_DeInit(JOY_TypeDef JOY, JOYPin_TypeDef JoyPins)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(JoyPins);
int32_t ret = BSP_ERROR_NONE;
/* ADC configuration */
hJoyHandle.Instance = ADAFRUIT_802_ADCx;
if(JOY >= JOYn)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 0)
JOY1_MspDeInit(&hJoyHandle);
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 0) */
if(HAL_ADC_DeInit(&hJoyHandle) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
}
return ret;
}
/**
* @brief Returns the Joystick key pressed.
* @param JOY Joystick to get its pins' state
* @retval BSP error code if value is negative or one of the following values:
* - JOY_NONE : 3.3 V / 4095
* - JOY_SEL : 1.055 V / 1308
* - JOY_DOWN : 0.71 V / 88
* - JOY_LEFT : 3.0 V / 3720
* - JOY_RIGHT : 0.595 V / 737
* - JOY_UP : 1.65 V / 2046
*/
int32_t ADAFRUIT_802_JOY_GetState(JOY_TypeDef JOY)
{
int32_t ret;
uint32_t keyconvertedvalue;
if(JOY >= JOYn)
{
ret = BSP_ERROR_WRONG_PARAM;
}/* Start the conversion process */
else if(HAL_ADC_Start(&hJoyHandle) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}/* Wait for the end of conversion */
else if(HAL_ADC_PollForConversion(&hJoyHandle, ADAFRUIT_802_ADCx_POLL_TIMEOUT) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}/* Check if the continuous conversion of regular channel is finished */
else if((HAL_ADC_GetState(&hJoyHandle) & HAL_ADC_STATE_REG_EOC) != HAL_ADC_STATE_REG_EOC)
{
ret = BSP_ERROR_BUSY;
}
else
{
/* Get the converted value of regular channel */
keyconvertedvalue = HAL_ADC_GetValue(&hJoyHandle);
if((keyconvertedvalue > 2010U) && (keyconvertedvalue < 2500U))
{
ret = (int32_t)JOY_UP;
}
else if((keyconvertedvalue > 680U) && (keyconvertedvalue < 900U))
{
ret = (int32_t)JOY_RIGHT;
}
else if((keyconvertedvalue > 1270U) && (keyconvertedvalue < 1500U))
{
ret = (int32_t)JOY_SEL;
}
else if((keyconvertedvalue > 50U) && (keyconvertedvalue < 200U))
{
ret = (int32_t)JOY_DOWN;
}
else if((keyconvertedvalue > 3400U) && (keyconvertedvalue < 3760U))
{
ret = (int32_t)JOY_LEFT;
}
else
{
ret = (int32_t)JOY_NONE;
}
}
/* Return the code of the Joystick key pressed */
return ret;
}
/**
* @brief Configures ADC peripheral
* @param hadc ADC handle
* @retval HAL error code
*/
__weak HAL_StatusTypeDef MX_ADAFRUIT_802_ADC_Init(ADC_HandleTypeDef *hadc)
{
HAL_StatusTypeDef ret = HAL_OK;
ADC_ChannelConfTypeDef sConfig;
/* ADC configuration */
hadc->Instance = ADAFRUIT_802_ADCx;
hadc->Init.ClockPrescaler = ADAFRUIT_802_ADCx_PRESCALER;
hadc->Init.Resolution = ADC_RESOLUTION_12B;
#if defined(ADC_CR2_ALIGN)
hadc->Init.DataAlign = ADC_DATAALIGN_RIGHT;
#endif
hadc->Init.ScanConvMode = (uint32_t)DISABLE;
#if defined(ADC_EOC_SINGLE_CONV)
hadc->Init.EOCSelection = ADC_EOC_SINGLE_CONV;
#endif
hadc->Init.ContinuousConvMode = DISABLE;
hadc->Init.NbrOfConversion = 1;
hadc->Init.DiscontinuousConvMode = DISABLE;
#if defined(ADC_CFGR_DISCNUM)
hadc->Init.NbrOfDiscConversion = 0;
#endif
hadc->Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc->Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
#if defined(ADC_CR2_DMA)
hadc->Init.DMAContinuousRequests = DISABLE;
#endif
#if defined(ADC_SMPR_SMP1) && defined(ADC_SMPR_SMP2)
hadc->Init.SamplingTimeCommon1 = ADC_SAMPLETIME_39CYCLES_5;
hadc->Init.SamplingTimeCommon2 = ADC_SAMPLETIME_39CYCLES_5;
#endif
#if defined(ADC_CFGR2_LFTRIG)
hadc->Init.TriggerFrequencyMode = ADC_TRIGGER_FREQ_HIGH;
#endif
if (HAL_ADC_Init(hadc) != HAL_OK)
{
ret = HAL_ERROR;
}
else
{
/**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
*/
sConfig.Channel = ADAFRUIT_802_ADCx_CHANNEL;
sConfig.Rank = ADAFRUIT_802_ADCx_RANK;
sConfig.SamplingTime = ADAFRUIT_802_ADCx_SAMPLETIME;
#if defined(ADC_OFR1_OFFSET1)
sConfig.Offset = 0;
#endif
#if defined(ADC_SINGLE_ENDED)
sConfig.SingleDiff = ADC_SINGLE_ENDED;
#endif
#if defined(ADC_OFFSET_NONE)
sConfig.OffsetNumber = ADC_OFFSET_NONE;
#endif
if (HAL_ADC_ConfigChannel(hadc, &sConfig) != HAL_OK)
{
ret = HAL_ERROR;
}
}
return ret;
}
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
/**
* @brief Register Default ADCx Bus Msp Callbacks
* @param JOY Joystick to be configured.
* This parameter can be JOY1
* @retval BSP status
*/
int32_t ADAFRUIT_802_JOY_RegisterDefaultMspCallbacks(JOY_TypeDef JOY)
{
int32_t ret = BSP_ERROR_NONE;
if(JOY >= JOYn)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
__HAL_ADC_RESET_HANDLE_STATE(&hJoyHandle);
/* Register default MspInit/MspDeInit Callback */
if(HAL_ADC_RegisterCallback(&hJoyHandle, HAL_ADC_MSPINIT_CB_ID, JOY1_MspInit) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else if(HAL_ADC_RegisterCallback(&hJoyHandle, HAL_ADC_MSPDEINIT_CB_ID, JOY1_MspDeInit) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else
{
IsJoyMspCbValid = 1U;
}
}
/* BSP status */
return ret;
}
/**
* @brief Register ADCx Bus Msp Callback registering
* @param JOY Joystick to be configured.
* This parameter can be JOY1
* @param Callbacks pointer to ADCx MspInit/MspDeInit callback functions
* @retval BSP status
*/
int32_t ADAFRUIT_802_JOY_RegisterMspCallbacks(JOY_TypeDef JOY, ADAFRUIT_802_JOY_Cb_t *Callback)
{
int32_t ret = BSP_ERROR_NONE;
if(JOY >= JOYn)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
__HAL_ADC_RESET_HANDLE_STATE(&hJoyHandle);
/* Register MspInit/MspDeInit Callbacks */
if(HAL_ADC_RegisterCallback(&hJoyHandle, HAL_ADC_MSPINIT_CB_ID, Callback->pMspInitCb) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else if(HAL_ADC_RegisterCallback(&hJoyHandle, HAL_ADC_MSPDEINIT_CB_ID, Callback->pMspDeInitCb) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else
{
IsJoyMspCbValid = 1U;
}
}
/* BSP status */
return ret;
}
#endif /* USE_HAL_ADC_REGISTER_CALLBACKS */
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL_Private_Functions LOW LEVEL Private Functions
* @{
*/
/**
* @brief Initializes ADC MSP.
* @param hadc ADC handle
* @retval None
*/
static void JOY1_MspInit(ADC_HandleTypeDef *hadc)
{
GPIO_InitTypeDef GPIO_InitStruct;
#if defined (RCC_ADCCLKSOURCE_SYSCLK) || defined (RCC_ADC12CLKSOURCE_SYSCLK)
RCC_PeriphCLKInitTypeDef RCC_PeriphCLKInitStruct;
#endif
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
/*** Configure the GPIOs ***/
/* Enable GPIO clock */
ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE();
/* Configure the selected ADC Channel as analog input */
GPIO_InitStruct.Pin = ADAFRUIT_802_ADCx_GPIO_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
#if defined (RCC_ADCCLKSOURCE_SYSCLK) || defined (RCC_ADC12CLKSOURCE_SYSCLK)
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
#endif
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(ADAFRUIT_802_ADCx_GPIO_PORT, &GPIO_InitStruct);
/*** Configure the ADC peripheral ***/
/* Enable ADC clock */
ADAFRUIT_802_ADCx_CLK_ENABLE();
#if defined (RCC_ADCCLKSOURCE_SYSCLK)
/* Configure SYSCLK as source clock for ADC */
RCC_PeriphCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC;
RCC_PeriphCLKInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_SYSCLK;
HAL_RCCEx_PeriphCLKConfig(&RCC_PeriphCLKInitStruct);
#elif defined (RCC_ADC12CLKSOURCE_SYSCLK)
RCC_PeriphCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC12;
RCC_PeriphCLKInitStruct.Adc12ClockSelection = RCC_ADC12CLKSOURCE_SYSCLK;
HAL_RCCEx_PeriphCLKConfig(&RCC_PeriphCLKInitStruct);
#endif
}
/**
* @brief DeInitializes ADC MSP.
* @param hadc ADC handle
* @note ADC DeInit does not disable the GPIO clock
* @retval None
*/
static void JOY1_MspDeInit(ADC_HandleTypeDef *hadc)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
/*** DeInit the ADC peripheral ***/
/* Disable ADC clock */
ADAFRUIT_802_ADCx_CLK_DISABLE();
/* Configure the selected ADC Channel as analog input */
GPIO_InitStruct.Pin = ADAFRUIT_802_ADCx_GPIO_PIN ;
HAL_GPIO_DeInit(ADAFRUIT_802_ADCx_GPIO_PORT, GPIO_InitStruct.Pin);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,118 @@
/**
******************************************************************************
* @file adafruit_802.h
* @author MCD Application Team
* @brief This file contains definitions for:
* - Joystick available on Adafruit 1.8" TFT LCD shield (reference ID 802)
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_H
#define ADAFRUIT_802_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "adafruit_802_conf.h"
/** @addtogroup BSP
* @{
*/
/** @defgroup ADAFRUIT_802 ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL STM32 ADAFRUIT_802 LOW LEVEL
* @brief This file provides set of firmware functions to manage joystick
* available on Adafruit shield.
* @{
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
* @{
*/
typedef enum
{
JOY1 = 0U,
JOYn
}JOY_TypeDef;
typedef enum
{
JOY_MODE_GPIO = 0U,
JOY_MODE_EXTI = 1U,
}JOYMode_TypeDef;
typedef enum
{
JOY_NONE = 0x00U,
JOY_SEL = 0x01U,
JOY_DOWN = 0x02U,
JOY_LEFT = 0x04U,
JOY_RIGHT = 0x08U,
JOY_UP = 0x10U,
JOY_ALL = 0x1FU
}JOYPin_TypeDef;
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
typedef struct
{
pADC_CallbackTypeDef pMspInitCb;
pADC_CallbackTypeDef pMspDeInitCb;
}ADAFRUIT_802_JOY_Cb_t;
#endif /* (USE_HAL_ADC_REGISTER_CALLBACKS == 1) */
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL_Exported_Functions LOW LEVEL Exported_Functions
* @{
*/
int32_t ADAFRUIT_802_JOY_Init(JOY_TypeDef JOY, JOYMode_TypeDef JoyMode, JOYPin_TypeDef JoyPins);
int32_t ADAFRUIT_802_JOY_DeInit(JOY_TypeDef JOY, JOYPin_TypeDef JoyPins);
int32_t ADAFRUIT_802_JOY_GetState(JOY_TypeDef JOY);
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
int32_t ADAFRUIT_802_JOY_RegisterDefaultMspCallbacks(JOY_TypeDef JOY);
int32_t ADAFRUIT_802_JOY_RegisterMspCallbacks(JOY_TypeDef JOY, ADAFRUIT_802_JOY_Cb_t *Callback);
#endif /* (USE_HAL_ADC_REGISTER_CALLBACKS == 1) */
HAL_StatusTypeDef MX_ADAFRUIT_802_ADC_Init(ADC_HandleTypeDef *hadc);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,80 @@
/**
******************************************************************************
* @file adafruit_802_conf_template.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration file that contains definitions for:
* - ADC information(GPIOs and configuration) used for Joystick
* - SPI information(GPIOs and configuration) used for microSD and LCD available
* on Adafruit 1.8" TFT LCD shield (reference ID 802)
*
*
* There are two ways to use this file:
* 1.
* - Copy stm32_adafruit_conf_template.h to the application and rename it to stm32_adafruit_conf.h
* - Fill stm32_adafruit_conf.h with adequate resources definition that can be directly
* copied from "Adafruit_Config" folder depending on the used nucleo board.
* - Un-comment and update the below lines with correct nucleo files
*
* 2.
* - Copy the required configuration file from "Adafruit_Config" folder to the
* application and rename it to stm32_adafruit_conf.h
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* #include "stm32xxxx_nucleo_conf.h"
#include "stm32xxxx_nucleo_errno.h"
*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,776 @@
/**
******************************************************************************
* @file adafruit_802_lcd.c
* @author MCD Application Team
* @brief This file includes the driver for Liquid Crystal Display (LCD) module
* mounted on the Adafruit 1.8" TFT LCD shield (reference ID 802),
* that is used with the STM32 Nucleo board through SPI interface.
******************************************************************************
@verbatim
How To use this driver:
--------------------------
- This driver is used to drive directly the LCD mounted on on the Adafruit 1.8" TFT LCD
shield (reference ID 802)
The following IP are implied : SPI
Driver description:
---------------------
+ Initialization steps:
o Initialize the LCD with required orientation using the ADAFRUIT_802_LCD_Init() function.
- LCD_ORIENTATION_PORTRAIT
- LCD_ORIENTATION_PORTRAIT_ROT180
- LCD_ORIENTATION_LANDSCAPE
- LCD_ORIENTATION_LANDSCAPE_ROT180
o Enable the LCD display using the ADAFRUIT_802_LCD_DisplayOn() function.
o Disable the LCD display using the ADAFRUIT_802_LCD_DisplayOff() function.
o Write a pixel to the LCD memory using the ADAFRUIT_802_LCD_WritePixel() function.
o Draw an horizontal line using the ADAFRUIT_802_LCD_DrawHLine() function.
o Draw a vertical line using the ADAFRUIT_802_LCD_DrawVLine() function.
o Draw a bitmap image using the ADAFRUIT_802_LCD_DrawBitmap() function.
o Select the LCD layer to be used using the ADAFRUIT_802_LCD_SelectLayer() function.
o Set the display brightness using the ADAFRUIT_802_LCD_SetBrightness() function.
o Get the display brightness using the ADAFRUIT_802_LCD_GetBrightness() function.
o Read a pixel from the LCD memory using the ADAFRUIT_802_LCD_ReadPixel() function.
+ Display on LCD
o To draw and fill a basic shapes (dot, line, rectangle, circle, ellipse, .. bitmap)
on LCD and display text, utility stm32_lcd.c/.h must be called. Once the LCD is initialized,
user should call UTIL_LCD_SetFuncDriver() API to link board LCD drivers to UTIL LCD drivers.
The basic lcd services, defined in lcd utility, are ready for use.
Note:
--------
- Regarding the "Instance" parameter, needed for all functions, it is used to select
an LCD instance. On the "Adafruit 1.8" TFT LCD shield", only one LCD instance is availble. Then, this
parameter should be 0.
- The LCD support only 1 layer. Thus ADAFRUIT_802_LCD_SelectLayer function set always
the Active Layer to 0
- SetBrightness, GetBrightness and ReadPixel features are not supported
@endverbatim
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 "adafruit_802_lcd.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @addtogroup ADAFRUIT_802_LCD
* @{
*/
/** @defgroup ADAFRUIT_802_LCD_Private_Variables LCD Private Variables
* @{
*/
static void *Lcd_CompObj = NULL;
static LCD_Drv_t *Lcd_Drv = NULL;
ADAFRUIT_802_LCD_Ctx_t Lcd_Ctx[LCD_INSTANCES_NBR];
/**
* @}
*/
/** @addtogroup ADAFRUIT_802_LCD_Exported_Variables
* @{
*/
const LCD_UTILS_Drv_t LCD_Driver =
{
ADAFRUIT_802_LCD_DrawBitmap,
ADAFRUIT_802_LCD_FillRGBRect,
ADAFRUIT_802_LCD_DrawHLine,
ADAFRUIT_802_LCD_DrawVLine,
ADAFRUIT_802_LCD_FillRect,
ADAFRUIT_802_LCD_ReadPixel,
ADAFRUIT_802_LCD_WritePixel,
ADAFRUIT_802_LCD_GetXSize,
ADAFRUIT_802_LCD_GetYSize,
NULL,
ADAFRUIT_802_LCD_GetPixelFormat
};
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LCD_Private_FunctionPrototypes LCD Private Function Prototypes
* @{
*/
static int32_t ST7735_Probe(uint32_t Orientation);
static int32_t LCD_IO_Init(void);
static int32_t LCD_IO_DeInit(void);
static int32_t LCD_IO_WriteReg(uint8_t Reg, uint8_t* pData, uint32_t Length);
static int32_t LCD_IO_SendData(uint8_t *pData, uint32_t Length);
/**
* @}
*/
/** @addtogroup ADAFRUIT_802_LCD_Exported_Functions
* @{
*/
/**
* @brief Initializes the LCD with a given orientation.
* @param Instance LCD Instance
* @param orientation Select display orientation:
* - LCD_ORIENTATION_PORTRAIT
* - LCD_ORIENTATION_LANDSCAPE
* - LCD_ORIENTATION_PORTRAIT_ROT180
* - LCD_ORIENTATION_LANDSCAPE_ROT180
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_Init(uint32_t Instance, uint32_t Orientation)
{
int32_t ret;
if((Orientation > LCD_ORIENTATION_LANDSCAPE_ROT180) || (Instance >= LCD_INSTANCES_NBR))
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
if(ST7735_Probe(Orientation) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_UNKNOWN_COMPONENT;
}
else if(ADAFRUIT_802_LCD_GetXSize(Instance, &Lcd_Ctx[Instance].XSize) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
else if(ADAFRUIT_802_LCD_GetYSize(Instance, &Lcd_Ctx[Instance].YSize) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
else
{
/* Clear the LCD screen with white color */
ret = ADAFRUIT_802_LCD_FillRect(Instance, 0U, 0U, Lcd_Ctx[Instance].XSize, Lcd_Ctx[Instance].YSize, 0xFFFFFFFFU);
}
}
return ret;
}
/**
* @brief DeInitializes the LCD.
* @param Instance LCD Instance
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DeInit(uint32_t Instance)
{
int32_t ret;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
ret = LCD_IO_DeInit();
}
return ret;
}
/**
* @brief Gets the LCD Active LCD Pixel Format.
* @param Instance LCD Instance
* @param PixelFormat Active LCD Pixel Format
* @retval BSP status
*/
int32_t ADAFRUIT_802_LCD_GetPixelFormat(uint32_t Instance, uint32_t *PixelFormat)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
/* Only RGB565 format is supported */
*PixelFormat = LCD_PIXEL_FORMAT_RGB565;
}
return ret;
}
/**
* @brief Gets the LCD X size.
* @param Instance LCD Instance
* @param XSize LCD width
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_GetXSize(uint32_t Instance, uint32_t *XSize)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
if(Lcd_Drv->GetXSize(Lcd_CompObj, XSize) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
return ret;
}
/**
* @brief Gets the LCD Y size.
* @param Instance LCD Instance
* @param YSize LCD hieght
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_GetYSize(uint32_t Instance, uint32_t *YSize)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
if(Lcd_Drv->GetYSize(Lcd_CompObj, YSize) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
return ret;
}
/**
* @brief Reads an LCD pixel.
* @param Instance LCD Instance
* @param Xpos X position
* @param Ypos Y position
* @param Color RGB color
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_ReadPixel(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t *Color)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(Instance);
UNUSED(Xpos);
UNUSED(Ypos);
UNUSED(Color);
return BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
/**
* @brief Draws a pixel on LCD.
* @param Instance LCD Instance
* @param Xpos X position
* @param Ypos Y position
* @param Color RGB color
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_WritePixel(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Color)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->SetPixel != NULL)
{
if(Lcd_Drv->SetPixel(Lcd_CompObj, Xpos, Ypos, Color) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Draws an horizontal line.
* @param Instance LCD Instance
* @param Xpos X position
* @param Ypos Y position
* @param Length Line length
* @param Color RGB color
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DrawHLine(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->DrawHLine != NULL)
{
if(Lcd_Drv->DrawHLine(Lcd_CompObj, Xpos, Ypos, Length, Color) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Draws a vertical line.
* @param Instance LCD Instance
* @param Xpos X position
* @param Ypos Y position
* @param Length Line length
* @param Color RGB color
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DrawVLine(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->DrawVLine != NULL)
{
if(Lcd_Drv->DrawVLine(Lcd_CompObj, Xpos, Ypos, Length, Color) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Draws a bitmap picture (16 bpp).
* @param Instance LCD Instance
* @param Xpos Bmp X position in the LCD
* @param Ypos Bmp Y position in the LCD
* @param pBmp Pointer to Bmp picture address.
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DrawBitmap(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint8_t *pBmp)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->DrawBitmap != NULL)
{
if(Lcd_Drv->DrawBitmap(Lcd_CompObj, Xpos, Ypos, pBmp) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Draws a full RGB rectangle
* @param Instance LCD Instance.
* @param Xpos specifies the X position.
* @param Ypos specifies the Y position.
* @param pData pointer to RGB data
* @param Width specifies the rectangle width.
* @param Height Specifies the rectangle height
* @retval BSP status
*/
int32_t ADAFRUIT_802_LCD_FillRGBRect(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height)
{
int32_t ret = BSP_ERROR_NONE;
if (Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->FillRGBRect != NULL)
{
/* Draw the horizontal line on LCD */
if (Lcd_Drv->FillRGBRect(Lcd_CompObj, Xpos, Ypos, pData, Width, Height) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Draws a full rectangle.
* @param Instance LCD instance
* @param Xpos X position
* @param Ypos Y position
* @param Width Rectangle width
* @param Height Rectangle height
* @param Color RGB color
* @retval BSP status
*/
int32_t ADAFRUIT_802_LCD_FillRect(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Width, uint32_t Height, uint32_t Color)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->FillRect != NULL)
{
if(Lcd_Drv->FillRect(Lcd_CompObj, Xpos, Ypos, Width, Height, Color) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Enables the display.
* @param Instance LCD Instance
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DisplayOn(uint32_t Instance)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->DisplayOn != NULL)
{
if(Lcd_Drv->DisplayOn(Lcd_CompObj) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Disables the display.
* @param Instance LCD Instance
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DisplayOff(uint32_t Instance)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->DisplayOff != NULL)
{
if(Lcd_Drv->DisplayOff(Lcd_CompObj) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Set the brightness value
* @param Instance LCD Instance
* @param Brightness [00: Min (black), 100 Max]
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_SetBrightness(uint32_t Instance, uint32_t Brightness)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->SetBrightness != NULL)
{
if(Lcd_Drv->SetBrightness(Lcd_CompObj, Brightness) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Get the brightness value
* @param Instance LCD Instance
* @param Brightness [00: Min (black), 100 Max]
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_GetBrightness(uint32_t Instance, uint32_t *Brightness)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->GetBrightness != NULL)
{
if(Lcd_Drv->GetBrightness(Lcd_CompObj, Brightness) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LCD_Private_Functions LCD Private Functions
* @{
*/
/**
* @brief Register Bus IOs if component ID is OK
* @param Orientation Display orientation
* @retval Error status
*/
static int32_t ST7735_Probe(uint32_t Orientation)
{
int32_t ret = BSP_ERROR_NONE;
ST7735_IO_t IOCtx;
static ST7735_Object_t ST7735Obj;
/* Configure the audio driver */
IOCtx.Address = 0;
IOCtx.Init = LCD_IO_Init;
IOCtx.DeInit = LCD_IO_DeInit;
IOCtx.GetTick = BSP_GetTick;
IOCtx.WriteReg = LCD_IO_WriteReg;
IOCtx.SendData = LCD_IO_SendData;
if(ST7735_RegisterBusIO(&ST7735Obj, &IOCtx) != ST7735_OK)
{
ret = BSP_ERROR_BUS_FAILURE;
}
else
{
Lcd_CompObj = &ST7735Obj;
Lcd_Drv = (LCD_Drv_t *) &ST7735_LCD_Driver;
if(Lcd_Drv->Init(Lcd_CompObj, ST7735_FORMAT_DEFAULT, Orientation) != ST7735_OK)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
return ret;
}
/**
* @brief Initializes the LCD
* @retval None
*/
static int32_t LCD_IO_Init(void)
{
int32_t ret = BSP_ERROR_NONE;
GPIO_InitTypeDef GPIO_InitStruct;
/* LCD_CS_GPIO and LCD_DC_GPIO Periph clock enable */
ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE();
ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE();
/* Configure LCD_CS_PIN pin: LCD Card CS pin */
GPIO_InitStruct.Pin = ADAFRUIT_802_LCD_CS_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(ADAFRUIT_802_LCD_CS_GPIO_PORT, &GPIO_InitStruct);
/* Configure LCD_DC_PIN pin: LCD Card DC pin */
GPIO_InitStruct.Pin = ADAFRUIT_802_LCD_DC_PIN;
HAL_GPIO_Init(ADAFRUIT_802_LCD_DC_GPIO_PORT, &GPIO_InitStruct);
/* LCD chip select high */
ADAFRUIT_802_LCD_CS_HIGH();
/* LCD SPI Config */
if(BUS_SPIx_Init() != BSP_ERROR_NONE)
{
ret = BSP_ERROR_NO_INIT;
}
return ret;
}
/**
* @brief De-Initializes the LCD
* @retval None
*/
static int32_t LCD_IO_DeInit(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* LCD chip de-select high */
ADAFRUIT_802_LCD_CS_LOW();
/* Configure LCD_CS_PIN pin: LCD Card CS pin */
GPIO_InitStruct.Pin = ADAFRUIT_802_LCD_CS_PIN;
HAL_GPIO_DeInit(ADAFRUIT_802_LCD_CS_GPIO_PORT, GPIO_InitStruct.Pin);
/* Configure LCD_DC_PIN pin: LCD Card DC pin */
GPIO_InitStruct.Pin = ADAFRUIT_802_LCD_DC_PIN;
HAL_GPIO_DeInit(ADAFRUIT_802_LCD_DC_GPIO_PORT, GPIO_InitStruct.Pin);
/* LCD_CS_GPIO and LCD_DC_GPIO Periph clock disable */
ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE();
ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE();
return BSP_ERROR_NONE;
}
/**
* @brief Writes command to select the LCD register.
* @param Reg Address of the selected register.
* @param pData pointer to data to write to the register
* @param Length length of data to write to the register
* @retval Error status
*/
static int32_t LCD_IO_WriteReg(uint8_t Reg, uint8_t* pData, uint32_t Length)
{
int32_t ret;
/* Reset LCD control line CS */
ADAFRUIT_802_LCD_CS_LOW();
/* Set LCD data/command line DC to Low */
ADAFRUIT_802_LCD_DC_LOW();
/* Send Command */
if(BUS_SPIx_Send(&Reg, 1) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else
{
/* Deselect : Chip Select high */
ADAFRUIT_802_LCD_CS_HIGH();
/* Send Data */
ret = LCD_IO_SendData(pData, Length);
}
return ret;
}
/**
* @brief Send data to select the LCD GRAM.
* @param pData pointer to data to write to LCD GRAM.
* @param Length length of data to write to LCD GRAM
* @retval Error status
*/
static int32_t LCD_IO_SendData(uint8_t *pData, uint32_t Length)
{
int32_t ret = BSP_ERROR_NONE;
if(Length != 0U)
{
/* Reset LCD control line CS */
ADAFRUIT_802_LCD_CS_LOW();
/* Set LCD data/command line DC to High */
ADAFRUIT_802_LCD_DC_HIGH();
if(BUS_SPIx_Send(pData, Length) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
/* Deselect : Chip Select high */
ADAFRUIT_802_LCD_CS_HIGH();
}
return ret;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,138 @@
/**
******************************************************************************
* @file adafruit_802_lcd.h
* @author MCD Application Team
* @brief This file contains the common defines and functions prototypes for
* the adafruit_802_lcd.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_LCD_H
#define ADAFRUIT_802_LCD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "adafruit_802.h"
#include "adafruit_802_conf.h"
#include "lcd.h"
#include "../Components/st7735/st7735.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_LCD LCD
* @{
*/
/** @defgroup ADAFRUIT_802_LCD_Exported_Variables LCD Exported Variables
* @{
*/
extern const LCD_UTILS_Drv_t LCD_Driver;
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LCD_Exported_Constants LCD Exported Constants
* @{
*/
#define LCD_INSTANCES_NBR 1U
#define LCD_ORIENTATION_PORTRAIT 0x00U /* Portrait orientation choice of LCD screen */
#define LCD_ORIENTATION_PORTRAIT_ROT180 0x01U /* Portrait rotated 180° orientation choice of LCD screen */
#define LCD_ORIENTATION_LANDSCAPE 0x02U /* Landscape orientation choice of LCD screen */
#define LCD_ORIENTATION_LANDSCAPE_ROT180 0x03U /* Landscape rotated 180° orientation choice of LCD screen */
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LCD_Exported_Types LCD Exported Types
* @{
*/
typedef struct
{
uint32_t XSize;
uint32_t YSize;
uint32_t PixelFormat;
uint32_t IsMspCallbacksValid;
} ADAFRUIT_802_LCD_Ctx_t;
/**
* @}
*/
/** @addtogroup ADAFRUIT_802_LCD_Exported_Variables
* @{
*/
extern ADAFRUIT_802_LCD_Ctx_t Lcd_Ctx[LCD_INSTANCES_NBR];
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LCD_Exported_Functions LCD Exported Functions
* @{
*/
int32_t ADAFRUIT_802_LCD_Init(uint32_t Instance, uint32_t Orientation);
int32_t ADAFRUIT_802_LCD_DeInit(uint32_t Instance);
/* LCD generic APIs: Display control */
int32_t ADAFRUIT_802_LCD_DisplayOn(uint32_t Instance);
int32_t ADAFRUIT_802_LCD_DisplayOff(uint32_t Instance);
int32_t ADAFRUIT_802_LCD_SetBrightness(uint32_t Instance, uint32_t Brightness);
int32_t ADAFRUIT_802_LCD_GetBrightness(uint32_t Instance, uint32_t *Brightness);
int32_t ADAFRUIT_802_LCD_GetXSize(uint32_t Instance, uint32_t *XSize);
int32_t ADAFRUIT_802_LCD_GetYSize(uint32_t Instance, uint32_t *YSize);
/* LCD generic APIs: Draw operations. This list of APIs is required for
lcd gfx utilities */
int32_t ADAFRUIT_802_LCD_GetPixelFormat(uint32_t Instance, uint32_t *PixelFormat);
int32_t ADAFRUIT_802_LCD_DrawBitmap(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint8_t *pBmp);
int32_t ADAFRUIT_802_LCD_FillRGBRect(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height);
int32_t ADAFRUIT_802_LCD_DrawHLine(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t ADAFRUIT_802_LCD_DrawVLine(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t ADAFRUIT_802_LCD_FillRect(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Width, uint32_t Height, uint32_t Color);
int32_t ADAFRUIT_802_LCD_ReadPixel(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t *Color);
int32_t ADAFRUIT_802_LCD_WritePixel(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Color);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_LCD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,223 @@
/**
******************************************************************************
* @file adafruit_802_sd.h
* @author MCD Application Team
* @brief This file contains the common defines and functions prototypes for
* the adafruit_802_sd.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_SD_H
#define ADAFRUIT_802_SD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "adafruit_802_conf.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_SD SD
* @{
*/
/** @defgroup ADAFRUIT_802_SD_Exported_Types SD Exported Types
* @{
*/
typedef struct
{
uint32_t Reserved1:2U; /* Reserved */
uint32_t DeviceSize:12U; /* Device Size */
uint32_t MaxRdCurrentVDDMin:3U; /* Max. read current @ VDD min */
uint32_t MaxRdCurrentVDDMax:3U; /* Max. read current @ VDD max */
uint32_t MaxWrCurrentVDDMin:3U; /* Max. write current @ VDD min */
uint32_t MaxWrCurrentVDDMax:3U; /* Max. write current @ VDD max */
uint32_t DeviceSizeMul:3U; /* Device size multiplier */
} SD_Version_1_t;
typedef struct
{
uint32_t Reserved1:6U; /* Reserved */
uint32_t DeviceSize:22U; /* Device Size */
uint32_t Reserved2:1U; /* Reserved */
} SD_Version_2_t;
/**
* @brief Card Specific Data: CSD Register
*/
typedef struct
{
/* Header part */
uint32_t CSDStruct:2U; /* CSD structure */
uint32_t Reserved1:6U; /* Reserved */
uint32_t TAAC:8U; /* Data read access-time 1 */
uint32_t NSAC:8U; /* Data read access-time 2 in CLK cycles */
uint32_t MaxBusClkFrec:8U; /* Max. bus clock frequency */
uint32_t CardComdClasses:12U; /* Card command classes */
uint32_t RdBlockLen:4U; /* Max. read data block length */
uint32_t PartBlockRead:1U; /* Partial blocks for read allowed */
uint32_t WrBlockMisalign:1U; /* Write block misalignment */
uint32_t RdBlockMisalign:1U; /* Read block misalignment */
uint32_t DSRImpl:1U; /* DSR implemented */
/* v1 or v2 struct */
union csd_version
{
SD_Version_1_t v1;
SD_Version_2_t v2;
} version;
uint32_t EraseSingleBlockEnable:1U; /* Erase single block enable */
uint32_t EraseSectorSize:7U; /* Erase group size multiplier */
uint32_t WrProtectGrSize:7U; /* Write protect group size */
uint32_t WrProtectGrEnable:1U; /* Write protect group enable */
uint32_t Reserved2:2U; /* Reserved */
uint32_t WrSpeedFact:3U; /* Write speed factor */
uint32_t MaxWrBlockLen:4U; /* Max. write data block length */
uint32_t WriteBlockPartial:1U; /* Partial blocks for write allowed */
uint32_t Reserved3:5U; /* Reserved */
uint32_t FileFormatGrouop:1U; /* File format group */
uint32_t CopyFlag:1U; /* Copy flag (OTP) */
uint32_t PermWrProtect:1U; /* Permanent write protection */
uint32_t TempWrProtect:1U; /* Temporary write protection */
uint32_t FileFormat:2U; /* File Format */
uint32_t Reserved4:2U; /* Reserved */
uint32_t crc:7U; /* Reserved */
uint32_t Reserved5:1U; /* always 1*/
} SD_CardSpecificData_t;
/**
* @brief Card Identification Data: CID Register
*/
typedef struct
{
uint32_t ManufacturerID; /* ManufacturerID */
uint32_t OEM_AppliID; /* OEM/Application ID */
uint32_t ProdName1; /* Product Name part1 */
uint32_t ProdName2; /* Product Name part2*/
uint32_t ProdRev; /* Product Revision */
uint32_t ProdSN; /* Product Serial Number */
uint32_t Reserved1; /* Reserved1 */
uint32_t ManufactDate; /* Manufacturing Date */
uint32_t CID_CRC; /* CID CRC */
uint32_t Reserved2; /* always 1 */
} SD_CardIdData_t;
/**
* @brief SD Card information
*/
typedef struct
{
SD_CardSpecificData_t Csd;
SD_CardIdData_t Cid;
uint32_t CardCapacity; /*!< Card Capacity */
uint32_t CardBlockSize; /*!< Card Block Size */
uint32_t LogBlockNbr; /*!< Specifies the Card logical Capacity in blocks */
uint32_t LogBlockSize; /*!< Specifies logical block size in bytes */
} SD_CardInfo_t;
/**
* @}
*/
/** @defgroup ADAFRUIT_802_SPI_SD_Exported_Constants SD Exported Constants
* @{
*/
/**
* @brief Block Size
*/
#define ADAFRUIT_SD_BLOCK_SIZE 512U
/**
* @brief SD instance number
*/
#define SD_INSTANCES_NBR 1UL
/**
* @brief SD transfer state definition
*/
#define SD_TRANSFER_OK 0U
#define SD_TRANSFER_BUSY 1U
/**
* @brief SD detection on its memory slot
*/
#define SD_PRESENT 1UL
#define SD_NOT_PRESENT 0UL
/**
* @brief SD capacity type
*/
#define ADAFRUIT_802_CARD_SDSC 0UL /* SD Standard Capacity */
#define ADAFRUIT_802_CARD_SDHC 1UL /* SD High Capacity */
/**
* @brief SD Card information structure
*/
#define ADAFRUIT_802_SD_CardInfo_t SD_CardInfo_t
/**
* @}
*/
/** @defgroup ADAFRUIT_802_SD_Exported_Functions SD Exported Functions
* @{
*/
int32_t ADAFRUIT_802_SD_Init(uint32_t Instance);
int32_t ADAFRUIT_802_SD_DeInit(uint32_t Instance);
int32_t ADAFRUIT_802_SD_DetectITConfig(uint32_t Instance);
int32_t ADAFRUIT_802_SD_ReadBlocks(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_WriteBlocks(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_ReadBlocks_DMA(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_WriteBlocks_DMA(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_ReadBlocks_IT(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_WriteBlocks_IT(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_Erase(uint32_t Instance, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_GetCardState(uint32_t Instance);
int32_t ADAFRUIT_802_SD_GetCardInfo(uint32_t Instance, ADAFRUIT_802_SD_CardInfo_t *CardInfo);
int32_t ADAFRUIT_802_SD_IsDetected(uint32_t Instance);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_SD_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,211 @@
<!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 BSP Common Components 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-bsp-common-components-drivers"><small>Release Notes for</small> <mark>BSP Common Components Drivers</mark></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>
<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 BSP Common components 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-section16" checked aria-hidden="true"> <label for="collapse-section16" aria-hidden="true">V7.0.0 / 25-February-2020</label>
<div>
<h2 id="main-changes">Main Changes</h2>
<h3 id="component-release">Component release</h3>
<ul>
<li>Rename GUI_Drv_t structure into UTILS_LCD_Drv_t</li>
</ul>
<h2 id="backward-compatibility">Backward Compatibility</h2>
<ul>
<li>This release breaks compatibility with previous versions.</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section15" aria-hidden="true"> <label for="collapse-section15" aria-hidden="true">V6.0.1 / 15-October-2019</label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<h3 id="component-release-1">Component release</h3>
<ul>
<li>Update st_logo.png inclusion path in Release notes.</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section14" aria-hidden="true"> <label for="collapse-section14" aria-hidden="true">V6.0.0 / 12-April-2019</label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<h3 id="component-release-2">Component release</h3>
<p>Official release of BSP Common components drivers in line with STM32Cube BSP drivers development guidelines (UM2298).</p>
<h2 id="backward-compatibility-1">Backward Compatibility</h2>
<p>This release breaks compatibility with previous versions.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section13" aria-hidden="true"> <label for="collapse-section13" aria-hidden="true">V5.1.1 / 31-August-2018</label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<p>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)<br />
Correct sensor names in headers files hsensor.h and psensor.h</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section12" aria-hidden="true"> <label for="collapse-section12" aria-hidden="true">V5.1.0 / 21-November-2017</label>
<div>
<h2 id="main-changes-4">Main Changes</h2>
<p>Add dpredriver.h: support of DP redriver class<br />
Add pwrmon.h: support of power monitor class<br />
Add usbtypecswitch.h: support of USB type C switch class</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section11" aria-hidden="true"> <label for="collapse-section11" aria-hidden="true">V5.0.0 / 01-March-2017</label>
<div>
<h2 id="main-changes-5">Main Changes</h2>
<p>Add hsensor.h: support of humidity class<br />
Add psensor.h: support of pressure class<br />
Update tsensor.h: Temperature can be negative<br />
Update accelero.h: LowPower API can enable or disable the low power mode<br />
Update magneto.h: LowPower API can enable or disable the low power mode</p>
<h2 id="backward-compatibility-2">Backward Compatibility</h2>
<p>This release breaks compatibility with previous versions.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section10" aria-hidden="true"> <label for="collapse-section10" aria-hidden="true">V4.0.1 / 21-July-2015</label>
<div>
<h2 id="main-changes-6">Main Changes</h2>
<p>tsensor.h: Fix compilation issue on <em>TSENSOR_InitTypeDef</em></p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section9" aria-hidden="true"> <label for="collapse-section9" aria-hidden="true">V4.0.0 / 22-June-2015</label>
<div>
<h2 id="main-changes-7">Main Changes</h2>
<p>accelero.h: add <em>DeInit</em> field in <em>ACCELERO_DrvTypeDef</em> structure<br />
audio.h: add <em>DeInit</em> field in <em>AUDIO_DrvTypeDef</em> structure<br />
idd.h:</p>
<ul>
<li>add <em>Shunt0StabDelay</em>, <em>Shunt1StabDelay</em>, <em>Shunt2StabDelay</em>, <em>Shunt3StabDelay</em>, <em>Shunt4StabDelay</em> and <em>ShuntNbOnBoard</em> fields in <em>IDD_ConfigTypeDef</em> structure<br />
</li>
<li>rename <em>ShuntNumber</em> field to <em>ShuntNbUsed</em> in <em>IDD_ConfigTypeDef</em> structure</li>
</ul>
<p>magneto.h: add <em>DeInit</em> field in <em>MAGNETO_DrvTypeDef</em> structure</p>
<h2 id="backward-compatibility-3">Backward Compatibility</h2>
<p>This release breaks compatibility with previous versions.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section8" aria-hidden="true"> <label for="collapse-section8" aria-hidden="true">V3.0.0 / 28-April-2015</label>
<div>
<h2 id="main-changes-8">Main Changes</h2>
<p>accelero.h: add <em>LowPower</em> field in <em>ACCELERO_DrvTypeDef</em> structure<br />
magneto.h: add <em>LowPower</em> field in <em>MAGNETO_DrvTypeDef</em> structure<br />
gyro.h: add <em>DeInit</em> and <em>LowPower</em> fields in <em>GYRO_DrvTypeDef</em> structure<br />
camera.h: add CAMERA_COLOR_EFFECT_NONE define<br />
idd.h:</p>
<ul>
<li>add <em>MeasureNb</em>, <em>DeltaDelayUnit</em> and <em>DeltaDelayValue</em> fields in <em>IDD_ConfigTypeDef</em> structure<br />
</li>
<li>rename <em>PreDelay</em> field to <em>PreDelayUnit</em> in <em>IDD_ConfigTypeDef</em> structure</li>
</ul>
<h2 id="backward-compatibility-4">Backward Compatibility</h2>
<p>This release breaks compatibility with previous versions.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section7" aria-hidden="true"> <label for="collapse-section7" aria-hidden="true">V2.2.0 / 09-February-2015</label>
<div>
<h2 id="main-changes-9">Main Changes</h2>
<p>Magnetometer driver function prototypes added (magneto.h file)<br />
Update “idd.h” file to provide DeInit() and WakeUp() services in IDD current measurement driver</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section6" aria-hidden="true"> <label for="collapse-section6" aria-hidden="true">V2.1.0 / 06-February-2015</label>
<div>
<h2 id="main-changes-10">Main Changes</h2>
<p>IDD current measurement driver function prototypes added (idd.h file)<br />
io.h: add new typedef enum IO_PinState with IO_PIN_RESET and IO_PIN_SET values</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section5" aria-hidden="true"> <label for="collapse-section5" aria-hidden="true">V2.0.0 / 15-December-2014</label>
<div>
<h2 id="main-changes-11">Main Changes</h2>
<p>Update “io.h” file to support MFX (Multi Function eXpander) device available on some STM32 boards</p>
<ul>
<li>add new entries for <em>IO_ModeTypedef</em> enumeration structure</li>
<li>update the <em>IO_DrvTypeDef</em> structure</li>
<li>Update all return values and function parameters to uint32_t</li>
<li>Add a return value for <em>Config</em> field</li>
</ul>
<h2 id="backward-compatibility-5">Backward Compatibility</h2>
<p>This release breaks compatibility with previous versions.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section4" aria-hidden="true"> <label for="collapse-section4" aria-hidden="true">V1.2.1 / 02-December-2014</label>
<div>
<h2 id="main-changes-12">Main Changes</h2>
<p>gyro.h: change “__GIRO_H” by “__GYRO_H” to fix compilation issue under Mac OS</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" aria-hidden="true"> <label for="collapse-section3" aria-hidden="true">V1.2.0 / 18-June-2014</label>
<div>
<h2 id="main-changes-13">Main Changes</h2>
<p>EPD (E Paper Display) driver function prototype added (epd.h file)</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true">V1.1.0 / 21-March-2014</label>
<div>
<h2 id="main-changes-14">Main Changes</h2>
<p>Temperature Sensor driver function prototype added</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true">V1.0.0 / 18-February-2014</label>
<div>
<h2 id="main-changes-15">Main Changes</h2>
<p>First official release with Accelerometer, Audio, Camera, Gyroscope, IO, LCD and Touch Screen drivers function prototypes</p>
</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,285 @@
---
pagetitle: Release Notes for BSP Common Components Drivers
lang: en
---
::: {.row}
::: {.col-sm-12 .col-lg-4}
::: {.card .fluid}
::: {.sectione .dark}
<center>
# <small>Release Notes for</small> <mark>BSP Common Components Drivers</mark>
Copyright &copy; 2014 STMicroelectronics\
[![ST logo](_htmresc/st_logo.png)](https://www.st.com){.logo}
</center>
:::
:::
# License
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:
[https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)
# Purpose
This directory contains the BSP Common components drivers.
:::
::: {.col-sm-12 .col-lg-8}
# Update History
::: {.collapse}
<input type="checkbox" id="collapse-section16" checked aria-hidden="true">
<label for="collapse-section16" aria-hidden="true">V7.0.0 / 25-February-2020</label>
<div>
## Main Changes
### Component release
- Rename GUI_Drv_t structure into UTILS_LCD_Drv_t
## Backward Compatibility
- This release breaks compatibility with previous versions.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section15" aria-hidden="true">
<label for="collapse-section15" aria-hidden="true">V6.0.1 / 15-October-2019</label>
<div>
## Main Changes
### Component release
- Update st_logo.png inclusion path in Release notes.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section14" aria-hidden="true">
<label for="collapse-section14" aria-hidden="true">V6.0.0 / 12-April-2019</label>
<div>
## Main Changes
### Component release
Official release of BSP Common components drivers in line with STM32Cube BSP drivers development guidelines (UM2298).
## Backward Compatibility
This release breaks compatibility with previous versions.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section13" aria-hidden="true">
<label for="collapse-section13" aria-hidden="true">V5.1.1 / 31-August-2018</label>
<div>
## Main Changes
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)
Correct sensor names in headers files hsensor.h and psensor.h
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section12" aria-hidden="true">
<label for="collapse-section12" aria-hidden="true">V5.1.0 / 21-November-2017</label>
<div>
## Main Changes
Add dpredriver.h: support of DP redriver class
Add pwrmon.h: support of power monitor class
Add usbtypecswitch.h: support of USB type C switch class
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section11" aria-hidden="true">
<label for="collapse-section11" aria-hidden="true">V5.0.0 / 01-March-2017</label>
<div>
## Main Changes
Add hsensor.h: support of humidity class
Add psensor.h: support of pressure class
Update tsensor.h: Temperature can be negative
Update accelero.h: LowPower API can enable or disable the low power mode
Update magneto.h: LowPower API can enable or disable the low power mode
## Backward Compatibility
This release breaks compatibility with previous versions.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section10" aria-hidden="true">
<label for="collapse-section10" aria-hidden="true">V4.0.1 / 21-July-2015</label>
<div>
## Main Changes
tsensor.h: Fix compilation issue on *TSENSOR_InitTypeDef*
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section9" aria-hidden="true">
<label for="collapse-section9" aria-hidden="true">V4.0.0 / 22-June-2015</label>
<div>
## Main Changes
accelero.h: add *DeInit* field in *ACCELERO_DrvTypeDef* structure
audio.h: add *DeInit* field in *AUDIO_DrvTypeDef* structure
idd.h:
- add *Shunt0StabDelay*, *Shunt1StabDelay*, *Shunt2StabDelay*, *Shunt3StabDelay*, *Shunt4StabDelay* and *ShuntNbOnBoard* fields in *IDD_ConfigTypeDef* structure
- rename *ShuntNumber* field to *ShuntNbUsed* in *IDD_ConfigTypeDef* structure
magneto.h: add *DeInit* field in *MAGNETO_DrvTypeDef* structure
## Backward Compatibility
This release breaks compatibility with previous versions.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section8" aria-hidden="true">
<label for="collapse-section8" aria-hidden="true">V3.0.0 / 28-April-2015</label>
<div>
## Main Changes
accelero.h: add *LowPower* field in *ACCELERO_DrvTypeDef* structure
magneto.h: add *LowPower* field in *MAGNETO_DrvTypeDef* structure
gyro.h: add *DeInit* and *LowPower* fields in *GYRO_DrvTypeDef* structure
camera.h: add CAMERA_COLOR_EFFECT_NONE define
idd.h:
- add *MeasureNb*, *DeltaDelayUnit* and *DeltaDelayValue* fields in *IDD_ConfigTypeDef* structure
- rename *PreDelay* field to *PreDelayUnit* in *IDD_ConfigTypeDef* structure
## Backward Compatibility
This release breaks compatibility with previous versions.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section7" aria-hidden="true">
<label for="collapse-section7" aria-hidden="true">V2.2.0 / 09-February-2015</label>
<div>
## Main Changes
Magnetometer driver function prototypes added (magneto.h file)
Update "idd.h" file to provide DeInit() and WakeUp() services in IDD current measurement driver
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section6" aria-hidden="true">
<label for="collapse-section6" aria-hidden="true">V2.1.0 / 06-February-2015</label>
<div>
## Main Changes
IDD current measurement driver function prototypes added (idd.h file)
io.h: add new typedef enum IO_PinState with IO_PIN_RESET and IO_PIN_SET values
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section5" aria-hidden="true">
<label for="collapse-section5" aria-hidden="true">V2.0.0 / 15-December-2014</label>
<div>
## Main Changes
Update "io.h" file to support MFX (Multi Function eXpander) device available on some STM32 boards
- add new entries for *IO_ModeTypedef* enumeration structure
- update the *IO_DrvTypeDef* structure
- Update all return values and function parameters to uint32_t
- Add a return value for *Config* field
## Backward Compatibility
This release breaks compatibility with previous versions.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section4" aria-hidden="true">
<label for="collapse-section4" aria-hidden="true">V1.2.1 / 02-December-2014</label>
<div>
## Main Changes
gyro.h: change “__GIRO_H” by “__GYRO_H” to fix compilation issue under Mac OS
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section3" aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">V1.2.0 / 18-June-2014</label>
<div>
## Main Changes
EPD (E Paper Display) driver function prototype added (epd.h file)
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section2" aria-hidden="true">
<label for="collapse-section2" aria-hidden="true">V1.1.0 / 21-March-2014</label>
<div>
## Main Changes
Temperature Sensor driver function prototype added
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section1" aria-hidden="true">
<label for="collapse-section1" aria-hidden="true">V1.0.0 / 18-February-2014</label>
<div>
## Main Changes
First official release with Accelerometer, Audio, Camera, Gyroscope, IO, LCD and Touch Screen drivers function prototypes
</div>
:::
:::
:::
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> ,
visit: [http://www.st.com/STM32](http://www.st.com/STM32)
</footer>

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

View file

@ -0,0 +1,108 @@
/**
******************************************************************************
* @file audio.h
* @author MCD Application Team
* @brief This header file contains the common defines and functions prototypes
* for the Audio driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 AUDIO_H
#define AUDIO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup AUDIO
* @{
*/
/** @defgroup AUDIO_Exported_Constants
* @{
*/
/**
* @}
*/
/** @defgroup AUDIO_Exported_Types
* @{
*/
/** @defgroup AUDIO_Driver_structure Audio Driver structure
* @{
*/
typedef struct
{
int32_t (*Init )(void*, void*);
int32_t (*DeInit )(void*);
int32_t (*ReadID )(void*, uint32_t*);
int32_t (*Play )(void*);
int32_t (*Pause )(void*);
int32_t (*Resume )(void*);
int32_t (*Stop )(void*, uint32_t);
int32_t (*SetFrequency )(void*, uint32_t);
int32_t (*GetFrequency )(void*);
int32_t (*SetVolume )(void*, uint32_t, uint8_t);
int32_t (*GetVolume )(void*, uint32_t, uint8_t*);
int32_t (*SetMute )(void*, uint32_t);
int32_t (*SetOutputMode )(void*, uint32_t);
int32_t (*SetResolution )(void*, uint32_t);
int32_t (*GetResolution )(void*, uint32_t*);
int32_t (*SetProtocol )(void*, uint32_t);
int32_t (*GetProtocol )(void*, uint32_t*);
int32_t (*Reset )(void*);
}AUDIO_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* AUDIO_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,106 @@
/**
******************************************************************************
* @file camera.h
* @author MCD Application Team
* @brief This header file contains the common defines and functions prototypes
* for the camera driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 CAMERA_H
#define CAMERA_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup CAMERA
* @{
*/
/** @defgroup CAMERA_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup CAMERA_Driver_structure Camera Driver structure
* @{
*/
typedef struct
{
int32_t (*Init )(void*, uint32_t, uint32_t);
int32_t (*DeInit )(void*);
int32_t (*ReadID )(void*, uint32_t*);
int32_t (*GetCapabilities )(void*, void*);
int32_t (*SetLightMode )(void*, uint32_t);
int32_t (*SetColorEffect )(void*, uint32_t);
int32_t (*SetBrightness )(void*, int32_t);
int32_t (*SetSaturation )(void*, int32_t);
int32_t (*SetContrast )(void*, int32_t);
int32_t (*SetHueDegree )(void*, int32_t);
int32_t (*MirrorFlipConfig )(void*, uint32_t);
int32_t (*ZoomConfig )(void*, uint32_t);
int32_t (*SetResolution )(void*, uint32_t);
int32_t (*GetResolution )(void*, uint32_t*);
int32_t (*SetPixelFormat )(void*, uint32_t);
int32_t (*GetPixelFormat )(void*, uint32_t*);
int32_t (*NightModeConfig )(void*, uint32_t);
}CAMERA_Drv_t;
/**
* @}
*/
/** @defgroup CAMERA_Exported_Constants
* @{
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* CAMERA_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,104 @@
/**
******************************************************************************
* @file dpredriver.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* DisplayPort Linear Redriver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 __DPREDRIVER_H
#define __DPREDRIVER_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup DPREDRIVER
* @{
*/
/** @defgroup DPREDRIVER_Exported_Types
* @{
*/
/** @defgroup DPREDRIVER_Channel_Identifier Channel Identifier
* @{
*/
typedef enum {
CHANNEL_DP0 = 0,
CHANNEL_DP1,
CHANNEL_DP2,
CHANNEL_DP3,
CHANNEL_RX1,
CHANNEL_RX2,
CHANNEL_SSTX
} DPREDRIVER_ChannelId_t;
/**
* @}
*/
/** @defgroup DPREDRIVER_Driver_structure DisplayPort Linear Redriver Driver structure
* @{
*/
typedef struct
{
uint32_t (*Init)(uint16_t);
void (*DeInit)(uint16_t);
uint32_t (*PowerOn)(uint16_t);
uint32_t (*PowerOff)(uint16_t);
uint32_t (*SetEQGain)(uint16_t, DPREDRIVER_ChannelId_t, uint8_t);
uint32_t (*EnableChannel)(uint16_t, DPREDRIVER_ChannelId_t);
uint32_t (*DisableChannel)(uint16_t, DPREDRIVER_ChannelId_t);
}DPREDRIVER_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __DPREDRIVER_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,100 @@
/**
******************************************************************************
* @file env_sensor.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* temperature driver
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 ENV_SENSORS_H
#define ENV_SENSORS_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP BSP
* @{
*/
/** @addtogroup COMPONENTS COMPONENTS
* @{
*/
/** @addtogroup COMMON COMMON
* @{
*/
/** @addtogroup ENV_SENSORS ENV_SENSORS
* @{
*/
/** @addtogroup ENV_SENSORS_Public_Types ENV_SENSORS Public types
* @{
*/
/**
* @brief ENV_SENSORS driver structure definition
*/
typedef struct
{
int32_t ( *Init ) ( void * );
int32_t ( *DeInit ) ( void * );
int32_t ( *ReadID ) ( void *, uint8_t * );
int32_t ( *GetCapabilities ) ( void *, void * );
} ENV_SENSOR_CommonDrv_t;
typedef struct
{
int32_t ( *Enable ) ( void * );
int32_t ( *Disable ) ( void * );
int32_t ( *GetOutputDataRate ) ( void *, float * );
int32_t ( *SetOutputDataRate ) ( void *, float );
int32_t ( *GetValue ) ( void *, float * );
} ENV_SENSOR_FuncDrv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ENV_SENSORS_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,97 @@
/**
******************************************************************************
* @file epd.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the
* EPD (E Paper Display) driver.
******************************************************************************
* @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
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __EPD_H
#define __EPD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup Common
* @{
*/
/** @addtogroup EPD
* @{
*/
/** @defgroup EPD_Exported_Types
* @{
*/
/** @defgroup EPD_Driver_structure E Paper Display Driver structure
* @{
*/
typedef struct
{
void (*Init)(void);
void (*WritePixel)(uint8_t);
/* Optimized operation */
void (*SetDisplayWindow)(uint16_t, uint16_t, uint16_t, uint16_t);
void (*RefreshDisplay)(void);
void (*CloseChargePump)(void);
uint16_t (*GetEpdPixelWidth)(void);
uint16_t (*GetEpdPixelHeight)(void);
void (*DrawImage)(uint16_t, uint16_t, uint16_t, uint16_t, uint8_t*);
}
EPD_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* EPD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,98 @@
/**
******************************************************************************
* @file idd.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the IDD driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 IDD_H
#define IDD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup IDD
* @{
*/
/** @defgroup IDD_Exported_Types IDD Exported Types
* @{
*/
/** @defgroup IDD_Driver_structure IDD Driver structure
* @{
*/
typedef struct
{
int32_t (*Init )(void*);
int32_t (*DeInit )(void*);
int32_t (*ReadID )(void*, uint32_t*);
int32_t (*Reset )(void*);
int32_t (*LowPower )(void*);
int32_t (*WakeUp )(void*);
int32_t (*Start )(void*);
int32_t (*Config )(void*, void*);
int32_t (*GetValue )(void*, uint32_t*);
int32_t (*EnableIT )(void*);
int32_t (*DisableIT )(void*);
int32_t (*ITStatus )(void*);
int32_t (*ClearIT )(void*);
int32_t (*ErrorEnableIT )(void*);
int32_t (*ErrorClearIT )(void*);
int32_t (*ErrorGetITStatus)(void*);
int32_t (*ErrorDisableIT )(void*);
int32_t (*ErrorGetSrc )(void*);
int32_t (*ErrorGetCode )(void*);
}IDD_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* IDD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,90 @@
/**
******************************************************************************
* @file io.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the IO driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 IO_H
#define IO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup IO
* @{
*/
/** @defgroup IO_Exported_Types IO Exported Types
* @{
*/
/** @defgroup IO_Driver_structure IO Driver structure
* @{
*/
typedef struct
{
int32_t (*Init )(void*, void*);
int32_t (*DeInit )(void*);
int32_t (*ReadID )(void*, uint32_t*);
int32_t (*Reset )(void*);
int32_t (*Start )(void*, uint32_t);
int32_t (*WritePin )(void*, uint32_t, uint8_t);
int32_t (*ReadPin )(void*, uint32_t);
int32_t (*EnableIT )(void*);
int32_t (*DisableIT )(void*);
int32_t (*ITStatus )(void*, uint32_t);
int32_t (*ClearIT )(void*, uint32_t);
}IO_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* IO_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,133 @@
/**
******************************************************************************
* @file lcd.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the LCD driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 LCD_H
#define LCD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup LCD
* @{
*/
/** @defgroup LCD_Exported_Constants LCD Exported Constants
* @{
*/
#define LCD_PIXEL_FORMAT_ARGB8888 0x00000000U /*!< ARGB8888 LTDC pixel format */
#define LCD_PIXEL_FORMAT_RGB888 0x00000001U /*!< RGB888 LTDC pixel format */
#define LCD_PIXEL_FORMAT_RGB565 0x00000002U /*!< RGB565 LTDC pixel format */
#define LCD_PIXEL_FORMAT_ARGB1555 0x00000003U /*!< ARGB1555 LTDC pixel format */
#define LCD_PIXEL_FORMAT_ARGB4444 0x00000004U /*!< ARGB4444 LTDC pixel format */
#define LCD_PIXEL_FORMAT_L8 0x00000005U /*!< L8 LTDC pixel format */
#define LCD_PIXEL_FORMAT_AL44 0x00000006U /*!< AL44 LTDC pixel format */
#define LCD_PIXEL_FORMAT_AL88 0x00000007U /*!< AL88 LTDC pixel format */
/**
* @}
*/
/** @defgroup LCD_Exported_Types
* @{
*/
/** @defgroup LCD_Driver_structure LCD Driver structure
* @{
*/
typedef struct
{
int32_t ( *DrawBitmap ) (uint32_t, uint32_t, uint32_t, uint8_t *);
int32_t ( *FillRGBRect ) (uint32_t, uint32_t, uint32_t, uint8_t*, uint32_t, uint32_t);
int32_t ( *DrawHLine ) (uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *DrawVLine ) (uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *FillRect ) (uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *GetPixel ) (uint32_t, uint32_t, uint32_t, uint32_t*);
int32_t ( *SetPixel ) (uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *GetXSize ) (uint32_t, uint32_t *);
int32_t ( *GetYSize ) (uint32_t, uint32_t *);
int32_t ( *SetLayer ) (uint32_t, uint32_t);
int32_t ( *GetFormat ) (uint32_t, uint32_t *);
} LCD_UTILS_Drv_t;
typedef struct
{
/* Control functions */
int32_t (*Init )(void*, uint32_t, uint32_t);
int32_t (*DeInit )(void*);
int32_t (*ReadID )(void*, uint32_t*);
int32_t (*DisplayOn )(void*);
int32_t (*DisplayOff )(void*);
int32_t (*SetBrightness )(void*, uint32_t);
int32_t (*GetBrightness )(void*, uint32_t*);
int32_t (*SetOrientation )(void*, uint32_t);
int32_t (*GetOrientation )(void*, uint32_t*);
/* Drawing functions*/
int32_t ( *SetCursor ) (void*, uint32_t, uint32_t);
int32_t ( *DrawBitmap ) (void*, uint32_t, uint32_t, uint8_t *);
int32_t ( *FillRGBRect ) (void*, uint32_t, uint32_t, uint8_t*, uint32_t, uint32_t);
int32_t ( *DrawHLine ) (void*, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *DrawVLine ) (void*, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *FillRect ) (void*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *GetPixel ) (void*, uint32_t, uint32_t, uint32_t*);
int32_t ( *SetPixel ) (void*, uint32_t, uint32_t, uint32_t);
int32_t ( *GetXSize ) (void*, uint32_t *);
int32_t ( *GetYSize ) (void*, uint32_t *);
}LCD_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* LCD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,104 @@
/**
******************************************************************************
* @file motion_sensor.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* accelerometer driver
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 MOTION_SENSOR_H
#define MOTION_SENSOR_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP BSP
* @{
*/
/** @addtogroup COMPONENTS COMPONENTS
* @{
*/
/** @addtogroup COMMON COMMON
* @{
*/
/** @addtogroup MOTION_SENSOR MOTION SENSOR
* @{
*/
/** @addtogroup MOTION_SENSOR_Public_Types MOTION SENSOR Public types
* @{
*/
/**
* @brief MOTION_SENSOR driver structure definition
*/
typedef struct
{
int32_t ( *Init ) ( void * );
int32_t ( *DeInit ) ( void * );
int32_t ( *ReadID ) ( void *, uint8_t * );
int32_t ( *GetCapabilities ) ( void *, void * );
} MOTION_SENSOR_CommonDrv_t;
typedef struct
{
int32_t ( *Enable ) ( void * );
int32_t ( *Disable ) ( void * );
int32_t ( *GetSensitivity ) ( void *, float * );
int32_t ( *GetOutputDataRate ) ( void *, float * );
int32_t ( *SetOutputDataRate ) ( void *, float );
int32_t ( *GetFullScale ) ( void *, int32_t * );
int32_t ( *SetFullScale ) ( void *, int32_t );
int32_t ( *GetAxes ) ( void *, void * );
int32_t ( *GetAxesRaw ) ( void *, void * );
} MOTION_SENSOR_FuncDrv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* MOTION_SENSOR_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,246 @@
/**
******************************************************************************
* @file pwrmon.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* Current/Power Monitor device driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 __PWRMON_H
#define __PWRMON_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup PWRMON
* @{
*/
/** @defgroup PWRMON_Exported_Types
* @{
*/
/** @defgroup PWRMON_Operating_Mode_enum Power Monitor Operating Mode enums
* @{
*/
typedef enum {
OPERATING_MODE_TRIGGERED = 0,
OPERATING_MODE_CONTINUOUS,
OPERATING_MODE_NB
} PWRMON_OperatingMode_t;
/**
* @}
*/
/** @defgroup PWRMON_Conversion_Time_enum Power Monitor Conversion_Time enums
* @{
*/
typedef enum {
CONVERT_TIME_140 = 0,
CONVERT_TIME_204,
CONVERT_TIME_332,
CONVERT_TIME_588,
CONVERT_TIME_1100,
CONVERT_TIME_2116,
CONVERT_TIME_4156,
CONVERT_TIME_8244,
CONVERT_TIME_NB
} PWRMON_ConvertTime_t;
/**
* @}
*/
/** @defgroup PWRMON_Conversion_Time_enum Power Monitor Conversion_Time enums
* @{
*/
typedef enum {
AVERAGING_MODE_1 = 0,
AVERAGING_MODE_4,
AVERAGING_MODE_16,
AVERAGING_MODE_64,
AVERAGING_MODE_128,
AVERAGING_MODE_256,
AVERAGING_MODE_512,
AVERAGING_MODE_1024,
AVERAGING_MODE_NB
} PWRMON_AveragingMode_t;
/**
* @}
*/
/** @defgroup PWRMON_Device_Configuration_structure Power Monitor Device Configuration structure
* @{
*/
typedef struct
{
PWRMON_ConvertTime_t ShuntConvertTime;
PWRMON_ConvertTime_t BusConvertTime;
PWRMON_AveragingMode_t AveragingMode;
} PWRMON_Config_t;
/**
* @}
*/
/** @defgroup PWRMON_Alert_Polarity_enum Power Monitor Alert Polarity enums
* @{
*/
typedef enum {
ALERT_POLARITY_NORMAL = 0,
ALERT_POLARITY_INVERTED,
ALERT_POLARITY_NB
} PWRMON_AlertPolarity_t;
/**
* @}
*/
/** @defgroup PWRMON_Alert_Latch_Enable_enum Power Monitor Alert Latch Enable enums
* @{
*/
typedef enum {
ALERT_LATCH_DISABLE = 0,
ALERT_LATCH_ENABLE,
ALERT_LATCH_NB
} PWRMON_AlertLatchEnable_t;
/**
* @}
*/
/** @defgroup PWRMON_Alert_Function_enum Power Monitor Alert Function enums
* @{
*/
typedef enum {
ALERT_FUNCTION_NONE = 0,
ALERT_FUNCTION_SOL,
ALERT_FUNCTION_SUL,
ALERT_FUNCTION_BOL,
ALERT_FUNCTION_BUL,
ALERT_FUNCTION_POL,
ALERT_FUNCTION_NB,
} PWRMON_AlertFunction_t;
/**
* @}
*/
/** @defgroup PWRMON_Alert_Configuration_structure Power Monitor Alert Configuration structure
* @{
*/
typedef struct
{
PWRMON_AlertPolarity_t Polarity;
PWRMON_AlertLatchEnable_t LatchEnable;
} PWRMON_AlertPinConfig_t;
/**
* @}
*/
/** @defgroup PWRMON_Voltage_Input_enum Power Monitor Voltage Input enums
* @{
*/
typedef enum {
VOLTAGE_INPUT_SHUNT = 0,
VOLTAGE_INPUT_BUS,
VOLTAGE_INPUT_ALL,
VOLTAGE_INPUT_NB
} PWRMON_InputSignal_t;
/**
* @}
*/
/** @defgroup PWRMON_Flag_enum Power Monitor Flag enums
* @{
*/
typedef enum {
FLAG_ALERT_FUNCTION = 0,
FLAG_CONVERSION_READY,
FLAG_MATH_OVERFLOW,
FLAG_NB
} PWRMON_Flag_t;
/**
* @}
*/
/** @defgroup PWRMON_Driver_structure Power Monitor Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t, PWRMON_Config_t *);
void (*DeInit)(uint16_t);
uint16_t (*ReadId)(uint16_t);
void (*Reset)(uint16_t);
void (*SetCalibration)(uint16_t, uint16_t);
uint16_t (*GetCalibration)(uint16_t);
void (*SetAlertFunction)(uint16_t, PWRMON_AlertFunction_t);
PWRMON_AlertFunction_t (*GetAlertFunction)(uint16_t);
void (*AlertPinConfig)(uint16_t, PWRMON_AlertPinConfig_t *);
void (*SetVBusThreshold)(uint16_t, uint16_t);
uint16_t (*GetVBusThreshold)(uint16_t);
void (*SetVShuntThreshold)(uint16_t, int16_t);
int16_t (*GetVShuntThreshold)(uint16_t);
void (*SetPowerThreshold)(uint16_t, uint32_t);
uint32_t (*GetPowerThreshold)(uint16_t);
void (*AlertThresholdEnableIT)(uint16_t);
void (*AlertThresholdDisableIT)(uint16_t);
void (*ConversionReadyEnableIT)(uint16_t);
void (*ConversionReadyDisableIT)(uint16_t);
void (*StartConversion)(uint16_t, PWRMON_InputSignal_t, PWRMON_OperatingMode_t);
void (*StopConversion)(uint16_t);
uint16_t (*GetVBus)(uint16_t);
int16_t (*GetVShunt)(uint16_t);
uint16_t (*GetPower)(uint16_t);
int16_t (*GetCurrent)(uint16_t);
uint8_t (*GetFlag)(uint16_t, PWRMON_Flag_t);
} PWRMON_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __PWRMON_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,93 @@
/**
******************************************************************************
* @file ts.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the Touch Screen driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 TS_H
#define TS_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup TS
* @{
*/
/** @defgroup TS_Exported_Types
* @{
*/
/** @defgroup TS_Driver_structure Touch Sensor Driver structure
* @{
*/
typedef struct
{
int32_t ( *Init ) (void *);
int32_t ( *DeInit ) (void *);
int32_t ( *GestureConfig ) (void *, void*);
int32_t ( *ReadID ) (void *, uint32_t *);
int32_t ( *GetState ) (void *, void*);
int32_t ( *GetMultiTouchState ) (void *, void*);
int32_t ( *GetGesture ) (void *, void*);
int32_t ( *GetCapabilities ) (void *, void*);
int32_t ( *EnableIT ) (void *);
int32_t ( *DisableIT ) (void *);
int32_t ( *ClearIT ) (void *);
int32_t ( *ITStatus ) (void *);
}TS_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* TS_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,114 @@
/**
******************************************************************************
* @file usbtypecswitch.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* crossbar switch device for USB Type-C systems.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 __USBTYPECSWITCH_H
#define __USBTYPECSWITCH_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup TYPECSWITCH
* @{
*/
/** @defgroup TYPECSWITCH_Exported_Types
* @{
*/
typedef enum {
USB_NORMAL = 0,
USB_FLIPPED,
DFP_D_PIN_ASSIGNMENT_A_NORMAL,
DFP_D_PIN_ASSIGNMENT_A_FLIPPED,
DFP_D_PIN_ASSIGNMENT_B_NORMAL,
DFP_D_PIN_ASSIGNMENT_B_FLIPPED,
DFP_D_PIN_ASSIGNMENT_C_NORMAL,
DFP_D_PIN_ASSIGNMENT_C_FLIPPED,
DFP_D_PIN_ASSIGNMENT_D_NORMAL,
DFP_D_PIN_ASSIGNMENT_D_FLIPPED,
DFP_D_PIN_ASSIGNMENT_E_NORMAL,
DFP_D_PIN_ASSIGNMENT_E_FLIPPED,
DFP_D_PIN_ASSIGNMENT_F_NORMAL,
DFP_D_PIN_ASSIGNMENT_F_FLIPPED,
UFP_D_PIN_ASSIGNMENT_A_NORMAL,
UFP_D_PIN_ASSIGNMENT_A_FLIPPED,
UFP_D_PIN_ASSIGNMENT_B_NORMAL,
UFP_D_PIN_ASSIGNMENT_B_FLIPPED,
UFP_D_PIN_ASSIGNMENT_C_NORMAL,
UFP_D_PIN_ASSIGNMENT_C_FLIPPED,
UFP_D_PIN_ASSIGNMENT_D_NORMAL,
UFP_D_PIN_ASSIGNMENT_D_FLIPPED,
UFP_D_PIN_ASSIGNMENT_E_NORMAL,
UFP_D_PIN_ASSIGNMENT_E_FLIPPED,
UFP_D_PIN_ASSIGNMENT_F_NORMAL,
UFP_D_PIN_ASSIGNMENT_F_FLIPPED
} TYPECSWITCH_Mode_t;
/** @defgroup TYPECSWITCH_Driver_structure USB Type-C Crossbar Switch Driver structure
* @{
*/
typedef struct
{
uint32_t (*Init)(uint16_t);
void (*DeInit)(uint16_t);
uint32_t (*PowerOn)(uint16_t);
uint32_t (*PowerOff)(uint16_t);
uint32_t (*SetMode)(uint16_t, TYPECSWITCH_Mode_t);
uint32_t (*IsSupportedMode)(TYPECSWITCH_Mode_t);
} TYPECSWITCH_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __USBTYPECSWITCH_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,89 @@
<!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 ADV7533 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-adv7533-component-driver"><strong>Release Notes for ADV7533 Component Driver</strong></h1>
<p>Copyright © 2016 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 HDMI(audio and display) functions offered by ADV7533 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-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V2.0.1 / 23-November-2019</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Update st_logo.png inclusion path in Release notes</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" checked aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V2.0.0 / 14-October-2019</strong></label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>First Official release of ADV7533 BSP drivers in line with STM32Cube BSP drivers development guidelines (UM2298)</li>
<li>The component drivers are composed of
<ul>
<li>component core drivers files: adv7533.h/.c</li>
<li>component register drivers files: adv7533_reg.h/.c</li>
</ul></li>
</ul>
<h2 id="backward-compatibility">Backward Compatibility</h2>
<ul>
<li>This version breaks the compatibility with previous version</li>
</ul>
<h2 id="dependencies">Dependencies</h2>
<p>This software release is compatible with:</p>
<ul>
<li>BSP Common v6.0.1 or above</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 26-August-2016</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>First official release of ADV7533 HDMI 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>

View file

@ -0,0 +1,92 @@
---
pagetitle: Release Notes for ADV7533 Component Driver
lang: en
---
::: {.row}
::: {.col-sm-12 .col-lg-4}
::: {.card .fluid}
::: {.sectione .dark}
<center>
# **Release Notes for ADV7533 Component Driver**
Copyright &copy; 2016 STMicroelectronics\
[![ST logo](_htmresc/st_logo.png)](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 HDMI(audio and display) functions offered by ADV7533 component
:::
::: {.col-sm-12 .col-lg-8}
# Update History
::: {.collapse}
<input type="checkbox" id="collapse-section3" checked aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">__V2.0.1 / 23-November-2019__</label>
<div>
## Main Changes
- Update st_logo.png inclusion path in Release notes
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section2" checked aria-hidden="true">
<label for="collapse-section2" aria-hidden="true">__V2.0.0 / 14-October-2019__</label>
<div>
## Main Changes
- First Official release of ADV7533 BSP drivers in line with STM32Cube BSP drivers development guidelines (UM2298)
- The component drivers are composed of
- component core drivers files: adv7533.h/.c
- component register drivers files: adv7533_reg.h/.c
## Backward Compatibility
- This version breaks the compatibility with previous version
## Dependencies
This software release is compatible with:
- BSP Common v6.0.1 or above
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section1" checked aria-hidden="true">
<label for="collapse-section1" aria-hidden="true">__V1.0.0 / 26-August-2016__</label>
<div>
## Main Changes
- First official release of ADV7533 HDMI component 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

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,272 @@
/**
******************************************************************************
* @file adv7533.h
* @author MCD Application Team
* @brief This file contains all the constants parameters for the ADV7533
* which is the HDMI bridge between DSI and HDMI
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2016 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 ADV7533_H
#define ADV7533_H
/* Includes ------------------------------------------------------------------*/
#include "adv7533_reg.h"
#include <stddef.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup ADV7533
* @{
*/
/** @defgroup ADV7533_Exported_Types Exported Types
* @{
*/
typedef int32_t (*ADV7533_Init_Func) (void);
typedef int32_t (*ADV7533_DeInit_Func) (void);
typedef int32_t (*ADV7533_GetTick_Func) (void);
typedef int32_t (*ADV7533_Delay_Func) (uint32_t);
typedef int32_t (*ADV7533_WriteReg_Func)(uint16_t, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*ADV7533_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
typedef struct
{
uint32_t Frequency;
} ADV7533_Init_t;
typedef struct
{
ADV7533_Init_Func Init;
ADV7533_DeInit_Func DeInit;
uint16_t Address;
ADV7533_WriteReg_Func WriteReg;
ADV7533_ReadReg_Func ReadReg;
ADV7533_GetTick_Func GetTick;
} ADV7533_IO_t;
typedef struct
{
ADV7533_IO_t IO;
adv7533_ctx_t Ctx;
uint8_t IsInitialized;
} ADV7533_Object_t;
typedef struct
{
int32_t ( *Init ) ( ADV7533_Object_t *, ADV7533_Init_t* );
int32_t ( *DeInit ) ( ADV7533_Object_t * );
int32_t ( *ReadID ) ( ADV7533_Object_t *, uint32_t *);
int32_t ( *Play ) ( ADV7533_Object_t * );
int32_t ( *Pause ) ( ADV7533_Object_t * );
int32_t ( *Resume ) ( ADV7533_Object_t * );
int32_t ( *Stop ) ( ADV7533_Object_t *, uint32_t );
int32_t ( *SetFrequency ) ( ADV7533_Object_t *, uint32_t );
int32_t ( *GetFrequency ) ( ADV7533_Object_t *, uint32_t* );
int32_t ( *SetVolume ) ( ADV7533_Object_t *, uint8_t, uint8_t );
int32_t ( *GetVolume ) ( ADV7533_Object_t *, uint8_t );
int32_t ( *SetMute ) ( ADV7533_Object_t *, uint16_t );
int32_t ( *SetOutputMode ) ( ADV7533_Object_t *, uint16_t );
int32_t ( *SetResolution ) ( ADV7533_Object_t *, uint32_t );
int32_t ( *GetResolution ) ( ADV7533_Object_t *, uint32_t *);
int32_t ( *SetProtocol ) ( ADV7533_Object_t *, uint16_t );
int32_t ( *GetProtocol ) ( ADV7533_Object_t *);
int32_t ( *Reset ) ( ADV7533_Object_t * );
} ADV7533_Drv_t;
typedef struct
{
/* Control functions */
int32_t (*Init )(ADV7533_Object_t*, uint32_t, uint32_t);
int32_t (*DeInit )(ADV7533_Object_t*);
int32_t (*ReadID )(ADV7533_Object_t*, uint32_t*);
int32_t (*DisplayOn )(ADV7533_Object_t*);
int32_t (*DisplayOff )(ADV7533_Object_t*);
int32_t (*SetBrightness )(ADV7533_Object_t*, uint32_t);
int32_t (*GetBrightness )(ADV7533_Object_t*, uint32_t*);
int32_t (*SetOrientation )(ADV7533_Object_t*, uint32_t);
int32_t (*GetOrientation )(ADV7533_Object_t*, uint32_t*);
/* Drawing functions*/
int32_t ( *SetCursor ) (ADV7533_Object_t*, uint32_t, uint32_t);
int32_t ( *DrawBitmap ) (ADV7533_Object_t*, uint32_t, uint32_t, uint8_t *);
int32_t (*FillRGBRect ) (ADV7533_Object_t*, uint32_t, uint32_t, uint8_t *, uint32_t, uint32_t);
int32_t ( *DrawHLine ) (ADV7533_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *DrawVLine ) (ADV7533_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *FillRect ) (ADV7533_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *GetPixel ) (ADV7533_Object_t*, uint32_t, uint32_t, uint32_t*);
int32_t ( *SetPixel ) (ADV7533_Object_t*, uint32_t, uint32_t, uint32_t);
int32_t ( *GetXSize ) (ADV7533_Object_t*, uint32_t *);
int32_t ( *GetYSize ) (ADV7533_Object_t*, uint32_t *);
} ADV7533_LcdDrv_t;
/**
* @}
*/
/** @defgroup ADV7533_Exported_Constants Exported Constants
* @{
*/
#define ADV7533_OK (0)
#define ADV7533_ERROR (-1)
/**
* @brief AUDIO FREQUENCY
*/
#define ADV7533_FREQUENCY_192K 192000
#define ADV7533_FREQUENCY_176K 176400
#define ADV7533_FREQUENCY_96K 96000
#define ADV7533_FREQUENCY_88K 88200
#define ADV7533_FREQUENCY_48K 48000
#define ADV7533_FREQUENCY_44K 44100
#define ADV7533_FREQUENCY_32K 32000
#define ADV7533_FREQUENCY_22K 22050
#define ADV7533_FREQUENCY_16K 16000
#define ADV7533_FREQUENCY_11K 11025
#define ADV7533_FREQUENCY_8K 8000
/**
* @brief HDMI audio output DEVICE
*/
#define OUTPUT_DEVICE_ADV7533_HDMI 0x1000U
/**
* @brief ADV7533 I2C Addresses 0x7A / 0x78
*/
#define ADV7533_MAIN_I2C_ADDR 0x7AU
#define ADV7533_CEC_DSI_I2C_ADDR 0x78U
/**
* @brief ADV7533 Aspect ratio
*/
#define ADV7533_ASPECT_RATIO_16_9 00U
#define ADV7533_ASPECT_RATIO_4_3 01U
/**
* @brief ADV7533 Aspect ratio
*/
#define ADV7533_MODE_HDMI 00U
#define ADV7533_MODE_DVI 01U
/**
* @brief ADV7533 Main Features Parameters
*/
/** @Brief adv7533 ID
*/
#define ADV7533_ID 0x7533U
/* MUTE commands */
#define ADV7533_MUTE_ON 1U
#define ADV7533_MUTE_OFF 0U
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/** @defgroup ADV7533_Exported_Macros ADV7533 Exported Macros
* @{
*/
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup ADV7533_Exported_Functions
* @{
*/
int32_t ADV7533_RegisterBusIO (ADV7533_Object_t *pObj, ADV7533_IO_t *pIO);
/*------------------------------------------------------------------------------
HDMI video functions
------------------------------------------------------------------------------*/
int32_t ADV7533_Init(ADV7533_Object_t *pObj, uint32_t ColorCoding, uint32_t Orientation);
int32_t ADV7533_DisplayOn(ADV7533_Object_t *pObj);
int32_t ADV7533_DisplayOff(ADV7533_Object_t *pObj);
int32_t ADV7533_Configure(ADV7533_Object_t *pObj, uint8_t LaneNumber);
int32_t ADV7533_PatternEnable(ADV7533_Object_t *pObj);
int32_t ADV7533_PatternDisable(ADV7533_Object_t *pObj);
int32_t ADV7533_SetBrightness(ADV7533_Object_t *pObj, uint32_t Brightness);
int32_t ADV7533_GetBrightness(ADV7533_Object_t *pObj, uint32_t *Brightness);
int32_t ADV7533_SetOrientation(ADV7533_Object_t *pObj, uint32_t Orientation);
int32_t ADV7533_GetOrientation(ADV7533_Object_t *pObj, uint32_t *Orientation);
int32_t ADV7533_SetCursor(ADV7533_Object_t *pObj, uint32_t Xpos, uint32_t Ypos);
int32_t ADV7533_DrawBitmap(ADV7533_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint8_t *pBmp);
int32_t ADV7533_FillRGBRect(ADV7533_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height);
int32_t ADV7533_DrawHLine(ADV7533_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t ADV7533_DrawVLine(ADV7533_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t ADV7533_FillRect(ADV7533_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Width, uint32_t Height, uint32_t Color);
int32_t ADV7533_SetPixel(ADV7533_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Color);
int32_t ADV7533_GetPixel(ADV7533_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t *Color);
int32_t ADV7533_GetXSize(ADV7533_Object_t *pObj, uint32_t *XSize);
int32_t ADV7533_GetYSize(ADV7533_Object_t *pObj, uint32_t *YSize);
/*------------------------------------------------------------------------------
HDMI Audio functions
------------------------------------------------------------------------------*/
int32_t ADV7533_AudioInit(ADV7533_Object_t *pObj, ADV7533_Init_t *pInit);
int32_t ADV7533_DeInit(ADV7533_Object_t *pObj);
int32_t ADV7533_ReadID(ADV7533_Object_t *pObj, uint32_t *Id);
int32_t ADV7533_Play(ADV7533_Object_t *pObj);
int32_t ADV7533_Pause(ADV7533_Object_t *pObj);
int32_t ADV7533_Resume(ADV7533_Object_t *pObj);
int32_t ADV7533_Stop(ADV7533_Object_t *pObj, uint32_t CodecPdwnMode);
int32_t ADV7533_SetVolume(ADV7533_Object_t *pObj, uint8_t Volume, uint8_t InputOutput);
int32_t ADV7533_GetVolume(ADV7533_Object_t *pObj, uint8_t InputOutput);
int32_t ADV7533_SetMute(ADV7533_Object_t *pObj, uint16_t Cmd);
int32_t ADV7533_SetOutputMode(ADV7533_Object_t *pObj, uint16_t Output);
int32_t ADV7533_SetResolution(ADV7533_Object_t *pObj, uint32_t Resolution);
int32_t ADV7533_GetResolution(ADV7533_Object_t *pObj, uint32_t *Resolution);
int32_t ADV7533_SetProtocol(ADV7533_Object_t *pObj, uint16_t Protocol);
int32_t ADV7533_GetProtocol(ADV7533_Object_t *pObj);
int32_t ADV7533_SetFrequency(ADV7533_Object_t *pObj, uint32_t AudioFreq);
int32_t ADV7533_GetFrequency(ADV7533_Object_t *pObj, uint32_t *Frequency);
int32_t ADV7533_Reset(ADV7533_Object_t *pObj);
/**
* @}
*/
/* Audio driver structure */
extern ADV7533_Drv_t ADV7533_Driver;
/* LCD driver structure */
extern ADV7533_LcdDrv_t ADV7533_LCD_Driver;
#endif /* ADV7533_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,94 @@
/**
******************************************************************************
* @file adv7533_reg.c
* @author MCD Application Team
* @brief This file provides the ADV7533 DSI to HDMI bridge driver
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2016 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 "adv7533_reg.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup ADV7533
* @brief This file provides a set of functions needed to drive the
* adv7533 DSI-HDMI bridge.
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/** @defgroup ADV7533_Private_Constants ADV7533 Private Constants
* @{
*/
/**
* @}
*/
/** @addtogroup ADV7533_Exported_Functions
* @{
*/
/* Private functions ---------------------------------------------------------*/
/************** Generic Function *******************/
/*******************************************************************************
* Function Name : adv7533_read_reg
* Description : Generic Reading function. It must be fullfilled with either
* I2C or SPI reading functions
* Input : register Address, length of buffer
* Output : Data Read
*******************************************************************************/
int32_t adv7533_read_reg(adv7533_ctx_t *ctx, uint16_t reg, uint8_t *pdata, uint16_t length)
{
return ctx->ReadReg(ctx->handle, reg, pdata, length);
}
/*******************************************************************************
* Function Name : adv7533_write_reg
* Description : Generic Writing function. It must be fullfilled with either
* I2C or SPI writing function
* Input : register Address, Data to be written, length of buffer
* Output : None
*******************************************************************************/
int32_t adv7533_write_reg(adv7533_ctx_t *ctx, uint16_t reg, uint8_t *pdata, uint16_t length)
{
return ctx->WriteReg(ctx->handle, reg, pdata, length);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,144 @@
/**
******************************************************************************
* @file adv7533_reg.h
* @author MCD Application Team
* @brief This file contains all the constants parameters for the ADV7533
* which is the HDMI bridge between DSI and HDMI
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2016 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 ADV7533_REG_H
#define ADV7533_REG_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup ADV7533
* @{
*/
/** @addtogroup ADV7533_Exported_Constants
* @{
*/
/**
* @brief ADV7533 Main Registers
*/
#define ADV7533_MAIN_SYNC_REG 0x17U
#define ADV7533_MAIN_POWER_DOWN_REG 0x41U
#define ADV7533_MAIN_HPG_REG 0x42U
/**
* @brief ADV7533 Main Features Parameters
*/
/**
* @brief ADV7533 CEC DSI Registers
*/
#define ADV7533_CEC_DSI_INTERNAL_TIMING_REG 0x27U
#define ADV7533_CEC_DSI_TOTAL_WIDTH_H_REG 0x28U
#define ADV7533_CEC_DSI_TOTAL_WIDTH_L_REG 0x29U
#define ADV7533_CEC_DSI_HSYNC_H_REG 0x2AU
#define ADV7533_CEC_DSI_HSYNC_L_REG 0x2BU
#define ADV7533_CEC_DSI_HFP_H_REG 0x2CU
#define ADV7533_CEC_DSI_HFP_L_REG 0x2DU
#define ADV7533_CEC_DSI_HBP_H_REG 0x2EU
#define ADV7533_CEC_DSI_HBP_L_REG 0x2FU
#define ADV7533_CEC_DSI_TOTAL_HEIGHT_H_REG 0x30U
#define ADV7533_CEC_DSI_TOTAL_HEIGHT_L_REG 0x31U
#define ADV7533_CEC_DSI_VSYNC_H_REG 0x32U
#define ADV7533_CEC_DSI_VSYNC_L_REG 0x33U
#define ADV7533_CEC_DSI_VFP_H_REG 0x34U
#define ADV7533_CEC_DSI_VFP_L_REG 0x35U
#define ADV7533_CEC_DSI_VBP_H_REG 0x36U
#define ADV7533_CEC_DSI_VBP_L_REG 0x37U
/** @Brief device ID register
*/
#define ADV7533_CHIPID_ADDR0 0x00U
#define ADV7533_CHIPID_ADDR1 0x01U
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/** @defgroup ADV7533_Exported_Macros ADV7533 Exported Macros
* @{
*/
/**
* @}
*/
/** @addtogroup ADV7533_Exported_Types
* @{
*/
typedef int32_t (*ADV7533_Write_Func)(void *, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*ADV7533_Read_Func) (void *, uint16_t, uint8_t*, uint16_t);
typedef struct
{
ADV7533_Write_Func WriteReg;
ADV7533_Read_Func ReadReg;
void *handle;
} adv7533_ctx_t;
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup ADV7533_Exported_Functions
* @{
*/
int32_t adv7533_write_reg(adv7533_ctx_t *ctx, uint16_t reg, uint8_t *pdata, uint16_t length );
int32_t adv7533_read_reg(adv7533_ctx_t *ctx, uint16_t reg, uint8_t *pdata, uint16_t length );
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADV7533_REG_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

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 AMPIRE480272 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-ampire480272-component-driver"><strong>Release Notes for AMPIRE480272 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 timings required for Ampire480272 LCD component</p>
</div>
<div class="col-sm-12 col-lg-8">
<h1 id="update-history">Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section4" checked aria-hidden="true"> <label for="collapse-section4" aria-hidden="true"><strong>V1.0.3 / 23-November-2019</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Update st_logo.png inclusion path in Release notes.</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V1.0.2 / 14-October-2019</strong></label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>Update Release_Notes generation sources</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" checked aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V1.0.1 / 07-April-2017</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>Update comments to be used for PDSC generation</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 18-February-2014</strong></label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>First official release of ampire480272 LCD 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>

View file

@ -0,0 +1,91 @@
---
pagetitle: Release Notes for AMPIRE480272 Component Driver
lang: en
---
::: {.row}
::: {.col-sm-12 .col-lg-4}
::: {.card .fluid}
::: {.sectione .dark}
<center>
# **Release Notes for AMPIRE480272 Component Driver**
Copyright &copy; 2014 STMicroelectronics\
[![ST logo](_htmresc/st_logo.png)](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 timings required for Ampire480272 LCD component
:::
::: {.col-sm-12 .col-lg-8}
# Update History
::: {.collapse}
<input type="checkbox" id="collapse-section4" checked aria-hidden="true">
<label for="collapse-section4" aria-hidden="true">__V1.0.3 / 23-November-2019__</label>
<div>
## Main Changes
- Update st_logo.png inclusion path in Release notes.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section3" checked aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">__V1.0.2 / 14-October-2019__</label>
<div>
## Main Changes
- Update Release_Notes generation sources
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section2" checked aria-hidden="true">
<label for="collapse-section2" aria-hidden="true">__V1.0.1 / 07-April-2017__</label>
<div>
## Main Changes
- Update comments to be used for PDSC generation
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section1" checked aria-hidden="true">
<label for="collapse-section1" aria-hidden="true">__V1.0.0 / 18-February-2014__</label>
<div>
## Main Changes
- First official release of ampire480272 LCD component 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

View file

@ -0,0 +1,119 @@
/**
******************************************************************************
* @file ampire480272.h
* @author MCD Application Team
* @brief This file contains all the constants parameters for the ampire480272
* LCD component.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2014 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 __AMPIRE480272_H
#define __AMPIRE480272_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup ampire480272
* @{
*/
/** @defgroup AMPIRE480272_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup AMPIRE480272_Exported_Constants
* @{
*/
/**
* @brief AMPIRE480272 Size
*/
#define AMPIRE480272_WIDTH ((uint16_t)480) /* LCD PIXEL WIDTH */
#define AMPIRE480272_HEIGHT ((uint16_t)272) /* LCD PIXEL HEIGHT */
/**
* @brief AMPIRE480272 Timing
*/
#define AMPIRE480272_HSYNC ((uint16_t)41) /* Horizontal synchronization */
#define AMPIRE480272_HBP ((uint16_t)2) /* Horizontal back porch */
#define AMPIRE480272_HFP ((uint16_t)2) /* Horizontal front porch */
#define AMPIRE480272_VSYNC ((uint16_t)10) /* Vertical synchronization */
#define AMPIRE480272_VBP ((uint16_t)2) /* Vertical back porch */
#define AMPIRE480272_VFP ((uint16_t)2) /* Vertical front porch */
/**
* @brief AMPIRE480272 frequency divider
*/
#define AMPIRE480272_FREQUENCY_DIVIDER 5 /* LCD Frequency divider */
/**
* @}
*/
/** @defgroup AMPIRE480272_Exported_Functions
* @{
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __AMPIRE480272_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

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 AMPIRE640480 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-ampire640480-component-driver"><strong>Release Notes for AMPIRE640480 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 timings required for Ampire640480 LCD component</p>
</div>
<div class="col-sm-12 col-lg-8">
<h1 id="update-history">Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section4" checked aria-hidden="true"> <label for="collapse-section4" aria-hidden="true"><strong>V1.0.3 / 23-November-2019</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Update st_logo.png inclusion path in Release notes.</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V1.0.2 / 14-October-2019</strong></label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>Update Release_Notes generation sources</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" checked aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V1.0.1 / 07-April-2017</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>Update comments to be used for PDSC generation</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 18-February-2014</strong></label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>First official release of ampire640480 LCD 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>

View file

@ -0,0 +1,91 @@
---
pagetitle: Release Notes for AMPIRE640480 Component Driver
lang: en
---
::: {.row}
::: {.col-sm-12 .col-lg-4}
::: {.card .fluid}
::: {.sectione .dark}
<center>
# **Release Notes for AMPIRE640480 Component Driver**
Copyright &copy; 2014 STMicroelectronics\
[![ST logo](_htmresc/st_logo.png)](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 timings required for Ampire640480 LCD component
:::
::: {.col-sm-12 .col-lg-8}
# Update History
::: {.collapse}
<input type="checkbox" id="collapse-section4" checked aria-hidden="true">
<label for="collapse-section4" aria-hidden="true">__V1.0.3 / 23-November-2019__</label>
<div>
## Main Changes
- Update st_logo.png inclusion path in Release notes.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section3" checked aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">__V1.0.2 / 14-October-2019__</label>
<div>
## Main Changes
- Update Release_Notes generation sources
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section2" checked aria-hidden="true">
<label for="collapse-section2" aria-hidden="true">__V1.0.1 / 07-April-2017__</label>
<div>
## Main Changes
- Update comments to be used for PDSC generation
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section1" checked aria-hidden="true">
<label for="collapse-section1" aria-hidden="true">__V1.0.0 / 18-February-2014__</label>
<div>
## Main Changes
- First official release of ampire640480 LCD component 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

View file

@ -0,0 +1,119 @@
/**
******************************************************************************
* @file ampire640480.h
* @author MCD Application Team
* @brief This file contains all the constants parameters for the ampire640480
* LCD component.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2014 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 __AMPIRE640480_H
#define __AMPIRE640480_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup ampire640480
* @{
*/
/** @defgroup AMPIRE640480_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup AMPIRE640480_Exported_Constants
* @{
*/
/**
* @brief AMPIRE640480 Size
*/
#define AMPIRE640480_WIDTH ((uint16_t)640) /* LCD PIXEL WIDTH */
#define AMPIRE640480_HEIGHT ((uint16_t)480) /* LCD PIXEL HEIGHT */
/**
* @brief AMPIRE640480 Timing
*/
#define AMPIRE640480_HSYNC ((uint16_t)30) /* Horizontal synchronization */
#define AMPIRE640480_HBP ((uint16_t)114) /* Horizontal back porch */
#define AMPIRE640480_HFP ((uint16_t)16) /* Horizontal front porch */
#define AMPIRE640480_VSYNC ((uint16_t)3) /* Vertical synchronization */
#define AMPIRE640480_VBP ((uint16_t)32) /* Vertical back porch */
#define AMPIRE640480_VFP ((uint16_t)10) /* Vertical front porch */
/**
* @brief AMPIRE640480 frequency divider
*/
#define AMPIRE640480_FREQUENCY_DIVIDER 3 /* LCD Frequency divider */
/**
* @}
*/
/** @defgroup AMPIRE640480_Exported_Functions
* @{
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __AMPIRE640480_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,91 @@
<!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 CS42L51 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-cs42l51-component-driver"><strong>Release Notes for CS42L51 Component Driver</strong></h1>
<p>Copyright © 2017 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 audio functions offered by CS42L51 codec 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-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V2.0.1 / 30-October-2019</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Update st_logo.png inclusion path in Release notes.</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" checked aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V2.0.0 / 14-October-2019</strong></label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>First Official release of CS42L51 BSP drivers in line with STM32Cube BSP drivers development guidelines (UM2298)</li>
<li>The component drivers are composed of
<ul>
<li>component core drivers files: cs42l51.h/.c</li>
<li>component register drivers files: cs42l51_regs.h/.c</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><p>This software release is compatible with:</p>
<ul>
<li>BSP Common v6.0.1 or above</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 17-February-2017</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>First official release of <strong>CS42L51</strong> Audio codec Component drivers</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>

View file

@ -0,0 +1,92 @@
---
pagetitle: Release Notes for CS42L51 Component Driver
lang: en
---
::: {.row}
::: {.col-sm-12 .col-lg-4}
::: {.card .fluid}
::: {.sectione .dark}
<center>
# **Release Notes for CS42L51 Component Driver**
Copyright &copy; 2017 STMicroelectronics\
[![ST logo](_htmresc/st_logo.png)](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 audio functions offered by CS42L51 codec component
:::
::: {.col-sm-12 .col-lg-8}
# Update History
::: {.collapse}
<input type="checkbox" id="collapse-section3" checked aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">__V2.0.1 / 30-October-2019__</label>
<div>
## Main Changes
- Update st_logo.png inclusion path in Release notes.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section2" checked aria-hidden="true">
<label for="collapse-section2" aria-hidden="true">__V2.0.0 / 14-October-2019__</label>
<div>
## Main Changes
- First Official release of CS42L51 BSP drivers in line with STM32Cube BSP drivers development guidelines (UM2298)
- The component drivers are composed of
- component core drivers files: cs42l51.h/.c
- component register drivers files: cs42l51_regs.h/.c
## Backward Compatibility
- This version breaks the compatibility with previous versions
## Dependencies
- This software release is compatible with:
- BSP Common v6.0.1 or above
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section1" checked aria-hidden="true">
<label for="collapse-section1" aria-hidden="true">__V1.0.0 / 17-February-2017__</label>
<div>
## Main Changes
- First official release of **CS42L51** Audio codec Component drivers
</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

View file

@ -0,0 +1,722 @@
/**
******************************************************************************
* @file cs42l51.c
* @author MCD Application Team
* @brief This file provides the CS42L51 Audio Codec driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 "cs42l51.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup cs42l51
* @brief This file provides a set of functions needed to drive the
* CS42L51 audio codec.
* @{
*/
/** @defgroup CS42L51_Private_Types Private Types
* @{
*/
/* Audio codec driver structure initialization */
CS42L51_Drv_t CS42L51_Driver =
{
CS42L51_Init,
CS42L51_DeInit,
CS42L51_ReadID,
CS42L51_Play,
CS42L51_Pause,
CS42L51_Resume,
CS42L51_Stop,
CS42L51_SetFrequency,
CS42L51_GetFrequency,
CS42L51_SetVolume,
CS42L51_GetVolume,
CS42L51_SetMute,
CS42L51_SetOutputMode,
CS42L51_SetResolution,
CS42L51_GetResolution,
CS42L51_SetProtocol,
CS42L51_GetProtocol,
CS42L51_Reset
};
/**
* @}
*/
/** @defgroup CS42L51_Private_Variables Private Variables
* @{
*/
static uint32_t CS42L51_CurrentDevices = CS42L51_OUT_NONE;
/**
* @}
*/
/** @defgroup CS42L51_Function_Prototypes Function Prototypes
* @{
*/
static int32_t CS42L51_ReadRegWrap(void *handle, uint16_t Reg, uint8_t* Data, uint16_t Length);
static int32_t CS42L51_WriteRegWrap(void *handle, uint16_t Reg, uint8_t* Data, uint16_t Length);
/**
* @}
*/
/** @defgroup CS42L51_Private_Functions Private Functions
* @{
*/
/**
* @brief Initializes the audio codec and the control interface.
* @param pObj pointer to component object
* @param pInit pointer de component init structure
* @retval Component status
*/
int32_t CS42L51_Init(CS42L51_Object_t *pObj, CS42L51_Init_t *pInit)
{
int32_t ret = 0;
uint8_t tmp;
if(pObj->IsInitialized == 0U)
{
/* Set the device in standby mode */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
tmp |= 0x01U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
/* Set all power down bits to 1 */
tmp = 0x7FU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
tmp |= 0x0EU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
pObj->IsInitialized = 1U;
}
else
{
/* Set all power down bits to 1 exept PDN to mute ADCs and DACs*/
tmp = 0x7EU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
tmp |= 0x0EU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
/* Disable zero cross and soft ramp */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_DAC_CTRL, &tmp, 1);
tmp &= 0xFCU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_DAC_CTRL, &tmp, 1);
/* Power control : Enter standby (PDN = 1) */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
tmp |= 0x01U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
}
/* Mic Power and Speed Control : Auto detect on, Speed mode SSM, tri state off, MCLK divide by 2 off */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
tmp = ((tmp & 0x0EU) | 0xA0U);
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
/* Interface control : Loopback off, Slave, I2S (SDIN and SOUT), Digital mix off, Mic mix off */
tmp = 0x0CU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_INTERFACE_CTRL, &tmp, 1);
/* Mic control : ADC single volume off, ADCB boost off, ADCA boost off, MicBias on AIN3B/MICIN2 pin, MicBias level 0.8xVA, MICB boost 32db, MICA boost 32dB */
tmp = 0x03U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_MIC_CTRL, &tmp, 1);
/* ADC control : ADCB HPF on, ADCB HPF freeze off, ADCA HPF on, ADCA HPF freeze off, Soft ramp B on, Zero cross B on, Soft ramp A on, Zero cross A on */
tmp = 0xAFU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ADC_CTRL, &tmp, 1);
/* DAC output control : HP Gain to 1, Single volume control off, PCM invert signals polarity off, DAC channels mute on */
tmp = 0xC3U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_DAC_OUTPUT_CTRL, &tmp, 1);
/* DAC control : Signal processing to DAC, Freeze off, De-emphasis off, Analog output auto mute off, DAC soft ramp */
tmp = 0x42U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_DAC_CTRL, &tmp, 1);
/* ALCA and PGAA Control : ALCA soft ramp disable on, ALCA zero cross disable on, PGA A Gain +8dB */
tmp = 0xD0U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ALCA_PGAA_CTRL, &tmp, 1);
/* ALCB and PGAB Control : ALCB soft ramp disable on, ALCB zero cross disable on, PGA B Gain +8dB */
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ALCB_PGAB_CTRL, &tmp, 1);
/* ADCA Attenuator : 0dB */
tmp = 0x00U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ADCA_ATTENUATOR, &tmp, 1);
/* ADCB Attenuator : 0dB */
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ADCB_ATTENUATOR, &tmp, 1);
/* ADCA mixer volume control : ADCA mixer channel mute on, ADCA mixer volume 0dB */
tmp = 0x80U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ADCA_MIXER_VOL_CTRL, &tmp, 1);
/* ADCB mixer volume control : ADCB mixer channel mute on, ADCB mixer volume 0dB */
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ADCB_MIXER_VOL_CTRL, &tmp, 1);
/* PCMA mixer volume control : PCMA mixer channel mute off, PCMA mixer volume 0dB */
tmp = 0x00U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PCMA_MIXER_VOL_CTRL, &tmp, 1);
/* PCMB mixer volume control : PCMB mixer channel mute off, PCMB mixer volume 0dB */
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PCMB_MIXER_VOL_CTRL, &tmp, 1);
/* PCM channel mixer : AOUTA Left, AOUTB Right */
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ADC_PCM_CHANNEL_MIXER, &tmp, 1);
if((pInit->OutputDevice & CS42L51_OUT_HEADPHONE) == CS42L51_OUT_HEADPHONE)
{
tmp = VOLUME_CONVERT(pInit->Volume);
/* AOUTA volume control : AOUTA volume */
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_AOUTA_VOL_CTRL, &tmp, 1);
/* AOUTB volume control : AOUTB volume */
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_AOUTB_VOL_CTRL, &tmp, 1);
}
/* ALC enable and attack rate : ALCB and ALCA enable, fastest attack */
tmp = 0x40U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ALC_ENABLE_AND_ATTACK_RATE, &tmp, 1);
/* Store current devices */
CS42L51_CurrentDevices = (pInit->OutputDevice | pInit->InputDevice);
if(ret != CS42L51_OK)
{
ret = CS42L51_ERROR;
}
return ret;
}
/**
* @brief Deinitializes the audio codec.
* @param pObj pointer to component object
* @retval Component status
*/
int32_t CS42L51_DeInit(CS42L51_Object_t *pObj)
{
if(pObj->IsInitialized == 1U)
{
pObj->IsInitialized = 0U;
}
return CS42L51_OK;
}
/**
* @brief Get the CS42L51 ID.
* @param pObj pointer to component object
* @param Id component ID
* @retval Component status
*/
int32_t CS42L51_ReadID(CS42L51_Object_t *pObj, uint32_t *Id)
{
int32_t ret;
uint8_t cs42l51_id;
/* Initialize the Control interface of the Audio Codec */
pObj->IO.Init();
/* Get ID from component */
ret = cs42l51_read_reg(&pObj->Ctx, CS42L51_CHIP_ID, &cs42l51_id, 1);
*Id = cs42l51_id;
return ret;
}
/**
* @brief Start the audio Codec play feature.
* @note For this codec no Play options are required.
* @param pObj pointer to component object
* @retval Component status
*/
int32_t CS42L51_Play(CS42L51_Object_t *pObj)
{
int32_t ret = 0;
uint8_t tmp;
if((CS42L51_CurrentDevices & CS42L51_OUT_HEADPHONE) == CS42L51_OUT_HEADPHONE)
{
/* Unmute the output first */
ret += CS42L51_SetMute(pObj, CS42L51_MUTE_OFF);
/* DAC control : Signal processing to DAC, Freeze off, De-emphasis off, Analog output auto mute off, DAC soft ramp */
tmp = 0x42U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_DAC_CTRL, &tmp, 1);
/* Power control 1 : PDN_DACA, PDN_DACB disable. */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
tmp &= 0x9FU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
}
if((CS42L51_CurrentDevices & CS42L51_IN_LINE1) == CS42L51_IN_LINE1)
{
/* ADC Input Select, Invert and Mute : AIN1B to PGAB, AIN1A to PGAA, ADCB invert off, ADCA invert off, ADCB mute off, ADCA mute off */
tmp = 0x00U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ADCX_INPUT_SELECT, &tmp, 1);
/* Power control 1 : PDN_PGAA, PDN_PGAA, PDN_ADCB, PDN_ADCA disable. */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
tmp &= 0xF9U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
/* Mic Power and Speed Control : PDN_MICA, PDN_MICB, PDN_MIC_BIAS disable. */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
tmp &= 0xFFU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
}
if((CS42L51_CurrentDevices & CS42L51_IN_MIC1) == CS42L51_IN_MIC1)
{
/* ADC Input Select, Invert and Mute : AIN1B to PGAB, AIN3A to PreAmp to PGAA, ADCB invert off, ADCA invert off, ADCB mute on, ADCA mute off */
tmp = 0x32U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_ADCX_INPUT_SELECT, &tmp, 1);
/* Power control 1 : PDN_PGAA, PDN_ADCA disable. */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
tmp &= 0xF5U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
/* Mic Power and Speed Control : PDN_MICA, PDN_MIC_BIAS disable. */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
tmp &= 0xF9U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
}
if((CS42L51_CurrentDevices & CS42L51_IN_MIC2) == CS42L51_IN_MIC2)
{
/* Power control 1 : PDN_PGAB, PDN_ADCB disable. */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
tmp &= 0xEBU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
/* Mic Power and Speed Control : PDN_MICB, PDN_MIC_BIAS disable. */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
tmp &= 0xF5U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
}
/* Power control : Exit standby (PDN = 0) */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
tmp &= 0xFEU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
return ret;
}
/**
* @brief Pauses playing on the audio codec.
* @param pObj pointer to component object
* @retval Component status
*/
int32_t CS42L51_Pause(CS42L51_Object_t *pObj)
{
/* Pause the audio file playing */
if(CS42L51_SetMute(pObj, CS42L51_MUTE_ON) != CS42L51_OK)
{
return CS42L51_ERROR;
}
return CS42L51_OK;
}
/**
* @brief Resumes playing on the audio codec.
* @param pObj pointer to component object
* @retval Component status
*/
int32_t CS42L51_Resume(CS42L51_Object_t *pObj)
{
/* Resumes the audio file playing */
return CS42L51_SetMute(pObj, CS42L51_MUTE_OFF);
}
/**
* @brief Stops audio Codec playing. It powers down the codec.
* @param pObj pointer to component object
* @param CodecPdwnMode selects the power down mode.
* - CS42L51_PDWN_SW: only mutes the audio codec. When resuming from this
* mode the codec keeps the previous initialization
* (no need to re-Initialize the codec registers).
* - CS42L51_PDWN_HW: Physically power down the codec. When resuming from this
* mode, the codec is set to default configuration
* (user should re-Initialize the codec in order to
* play again the audio stream).
* @retval Component status
*/
int32_t CS42L51_Stop(CS42L51_Object_t *pObj, uint32_t CodecPdwnMode)
{
int32_t ret;
uint8_t tmp;
/* Mute the output first */
ret = CS42L51_SetMute(pObj, CS42L51_MUTE_ON);
if (CodecPdwnMode == CS42L51_PDWN_SW)
{
/* Only output mute required*/
}
else /* CS42L51_PDWN_HW */
{
/* Set all power down bits to 1 exept PDN to mute ADCs and DACs*/
tmp = 0x7EU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
tmp |= 0x0EU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_MIC_PWR_SPEED_CTRL, &tmp, 1);
/* Disable zero cross and soft ramp */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_DAC_CTRL, &tmp, 1);
tmp &= 0xFCU;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_DAC_CTRL, &tmp, 1);
/* Power control : Enter standby (PDN = 1) */
ret += cs42l51_read_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
tmp |= 0x01U;
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_PWR_CTRL_1, &tmp, 1);
}
if(ret != CS42L51_OK)
{
ret = CS42L51_ERROR;
}
return ret;
}
/**
* @brief Set higher or lower the codec volume level.
* @param pObj pointer to component object
* @param InputOutput Input or Output volume
* @param Volume a byte value from 0 to 255
* (refer to codec registers description for more details).
* @retval Component status
*/
int32_t CS42L51_SetVolume(CS42L51_Object_t *pObj, uint32_t InputOutput, uint8_t Volume)
{
int32_t ret;
uint8_t convertedvol;
if(InputOutput != VOLUME_OUTPUT)
{
ret = CS42L51_ERROR;
}
else
{
convertedvol = VOLUME_CONVERT(Volume);
/* AOUTA volume control : AOUTA volume */
ret = cs42l51_write_reg(&pObj->Ctx, CS42L51_AOUTA_VOL_CTRL, &convertedvol, 1);
/* AOUTB volume control : AOUTB volume */
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_AOUTB_VOL_CTRL, &convertedvol, 1);
}
if(ret != CS42L51_OK)
{
ret = CS42L51_ERROR;
}
return ret;
}
/**
* @brief Get higher or lower the codec volume level.
* @param pObj pointer to component object
* @param InputOutput Input or Output volume
* @param Volume audio volume
* @retval Component status
*/
int32_t CS42L51_GetVolume(CS42L51_Object_t *pObj, uint32_t InputOutput, uint8_t *Volume)
{
int32_t ret;
uint8_t tmp;
if(InputOutput != VOLUME_OUTPUT)
{
ret = CS42L51_ERROR;
}
else
{
ret = cs42l51_read_reg(&pObj->Ctx, CS42L51_AOUTA_VOL_CTRL, &tmp, 1);
*Volume = VOLUME_INVERT(tmp);
}
return ret;
}
/**
* @brief Enables or disables the mute feature on the audio codec.
* @param pObj pointer to component object
* @param Cmd CS42L51_MUTE_ON to enable the mute or CS42L51_MUTE_OFF to disable the
* mute mode.
* @retval Component status
*/
int32_t CS42L51_SetMute(CS42L51_Object_t *pObj, uint32_t Cmd)
{
int32_t ret;
uint8_t tmp;
ret = cs42l51_read_reg(&pObj->Ctx, CS42L51_DAC_OUTPUT_CTRL, &tmp, 1);
/* Set the Mute mode */
if(Cmd == CS42L51_MUTE_ON)
{
tmp |= 0x03U;
}
else /* CS42L51_MUTE_OFF Disable the Mute */
{
tmp &= 0xFCU;
}
ret += cs42l51_write_reg(&pObj->Ctx, CS42L51_DAC_OUTPUT_CTRL, &tmp, 1);
if(ret != CS42L51_OK)
{
ret = CS42L51_ERROR;
}
return ret;
}
/**
* @brief Switch dynamically (while audio file is played) the output target
* (speaker or headphone).
* @param pObj pointer to component object
* @param Output Only CS42L51_OUT_HEADPHONE output is supported
* @retval Component status
*/
int32_t CS42L51_SetOutputMode(CS42L51_Object_t *pObj, uint32_t Output)
{
(void)(pObj);
(void)(Output);
/* This feature is not supported */
return CS42L51_ERROR;
}
/**
* @brief Set Audio resolution.
* @param pObj pointer to component object
* @param Resolution Audio resolution. Can be:
* CS42L51_RESOLUTION_16b, CS42L51_RESOLUTION_18b,
* CS42L51_RESOLUTION_20b or CS42L51_RESOLUTION_24b
* @note This is applicable only for CS42L51_PROTOCOL_R_JUSTIFIED protocol
* @retval Component status
*/
int32_t CS42L51_SetResolution(CS42L51_Object_t *pObj, uint32_t Resolution)
{
(void)(pObj);
(void)(Resolution);
/* This feature is not supported */
return CS42L51_ERROR;
}
/**
* @brief Get Audio resolution.
* @param pObj pointer to component object
* @retval Audio resolution
*/
int32_t CS42L51_GetResolution(CS42L51_Object_t *pObj, uint32_t *Resolution)
{
(void)(pObj);
(void)(Resolution);
/* This feature is not supported */
return CS42L51_ERROR;
}
/**
* @brief Set Audio Protocol.
* @param pObj pointer to component object
* @param Protocol Audio Protocol. Can be:
* CS42L51_PROTOCOL_R_JUSTIFIED, CS42L51_PROTOCOL_L_JUSTIFIED
* or CS42L51_PROTOCOL_I2S
* @retval Component status
*/
int32_t CS42L51_SetProtocol(CS42L51_Object_t *pObj, uint32_t Protocol)
{
(void)(pObj);
(void)(Protocol);
/* This feature is not supported */
return CS42L51_ERROR;
}
/**
* @brief Get Audio Protocol.
* @param pObj pointer to component object
* @param Protocol pointer to protocol value
* @retval Component status
*/
int32_t CS42L51_GetProtocol(CS42L51_Object_t *pObj, uint32_t *Protocol)
{
(void)(pObj);
(void)(Protocol);
/* This feature is not supported */
return CS42L51_ERROR;
}
/**
* @brief Sets new frequency.
* @param pObj pointer to component object
* @param AudioFreq Audio frequency
* @retval Component status
*/
int32_t CS42L51_SetFrequency(CS42L51_Object_t *pObj, uint32_t AudioFreq)
{
(void)(pObj);
(void)(AudioFreq);
/* This feature is not supported */
return CS42L51_ERROR;
}
/**
* @brief Get frequency.
* @param pObj pointer to component object
* @param AudioFreq Audio frequency
* @retval Component status
*/
int32_t CS42L51_GetFrequency(CS42L51_Object_t *pObj, uint32_t *AudioFreq)
{
(void)(pObj);
(void)(AudioFreq);
/* This feature is not supported */
return CS42L51_ERROR;
}
/**
* @brief Resets cs42l51 registers.
* @param pObj pointer to component object
* @retval Component status
*/
int32_t CS42L51_Reset(CS42L51_Object_t *pObj)
{
/* De-Initialize Audio Codec interface */
pObj->IO.DeInit();
/* Initialize Audio Codec interface */
pObj->IO.Init();
return CS42L51_OK;
}
/******************** Static functions ****************************************/
/**
* @brief Function
* @param Component object pointer
* @retval error status
*/
int32_t CS42L51_RegisterBusIO (CS42L51_Object_t *pObj, CS42L51_IO_t *pIO)
{
int32_t ret;
if (pObj == NULL)
{
ret = CS42L51_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 = CS42L51_ReadRegWrap;
pObj->Ctx.WriteReg = CS42L51_WriteRegWrap;
pObj->Ctx.handle = pObj;
if(pObj->IO.Init != NULL)
{
ret = pObj->IO.Init();
}
else
{
ret = CS42L51_ERROR;
}
}
return ret;
}
/**
* @brief Function
* @param handle Component object handle
* @param Reg The target register address to write
* @param pData The target register value to be written
* @param Length buffer size to be written
* @retval error status
*/
static int32_t CS42L51_ReadRegWrap(void *handle, uint16_t Reg, uint8_t* pData, uint16_t Length)
{
CS42L51_Object_t *pObj = (CS42L51_Object_t *)handle;
return pObj->IO.ReadReg(pObj->IO.Address, Reg, pData, Length);
}
/**
* @brief Function
* @param handle Component object handle
* @param Reg The target register address to write
* @param pData The target register value to be written
* @param Length buffer size to be written
* @retval error status
*/
static int32_t CS42L51_WriteRegWrap(void *handle, uint16_t Reg, uint8_t* pData, uint16_t Length)
{
CS42L51_Object_t *pObj = (CS42L51_Object_t *)handle;
return pObj->IO.WriteReg(pObj->IO.Address, Reg, pData, Length);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,219 @@
/**
******************************************************************************
* @file cs42l51.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the
* cs42l51.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 CS42L51_H
#define CS42L51_H
/* Includes ------------------------------------------------------------------*/
#include "cs42l51_reg.h"
#include <stddef.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup CS42L51
* @{
*/
typedef int32_t (*CS42L51_Init_Func) (void);
typedef int32_t (*CS42L51_DeInit_Func) (void);
typedef int32_t (*CS42L51_GetTick_Func) (void);
typedef int32_t (*CS42L51_Delay_Func) (uint32_t);
typedef int32_t (*CS42L51_WriteReg_Func)(uint16_t, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*CS42L51_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
typedef struct
{
CS42L51_Init_Func Init;
CS42L51_DeInit_Func DeInit;
uint16_t Address;
CS42L51_WriteReg_Func WriteReg;
CS42L51_ReadReg_Func ReadReg;
CS42L51_GetTick_Func GetTick;
} CS42L51_IO_t;
typedef struct
{
CS42L51_IO_t IO;
cs42l51_ctx_t Ctx;
uint8_t IsInitialized;
} CS42L51_Object_t;
typedef struct
{
uint32_t InputDevice;
uint32_t OutputDevice;
uint32_t Frequency;
uint32_t Resolution;
uint32_t Volume;
} CS42L51_Init_t;
typedef struct
{
int32_t ( *Init ) ( CS42L51_Object_t *, CS42L51_Init_t* );
int32_t ( *DeInit ) ( CS42L51_Object_t * );
int32_t ( *ReadID ) ( CS42L51_Object_t *, uint32_t * );
int32_t ( *Play ) ( CS42L51_Object_t * );
int32_t ( *Pause ) ( CS42L51_Object_t * );
int32_t ( *Resume ) ( CS42L51_Object_t * );
int32_t ( *Stop ) ( CS42L51_Object_t *, uint32_t );
int32_t ( *SetFrequency ) ( CS42L51_Object_t *, uint32_t );
int32_t ( *GetFrequency ) ( CS42L51_Object_t *, uint32_t*);
int32_t ( *SetVolume ) ( CS42L51_Object_t *, uint32_t, uint8_t );
int32_t ( *GetVolume ) ( CS42L51_Object_t *, uint32_t, uint8_t*);
int32_t ( *SetMute ) ( CS42L51_Object_t *, uint32_t );
int32_t ( *SetOutputMode ) ( CS42L51_Object_t *, uint32_t );
int32_t ( *SetResolution ) ( CS42L51_Object_t *, uint32_t );
int32_t ( *GetResolution ) ( CS42L51_Object_t *, uint32_t*);
int32_t ( *SetProtocol ) ( CS42L51_Object_t *, uint32_t );
int32_t ( *GetProtocol ) ( CS42L51_Object_t *, uint32_t*);
int32_t ( *Reset ) ( CS42L51_Object_t * );
} CS42L51_Drv_t;
/** @defgroup CS42L51_Exported_Constants
* @{
*/
#define CS42L51_OK (0)
#define CS42L51_ERROR (-1)
/******************************************************************************/
/*************************** Codec User defines ******************************/
/******************************************************************************/
/* Audio Input Device */
#define CS42L51_IN_NONE 0x0000U
#define CS42L51_IN_MIC1 0x0100U
#define CS42L51_IN_MIC2 0x0200U
#define CS42L51_IN_LINE1 0x0400U
#define CS42L51_IN_LINE2 0x0800U
#define CS42L51_IN_LINE3 0x1000U
/* Audio Output Device */
#define CS42L51_OUT_NONE 0x0000U
#define CS42L51_OUT_HEADPHONE 0x0001U
/* AUDIO FREQUENCY */
#define CS42L51_FREQUENCY_192K 192000
#define CS42L51_FREQUENCY_176K 176400
#define CS42L51_FREQUENCY_96K 96000
#define CS42L51_FREQUENCY_88K 88200
#define CS42L51_FREQUENCY_48K 48000
#define CS42L51_FREQUENCY_44K 44100
#define CS42L51_FREQUENCY_32K 32000
#define CS42L51_FREQUENCY_22K 22050
#define CS42L51_FREQUENCY_16K 16000
#define CS42L51_FREQUENCY_11K 11025
#define CS42L51_FREQUENCY_8K 8000
/* AUDIO RESOLUTION */
#define CS42L51_RESOLUTION_16b 0x05U
#define CS42L51_RESOLUTION_18b 0x04U
#define CS42L51_RESOLUTION_20b 0x03U
#define CS42L51_RESOLUTION_24b 0x02U
/* Codec stop options */
#define CS42L51_PDWN_HW 0x00U
#define CS42L51_PDWN_SW 0x01U
/* Volume Input Output selection */
#define VOLUME_INPUT 0U
#define VOLUME_OUTPUT 1U
/* MUTE commands */
#define CS42L51_MUTE_ON 1U
#define CS42L51_MUTE_OFF 0U
/* AUDIO PROTOCOL */
#define CS42L51_PROTOCOL_L_JUSTIFIED 0U
#define CS42L51_PROTOCOL_I2S 1U
#define CS42L51_PROTOCOL_R_JUSTIFIED 2U
#define VOLUME_CONVERT(Volume) (((Volume) >= 100U) ? 0U : ((uint8_t)((((Volume) * 2U) + 56U))))
#define VOLUME_INVERT(Volume) (((Volume) == 0U) ? 100U : ((uint8_t)(((Volume) - 56U) / 2U)))
/**
* @brief CS42L51 ID
*/
#define CS42L51_ID 0xD8U
#define CS42L51_ID_MASK 0xF8U
/** @defgroup CS42L51_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup CS42L51_Exported_Functions
* @{
*/
/*------------------------------------------------------------------------------
Audio Codec functions
------------------------------------------------------------------------------*/
/* High Layer codec functions */
int32_t CS42L51_RegisterBusIO (CS42L51_Object_t *pObj, CS42L51_IO_t *pIO);
int32_t CS42L51_Init(CS42L51_Object_t *pObj, CS42L51_Init_t *pInit);
int32_t CS42L51_DeInit(CS42L51_Object_t *pObj);
int32_t CS42L51_ReadID(CS42L51_Object_t *pObj, uint32_t *Id);
int32_t CS42L51_Play(CS42L51_Object_t *pObj);
int32_t CS42L51_Pause(CS42L51_Object_t *pObj);
int32_t CS42L51_Resume(CS42L51_Object_t *pObj);
int32_t CS42L51_Stop(CS42L51_Object_t *pObj, uint32_t CodecPdwnMode);
int32_t CS42L51_SetVolume(CS42L51_Object_t *pObj, uint32_t InputOutput, uint8_t Volume);
int32_t CS42L51_GetVolume(CS42L51_Object_t *pObj, uint32_t InputOutput, uint8_t *Volume);
int32_t CS42L51_SetMute(CS42L51_Object_t *pObj, uint32_t Cmd);
int32_t CS42L51_SetOutputMode(CS42L51_Object_t *pObj, uint32_t Output);
int32_t CS42L51_SetResolution(CS42L51_Object_t *pObj, uint32_t Resolution);
int32_t CS42L51_GetResolution(CS42L51_Object_t *pObj, uint32_t *Resolution);
int32_t CS42L51_SetProtocol(CS42L51_Object_t *pObj, uint32_t Protocol);
int32_t CS42L51_GetProtocol(CS42L51_Object_t *pObj, uint32_t *Protocol);
int32_t CS42L51_SetFrequency(CS42L51_Object_t *pObj, uint32_t AudioFreq);
int32_t CS42L51_GetFrequency(CS42L51_Object_t *pObj, uint32_t *AudioFreq);
int32_t CS42L51_Reset(CS42L51_Object_t *pObj);
/* Audio driver structure */
extern CS42L51_Drv_t CS42L51_Driver;
#endif /* CS42L51_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,76 @@
/**
******************************************************************************
* @file cs42l51_reg.c
* @author MCD Application Team
* @brief This file provides unitary register function to control the CS42L51
* Audio Codec driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 "cs42l51_reg.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup cs42l51
* @brief This file provides a set of functions needed to drive the
* CS42L51 audio codec.
* @{
*/
/************** Generic Function *******************/
/*******************************************************************************
* Function Name : cs42l51_read_reg
* Description : Generic Reading function. It must be fullfilled with either
* I2C or SPI reading functions
* Input : Register Address, length of buffer
* Output : data Read
*******************************************************************************/
int32_t cs42l51_read_reg(cs42l51_ctx_t *ctx, uint16_t reg, uint8_t* data, uint16_t length)
{
return ctx->ReadReg(ctx->handle, reg, data, length);
}
/*******************************************************************************
* Function Name : cs42l51_write_reg
* Description : Generic Writing function. It must be fullfilled with either
* I2C or SPI writing function
* Input : Register Address, data to be written, length of buffer
* Output : None
*******************************************************************************/
int32_t cs42l51_write_reg(cs42l51_ctx_t *ctx, uint16_t reg, uint8_t *data, uint16_t length)
{
return ctx->WriteReg(ctx->handle, reg, data, length);
}
/******************************************************************************/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,128 @@
/**
******************************************************************************
* @file cs42l51_reg.h
* @author MCD Application Team
* @brief Header of cs42l51_reg.c
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 CS42L51_REG_H
#define CS42L51_REG_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup CS42L51
* @{
*/
/** @defgroup CS42L51_Exported_Constants CS42L51 Exported Constants
* @{
*/
/******************************************************************************/
/****************************** REGISTER MAPPING ******************************/
/******************************************************************************/
#define CS42L51_CHIP_ID 0x01U
#define CS42L51_PWR_CTRL_1 0x02U
#define CS42L51_MIC_PWR_SPEED_CTRL 0x03U
#define CS42L51_INTERFACE_CTRL 0x04U
#define CS42L51_MIC_CTRL 0x05U
#define CS42L51_ADC_CTRL 0x06U
#define CS42L51_ADCX_INPUT_SELECT 0x07U
#define CS42L51_DAC_OUTPUT_CTRL 0x08U
#define CS42L51_DAC_CTRL 0x09U
#define CS42L51_ALCA_PGAA_CTRL 0x0AU
#define CS42L51_ALCB_PGAB_CTRL 0x0BU
#define CS42L51_ADCA_ATTENUATOR 0x0CU
#define CS42L51_ADCB_ATTENUATOR 0x0DU
#define CS42L51_ADCA_MIXER_VOL_CTRL 0x0EU
#define CS42L51_ADCB_MIXER_VOL_CTRL 0x0FU
#define CS42L51_PCMA_MIXER_VOL_CTRL 0x10U
#define CS42L51_PCMB_MIXER_VOL_CTRL 0x11U
#define CS42L51_BEEP_FREQ_AND_TIMING_CFG 0x12U
#define CS42L51_BEEP_OFF_TIME_AND_VOL 0x13U
#define CS42L51_BEEP_CFG_AND_TONE_CFG 0x14U
#define CS42L51_TONE_CTRL 0x15U
#define CS42L51_AOUTA_VOL_CTRL 0x16U
#define CS42L51_AOUTB_VOL_CTRL 0x17U
#define CS42L51_ADC_PCM_CHANNEL_MIXER 0x18U
#define CS42L51_LIMITER_THR_SZC_DISABLE 0x19U
#define CS42L51_LIMITER_RELEASE_RATE_REG 0x1AU
#define CS42L51_LIMITER_ATTACK_RATE_REG 0x1BU
#define CS42L51_ALC_ENABLE_AND_ATTACK_RATE 0x1CU
#define CS42L51_ALC_RELEASE_RATE 0x1DU
#define CS42L51_ALC_THR 0x1EU
#define CS42L51_NOISE_GATE_CFG_AND_MISC 0x1FU
#define CS42L51_STATUS 0x20U
#define CS42L51_CHARGE_PUMP_FREQ 0x21U
/**
* @}
*/
/************** Generic Function *******************/
typedef int32_t (*CS42L51_Write_Func)(void *, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*CS42L51_Read_Func) (void *, uint16_t, uint8_t*, uint16_t);
typedef struct
{
CS42L51_Write_Func WriteReg;
CS42L51_Read_Func ReadReg;
void *handle;
} cs42l51_ctx_t;
/*******************************************************************************
* Register : Generic - All
* Address : Generic - All
* Bit Group Name: None
* Permission : W
*******************************************************************************/
int32_t cs42l51_write_reg(cs42l51_ctx_t *ctx, uint16_t reg, uint8_t *data, uint16_t length);
int32_t cs42l51_read_reg(cs42l51_ctx_t *ctx, uint16_t reg, uint8_t* data, uint16_t length);
#ifdef __cplusplus
}
#endif
#endif /* CS42L51_REG_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,73 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team via this [link](https://www.st.com/content/st_com/en/contact-us.html).
All complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4,
available [here](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html).
For answers to common questions about this code of conduct, see the [FAQ section](https://www.contributor-covenant.org/faq).

View file

@ -0,0 +1,40 @@
# Contributing guide
This guide serves as a checklist before contributing to this repository. It mainly focuses on the steps to follow to submit an issue or a pull-request.
## 1. Issues
### 1.1 Before opening an issue
Please check the following points before posting an issue:
* Make sure you are using the latest commit (major releases are tagged, but corrections are available as new commits).
* Make sure your issue is a question/feedback/suggestions **related to** the software provided in this repository. Otherwise, please refer to section [3](CONTRIBUTING.md#3-support-requests-and-questions) below.
* Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue. Do not forget to browse into the **closed** issues.
### 1.2 Posting the issue
When you have checked the previous points, create a new report from the **Issues** tab of this repository. A template is available [here](../../issues/new/choose) to help you report the issue you are facing or the enhancement you would like to propose.
## 2. Pull Requests
### 2.1 Before opening a pull-request
STMicrolectronics is happy to receive contributions from the community, based on an initial Contributor License Agreement (CLA) procedure.
* If you are an individual writing original source code and you are sure **you own the intellectual property**, then you need to sign an Individual [CLA](https://cla.st.com).
* If you work for a company that wants also to allow you to contribute with your work, your company needs to provide a Corporate [CLA](https://cla.st.com) mentioning your GitHub account name.
* If you are not sure that a CLA (Individual or Corporate) has been signed for your GitHub account you can check the [CLA](https://cla.st.com) dedicated page.
Please note that:
* The Corporate CLA will always take precedence over the Individual CLA.
* One CLA submission is sufficient, for any project proposed by STMicroelectronics.
### 2.2 How to proceed
* We recommend to engage first a communication thru an issue, in order to present your proposal, just to confirm that it corresponds to STMicroelectronics' domain or scope.
* Then fork the project to your GitHub account to further develop your contribution. Please use the latest commit version.
* Please, submit one pull-request per new feature or proposal. This will ease the analysis and the final merge if accepted.
## 3. Support requests and questions
For support requests or any other question related to the product, the tools, the environment, you can submit a post to the **ST Community** on the appropriate topic [page](https://community.st.com/s/topiccatalog).

View file

@ -0,0 +1,34 @@
# BSP STM32-ES-WIFI ES WIFI Component
![latest tag](https://img.shields.io/github/v/tag/STMicroelectronics/stm32-es-wifi.svg?color=brightgreen)
## Overview
**STM32Cube** is an STMicroelectronics original initiative to ease developers' life by reducing efforts, time and cost.
**STM32Cube** covers the overall STM32 products portfolio. It includes a comprehensive embedded software platform delivered for each STM32 series.
* The CMSIS modules (core and device) corresponding to the ARM(tm) core implemented in this STM32 product.
* The STM32 HAL-LL drivers, an abstraction layer offering a set of APIs ensuring maximized portability across the STM32 portfolio.
* The BSP drivers of each evaluation, demonstration or nucleo board provided for this STM32 series.
* A consistent set of middleware libraries such as RTOS, USB, FatFS, graphics, touch sensing library...
* A full set of software projects (basic examples, applications, and demonstrations) for each board provided for this STM32 series.
Two models of publication are proposed for the STM32Cube embedded software:
* The monolithic **MCU Package**: all STM32Cube software modules of one STM32 series are present (Drivers, Middleware, Projects, Utilities) in the repository (usual name **STM32Cubexx**, xx corresponding to the STM32 series).
* The **MCU component**: each STM32Cube software module being part of the STM32Cube MCU Package, is delivered as an individual repository, allowing the user to select and get only the required software functions.
## Description
This **stm32-es-wifi** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **ES-WIFI** BSP component part.
## Release note
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/stm32-es-wifi/blob/main/Release_Notes.html).
## Compatibility information
Please refer to the repository of the BSP **board** driver you are using to know which version of this BSP component driver to use. It is **crucial** that you use a consistent set of versions as indicated.
## Troubleshooting
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) guide.

View file

@ -0,0 +1,147 @@
<!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 ES_WIFI 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-es_wifi-component-driver"><small>Release Notes for</small> <mark>ES_WIFI Component Driver</mark></h1>
<p>Copyright © 2017 STMicroelectronics<br />
Microcontrollers Division - Application Team</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 ES_WIFI component driver.</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-section25" checked aria-hidden="true"> <label for="collapse-section25" aria-hidden="true">V1.6.0 / 09-Apr-2020</label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Add country code definition in configuration file to allow higher WiFi channels support</li>
<li>Replaced strtok() by strtok_r() to be thread-safe</li>
<li>Add Sock info and Peer info functions</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section24" aria-hidden="true"> <label for="collapse-section24" aria-hidden="true">V1.5.0 / 21-Nov-2019</label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>Add partial support of new Inventek Module for Tiny Shark board</li>
<li>Fix MISRA deviation</li>
<li>Improve embedded TLS support API</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section23" aria-hidden="true"> <label for="collapse-section23" aria-hidden="true">V1.4.0 / 03-July-2019</label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>Set a default value to read and write time-out when non blocking</li>
<li>Add ES_WIFI_MAX_SO_TIMEOUT</li>
<li>Apply new template for sources</li>
<li>New release notes format</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section22" aria-hidden="true"> <label for="collapse-section22" aria-hidden="true">V1.3.0 / 10-Sept-2018</label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>Add support of TLS connection based on internal WIFI module support</li>
<li>Ability to list Access Point one by one from Inventek firmware version 3.5.2.5</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section20" aria-hidden="true"> <label for="collapse-section20" aria-hidden="true">V1.2.0 / 24-July-2018</label>
<div>
<h2 id="main-changes-4">Main Changes</h2>
<ul>
<li>Add parameter to ES_WIFI_Ping() API to get the time for each ping.</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.2 / 07-June-2018</label>
<div>
<h2 id="main-changes-5">Main Changes</h2>
<ul>
<li>Fix in UDP support along new Inventek FW versions &gt;= C3.5.2.4.STM.RC11</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section185" aria-hidden="true"> <label for="collapse-section185" aria-hidden="true">V1.1.1 / 27-February-2018</label>
<div>
<h2 id="main-changes-6">Main Changes</h2>
<ul>
<li>Improve TCP server command</li>
<li>Improve Robustness on potential memory overflows</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section18" aria-hidden="true"> <label for="collapse-section18" aria-hidden="true">V1.1.0 / 05-February-2018</label>
<div>
<h2 id="main-changes-7">Main Changes</h2>
<ul>
<li>Support for UDP sockets</li>
<li>Spport for projects using RTOS</li>
<li>Fix issue on never ending reads on stuffing bits</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section17" aria-hidden="true"> <label for="collapse-section17" aria-hidden="true">V1.0.1 / 31-August-2017</label>
<div>
<h2 id="main-changes-8">Main Changes</h2>
<ul>
<li>Corrections for ES_WIFI WiFi component.</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section16" aria-hidden="true"> <label for="collapse-section16" aria-hidden="true">V1.0.0 / 23-February-2017</label>
<div>
<h2 id="main-changes-9">Main Changes</h2>
<ul>
<li>First official release of ES_WIFI WiFi component.</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,31 @@
# Report potential product security vulnerabilities
ST places a high priority on security, and our Product Security Incident
Response Team (PSIRT) is committed to rapidly addressing potential security
vulnerabilities affecting our products. PSIRT's long history and vast experience
in security allows ST to perform clear analyses and provide appropriate guidance
on mitigations and solutions when applicable.
If you wish to report potential security vulnerabilities regarding our products,
**please do not report them through public GitHub issues.** Instead, we
encourage you to report them to our ST PSIRT following the process described at:
**https://www.st.com/content/st_com/en/security/report-vulnerabilities.html**
### IMPORTANT - READ CAREFULLY:
STMicroelectronics International N.V., on behalf of itself, its affiliates and
subsidiaries, (collectively “ST”) takes all potential security vulnerability
reports or other related communications (“Report(s)”) seriously. In order to
review Your Report (the terms “You” and “Yours” include your employer, and all
affiliates, subsidiaries and related persons or entities) and take actions as
deemed appropriate, ST requires that we have the rights and Your permission to
do so.
As such, by submitting Your Report to ST, You agree that You have the right to
do so, and You grant to ST the rights to use the Report for purposes related to
security vulnerability analysis, testing, correction, patching, reporting and
any other related purpose or function.
By submitting Your Report, You agree that STs
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
applies to all related communications.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,359 @@
/**
******************************************************************************
* @file es_wifi.h
* @author MCD Application Team
* @brief header file for the es_wifi module.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 ES_WIFI_H
#define ES_WIFI_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/*cstat -MISRAC2012-Dir-4.10 */
#include "stdint.h"
#include "string.h"
#include "stdbool.h"
#include "stdio.h"
#include "es_wifi_conf.h"
/*cstat +MISRAC2012-Dir-4.10 */
/* Exported Constants --------------------------------------------------------*/
#define ES_WIFI_PAYLOAD_SIZE 1200
#define ES_WIFI_MAX_SO_TIMEOUT 30000
typedef int8_t (*IO_Init_Func)(uint16_t );
typedef int8_t (*IO_DeInit_Func)( void);
typedef void (*IO_Delay_Func)(uint32_t);
typedef int16_t (*IO_Send_Func)( uint8_t *, uint16_t len, uint32_t);
typedef int16_t (*IO_Receive_Func)(uint8_t *, uint16_t len, uint32_t);
/* Exported typedef ----------------------------------------------------------*/
typedef enum {
ES_WIFI_INIT = 0,
ES_WIFI_RESET = 1
}
ES_WIFI_InitMode_t;
typedef enum {
ES_WIFI_STATUS_OK = 0,
ES_WIFI_STATUS_REQ_DATA_STAGE = 1,
ES_WIFI_STATUS_ERROR = 2,
ES_WIFI_STATUS_TIMEOUT = 3,
ES_WIFI_STATUS_IO_ERROR = 4,
ES_WIFI_STATUS_UNEXPECTED_CLOSED_SOCKET = 5,
ES_WIFI_STATUS_MODULE_CRASH = 6
} ES_WIFI_Status_t;
#define ES_WIFI_ERROR_SPI_FAILED -1
#define ES_WIFI_ERROR_WAITING_DRDY_RISING -2
#define ES_WIFI_ERROR_WAITING_DRDY_FALLING -3
#define ES_WIFI_ERROR_STUFFING_FOREVER -4
#define ES_WIFI_ERROR_SPI_INIT -5
typedef enum {
ES_WIFI_MODE_SINGLE = 0,
ES_WIFI_MODE_MULTI = 1,
} ES_WIFI_ConnMode_t;
typedef enum {
ES_WIFI_TCP_CONNECTION = 0,
ES_WIFI_UDP_CONNECTION = 1,
ES_WIFI_UDP_LITE_CONNECTION = 2,
ES_WIFI_TCP_SSL_CONNECTION = 3,
ES_WIFI_MQTT_CONNECTION = 4,
} ES_WIFI_ConnType_t;
/* Security settings for wifi network */
typedef enum {
ES_WIFI_SEC_OPEN = 0x00, /*!< Wifi is open */
ES_WIFI_SEC_WEP = 0x01, /*!< Wired Equivalent Privacy option for wifi security. \note This mode can't be used when setting up ES_WIFI wifi */
ES_WIFI_SEC_WPA = 0x02, /*!< Wi-Fi Protected Access */
ES_WIFI_SEC_WPA2 = 0x03, /*!< Wi-Fi Protected Access 2 */
ES_WIFI_SEC_WPA_WPA2= 0x04, /*!< Wi-Fi Protected Access with both modes */
ES_WIFI_SEC_WPA2_TKIP= 0x05, /*!< Wi-Fi Protected Access with both modes */
ES_WIFI_SEC_UNKNOWN = 0xFF, /*!< Wi-Fi Unknown Security mode */
} ES_WIFI_SecurityType_t;
typedef enum {
ES_WIFI_IPV4 = 0x00,
ES_WIFI_IPV6 = 0x01,
} ES_WIFI_IPVer_t;
typedef enum {
ES_WIFI_AP_NONE = 0x00,
ES_WIFI_AP_ASSIGNED = 0x01,
ES_WIFI_AP_JOINED = 0x02,
ES_WIFI_AP_ERROR = 0xFF,
} ES_WIFI_APState_t;
typedef enum {
ES_WIFI_FUNCTION_TLS = 0x00,
ES_WIFI_FUNCTION_AWS = 0x01,
} ES_WIFI_CredsFunction_t;
typedef enum {
ES_WIFI_TLS_CHECK_NOTHING = 0x00,
ES_WIFI_TLS_CHECK_ROOTCA = 0x01,
ES_WIFI_TLS_CHECK_DEVICE_CERTS = 0x02
} ES_WIFI_TlsCheckCertificatMode_t;
#define ES_WIFI_TLS_MULTIPLE_WRITE_SLOT 3
typedef struct
{
uint32_t Port;
uint32_t BaudRate;
uint32_t DataWidth;
uint32_t Parity;
uint32_t StopBits;
uint32_t Mode;
} ES_WIFI_UARTConfig_t;
typedef struct
{
uint32_t Configuration;
uint32_t WPSPin;
uint32_t VID;
uint32_t PID;
uint8_t MAC[6];
uint8_t AP_IPAddress[4];
uint32_t PS_Mode;
uint32_t RadioMode;
uint32_t CurrentBeacon;
uint32_t PrevBeacon;
uint32_t ProductName;
} ES_WIFI_SystemConfig_t;
typedef struct {
uint8_t* Address; /*!< Pointer to domain or IP to ping */
uint32_t Time; /*!< Time in milliseconds needed for pinging */
uint8_t Success; /*!< Status indicates if ping was successful */
} ES_WIFI_Ping_t;
typedef struct {
uint8_t SSID[ES_WIFI_MAX_SSID_NAME_SIZE + 1]; /*!< Service Set Identifier value.Wi-Fi spot name */
ES_WIFI_SecurityType_t Security; /*!< Security of Wi-Fi spot. */
int16_t RSSI; /*!< Signal strength of Wi-Fi spot */
uint8_t MAC[6]; /*!< MAC address of spot */
uint8_t Channel; /*!< Wi-Fi channel */
} ES_WIFI_AP_t;
/* Access point configuration */
typedef struct {
uint8_t SSID[ES_WIFI_MAX_SSID_NAME_SIZE + 1]; /*!< Network public name for ESP AP mode */
uint8_t Pass[ES_WIFI_MAX_PSWD_NAME_SIZE + 1]; /*!< Network password for ESP AP mode */
ES_WIFI_SecurityType_t Security; /*!< Security of Wi-Fi access point */
uint8_t Channel; /*!< Channel Wi-Fi is operating at */
uint8_t MaxConnections; /*!< Max number of stations that are allowed to connect to ESP AP, between 1 and 4 */
uint8_t Hidden; /*!< Set to 1 if network is hidden (not broadcast) or zero if visible */
} ES_WIFI_APConfig_t;
typedef struct {
uint8_t SSID[ES_WIFI_MAX_SSID_NAME_SIZE + 1]; /*!< Network public name for ESP AP mode */
uint8_t IP_Addr[4]; /*!< IP Address */
uint8_t MAC_Addr[6]; /*!< MAC address */
} ES_WIFI_APSettings_t;
typedef struct {
ES_WIFI_AP_t AP[ES_WIFI_MAX_DETECTED_AP];
uint8_t nbr;
} ES_WIFI_APs_t;
typedef struct {
uint8_t SSID[ES_WIFI_MAX_SSID_NAME_SIZE + 1];
uint8_t pswd[ES_WIFI_MAX_PSWD_NAME_SIZE + 1];
ES_WIFI_SecurityType_t Security;
uint8_t DHCP_IsEnabled;
uint8_t JoinRetries;
uint8_t IsConnected;
uint8_t AutoConnect;
ES_WIFI_IPVer_t IP_Ver;
uint8_t IP_Addr[4];
uint8_t IP_Mask[4];
uint8_t Gateway_Addr[4];
uint8_t DNS1[4];
uint8_t DNS2[4];
} ES_WIFI_Network_t;
typedef struct {
ES_WIFI_ConnType_t Protocol;
uint8_t Local_IP_Addr[4];
uint16_t Local_Port;
uint8_t Remote_IP_Addr[4];
uint16_t Remote_Port;
uint8_t TCP_Server;
uint8_t UDP_Server;
uint8_t TCP_Backlogs;
uint8_t Accept_Loop;
uint8_t Read_Mode;
} ES_WIFI_Transport_t;
#if (ES_WIFI_USE_AWS == 1)
typedef struct {
ES_WIFI_ConnType_t Type;
uint8_t Number;
uint16_t RemotePort;
uint8_t RemoteIP[4];
uint8_t *PublishTopic;
uint8_t *SubscribeTopic;
uint8_t *ClientID;
uint8_t MQTTMode;
} ES_WIFI_AWS_Conn_t;
#endif
typedef struct {
ES_WIFI_ConnType_t Type;
ES_WIFI_TlsCheckCertificatMode_t TLScheckMode;
uint8_t Number;
uint16_t RemotePort;
uint16_t LocalPort;
uint8_t RemoteIP[4];
char* Name;
uint8_t Backlog;
} ES_WIFI_Conn_t;
typedef struct {
IO_Init_Func IO_Init;
IO_DeInit_Func IO_DeInit;
IO_Delay_Func IO_Delay;
IO_Send_Func IO_Send;
IO_Receive_Func IO_Receive;
} ES_WIFI_IO_t;
typedef struct {
uint8_t Product_ID[ES_WIFI_PRODUCT_ID_SIZE];
uint8_t FW_Rev[ES_WIFI_FW_REV_SIZE];
uint8_t API_Rev[ES_WIFI_API_REV_SIZE];
uint8_t Stack_Rev[ES_WIFI_STACK_REV_SIZE];
uint8_t RTOS_Rev[ES_WIFI_RTOS_REV_SIZE];
uint8_t Product_Name[ES_WIFI_PRODUCT_NAME_SIZE];
uint32_t CPU_Clock;
ES_WIFI_SecurityType_t Security;
ES_WIFI_Network_t NetSettings;
ES_WIFI_APSettings_t APSettings;
ES_WIFI_IO_t fops;
uint8_t CmdData[ES_WIFI_DATA_SIZE];
uint32_t Timeout;
uint32_t BufferSize;
} ES_WIFIObject_t;
/* Exported functions --------------------------------------------------------*/
ES_WIFI_Status_t ES_WIFI_Init(ES_WIFIObject_t *Obj);
ES_WIFI_Status_t ES_WIFI_DeInit(ES_WIFIObject_t *Obj);
ES_WIFI_Status_t ES_WIFI_SetTimeout(ES_WIFIObject_t *Obj, uint32_t Timeout);
ES_WIFI_Status_t ES_WIFI_ListAccessPoints(ES_WIFIObject_t *Obj, ES_WIFI_APs_t *APs);
ES_WIFI_Status_t ES_WIFI_Connect(ES_WIFIObject_t *Obj, const char* SSID, const char* Password,
ES_WIFI_SecurityType_t SecType);
ES_WIFI_Status_t ES_WIFI_Disconnect(ES_WIFIObject_t *Obj);
uint8_t ES_WIFI_IsConnected(ES_WIFIObject_t *Obj);
ES_WIFI_Status_t ES_WIFI_GetNetworkSettings(ES_WIFIObject_t *Obj);
ES_WIFI_Status_t ES_WIFI_GetMACAddress(ES_WIFIObject_t *Obj, uint8_t *mac);
ES_WIFI_Status_t ES_WIFI_GetIPAddress(ES_WIFIObject_t *Obj, uint8_t *ipaddr);
ES_WIFI_Status_t ES_WIFI_GetProductID(ES_WIFIObject_t *Obj, uint8_t *productID);
ES_WIFI_Status_t ES_WIFI_GetFWRevID(ES_WIFIObject_t *Obj, uint8_t *FWRev);
ES_WIFI_Status_t ES_WIFI_GetRTOSRev(ES_WIFIObject_t *Obj, uint8_t *RTOSRev);
ES_WIFI_Status_t ES_WIFI_GetProductName(ES_WIFIObject_t *Obj, uint8_t *productName);
ES_WIFI_Status_t ES_WIFI_GetAPIRev(ES_WIFIObject_t *Obj, uint8_t *APIRev);
ES_WIFI_Status_t ES_WIFI_GetStackRev(ES_WIFIObject_t *Obj, uint8_t *StackRev);
ES_WIFI_Status_t ES_WIFI_SetMACAddress(ES_WIFIObject_t *Obj, uint8_t *mac);
ES_WIFI_Status_t ES_WIFI_ResetToFactoryDefault(ES_WIFIObject_t *Obj);
ES_WIFI_Status_t ES_WIFI_ResetModule(ES_WIFIObject_t *Obj);
ES_WIFI_Status_t ES_WIFI_HardResetModule(ES_WIFIObject_t *Obj);
ES_WIFI_Status_t ES_WIFI_SetProductName(ES_WIFIObject_t *Obj, uint8_t *ProductName);
#if (ES_WIFI_USE_PING == 1)
ES_WIFI_Status_t ES_WIFI_Ping(ES_WIFIObject_t *Obj, uint8_t *address, uint16_t count, uint16_t interval_ms, int32_t res[]);
#endif
ES_WIFI_Status_t ES_WIFI_DNS_LookUp(ES_WIFIObject_t *Obj, const char *url, uint8_t *ipaddress);
ES_WIFI_Status_t ES_WIFI_StartClientConnection(ES_WIFIObject_t *Obj, ES_WIFI_Conn_t *conn);
ES_WIFI_Status_t ES_WIFI_StopClientConnection(ES_WIFIObject_t *Obj, ES_WIFI_Conn_t *conn);
#if (ES_WIFI_USE_AWS == 1)
ES_WIFI_Status_t ES_WIFI_StartAWSClientConnection(ES_WIFIObject_t *Obj, ES_WIFI_AWS_Conn_t *conn);
#endif
ES_WIFI_Status_t ES_WIFI_StartServerSingleConn(ES_WIFIObject_t *Obj, ES_WIFI_Conn_t *conn);
ES_WIFI_Status_t ES_WIFI_WaitServerConnection(ES_WIFIObject_t *Obj,uint32_t Timeout,ES_WIFI_Conn_t *con);
ES_WIFI_Status_t ES_WIFI_CloseServerConnection(ES_WIFIObject_t *Obj,int socket);
ES_WIFI_Status_t ES_WIFI_StopServerSingleConn(ES_WIFIObject_t *Obj, int socket);
ES_WIFI_Status_t ES_WIFI_StartServerMultiConn(ES_WIFIObject_t *Obj, ES_WIFI_Conn_t *conn);
ES_WIFI_Status_t ES_WIFI_StopServerMultiConn(ES_WIFIObject_t *Obj);
ES_WIFI_Status_t ES_WIFI_SendData(ES_WIFIObject_t *Obj, uint8_t Socket, uint8_t *pdata, uint16_t Reqlen , uint16_t *SentLen, uint32_t Timeout);
ES_WIFI_Status_t ES_WIFI_SendDataTo(ES_WIFIObject_t *Obj, uint8_t Socket, uint8_t *pdata, uint16_t Reqlen , uint16_t *SentLen, uint32_t Timeout, uint8_t *IPaddr, uint16_t Port);
ES_WIFI_Status_t ES_WIFI_ReceiveData(ES_WIFIObject_t *Obj, uint8_t Socket, uint8_t *pdata, uint16_t Reqlen, uint16_t *Receivedlen, uint32_t Timeout);
ES_WIFI_Status_t ES_WIFI_ReceiveDataFrom(ES_WIFIObject_t *Obj, uint8_t Socket, uint8_t *pdata, uint16_t Reqlen, uint16_t *Receivedlen, uint32_t Timeout, uint8_t *IPaddr, uint16_t *pPort);
ES_WIFI_Status_t ES_WIFI_ActivateAP(ES_WIFIObject_t *Obj, ES_WIFI_APConfig_t *ApConfig);
ES_WIFI_APState_t ES_WIFI_WaitAPStateChange(ES_WIFIObject_t *Obj);
ES_WIFI_Status_t ES_WIFI_PeerInfo(ES_WIFIObject_t *Obj, uint8_t Socket, uint8_t *IPaddr, uint16_t *pPort);
ES_WIFI_Status_t ES_WIFI_SockInfo(ES_WIFIObject_t *Obj, uint8_t Socket, uint8_t *IPaddr, uint16_t *pPort);
#if (ES_WIFI_USE_FIRMWAREUPDATE == 1)
ES_WIFI_Status_t ES_WIFI_OTA_Upgrade(ES_WIFIObject_t *Obj, uint8_t *link);
#endif
#if (ES_WIFI_USE_UART == 1)
ES_WIFI_Status_t ES_WIFI_SetUARTBaudRate(ES_WIFIObject_t *Obj, uint16_t BaudRate);
ES_WIFI_Status_t ES_WIFI_GetUARTConfig(ES_WIFIObject_t *Obj, ES_WIFI_UARTConfig_t *pconf);
#endif
ES_WIFI_Status_t ES_WIFI_GetSystemConfig(ES_WIFIObject_t *Obj, ES_WIFI_SystemConfig_t *pconf);
ES_WIFI_Status_t ES_WIFI_RegisterBusIO(ES_WIFIObject_t *Obj, IO_Init_Func IO_Init,
IO_DeInit_Func IO_DeInit,
IO_Delay_Func IO_Delay,
IO_Send_Func IO_Send,
IO_Receive_Func IO_Receive);
ES_WIFI_Status_t ES_WIFI_StoreCreds( ES_WIFIObject_t *Obj,
ES_WIFI_CredsFunction_t credsFunction, uint8_t credSet,
uint8_t* ca, uint16_t caLength,
uint8_t* certificate, uint16_t certificateLength,
uint8_t* key, uint16_t keyLength );
ES_WIFI_Status_t ES_WIFI_StoreCA( ES_WIFIObject_t *Obj,
ES_WIFI_CredsFunction_t credsFunction,
uint8_t credSet,
uint8_t* ca,
uint16_t caLength );
ES_WIFI_Status_t ES_WIFI_StoreCertificate( ES_WIFIObject_t *Obj,
ES_WIFI_CredsFunction_t credsFunction,
uint8_t credSet,
uint8_t* certificate,
uint16_t certificateLength );
ES_WIFI_Status_t ES_WIFI_StoreKey( ES_WIFIObject_t *Obj,
ES_WIFI_CredsFunction_t credsFunction,
uint8_t credSet,
uint8_t* key,
uint16_t keyLength );
#ifdef __cplusplus
}
#endif
#endif /* ES_WIFI_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,91 @@
/**
******************************************************************************
* @file es_wifi_conf.h
* @author MCD Application Team
* @brief ES_WIFI configuration.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 ES_WIFI_CONF_H
#define ES_WIFI_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
//#define WIFI_USE_CMSIS_OS
#ifdef WIFI_USE_CMSIS_OS
#include "cmsis_os.h"
extern osMutexId es_wifi_mutex;
#define LOCK_SPI() osMutexWait(spi_mutex, 0)
#define UNLOCK_SPI() osMutexRelease(spi_mutex)
#define LOCK_WIFI() osMutexWait(es_wifi_mutex, 0)
#define UNLOCK_WIFI() osMutexRelease(es_wifi_mutex)
#define SEM_SIGNAL(a) osSemaphoreRelease(a)
#define SEM_WAIT(a,timeout) osSemaphoreWait(a,timeout)
#else /* WIFI_USE_CMSIS_OS */
#define LOCK_SPI()
#define LOCK_WIFI()
#define UNLOCK_SPI()
#define UNLOCK_WIFI()
#define SEM_SIGNAL(a)
#endif /* WIFI_USE_CMSIS_OS */
#define ES_WIFI_MAX_SSID_NAME_SIZE 32
#define ES_WIFI_MAX_PSWD_NAME_SIZE 32
#define ES_WIFI_PRODUCT_ID_SIZE 32
#define ES_WIFI_PRODUCT_NAME_SIZE 32
#define ES_WIFI_FW_REV_SIZE 24
#define ES_WIFI_API_REV_SIZE 16
#define ES_WIFI_STACK_REV_SIZE 16
#define ES_WIFI_RTOS_REV_SIZE 16
#define ES_WIFI_DATA_SIZE 1400
#define ES_WIFI_MAX_DETECTED_AP 10
#define ES_WIFI_TIMEOUT 0xFFFF
#define ES_WIFI_USE_PING 1
#define ES_WIFI_USE_AWS 0
#define ES_WIFI_USE_FIRMWAREUPDATE 0
#define ES_WIFI_USE_WPS 0
#define ES_WIFI_USE_SPI 0
#define ES_WIFI_USE_UART (!ES_WIFI_USE_SPI)
/* Definitions of Country codes for "CN" AT command */
/* Allows to change WiFi channels range */
#define ES_WIFI_COUNTRY_FR "FR/0" /* allows WiFi channels 1-13 */
#define ES_WIFI_COUNTRY_JP "JP/0" /* allows WiFi channels 1-14 (channel 14 low power) */
#define ES_WIFI_COUNTRY_CA "CA/0" /* allows WiFi channels 1-12 (channel 12 low power) */
#define ES_WIFI_COUNTRY_US "US/0" /* allows WiFi channels 1-11 (set by default) */
/* define ES_WIFI_COUNTRY to one of ES_WIFI_COUNTRY_FR, ES_WIFI_COUNTRY_JP, ... */
/* define it only if country is not US (US is the default setting) */
/* #define ES_WIFI_COUNTRY ES_WIFI_COUNTRY_FR */
#ifdef __cplusplus
}
#endif
#endif /* ES_WIFI_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,114 @@
<!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 EXC7200 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-exc7200-component-driver"><strong>Release Notes for EXC7200 Component Driver</strong></h1>
<p>Copyright © 2015 STMicroelectronics<br />
</p>
<a href="https://www.st.com" class="logo"><img src="_htmresc/st_logo.png" alt="ST logo" /></a>
</center>
</div>
</div>
<h1 id="license">License</h1>
This software component is licensed by ST under BSD 3-Clause license, the “License”; You may not use this component except in compliance with the License. You may obtain a copy of the License at:
<center>
<a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a>
</center>
<h1 id="purpose">Purpose</h1>
<p>This driver provides a set of audio functions offered by EXC7200 TS 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-section5" checked aria-hidden="true"> <label for="collapse-section5" aria-hidden="true"><strong>V2.0.1 / 23-November-2019</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Update st_logo.png inclusion path in Release notes</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section4" checked aria-hidden="true"> <label for="collapse-section4" aria-hidden="true"><strong>V2.0.0 / 14-October-2019</strong></label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>First Official release of EXC7200 BSP drivers in line with STM32Cube BSP drivers development guidelines (UM2298)</li>
<li>The component drivers are composed of
<ul>
<li>component core drivers files: exc7200.h/.c</li>
<li>component register drivers files: exc7200_reg.h/.c</li>
<li>component configuration files: exc7200_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><p>This software release is compatible with:</p>
<ul>
<li>BSP Common v6.0.1 or above</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V1.0.2 / 07-April-2017</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>Update comments to be used for PDSC generation</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" checked aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V1.0.1 / 21-September-2015</strong></label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>exc7200.c:
<ul>
<li>Update the I2C slave read address within exc7200_TS_DetectTouch() function.</li>
<li>Update exc7200_TS_GetXY() function to return correct Touch Screen positions.</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 28-April-2015</strong></label>
<div>
<h2 id="main-changes-4">Main Changes</h2>
<ul>
<li>First official release of <strong>EXC7200</strong> Toush Screen Component drivers</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>

View file

@ -0,0 +1,119 @@
---
pagetitle: Release Notes for EXC7200 Component Driver
lang: en
---
::: {.row}
::: {.col-sm-12 .col-lg-4}
::: {.card .fluid}
::: {.sectione .dark}
<center>
# **Release Notes for EXC7200 Component Driver**
Copyright &copy; 2015 STMicroelectronics\
[![ST logo](_htmresc/st_logo.png)](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 audio functions offered by EXC7200 TS component
:::
::: {.col-sm-12 .col-lg-8}
# Update History
::: {.collapse}
<input type="checkbox" id="collapse-section5" checked aria-hidden="true">
<label for="collapse-section5" aria-hidden="true">__V2.0.1 / 23-November-2019__</label>
<div>
## Main Changes
- Update st_logo.png inclusion path in Release notes
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section4" checked aria-hidden="true">
<label for="collapse-section4" aria-hidden="true">__V2.0.0 / 14-October-2019__</label>
<div>
## Main Changes
- First Official release of EXC7200 BSP drivers in line with STM32Cube BSP drivers development guidelines (UM2298)
- The component drivers are composed of
- component core drivers files: exc7200.h/.c
- component register drivers files: exc7200_reg.h/.c
- component configuration files: exc7200_conf_template.h
## Backward Compatibility
- This version breaks the compatibility with previous versions
## Dependencies
- This software release is compatible with:
- BSP Common v6.0.1 or above
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section3" checked aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">__V1.0.2 / 07-April-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 / 21-September-2015__</label>
<div>
## Main Changes
- exc7200.c:
- Update the I2C slave read address within exc7200_TS_DetectTouch() function.
- Update exc7200_TS_GetXY() function to return correct Touch Screen positions.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section1" checked aria-hidden="true">
<label for="collapse-section1" aria-hidden="true">__V1.0.0 / 28-April-2015__</label>
<div>
## Main Changes
- First official release of **EXC7200** Toush Screen Component drivers
</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

View file

@ -0,0 +1,408 @@
/**
******************************************************************************
* @file exc7200.c
* @author MCD Application Team
* @brief This file provides a set of functions needed to manage the EXC7200
* 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 "exc7200.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @defgroup EXC7200 EXC7200
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/** @defgroup EXC7200_Exported_Variables EXC7200 Exported Variables
* @{
*/
/* Touch screen driver structure initialization */
EXC7200_TS_Drv_t EXC7200_TS_Driver =
{
EXC7200_Init,
EXC7200_DeInit,
EXC7200_GestureConfig,
EXC7200_ReadID,
EXC7200_GetState,
EXC7200_GetMultiTouchState,
EXC7200_GetGesture,
EXC7200_GetCapabilities,
EXC7200_EnableIT,
EXC7200_DisableIT,
EXC7200_ClearIT,
EXC7200_ITStatus
};
/**
* @}
*/
/** @defgroup EXC7200_Private_Function_Prototypes EXC7200 Private Function Prototypes
* @{
*/
static int32_t EXC7200_DetectTouch(EXC7200_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 EXC7200_Exported_Functions EXC7200 Exported Functions
* @{
*/
/**
* @brief Register IO bus to component object
* @param Component object pointer
* @retval error status
*/
int32_t EXC7200_RegisterBusIO (EXC7200_Object_t *pObj, EXC7200_IO_t *pIO)
{
int32_t ret;
if (pObj == NULL)
{
ret = EXC7200_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 = EXC7200_ERROR;
}
}
return ret;
}
/**
* @brief Get EXC7200 sensor capabilities
* @param pObj Component object pointer
* @param Capabilities pointer to EXC7200 sensor capabilities
* @retval Component status
*/
int32_t EXC7200_GetCapabilities(EXC7200_Object_t *pObj, EXC7200_Capabilities_t *Capabilities)
{
/* Prevent unused argument(s) compilation warning */
(void)(pObj);
/* Store component's capabilities */
Capabilities->MultiTouch = 0;
Capabilities->Gesture = 0;
Capabilities->MaxTouch = EXC7200_MAX_NB_TOUCH;
Capabilities->MaxXl = EXC7200_MAX_X_LENGTH;
Capabilities->MaxYl = EXC7200_MAX_Y_LENGTH;
return EXC7200_OK;
}
/**
* @brief Initialize the EXC7200 communication bus
* from MCU to EXC7200 : ie I2C channel initialization (if required).
* @param pObj Component object pointer
* @retval Component status
*/
int32_t EXC7200_Init(EXC7200_Object_t *pObj)
{
int32_t ret = EXC7200_OK;
if(pObj->IsInitialized == 0U)
{
/* Initialize IO BUS layer */
if(pObj->IO.Init() != EXC7200_OK)
{
ret = EXC7200_ERROR;
}
else
{
pObj->IsInitialized = 1;
}
}
return ret;
}
/**
* @brief De-Initialize the EXC7200 communication bus
* from MCU to EXC7200 : ie I2C channel initialization (if required).
* @param pObj Component object pointer
* @retval Component status
*/
int32_t EXC7200_DeInit(EXC7200_Object_t *pObj)
{
int32_t ret = EXC7200_OK;
if(pObj->IsInitialized == 1U)
{
if(pObj->IO.DeInit() != EXC7200_OK)
{
ret = EXC7200_ERROR;
}
else
{
pObj->IsInitialized = 0;
}
}
return ret;
}
/**
* @brief Configure the EXC7200 gesture
* from MCU to EXC7200 : ie I2C channel initialization (if required).
* @param pObj Component object pointer
* @param GestureInit Gesture init structure
* @retval Component status
*/
int32_t EXC7200_GestureConfig(EXC7200_Object_t *pObj, EXC7200_Gesture_Init_t *GestureInit)
{
/* Feature not supported */
return EXC7200_ERROR;
}
/**
* @brief Read the EXC7200 device ID, pre initialize I2C in case of need to be
* able to read the EXC7200 device ID, and verify this is a EXC7200.
* @param pObj Component object pointer
* @param Id Pointer to component ID value
* @retval Component status
*/
int32_t EXC7200_ReadID(EXC7200_Object_t *pObj, uint32_t *Id)
{
int32_t ret = EXC7200_ERROR;
uint8_t data;
if(exc7200_read_reg(&pObj->Ctx, EXC7200_READ_REG, &data, 1) == EXC7200_OK)
{
*Id = EXC7200_ID;
ret = EXC7200_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 EXC7200_GetState(EXC7200_Object_t *pObj, EXC7200_State_t *State)
{
uint8_t data[10];
State->TouchDetected = (uint32_t)EXC7200_DetectTouch(pObj, data, (uint32_t)sizeof(data));
/* Send back first ready X position to caller */
State->TouchX = (((data[3]&0x00ff) << 4) | ((data[2]&0x00f0) >> 4)) << 1;
/* Send back first ready Y position to caller */
State->TouchY = (((data[5]&0x00ff) << 4) | ((data[4]&0x00f0) >> 4)) << 1;
/* Dummy Read to deactivate read mode */
(void)EXC7200_DetectTouch(pObj, data, (uint32_t)sizeof(data));
return EXC7200_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 EXC7200_GetMultiTouchState(EXC7200_Object_t *pObj, EXC7200_MultiTouch_State_t *State)
{
/* Feature not supported */
return EXC7200_ERROR;
}
/**
* @brief Get Gesture ID
* @param pObj Component object pointer
* @param GestureId gesture ID
* @retval Component status.
*/
int32_t EXC7200_GetGesture(EXC7200_Object_t *pObj, uint8_t *GestureId)
{
/* Feature not supported */
return EXC7200_ERROR;
}
/**
* @brief Configure the EXC7200 device to generate IT on given INT pin
* connected to MCU as EXTI.
* @param pObj Component object pointer
* @retval Component status.
*/
int32_t EXC7200_EnableIT(EXC7200_Object_t *pObj)
{
/* Feature not supported */
return EXC7200_ERROR;
}
/**
* @brief Configure the EXC7200 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 EXC7200_DisableIT(EXC7200_Object_t *pObj)
{
/* Feature not supported */
return EXC7200_ERROR;
}
/**
* @brief Get IT status from EXC7200 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 EXC7200.
* @param pObj Component object pointer
* @retval Component status.
*/
int32_t EXC7200_ITStatus(EXC7200_Object_t *pObj)
{
/* Feature not supported */
return EXC7200_ERROR;
}
/**
* @brief Clear IT status in EXC7200 interrupt status clear registers
* Should be called Following an EXTI coming to the MCU.
* @note : This feature is not applicable to EXC7200.
* @param pObj Component object pointer
* @retval Component status.
*/
int32_t EXC7200_ClearIT(EXC7200_Object_t *pObj)
{
/* Feature not supported */
return EXC7200_ERROR;
}
/**
* @}
*/
/** @defgroup EXC7200_Private_Functions EXC7200 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 EXC7200_ERROR
* in case of error
*/
static int32_t EXC7200_DetectTouch(EXC7200_Object_t *pObj, uint8_t *pData, uint32_t Length)
{
int32_t ret;
/* Read TS data */
if(exc7200_read_reg(&pObj->Ctx, EXC7200_READ_REG, pData, Length) != EXC7200_OK)
{
ret = EXC7200_ERROR;
}
else
{
if(pData[1] == 0x83U)
{
/* 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 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)
{
EXC7200_Object_t *pObj = (EXC7200_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)
{
EXC7200_Object_t *pObj = (EXC7200_Object_t *)handle;
return pObj->IO.WriteReg(pObj->IO.Address, Reg, pData, Length);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,191 @@
/**
******************************************************************************
* @file exc7200.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the
* exc7200.c IO expander driver.
******************************************************************************
* @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
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef EXC7200_H
#define EXC7200_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "exc7200_reg.h"
#include <stddef.h>
#include "exc7200_conf.h"
/* Macros --------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup EXC7200
* @{
*/
/** @addtogroup EXC7200_Exported_Constants
* @{
*/
#define EXC7200_OK (0)
#define EXC7200_ERROR (-1)
/* Max detectable simultaneous touches */
#define EXC7200_MAX_NB_TOUCH 1U
/* Touch EXC7200 IDs */
#define EXC7200_ID 0x7200U
/**
* @}
*/
/** @defgroup EXC7200_Exported_Types EXC7200 Exported Types
* @{
*/
typedef struct
{
uint32_t Radian;
uint32_t OffsetLeftRight;
uint32_t OffsetUpDown;
uint32_t DistanceLeftRight;
uint32_t DistanceUpDown;
uint32_t DistanceZoom;
}EXC7200_Gesture_Init_t;
typedef int32_t (*EXC7200_Init_Func) (void);
typedef int32_t (*EXC7200_DeInit_Func) (void);
typedef int32_t (*EXC7200_GetTick_Func) (void);
typedef int32_t (*EXC7200_Delay_Func) (uint32_t);
typedef int32_t (*EXC7200_WriteReg_Func)(uint16_t, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*EXC7200_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
typedef struct
{
EXC7200_Init_Func Init;
EXC7200_DeInit_Func DeInit;
uint16_t Address;
EXC7200_WriteReg_Func WriteReg;
EXC7200_ReadReg_Func ReadReg;
EXC7200_GetTick_Func GetTick;
} EXC7200_IO_t;
typedef struct
{
uint32_t TouchDetected;
uint32_t TouchX;
uint32_t TouchY;
} EXC7200_State_t;
typedef struct
{
uint32_t TouchDetected;
uint32_t TouchX[EXC7200_MAX_NB_TOUCH];
uint32_t TouchY[EXC7200_MAX_NB_TOUCH];
uint32_t TouchWeight[EXC7200_MAX_NB_TOUCH];
uint32_t TouchEvent[EXC7200_MAX_NB_TOUCH];
uint32_t TouchArea[EXC7200_MAX_NB_TOUCH];
} EXC7200_MultiTouch_State_t;
typedef struct
{
EXC7200_IO_t IO;
exc7200_ctx_t Ctx;
uint8_t IsInitialized;
} EXC7200_Object_t;
typedef struct
{
uint8_t MultiTouch;
uint8_t Gesture;
uint8_t MaxTouch;
uint32_t MaxXl;
uint32_t MaxYl;
} EXC7200_Capabilities_t;
typedef struct
{
int32_t ( *Init ) ( EXC7200_Object_t *);
int32_t ( *DeInit ) ( EXC7200_Object_t * );
int32_t ( *GestureConfig ) ( EXC7200_Object_t *, EXC7200_Gesture_Init_t* );
int32_t ( *ReadID ) ( EXC7200_Object_t *, uint32_t * );
int32_t ( *GetState ) ( EXC7200_Object_t *, EXC7200_State_t* );
int32_t ( *GetMultiTouchState ) ( EXC7200_Object_t *, EXC7200_MultiTouch_State_t* );
int32_t ( *GetGesture ) ( EXC7200_Object_t *, uint8_t* );
int32_t ( *GetCapabilities ) ( EXC7200_Object_t *, EXC7200_Capabilities_t * );
int32_t ( *EnableIT ) ( EXC7200_Object_t * );
int32_t ( *DisableIT ) ( EXC7200_Object_t * );
int32_t ( *ClearIT ) ( EXC7200_Object_t * );
int32_t ( *ITStatus ) ( EXC7200_Object_t * );
} EXC7200_TS_Drv_t;
/**
* @}
*/
/** @addtogroup EXC7200_Exported_Variables
* @{
*/
extern EXC7200_TS_Drv_t EXC7200_TS_Driver;
/**
* @}
*/
/** @addtogroup EXC7200_Exported_Functions
* @{
*/
int32_t EXC7200_RegisterBusIO (EXC7200_Object_t *pObj, EXC7200_IO_t *pIO);
int32_t EXC7200_Init(EXC7200_Object_t *pObj);
int32_t EXC7200_DeInit(EXC7200_Object_t *pObj);
int32_t EXC7200_GestureConfig(EXC7200_Object_t *pObj, EXC7200_Gesture_Init_t *GestureInit);
int32_t EXC7200_ReadID(EXC7200_Object_t *pObj, uint32_t *Id);
int32_t EXC7200_GetState(EXC7200_Object_t *pObj, EXC7200_State_t *State);
int32_t EXC7200_GetMultiTouchState(EXC7200_Object_t *pObj, EXC7200_MultiTouch_State_t *State);
int32_t EXC7200_GetGesture(EXC7200_Object_t *pObj, uint8_t *GestureId);
int32_t EXC7200_EnableIT(EXC7200_Object_t *pObj);
int32_t EXC7200_DisableIT(EXC7200_Object_t *pObj);
int32_t EXC7200_ITStatus(EXC7200_Object_t *pObj);
int32_t EXC7200_ClearIT(EXC7200_Object_t *pObj);
int32_t EXC7200_GetCapabilities(EXC7200_Object_t *pObj, EXC7200_Capabilities_t *Capabilities);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* EXC7200_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,41 @@
/**
******************************************************************************
* @file exc7200_conf_template.h
* @author MCD Application Team
* @brief This file contains specific configuration for the
* exc7200.c that can be modified by user.
******************************************************************************
* @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
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef EXC7200_CONF_H
#define EXC7200_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Macros --------------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
#define EXC7200_MAX_X_LENGTH 4096U
#define EXC7200_MAX_Y_LENGTH 4096U
#ifdef __cplusplus
}
#endif
#endif /* EXC7200_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,82 @@
/**
******************************************************************************
* @file exc7200_reg.c
* @author MCD Application Team
* @brief This file provides unitary register function to control the exc7200 Touch
*
******************************************************************************
* @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 "exc7200_reg.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup EXC7200
* @{
*/
/** @addtogroup EXC7200_Exported_Functions
* @{
*/
/**
* @brief Read EXC7200 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 exc7200_read_reg(exc7200_ctx_t *ctx, uint8_t reg, uint8_t* pdata, uint16_t length)
{
return ctx->ReadReg(ctx->handle, reg, pdata, length);
}
/**
* @brief Write EXC7200 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 exc7200_write_reg(exc7200_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****/

View file

@ -0,0 +1,99 @@
/**
******************************************************************************
* @file exc7200_reg.h
* @author MCD Application Team
* @brief Header of exc7200_regs.c
*
******************************************************************************
* @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
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef EXC7200_REG_H
#define EXC7200_REG_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Macros --------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup EXC7200
* @{
*/
/** @defgroup EXC7200_Exported_Constants Exported Constants
* @{
*/
/* */
#define EXC7200_READ_REG 0x09U
/**
* @}
*/
/** @defgroup EXC7200_Exported_Types EXC7200 Exported Types
* @{
*/
typedef int32_t (*EXC7200_Write_Func)(void *, uint8_t, uint8_t*, uint16_t);
typedef int32_t (*EXC7200_Read_Func) (void *, uint8_t, uint8_t*, uint16_t);
typedef struct
{
EXC7200_Write_Func WriteReg;
EXC7200_Read_Func ReadReg;
void *handle;
} exc7200_ctx_t;
/**
* @}
*/
/** @addtogroup EXC7200_Exported_Functions
* @{
*/
int32_t exc7200_write_reg(exc7200_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
int32_t exc7200_read_reg(exc7200_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* EXC7200_REG_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -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.

View file

@ -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>

View file

@ -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

View file

@ -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 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View file

@ -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);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View file

@ -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 */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View file

@ -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 */

View file

@ -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);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View file

@ -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 */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/

View file

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Release Notes for FT5336 Component Driver</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<link rel="stylesheet" href="_htmresc/mini-st.css" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<div class="row">
<div class="col-sm-12 col-lg-4">
<div class="card fluid">
<div class="sectione dark">
<center>
<h1 id="release-notes-for-ft5336-ts-component-driver"><strong>Release Notes for FT5336 TS Component Driver</strong></h1>
<p>Copyright © 2015 STMicroelectronics<br />
</p>
<a href="https://www.st.com" class="logo"><img src="_htmresc/st_logo.png" alt="ST logo" /></a>
</center>
</div>
</div>
<h1 id="license">License</h1>
This software component is licensed by ST under BSD 3-Clause license, the “License”; You may not use this component except in compliance with the License. You may obtain a copy of the License at:
<center>
<a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a>
</center>
<h1 id="purpose">Purpose</h1>
<p>This driver provides a set of Touch Screen functions offered by FT5336 component</p>
</div>
<div class="col-sm-12 col-lg-8">
<h1 id="update-history">Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section4" checked aria-hidden="true"> <label for="collapse-section4" aria-hidden="true"><strong>V2.0.1 / 30-October-2019</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Update st_logo.png inclusion path in Release notes.</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V2.0.0 / 14-October-2019</strong></label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>First Official Release of FT5336 Touch Screen Component Drivers in line with STM32Cube BSP drivers development guidelines (UM2298)</li>
<li>The component drivers are composed of
<ul>
<li>component core drivers files: ft5336.h/.c</li>
<li>component register drivers files: ft5336_regs.h/.c</li>
<li>component configuration file ft5336_conf_template.h file</li>
</ul></li>
</ul>
<h2 id="backward-compatibility">Backward Compatibility</h2>
<ul>
<li>This version breaks the compatibility with previous versions</li>
</ul>
<h2 id="dependencies">Dependencies</h2>
<p>This software release is compatible with:</p>
<ul>
<li>BSP Common v6.0.1 or above</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" checked aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V1.0.1 / 07-April-2017</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>Update comments to be used for PDSC generation</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 25-June-2015</strong></label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>First official release of <strong>FT5336</strong> TS driver</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <span style="font-color: blue;"><a href="http://www.st.com/STM32">www.st.com</a></span>
</footer>
</body>
</html>

View file

@ -0,0 +1,104 @@
---
pagetitle: Release Notes for FT5336 Component Driver
lang: en
---
::: {.row}
::: {.col-sm-12 .col-lg-4}
::: {.card .fluid}
::: {.sectione .dark}
<center>
# **Release Notes for FT5336 TS Component Driver**
Copyright &copy; 2015 STMicroelectronics\
[![ST logo](_htmresc/st_logo.png)](https://www.st.com){.logo}
</center>
:::
:::
# License
This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this component except in
compliance with the License. You may obtain a copy of the License at:
<center>
[https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)
</center>
# Purpose
This driver provides a set of Touch Screen functions offered by FT5336 component
:::
::: {.col-sm-12 .col-lg-8}
# Update History
::: {.collapse}
<input type="checkbox" id="collapse-section4" checked aria-hidden="true">
<label for="collapse-section4" aria-hidden="true">__V2.0.1 / 30-October-2019__</label>
<div>
## Main Changes
- Update st_logo.png inclusion path in Release notes.
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section3" checked aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">__V2.0.0 / 14-October-2019__</label>
<div>
## Main Changes
- First Official Release of FT5336 Touch Screen Component Drivers in line with STM32Cube BSP drivers development guidelines (UM2298)
- The component drivers are composed of
- component core drivers files: ft5336.h/.c
- component register drivers files: ft5336_regs.h/.c
- component configuration file ft5336_conf_template.h file
## Backward Compatibility
- This version breaks the compatibility with previous versions
## Dependencies
This software release is compatible with:
- BSP Common v6.0.1 or above
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section2" checked aria-hidden="true">
<label for="collapse-section2" aria-hidden="true">__V1.0.1 / 07-April-2017__</label>
<div>
## Main Changes
- Update comments to be used for PDSC generation
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section1" checked aria-hidden="true">
<label for="collapse-section1" aria-hidden="true">__V1.0.0 / 25-June-2015__</label>
<div>
## Main Changes
- First official release of **FT5336** TS driver
</div>
:::
:::
:::
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> ,
visit: [[www.st.com](http://www.st.com/STM32)]{style="font-color: blue;"}
</footer>

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -0,0 +1,525 @@
/**
******************************************************************************
* @file ft5336.c
* @author MCD Application Team
* @brief This file provides a set of functions needed to manage the FT5336
* IO Expander devices.
******************************************************************************
* @attention
*
* <h2><center>&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 "ft5336.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @defgroup FT5336 FT5336
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/** @defgroup FT5336_Exported_Variables FT5336 Exported Variables
* @{
*/
/* Touch screen driver structure initialization */
FT5336_TS_Drv_t FT5336_TS_Driver =
{
FT5336_Init,
FT5336_DeInit,
FT5336_GestureConfig,
FT5336_ReadID,
FT5336_GetState,
FT5336_GetMultiTouchState,
FT5336_GetGesture,
FT5336_GetCapabilities,
FT5336_EnableIT,
FT5336_DisableIT,
FT5336_ClearIT,
FT5336_ITStatus
};
/**
* @}
*/
/** @defgroup FT5336_Private_Function_Prototypes FT5336 Private Function Prototypes
* @{
*/
#if (FT5336_AUTO_CALIBRATION_ENABLED == 1)
static int32_t FT5336_TS_Calibration(FT5336_Object_t *pObj);
static int32_t FT5336_Delay(FT5336_Object_t *pObj, uint32_t Delay);
#endif /* FT5336_AUTO_CALIBRATION_ENABLED == 1 */
static int32_t FT5336_DetectTouch(FT5336_Object_t *pObj);
static int32_t ReadRegWrap(void *handle, uint8_t Reg, uint8_t* Data, uint16_t Length);
static int32_t WriteRegWrap(void *handle, uint8_t Reg, uint8_t* Data, uint16_t Length);
/**
* @}
*/
/** @defgroup FT5336_Exported_Functions FT5336 Exported Functions
* @{
*/
/**
* @brief Register IO bus to component object
* @param Component object pointer
* @retval error status
*/
int32_t FT5336_RegisterBusIO (FT5336_Object_t *pObj, FT5336_IO_t *pIO)
{
int32_t ret;
if (pObj == NULL)
{
ret = FT5336_ERROR;
}
else
{
pObj->IO.Init = pIO->Init;
pObj->IO.DeInit = pIO->DeInit;
pObj->IO.Address = pIO->Address;
pObj->IO.WriteReg = pIO->WriteReg;
pObj->IO.ReadReg = pIO->ReadReg;
pObj->IO.GetTick = pIO->GetTick;
pObj->Ctx.ReadReg = ReadRegWrap;
pObj->Ctx.WriteReg = WriteRegWrap;
pObj->Ctx.handle = pObj;
if(pObj->IO.Init != NULL)
{
ret = pObj->IO.Init();
}
else
{
ret = FT5336_ERROR;
}
}
return ret;
}
/**
* @brief Get FT5336 sensor capabilities
* @param pObj Component object pointer
* @param Capabilities pointer to FT5336 sensor capabilities
* @retval Component status
*/
int32_t FT5336_GetCapabilities(FT5336_Object_t *pObj, FT5336_Capabilities_t *Capabilities)
{
/* Prevent unused argument(s) compilation warning */
(void)(pObj);
/* Store component's capabilities */
Capabilities->MultiTouch = 1;
Capabilities->Gesture = 1;
Capabilities->MaxTouch = FT5336_MAX_NB_TOUCH;
Capabilities->MaxXl = FT5336_MAX_X_LENGTH;
Capabilities->MaxYl = FT5336_MAX_Y_LENGTH;
return FT5336_OK;
}
/**
* @brief Initialize the FT5336 communication bus
* from MCU to FT5336 : ie I2C channel initialization (if required).
* @param pObj Component object pointer
* @param GestureInit: Gesture init structure
* @retval FT5336_OK
*/
int32_t FT5336_Init(FT5336_Object_t *pObj)
{
int32_t ret = FT5336_OK;
if(pObj->IsInitialized == 0U)
{
/* Initialize IO BUS layer */
pObj->IO.Init();
#if (FT5336_AUTO_CALIBRATION_ENABLED == 1)
/* Hw Calibration sequence start : should be done once after each power up */
/* This is called internal calibration of the touch screen */
ret += FT5336_TS_Calibration(pObj);
#endif /* (FT5336_AUTO_CALIBRATION_ENABLED == 1) */
/* By default set FT5336 IC in Polling mode : no INT generation on FT5336 for new touch available */
/* Note TS_INT is active low */
ret += FT5336_DisableIT(pObj);
pObj->IsInitialized = 1;
}
if(ret != FT5336_OK)
{
ret = FT5336_ERROR;
}
return ret;
}
/**
* @brief De-Initialize the FT5336 communication bus
* from MCU to FT5336 : ie I2C channel initialization (if required).
* @param pObj Component object pointer
* @retval FT5336_OK
*/
int32_t FT5336_DeInit(FT5336_Object_t *pObj)
{
int32_t ret = FT5336_OK;
if(pObj->IsInitialized == 1U)
{
pObj->IsInitialized = 0;
}
return ret;
}
/**
* @brief Configure the FT5336 gesture
* @param pObj Component object pointer
* @param GestureInit Gesture init structure
* @retval FT5336_OK
*/
int32_t FT5336_GestureConfig(FT5336_Object_t *pObj, FT5336_Gesture_Init_t *GestureInit)
{
int32_t ret;
ret = ft5336_radian_value(&pObj->Ctx, (uint8_t)GestureInit->Radian);
ret += ft5336_offset_left_right(&pObj->Ctx, (uint8_t)GestureInit->OffsetLeftRight);
ret += ft5336_offset_up_down(&pObj->Ctx, (uint8_t)GestureInit->OffsetUpDown);
ret += ft5336_disatnce_left_right(&pObj->Ctx, (uint8_t)GestureInit->DistanceLeftRight);
ret += ft5336_distance_up_down(&pObj->Ctx, (uint8_t)GestureInit->DistanceUpDown);
ret += ft5336_distance_zoom(&pObj->Ctx, (uint8_t)GestureInit->DistanceZoom);
if(ret != FT5336_OK)
{
ret = FT5336_ERROR;
}
return ret;
}
/**
* @brief Read the FT5336 device ID, pre initialize I2C in case of need to be
* able to read the FT5336 device ID, and verify this is a FT5336.
* @param pObj Component object pointer
* @retval The Device ID (two bytes).
*/
int32_t FT5336_ReadID(FT5336_Object_t *pObj, uint32_t *Id)
{
return ft5336_chip_id(&pObj->Ctx, (uint8_t *)Id);
}
/**
* @brief Get the touch screen X and Y positions values
* @param pObj Component object pointer
* @param State: Single Touch stucture pointer
* @retval FT5336_OK.
*/
int32_t FT5336_GetState(FT5336_Object_t *pObj, FT5336_State_t *State)
{
int32_t ret = FT5336_OK;
uint8_t data[4];
State->TouchDetected = (uint32_t)FT5336_DetectTouch(pObj);
if(ft5336_read_reg(&pObj->Ctx, FT5336_P1_XH_REG, data, (uint16_t)sizeof(data)) != FT5336_OK)
{
ret = FT5336_ERROR;
}
else
{
/* Send back first ready X position to caller */
State->TouchX = (((uint32_t)data[0] & FT5336_P1_XH_TP_BIT_MASK) << 8) | ((uint32_t)data[1] & FT5336_P1_XL_TP_BIT_MASK);
/* Send back first ready Y position to caller */
State->TouchY = (((uint32_t)data[2] & FT5336_P1_YH_TP_BIT_MASK) << 8) | ((uint32_t)data[3] & FT5336_P1_YL_TP_BIT_MASK);
}
return ret;
}
/**
* @brief Get the touch screen Xn and Yn positions values in multi-touch mode
* @param pObj Component object pointer
* @param State Multi Touch structure pointer
* @retval FT5336_OK.
*/
int32_t FT5336_GetMultiTouchState(FT5336_Object_t *pObj, FT5336_MultiTouch_State_t *State)
{
int32_t ret = FT5336_OK;
uint8_t data[30];
uint32_t i;
State->TouchDetected = (uint32_t)FT5336_DetectTouch(pObj);
if(ft5336_read_reg(&pObj->Ctx, FT5336_P1_XH_REG, data, (uint16_t)sizeof(data)) != FT5336_OK)
{
ret = FT5336_ERROR;
}
else
{
for(i = 0; i < FT5336_MAX_NB_TOUCH; i++)
{
/* Send back first ready X position to caller */
State->TouchX[i] = (((uint32_t)data[i*6U] & FT5336_P1_XH_TP_BIT_MASK) << 8U) | ((uint32_t)data[(i*6U) + 1U] & FT5336_P1_XL_TP_BIT_MASK);
/* Send back first ready Y position to caller */
State->TouchY[i] = (((uint32_t)data[(i*6U) + 2U] & FT5336_P1_YH_TP_BIT_MASK) << 8U) | ((uint32_t)data[(i*6U) + 3U] & FT5336_P1_YL_TP_BIT_MASK);
/* Send back first ready Event to caller */
State->TouchEvent[i] = (((uint32_t)data[i*6U] & FT5336_P1_XH_EF_BIT_MASK) >> FT5336_P1_XH_EF_BIT_POSITION);
/* Send back first ready Weight to caller */
State->TouchWeight[i] = ((uint32_t)data[(i*6U) + 4U] & FT5336_P1_WEIGHT_BIT_MASK);
/* Send back first ready Area to caller */
State->TouchArea[i] = ((uint32_t)data[(i*6U) + 5U] & FT5336_P1_MISC_BIT_MASK) >> FT5336_P1_MISC_BIT_POSITION;
}
}
return ret;
}
/**
* @brief Get Gesture ID
* @param pObj Component object pointer
* @param GestureId: gesture ID
* @retval Gesture ID.
*/
int32_t FT5336_GetGesture(FT5336_Object_t *pObj, uint8_t *GestureId)
{
return ft5336_gest_id(&pObj->Ctx, GestureId);
}
/**
* @brief Configure the FT5336 device to generate IT on given INT pin
* connected to MCU as EXTI.
* @param pObj Component object pointer
* @retval None
*/
int32_t FT5336_EnableIT(FT5336_Object_t *pObj)
{
return ft5336_g_mode(&pObj->Ctx, FT5336_G_MODE_INTERRUPT_TRIGGER);
}
/**
* @brief Configure the FT5336 device to stop generating IT on the given INT pin
* connected to MCU as EXTI.
* @param pObj Component object pointer
* @retval None
*/
int32_t FT5336_DisableIT(FT5336_Object_t *pObj)
{
return ft5336_g_mode(&pObj->Ctx, FT5336_G_MODE_INTERRUPT_POLLING);
}
/**
* @brief Get IT status from FT5336 interrupt status registers
* Should be called Following an EXTI coming to the MCU to know the detailed
* reason of the interrupt.
* @note : This feature is not applicable to FT5336.
* @param pObj Component object pointer
* @retval TS interrupts status : always return 0 here
*/
int32_t FT5336_ITStatus(FT5336_Object_t *pObj)
{
/* Prevent unused argument(s) compilation warning */
(void)(pObj);
/* Always return FT5336_OK as feature not applicable to FT5336 */
return FT5336_OK;
}
/**
* @brief Clear IT status in FT5336 interrupt status clear registers
* Should be called Following an EXTI coming to the MCU.
* @note : This feature is not applicable to FT5336.
* @param pObj Component object pointer
* @retval None
*/
int32_t FT5336_ClearIT(FT5336_Object_t *pObj)
{
/* Prevent unused argument(s) compilation warning */
(void)(pObj);
/* Always return FT5336_OK as feature not applicable to FT5336 */
return FT5336_OK;
}
/******************** Static functions ****************************************/
#if (FT5336_AUTO_CALIBRATION_ENABLED == 1)
/**
* @brief This function provides accurate delay (in milliseconds)
* @param pObj pointer to component object
* @param Delay: specifies the delay time length, in milliseconds
* @retval WM8994_OK
*/
static int32_t FT5336_Delay(FT5336_Object_t *pObj, uint32_t Delay)
{
uint32_t tickstart;
tickstart = pObj->IO.GetTick();
while((pObj->IO.GetTick() - tickstart) < Delay)
{
}
return FT5336_OK;
}
/**
* @brief Start TouchScreen calibration phase
* @param DeviceAddr: FT5336 Device address for communication on I2C Bus.
* @retval Status FT5336_OK or FT5336_ERROR.
*/
static int32_t FT5336_TS_Calibration(FT5336_Object_t *pObj)
{
int32_t ret = FT5336_OK;
uint32_t nbr_attempt;
uint8_t read_data;
uint8_t end_calibration = 0;
/* Switch FT5336 back to factory mode to calibrate */
if(ft5336_dev_mode_w(&pObj->Ctx, FT5336_DEV_MODE_FACTORY) != FT5336_OK)
{
ret = FT5336_ERROR;
}/* Read back the same register FT5336_DEV_MODE_REG */
else if(ft5336_dev_mode_r(&pObj->Ctx, &read_data) != FT5336_OK)
{
ret = FT5336_ERROR;
}
else
{
(void)FT5336_Delay(pObj, 300); /* Wait 300 ms */
if(read_data != FT5336_DEV_MODE_FACTORY )
{
/* Return error to caller */
ret = FT5336_ERROR;
}
else
{
/* Start calibration command */
read_data= 0x04;
if(ft5336_write_reg(&pObj->Ctx, FT5336_TD_STAT_REG, &read_data, 1) != FT5336_OK)
{
ret = FT5336_ERROR;
}
else
{
(void)FT5336_Delay(pObj, 300); /* Wait 300 ms */
/* 100 attempts to wait switch from factory mode (calibration) to working mode */
for (nbr_attempt=0; ((nbr_attempt < 100U) && (end_calibration == 0U)) ; nbr_attempt++)
{
if(ft5336_dev_mode_r(&pObj->Ctx, &read_data) != FT5336_OK)
{
ret = FT5336_ERROR;
break;
}
if(read_data == FT5336_DEV_MODE_WORKING)
{
/* Auto Switch to FT5336_DEV_MODE_WORKING : means calibration have ended */
end_calibration = 1; /* exit for loop */
}
(void)FT5336_Delay(pObj, 200); /* Wait 200 ms */
}
}
}
}
return ret;
}
#endif /* FT5336_AUTO_CALIBRATION_ENABLED == 1 */
/**
* @brief Return if there is touches detected or not.
* Try to detect new touches and forget the old ones (reset internal global
* variables).
* @param pObj Component object pointer
* @retval Number of active touches detected (can be 0, 1 or 2) or FT5336_ERROR
* in case of error
*/
static int32_t FT5336_DetectTouch(FT5336_Object_t *pObj)
{
int32_t ret;
uint8_t nb_touch;
/* Read register FT5336_TD_STAT_REG to check number of touches detection */
if(ft5336_td_status(&pObj->Ctx, &nb_touch) != FT5336_OK)
{
ret = FT5336_ERROR;
}
else
{
if(nb_touch > FT5336_MAX_NB_TOUCH)
{
/* If invalid number of touch detected, set it to zero */
ret = 0;
}
else
{
ret = (int32_t)nb_touch;
}
}
return ret;
}
/**
* @brief Function
* @param handle: Component object handle
* @param Reg: The target register address to write
* @param pData: The target register value to be written
* @param Length: buffer size to be written
* @retval error status
*/
static int32_t ReadRegWrap(void *handle, uint8_t Reg, uint8_t* pData, uint16_t Length)
{
FT5336_Object_t *pObj = (FT5336_Object_t *)handle;
return pObj->IO.ReadReg(pObj->IO.Address, Reg, pData, Length);
}
/**
* @brief Function
* @param handle: Component object handle
* @param Reg: The target register address to write
* @param pData: The target register value to be written
* @param Length: buffer size to be written
* @retval error status
*/
static int32_t WriteRegWrap(void *handle, uint8_t Reg, uint8_t* pData, uint16_t Length)
{
FT5336_Object_t *pObj = (FT5336_Object_t *)handle;
return pObj->IO.WriteReg(pObj->IO.Address, Reg, pData, Length);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,220 @@
/**
******************************************************************************
* @file ft5336.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the
* ft5336.c IO expander driver.
******************************************************************************
* @attention
*
* <h2><center>&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
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef FT5336_H
#define FT5336_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "ft5336_reg.h"
#include <stddef.h>
#include "ft5336_conf.h"
/* Macros --------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup FT5336
* @{
*/
/** @defgroup FT5336_Exported_Constants FT5336 Exported Constants
* @{
*/
#define FT5336_OK (0)
#define FT5336_ERROR (-1)
/* Max detectable simultaneous touches */
#define FT5336_MAX_NB_TOUCH 5U
/* Touch FT5336 IDs */
#define FT5336_ID 0x51U
/* Possible values of FT5336_DEV_MODE_REG */
#define FT5336_DEV_MODE_WORKING 0x00U
#define FT5336_DEV_MODE_FACTORY 0x04U
/* Possible values of FT5336_GEST_ID_REG */
#define FT5336_GEST_ID_NO_GESTURE 0x00U
#define FT5336_GEST_ID_MOVE_UP 0x10U
#define FT5336_GEST_ID_MOVE_RIGHT 0x14U
#define FT5336_GEST_ID_MOVE_DOWN 0x18U
#define FT5336_GEST_ID_MOVE_LEFT 0x1CU
#define FT5336_GEST_ID_ZOOM_IN 0x48U
#define FT5336_GEST_ID_ZOOM_OUT 0x49U
/* Values Pn_XH and Pn_YH related */
#define FT5336_TOUCH_EVT_FLAG_PRESS_DOWN 0x00U
#define FT5336_TOUCH_EVT_FLAG_LIFT_UP 0x01U
#define FT5336_TOUCH_EVT_FLAG_CONTACT 0x02U
#define FT5336_TOUCH_EVT_FLAG_NO_EVENT 0x03U
/* Possible values of FT5336_GMODE_REG */
#define FT5336_G_MODE_INTERRUPT_POLLING 0x00U
#define FT5336_G_MODE_INTERRUPT_TRIGGER 0x01U
/**
* @}
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup FT5336_Exported_Types FT5336 Exported Types
* @{
*/
typedef struct
{
uint32_t Radian;
uint32_t OffsetLeftRight;
uint32_t OffsetUpDown;
uint32_t DistanceLeftRight;
uint32_t DistanceUpDown;
uint32_t DistanceZoom;
}FT5336_Gesture_Init_t;
typedef int32_t (*FT5336_Init_Func) (void);
typedef int32_t (*FT5336_DeInit_Func) (void);
typedef int32_t (*FT5336_GetTick_Func) (void);
typedef int32_t (*FT5336_Delay_Func) (uint32_t);
typedef int32_t (*FT5336_WriteReg_Func)(uint16_t, uint16_t, uint8_t*, uint16_t);
typedef int32_t (*FT5336_ReadReg_Func) (uint16_t, uint16_t, uint8_t*, uint16_t);
typedef struct
{
FT5336_Init_Func Init;
FT5336_DeInit_Func DeInit;
uint16_t Address;
FT5336_WriteReg_Func WriteReg;
FT5336_ReadReg_Func ReadReg;
FT5336_GetTick_Func GetTick;
} FT5336_IO_t;
typedef struct
{
uint32_t TouchDetected;
uint32_t TouchX;
uint32_t TouchY;
} FT5336_State_t;
typedef struct
{
uint32_t TouchDetected;
uint32_t TouchX[FT5336_MAX_NB_TOUCH];
uint32_t TouchY[FT5336_MAX_NB_TOUCH];
uint32_t TouchWeight[FT5336_MAX_NB_TOUCH];
uint32_t TouchEvent[FT5336_MAX_NB_TOUCH];
uint32_t TouchArea[FT5336_MAX_NB_TOUCH];
} FT5336_MultiTouch_State_t;
typedef struct
{
FT5336_IO_t IO;
ft5336_ctx_t Ctx;
uint8_t IsInitialized;
} FT5336_Object_t;
typedef struct
{
uint8_t MultiTouch;
uint8_t Gesture;
uint8_t MaxTouch;
uint32_t MaxXl;
uint32_t MaxYl;
} FT5336_Capabilities_t;
typedef struct
{
int32_t ( *Init ) ( FT5336_Object_t *);
int32_t ( *DeInit ) ( FT5336_Object_t * );
int32_t ( *GestureConfig ) ( FT5336_Object_t *, FT5336_Gesture_Init_t* );
int32_t ( *ReadID ) ( FT5336_Object_t *, uint32_t * );
int32_t ( *GetState ) ( FT5336_Object_t *, FT5336_State_t* );
int32_t ( *GetMultiTouchState ) ( FT5336_Object_t *, FT5336_MultiTouch_State_t* );
int32_t ( *GetGesture ) ( FT5336_Object_t *, uint8_t* );
int32_t ( *GetCapabilities ) ( FT5336_Object_t *, FT5336_Capabilities_t * );
int32_t ( *EnableIT ) ( FT5336_Object_t * );
int32_t ( *DisableIT ) ( FT5336_Object_t * );
int32_t ( *ClearIT ) ( FT5336_Object_t * );
int32_t ( *ITStatus ) ( FT5336_Object_t * );
} FT5336_TS_Drv_t;
/**
* @}
*/
/** @addtogroup FT5336_Exported_Variables
* @{
*/
extern FT5336_TS_Drv_t FT5336_TS_Driver;
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup FT5336_Exported_Functions
* @{
*/
int32_t FT5336_RegisterBusIO (FT5336_Object_t *pObj, FT5336_IO_t *pIO);
int32_t FT5336_Init(FT5336_Object_t *pObj);
int32_t FT5336_DeInit(FT5336_Object_t *pObj);
int32_t FT5336_GestureConfig(FT5336_Object_t *pObj, FT5336_Gesture_Init_t *GestureInit);
int32_t FT5336_ReadID(FT5336_Object_t *pObj, uint32_t *Id);
int32_t FT5336_GetState(FT5336_Object_t *pObj, FT5336_State_t *State);
int32_t FT5336_GetMultiTouchState(FT5336_Object_t *pObj, FT5336_MultiTouch_State_t *State);
int32_t FT5336_GetGesture(FT5336_Object_t *pObj, uint8_t *GestureId);
int32_t FT5336_EnableIT(FT5336_Object_t *pObj);
int32_t FT5336_DisableIT(FT5336_Object_t *pObj);
int32_t FT5336_ITStatus(FT5336_Object_t *pObj);
int32_t FT5336_ClearIT(FT5336_Object_t *pObj);
int32_t FT5336_GetCapabilities(FT5336_Object_t *pObj, FT5336_Capabilities_t *Capabilities);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* FT5336_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,42 @@
/**
******************************************************************************
* @file ft5336_conf.h
* @author MCD Application Team
* @brief This file contains specific configuration for the
* ft5336.c that can be modified by user.
******************************************************************************
* @attention
*
* <h2><center>&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
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef FT5336_CONF_H
#define FT5336_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Macros --------------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
#define FT5336_AUTO_CALIBRATION_ENABLED 0U
#define FT5336_MAX_X_LENGTH 800U
#define FT5336_MAX_Y_LENGTH 480U
#ifdef __cplusplus
}
#endif
#endif /* FT5336_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,971 @@
/**
******************************************************************************
* @file ft5336_reg.h
* @author MCD Application Team
* @brief Header of ft5336_reg.c
*
******************************************************************************
* @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
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef FT5336_REG_H
#define FT5336_REG_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Macros --------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup FT5336
* @{
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup FT5336_Exported_Types FT5336 Exported Types
* @{
*/
/************** Generic Function *******************/
typedef int32_t (*FT5336_Write_Func)(void *, uint8_t, uint8_t*, uint16_t);
typedef int32_t (*FT5336_Read_Func) (void *, uint8_t, uint8_t*, uint16_t);
/**
* @}
*/
/** @defgroup FT5336_Imported_Globals FT5336 Imported Globals
* @{
*/
typedef struct
{
FT5336_Write_Func WriteReg;
FT5336_Read_Func ReadReg;
void *handle;
} ft5336_ctx_t;
/**
* @}
*/
/** @defgroup FT5336_Exported_Constants FT5336 Exported Constants
* @{
*/
/* Current mode register of the FT5336 (R/W) */
#define FT5336_DEV_MODE_REG 0x00
/* Gesture ID register */
#define FT5336_GEST_ID_REG 0x01
/* Touch Data Status register : gives number of active touch points (0..2) */
#define FT5336_TD_STAT_REG 0x02
/* P1 X, Y coordinates, weight and misc registers */
#define FT5336_P1_XH_REG 0x03U
#define FT5336_P1_XL_REG 0x04U
#define FT5336_P1_YH_REG 0x05U
#define FT5336_P1_YL_REG 0x06U
#define FT5336_P1_WEIGHT_REG 0x07U
#define FT5336_P1_MISC_REG 0x08U
/* P2 X, Y coordinates, weight and misc registers */
#define FT5336_P2_XH_REG 0x09U
#define FT5336_P2_XL_REG 0x0AU
#define FT5336_P2_YH_REG 0x0BU
#define FT5336_P2_YL_REG 0x0CU
#define FT5336_P2_WEIGHT_REG 0x0DU
#define FT5336_P2_MISC_REG 0x0EU
/* P3 X, Y coordinates, weight and misc registers */
#define FT5336_P3_XH_REG 0x0FU
#define FT5336_P3_XL_REG 0x10U
#define FT5336_P3_YH_REG 0x11U
#define FT5336_P3_YL_REG 0x12U
#define FT5336_P3_WEIGHT_REG 0x13U
#define FT5336_P3_MISC_REG 0x14U
/* P4 X, Y coordinates, weight and misc registers */
#define FT5336_P4_XH_REG 0x15U
#define FT5336_P4_XL_REG 0x16U
#define FT5336_P4_YH_REG 0x17U
#define FT5336_P4_YL_REG 0x18U
#define FT5336_P4_WEIGHT_REG 0x19U
#define FT5336_P4_MISC_REG 0x1AU
/* P5 X, Y coordinates, weight and misc registers */
#define FT5336_P5_XH_REG 0x1BU
#define FT5336_P5_XL_REG 0x1CU
#define FT5336_P5_YH_REG 0x1DU
#define FT5336_P5_YL_REG 0x1EU
#define FT5336_P5_WEIGHT_REG 0x1FU
#define FT5336_P5_MISC_REG 0x20U
/* P6 X, Y coordinates, weight and misc registers */
#define FT5336_P6_XH_REG 0x21U
#define FT5336_P6_XL_REG 0x22U
#define FT5336_P6_YH_REG 0x23U
#define FT5336_P6_YL_REG 0x24U
#define FT5336_P6_WEIGHT_REG 0x25U
#define FT5336_P6_MISC_REG 0x26U
/* P7 X, Y coordinates, weight and misc registers */
#define FT5336_P7_XH_REG 0x27U
#define FT5336_P7_XL_REG 0x28U
#define FT5336_P7_YH_REG 0x29U
#define FT5336_P7_YL_REG 0x2AU
#define FT5336_P7_WEIGHT_REG 0x2BU
#define FT5336_P7_MISC_REG 0x2CU
/* P8 X, Y coordinates, weight and misc registers */
#define FT5336_P8_XH_REG 0x2DU
#define FT5336_P8_XL_REG 0x2EU
#define FT5336_P8_YH_REG 0x2FU
#define FT5336_P8_YL_REG 0x30U
#define FT5336_P8_WEIGHT_REG 0x31U
#define FT5336_P8_MISC_REG 0x32U
/* P9 X, Y coordinates, weight and misc registers */
#define FT5336_P9_XH_REG 0x33U
#define FT5336_P9_XL_REG 0x34U
#define FT5336_P9_YH_REG 0x35U
#define FT5336_P9_YL_REG 0x36U
#define FT5336_P9_WEIGHT_REG 0x37U
#define FT5336_P9_MISC_REG 0x38U
/* P10 X, Y coordinates, weight and misc registers */
#define FT5336_P10_XH_REG 0x39U
#define FT5336_P10_XL_REG 0x3AU
#define FT5336_P10_YH_REG 0x3BU
#define FT5336_P10_YL_REG 0x3CU
#define FT5336_P10_WEIGHT_REG 0x3DU
#define FT5336_P10_MISC_REG 0x3EU
/* Threshold for touch detection */
#define FT5336_TH_GROUP_REG 0x80
/* Filter function coefficients */
#define FT5336_TH_DIFF_REG 0x85
/* Control register */
#define FT5336_CTRL_REG 0x86
/* The time period of switching from Active mode to Monitor mode when there is no touching */
#define FT5336_TIMEENTERMONITOR_REG 0x87
/* Report rate in Active mode */
#define FT5336_PERIODACTIVE_REG 0x88
/* Report rate in Monitor mode */
#define FT5336_PERIODMONITOR_REG 0x89
/* The value of the minimum allowed angle while Rotating gesture mode */
#define FT5336_RADIAN_VALUE_REG 0x91
/* Maximum offset while Moving Left and Moving Right gesture */
#define FT5336_OFFSET_LR_REG 0x92
/* Maximum offset while Moving Up and Moving Down gesture */
#define FT5336_OFFSET_UD_REG 0x93
/* Minimum distance while Moving Left and Moving Right gesture */
#define FT5336_DISTANCE_LR_REG 0x94
/* Minimum distance while Moving Up and Moving Down gesture */
#define FT5336_DISTANCE_UD_REG 0x95
/* Maximum distance while Zoom In and Zoom Out gesture */
#define FT5336_DISTANCE_ZOOM_REG 0x96
/* High 8-bit of LIB Version info */
#define FT5336_LIB_VER_H_REG 0xA1
/* Low 8-bit of LIB Version info */
#define FT5336_LIB_VER_L_REG 0xA2
/* Chip Selecting */
#define FT5336_CIPHER_REG 0xA3
/* Interrupt mode register (used when in interrupt mode) */
#define FT5336_GMODE_REG 0xA4
/* Current power mode the FT5336 system is in (R) */
#define FT5336_PWR_MODE_REG 0xA5
/* FT5336 firmware version */
#define FT5336_FIRMID_REG 0xA6
/* FT5336 Chip identification register */
#define FT5336_CHIP_ID_REG 0xA8
/* Release code version */
#define FT5336_RELEASE_CODE_ID_REG 0xAF
/* Current operating mode the FT5336 system is in (R) */
#define FT5336_STATE_REG 0xBC
/**
* @}
*/
/*******************************************************************************
* Register : Generic - All
* Address : Generic - All
* Bit Group Name: None
* Permission : W
*******************************************************************************/
int32_t ft5336_write_reg(ft5336_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
int32_t ft5336_read_reg(ft5336_ctx_t *ctx, uint8_t reg, uint8_t *pbuf, uint16_t length);
/**************** Base Function *******************/
/*******************************************************************************
* Register : DEV_MODE
* Address : 0X00
* Bit Group Name: DEVICE_MODE
* Permission : RW
*******************************************************************************/
#define FT5336_DEV_MODE_BIT_MASK 0x70U
#define FT5336_DEV_MODE_BIT_POSITION 4
int32_t ft5336_dev_mode_w(ft5336_ctx_t *ctx, uint8_t value);
int32_t ft5336_dev_mode_r(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : GEST_ID
* Address : 0X01
* Bit Group Name: Gesture ID
* Permission : R
*******************************************************************************/
#define FT5336_GEST_ID_BIT_MASK 0xFFU
#define FT5336_GEST_ID_BIT_POSITION 0
int32_t ft5336_gest_id(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : TD_STATUS
* Address : 0X02
* Bit Group Name:
* Permission : R
*******************************************************************************/
#define FT5336_TD_STATUS_BIT_MASK 0x0FU
#define FT5336_TD_STATUS_BIT_POSITION 0
int32_t ft5336_td_status(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_XH
* Address : 0X03
* Bit Group Name: First Event Flag
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT5336_P1_XH_EF_BIT_MASK 0xC0U
#define FT5336_P1_XH_EF_BIT_POSITION 6
int32_t ft5336_p1_xh_ef(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_XH
* Address : 0X03
* Bit Group Name: First Touch X Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT5336_P1_XH_TP_BIT_MASK 0x0FU
#define FT5336_P1_XH_TP_BIT_POSITION 0
int32_t ft5336_p1_xh_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_XL
* Address : 0X04
* Bit Group Name: First Touch X Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P1_XL_TP_BIT_MASK 0xFFU
#define FT5336_P1_XL_TP_BIT_POSITION 0
int32_t ft5336_p1_xl_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_YH
* Address : 0X05
* Bit Group Name: First Touch ID
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT5336_P1_YH_TID_BIT_MASK 0xF0U
#define FT5336_P1_YH_TID_BIT_POSITION 4
int32_t ft5336_p1_yh_tid(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_YH
* Address : 0x06
* Bit Group Name: First Touch Y Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT5336_P1_YH_TP_BIT_MASK 0x0FU
#define FT5336_P1_YH_TP_BIT_POSITION 0
int32_t ft5336_p1_yh_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_YL
* Address : 0X06
* Bit Group Name: First Touch Y Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P1_YL_TP_BIT_MASK 0xFFU
#define FT5336_P1_YL_TP_BIT_POSITION 0
int32_t ft5336_p1_yl_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_WEIGHT
* Address : 0X07
* Bit Group Name: First Touch Weight(pressure)
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P1_WEIGHT_BIT_MASK 0xFFU
#define FT5336_P1_WEIGHT_BIT_POSITION 0
int32_t ft5336_p1_weight(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P1_MISC
* Address : 0X08
* Bit Group Name: First Touch Area
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P1_MISC_BIT_MASK 0xF0U
#define FT5336_P1_MISC_BIT_POSITION 4
int32_t ft5336_p1_misc(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_XH
* Address : 0X09
* Bit Group Name: Second Event Flag
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT5336_P2_XH_EF_BIT_MASK 0xC0U
#define FT5336_P2_XH_EF_BIT_POSITION 6
int32_t ft5336_p2_xh_ef(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_XH
* Address : 0X09
* Bit Group Name: Second Touch X Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT5336_P2_XH_TP_BIT_MASK 0x0FU
#define FT5336_P2_XH_TP_BIT_POSITION 0
int32_t ft5336_p2_xh_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_XL
* Address : 0X0A
* Bit Group Name: Second Touch X Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P2_XL_TP_BIT_MASK 0xFFU
#define FT5336_P2_XL_TP_BIT_POSITION 0
int32_t ft5336_p2_xl_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_YH
* Address : 0X0B
* Bit Group Name: Second Touch ID
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT5336_P2_YH_TID_BIT_MASK 0xF0U
#define FT5336_P2_YH_TID_BIT_POSITION 4
int32_t ft5336_p2_yh_tid(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_YH
* Address : 0x0B
* Bit Group Name: Second Touch Y Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT5336_P2_YH_TP_BIT_MASK 0x0FU
#define FT5336_P2_YH_TP_BIT_POSITION 0
int32_t ft5336_p2_yh_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_YL
* Address : 0X0C
* Bit Group Name: Second Touch Y Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P2_YL_TP_BIT_MASK 0xFFU
#define FT5336_P2_YL_TP_BIT_POSITION 0
int32_t ft5336_p2_yl_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_WEIGHT
* Address : 0X0D
* Bit Group Name: Second Touch Weight(pressure)
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P2_WEIGHT_BIT_MASK 0xFFU
#define FT5336_P2_WEIGHT_BIT_POSITION 0
int32_t ft5336_p2_weight(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P2_MISC
* Address : 0X0E
* Bit Group Name: Second Touch Area
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P2_MISC_BIT_MASK 0xF0U
#define FT5336_P2_MISC_BIT_POSITION 4
int32_t ft5336_p2_misc(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P3_XH
* Address : 0X0F
* Bit Group Name: Third Event Flag
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT5336_P3_XH_EF_BIT_MASK 0xC0U
#define FT5336_P3_XH_EF_BIT_POSITION 6
int32_t ft5336_p3_xh_ef(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P3_XH
* Address : 0X0F
* Bit Group Name: Third Touch X High Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT5336_P3_XH_TP_BIT_MASK 0x0FU
#define FT5336_P3_XH_TP_BIT_POSITION 0
int32_t ft5336_p3_xh_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P3_XL
* Address : 0X10
* Bit Group Name: Third Touch X Low Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P3_XL_TP_BIT_MASK 0xFFU
#define FT5336_P3_XL_TP_BIT_POSITION 0
int32_t ft5336_p3_xl_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P3_YH
* Address : 0X11
* Bit Group Name: Third Touch ID
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT5336_P3_YH_TID_BIT_MASK 0xF0U
#define FT5336_P3_YH_TID_BIT_POSITION 4
int32_t ft5336_p3_yh_tid(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P3_YH
* Address : 0x11
* Bit Group Name: Third Touch Y High Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT5336_P3_YH_TP_BIT_MASK 0x0FU
#define FT5336_P3_YH_TP_BIT_POSITION 0
int32_t ft5336_p3_yh_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P3_YL
* Address : 0X12
* Bit Group Name: Third Touch Y Low Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P3_YL_TP_BIT_MASK 0xFFU
#define FT5336_P3_YL_TP_BIT_POSITION 0
int32_t ft5336_p3_yl_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P3_WEIGHT
* Address : 0X13
* Bit Group Name: Third Touch Weight(pressure)
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P3_WEIGHT_BIT_MASK 0xFFU
#define FT5336_P3_WEIGHT_BIT_POSITION 0
int32_t ft5336_p3_weight(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P3_MISC
* Address : 0X14
* Bit Group Name: Third Touch Area
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P3_MISC_BIT_MASK 0xF0U
#define FT5336_P3_MISC_BIT_POSITION 4
int32_t ft5336_p3_misc(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P4_XH
* Address : 0X15
* Bit Group Name: Fourth Event Flag
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT5336_P4_XH_EF_BIT_MASK 0xC0U
#define FT5336_P4_XH_EF_BIT_POSITION 6
int32_t ft5336_p4_xh_ef(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P4_XH
* Address : 0X15
* Bit Group Name: Fourth Touch X High Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT5336_P4_XH_TP_BIT_MASK 0x0FU
#define FT5336_P4_XH_TP_BIT_POSITION 0
int32_t ft5336_p4_xh_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P4_XL
* Address : 0X16
* Bit Group Name: Fourth Touch X Low Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P4_XL_TP_BIT_MASK 0xFFU
#define FT5336_P4_XL_TP_BIT_POSITION 0
int32_t ft5336_p4_xl_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P4_YH
* Address : 0X17
* Bit Group Name: Fourth Touch ID
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT5336_P4_YH_TID_BIT_MASK 0xF0U
#define FT5336_P4_YH_TID_BIT_POSITION 4
int32_t ft5336_p4_yh_tid(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P4_YH
* Address : 0x17
* Bit Group Name: Fourth Touch Y High Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT5336_P4_YH_TP_BIT_MASK 0x0FU
#define FT5336_P4_YH_TP_BIT_POSITION 0
int32_t ft5336_p4_yh_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P4_YL
* Address : 0X18
* Bit Group Name: Fourth Touch Y Low Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P4_YL_TP_BIT_MASK 0xFFU
#define FT5336_P4_YL_TP_BIT_POSITION 0
int32_t ft5336_p4_yl_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P4_WEIGHT
* Address : 0X19
* Bit Group Name: Fourth Touch Weight(pressure)
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P4_WEIGHT_BIT_MASK 0xFFU
#define FT5336_P4_WEIGHT_BIT_POSITION 0
int32_t ft5336_p4_weight(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P4_MISC
* Address : 0X1A
* Bit Group Name: Fourth Touch Area
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P4_MISC_BIT_MASK 0xF0U
#define FT5336_P4_MISC_BIT_POSITION 4
int32_t ft5336_p4_misc(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P5_XH
* Address : 0X1B
* Bit Group Name: Fifth Event Flag
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT5336_P5_XH_EF_BIT_MASK 0xC0U
#define FT5336_P5_XH_EF_BIT_POSITION 6
int32_t ft5336_p5_xh_ef(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P5_XH
* Address : 0X1B
* Bit Group Name: Fifth Touch X High Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT5336_P5_XH_TP_BIT_MASK 0x0FU
#define FT5336_P5_XH_TP_BIT_POSITION 0
int32_t ft5336_p5_xh_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P5_XL
* Address : 0X1C
* Bit Group Name: Fifth Touch X Low Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P5_XL_TP_BIT_MASK 0xFFU
#define FT5336_P5_XL_TP_BIT_POSITION 0
int32_t ft5336_p5_xl_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P5_YH
* Address : 0X1D
* Bit Group Name: Fifth Touch ID
* Permission : R
* Default value : 0xF0U
*******************************************************************************/
#define FT5336_P5_YH_TID_BIT_MASK 0xF0U
#define FT5336_P5_YH_TID_BIT_POSITION 4
int32_t ft5336_p5_yh_tid(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P5_YH
* Address : 0x1D
* Bit Group Name: Fifth Touch Y High Position
* Permission : R
* Default value : 0x0FU
*******************************************************************************/
#define FT5336_P5_YH_TP_BIT_MASK 0x0FU
#define FT5336_P5_YH_TP_BIT_POSITION 0
int32_t ft5336_p5_yh_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P5_YL
* Address : 0X1E
* Bit Group Name: Fifth Touch Y Low Position
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P5_YL_TP_BIT_MASK 0xFFU
#define FT5336_P5_YL_TP_BIT_POSITION 0
int32_t ft5336_p5_yl_tp(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P5_WEIGHT
* Address : 0X1F
* Bit Group Name: Fifth Touch Weight(pressure)
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P5_WEIGHT_BIT_MASK 0xFFU
#define FT5336_P5_WEIGHT_BIT_POSITION 0
int32_t ft5336_p5_weight(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : P5_MISC
* Address : 0X20
* Bit Group Name: Fifth Touch Area
* Permission : R
* Default value : 0xFFU
*******************************************************************************/
#define FT5336_P5_MISC_BIT_MASK 0xF0U
#define FT5336_P5_MISC_BIT_POSITION 4
int32_t ft5336_p5_misc(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : TH_GROUP
* Address : 0X80
* Bit Group Name: Threshold for touch detection
* Permission : RW
* Default value : None
*******************************************************************************/
#define FT5336_TH_GROUP_BIT_MASK 0xFFU
#define FT5336_TH_GROUP_BIT_POSITION 0
int32_t ft5336_th_group(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : TH_DIFF
* Address : 0X85
* Bit Group Name: Filter function coefficient
* Permission : RW
* Default value : None
*******************************************************************************/
#define FT5336_TH_DIFF_BIT_MASK 0xFFU
#define FT5336_TH_DIFF_BIT_POSITION 0
int32_t ft5336_th_diff(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : CTRL
* Address : 0X86
* Bit Group Name:
* Permission : RW
* Default value : 0x01
*******************************************************************************/
#define FT5336_CTRL_BIT_MASK 0xFFU
#define FT5336_CTRL_BIT_POSITION 0
int32_t ft5336_ctrl(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : TIMEENTERMONITOR
* Address : 0X87
* Bit Group Name:
* Permission : RW
* Default value : 0x0A
*******************************************************************************/
#define FT5336_TIMEENTERMONITOR_BIT_MASK 0xFFU
#define FT5336_TIMEENTERMONITOR_BIT_POSITION 0
int32_t ft5336_time_enter_monitor(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : PERIODACTIVE
* Address : 0X88
* Bit Group Name:
* Permission : RW
* Default value : None
*******************************************************************************/
#define FT5336_PERIODACTIVE_BIT_MASK 0xFFU
#define FT5336_PERIODACTIVE_BIT_POSITION 0
int32_t ft5336_period_active(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : PERIODMONITOR
* Address : 0X89
* Bit Group Name:
* Permission : RW
* Default value : 0x28
*******************************************************************************/
#define FT5336_PERIODMONITOR_BIT_MASK 0xFFU
#define FT5336_PERIODMONITOR_BIT_POSITION 0
int32_t ft5336_period_monitor(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : RADIAN_VALUE
* Address : 0X91
* Bit Group Name:
* Permission : RW
* Default value : 0x0A
*******************************************************************************/
#define FT5336_RADIAN_VALUE_BIT_MASK 0xFFU
#define FT5336_RADIAN_VALUE_BIT_POSITION 0
int32_t ft5336_radian_value(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : OFFSET_LEFT_RIGHT
* Address : 0X92
* Bit Group Name:
* Permission : RW
* Default value : 0x19
*******************************************************************************/
#define FT5336_OFFSET_LR_BIT_MASK 0xFFU
#define FT5336_OFFSET_LR_BIT_POSITION 0
int32_t ft5336_offset_left_right(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : OFFSET_UP_DOWN
* Address : 0X93
* Bit Group Name:
* Permission : RW
* Default value : 0x19
*******************************************************************************/
#define FT5336_OFFSET_UD_BIT_MASK 0xFFU
#define FT5336_OFFSET_UD_BIT_POSITION 0
int32_t ft5336_offset_up_down(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : DISTANCE_LEFT_RIGHT
* Address : 0X94
* Bit Group Name:
* Permission : RW
* Default value : 0x19
*******************************************************************************/
#define FT5336_DISTANCE_LR_BIT_MASK 0xFFU
#define FT5336_DISTANCE_LR_BIT_POSITION 0
int32_t ft5336_disatnce_left_right(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : DISTANCE_UP_DOWN
* Address : 0X95
* Bit Group Name:
* Permission : RW
* Default value : 0x19
*******************************************************************************/
#define FT5336_DISTANCE_UD_BIT_MASK 0xFFU
#define FT5336_DISTANCE_UD_BIT_POSITION 0
int32_t ft5336_distance_up_down(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : DISTANCE_ZOOM
* Address : 0X96
* Bit Group Name:
* Permission : RW
* Default value : 0x32
*******************************************************************************/
#define FT5336_DISTANCE_ZOOM_BIT_MASK 0xFFU
#define FT5336_DISTANCE_ZOOM_BIT_POSITION 0
int32_t ft5336_distance_zoom(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : LIB_VER_H
* Address : 0XA1
* Bit Group Name:
* Permission : R
* Default value : None
*******************************************************************************/
#define FT5336_LIB_VER_H_BIT_MASK 0xFFU
#define FT5336_LIB_VER_H_BIT_POSITION 0
int32_t ft5336_lib_ver_high(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : LIB_VER_L
* Address : 0XA2
* Bit Group Name:
* Permission : R
* Default value : None
*******************************************************************************/
#define FT5336_LIB_VER_L_BIT_MASK 0xFFU
#define FT5336_LIB_VER_L_BIT_POSITION 0
int32_t ft5336_lib_ver_low(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : CIPHER
* Address : 0XA3
* Bit Group Name:
* Permission : R
* Default value : 0x06
*******************************************************************************/
#define FT5336_CIPHER_BIT_MASK 0xFFU
#define FT5336_CIPHER_BIT_POSITION 0
int32_t ft5336_cipher(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : G_MODE
* Address : 0XA4
* Bit Group Name:
* Permission : RW
* Default value : 0x01
*******************************************************************************/
#define FT5336_G_MODE_BIT_MASK 0xFFU
#define FT5336_G_MODE_BIT_POSITION 0
int32_t ft5336_g_mode(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : PWR_MODE
* Address : 0XA5
* Bit Group Name:
* Permission : RW
* Default value : 0x00
*******************************************************************************/
#define FT5336_PWR_MODE_BIT_MASK 0xFFU
#define FT5336_PWR_MODE_BIT_POSITION 0
int32_t ft5336_pwr_mode(ft5336_ctx_t *ctx, uint8_t value);
/*******************************************************************************
* Register : FIRMID
* Address : 0XA6
* Bit Group Name:
* Permission : R
* Default value : None
*******************************************************************************/
#define FT5336_FIRMID_BIT_MASK 0xFFU
#define FT5336_FIRMID_BIT_POSITION 0
int32_t ft5336_firm_id(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : FOCALTECH_ID
* Address : 0XA8
* Bit Group Name:
* Permission : R
* Default value : 0x11
*******************************************************************************/
#define FT5336_CHIP_ID_BIT_MASK 0xFFU
#define FT5336_CHIP_ID_BIT_POSITION 0
int32_t ft5336_chip_id(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : RELEASE_CODE_ID
* Address : 0XAF
* Bit Group Name:
* Permission : R
* Default value : 0x001
*******************************************************************************/
#define FT5336_RC_ID_BIT_MASK 0xFFU
#define FT5336_RC_ID_BIT_POSITION 0
int32_t ft5336_release_code_id(ft5336_ctx_t *ctx, uint8_t *value);
/*******************************************************************************
* Register : STATE
* Address : 0XBC
* Bit Group Name:
* Permission : RW
* Default value : 0x01
*******************************************************************************/
#define FT5336_STATE_BIT_MASK 0xFFU
#define FT5336_STATE_BIT_POSITION 0
int32_t ft5336_state(ft5336_ctx_t *ctx, uint8_t value);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* FT5336_REG_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Release Notes for FT6X06 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-ft6x06-ts-component-driver"><strong>Release Notes for FT6X06 TS Component Driver</strong></h1>
<p>Copyright © 2015 STMicroelectronics<br />
</p>
<a href="https://www.st.com" class="logo"><img src="_htmresc/st_logo.png" alt="ST logo" /></a>
</center>
</div>
</div>
<h1 id="license">License</h1>
This software component is licensed by ST under BSD 3-Clause license, the “License”; You may not use this component except in compliance with the License. You may obtain a copy of the License at:
<center>
<a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a>
</center>
<h1 id="purpose">Purpose</h1>
<p>This driver provides a set of Touch Screen functions offered by FT6X06 component</p>
</div>
<div class="col-sm-12 col-lg-8">
<h1 id="update-history">Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section4" checked aria-hidden="true"> <label for="collapse-section4" aria-hidden="true"><strong>V2.0.0 / 23-November-2019</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>First Official Release of FT6X06 Touch Screen Component Drivers in line with STM32Cube BSP drivers development guidelines (UM2298)</li>
<li>The component drivers are composed of
<ul>
<li>component core drivers files: ft6X06.h/.c</li>
<li>component register drivers files: ft6X06_reg.h/.c</li>
<li>component configuration file ft6X06_conf_template.h file</li>
</ul></li>
</ul>
<h2 id="backward-compatibility">Backward Compatibility</h2>
<ul>
<li>This version breaks the compatibility with previous versions</li>
</ul>
<h2 id="dependencies">Dependencies</h2>
<p>This software release is compatible with:</p>
<ul>
<li>BSP Common v6.0.0 or above</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V1.0.2 / 07-April-2017</strong></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"><strong>V1.0.1 / 03-Mai-2016</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>Add support of FT6x36 Touch controller</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" checked aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 03-August-2015</strong></label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>First official release of <strong>FT6X06</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>

View file

@ -0,0 +1,104 @@
---
pagetitle: Release Notes for FT6X06 Component Driver
lang: en
---
::: {.row}
::: {.col-sm-12 .col-lg-4}
::: {.card .fluid}
::: {.sectione .dark}
<center>
# **Release Notes for FT6X06 TS Component Driver**
Copyright &copy; 2015 STMicroelectronics\
[![ST logo](_htmresc/st_logo.png)](https://www.st.com){.logo}
</center>
:::
:::
# License
This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this component except in
compliance with the License. You may obtain a copy of the License at:
<center>
[https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)
</center>
# Purpose
This driver provides a set of Touch Screen functions offered by FT6X06 component
:::
::: {.col-sm-12 .col-lg-8}
# Update History
::: {.collapse}
<input type="checkbox" id="collapse-section4" checked aria-hidden="true">
<label for="collapse-section4" aria-hidden="true">__V2.0.0 / 23-November-2019__</label>
<div>
## Main Changes
- First Official Release of FT6X06 Touch Screen Component Drivers in line with STM32Cube BSP drivers development guidelines (UM2298)
- The component drivers are composed of
- component core drivers files: ft6X06.h/.c
- component register drivers files: ft6X06_reg.h/.c
- component configuration file ft6X06_conf_template.h file
## Backward Compatibility
- This version breaks the compatibility with previous versions
## Dependencies
This software release is compatible with:
- BSP Common v6.0.0 or above
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section3" checked aria-hidden="true">
<label for="collapse-section3" aria-hidden="true">__V1.0.2 / 07-April-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 / 03-Mai-2016__</label>
<div>
## Main Changes
- Add support of FT6x36 Touch controller
</div>
:::
::: {.collapse}
<input type="checkbox" id="collapse-section1" checked aria-hidden="true">
<label for="collapse-section1" aria-hidden="true">__V1.0.0 / 03-August-2015__</label>
<div>
## Main Changes
- First official release of **FT6X06** 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

Some files were not shown because too many files have changed in this diff Show more