initial working (stm32f4-discovery)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 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.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32_adafruit_lcd.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the common defines and functions prototypes for
|
||||
* the stm32_adafruit_lcd.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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 __STM32_ADAFRUIT_LCD_H
|
||||
#define __STM32_ADAFRUIT_LCD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Components/st7735/st7735.h"
|
||||
#include "../../../Utilities/Fonts/fonts.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32_ADAFRUIT
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32_ADAFRUIT_LCD
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM32_ADAFRUIT_LCD_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Draw Properties structures definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t TextColor;
|
||||
uint32_t BackColor;
|
||||
sFONT *pFont;
|
||||
|
||||
}LCD_DrawPropTypeDef;
|
||||
|
||||
/**
|
||||
* @brief Point structures definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int16_t X;
|
||||
int16_t Y;
|
||||
|
||||
}Point, * pPoint;
|
||||
|
||||
/**
|
||||
* @brief Line mode structures definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CENTER_MODE = 0x01, /*!< Center mode */
|
||||
RIGHT_MODE = 0x02, /*!< Right mode */
|
||||
LEFT_MODE = 0x03 /*!< Left mode */
|
||||
|
||||
}Line_ModeTypdef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32_ADAFRUIT_LCD_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define __IO volatile
|
||||
|
||||
/**
|
||||
* @brief LCD status structure definition
|
||||
*/
|
||||
#define LCD_OK 0x00
|
||||
#define LCD_ERROR 0x01
|
||||
#define LCD_TIMEOUT 0x02
|
||||
|
||||
/**
|
||||
* @brief LCD color
|
||||
*/
|
||||
#define LCD_COLOR_BLACK 0x0000
|
||||
#define LCD_COLOR_GREY 0xF7DE
|
||||
#define LCD_COLOR_BLUE 0x001F
|
||||
#define LCD_COLOR_RED 0xF800
|
||||
#define LCD_COLOR_GREEN 0x07E0
|
||||
#define LCD_COLOR_CYAN 0x07FF
|
||||
#define LCD_COLOR_MAGENTA 0xF81F
|
||||
#define LCD_COLOR_YELLOW 0xFFE0
|
||||
#define LCD_COLOR_WHITE 0xFFFF
|
||||
|
||||
/**
|
||||
* @brief LCD default font
|
||||
*/
|
||||
#define LCD_DEFAULT_FONT Font8
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32_ADAFRUIT_LCD_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_LCD_Init(void);
|
||||
uint32_t BSP_LCD_GetXSize(void);
|
||||
uint32_t BSP_LCD_GetYSize(void);
|
||||
|
||||
uint16_t BSP_LCD_GetTextColor(void);
|
||||
uint16_t BSP_LCD_GetBackColor(void);
|
||||
void BSP_LCD_SetTextColor(__IO uint16_t Color);
|
||||
void BSP_LCD_SetBackColor(__IO uint16_t Color);
|
||||
void BSP_LCD_SetFont(sFONT *fonts);
|
||||
sFONT *BSP_LCD_GetFont(void);
|
||||
|
||||
void BSP_LCD_Clear(uint16_t Color);
|
||||
void BSP_LCD_ClearStringLine(uint16_t Line);
|
||||
void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr);
|
||||
void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Line_ModeTypdef Mode);
|
||||
void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
|
||||
|
||||
void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code);
|
||||
void BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
|
||||
void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
|
||||
void BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
|
||||
void BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
|
||||
void BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
|
||||
void BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount);
|
||||
void BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
|
||||
void BSP_LCD_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pBmp);
|
||||
void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
|
||||
void BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
|
||||
void BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount);
|
||||
void BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
|
||||
|
||||
void BSP_LCD_DisplayOff(void);
|
||||
void BSP_LCD_DisplayOn(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32_ADAFRUIT_LCD_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,229 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32_adafruit_sd.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the common defines and functions prototypes for
|
||||
* the stm32_adafruit_sd.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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 __STM32_ADAFRUIT_SD_H
|
||||
#define __STM32_ADAFRUIT_SD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
#define __IO volatile
|
||||
|
||||
/** @addtogroup STM32_ADAFRUIT
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32_ADAFRUIT_SD
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32_ADAFRUIT_SD_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief SD status structure definition
|
||||
*/
|
||||
enum {
|
||||
BSP_SD_OK = 0x00,
|
||||
MSD_OK = 0x00,
|
||||
BSP_SD_ERROR = 0x01,
|
||||
BSP_SD_TIMEOUT
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Reserved1:2; /* Reserved */
|
||||
uint16_t DeviceSize:12; /* Device Size */
|
||||
uint8_t MaxRdCurrentVDDMin:3; /* Max. read current @ VDD min */
|
||||
uint8_t MaxRdCurrentVDDMax:3; /* Max. read current @ VDD max */
|
||||
uint8_t MaxWrCurrentVDDMin:3; /* Max. write current @ VDD min */
|
||||
uint8_t MaxWrCurrentVDDMax:3; /* Max. write current @ VDD max */
|
||||
uint8_t DeviceSizeMul:3; /* Device size multiplier */
|
||||
} struct_v1;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Reserved1:6; /* Reserved */
|
||||
uint32_t DeviceSize:22; /* Device Size */
|
||||
uint8_t Reserved2:1; /* Reserved */
|
||||
} struct_v2;
|
||||
|
||||
/**
|
||||
* @brief Card Specific Data: CSD Register
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/* Header part */
|
||||
uint8_t CSDStruct:2; /* CSD structure */
|
||||
uint8_t Reserved1:6; /* Reserved */
|
||||
uint8_t TAAC:8; /* Data read access-time 1 */
|
||||
uint8_t NSAC:8; /* Data read access-time 2 in CLK cycles */
|
||||
uint8_t MaxBusClkFrec:8; /* Max. bus clock frequency */
|
||||
uint16_t CardComdClasses:12; /* Card command classes */
|
||||
uint8_t RdBlockLen:4; /* Max. read data block length */
|
||||
uint8_t PartBlockRead:1; /* Partial blocks for read allowed */
|
||||
uint8_t WrBlockMisalign:1; /* Write block misalignment */
|
||||
uint8_t RdBlockMisalign:1; /* Read block misalignment */
|
||||
uint8_t DSRImpl:1; /* DSR implemented */
|
||||
|
||||
/* v1 or v2 struct */
|
||||
union csd_version {
|
||||
struct_v1 v1;
|
||||
struct_v2 v2;
|
||||
} version;
|
||||
|
||||
uint8_t EraseSingleBlockEnable:1; /* Erase single block enable */
|
||||
uint8_t EraseSectorSize:7; /* Erase group size multiplier */
|
||||
uint8_t WrProtectGrSize:7; /* Write protect group size */
|
||||
uint8_t WrProtectGrEnable:1; /* Write protect group enable */
|
||||
uint8_t Reserved2:2; /* Reserved */
|
||||
uint8_t WrSpeedFact:3; /* Write speed factor */
|
||||
uint8_t MaxWrBlockLen:4; /* Max. write data block length */
|
||||
uint8_t WriteBlockPartial:1; /* Partial blocks for write allowed */
|
||||
uint8_t Reserved3:5; /* Reserved */
|
||||
uint8_t FileFormatGrouop:1; /* File format group */
|
||||
uint8_t CopyFlag:1; /* Copy flag (OTP) */
|
||||
uint8_t PermWrProtect:1; /* Permanent write protection */
|
||||
uint8_t TempWrProtect:1; /* Temporary write protection */
|
||||
uint8_t FileFormat:2; /* File Format */
|
||||
uint8_t Reserved4:2; /* Reserved */
|
||||
uint8_t crc:7; /* Reserved */
|
||||
uint8_t Reserved5:1; /* always 1*/
|
||||
|
||||
} SD_CSD;
|
||||
|
||||
/**
|
||||
* @brief Card Identification Data: CID Register
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t ManufacturerID; /* ManufacturerID */
|
||||
uint16_t OEM_AppliID; /* OEM/Application ID */
|
||||
uint32_t ProdName1; /* Product Name part1 */
|
||||
uint8_t ProdName2; /* Product Name part2*/
|
||||
uint8_t ProdRev; /* Product Revision */
|
||||
uint32_t ProdSN; /* Product Serial Number */
|
||||
uint8_t Reserved1; /* Reserved1 */
|
||||
uint16_t ManufactDate; /* Manufacturing Date */
|
||||
uint8_t CID_CRC; /* CID CRC */
|
||||
uint8_t Reserved2; /* always 1 */
|
||||
} SD_CID;
|
||||
|
||||
/**
|
||||
* @brief SD Card information
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
SD_CSD Csd;
|
||||
SD_CID 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;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32_ADAFRUIT_SPI_SD_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Block Size
|
||||
*/
|
||||
#define SD_BLOCK_SIZE 0x200
|
||||
|
||||
/**
|
||||
* @brief SD detection on its memory slot
|
||||
*/
|
||||
#define SD_PRESENT ((uint8_t)0x01)
|
||||
#define SD_NOT_PRESENT ((uint8_t)0x00)
|
||||
|
||||
#define SD_DATATIMEOUT ((uint32_t)100000000)
|
||||
|
||||
/**
|
||||
* @brief SD Card information structure
|
||||
*/
|
||||
#define BSP_SD_CardInfo SD_CardInfo
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32_ADAFRUIT_SD_Exported_Macro
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32_ADAFRUIT_SD_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_SD_Init(void);
|
||||
uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
|
||||
uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
|
||||
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
|
||||
uint8_t BSP_SD_GetCardState(void);
|
||||
uint8_t BSP_SD_GetCardInfo(SD_CardInfo *pCardInfo);
|
||||
|
||||
/* Link functions for SD Card peripheral*/
|
||||
void SD_IO_Init(void);
|
||||
void SD_IO_CSState(uint8_t state);
|
||||
void SD_IO_WriteReadData(const uint8_t *DataIn, uint8_t *DataOut, uint16_t DataLength);
|
||||
uint8_t SD_IO_WriteByte(uint8_t Data);
|
||||
|
||||
/* Link function for HAL delay */
|
||||
void HAL_Delay(__IO uint32_t Delay);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32_ADAFRUIT_SD_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file accelero.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This header file contains the functions prototypes for the Accelerometer driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __ACCELERO_H
|
||||
#define __ACCELERO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ACCELERO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ACCELERO_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ACCELERO_Driver_structure Accelerometer Driver structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (*Init)(uint16_t);
|
||||
void (*DeInit)(void);
|
||||
uint8_t (*ReadID)(void);
|
||||
void (*Reset)(void);
|
||||
void (*LowPower)(void);
|
||||
void (*ConfigIT)(void);
|
||||
void (*EnableIT)(uint8_t);
|
||||
void (*DisableIT)(uint8_t);
|
||||
uint8_t (*ITStatus)(uint16_t);
|
||||
void (*ClearIT)(void);
|
||||
void (*FilterConfig)(uint8_t);
|
||||
void (*FilterCmd)(uint8_t);
|
||||
void (*GetXYZ)(int16_t *);
|
||||
}ACCELERO_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ACCELERO_Configuration_structure Accelerometer Configuration structure
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* ACCELERO struct */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Power_Mode; /* Power-down/Normal Mode */
|
||||
uint8_t AccOutput_DataRate; /* OUT data rate */
|
||||
uint8_t Axes_Enable; /* Axes enable */
|
||||
uint8_t High_Resolution; /* High Resolution enabling/disabling */
|
||||
uint8_t BlockData_Update; /* Block Data Update */
|
||||
uint8_t Endianness; /* Endian Data selection */
|
||||
uint8_t AccFull_Scale; /* Full Scale selection */
|
||||
uint8_t Communication_Mode;
|
||||
}ACCELERO_InitTypeDef;
|
||||
|
||||
/* ACCELERO High Pass Filter struct */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t HighPassFilter_Mode_Selection; /* Internal filter mode */
|
||||
uint8_t HighPassFilter_CutOff_Frequency; /* High pass filter cut-off frequency */
|
||||
uint8_t HighPassFilter_AOI1; /* HPF_enabling/disabling for AOI function on interrupt 1 */
|
||||
uint8_t HighPassFilter_AOI2; /* HPF_enabling/disabling for AOI function on interrupt 2 */
|
||||
uint8_t HighPassFilter_Data_Sel;
|
||||
uint8_t HighPassFilter_Stat;
|
||||
}ACCELERO_FilterConfigTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ACCELERO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file audio.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This header file contains the common defines and functions prototypes
|
||||
* for the Audio driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __AUDIO_H
|
||||
#define __AUDIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup AUDIO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup AUDIO_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Codec audio Standards */
|
||||
#define CODEC_STANDARD 0x04
|
||||
#define I2S_STANDARD I2S_STANDARD_PHILIPS
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup AUDIO_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup AUDIO_Driver_structure Audio Driver structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t (*Init)(uint16_t, uint16_t, uint8_t, uint32_t);
|
||||
void (*DeInit)(void);
|
||||
uint32_t (*ReadID)(uint16_t);
|
||||
uint32_t (*Play)(uint16_t, uint16_t*, uint16_t);
|
||||
uint32_t (*Pause)(uint16_t);
|
||||
uint32_t (*Resume)(uint16_t);
|
||||
uint32_t (*Stop)(uint16_t, uint32_t);
|
||||
uint32_t (*SetFrequency)(uint16_t, uint32_t);
|
||||
uint32_t (*SetVolume)(uint16_t, uint8_t);
|
||||
uint32_t (*SetMute)(uint16_t, uint32_t);
|
||||
uint32_t (*SetOutputMode)(uint16_t, uint8_t);
|
||||
uint32_t (*Reset)(uint16_t);
|
||||
}AUDIO_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __AUDIO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file camera.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This header file contains the common defines and functions prototypes
|
||||
* for the camera driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __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
|
||||
{
|
||||
void (*Init)(uint16_t, uint32_t);
|
||||
uint16_t (*ReadID)(uint16_t);
|
||||
void (*Config)(uint16_t, uint32_t, uint32_t, uint32_t);
|
||||
}CAMERA_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup CAMERA_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
#define CAMERA_R160x120 0x00 /* QQVGA Resolution */
|
||||
#define CAMERA_R320x240 0x01 /* QVGA Resolution */
|
||||
#define CAMERA_R480x272 0x02 /* 480x272 Resolution */
|
||||
#define CAMERA_R640x480 0x03 /* VGA Resolution */
|
||||
|
||||
#define CAMERA_CONTRAST_BRIGHTNESS 0x00 /* Camera contrast brightness features */
|
||||
#define CAMERA_BLACK_WHITE 0x01 /* Camera black white feature */
|
||||
#define CAMERA_COLOR_EFFECT 0x03 /* Camera color effect feature */
|
||||
|
||||
#define CAMERA_BRIGHTNESS_LEVEL0 0x00 /* Brightness level -2 */
|
||||
#define CAMERA_BRIGHTNESS_LEVEL1 0x01 /* Brightness level -1 */
|
||||
#define CAMERA_BRIGHTNESS_LEVEL2 0x02 /* Brightness level 0 */
|
||||
#define CAMERA_BRIGHTNESS_LEVEL3 0x03 /* Brightness level +1 */
|
||||
#define CAMERA_BRIGHTNESS_LEVEL4 0x04 /* Brightness level +2 */
|
||||
|
||||
#define CAMERA_CONTRAST_LEVEL0 0x05 /* Contrast level -2 */
|
||||
#define CAMERA_CONTRAST_LEVEL1 0x06 /* Contrast level -1 */
|
||||
#define CAMERA_CONTRAST_LEVEL2 0x07 /* Contrast level 0 */
|
||||
#define CAMERA_CONTRAST_LEVEL3 0x08 /* Contrast level +1 */
|
||||
#define CAMERA_CONTRAST_LEVEL4 0x09 /* Contrast level +2 */
|
||||
|
||||
#define CAMERA_BLACK_WHITE_BW 0x00 /* Black and white effect */
|
||||
#define CAMERA_BLACK_WHITE_NEGATIVE 0x01 /* Negative effect */
|
||||
#define CAMERA_BLACK_WHITE_BW_NEGATIVE 0x02 /* BW and Negative effect */
|
||||
#define CAMERA_BLACK_WHITE_NORMAL 0x03 /* Normal effect */
|
||||
|
||||
#define CAMERA_COLOR_EFFECT_NONE 0x00 /* No effects */
|
||||
#define CAMERA_COLOR_EFFECT_BLUE 0x01 /* Blue effect */
|
||||
#define CAMERA_COLOR_EFFECT_GREEN 0x02 /* Green effect */
|
||||
#define CAMERA_COLOR_EFFECT_RED 0x03 /* Red effect */
|
||||
#define CAMERA_COLOR_EFFECT_ANTIQUE 0x04 /* Antique effect */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CAMERA_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file epd.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* EPD (E Paper Display) driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __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****/
|
||||
@@ -0,0 +1,145 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file gyro.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This header file contains the functions prototypes for the gyroscope driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __GYRO_H
|
||||
#define __GYRO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup GYRO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup GYRO_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup GYRO_Driver_structure Gyroscope Driver structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (*Init)(uint16_t);
|
||||
void (*DeInit)(void);
|
||||
uint8_t (*ReadID)(void);
|
||||
void (*Reset)(void);
|
||||
void (*LowPower)(uint16_t);
|
||||
void (*ConfigIT)(uint16_t);
|
||||
void (*EnableIT)(uint8_t);
|
||||
void (*DisableIT)(uint8_t);
|
||||
uint8_t (*ITStatus)(uint16_t, uint16_t);
|
||||
void (*ClearIT)(uint16_t, uint16_t);
|
||||
void (*FilterConfig)(uint8_t);
|
||||
void (*FilterCmd)(uint8_t);
|
||||
void (*GetXYZ)(float *);
|
||||
}GYRO_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup GYRO_Config_structure Gyroscope Configuration structure
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Power_Mode; /* Power-down/Sleep/Normal Mode */
|
||||
uint8_t Output_DataRate; /* OUT data rate */
|
||||
uint8_t Axes_Enable; /* Axes enable */
|
||||
uint8_t Band_Width; /* Bandwidth selection */
|
||||
uint8_t BlockData_Update; /* Block Data Update */
|
||||
uint8_t Endianness; /* Endian Data selection */
|
||||
uint8_t Full_Scale; /* Full Scale selection */
|
||||
}GYRO_InitTypeDef;
|
||||
|
||||
/* GYRO High Pass Filter struct */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t HighPassFilter_Mode_Selection; /* Internal filter mode */
|
||||
uint8_t HighPassFilter_CutOff_Frequency; /* High pass filter cut-off frequency */
|
||||
}GYRO_FilterConfigTypeDef;
|
||||
|
||||
/*GYRO Interrupt struct */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Latch_Request; /* Latch interrupt request into CLICK_SRC register */
|
||||
uint8_t Interrupt_Axes; /* X, Y, Z Axes Interrupts */
|
||||
uint8_t Interrupt_ActiveEdge; /* Interrupt Active edge */
|
||||
}GYRO_InterruptConfigTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GYRO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,168 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file idd.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This file contains all the functions prototypes for the IDD driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __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_Config_structure IDD Configuration structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t AmpliGain; /*!< Specifies ampli gain value
|
||||
*/
|
||||
uint16_t VddMin; /*!< Specifies minimum MCU VDD can reach to protect MCU from reset
|
||||
*/
|
||||
uint16_t Shunt0Value; /*!< Specifies value of Shunt 0 if existing
|
||||
*/
|
||||
uint16_t Shunt1Value; /*!< Specifies value of Shunt 1 if existing
|
||||
*/
|
||||
uint16_t Shunt2Value; /*!< Specifies value of Shunt 2 if existing
|
||||
*/
|
||||
uint16_t Shunt3Value; /*!< Specifies value of Shunt 3 if existing
|
||||
*/
|
||||
uint16_t Shunt4Value; /*!< Specifies value of Shunt 4 if existing
|
||||
*/
|
||||
uint16_t Shunt0StabDelay; /*!< Specifies delay of Shunt 0 stabilization if existing
|
||||
*/
|
||||
uint16_t Shunt1StabDelay; /*!< Specifies delay of Shunt 1 stabilization if existing
|
||||
*/
|
||||
uint16_t Shunt2StabDelay; /*!< Specifies delay of Shunt 2 stabilization if existing
|
||||
*/
|
||||
uint16_t Shunt3StabDelay; /*!< Specifies delay of Shunt 3 stabilization if existing
|
||||
*/
|
||||
uint16_t Shunt4StabDelay; /*!< Specifies delay of Shunt 4 stabilization if existing
|
||||
*/
|
||||
uint8_t ShuntNbOnBoard; /*!< Specifies number of shunts that are present on board
|
||||
This parameter can be a value of @ref IDD_shunt_number */
|
||||
uint8_t ShuntNbUsed; /*!< Specifies number of shunts used for measurement
|
||||
This parameter can be a value of @ref IDD_shunt_number */
|
||||
uint8_t VrefMeasurement; /*!< Specifies if Vref is automatically measured before each Idd measurement
|
||||
This parameter can be a value of @ref IDD_Vref_Measurement */
|
||||
uint8_t Calibration; /*!< Specifies if calibration is done before each Idd measurement
|
||||
*/
|
||||
uint8_t PreDelayUnit; /*!< Specifies Pre delay unit
|
||||
This parameter can be a value of @ref IDD_PreDelay */
|
||||
uint8_t PreDelayValue; /*!< Specifies Pre delay value in selected unit
|
||||
*/
|
||||
uint8_t MeasureNb; /*!< Specifies number of Measure to be performed
|
||||
This parameter can be a value between 1 and 256 */
|
||||
uint8_t DeltaDelayUnit; /*!< Specifies Delta delay unit
|
||||
This parameter can be a value of @ref IDD_DeltaDelay */
|
||||
uint8_t DeltaDelayValue; /*!< Specifies Delta delay between 2 measures
|
||||
value can be between 1 and 128 */
|
||||
}IDD_ConfigTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup IDD_Driver_structure IDD Driver structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (*Init)(uint16_t);
|
||||
void (*DeInit)(uint16_t);
|
||||
uint16_t (*ReadID)(uint16_t);
|
||||
void (*Reset)(uint16_t);
|
||||
void (*LowPower)(uint16_t);
|
||||
void (*WakeUp)(uint16_t);
|
||||
void (*Start)(uint16_t);
|
||||
void (*Config)(uint16_t,IDD_ConfigTypeDef);
|
||||
void (*GetValue)(uint16_t, uint32_t *);
|
||||
void (*EnableIT)(uint16_t);
|
||||
void (*ClearIT)(uint16_t);
|
||||
uint8_t (*GetITStatus)(uint16_t);
|
||||
void (*DisableIT)(uint16_t);
|
||||
void (*ErrorEnableIT)(uint16_t);
|
||||
void (*ErrorClearIT)(uint16_t);
|
||||
uint8_t (*ErrorGetITStatus)(uint16_t);
|
||||
void (*ErrorDisableIT)(uint16_t);
|
||||
uint8_t (*ErrorGetSrc)(uint16_t);
|
||||
uint8_t (*ErrorGetCode)(uint16_t);
|
||||
}IDD_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __IDD_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file io.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This file contains all the functions prototypes for the IO driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __IO_H
|
||||
#define __IO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup IO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup IO_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief IO Bit SET and Bit RESET enumeration
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
IO_PIN_RESET = 0,
|
||||
IO_PIN_SET
|
||||
}IO_PinState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
IO_MODE_INPUT = 0, /* input floating */
|
||||
IO_MODE_OUTPUT, /* output Push Pull */
|
||||
IO_MODE_IT_RISING_EDGE, /* float input - irq detect on rising edge */
|
||||
IO_MODE_IT_FALLING_EDGE, /* float input - irq detect on falling edge */
|
||||
IO_MODE_IT_LOW_LEVEL, /* float input - irq detect on low level */
|
||||
IO_MODE_IT_HIGH_LEVEL, /* float input - irq detect on high level */
|
||||
/* following modes only available on MFX*/
|
||||
IO_MODE_ANALOG, /* analog mode */
|
||||
IO_MODE_OFF, /* when pin isn't used*/
|
||||
IO_MODE_INPUT_PU, /* input with internal pull up resistor */
|
||||
IO_MODE_INPUT_PD, /* input with internal pull down resistor */
|
||||
IO_MODE_OUTPUT_OD, /* Open Drain output without internal resistor */
|
||||
IO_MODE_OUTPUT_OD_PU, /* Open Drain output with internal pullup resistor */
|
||||
IO_MODE_OUTPUT_OD_PD, /* Open Drain output with internal pulldown resistor */
|
||||
IO_MODE_OUTPUT_PP, /* PushPull output without internal resistor */
|
||||
IO_MODE_OUTPUT_PP_PU, /* PushPull output with internal pullup resistor */
|
||||
IO_MODE_OUTPUT_PP_PD, /* PushPull output with internal pulldown resistor */
|
||||
IO_MODE_IT_RISING_EDGE_PU, /* push up resistor input - irq on rising edge */
|
||||
IO_MODE_IT_RISING_EDGE_PD, /* push dw resistor input - irq on rising edge */
|
||||
IO_MODE_IT_FALLING_EDGE_PU, /* push up resistor input - irq on falling edge */
|
||||
IO_MODE_IT_FALLING_EDGE_PD, /* push dw resistor input - irq on falling edge */
|
||||
IO_MODE_IT_LOW_LEVEL_PU, /* push up resistor input - irq detect on low level */
|
||||
IO_MODE_IT_LOW_LEVEL_PD, /* push dw resistor input - irq detect on low level */
|
||||
IO_MODE_IT_HIGH_LEVEL_PU, /* push up resistor input - irq detect on high level */
|
||||
IO_MODE_IT_HIGH_LEVEL_PD, /* push dw resistor input - irq detect on high level */
|
||||
|
||||
}IO_ModeTypedef;
|
||||
|
||||
/** @defgroup IO_Driver_structure IO Driver structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (*Init)(uint16_t);
|
||||
uint16_t (*ReadID)(uint16_t);
|
||||
void (*Reset)(uint16_t);
|
||||
|
||||
void (*Start)(uint16_t, uint32_t);
|
||||
uint8_t (*Config)(uint16_t, uint32_t, IO_ModeTypedef);
|
||||
void (*WritePin)(uint16_t, uint32_t, uint8_t);
|
||||
uint32_t (*ReadPin)(uint16_t, uint32_t);
|
||||
|
||||
void (*EnableIT)(uint16_t);
|
||||
void (*DisableIT)(uint16_t);
|
||||
uint32_t (*ITStatus)(uint16_t, uint32_t);
|
||||
void (*ClearIT)(uint16_t, uint32_t);
|
||||
|
||||
}IO_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __IO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file lcd.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This file contains all the functions prototypes for the LCD driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __LCD_H
|
||||
#define __LCD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup LCD
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LCD_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LCD_Driver_structure LCD Driver structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (*Init)(void);
|
||||
uint16_t (*ReadID)(void);
|
||||
void (*DisplayOn)(void);
|
||||
void (*DisplayOff)(void);
|
||||
void (*SetCursor)(uint16_t, uint16_t);
|
||||
void (*WritePixel)(uint16_t, uint16_t, uint16_t);
|
||||
uint16_t (*ReadPixel)(uint16_t, uint16_t);
|
||||
|
||||
/* Optimized operation */
|
||||
void (*SetDisplayWindow)(uint16_t, uint16_t, uint16_t, uint16_t);
|
||||
void (*DrawHLine)(uint16_t, uint16_t, uint16_t, uint16_t);
|
||||
void (*DrawVLine)(uint16_t, uint16_t, uint16_t, uint16_t);
|
||||
|
||||
uint16_t (*GetLcdPixelWidth)(void);
|
||||
uint16_t (*GetLcdPixelHeight)(void);
|
||||
void (*DrawBitmap)(uint16_t, uint16_t, uint8_t*);
|
||||
void (*DrawRGBImage)(uint16_t, uint16_t, uint16_t, uint16_t, uint8_t*);
|
||||
}LCD_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __LCD_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file magneto.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This header file contains the functions prototypes for the MAGNETO driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __MAGNETO_H
|
||||
#define __MAGNETO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup MAGNETO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup MAGNETO_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup MAGNETO_Config_structure Magnetometer Configuration structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Register1;
|
||||
uint8_t Register2;
|
||||
uint8_t Register3;
|
||||
uint8_t Register4;
|
||||
uint8_t Register5;
|
||||
}MAGNETO_InitTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MAGNETO_Driver_structure Magnetometer Driver structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (*Init)(MAGNETO_InitTypeDef);
|
||||
void (*DeInit)(void);
|
||||
uint8_t (*ReadID)(void);
|
||||
void (*Reset)(void);
|
||||
void (*LowPower)(void);
|
||||
void (*ConfigIT)(void);
|
||||
void (*EnableIT)(uint8_t);
|
||||
void (*DisableIT)(uint8_t);
|
||||
uint8_t (*ITStatus)(uint16_t);
|
||||
void (*ClearIT)(void);
|
||||
void (*FilterConfig)(uint8_t);
|
||||
void (*FilterCmd)(uint8_t);
|
||||
void (*GetXYZ)(int16_t *);
|
||||
}MAGNETO_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAGNETO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ts.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This file contains all the functions prototypes for the Touch Screen driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __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
|
||||
{
|
||||
void (*Init)(uint16_t);
|
||||
uint16_t (*ReadID)(uint16_t);
|
||||
void (*Reset)(uint16_t);
|
||||
void (*Start)(uint16_t);
|
||||
uint8_t (*DetectTouch)(uint16_t);
|
||||
void (*GetXY)(uint16_t, uint16_t*, uint16_t*);
|
||||
void (*EnableIT)(uint16_t);
|
||||
void (*ClearIT)(uint16_t);
|
||||
uint8_t (*GetITStatus)(uint16_t);
|
||||
void (*DisableIT)(uint16_t);
|
||||
}TS_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TS_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file tsensor.h
|
||||
* @author MCD Application Team
|
||||
* @version V4.0.1
|
||||
* @date 21-July-2015
|
||||
* @brief This header file contains the functions prototypes for the
|
||||
* Temperature Sensor driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 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 __TSENSOR_H
|
||||
#define __TSENSOR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup TSENSOR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup TSENSOR_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup TSENSOR_Config_structure Temperature Sensor Configuration structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t AlertMode; /* Alert Mode Temperature out of range*/
|
||||
uint8_t ConversionMode; /* Continuous/One Shot Mode */
|
||||
uint8_t ConversionResolution; /* Temperature Resolution */
|
||||
uint8_t ConversionRate; /* Number of measure per second */
|
||||
uint8_t TemperatureLimitHigh; /* High Temperature Limit Range */
|
||||
uint8_t TemperatureLimitLow; /* Low Temperature Limit Range */
|
||||
}TSENSOR_InitTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TSENSOR_Driver_structure Temperature Sensor Driver structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (*Init)(uint16_t, TSENSOR_InitTypeDef *);
|
||||
uint8_t (*IsReady)(uint16_t, uint32_t);
|
||||
uint8_t (*ReadStatus)(uint16_t);
|
||||
uint16_t (*ReadTemp)(uint16_t);
|
||||
}TSENSOR_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TSENSOR_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: 'Bug report'
|
||||
about: 'Create a report to help us improve the quality of our software'
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Caution**
|
||||
|
||||
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
|
||||
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the **ST Community** in the STM32 MCUs dedicated [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
|
||||
**Describe the set-up**
|
||||
|
||||
* The board (either ST RPN reference or your custom board)
|
||||
* IDE or at least the compiler and its version
|
||||
|
||||
**Describe the bug (skip if none)**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce the bug (skip if none)**
|
||||
|
||||
1. Indicate the global behavior of your application project
|
||||
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
|
||||
3. Describe the use case that generates the problem
|
||||
4. How we can reproduce the problem
|
||||
|
||||
|
||||
**Additional context**
|
||||
|
||||
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
@@ -0,0 +1,3 @@
|
||||
## IMPORTANT INFORMATION
|
||||
|
||||
Pull-requests are **not** accepted on this repository. Please use issues to report any bug or request.
|
||||
@@ -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).
|
||||
@@ -0,0 +1,28 @@
|
||||
## Contributing guide
|
||||
|
||||
This document serves as a checklist before contributing to this repository.
|
||||
It includes links to read up on if topics are unclear to you.
|
||||
|
||||
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
|
||||
To report a bug or a request please file an issue in the right repository
|
||||
(example for [ampire480272](https://github.com/STMicroelectronics/ampire480272/issues/new/choose)).
|
||||
|
||||
Please check the following boxes 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, it should be submitted to the ST Community under the MCU topic [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
|
||||
### 2. Posting the issue
|
||||
When you have checked the previous boxes. You will find two templates (Bug Report or Other Issue) available in the **Issues** tab of the repository.
|
||||
|
||||
### 3. Pull Requests
|
||||
Pull-requests are **not** accepted on this repository. Please use **issues** to report any bug or request.
|
||||
|
||||
### 4. 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 for one new feature or proposal. This will ease the analysis and the final merge if accepted.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,40 @@
|
||||
# BSP AMPIRE480272 Component
|
||||
|
||||
## Overview
|
||||
|
||||
**STM32Cube** is an STMicroelectronics original initiative to ease the 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 components 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 **ampire480272** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **AMPIRE480272** BSP LCD component part.
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2014 STMicroelectronics
|
||||
|
||||
This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this software except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
|
||||
|
||||
## Release note
|
||||
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/ampire480272/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
|
||||
|
||||
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/ampire480272/issues/new/choose).
|
||||
|
||||
For any other question related to the product, the tools, the environment, you can submit a topic to the [ST Community](https://community.st.com/s/).
|
||||
@@ -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 ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ampire480272.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the constants parameters for the ampire480272
|
||||
* LCD component.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2014 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 __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 */
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: 'Bug report'
|
||||
about: 'Create a report to help us improve the quality of our software'
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Caution**
|
||||
|
||||
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
|
||||
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the **ST Community** in the STM32 MCUs dedicated [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
|
||||
**Describe the set-up**
|
||||
|
||||
* The board (either ST RPN reference or your custom board)
|
||||
* IDE or at least the compiler and its version
|
||||
|
||||
**Describe the bug (skip if none)**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce the bug (skip if none)**
|
||||
|
||||
1. Indicate the global behavior of your application project
|
||||
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
|
||||
3. Describe the use case that generates the problem
|
||||
4. How we can reproduce the problem
|
||||
|
||||
|
||||
**Additional context**
|
||||
|
||||
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
@@ -0,0 +1,4 @@
|
||||
## IMPORTANT INFORMATION
|
||||
|
||||
### Contributor License Agreement (CLA)
|
||||
Pull-request are **not** accepted on this repository. Please use issues to report any bug or request.
|
||||
@@ -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).
|
||||
@@ -0,0 +1,28 @@
|
||||
## Contributing guide
|
||||
|
||||
This document serves as a checklist before contributing to this repository.
|
||||
It includes links to read up on if topics are unclear to you.
|
||||
|
||||
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
|
||||
To report a bug or a request please file an issue in the right repository
|
||||
(example for [ampire640480](https://github.com/STMicroelectronics/ampire640480/issues/new/choose)).
|
||||
|
||||
Please check the following boxes 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, it should be submitted to the ST Community under the MCU topic [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
|
||||
### 2. Posting the issue
|
||||
When you have checked the previous boxes. You will find two templates (Bug Report or Other Issue) available in the **Issues** tab of the repository.
|
||||
|
||||
### 3. Pull Requests
|
||||
Pull-request are not accepted on this repository. Please use **issues** to report any bug or request.
|
||||
|
||||
### 4. 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 for one new feature or proposal. This will ease the analysis and the final merge if accepted.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,40 @@
|
||||
# BSP AMPIRE640480 Component
|
||||
|
||||
## Overview
|
||||
|
||||
**STM32Cube** is an STMicroelectronics original initiative to ease the 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 components 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 **ampire640480** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **AMPIRE640480** BSP LCD component part.
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2014 STMicroelectronics
|
||||
|
||||
This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this software except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
|
||||
|
||||
## Release note
|
||||
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/ampire640480/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. It is **crucial** that you use a consistent set of versions as indicated.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/ampire640480/issues/new/choose).
|
||||
|
||||
For any other question related to the product, the tools, the environment, you can submit a topic to the [ST Community](https://community.st.com/s/).
|
||||
@@ -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 ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ampire640480.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the constants parameters for the ampire640480
|
||||
* LCD component.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2014 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 __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 */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: 'Bug report'
|
||||
about: 'Create a report to help us improve the quality of our software'
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Caution**
|
||||
|
||||
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
|
||||
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the **ST Community** in the STM32 MCUs dedicated [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
|
||||
**Describe the set-up**
|
||||
|
||||
* The board (either ST RPN reference or your custom board)
|
||||
* IDE or at least the compiler and its version
|
||||
|
||||
**Describe the bug (skip if none)**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce the bug (skip if none)**
|
||||
|
||||
1. Indicate the global behavior of your application project
|
||||
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
|
||||
3. Describe the use case that generates the problem
|
||||
4. How we can reproduce the problem
|
||||
|
||||
|
||||
**Additional context**
|
||||
|
||||
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
@@ -0,0 +1,3 @@
|
||||
## IMPORTANT INFORMATION
|
||||
|
||||
Pull-requests are **not** accepted on this repository. Please use issues to report any bug or request.
|
||||
@@ -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).
|
||||
@@ -0,0 +1,28 @@
|
||||
## Contributing guide
|
||||
|
||||
This document serves as a checklist before contributing to this repository.
|
||||
It includes links to read up on if topics are unclear to you.
|
||||
|
||||
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
|
||||
To report a bug or a request please file an issue in the right repository
|
||||
(example for [cs43l22](https://github.com/STMicroelectronics/cs43l22/issues/new/choose)).
|
||||
|
||||
Please check the following boxes 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, it should be submitted to the ST Community under the MCU topic [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
|
||||
### 2. Posting the issue
|
||||
When you have checked the previous boxes. You will find two templates (Bug Report or Other Issue) available in the **Issues** tab of the repository.
|
||||
|
||||
### 3. Pull Requests
|
||||
Pull-requests are **not** accepted on this repository. Please use **issues** to report any bug or request.
|
||||
|
||||
### 4. 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 for one new feature or proposal. This will ease the analysis and the final merge if accepted.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,40 @@
|
||||
# BSP CS43L22 Component
|
||||
|
||||
## Overview
|
||||
|
||||
**STM32Cube** is an STMicroelectronics original initiative to ease the 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 components 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 **cs43l22** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **CS43L22** BSP AUDIO component part.
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2015 STMicroelectronics
|
||||
|
||||
This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this software except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
|
||||
|
||||
## Release note
|
||||
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/cs43l22/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.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/cs43l22/issues/new/choose).
|
||||
|
||||
For any other question related to the product, the tools, the environment, you can submit a topic to the [ST Community](https://community.st.com/s/).
|
||||
@@ -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 ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
@@ -0,0 +1,474 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file cs43l22.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides the CS43L22 Audio Codec driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015 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 "cs43l22.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup CS43L22
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* CS43L22 audio codec.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup CS43L22_Private_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup CS43L22_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
#define VOLUME_CONVERT(Volume) (((Volume) > 100)? 255:((uint8_t)(((Volume) * 255) / 100)))
|
||||
/* Uncomment this line to enable verifying data sent to codec after each write
|
||||
operation (for debug purpose) */
|
||||
#if !defined (VERIFY_WRITTENDATA)
|
||||
/* #define VERIFY_WRITTENDATA */
|
||||
#endif /* VERIFY_WRITTENDATA */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup CS43L22_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup CS43L22_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Audio codec driver structure initialization */
|
||||
AUDIO_DrvTypeDef cs43l22_drv =
|
||||
{
|
||||
cs43l22_Init,
|
||||
cs43l22_DeInit,
|
||||
cs43l22_ReadID,
|
||||
|
||||
cs43l22_Play,
|
||||
cs43l22_Pause,
|
||||
cs43l22_Resume,
|
||||
cs43l22_Stop,
|
||||
|
||||
cs43l22_SetFrequency,
|
||||
cs43l22_SetVolume,
|
||||
cs43l22_SetMute,
|
||||
cs43l22_SetOutputMode,
|
||||
cs43l22_Reset,
|
||||
};
|
||||
|
||||
static uint8_t Is_cs43l22_Stop = 1;
|
||||
|
||||
volatile uint8_t OutputDev = 0;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup CS43L22_Function_Prototypes
|
||||
* @{
|
||||
*/
|
||||
static uint8_t CODEC_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup CS43L22_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes the audio codec and the control interface.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param OutputDevice: can be OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE,
|
||||
* OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO .
|
||||
* @param Volume: Initial volume level (from 0 (Mute) to 100 (Max))
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t cs43l22_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq)
|
||||
{
|
||||
uint32_t counter = 0;
|
||||
|
||||
/* Initialize the Control interface of the Audio Codec */
|
||||
AUDIO_IO_Init();
|
||||
|
||||
/* Keep Codec powered OFF */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL1, 0x01);
|
||||
|
||||
/*Save Output device for mute ON/OFF procedure*/
|
||||
switch (OutputDevice)
|
||||
{
|
||||
case OUTPUT_DEVICE_SPEAKER:
|
||||
OutputDev = 0xFA;
|
||||
break;
|
||||
|
||||
case OUTPUT_DEVICE_HEADPHONE:
|
||||
OutputDev = 0xAF;
|
||||
break;
|
||||
|
||||
case OUTPUT_DEVICE_BOTH:
|
||||
OutputDev = 0xAA;
|
||||
break;
|
||||
|
||||
case OUTPUT_DEVICE_AUTO:
|
||||
OutputDev = 0x05;
|
||||
break;
|
||||
|
||||
default:
|
||||
OutputDev = 0x05;
|
||||
break;
|
||||
}
|
||||
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, OutputDev);
|
||||
|
||||
/* Clock configuration: Auto detection */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_CLOCKING_CTL, 0x81);
|
||||
|
||||
/* Set the Slave Mode and the audio Standard */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_INTERFACE_CTL1, CODEC_STANDARD);
|
||||
|
||||
/* Set the Master volume */
|
||||
counter += cs43l22_SetVolume(DeviceAddr, Volume);
|
||||
|
||||
/* If the Speaker is enabled, set the Mono mode and volume attenuation level */
|
||||
if(OutputDevice != OUTPUT_DEVICE_HEADPHONE)
|
||||
{
|
||||
/* Set the Speaker Mono mode */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_PLAYBACK_CTL2, 0x06);
|
||||
|
||||
/* Set the Speaker attenuation level */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_SPEAKER_A_VOL, 0x00);
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_SPEAKER_B_VOL, 0x00);
|
||||
}
|
||||
|
||||
/* Additional configuration for the CODEC. These configurations are done to reduce
|
||||
the time needed for the Codec to power off. If these configurations are removed,
|
||||
then a long delay should be added between powering off the Codec and switching
|
||||
off the I2S peripheral MCLK clock (which is the operating clock for Codec).
|
||||
If this delay is not inserted, then the codec will not shut down properly and
|
||||
it results in high noise after shut down. */
|
||||
|
||||
/* Disable the analog soft ramp */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_ANALOG_ZC_SR_SETT, 0x00);
|
||||
/* Disable the digital soft ramp */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MISC_CTL, 0x04);
|
||||
/* Disable the limiter attack level */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_LIMIT_CTL1, 0x00);
|
||||
/* Adjust Bass and Treble levels */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_TONE_CTL, 0x0F);
|
||||
/* Adjust PCM volume level */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_PCMA_VOL, 0x0A);
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_PCMB_VOL, 0x0A);
|
||||
|
||||
/* Return communication control value */
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the audio codec.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void cs43l22_DeInit(void)
|
||||
{
|
||||
/* Deinitialize Audio Codec interface */
|
||||
AUDIO_IO_DeInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the CS43L22 ID.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval The CS43L22 ID
|
||||
*/
|
||||
uint32_t cs43l22_ReadID(uint16_t DeviceAddr)
|
||||
{
|
||||
uint8_t Value;
|
||||
/* Initialize the Control interface of the Audio Codec */
|
||||
AUDIO_IO_Init();
|
||||
|
||||
Value = AUDIO_IO_Read(DeviceAddr, CS43L22_CHIPID_ADDR);
|
||||
Value = (Value & CS43L22_ID_MASK);
|
||||
|
||||
return((uint32_t) Value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start the audio Codec play feature.
|
||||
* @note For this codec no Play options are required.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t cs43l22_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size)
|
||||
{
|
||||
uint32_t counter = 0;
|
||||
|
||||
if(Is_cs43l22_Stop == 1)
|
||||
{
|
||||
/* Enable the digital soft ramp */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MISC_CTL, 0x06);
|
||||
|
||||
/* Enable Output device */
|
||||
counter += cs43l22_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
|
||||
|
||||
/* Power on the Codec */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL1, 0x9E);
|
||||
Is_cs43l22_Stop = 0;
|
||||
}
|
||||
|
||||
/* Return communication control value */
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pauses playing on the audio codec.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t cs43l22_Pause(uint16_t DeviceAddr)
|
||||
{
|
||||
uint32_t counter = 0;
|
||||
|
||||
/* Pause the audio file playing */
|
||||
/* Mute the output first */
|
||||
counter += cs43l22_SetMute(DeviceAddr, AUDIO_MUTE_ON);
|
||||
|
||||
/* Put the Codec in Power save mode */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL1, 0x01);
|
||||
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resumes playing on the audio codec.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t cs43l22_Resume(uint16_t DeviceAddr)
|
||||
{
|
||||
uint32_t counter = 0;
|
||||
volatile uint32_t index = 0x00;
|
||||
/* Resumes the audio file playing */
|
||||
/* Unmute the output first */
|
||||
counter += cs43l22_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
|
||||
|
||||
for(index = 0x00; index < 0xFF; index++);
|
||||
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, OutputDev);
|
||||
|
||||
/* Exit the Power save mode */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL1, 0x9E);
|
||||
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stops audio Codec playing. It powers down the codec.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param CodecPdwnMode: selects the power down mode.
|
||||
* - CODEC_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 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t cs43l22_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode)
|
||||
{
|
||||
uint32_t counter = 0;
|
||||
|
||||
/* Mute the output first */
|
||||
counter += cs43l22_SetMute(DeviceAddr, AUDIO_MUTE_ON);
|
||||
|
||||
/* Disable the digital soft ramp */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MISC_CTL, 0x04);
|
||||
|
||||
/* Power down the DAC and the speaker (PMDAC and PMSPK bits)*/
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL1, 0x9F);
|
||||
|
||||
Is_cs43l22_Stop = 1;
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets higher or lower the codec volume level.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param Volume: a byte value from 0 to 255 (refer to codec registers
|
||||
* description for more details).
|
||||
*
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t cs43l22_SetVolume(uint16_t DeviceAddr, uint8_t Volume)
|
||||
{
|
||||
uint32_t counter = 0;
|
||||
uint8_t convertedvol = VOLUME_CONVERT(Volume);
|
||||
|
||||
if(convertedvol > 0xE6)
|
||||
{
|
||||
/* Set the Master volume */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MASTER_A_VOL, convertedvol - 0xE7);
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MASTER_B_VOL, convertedvol - 0xE7);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set the Master volume */
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MASTER_A_VOL, convertedvol + 0x19);
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MASTER_B_VOL, convertedvol + 0x19);
|
||||
}
|
||||
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets new frequency.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param AudioFreq: Audio frequency used to play the audio stream.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t cs43l22_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the mute feature on the audio codec.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param Cmd: AUDIO_MUTE_ON to enable the mute or AUDIO_MUTE_OFF to disable the
|
||||
* mute mode.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t cs43l22_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
|
||||
{
|
||||
uint32_t counter = 0;
|
||||
|
||||
/* Set the Mute mode */
|
||||
if(Cmd == AUDIO_MUTE_ON)
|
||||
{
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0xFF);
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_HEADPHONE_A_VOL, 0x01);
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_HEADPHONE_B_VOL, 0x01);
|
||||
}
|
||||
else /* AUDIO_MUTE_OFF Disable the Mute */
|
||||
{
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_HEADPHONE_A_VOL, 0x00);
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_HEADPHONE_B_VOL, 0x00);
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, OutputDev);
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Switch dynamically (while audio file is played) the output target
|
||||
* (speaker or headphone).
|
||||
* @note This function modifies a global variable of the audio codec driver: OutputDev.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param Output: specifies the audio output target: OUTPUT_DEVICE_SPEAKER,
|
||||
* OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t cs43l22_SetOutputMode(uint16_t DeviceAddr, uint8_t Output)
|
||||
{
|
||||
uint32_t counter = 0;
|
||||
|
||||
switch (Output)
|
||||
{
|
||||
case OUTPUT_DEVICE_SPEAKER:
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0xFA); /* SPK always ON & HP always OFF */
|
||||
OutputDev = 0xFA;
|
||||
break;
|
||||
|
||||
case OUTPUT_DEVICE_HEADPHONE:
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0xAF); /* SPK always OFF & HP always ON */
|
||||
OutputDev = 0xAF;
|
||||
break;
|
||||
|
||||
case OUTPUT_DEVICE_BOTH:
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0xAA); /* SPK always ON & HP always ON */
|
||||
OutputDev = 0xAA;
|
||||
break;
|
||||
|
||||
case OUTPUT_DEVICE_AUTO:
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0x05); /* Detect the HP or the SPK automatically */
|
||||
OutputDev = 0x05;
|
||||
break;
|
||||
|
||||
default:
|
||||
counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0x05); /* Detect the HP or the SPK automatically */
|
||||
OutputDev = 0x05;
|
||||
break;
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resets cs43l22 registers.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t cs43l22_Reset(uint16_t DeviceAddr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes/Read a single data.
|
||||
* @param Addr: I2C address
|
||||
* @param Reg: Reg address
|
||||
* @param Value: Data to be written
|
||||
* @retval None
|
||||
*/
|
||||
static uint8_t CODEC_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
|
||||
AUDIO_IO_Write(Addr, Reg, Value);
|
||||
|
||||
#ifdef VERIFY_WRITTENDATA
|
||||
/* Verify that the data has been correctly written */
|
||||
result = (AUDIO_IO_Read(Addr, Reg) == Value)? 0:1;
|
||||
#endif /* VERIFY_WRITTENDATA */
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,207 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file cs43l22.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the cs43l22.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015 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 __CS43L22_H
|
||||
#define __CS43L22_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/audio.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup CS43L22
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup CS43L22_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup CS43L22_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/******************************************************************************/
|
||||
/*************************** Codec User defines ******************************/
|
||||
/******************************************************************************/
|
||||
/* Codec output DEVICE */
|
||||
#define OUTPUT_DEVICE_SPEAKER 1
|
||||
#define OUTPUT_DEVICE_HEADPHONE 2
|
||||
#define OUTPUT_DEVICE_BOTH 3
|
||||
#define OUTPUT_DEVICE_AUTO 4
|
||||
|
||||
/* Volume Levels values */
|
||||
#define DEFAULT_VOLMIN 0x00
|
||||
#define DEFAULT_VOLMAX 0xFF
|
||||
#define DEFAULT_VOLSTEP 0x04
|
||||
|
||||
#define AUDIO_PAUSE 0
|
||||
#define AUDIO_RESUME 1
|
||||
|
||||
/* Codec POWER DOWN modes */
|
||||
#define CODEC_PDWN_HW 1
|
||||
#define CODEC_PDWN_SW 2
|
||||
|
||||
/* MUTE commands */
|
||||
#define AUDIO_MUTE_ON 1
|
||||
#define AUDIO_MUTE_OFF 0
|
||||
|
||||
/* AUDIO FREQUENCY */
|
||||
#define AUDIO_FREQUENCY_192K ((uint32_t)192000)
|
||||
#define AUDIO_FREQUENCY_96K ((uint32_t)96000)
|
||||
#define AUDIO_FREQUENCY_48K ((uint32_t)48000)
|
||||
#define AUDIO_FREQUENCY_44K ((uint32_t)44100)
|
||||
#define AUDIO_FREQUENCY_32K ((uint32_t)32000)
|
||||
#define AUDIO_FREQUENCY_22K ((uint32_t)22050)
|
||||
#define AUDIO_FREQUENCY_16K ((uint32_t)16000)
|
||||
#define AUDIO_FREQUENCY_11K ((uint32_t)11025)
|
||||
#define AUDIO_FREQUENCY_8K ((uint32_t)8000)
|
||||
|
||||
/** CS43l22 Registers ***/
|
||||
#define CS43L22_REG_ID 0x01
|
||||
#define CS43L22_REG_POWER_CTL1 0x02
|
||||
#define CS43L22_REG_POWER_CTL2 0x04
|
||||
#define CS43L22_REG_CLOCKING_CTL 0x05
|
||||
#define CS43L22_REG_INTERFACE_CTL1 0x06
|
||||
#define CS43L22_REG_INTERFACE_CTL2 0x07
|
||||
#define CS43L22_REG_PASSTHR_A_SELECT 0x08
|
||||
#define CS43L22_REG_PASSTHR_B_SELECT 0x09
|
||||
#define CS43L22_REG_ANALOG_ZC_SR_SETT 0x0A
|
||||
#define CS43L22_REG_PASSTHR_GANG_CTL 0x0C
|
||||
#define CS43L22_REG_PLAYBACK_CTL1 0x0D
|
||||
#define CS43L22_REG_MISC_CTL 0x0E
|
||||
#define CS43L22_REG_PLAYBACK_CTL2 0x0F
|
||||
#define CS43L22_REG_PASSTHR_A_VOL 0x14
|
||||
#define CS43L22_REG_PASSTHR_B_VOL 0x15
|
||||
#define CS43L22_REG_PCMA_VOL 0x1A
|
||||
#define CS43L22_REG_PCMB_VOL 0x1B
|
||||
#define CS43L22_REG_BEEP_FREQ_ON_TIME 0x1C
|
||||
#define CS43L22_REG_BEEP_VOL_OFF_TIME 0x1D
|
||||
#define CS43L22_REG_BEEP_TONE_CFG 0x1E
|
||||
#define CS43L22_REG_TONE_CTL 0x1F
|
||||
#define CS43L22_REG_MASTER_A_VOL 0x20
|
||||
#define CS43L22_REG_MASTER_B_VOL 0x21
|
||||
#define CS43L22_REG_HEADPHONE_A_VOL 0x22
|
||||
#define CS43L22_REG_HEADPHONE_B_VOL 0x23
|
||||
#define CS43L22_REG_SPEAKER_A_VOL 0x24
|
||||
#define CS43L22_REG_SPEAKER_B_VOL 0x25
|
||||
#define CS43L22_REG_CH_MIXER_SWAP 0x26
|
||||
#define CS43L22_REG_LIMIT_CTL1 0x27
|
||||
#define CS43L22_REG_LIMIT_CTL2 0x28
|
||||
#define CS43L22_REG_LIMIT_ATTACK_RATE 0x29
|
||||
#define CS43L22_REG_OVF_CLK_STATUS 0x2E
|
||||
#define CS43L22_REG_BATT_COMPENSATION 0x2F
|
||||
#define CS43L22_REG_VP_BATTERY_LEVEL 0x30
|
||||
#define CS43L22_REG_SPEAKER_STATUS 0x31
|
||||
#define CS43L22_REG_TEMPMONITOR_CTL 0x32
|
||||
#define CS43L22_REG_THERMAL_FOLDBACK 0x33
|
||||
#define CS43L22_REG_CHARGE_PUMP_FREQ 0x34
|
||||
|
||||
/******************************************************************************/
|
||||
/****************************** REGISTER MAPPING ******************************/
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @brief CS43L22 ID
|
||||
*/
|
||||
#define CS43L22_ID 0xE0
|
||||
#define CS43L22_ID_MASK 0xF8
|
||||
/**
|
||||
* @brief Chip ID Register: Chip I.D. and Revision Register
|
||||
* Read only register
|
||||
* Default value: 0x01
|
||||
* [7:3] CHIPID[4:0]: I.D. code for the CS43L22.
|
||||
* Default value: 11100b
|
||||
* [2:0] REVID[2:0]: CS43L22 revision level.
|
||||
* Default value:
|
||||
* 000 - Rev A0
|
||||
* 001 - Rev A1
|
||||
* 010 - Rev B0
|
||||
* 011 - Rev B1
|
||||
*/
|
||||
#define CS43L22_CHIPID_ADDR 0x01
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup CS43L22_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup CS43L22_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Audio Codec functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/* High Layer codec functions */
|
||||
uint32_t cs43l22_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq);
|
||||
void cs43l22_DeInit(void);
|
||||
uint32_t cs43l22_ReadID(uint16_t DeviceAddr);
|
||||
uint32_t cs43l22_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size);
|
||||
uint32_t cs43l22_Pause(uint16_t DeviceAddr);
|
||||
uint32_t cs43l22_Resume(uint16_t DeviceAddr);
|
||||
uint32_t cs43l22_Stop(uint16_t DeviceAddr, uint32_t Cmd);
|
||||
uint32_t cs43l22_SetVolume(uint16_t DeviceAddr, uint8_t Volume);
|
||||
uint32_t cs43l22_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq);
|
||||
uint32_t cs43l22_SetMute(uint16_t DeviceAddr, uint32_t Cmd);
|
||||
uint32_t cs43l22_SetOutputMode(uint16_t DeviceAddr, uint8_t Output);
|
||||
uint32_t cs43l22_Reset(uint16_t DeviceAddr);
|
||||
|
||||
/* AUDIO IO functions */
|
||||
void AUDIO_IO_Init(void);
|
||||
void AUDIO_IO_DeInit(void);
|
||||
void AUDIO_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
|
||||
uint8_t AUDIO_IO_Read(uint8_t Addr, uint8_t Reg);
|
||||
|
||||
/* Audio driver structure */
|
||||
extern AUDIO_DrvTypeDef cs43l22_drv;
|
||||
|
||||
#endif /* __CS43L22_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: 'Bug report'
|
||||
about: 'Create a report to help us improve the quality of our software'
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Caution**
|
||||
|
||||
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
|
||||
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the **ST Community** in the STM32 MCUs dedicated [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
|
||||
**Describe the set-up**
|
||||
|
||||
* The board (either ST RPN reference or your custom board)
|
||||
* IDE or at least the compiler and its version
|
||||
|
||||
**Describe the bug (skip if none)**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce the bug (skip if none)**
|
||||
|
||||
1. Indicate the global behavior of your application project
|
||||
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
|
||||
3. Describe the use case that generates the problem
|
||||
4. How we can reproduce the problem
|
||||
|
||||
|
||||
**Additional context**
|
||||
|
||||
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
@@ -0,0 +1,3 @@
|
||||
## IMPORTANT INFORMATION
|
||||
|
||||
Pull-requests are **not** accepted on this repository. Please use issues to report any bug or request.
|
||||
@@ -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).
|
||||
@@ -0,0 +1,38 @@
|
||||
## Contributing guide
|
||||
|
||||
This document serves as a checklist before contributing to this repository.
|
||||
It includes links to read up on if topics are unclear to you.
|
||||
|
||||
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
|
||||
To report a bug or a request please file an issue in the right repository
|
||||
(example for [stm32-dp83848](https://github.com/STMicroelectronics/stm32-dp83848/issues/new/choose)).
|
||||
|
||||
Please check the following boxes 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, it should be submitted to the **ST Community** on the appropriate topic [page](https://community.st.com/s/topiccatalog).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
|
||||
### 2. Posting the issue
|
||||
|
||||
When you have checked the previous boxes, create a new report from the **Issues** tab of the repository. A template is available to help you report the issue you are facing or the enhancement you would like to propose.
|
||||
|
||||
### 3. Pull Requests
|
||||
|
||||
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.
|
||||
|
||||
### 4. 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.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,34 @@
|
||||
# BSP stm32-dp83848 Component
|
||||
|
||||
## 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-dp83848** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **STM32-DP83848** BSP PHY 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-dp83848/blob/main/Release_Notes.html).
|
||||
|
||||
## Compatibility information
|
||||
|
||||
Below is the list of the BSP *component* drivers to be used with this BSP *board* driver. It is **crucial** that you use a consistent set of CMSIS - HAL - BSP versions, as mentioned in [this](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/STM32CubeALL/blob/master/Release_Notes.html) release note.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/stm32-dp83848/issues/new).
|
||||
|
||||
For 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).
|
||||
@@ -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 ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><g fill="#13254a"><path d="M100 .212C44.868.212 0 44.889 0 99.788c0 55.132 44.868 100 100 100s100-44.868 100-100C200 44.889 155.132.212 100 .212zm0 181.164c-44.974 0-81.587-36.614-81.587-81.587 0-44.762 36.614-81.164 81.587-81.164 44.995 0 81.587 36.402 81.587 81.164 0 44.973-36.592 81.587-81.587 81.587z" style="fill: #e6007e;"/><path d="M141.1 88.127h-29.439V58.688c0-6.392-5.185-11.598-11.598-11.598-6.413 0-11.619 5.206-11.619 11.598v29.439H58.476c-6.392 0-11.598 5.185-11.598 11.598 0 6.413 5.206 11.619 11.598 11.619h29.968v29.968c0 6.392 5.206 11.598 11.619 11.598 6.413 0 11.598-5.206 11.598-11.598v-29.968H141.1c6.392 0 11.598-5.206 11.598-11.619 0-6.413-5.206-11.598-11.598-11.598z" style="fill: #e6007e;"/></g></svg>
|
||||
|
After Width: | Height: | Size: 830 B |
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><g fill="#03234b"><path d="M170.934 64.569l-.04-.055-29.049 40.038-.057.079h14.867a59.366 59.366 0 0 1-1.488 15.615c-1.158 5.318-3.807 13.448-9.848 21.977-2.766 4.118-6.375 7.726-9.208 10.408-3.426 2.857-7.461 6.095-12 8.376-8.121 4.568-17.881 7.138-28.225 7.432-10.907.248-20.201-2.61-26.072-5.052-8.283-3.479-14.111-7.807-16.85-10.078-1.254-.956-2.25-1.907-3.057-2.676a28.662 28.662 0 0 0-1.157-1.069 158.874 158.874 0 0 0-1.479-1.362l-4.435-3.956 3.569 4.81.183.243c.2.263.548.722 1.048 1.389.276.334.579.747.93 1.226l.008.01c.689.939 1.546 2.107 2.664 3.322 3 3.536 8.178 8.801 15.808 13.801 5.969 3.866 15.672 8.901 28.001 10.935a79.05 79.05 0 0 0 12.485.998c7.97 0 15.651-1.228 22.828-3.649 6.366-1.877 12.192-4.981 17.053-7.771 6.16-3.936 10.817-7.586 14.654-11.488 8.084-7.899 14.884-17.913 19.15-28.199 3.259-7.594 5.456-15.727 6.529-24.175l.055-.425.083-.641H200l-29.066-40.063zM58.159 99.232l-12.655.563c-.097-.881-.159-1.986-.227-3.474a59.184 59.184 0 0 1 1.446-16.56c1.157-5.316 3.804-13.444 9.848-21.977 2.168-3.228 5.009-6.44 9.208-10.415 3.41-2.849 7.432-6.08 12.005-8.375 8.114-4.568 17.87-7.138 28.213-7.432 10.9-.25 20.196 2.607 26.072 5.045 8.258 3.473 14.105 7.812 16.857 10.091 1.257.951 2.253 1.904 3.057 2.673l.017.016c.43.411.801.766 1.136 1.051.475.438.841.777 1.091 1.01l.138.128.248.229 4.04 3.613-3.165-4.456c-.058-.083-.312-.417-.73-.971l-.507-.67a28.922 28.922 0 0 1-.901-1.192l-.02-.027c-.69-.945-1.548-2.121-2.677-3.346-3.002-3.537-8.182-8.803-15.813-13.801-5.964-3.865-15.662-8.9-27.997-10.935-8.484-1.363-21.496-2.009-35.313 2.651-6.355 1.88-12.186 4.983-17.054 7.772-6.163 3.944-10.82 7.595-14.654 11.488-8.079 7.894-14.882 17.909-19.155 28.2-3.268 7.624-5.463 15.757-6.523 24.173-.436 3.281-.642 5.421-.664 6.926L0 101.831l30.683 38.727.042.053 27.38-41.298.054-.081z" style="fill: #e6007e;"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1,613 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file dp83848.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the DP83848
|
||||
* PHY devices.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2021 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 "dp83848.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848 DP83848
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/** @defgroup DP83848_Private_Defines DP83848 Private Defines
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_MAX_DEV_ADDR ((uint32_t)31U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
/** @defgroup DP83848_Private_Functions DP83848 Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Register IO functions to component object
|
||||
* @param pObj: device object of DP83848_Object_t.
|
||||
* @param ioctx: holds device IO functions.
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_ERROR if missing mandatory function
|
||||
*/
|
||||
int32_t DP83848_RegisterBusIO(dp83848_Object_t *pObj, dp83848_IOCtx_t *ioctx)
|
||||
{
|
||||
if(!pObj || !ioctx->ReadReg || !ioctx->WriteReg || !ioctx->GetTick)
|
||||
{
|
||||
return DP83848_STATUS_ERROR;
|
||||
}
|
||||
|
||||
pObj->IO.Init = ioctx->Init;
|
||||
pObj->IO.DeInit = ioctx->DeInit;
|
||||
pObj->IO.ReadReg = ioctx->ReadReg;
|
||||
pObj->IO.WriteReg = ioctx->WriteReg;
|
||||
pObj->IO.GetTick = ioctx->GetTick;
|
||||
|
||||
return DP83848_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the DP83848 and configure the needed hardware resources
|
||||
* @param pObj: device object DP83848_Object_t.
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_ADDRESS_ERROR if cannot find device address
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
*/
|
||||
int32_t DP83848_Init(dp83848_Object_t *pObj)
|
||||
{
|
||||
uint32_t regvalue = 0, addr = 0;
|
||||
int32_t status = DP83848_STATUS_OK;
|
||||
|
||||
if(pObj->Is_Initialized == 0)
|
||||
{
|
||||
if(pObj->IO.Init != 0)
|
||||
{
|
||||
/* GPIO and Clocks initialization */
|
||||
pObj->IO.Init();
|
||||
}
|
||||
|
||||
/* for later check */
|
||||
pObj->DevAddr = DP83848_MAX_DEV_ADDR + 1;
|
||||
|
||||
/* Get the device address from special mode register */
|
||||
for(addr = 0; addr <= DP83848_MAX_DEV_ADDR; addr ++)
|
||||
{
|
||||
if(pObj->IO.ReadReg(addr, DP83848_SMR, ®value) < 0)
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
/* Can't read from this device address
|
||||
continue with next address */
|
||||
continue;
|
||||
}
|
||||
|
||||
if((regvalue & DP83848_SMR_PHY_ADDR) == addr)
|
||||
{
|
||||
pObj->DevAddr = addr;
|
||||
status = DP83848_STATUS_OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(pObj->DevAddr > DP83848_MAX_DEV_ADDR)
|
||||
{
|
||||
status = DP83848_STATUS_ADDRESS_ERROR;
|
||||
}
|
||||
|
||||
/* if device address is matched */
|
||||
if(status == DP83848_STATUS_OK)
|
||||
{
|
||||
pObj->Is_Initialized = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief De-Initialize the dp83848 and it's hardware resources
|
||||
* @param pObj: device object DP83848_Object_t.
|
||||
* @retval None
|
||||
*/
|
||||
int32_t DP83848_DeInit(dp83848_Object_t *pObj)
|
||||
{
|
||||
if(pObj->Is_Initialized)
|
||||
{
|
||||
if(pObj->IO.DeInit != 0)
|
||||
{
|
||||
if(pObj->IO.DeInit() < 0)
|
||||
{
|
||||
return DP83848_STATUS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
pObj->Is_Initialized = 0;
|
||||
}
|
||||
|
||||
return DP83848_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable the DP83848 power down mode.
|
||||
* @param pObj: device object DP83848_Object_t.
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
* DP83848_STATUS_WRITE_ERROR if connot write to register
|
||||
*/
|
||||
int32_t DP83848_DisablePowerDownMode(dp83848_Object_t *pObj)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
int32_t status = DP83848_STATUS_OK;
|
||||
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_BCR, &readval) >= 0)
|
||||
{
|
||||
readval &= ~DP83848_BCR_POWER_DOWN;
|
||||
|
||||
/* Apply configuration */
|
||||
if(pObj->IO.WriteReg(pObj->DevAddr, DP83848_BCR, readval) < 0)
|
||||
{
|
||||
status = DP83848_STATUS_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable the DP83848 power down mode.
|
||||
* @param pObj: device object DP83848_Object_t.
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
* DP83848_STATUS_WRITE_ERROR if connot write to register
|
||||
*/
|
||||
int32_t DP83848_EnablePowerDownMode(dp83848_Object_t *pObj)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
int32_t status = DP83848_STATUS_OK;
|
||||
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_BCR, &readval) >= 0)
|
||||
{
|
||||
readval |= DP83848_BCR_POWER_DOWN;
|
||||
|
||||
/* Apply configuration */
|
||||
if(pObj->IO.WriteReg(pObj->DevAddr, DP83848_BCR, readval) < 0)
|
||||
{
|
||||
status = DP83848_STATUS_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start the auto negotiation process.
|
||||
* @param pObj: device object DP83848_Object_t.
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
* DP83848_STATUS_WRITE_ERROR if connot write to register
|
||||
*/
|
||||
int32_t DP83848_StartAutoNego(dp83848_Object_t *pObj)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
int32_t status = DP83848_STATUS_OK;
|
||||
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_BCR, &readval) >= 0)
|
||||
{
|
||||
readval |= DP83848_BCR_AUTONEGO_EN;
|
||||
|
||||
/* Apply configuration */
|
||||
if(pObj->IO.WriteReg(pObj->DevAddr, DP83848_BCR, readval) < 0)
|
||||
{
|
||||
status = DP83848_STATUS_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the link state of DP83848 device.
|
||||
* @param pObj: Pointer to device object.
|
||||
* @param pLinkState: Pointer to link state
|
||||
* @retval DP83848_STATUS_LINK_DOWN if link is down
|
||||
* DP83848_STATUS_AUTONEGO_NOTDONE if Auto nego not completed
|
||||
* DP83848_STATUS_100MBITS_FULLDUPLEX if 100Mb/s FD
|
||||
* DP83848_STATUS_100MBITS_HALFDUPLEX if 100Mb/s HD
|
||||
* DP83848_STATUS_10MBITS_FULLDUPLEX if 10Mb/s FD
|
||||
* DP83848_STATUS_10MBITS_HALFDUPLEX if 10Mb/s HD
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
* DP83848_STATUS_WRITE_ERROR if connot write to register
|
||||
*/
|
||||
int32_t DP83848_GetLinkState(dp83848_Object_t *pObj)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
|
||||
/* Read Status register */
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_BSR, &readval) < 0)
|
||||
{
|
||||
return DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
/* Read Status register again */
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_BSR, &readval) < 0)
|
||||
{
|
||||
return DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
if((readval & DP83848_BSR_LINK_STATUS) == 0)
|
||||
{
|
||||
/* Return Link Down status */
|
||||
return DP83848_STATUS_LINK_DOWN;
|
||||
}
|
||||
|
||||
/* Check Auto negotiaition */
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_BCR, &readval) < 0)
|
||||
{
|
||||
return DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
if((readval & DP83848_BCR_AUTONEGO_EN) != DP83848_BCR_AUTONEGO_EN)
|
||||
{
|
||||
if(((readval & DP83848_BCR_SPEED_SELECT) == DP83848_BCR_SPEED_SELECT) && ((readval & DP83848_BCR_DUPLEX_MODE) == DP83848_BCR_DUPLEX_MODE))
|
||||
{
|
||||
return DP83848_STATUS_100MBITS_FULLDUPLEX;
|
||||
}
|
||||
else if ((readval & DP83848_BCR_SPEED_SELECT) == DP83848_BCR_SPEED_SELECT)
|
||||
{
|
||||
return DP83848_STATUS_100MBITS_HALFDUPLEX;
|
||||
}
|
||||
else if ((readval & DP83848_BCR_DUPLEX_MODE) == DP83848_BCR_DUPLEX_MODE)
|
||||
{
|
||||
return DP83848_STATUS_10MBITS_FULLDUPLEX;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DP83848_STATUS_10MBITS_HALFDUPLEX;
|
||||
}
|
||||
}
|
||||
else /* Auto Nego enabled */
|
||||
{
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_PHYSCSR, &readval) < 0)
|
||||
{
|
||||
return DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
/* Check if auto nego not done */
|
||||
if((readval & DP83848_PHYSCSR_AUTONEGO_DONE) == 0)
|
||||
{
|
||||
return DP83848_STATUS_AUTONEGO_NOTDONE;
|
||||
}
|
||||
|
||||
if((readval & DP83848_PHYSCSR_HCDSPEEDMASK) == DP83848_PHYSCSR_100BTX_FD)
|
||||
{
|
||||
return DP83848_STATUS_100MBITS_FULLDUPLEX;
|
||||
}
|
||||
else if ((readval & DP83848_PHYSCSR_HCDSPEEDMASK) == DP83848_PHYSCSR_100BTX_HD)
|
||||
{
|
||||
return DP83848_STATUS_100MBITS_HALFDUPLEX;
|
||||
}
|
||||
else if ((readval & DP83848_PHYSCSR_HCDSPEEDMASK) == DP83848_PHYSCSR_10BT_FD)
|
||||
{
|
||||
return DP83848_STATUS_10MBITS_FULLDUPLEX;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DP83848_STATUS_10MBITS_HALFDUPLEX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the link state of DP83848 device.
|
||||
* @param pObj: Pointer to device object.
|
||||
* @param pLinkState: link state can be one of the following
|
||||
* DP83848_STATUS_100MBITS_FULLDUPLEX if 100Mb/s FD
|
||||
* DP83848_STATUS_100MBITS_HALFDUPLEX if 100Mb/s HD
|
||||
* DP83848_STATUS_10MBITS_FULLDUPLEX if 10Mb/s FD
|
||||
* DP83848_STATUS_10MBITS_HALFDUPLEX if 10Mb/s HD
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_ERROR if parameter error
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
* DP83848_STATUS_WRITE_ERROR if connot write to register
|
||||
*/
|
||||
int32_t DP83848_SetLinkState(dp83848_Object_t *pObj, uint32_t LinkState)
|
||||
{
|
||||
uint32_t bcrvalue = 0;
|
||||
int32_t status = DP83848_STATUS_OK;
|
||||
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_BCR, &bcrvalue) >= 0)
|
||||
{
|
||||
/* Disable link config (Auto nego, speed and duplex) */
|
||||
bcrvalue &= ~(DP83848_BCR_AUTONEGO_EN | DP83848_BCR_SPEED_SELECT | DP83848_BCR_DUPLEX_MODE);
|
||||
|
||||
if(LinkState == DP83848_STATUS_100MBITS_FULLDUPLEX)
|
||||
{
|
||||
bcrvalue |= (DP83848_BCR_SPEED_SELECT | DP83848_BCR_DUPLEX_MODE);
|
||||
}
|
||||
else if (LinkState == DP83848_STATUS_100MBITS_HALFDUPLEX)
|
||||
{
|
||||
bcrvalue |= DP83848_BCR_SPEED_SELECT;
|
||||
}
|
||||
else if (LinkState == DP83848_STATUS_10MBITS_FULLDUPLEX)
|
||||
{
|
||||
bcrvalue |= DP83848_BCR_DUPLEX_MODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Wrong link status parameter */
|
||||
status = DP83848_STATUS_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
if(status == DP83848_STATUS_OK)
|
||||
{
|
||||
/* Apply configuration */
|
||||
if(pObj->IO.WriteReg(pObj->DevAddr, DP83848_BCR, bcrvalue) < 0)
|
||||
{
|
||||
status = DP83848_STATUS_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable loopback mode.
|
||||
* @param pObj: Pointer to device object.
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
* DP83848_STATUS_WRITE_ERROR if connot write to register
|
||||
*/
|
||||
int32_t DP83848_EnableLoopbackMode(dp83848_Object_t *pObj)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
int32_t status = DP83848_STATUS_OK;
|
||||
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_BCR, &readval) >= 0)
|
||||
{
|
||||
readval |= DP83848_BCR_LOOPBACK;
|
||||
|
||||
/* Apply configuration */
|
||||
if(pObj->IO.WriteReg(pObj->DevAddr, DP83848_BCR, readval) < 0)
|
||||
{
|
||||
status = DP83848_STATUS_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable loopback mode.
|
||||
* @param pObj: Pointer to device object.
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
* DP83848_STATUS_WRITE_ERROR if connot write to register
|
||||
*/
|
||||
int32_t DP83848_DisableLoopbackMode(dp83848_Object_t *pObj)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
int32_t status = DP83848_STATUS_OK;
|
||||
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_BCR, &readval) >= 0)
|
||||
{
|
||||
readval &= ~DP83848_BCR_LOOPBACK;
|
||||
|
||||
/* Apply configuration */
|
||||
if(pObj->IO.WriteReg(pObj->DevAddr, DP83848_BCR, readval) < 0)
|
||||
{
|
||||
status = DP83848_STATUS_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable IT source.
|
||||
* @param pObj: Pointer to device object.
|
||||
* @param Interrupt: IT source to be enabled
|
||||
* should be a value or a combination of the following:
|
||||
* DP83848_WOL_IT
|
||||
* DP83848_ENERGYON_IT
|
||||
* DP83848_AUTONEGO_COMPLETE_IT
|
||||
* DP83848_REMOTE_FAULT_IT
|
||||
* DP83848_LINK_DOWN_IT
|
||||
* DP83848_AUTONEGO_LP_ACK_IT
|
||||
* DP83848_PARALLEL_DETECTION_FAULT_IT
|
||||
* DP83848_AUTONEGO_PAGE_RECEIVED_IT
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
* DP83848_STATUS_WRITE_ERROR if connot write to register
|
||||
*/
|
||||
int32_t DP83848_EnableIT(dp83848_Object_t *pObj, uint32_t Interrupt)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
int32_t status = DP83848_STATUS_OK;
|
||||
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_IMR, &readval) >= 0)
|
||||
{
|
||||
readval |= Interrupt;
|
||||
|
||||
/* Apply configuration */
|
||||
if(pObj->IO.WriteReg(pObj->DevAddr, DP83848_IMR, readval) < 0)
|
||||
{
|
||||
status = DP83848_STATUS_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable IT source.
|
||||
* @param pObj: Pointer to device object.
|
||||
* @param Interrupt: IT source to be disabled
|
||||
* should be a value or a combination of the following:
|
||||
* DP83848_WOL_IT
|
||||
* DP83848_ENERGYON_IT
|
||||
* DP83848_AUTONEGO_COMPLETE_IT
|
||||
* DP83848_REMOTE_FAULT_IT
|
||||
* DP83848_LINK_DOWN_IT
|
||||
* DP83848_AUTONEGO_LP_ACK_IT
|
||||
* DP83848_PARALLEL_DETECTION_FAULT_IT
|
||||
* DP83848_AUTONEGO_PAGE_RECEIVED_IT
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
* DP83848_STATUS_WRITE_ERROR if connot write to register
|
||||
*/
|
||||
int32_t DP83848_DisableIT(dp83848_Object_t *pObj, uint32_t Interrupt)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
int32_t status = DP83848_STATUS_OK;
|
||||
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_IMR, &readval) >= 0)
|
||||
{
|
||||
readval &= ~Interrupt;
|
||||
|
||||
/* Apply configuration */
|
||||
if(pObj->IO.WriteReg(pObj->DevAddr, DP83848_IMR, readval) < 0)
|
||||
{
|
||||
status = DP83848_STATUS_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear IT flag.
|
||||
* @param pObj: Pointer to device object.
|
||||
* @param Interrupt: IT flag to be cleared
|
||||
* should be a value or a combination of the following:
|
||||
* DP83848_WOL_IT
|
||||
* DP83848_ENERGYON_IT
|
||||
* DP83848_AUTONEGO_COMPLETE_IT
|
||||
* DP83848_REMOTE_FAULT_IT
|
||||
* DP83848_LINK_DOWN_IT
|
||||
* DP83848_AUTONEGO_LP_ACK_IT
|
||||
* DP83848_PARALLEL_DETECTION_FAULT_IT
|
||||
* DP83848_AUTONEGO_PAGE_RECEIVED_IT
|
||||
* @retval DP83848_STATUS_OK if OK
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
*/
|
||||
int32_t DP83848_ClearIT(dp83848_Object_t *pObj, uint32_t Interrupt)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
int32_t status = DP83848_STATUS_OK;
|
||||
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_ISFR, &readval) < 0)
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get IT Flag status.
|
||||
* @param pObj: Pointer to device object.
|
||||
* @param Interrupt: IT Flag to be checked,
|
||||
* should be a value or a combination of the following:
|
||||
* DP83848_WOL_IT
|
||||
* DP83848_ENERGYON_IT
|
||||
* DP83848_AUTONEGO_COMPLETE_IT
|
||||
* DP83848_REMOTE_FAULT_IT
|
||||
* DP83848_LINK_DOWN_IT
|
||||
* DP83848_AUTONEGO_LP_ACK_IT
|
||||
* DP83848_PARALLEL_DETECTION_FAULT_IT
|
||||
* DP83848_AUTONEGO_PAGE_RECEIVED_IT
|
||||
* @retval 1 IT flag is SET
|
||||
* 0 IT flag is RESET
|
||||
* DP83848_STATUS_READ_ERROR if connot read register
|
||||
*/
|
||||
int32_t DP83848_GetITStatus(dp83848_Object_t *pObj, uint32_t Interrupt)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
int32_t status = 0;
|
||||
|
||||
if(pObj->IO.ReadReg(pObj->DevAddr, DP83848_ISFR, &readval) >= 0)
|
||||
{
|
||||
status = ((readval & Interrupt) == Interrupt);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = DP83848_STATUS_READ_ERROR;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,434 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file dp83848.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* dp83848.c PHY driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2021 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 DP83848_H
|
||||
#define DP83848_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848
|
||||
* @{
|
||||
*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup DP83848_Exported_Constants DP83848 Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_Registers_Mapping DP83848 Registers Mapping
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_BCR ((uint16_t)0x0000U)
|
||||
#define DP83848_BSR ((uint16_t)0x0001U)
|
||||
#define DP83848_PHYI1R ((uint16_t)0x0002U)
|
||||
#define DP83848_PHYI2R ((uint16_t)0x0003U)
|
||||
#define DP83848_ANAR ((uint16_t)0x0004U)
|
||||
#define DP83848_ANLPAR ((uint16_t)0x0005U)
|
||||
#define DP83848_ANER ((uint16_t)0x0006U)
|
||||
#define DP83848_ANNPTR ((uint16_t)0x0007U)
|
||||
#define DP83848_SMR ((uint16_t)0x0019U)
|
||||
#define DP83848_ISFR ((uint16_t)0x0012U)
|
||||
#define DP83848_IMR ((uint16_t)0x0011U)
|
||||
#define DP83848_PHYSCSR ((uint16_t)0x0010U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_BCR_Bit_Definition DP83848 BCR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_BCR_SOFT_RESET ((uint16_t)0x8000U)
|
||||
#define DP83848_BCR_LOOPBACK ((uint16_t)0x4000U)
|
||||
#define DP83848_BCR_SPEED_SELECT ((uint16_t)0x2000U)
|
||||
#define DP83848_BCR_AUTONEGO_EN ((uint16_t)0x1000U)
|
||||
#define DP83848_BCR_POWER_DOWN ((uint16_t)0x0800U)
|
||||
#define DP83848_BCR_ISOLATE ((uint16_t)0x0400U)
|
||||
#define DP83848_BCR_RESTART_AUTONEGO ((uint16_t)0x0200U)
|
||||
#define DP83848_BCR_DUPLEX_MODE ((uint16_t)0x0100U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_BSR_Bit_Definition DP83848 BSR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_BSR_100BASE_T4 ((uint16_t)0x8000U)
|
||||
#define DP83848_BSR_100BASE_TX_FD ((uint16_t)0x4000U)
|
||||
#define DP83848_BSR_100BASE_TX_HD ((uint16_t)0x2000U)
|
||||
#define DP83848_BSR_10BASE_T_FD ((uint16_t)0x1000U)
|
||||
#define DP83848_BSR_10BASE_T_HD ((uint16_t)0x0800U)
|
||||
#define DP83848_BSR_MF_PREAMBLE ((uint16_t)0x0040U)
|
||||
#define DP83848_BSR_AUTONEGO_CPLT ((uint16_t)0x0020U)
|
||||
#define DP83848_BSR_REMOTE_FAULT ((uint16_t)0x0010U)
|
||||
#define DP83848_BSR_AUTONEGO_ABILITY ((uint16_t)0x0008U)
|
||||
#define DP83848_BSR_LINK_STATUS ((uint16_t)0x0004U)
|
||||
#define DP83848_BSR_JABBER_DETECT ((uint16_t)0x0002U)
|
||||
#define DP83848_BSR_EXTENDED_CAP ((uint16_t)0x0001U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_PHYI1R_Bit_Definition DP83848 PHYI1R Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_PHYI1R_OUI_3_18 ((uint16_t)0xFFFFU)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_PHYI2R_Bit_Definition DP83848 PHYI2R Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_PHYI2R_OUI_19_24 ((uint16_t)0xFC00U)
|
||||
#define DP83848_PHYI2R_MODEL_NBR ((uint16_t)0x03F0U)
|
||||
#define DP83848_PHYI2R_REVISION_NBR ((uint16_t)0x000FU)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_ANAR_Bit_Definition DP83848 ANAR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_ANAR_NEXT_PAGE ((uint16_t)0x8000U)
|
||||
#define DP83848_ANAR_REMOTE_FAULT ((uint16_t)0x2000U)
|
||||
#define DP83848_ANAR_PAUSE_OPERATION ((uint16_t)0x0C00U)
|
||||
#define DP83848_ANAR_PO_NOPAUSE ((uint16_t)0x0000U)
|
||||
#define DP83848_ANAR_PO_SYMMETRIC_PAUSE ((uint16_t)0x0400U)
|
||||
#define DP83848_ANAR_PO_ASYMMETRIC_PAUSE ((uint16_t)0x0800U)
|
||||
#define DP83848_ANAR_PO_ADVERTISE_SUPPORT ((uint16_t)0x0C00U)
|
||||
#define DP83848_ANAR_100BASE_TX_FD ((uint16_t)0x0100U)
|
||||
#define DP83848_ANAR_100BASE_TX ((uint16_t)0x0080U)
|
||||
#define DP83848_ANAR_10BASE_T_FD ((uint16_t)0x0040U)
|
||||
#define DP83848_ANAR_10BASE_T ((uint16_t)0x0020U)
|
||||
#define DP83848_ANAR_SELECTOR_FIELD ((uint16_t)0x000FU)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_ANLPAR_Bit_Definition DP83848 ANLPAR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_ANLPAR_NEXT_PAGE ((uint16_t)0x8000U)
|
||||
#define DP83848_ANLPAR_REMOTE_FAULT ((uint16_t)0x2000U)
|
||||
#define DP83848_ANLPAR_PAUSE_OPERATION ((uint16_t)0x0C00U)
|
||||
#define DP83848_ANLPAR_PO_NOPAUSE ((uint16_t)0x0000U)
|
||||
#define DP83848_ANLPAR_PO_SYMMETRIC_PAUSE ((uint16_t)0x0400U)
|
||||
#define DP83848_ANLPAR_PO_ASYMMETRIC_PAUSE ((uint16_t)0x0800U)
|
||||
#define DP83848_ANLPAR_PO_ADVERTISE_SUPPORT ((uint16_t)0x0C00U)
|
||||
#define DP83848_ANLPAR_100BASE_TX_FD ((uint16_t)0x0100U)
|
||||
#define DP83848_ANLPAR_100BASE_TX ((uint16_t)0x0080U)
|
||||
#define DP83848_ANLPAR_10BASE_T_FD ((uint16_t)0x0040U)
|
||||
#define DP83848_ANLPAR_10BASE_T ((uint16_t)0x0020U)
|
||||
#define DP83848_ANLPAR_SELECTOR_FIELD ((uint16_t)0x000FU)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_ANER_Bit_Definition DP83848 ANER Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_ANER_RX_NP_LOCATION_ABLE ((uint16_t)0x0040U)
|
||||
#define DP83848_ANER_RX_NP_STORAGE_LOCATION ((uint16_t)0x0020U)
|
||||
#define DP83848_ANER_PARALLEL_DETECT_FAULT ((uint16_t)0x0010U)
|
||||
#define DP83848_ANER_LP_NP_ABLE ((uint16_t)0x0008U)
|
||||
#define DP83848_ANER_NP_ABLE ((uint16_t)0x0004U)
|
||||
#define DP83848_ANER_PAGE_RECEIVED ((uint16_t)0x0002U)
|
||||
#define DP83848_ANER_LP_AUTONEG_ABLE ((uint16_t)0x0001U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_ANNPTR_Bit_Definition DP83848 ANNPTR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_ANNPTR_NEXT_PAGE ((uint16_t)0x8000U)
|
||||
#define DP83848_ANNPTR_MESSAGE_PAGE ((uint16_t)0x2000U)
|
||||
#define DP83848_ANNPTR_ACK2 ((uint16_t)0x1000U)
|
||||
#define DP83848_ANNPTR_TOGGLE ((uint16_t)0x0800U)
|
||||
#define DP83848_ANNPTR_MESSAGE_CODE ((uint16_t)0x07FFU)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_ANNPRR_Bit_Definition DP83848 ANNPRR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_ANNPRR_NEXT_PAGE ((uint16_t)0x8000U)
|
||||
#define DP83848_ANNPRR_ACK ((uint16_t)0x4000U)
|
||||
#define DP83848_ANNPRR_MESSAGE_PAGE ((uint16_t)0x2000U)
|
||||
#define DP83848_ANNPRR_ACK2 ((uint16_t)0x1000U)
|
||||
#define DP83848_ANNPRR_TOGGLE ((uint16_t)0x0800U)
|
||||
#define DP83848_ANNPRR_MESSAGE_CODE ((uint16_t)0x07FFU)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_MMDACR_Bit_Definition DP83848 MMDACR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_MMDACR_MMD_FUNCTION ((uint16_t)0xC000U)
|
||||
#define DP83848_MMDACR_MMD_FUNCTION_ADDR ((uint16_t)0x0000U)
|
||||
#define DP83848_MMDACR_MMD_FUNCTION_DATA ((uint16_t)0x4000U)
|
||||
#define DP83848_MMDACR_MMD_DEV_ADDR ((uint16_t)0x001FU)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_ENCTR_Bit_Definition DP83848 ENCTR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_ENCTR_TX_ENABLE ((uint16_t)0x8000U)
|
||||
#define DP83848_ENCTR_TX_TIMER ((uint16_t)0x6000U)
|
||||
#define DP83848_ENCTR_TX_TIMER_1S ((uint16_t)0x0000U)
|
||||
#define DP83848_ENCTR_TX_TIMER_768MS ((uint16_t)0x2000U)
|
||||
#define DP83848_ENCTR_TX_TIMER_512MS ((uint16_t)0x4000U)
|
||||
#define DP83848_ENCTR_TX_TIMER_265MS ((uint16_t)0x6000U)
|
||||
#define DP83848_ENCTR_RX_ENABLE ((uint16_t)0x1000U)
|
||||
#define DP83848_ENCTR_RX_MAX_INTERVAL ((uint16_t)0x0C00U)
|
||||
#define DP83848_ENCTR_RX_MAX_INTERVAL_64MS ((uint16_t)0x0000U)
|
||||
#define DP83848_ENCTR_RX_MAX_INTERVAL_256MS ((uint16_t)0x0400U)
|
||||
#define DP83848_ENCTR_RX_MAX_INTERVAL_512MS ((uint16_t)0x0800U)
|
||||
#define DP83848_ENCTR_RX_MAX_INTERVAL_1S ((uint16_t)0x0C00U)
|
||||
#define DP83848_ENCTR_EX_CROSS_OVER ((uint16_t)0x0002U)
|
||||
#define DP83848_ENCTR_EX_MANUAL_CROSS_OVER ((uint16_t)0x0001U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_MCSR_Bit_Definition DP83848 MCSR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_MCSR_EDPWRDOWN ((uint16_t)0x2000U)
|
||||
#define DP83848_MCSR_FARLOOPBACK ((uint16_t)0x0200U)
|
||||
#define DP83848_MCSR_ALTINT ((uint16_t)0x0040U)
|
||||
#define DP83848_MCSR_ENERGYON ((uint16_t)0x0002U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_SMR_Bit_Definition DP83848 SMR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_SMR_MODE ((uint16_t)0x00E0U)
|
||||
#define DP83848_SMR_PHY_ADDR ((uint16_t)0x001FU)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_TPDCR_Bit_Definition DP83848 TPDCR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_TPDCR_DELAY_IN ((uint16_t)0x8000U)
|
||||
#define DP83848_TPDCR_LINE_BREAK_COUNTER ((uint16_t)0x7000U)
|
||||
#define DP83848_TPDCR_PATTERN_HIGH ((uint16_t)0x0FC0U)
|
||||
#define DP83848_TPDCR_PATTERN_LOW ((uint16_t)0x003FU)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_TCSR_Bit_Definition DP83848 TCSR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_TCSR_TDR_ENABLE ((uint16_t)0x8000U)
|
||||
#define DP83848_TCSR_TDR_AD_FILTER_ENABLE ((uint16_t)0x4000U)
|
||||
#define DP83848_TCSR_TDR_CH_CABLE_TYPE ((uint16_t)0x0600U)
|
||||
#define DP83848_TCSR_TDR_CH_CABLE_DEFAULT ((uint16_t)0x0000U)
|
||||
#define DP83848_TCSR_TDR_CH_CABLE_SHORTED ((uint16_t)0x0200U)
|
||||
#define DP83848_TCSR_TDR_CH_CABLE_OPEN ((uint16_t)0x0400U)
|
||||
#define DP83848_TCSR_TDR_CH_CABLE_MATCH ((uint16_t)0x0600U)
|
||||
#define DP83848_TCSR_TDR_CH_STATUS ((uint16_t)0x0100U)
|
||||
#define DP83848_TCSR_TDR_CH_LENGTH ((uint16_t)0x00FFU)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_SCSIR_Bit_Definition DP83848 SCSIR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_SCSIR_AUTO_MDIX_ENABLE ((uint16_t)0x8000U)
|
||||
#define DP83848_SCSIR_CHANNEL_SELECT ((uint16_t)0x2000U)
|
||||
#define DP83848_SCSIR_SQE_DISABLE ((uint16_t)0x0800U)
|
||||
#define DP83848_SCSIR_XPOLALITY ((uint16_t)0x0010U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_CLR_Bit_Definition DP83848 CLR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_CLR_CABLE_LENGTH ((uint16_t)0xF000U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_IMR_ISFR_Bit_Definition DP83848 IMR ISFR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_INT_8 ((uint16_t)0x0100U)
|
||||
#define DP83848_INT_7 ((uint16_t)0x0080U)
|
||||
#define DP83848_INT_6 ((uint16_t)0x0040U)
|
||||
#define DP83848_INT_5 ((uint16_t)0x0020U)
|
||||
#define DP83848_INT_4 ((uint16_t)0x0010U)
|
||||
#define DP83848_INT_3 ((uint16_t)0x0008U)
|
||||
#define DP83848_INT_2 ((uint16_t)0x0004U)
|
||||
#define DP83848_INT_1 ((uint16_t)0x0002U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_PHYSCSR_Bit_Definition DP83848 PHYSCSR Bit Definition
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_PHYSCSR_AUTONEGO_DONE ((uint16_t)0x010U)
|
||||
#define DP83848_PHYSCSR_HCDSPEEDMASK ((uint16_t)0x006U)
|
||||
#define DP83848_PHYSCSR_10BT_HD ((uint16_t)0x002U)
|
||||
#define DP83848_PHYSCSR_10BT_FD ((uint16_t)0x006U)
|
||||
#define DP83848_PHYSCSR_100BTX_HD ((uint16_t)0x000U)
|
||||
#define DP83848_PHYSCSR_100BTX_FD ((uint16_t)0x004U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_Status DP83848 Status
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define DP83848_STATUS_READ_ERROR ((int32_t)-5)
|
||||
#define DP83848_STATUS_WRITE_ERROR ((int32_t)-4)
|
||||
#define DP83848_STATUS_ADDRESS_ERROR ((int32_t)-3)
|
||||
#define DP83848_STATUS_RESET_TIMEOUT ((int32_t)-2)
|
||||
#define DP83848_STATUS_ERROR ((int32_t)-1)
|
||||
#define DP83848_STATUS_OK ((int32_t) 0)
|
||||
#define DP83848_STATUS_LINK_DOWN ((int32_t) 1)
|
||||
#define DP83848_STATUS_100MBITS_FULLDUPLEX ((int32_t) 2)
|
||||
#define DP83848_STATUS_100MBITS_HALFDUPLEX ((int32_t) 3)
|
||||
#define DP83848_STATUS_10MBITS_FULLDUPLEX ((int32_t) 4)
|
||||
#define DP83848_STATUS_10MBITS_HALFDUPLEX ((int32_t) 5)
|
||||
#define DP83848_STATUS_AUTONEGO_NOTDONE ((int32_t) 6)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DP83848_IT_Flags DP83848 IT Flags
|
||||
* @{
|
||||
*/
|
||||
#define DP83848_WOL_IT DP83848_INT_8
|
||||
#define DP83848_ENERGYON_IT DP83848_INT_7
|
||||
#define DP83848_AUTONEGO_COMPLETE_IT DP83848_INT_6
|
||||
#define DP83848_REMOTE_FAULT_IT DP83848_INT_5
|
||||
#define DP83848_LINK_DOWN_IT DP83848_INT_4
|
||||
#define DP83848_AUTONEGO_LP_ACK_IT DP83848_INT_3
|
||||
#define DP83848_PARALLEL_DETECTION_FAULT_IT DP83848_INT_2
|
||||
#define DP83848_AUTONEGO_PAGE_RECEIVED_IT DP83848_INT_1
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup DP83848_Exported_Types DP83848 Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef int32_t (*dp83848_Init_Func) (void);
|
||||
typedef int32_t (*dp83848_DeInit_Func) (void);
|
||||
typedef int32_t (*dp83848_ReadReg_Func) (uint32_t, uint32_t, uint32_t *);
|
||||
typedef int32_t (*dp83848_WriteReg_Func) (uint32_t, uint32_t, uint32_t);
|
||||
typedef int32_t (*dp83848_GetTick_Func) (void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
dp83848_Init_Func Init;
|
||||
dp83848_DeInit_Func DeInit;
|
||||
dp83848_WriteReg_Func WriteReg;
|
||||
dp83848_ReadReg_Func ReadReg;
|
||||
dp83848_GetTick_Func GetTick;
|
||||
} dp83848_IOCtx_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t DevAddr;
|
||||
uint32_t Is_Initialized;
|
||||
dp83848_IOCtx_t IO;
|
||||
void *pData;
|
||||
}dp83848_Object_t;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @defgroup DP83848_Exported_Functions DP83848 Exported Functions
|
||||
* @{
|
||||
*/
|
||||
int32_t DP83848_RegisterBusIO(dp83848_Object_t *pObj, dp83848_IOCtx_t *ioctx);
|
||||
int32_t DP83848_Init(dp83848_Object_t *pObj);
|
||||
int32_t DP83848_DeInit(dp83848_Object_t *pObj);
|
||||
int32_t DP83848_DisablePowerDownMode(dp83848_Object_t *pObj);
|
||||
int32_t DP83848_EnablePowerDownMode(dp83848_Object_t *pObj);
|
||||
int32_t DP83848_StartAutoNego(dp83848_Object_t *pObj);
|
||||
int32_t DP83848_GetLinkState(dp83848_Object_t *pObj);
|
||||
int32_t DP83848_SetLinkState(dp83848_Object_t *pObj, uint32_t LinkState);
|
||||
int32_t DP83848_EnableLoopbackMode(dp83848_Object_t *pObj);
|
||||
int32_t DP83848_DisableLoopbackMode(dp83848_Object_t *pObj);
|
||||
int32_t DP83848_EnableIT(dp83848_Object_t *pObj, uint32_t Interrupt);
|
||||
int32_t DP83848_DisableIT(dp83848_Object_t *pObj, uint32_t Interrupt);
|
||||
int32_t DP83848_ClearIT(dp83848_Object_t *pObj, uint32_t Interrupt);
|
||||
int32_t DP83848_GetITStatus(dp83848_Object_t *pObj, uint32_t Interrupt);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* DP83848_H */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,222 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file exc7200.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the EXC7200
|
||||
* Touch-screen controller.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015 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 "exc7200.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup EXC7200
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
|
||||
/** @defgroup EXC7200_Private_Types_Definitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup EXC7200_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup EXC7200_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
/** @defgroup EXC7200_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Touch screen driver structure initialization */
|
||||
TS_DrvTypeDef exc7200_ts_drv =
|
||||
{
|
||||
exc7200_Init,
|
||||
exc7200_ReadID,
|
||||
exc7200_Reset,
|
||||
|
||||
exc7200_TS_Start,
|
||||
exc7200_TS_DetectTouch,
|
||||
exc7200_TS_GetXY,
|
||||
|
||||
exc7200_TS_EnableIT,
|
||||
exc7200_TS_ClearIT,
|
||||
exc7200_TS_ITStatus,
|
||||
exc7200_TS_DisableIT,
|
||||
};
|
||||
|
||||
uint8_t aBufferTS[10];
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
|
||||
/** @defgroup exc7200_Private_Function_Prototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/** @defgroup exc7200_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize the exc7200 and configure the needed hardware resources
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval None
|
||||
*/
|
||||
void exc7200_Init(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Initialize IO BUS layer */
|
||||
IOE_Init();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset the exc7200 by Software.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval None
|
||||
*/
|
||||
void exc7200_Reset(uint16_t DeviceAddr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the exc7200 IO Expander device ID.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval The Device ID (two bytes).
|
||||
*/
|
||||
uint16_t exc7200_ReadID(uint16_t DeviceAddr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the touch Screen Controller (Single point detection)
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval None.
|
||||
*/
|
||||
void exc7200_TS_Start(uint16_t DeviceAddr)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return if there is touch detected or not.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval Touch detected state.
|
||||
*/
|
||||
uint8_t exc7200_TS_DetectTouch(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Read TS data : Send I2C Slave address + 1 Bit0=1 for:read */
|
||||
IOE_ReadMultiple(DeviceAddr | 1, EXC7200_READ_CMD, aBufferTS, 10);
|
||||
|
||||
/* check for first byte */
|
||||
if (aBufferTS[1]==0x83)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the touch screen X and Y positions values
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param X: Pointer to X position value
|
||||
* @param Y: Pointer to Y position value
|
||||
* @retval None.
|
||||
*/
|
||||
void exc7200_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
|
||||
{
|
||||
/* Calculate positions */
|
||||
*X = (((aBufferTS[3]&0x00ff) << 4) | ((aBufferTS[2]&0x00f0) >> 4)) << 1;
|
||||
*Y = (((aBufferTS[5]&0x00ff) << 4) | ((aBufferTS[4]&0x00f0) >> 4)) << 1;
|
||||
|
||||
/* Dummy Read to deactivate read mode */
|
||||
IOE_ReadMultiple(DeviceAddr, EXC7200_READ_CMD, aBufferTS, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the selected source to generate a global interrupt or not
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval None
|
||||
*/
|
||||
void exc7200_TS_EnableIT(uint16_t DeviceAddr)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the selected source to generate a global interrupt or not
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval None
|
||||
*/
|
||||
void exc7200_TS_DisableIT(uint16_t DeviceAddr)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the selected source to generate a global interrupt or not
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval TS interrupts status
|
||||
*/
|
||||
uint8_t exc7200_TS_ITStatus(uint16_t DeviceAddr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the selected source to generate a global interrupt or not
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval None
|
||||
*/
|
||||
void exc7200_TS_ClearIT(uint16_t DeviceAddr)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file exc7200.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* exc7200.c IO expander driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015 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 __EXC7200_H
|
||||
#define __EXC7200_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/ts.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup EXC7200
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup EXC7200_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup EXC7200_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* */
|
||||
#define EXC7200_READ_CMD 0x09
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup exc7200_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup exc7200_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief exc7200 Control functions
|
||||
*/
|
||||
void exc7200_Init(uint16_t DeviceAddr);
|
||||
void exc7200_Reset(uint16_t DeviceAddr);
|
||||
uint16_t exc7200_ReadID(uint16_t DeviceAddr);
|
||||
void exc7200_TS_Start(uint16_t DeviceAddr);
|
||||
uint8_t exc7200_TS_DetectTouch(uint16_t DeviceAddr);
|
||||
void exc7200_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
|
||||
void exc7200_TS_EnableIT(uint16_t DeviceAddr);
|
||||
void exc7200_TS_DisableIT(uint16_t DeviceAddr);
|
||||
uint8_t exc7200_TS_ITStatus (uint16_t DeviceAddr);
|
||||
void exc7200_TS_ClearIT (uint16_t DeviceAddr);
|
||||
|
||||
void IOE_Init(void);
|
||||
void IOE_Delay(uint32_t delay);
|
||||
uint8_t IOE_Read(uint8_t addr, uint8_t reg);
|
||||
uint16_t IOE_ReadMultiple(uint8_t addr, uint8_t reg, uint8_t *buffer, uint16_t length);
|
||||
void IOE_WriteMultiple(uint8_t addr, uint8_t reg, uint8_t *buffer, uint16_t length);
|
||||
|
||||
/* Touch screen driver structure */
|
||||
extern TS_DrvTypeDef exc7200_ts_drv;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __EXC7200_H */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: 'Bug report'
|
||||
about: 'Create a report to help us improve the quality of our software'
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Caution**
|
||||
|
||||
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
|
||||
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the **ST Community** in the STM32 MCUs dedicated [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
|
||||
**Describe the set-up**
|
||||
|
||||
* The board (either ST RPN reference or your custom board)
|
||||
* IDE or at least the compiler and its version
|
||||
|
||||
**Describe the bug (skip if none)**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce the bug (skip if none)**
|
||||
|
||||
1. Indicate the global behavior of your application project
|
||||
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
|
||||
3. Describe the use case that generates the problem
|
||||
4. How we can reproduce the problem
|
||||
|
||||
|
||||
**Additional context**
|
||||
|
||||
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
@@ -0,0 +1,3 @@
|
||||
## IMPORTANT INFORMATION
|
||||
|
||||
Pull-requests are **not** accepted on this repository. Please use issues to report any bug or request.
|
||||
@@ -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).
|
||||
@@ -0,0 +1,28 @@
|
||||
## Contributing guide
|
||||
|
||||
This document serves as a checklist before contributing to this repository.
|
||||
It includes links to read up on if topics are unclear to you.
|
||||
|
||||
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
|
||||
To report a bug or a request please file an issue in the right repository
|
||||
(example for [ft3x67](https://github.com/STMicroelectronics/ft3x67/issues/new/choose)).
|
||||
|
||||
Please check the following boxes 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, it should be submitted to the ST Community under the MCU topic [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
|
||||
### 2. Posting the issue
|
||||
When you have checked the previous boxes. You will find two templates (Bug Report or Other Issue) available in the **Issues** tab of the repository.
|
||||
|
||||
### 3. Pull Requests
|
||||
Pull-requests are **not** accepted on this repository. Please use **issues** to report any bug or request.
|
||||
|
||||
### 4. 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 for one new feature or proposal. This will ease the analysis and the final merge if accepted.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,40 @@
|
||||
# BSP FT3X67 Component
|
||||
|
||||
## Overview
|
||||
|
||||
**STM32Cube** is an STMicroelectronics original initiative to ease the 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 components 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 **ft3x67** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **FT3X67** BSP TOUCH SCREEN component part.
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2017 STMicroelectronics
|
||||
|
||||
This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this software except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
|
||||
|
||||
## Release note
|
||||
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/ft3x67/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.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/ft3x67/issues/new/choose).
|
||||
|
||||
For any other question related to the product, the tools, the environment, you can submit a topic to the [ST Community](https://community.st.com/s/).
|
||||
@@ -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 ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
@@ -0,0 +1,439 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ft3x67.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the FT3X67
|
||||
* touch screen devices.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 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 "ft3x67.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup FT3X67
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Private_Types_Definitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* ft3x67 Handle definition. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t i2cInitialized;
|
||||
|
||||
/* field holding the current number of simultaneous active touches */
|
||||
uint8_t currActiveTouchNb;
|
||||
|
||||
/* field holding the touch index currently managed */
|
||||
uint8_t currActiveTouchIdx;
|
||||
|
||||
} ft3x67_handle_TypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Touch screen driver structure initialization */
|
||||
TS_DrvTypeDef ft3x67_ts_drv =
|
||||
{
|
||||
ft3x67_Init,
|
||||
ft3x67_ReadID,
|
||||
ft3x67_Reset,
|
||||
ft3x67_TS_Start,
|
||||
ft3x67_TS_DetectTouch,
|
||||
ft3x67_TS_GetXY,
|
||||
ft3x67_TS_EnableIT,
|
||||
ft3x67_TS_ClearIT,
|
||||
ft3x67_TS_ITStatus,
|
||||
ft3x67_TS_DisableIT
|
||||
};
|
||||
|
||||
/* Global ft3x67 handle */
|
||||
static ft3x67_handle_TypeDef ft3x67_handle = { FT3X67_I2C_NOT_INITIALIZED, 0U, 0U};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private functions prototypes-----------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
static uint8_t ft3x67_Get_I2C_InitializedStatus(void);
|
||||
static void ft3x67_I2C_InitializeIfRequired(void);
|
||||
static uint32_t ft3x67_TS_Configure(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup FT3X67_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize the ft3x67 communication bus
|
||||
* from MCU to FT3X67 : ie I2C channel initialization (if required).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @retval None
|
||||
*/
|
||||
void ft3x67_Init(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Initialize I2C link if needed */
|
||||
ft3x67_I2C_InitializeIfRequired();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Software Reset the ft3x67.
|
||||
* @note : Not applicable to FT3X67.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @retval None
|
||||
*/
|
||||
void ft3x67_Reset(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Do nothing */
|
||||
/* No software reset sequence available in FT3X67 IC */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the ft3x67 device ID, pre initialize I2C in case of need to be
|
||||
* able to read the FT3X67 device ID, and verify this is a FT3X67.
|
||||
* @param DeviceAddr: I2C FT3X67 Slave address.
|
||||
* @retval The Device ID (two bytes).
|
||||
*/
|
||||
uint16_t ft3x67_ReadID(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Initialize I2C link if needed */
|
||||
ft3x67_I2C_InitializeIfRequired();
|
||||
|
||||
/* Return the device ID value */
|
||||
return(TS_IO_Read(DeviceAddr, FT3X67_CHIP_ID_REG));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the touch Screen IC device to start detecting touches
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address).
|
||||
* @retval None.
|
||||
*/
|
||||
void ft3x67_TS_Start(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Minimum static configuration of FT3X67 */
|
||||
ft3x67_TS_Configure(DeviceAddr);
|
||||
|
||||
/* By default set FT3X67 IC in Polling mode : no INT generation on FT3X67 for new touch available */
|
||||
/* Note TS_INT is active low */
|
||||
ft3x67_TS_DisableIT(DeviceAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return if there is touches detected or not.
|
||||
* Try to detect new touches and forget the old ones (reset internal global
|
||||
* variables).
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval : Number of active touches detected (can be 0, 1 or 2).
|
||||
*/
|
||||
uint8_t ft3x67_TS_DetectTouch(uint16_t DeviceAddr)
|
||||
{
|
||||
volatile uint8_t nbTouch = 0U;
|
||||
|
||||
/* Read register FT3X67_TD_STAT_REG to check number of touches detection */
|
||||
nbTouch = TS_IO_Read(DeviceAddr, FT3X67_TD_STAT_REG);
|
||||
nbTouch &= FT3X67_TD_STAT_MASK;
|
||||
|
||||
if(nbTouch > FT3X67_MAX_DETECTABLE_TOUCH)
|
||||
{
|
||||
/* If invalid number of touch detected, set it to zero */
|
||||
nbTouch = 0U;
|
||||
}
|
||||
|
||||
/* Update ft3x67 driver internal global : current number of active touches */
|
||||
ft3x67_handle.currActiveTouchNb = nbTouch;
|
||||
|
||||
/* Reset current active touch index on which to work on */
|
||||
ft3x67_handle.currActiveTouchIdx = 0U;
|
||||
|
||||
return(nbTouch);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the touch screen X and Y positions values
|
||||
* Manage multi touch thanks to touch Index global
|
||||
* variable 'ft3x67_handle.currActiveTouchIdx'.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param X: Pointer to X position value
|
||||
* @param Y: Pointer to Y position value
|
||||
* @retval None.
|
||||
*/
|
||||
void ft3x67_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
|
||||
{
|
||||
uint8_t regAddress = 0U;
|
||||
uint8_t dataxy[4U];
|
||||
|
||||
if(ft3x67_handle.currActiveTouchIdx < ft3x67_handle.currActiveTouchNb)
|
||||
{
|
||||
switch(ft3x67_handle.currActiveTouchIdx)
|
||||
{
|
||||
case 0U :
|
||||
regAddress = FT3X67_P1_XH_REG;
|
||||
break;
|
||||
|
||||
case 1U :
|
||||
regAddress = FT3X67_P2_XH_REG;
|
||||
break;
|
||||
|
||||
default :
|
||||
break;
|
||||
} /* end switch(ft3x67_handle.currActiveTouchIdx) */
|
||||
|
||||
/* Read X and Y positions */
|
||||
TS_IO_ReadMultiple(DeviceAddr, regAddress, dataxy, sizeof(dataxy));
|
||||
|
||||
/* Send back ready X position to caller */
|
||||
*X = ((dataxy[0U] & FT3X67_TOUCH_POS_MSB_MASK) << 8U) | dataxy[1U];
|
||||
|
||||
/* Send back ready Y position to caller */
|
||||
*Y = ((dataxy[2U] & FT3X67_TOUCH_POS_MSB_MASK) << 8U) | dataxy[3U];
|
||||
|
||||
/* Increment current touch index */
|
||||
ft3x67_handle.currActiveTouchIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the FT3X67 device to generate IT on given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT3X67).
|
||||
* @retval None
|
||||
*/
|
||||
void ft3x67_TS_EnableIT(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Set interrupt trigger mode in FT3X67_GMODE_REG */
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GMODE_REG, FT3X67_G_MODE_INTERRUPT_TRIGGER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the FT3X67 device to stop generating IT on the given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT3X67).
|
||||
* @retval None
|
||||
*/
|
||||
void ft3x67_TS_DisableIT(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Set interrupt polling mode in FT3X67_GMODE_REG */
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GMODE_REG, FT3X67_G_MODE_INTERRUPT_POLLING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get IT status from FT3X67 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 FT3X67.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @retval TS interrupts status : always return 0 here
|
||||
*/
|
||||
uint8_t ft3x67_TS_ITStatus(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Always return 0 as feature not applicable to FT3X67 */
|
||||
return 0U;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear IT status in FT3X67 interrupt status clear registers
|
||||
* Should be called Following an EXTI coming to the MCU.
|
||||
* @note : This feature is not applicable to FT3X67.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @retval None
|
||||
*/
|
||||
void ft3x67_TS_ClearIT(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Nothing to be done here for FT3X67 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure gesture feature (enable/disable).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @param Activation : Enable or disable gesture feature. Possible values are
|
||||
* FT3X67_GESTURE_DISABLE or FT3X67_GESTURE_ENABLE.
|
||||
* @retval None.
|
||||
*/
|
||||
void ft3x67_TS_GestureConfig(uint16_t DeviceAddr, uint32_t Activation)
|
||||
{
|
||||
if(Activation == FT3X67_GESTURE_ENABLE)
|
||||
{
|
||||
/* Enable gesture feature. */
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GESTURE_FLAG_REG, FT3X67_GEST_ALL_FLAGS_ENABLE);
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GESTURE_ENABLE_REG, FT3X67_GESTURE_ENABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable gesture feature. */
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GESTURE_FLAG_REG, FT3X67_GEST_ALL_FLAGS_DISABLE);
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GESTURE_ENABLE_REG, FT3X67_GESTURE_DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the last touch gesture identification (zoom, move up/down...).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @param pGestureId : Pointer to get last touch gesture Identification.
|
||||
* @retval None.
|
||||
*/
|
||||
void ft3x67_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId)
|
||||
{
|
||||
volatile uint8_t ucReadData = 0U;
|
||||
|
||||
ucReadData = TS_IO_Read(DeviceAddr, FT3X67_GEST_ID_REG);
|
||||
|
||||
*pGestureId = ucReadData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the touch detailed informations on touch number 'touchIdx' (0..1)
|
||||
* This touch detailed information contains :
|
||||
* - weight that was applied to this touch
|
||||
* - sub-area of the touch in the touch panel
|
||||
* - event of linked to the touch (press down, lift up, ...)
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT3X67).
|
||||
* @param touchIdx : Passed index of the touch (0..1) on which we want to get the
|
||||
* detailed information.
|
||||
* @param pWeight : Pointer to to get the weight information of 'touchIdx'.
|
||||
* @param pArea : Pointer to to get the sub-area information of 'touchIdx'.
|
||||
* @param pEvent : Pointer to to get the event information of 'touchIdx'.
|
||||
* @note Area and Weight features are not supported by FT3X67. Return always 0 value.
|
||||
* @retval None.
|
||||
*/
|
||||
void ft3x67_TS_GetTouchInfo(uint16_t DeviceAddr,
|
||||
uint32_t touchIdx,
|
||||
uint32_t * pWeight,
|
||||
uint32_t * pArea,
|
||||
uint32_t * pEvent)
|
||||
{
|
||||
volatile uint8_t ucReadData = 0U;
|
||||
uint8_t regAddressXHigh = 0U;
|
||||
|
||||
if(touchIdx < ft3x67_handle.currActiveTouchNb)
|
||||
{
|
||||
switch(touchIdx)
|
||||
{
|
||||
case 0U :
|
||||
regAddressXHigh = FT3X67_P1_XH_REG;
|
||||
break;
|
||||
|
||||
case 1U :
|
||||
regAddressXHigh = FT3X67_P2_XH_REG;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
} /* end switch(touchIdx) */
|
||||
|
||||
/* Read Event Id of touch index */
|
||||
ucReadData = TS_IO_Read(DeviceAddr, regAddressXHigh);
|
||||
*pEvent = (ucReadData & FT3X67_TOUCH_EVT_FLAG_MASK) >> FT3X67_TOUCH_EVT_FLAG_SHIFT;
|
||||
|
||||
/* Weight and area of touch index not supported by FT3X67 */
|
||||
*pWeight = 0;
|
||||
*pArea = 0;
|
||||
} /* of if(touchIdx < ft3x67_handle.currActiveTouchNb) */
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private functions bodies---------------------------------------------------*/
|
||||
|
||||
/** @addtogroup FT3X67_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Return the status of I2C was initialized or not.
|
||||
* @param None.
|
||||
* @retval : I2C initialization status.
|
||||
*/
|
||||
static uint8_t ft3x67_Get_I2C_InitializedStatus(void)
|
||||
{
|
||||
return(ft3x67_handle.i2cInitialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief I2C initialize if needed.
|
||||
* @param None.
|
||||
* @retval : None.
|
||||
*/
|
||||
static void ft3x67_I2C_InitializeIfRequired(void)
|
||||
{
|
||||
if(ft3x67_Get_I2C_InitializedStatus() == FT3X67_I2C_NOT_INITIALIZED)
|
||||
{
|
||||
/* Initialize TS IO BUS layer (I2C) */
|
||||
TS_IO_Init();
|
||||
|
||||
/* Set state to initialized */
|
||||
ft3x67_handle.i2cInitialized = FT3X67_I2C_INITIALIZED;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Basic static configuration of TouchScreen
|
||||
* @param DeviceAddr: FT3X67 Device address for communication on I2C Bus.
|
||||
* @retval Status FT3X67_STATUS_OK or FT3X67_STATUS_NOT_OK.
|
||||
*/
|
||||
static uint32_t ft3x67_TS_Configure(uint16_t DeviceAddr)
|
||||
{
|
||||
uint32_t status = FT3X67_STATUS_OK;
|
||||
|
||||
/* Disable gesture feature */
|
||||
TS_IO_Write(DeviceAddr, FT3X67_GESTURE_ENABLE_REG, FT3X67_GESTURE_DISABLE);
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,270 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ft3x67.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* ft3x67.c touch screen driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 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 __FT3X67_H
|
||||
#define __FT3X67_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/ts.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FT3X67
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Maximum border values of the touchscreen pad */
|
||||
#define FT3X67_MAX_WIDTH 390U /* Touchscreen pad max width */
|
||||
#define FT3X67_MAX_HEIGHT 390U /* Touchscreen pad max height */
|
||||
|
||||
/* Possible values of driver functions return status */
|
||||
#define FT3X67_STATUS_OK 0x00U
|
||||
#define FT3X67_STATUS_NOT_OK 0x01U
|
||||
|
||||
/* Possible values of global variable 'TS_I2C_Initialized' */
|
||||
#define FT3X67_I2C_NOT_INITIALIZED 0x00U
|
||||
#define FT3X67_I2C_INITIALIZED 0x01U
|
||||
|
||||
/* Max detectable simultaneous touches */
|
||||
#define FT3X67_MAX_DETECTABLE_TOUCH 0x02U
|
||||
|
||||
/* Definitions for FT3X67 registers */
|
||||
|
||||
/* Current mode register of the FT3X67 (R/W) */
|
||||
#define FT3X67_DEV_MODE_REG 0x00U
|
||||
/* Possible values of FT3X67_DEV_MODE_REG */
|
||||
#define FT3X67_DEV_MODE_WORKING 0x00U
|
||||
#define FT3X67_DEV_MODE_FACTORY 0x40U
|
||||
|
||||
/* Touch Data Status register : gives number of active touch points (0..2) */
|
||||
#define FT3X67_TD_STAT_REG 0x02U
|
||||
/* Values related to FT3X67_TD_STAT_REG */
|
||||
#define FT3X67_TD_STAT_MASK 0x0FU
|
||||
|
||||
/* Values Pn_XH and Pn_YH related */
|
||||
#define FT3X67_TOUCH_EVT_FLAG_PRESS_DOWN 0x00U
|
||||
#define FT3X67_TOUCH_EVT_FLAG_LIFT_UP 0x01U
|
||||
#define FT3X67_TOUCH_EVT_FLAG_CONTACT 0x02U
|
||||
#define FT3X67_TOUCH_EVT_FLAG_NO_EVENT 0x03U
|
||||
#define FT3X67_TOUCH_EVT_FLAG_SHIFT 0x06U
|
||||
#define FT3X67_TOUCH_EVT_FLAG_MASK (3U << FT3X67_TOUCH_EVT_FLAG_SHIFT)
|
||||
#define FT3X67_TOUCH_POS_MSB_MASK 0x0FU
|
||||
|
||||
/* Point 1 registers */
|
||||
#define FT3X67_P1_XH_REG 0x03U
|
||||
#define FT3X67_P1_XL_REG 0x04U
|
||||
#define FT3X67_P1_YH_REG 0x05U
|
||||
#define FT3X67_P1_YL_REG 0x06U
|
||||
#define FT3X67_P1_WEIGHT_REG 0x07U
|
||||
#define FT3X67_P1_MISC_REG 0x08U
|
||||
|
||||
/* Point 2 registers */
|
||||
#define FT3X67_P2_XH_REG 0x09U
|
||||
#define FT3X67_P2_XL_REG 0x0AU
|
||||
#define FT3X67_P2_YH_REG 0x0BU
|
||||
#define FT3X67_P2_YL_REG 0x0CU
|
||||
#define FT3X67_P2_WEIGHT_REG 0x0DU
|
||||
#define FT3X67_P2_MISC_REG 0x0EU
|
||||
|
||||
/* Values related to Pn_MISC register */
|
||||
#define FT3X67_TOUCH_AREA_MASK (0xFU << FT3X67_TOUCH_AREA_SHIFT)
|
||||
#define FT3X67_TOUCH_AREA_SHIFT 0x04U
|
||||
|
||||
/* Threshold for touch detection register */
|
||||
#define FT3X67_TH_GROUP_REG 0x80U
|
||||
|
||||
/* Filter function coefficients register */
|
||||
#define FT3X67_TH_DIFF_REG 0x85U
|
||||
|
||||
/* Control register */
|
||||
#define FT3X67_CTRL_REG 0x86U
|
||||
/* Values related to FT3X67_CTRL_REG */
|
||||
#define FT3X67_CTRL_KEEP_ACTIVE_MODE 0x00U
|
||||
#define FT3X67_CTRL_KEEP_AUTO_SWITCH_MONITOR_MODE 0x01U
|
||||
|
||||
/* The time period of switching from Active mode to Monitor mode when there is no touching */
|
||||
#define FT3X67_TIMEENTERMONITOR_REG 0x87U
|
||||
|
||||
/* Report rate in Active mode */
|
||||
#define FT3X67_PERIODACTIVE_REG 0x88U
|
||||
|
||||
/* Report rate in Monitor mode */
|
||||
#define FT3X67_PERIODMONITOR_REG 0x89U
|
||||
|
||||
/* High 8-bit of LIB Version info */
|
||||
#define FT3X67_LIB_VER_H_REG 0xA1U
|
||||
|
||||
/* Low 8-bit of LIB Version info */
|
||||
#define FT3X67_LIB_VER_L_REG 0xA2U
|
||||
|
||||
/* Chip Selecting */
|
||||
#define FT3X67_CIPHER_REG 0xA3U
|
||||
|
||||
/* Interrupt mode register (used when in interrupt mode) */
|
||||
#define FT3X67_GMODE_REG 0xA4U
|
||||
/* Possible values of FT3X67_GMODE_REG */
|
||||
#define FT3X67_G_MODE_INTERRUPT_POLLING 0x00U
|
||||
#define FT3X67_G_MODE_INTERRUPT_TRIGGER 0x01U
|
||||
|
||||
/* Current power mode */
|
||||
#define FT3X67_PWR_MODE_REG 0xA5U
|
||||
|
||||
/* Firmware version */
|
||||
#define FT3X67_FIRMID_REG 0xA6U
|
||||
|
||||
/* Chip identification register */
|
||||
#define FT3X67_CHIP_ID_REG 0xA8U
|
||||
/* Possible values of FT3X67_CHIP_ID_REG */
|
||||
#define FT3X67_ID_VALUE 0x11U
|
||||
|
||||
/* Release code version */
|
||||
#define FT3X67_RELEASE_CODE_ID_REG 0xAFU
|
||||
|
||||
/* Current operating mode register */
|
||||
#define FT3X67_STATE_REG 0xBCU
|
||||
/* Possible values of FT3X67_STATE_REG */
|
||||
#define FT3X67_STATE_INFO_MODE 0x00U
|
||||
#define FT3X67_STATE_NORMAL_MODE 0x01U
|
||||
#define FT3X67_STATE_FACTORY_MODE 0x03U
|
||||
#define FT3X67_STATE_AUTO_CALIB_MODE 0x04U
|
||||
|
||||
/* Gesture enable register */
|
||||
#define FT3X67_GESTURE_ENABLE_REG 0xD0U
|
||||
/* Possible values of FT3X67_GESTURE_ENABLE_REG */
|
||||
#define FT3X67_GESTURE_DISABLE 0x00U
|
||||
#define FT3X67_GESTURE_ENABLE 0x01U
|
||||
|
||||
/* Gesture flag register */
|
||||
#define FT3X67_GESTURE_FLAG_REG 0xD1U
|
||||
/* Possible values of FT3X67_GESTURE_FLAG_REG can be any combination of following values */
|
||||
#define FT3X67_GEST_LINE_RIGHT_TO_LEFT_ENABLE 0x01U
|
||||
#define FT3X67_GEST_LINE_LEFT_TO_RIGHT_ENABLE 0x02U
|
||||
#define FT3X67_GEST_LINE_DOWN_TO_UP_ENABLE 0x04U
|
||||
#define FT3X67_GEST_LINE_UP_TO_DOWN_ENABLE 0x08U
|
||||
#define FT3X67_GEST_DOUBLE_TAP_ENABLE 0x10U
|
||||
#define FT3X67_GEST_ALL_FLAGS_ENABLE 0x1FU
|
||||
#define FT3X67_GEST_ALL_FLAGS_DISABLE 0x00U
|
||||
|
||||
/* Gesture ID register */
|
||||
#define FT3X67_GEST_ID_REG 0xD3U
|
||||
/* Possible values of FT3X67_GEST_ID_REG */
|
||||
#define FT3X67_GEST_ID_NO_GESTURE 0x00U
|
||||
#define FT3X67_GEST_ID_MOVE_UP 0x22U
|
||||
#define FT3X67_GEST_ID_MOVE_RIGHT 0x21U
|
||||
#define FT3X67_GEST_ID_MOVE_DOWN 0x23U
|
||||
#define FT3X67_GEST_ID_MOVE_LEFT 0x20U
|
||||
#define FT3X67_GEST_ID_DOUBLE_CLICK 0x24U
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
void ft3x67_Init(uint16_t DeviceAddr);
|
||||
void ft3x67_Reset(uint16_t DeviceAddr);
|
||||
uint16_t ft3x67_ReadID(uint16_t DeviceAddr);
|
||||
void ft3x67_TS_Start(uint16_t DeviceAddr);
|
||||
uint8_t ft3x67_TS_DetectTouch(uint16_t DeviceAddr);
|
||||
void ft3x67_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
|
||||
void ft3x67_TS_EnableIT(uint16_t DeviceAddr);
|
||||
void ft3x67_TS_DisableIT(uint16_t DeviceAddr);
|
||||
uint8_t ft3x67_TS_ITStatus (uint16_t DeviceAddr);
|
||||
void ft3x67_TS_ClearIT (uint16_t DeviceAddr);
|
||||
void ft3x67_TS_GestureConfig(uint16_t DeviceAddr, uint32_t Activation);
|
||||
void ft3x67_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId);
|
||||
void ft3x67_TS_GetTouchInfo(uint16_t DeviceAddr,
|
||||
uint32_t touchIdx,
|
||||
uint32_t * pWeight,
|
||||
uint32_t * pArea,
|
||||
uint32_t * pEvent);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Imported TS IO functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Imported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* TouchScreen (TS) external IO functions */
|
||||
extern void TS_IO_Init(void);
|
||||
extern void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
|
||||
extern uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg);
|
||||
extern uint16_t TS_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
extern void TS_IO_Delay(uint32_t Delay);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Imported global variables --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT3X67_Imported_Globals
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Touch screen driver structure */
|
||||
extern TS_DrvTypeDef ft3x67_ts_drv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __FT3X67_H */
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,493 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ft6x06.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the FT6X06
|
||||
* IO Expander devices.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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 "ft6x06.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FT6XX6
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT6XX6_Private_Defines FT6XX6 Private Defines
|
||||
* @{
|
||||
*/
|
||||
#define FT6x06_MAX_INSTANCE 2
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT6XX6_Private_Variables FT6XX6 Private Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Touch screen driver structure initialization */
|
||||
TS_DrvTypeDef ft6x06_ts_drv =
|
||||
{
|
||||
ft6x06_Init,
|
||||
ft6x06_ReadID,
|
||||
ft6x06_Reset,
|
||||
|
||||
ft6x06_TS_Start,
|
||||
ft6x06_TS_DetectTouch,
|
||||
ft6x06_TS_GetXY,
|
||||
|
||||
ft6x06_TS_EnableIT,
|
||||
ft6x06_TS_ClearIT,
|
||||
ft6x06_TS_ITStatus,
|
||||
ft6x06_TS_DisableIT
|
||||
};
|
||||
|
||||
/* ft6xx6 instances by address */
|
||||
uint8_t ft6x06[FT6x06_MAX_INSTANCE] = {0};
|
||||
|
||||
/* Global ft6xx6 handle */
|
||||
static ft6x06_handle_TypeDef ft6x06_handle = { FT6206_I2C_NOT_INITIALIZED, 0, 0};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ft6xx6_Private_Function_Prototypes ft6xx6 Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
static uint8_t ft6x06_GetInstance(uint16_t DeviceAddr);
|
||||
/* Private functions prototypes-----------------------------------------------*/
|
||||
#if (TS_AUTO_CALIBRATION_SUPPORTED == 1)
|
||||
/**
|
||||
* @brief Start TouchScreen calibration phase
|
||||
* @param DeviceAddr: FT6xx6 Device address for communication on I2C Bus.
|
||||
* @retval Status FT6206_STATUS_OK or FT6206_STATUS_NOT_OK.
|
||||
*/
|
||||
static uint32_t ft6x06_TS_Calibration(uint16_t DeviceAddr);
|
||||
#endif /* TS_AUTO_CALIBRATION_SUPPORTED == 1 */
|
||||
|
||||
/**
|
||||
* @brief Basic static configuration of TouchScreen
|
||||
* @param DeviceAddr: FT6xx6 Device address for communication on I2C Bus.
|
||||
* @retval Status FT6206_STATUS_OK or FT6206_STATUS_NOT_OK.
|
||||
*/
|
||||
static uint32_t ft6x06_TS_Configure(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ft6xx6_Private_Functions ft6xx6 Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize the ft6xx6 communication bus
|
||||
* from MCU to FT6xx6 : ie I2C channel initialization (if required).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_Init(uint16_t DeviceAddr)
|
||||
{
|
||||
uint8_t instance;
|
||||
uint8_t empty;
|
||||
|
||||
/* Check if device instance already exists */
|
||||
instance = ft6x06_GetInstance(DeviceAddr);
|
||||
|
||||
/* To prevent double initialization */
|
||||
if(instance == 0xFF)
|
||||
{
|
||||
/* Look for empty instance */
|
||||
empty = ft6x06_GetInstance(0);
|
||||
|
||||
if(empty < FT6x06_MAX_INSTANCE)
|
||||
{
|
||||
/* Register the current device instance */
|
||||
ft6x06[empty] = DeviceAddr;
|
||||
|
||||
/* Initialize IO BUS layer */
|
||||
TS_IO_Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Software Reset the ft6xx6.
|
||||
* @note : Not applicable to FT6xx6.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_Reset(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Do nothing */
|
||||
/* No software reset sequence available in FT6xx6 IC */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the ft6xx6 device ID, pre initialize I2C in case of need to be
|
||||
* able to read the FT6xx6 device ID, and verify this is a FT6xx6.
|
||||
* @param DeviceAddr: I2C FT6xx6 Slave address.
|
||||
* @retval The Device ID (two bytes).
|
||||
*/
|
||||
uint16_t ft6x06_ReadID(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Initialize I2C link if needed */
|
||||
TS_IO_Init();
|
||||
|
||||
/* Return the device ID value */
|
||||
return (TS_IO_Read(DeviceAddr, FT6206_CHIP_ID_REG));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the touch Screen IC device to start detecting touches
|
||||
* It goes through an internal calibration process (Hw calibration sequence of
|
||||
* the touch screen).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address).
|
||||
* @retval None.
|
||||
*/
|
||||
void ft6x06_TS_Start(uint16_t DeviceAddr)
|
||||
{
|
||||
#if (TS_AUTO_CALIBRATION_SUPPORTED == 1)
|
||||
/* Hw Calibration sequence start : should be done once after each power up */
|
||||
/* This is called internal calibration of the touch screen */
|
||||
ft6x06_TS_Calibration(DeviceAddr);
|
||||
#endif
|
||||
/* Minimum static configuration of FT6xx6 */
|
||||
ft6x06_TS_Configure(DeviceAddr);
|
||||
|
||||
/* By default set FT6xx6 IC in Polling mode : no INT generation on FT6xx6 for new touch available */
|
||||
/* Note TS_INT is active low */
|
||||
ft6x06_TS_DisableIT(DeviceAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return if there is touches detected or not.
|
||||
* Try to detect new touches and forget the old ones (reset internal global
|
||||
* variables).
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval : Number of active touches detected (can be 0, 1 or 2).
|
||||
*/
|
||||
uint8_t ft6x06_TS_DetectTouch(uint16_t DeviceAddr)
|
||||
{
|
||||
volatile uint8_t nbTouch = 0;
|
||||
|
||||
/* Read register FT6206_TD_STAT_REG to check number of touches detection */
|
||||
nbTouch = TS_IO_Read(DeviceAddr, FT6206_TD_STAT_REG);
|
||||
nbTouch &= FT6206_TD_STAT_MASK;
|
||||
|
||||
if(nbTouch > FT6206_MAX_DETECTABLE_TOUCH)
|
||||
{
|
||||
/* If invalid number of touch detected, set it to zero */
|
||||
nbTouch = 0;
|
||||
}
|
||||
|
||||
/* Update ft6xx6 driver internal global : current number of active touches */
|
||||
ft6x06_handle.currActiveTouchNb = nbTouch;
|
||||
|
||||
/* Reset current active touch index on which to work on */
|
||||
ft6x06_handle.currActiveTouchIdx = 0;
|
||||
|
||||
return(nbTouch);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the touch screen X and Y positions values
|
||||
* Manage multi touch thanks to touch Index global
|
||||
* variable 'ft6x06_handle.currActiveTouchIdx'.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param X: Pointer to X position value
|
||||
* @param Y: Pointer to Y position value
|
||||
* @retval None.
|
||||
*/
|
||||
void ft6x06_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
|
||||
{
|
||||
uint8_t regAddress = 0;
|
||||
uint8_t dataxy[4];
|
||||
|
||||
if(ft6x06_handle.currActiveTouchIdx < ft6x06_handle.currActiveTouchNb)
|
||||
{
|
||||
switch(ft6x06_handle.currActiveTouchIdx)
|
||||
{
|
||||
case 0 :
|
||||
regAddress = FT6206_P1_XH_REG;
|
||||
break;
|
||||
case 1 :
|
||||
regAddress = FT6206_P2_XH_REG;
|
||||
break;
|
||||
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
/* Read X and Y positions */
|
||||
TS_IO_ReadMultiple(DeviceAddr, regAddress, dataxy, sizeof(dataxy));
|
||||
|
||||
/* Send back ready X position to caller */
|
||||
*X = ((dataxy[0] & FT6206_MSB_MASK) << 8) | (dataxy[1] & FT6206_LSB_MASK);
|
||||
|
||||
/* Send back ready Y position to caller */
|
||||
*Y = ((dataxy[2] & FT6206_MSB_MASK) << 8) | (dataxy[3] & FT6206_LSB_MASK);
|
||||
|
||||
ft6x06_handle.currActiveTouchIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the FT6xx6 device to generate IT on given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT6xx6).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_TS_EnableIT(uint16_t DeviceAddr)
|
||||
{
|
||||
uint8_t regValue = 0;
|
||||
regValue = (FT6206_G_MODE_INTERRUPT_TRIGGER & (FT6206_G_MODE_INTERRUPT_MASK >> FT6206_G_MODE_INTERRUPT_SHIFT)) << FT6206_G_MODE_INTERRUPT_SHIFT;
|
||||
|
||||
/* Set interrupt trigger mode in FT6206_GMODE_REG */
|
||||
TS_IO_Write(DeviceAddr, FT6206_GMODE_REG, regValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the FT6xx6 device to stop generating IT on the given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT6xx6).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_TS_DisableIT(uint16_t DeviceAddr)
|
||||
{
|
||||
uint8_t regValue = 0;
|
||||
regValue = (FT6206_G_MODE_INTERRUPT_POLLING & (FT6206_G_MODE_INTERRUPT_MASK >> FT6206_G_MODE_INTERRUPT_SHIFT)) << FT6206_G_MODE_INTERRUPT_SHIFT;
|
||||
|
||||
/* Set interrupt polling mode in FT6206_GMODE_REG */
|
||||
TS_IO_Write(DeviceAddr, FT6206_GMODE_REG, regValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get IT status from FT6xx6 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 FT6xx6.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @retval TS interrupts status : always return 0 here
|
||||
*/
|
||||
uint8_t ft6x06_TS_ITStatus(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Always return 0 as feature not applicable to FT6xx6 */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear IT status in FT6xx6 interrupt status clear registers
|
||||
* Should be called Following an EXTI coming to the MCU.
|
||||
* @note : This feature is not applicable to FT6xx6.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_TS_ClearIT(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Nothing to be done here for FT6xx6 */
|
||||
}
|
||||
|
||||
/**** NEW FEATURES enabled when Multi-touch support is enabled ****/
|
||||
|
||||
#if (TS_MULTI_TOUCH_SUPPORTED == 1)
|
||||
/**
|
||||
* @brief Get the last touch gesture identification (zoom, move up/down...).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @param pGestureId : Pointer to get last touch gesture Identification.
|
||||
* @retval None.
|
||||
*/
|
||||
void ft6x06_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId)
|
||||
{
|
||||
volatile uint8_t ucReadData = 0;
|
||||
|
||||
ucReadData = TS_IO_Read(DeviceAddr, FT6206_GEST_ID_REG);
|
||||
|
||||
* pGestureId = ucReadData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the touch detailed informations on touch number 'touchIdx' (0..1)
|
||||
* This touch detailed information contains :
|
||||
* - weight that was applied to this touch
|
||||
* - sub-area of the touch in the touch panel
|
||||
* - event of linked to the touch (press down, lift up, ...)
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @param touchIdx : Passed index of the touch (0..1) on which we want to get the
|
||||
* detailed information.
|
||||
* @param pWeight : Pointer to to get the weight information of 'touchIdx'.
|
||||
* @param pArea : Pointer to to get the sub-area information of 'touchIdx'.
|
||||
* @param pEvent : Pointer to to get the event information of 'touchIdx'.
|
||||
|
||||
* @retval None.
|
||||
*/
|
||||
void ft6x06_TS_GetTouchInfo(uint16_t DeviceAddr,
|
||||
uint32_t touchIdx,
|
||||
uint32_t * pWeight,
|
||||
uint32_t * pArea,
|
||||
uint32_t * pEvent)
|
||||
{
|
||||
uint8_t regAddress = 0;
|
||||
uint8_t dataxy[3];
|
||||
|
||||
if(touchIdx < ft6x06_handle.currActiveTouchNb)
|
||||
{
|
||||
switch(touchIdx)
|
||||
{
|
||||
case 0 :
|
||||
regAddress = FT6206_P1_WEIGHT_REG;
|
||||
break;
|
||||
|
||||
case 1 :
|
||||
regAddress = FT6206_P2_WEIGHT_REG;
|
||||
break;
|
||||
|
||||
default :
|
||||
break;
|
||||
|
||||
} /* end switch(touchIdx) */
|
||||
|
||||
/* Read weight, area and Event Id of touch index */
|
||||
TS_IO_ReadMultiple(DeviceAddr, regAddress, dataxy, sizeof(dataxy));
|
||||
|
||||
/* Return weight of touch index */
|
||||
* pWeight = (dataxy[0] & FT6206_TOUCH_WEIGHT_MASK) >> FT6206_TOUCH_WEIGHT_SHIFT;
|
||||
/* Return area of touch index */
|
||||
* pArea = (dataxy[1] & FT6206_TOUCH_AREA_MASK) >> FT6206_TOUCH_AREA_SHIFT;
|
||||
/* Return Event Id of touch index */
|
||||
* pEvent = (dataxy[2] & FT6206_TOUCH_EVT_FLAG_MASK) >> FT6206_TOUCH_EVT_FLAG_SHIFT;
|
||||
|
||||
} /* of if(touchIdx < ft6x06_handle.currActiveTouchNb) */
|
||||
}
|
||||
|
||||
#endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */
|
||||
|
||||
#if (TS_AUTO_CALIBRATION_SUPPORTED == 1)
|
||||
/**
|
||||
* @brief Start TouchScreen calibration phase
|
||||
* @param DeviceAddr: FT6xx6 Device address for communication on I2C Bus.
|
||||
* @retval Status FT6206_STATUS_OK or FT6206_STATUS_NOT_OK.
|
||||
*/
|
||||
static uint32_t ft6x06_TS_Calibration(uint16_t DeviceAddr)
|
||||
{
|
||||
uint32_t nbAttempt = 0;
|
||||
volatile uint8_t ucReadData;
|
||||
volatile uint8_t regValue;
|
||||
uint32_t status = FT6206_STATUS_OK;
|
||||
uint8_t bEndCalibration = 0;
|
||||
|
||||
/* >> Calibration sequence start */
|
||||
|
||||
/* Switch FT6xx6 back to factory mode to calibrate */
|
||||
regValue = (FT6206_DEV_MODE_FACTORY & FT6206_DEV_MODE_MASK) << FT6206_DEV_MODE_SHIFT;
|
||||
TS_IO_Write(DeviceAddr, FT6206_DEV_MODE_REG, regValue); /* 0x40 */
|
||||
|
||||
/* Read back the same register FT6206_DEV_MODE_REG */
|
||||
ucReadData = TS_IO_Read(DeviceAddr, FT6206_DEV_MODE_REG);
|
||||
TS_IO_Delay(300); /* Wait 300 ms */
|
||||
|
||||
if(((ucReadData & (FT6206_DEV_MODE_MASK << FT6206_DEV_MODE_SHIFT)) >> FT6206_DEV_MODE_SHIFT) != FT6206_DEV_MODE_FACTORY )
|
||||
{
|
||||
/* Return error to caller */
|
||||
return(FT6206_STATUS_NOT_OK);
|
||||
}
|
||||
|
||||
/* Start calibration command */
|
||||
TS_IO_Write(DeviceAddr, FT6206_TD_STAT_REG, 0x04);
|
||||
TS_IO_Delay(300); /* Wait 300 ms */
|
||||
|
||||
/* 100 attempts to wait switch from factory mode (calibration) to working mode */
|
||||
for (nbAttempt=0; ((nbAttempt < 100) && (!bEndCalibration)) ; nbAttempt++)
|
||||
{
|
||||
ucReadData = TS_IO_Read(DeviceAddr, FT6206_DEV_MODE_REG);
|
||||
ucReadData = (ucReadData & (FT6206_DEV_MODE_MASK << FT6206_DEV_MODE_SHIFT)) >> FT6206_DEV_MODE_SHIFT;
|
||||
if(ucReadData == FT6206_DEV_MODE_WORKING)
|
||||
{
|
||||
/* Auto Switch to FT6206_DEV_MODE_WORKING : means calibration have ended */
|
||||
bEndCalibration = 1; /* exit for loop */
|
||||
}
|
||||
|
||||
TS_IO_Delay(200); /* Wait 200 ms */
|
||||
}
|
||||
|
||||
/* Calibration sequence end << */
|
||||
|
||||
return(status);
|
||||
}
|
||||
#endif /* TS_AUTO_CALIBRATION_SUPPORTED == 1 */
|
||||
|
||||
/**
|
||||
* @brief Basic static configuration of TouchScreen
|
||||
* @param DeviceAddr: FT6xx6 Device address for communication on I2C Bus.
|
||||
* @retval Status FT6206_STATUS_OK or FT6206_STATUS_NOT_OK.
|
||||
*/
|
||||
static uint32_t ft6x06_TS_Configure(uint16_t DeviceAddr)
|
||||
{
|
||||
uint32_t status = FT6206_STATUS_OK;
|
||||
|
||||
/* Nothing special to be done for FT6xx6 */
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the device instance of the selected address is already registered
|
||||
* and return its index
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval Index of the device instance if registered, 0xFF if not.
|
||||
*/
|
||||
static uint8_t ft6x06_GetInstance(uint16_t DeviceAddr)
|
||||
{
|
||||
uint8_t idx = 0;
|
||||
|
||||
/* Check all the registered instances */
|
||||
for(idx = 0; idx < FT6x06_MAX_INSTANCE ; idx ++)
|
||||
{
|
||||
if(ft6x06[idx] == DeviceAddr)
|
||||
{
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,452 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ft6x06.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* ft6x06.c IO expander driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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 __FT6XX6_H
|
||||
#define __FT6XX6_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Set Multi-touch as non supported */
|
||||
#ifndef TS_MULTI_TOUCH_SUPPORTED
|
||||
#define TS_MULTI_TOUCH_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
/* Set Auto-calibration as non supported */
|
||||
#ifndef TS_AUTO_CALIBRATION_SUPPORTED
|
||||
#define TS_AUTO_CALIBRATION_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/ts.h"
|
||||
|
||||
/* Macros --------------------------------------------------------------------*/
|
||||
|
||||
/** @typedef ft6x06_handle_TypeDef
|
||||
* ft6x06 Handle definition.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t i2cInitialized;
|
||||
|
||||
/* field holding the current number of simultaneous active touches */
|
||||
uint8_t currActiveTouchNb;
|
||||
|
||||
/* field holding the touch index currently managed */
|
||||
uint8_t currActiveTouchIdx;
|
||||
|
||||
} ft6x06_handle_TypeDef;
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FT6XX6
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT6XX6_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT6XX6_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Maximum border values of the touchscreen pad */
|
||||
#define FT_6206_MAX_WIDTH ((uint16_t)800) /* Touchscreen pad max width */
|
||||
#define FT_6206_MAX_HEIGHT ((uint16_t)480) /* Touchscreen pad max height */
|
||||
|
||||
/* Touchscreen pad max width and height values for FT6xx6 Touch*/
|
||||
#define FT_6206_MAX_WIDTH_HEIGHT ((uint16_t)240)
|
||||
|
||||
/* Possible values of driver functions return status */
|
||||
#define FT6206_STATUS_OK 0
|
||||
#define FT6206_STATUS_NOT_OK 1
|
||||
|
||||
/* Possible values of global variable 'TS_I2C_Initialized' */
|
||||
#define FT6206_I2C_NOT_INITIALIZED 0
|
||||
#define FT6206_I2C_INITIALIZED 1
|
||||
|
||||
/* Max detectable simultaneous touches */
|
||||
#define FT6206_MAX_DETECTABLE_TOUCH 2
|
||||
|
||||
/**
|
||||
* @brief : Definitions for FT6xx6 I2C register addresses on 8 bit
|
||||
**/
|
||||
|
||||
/* Current mode register of the FT6xx6 (R/W) */
|
||||
#define FT6206_DEV_MODE_REG 0x00
|
||||
|
||||
/* Possible values of FT6206_DEV_MODE_REG */
|
||||
#define FT6206_DEV_MODE_WORKING 0x00
|
||||
#define FT6206_DEV_MODE_FACTORY 0x04
|
||||
|
||||
#define FT6206_DEV_MODE_MASK 0x7
|
||||
#define FT6206_DEV_MODE_SHIFT 4
|
||||
|
||||
/* Gesture ID register */
|
||||
#define FT6206_GEST_ID_REG 0x01
|
||||
|
||||
/* Possible values of FT6206_GEST_ID_REG */
|
||||
#define FT6206_GEST_ID_NO_GESTURE 0x00
|
||||
#define FT6206_GEST_ID_MOVE_UP 0x10
|
||||
#define FT6206_GEST_ID_MOVE_RIGHT 0x14
|
||||
#define FT6206_GEST_ID_MOVE_DOWN 0x18
|
||||
#define FT6206_GEST_ID_MOVE_LEFT 0x1C
|
||||
#define FT6206_GEST_ID_ZOOM_IN 0x48
|
||||
#define FT6206_GEST_ID_ZOOM_OUT 0x49
|
||||
|
||||
/* Touch Data Status register : gives number of active touch points (0..2) */
|
||||
#define FT6206_TD_STAT_REG 0x02
|
||||
|
||||
/* Values related to FT6206_TD_STAT_REG */
|
||||
#define FT6206_TD_STAT_MASK 0x0F
|
||||
#define FT6206_TD_STAT_SHIFT 0x00
|
||||
|
||||
/* Values Pn_XH and Pn_YH related */
|
||||
#define FT6206_TOUCH_EVT_FLAG_PRESS_DOWN 0x00
|
||||
#define FT6206_TOUCH_EVT_FLAG_LIFT_UP 0x01
|
||||
#define FT6206_TOUCH_EVT_FLAG_CONTACT 0x02
|
||||
#define FT6206_TOUCH_EVT_FLAG_NO_EVENT 0x03
|
||||
|
||||
#define FT6206_TOUCH_EVT_FLAG_SHIFT 6
|
||||
#define FT6206_TOUCH_EVT_FLAG_MASK (3 << FT6206_TOUCH_EVT_FLAG_SHIFT)
|
||||
|
||||
#define FT6206_MSB_MASK 0x0F
|
||||
#define FT6206_MSB_SHIFT 0
|
||||
|
||||
/* Values Pn_XL and Pn_YL related */
|
||||
#define FT6206_LSB_MASK 0xFF
|
||||
#define FT6206_LSB_SHIFT 0
|
||||
|
||||
#define FT6206_P1_XH_REG 0x03
|
||||
#define FT6206_P1_XL_REG 0x04
|
||||
#define FT6206_P1_YH_REG 0x05
|
||||
#define FT6206_P1_YL_REG 0x06
|
||||
|
||||
/* Touch Pressure register value (R) */
|
||||
#define FT6206_P1_WEIGHT_REG 0x07
|
||||
|
||||
/* Values Pn_WEIGHT related */
|
||||
#define FT6206_TOUCH_WEIGHT_MASK 0xFF
|
||||
#define FT6206_TOUCH_WEIGHT_SHIFT 0
|
||||
|
||||
/* Touch area register */
|
||||
#define FT6206_P1_MISC_REG 0x08
|
||||
|
||||
/* Values related to FT6206_Pn_MISC_REG */
|
||||
#define FT6206_TOUCH_AREA_MASK (0x04 << 4)
|
||||
#define FT6206_TOUCH_AREA_SHIFT 0x04
|
||||
|
||||
#define FT6206_P2_XH_REG 0x09
|
||||
#define FT6206_P2_XL_REG 0x0A
|
||||
#define FT6206_P2_YH_REG 0x0B
|
||||
#define FT6206_P2_YL_REG 0x0C
|
||||
#define FT6206_P2_WEIGHT_REG 0x0D
|
||||
#define FT6206_P2_MISC_REG 0x0E
|
||||
|
||||
/* Threshold for touch detection */
|
||||
#define FT6206_TH_GROUP_REG 0x80
|
||||
|
||||
/* Values FT6206_TH_GROUP_REG : threshold related */
|
||||
#define FT6206_THRESHOLD_MASK 0xFF
|
||||
#define FT6206_THRESHOLD_SHIFT 0
|
||||
|
||||
/* Filter function coefficients */
|
||||
#define FT6206_TH_DIFF_REG 0x85
|
||||
|
||||
/* Control register */
|
||||
#define FT6206_CTRL_REG 0x86
|
||||
|
||||
/* Values related to FT6206_CTRL_REG */
|
||||
|
||||
/* Will keep the Active mode when there is no touching */
|
||||
#define FT6206_CTRL_KEEP_ACTIVE_MODE 0x00
|
||||
|
||||
/* Switching from Active mode to Monitor mode automatically when there is no touching */
|
||||
#define FT6206_CTRL_KEEP_AUTO_SWITCH_MONITOR_MODE 0x01
|
||||
|
||||
/* The time period of switching from Active mode to Monitor mode when there is no touching */
|
||||
#define FT6206_TIMEENTERMONITOR_REG 0x87
|
||||
|
||||
/* Report rate in Active mode */
|
||||
#define FT6206_PERIODACTIVE_REG 0x88
|
||||
|
||||
/* Report rate in Monitor mode */
|
||||
#define FT6206_PERIODMONITOR_REG 0x89
|
||||
|
||||
/* The value of the minimum allowed angle while Rotating gesture mode */
|
||||
#define FT6206_RADIAN_VALUE_REG 0x91
|
||||
|
||||
/* Maximum offset while Moving Left and Moving Right gesture */
|
||||
#define FT6206_OFFSET_LEFT_RIGHT_REG 0x92
|
||||
|
||||
/* Maximum offset while Moving Up and Moving Down gesture */
|
||||
#define FT6206_OFFSET_UP_DOWN_REG 0x93
|
||||
|
||||
/* Minimum distance while Moving Left and Moving Right gesture */
|
||||
#define FT6206_DISTANCE_LEFT_RIGHT_REG 0x94
|
||||
|
||||
/* Minimum distance while Moving Up and Moving Down gesture */
|
||||
#define FT6206_DISTANCE_UP_DOWN_REG 0x95
|
||||
|
||||
/* Maximum distance while Zoom In and Zoom Out gesture */
|
||||
#define FT6206_DISTANCE_ZOOM_REG 0x96
|
||||
|
||||
/* High 8-bit of LIB Version info */
|
||||
#define FT6206_LIB_VER_H_REG 0xA1
|
||||
|
||||
/* Low 8-bit of LIB Version info */
|
||||
#define FT6206_LIB_VER_L_REG 0xA2
|
||||
|
||||
/* Chip Selecting */
|
||||
#define FT6206_CIPHER_REG 0xA3
|
||||
|
||||
/* Interrupt mode register (used when in interrupt mode) */
|
||||
#define FT6206_GMODE_REG 0xA4
|
||||
|
||||
#define FT6206_G_MODE_INTERRUPT_MASK 0x03
|
||||
#define FT6206_G_MODE_INTERRUPT_SHIFT 0x00
|
||||
|
||||
/* Possible values of FT6206_GMODE_REG */
|
||||
#define FT6206_G_MODE_INTERRUPT_POLLING 0x00
|
||||
#define FT6206_G_MODE_INTERRUPT_TRIGGER 0x01
|
||||
|
||||
/* Current power mode the FT6xx6 system is in (R) */
|
||||
#define FT6206_PWR_MODE_REG 0xA5
|
||||
|
||||
/* FT6xx6 firmware version */
|
||||
#define FT6206_FIRMID_REG 0xA6
|
||||
|
||||
/* FT6xx6 Chip identification register */
|
||||
#define FT6206_CHIP_ID_REG 0xA8
|
||||
|
||||
/* Possible values of touchscreen controller ID */
|
||||
#define FT6206_ID_VALUE 0x11
|
||||
#define FT6x36_ID_VALUE 0xCD
|
||||
#define FT6X36_ID2_VALUE 0xD8
|
||||
|
||||
/* Release code version */
|
||||
#define FT6206_RELEASE_CODE_ID_REG 0xAF
|
||||
|
||||
/* Current operating mode the FT6xx6 system is in (R) */
|
||||
#define FT6206_STATE_REG 0xBC
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup ft6xx6_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup ft6xx6_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief ft6xx6 Control functions
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize the ft6xx6 communication bus
|
||||
* from MCU to FT6xx6 : ie I2C channel initialization (if required).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_Init(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Software Reset the ft6xx6.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_Reset(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Read the ft6xx6 device ID, pre intitalize I2C in case of need to be
|
||||
* able to read the FT6xx6 device ID, and verify this is a FT6xx6.
|
||||
* @param DeviceAddr: I2C FT6xx6 Slave address.
|
||||
* @retval The Device ID (two bytes).
|
||||
*/
|
||||
uint16_t ft6x06_ReadID(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Configures the touch Screen IC device to start detecting touches
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address).
|
||||
* @retval None.
|
||||
*/
|
||||
void ft6x06_TS_Start(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Return if there is touches detected or not.
|
||||
* Try to detect new touches and forget the old ones (reset internal global
|
||||
* variables).
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval : Number of active touches detected (can be 0, 1 or 2).
|
||||
*/
|
||||
uint8_t ft6x06_TS_DetectTouch(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Get the touch screen X and Y positions values
|
||||
* Manage multi touch thanks to touch Index global
|
||||
* variable 'ft6x06_handle.currActiveTouchIdx'.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param X: Pointer to X position value
|
||||
* @param Y: Pointer to Y position value
|
||||
* @retval None.
|
||||
*/
|
||||
void ft6x06_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
|
||||
|
||||
/**
|
||||
* @brief Configure the FT6xx6 device to generate IT on given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT6xx6).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_TS_EnableIT(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Configure the FT6xx6 device to stop generating IT on the given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT6xx6).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_TS_DisableIT(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Get IT status from FT6xx6 interrupt status registers
|
||||
* Should be called Following an EXTI coming to the MCU to know the detailed
|
||||
* reason of the interrupt.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @retval TS interrupts status
|
||||
*/
|
||||
uint8_t ft6x06_TS_ITStatus (uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Clear IT status in FT6xx6 interrupt status clear registers
|
||||
* Should be called Following an EXTI coming to the MCU.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @retval TS interrupts status
|
||||
*/
|
||||
void ft6x06_TS_ClearIT (uint16_t DeviceAddr);
|
||||
|
||||
/**** NEW FEATURES enabled when Multi-touch support is enabled ****/
|
||||
|
||||
#if (TS_MULTI_TOUCH_SUPPORTED == 1)
|
||||
|
||||
/**
|
||||
* @brief Get the last touch gesture identification (zoom, move up/down...).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @param pGestureId : Pointer to get last touch gesture Identification.
|
||||
* @retval None.
|
||||
*/
|
||||
void ft6x06_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId);
|
||||
|
||||
/**
|
||||
* @brief Get the touch detailed informations on touch number 'touchIdx' (0..1)
|
||||
* This touch detailed information contains :
|
||||
* - weight that was applied to this touch
|
||||
* - sub-area of the touch in the touch panel
|
||||
* - event of linked to the touch (press down, lift up, ...)
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6xx6).
|
||||
* @param touchIdx : Passed index of the touch (0..1) on which we want to get the
|
||||
* detailed information.
|
||||
* @param pWeight : Pointer to to get the weight information of 'touchIdx'.
|
||||
* @param pArea : Pointer to to get the sub-area information of 'touchIdx'.
|
||||
* @param pEvent : Pointer to to get the event information of 'touchIdx'.
|
||||
|
||||
* @retval None.
|
||||
*/
|
||||
void ft6x06_TS_GetTouchInfo(uint16_t DeviceAddr,
|
||||
uint32_t touchIdx,
|
||||
uint32_t * pWeight,
|
||||
uint32_t * pArea,
|
||||
uint32_t * pEvent);
|
||||
|
||||
#endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */
|
||||
|
||||
/* Imported TS IO functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup ft6xx6_Imported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* TouchScreen (TS) external IO functions */
|
||||
extern void TS_IO_Init(void);
|
||||
extern void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
|
||||
extern uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg);
|
||||
extern uint16_t TS_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
extern void TS_IO_Delay(uint32_t Delay);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Imported global variables --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup ft6xx6_Imported_Globals
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* Touch screen driver structure */
|
||||
extern TS_DrvTypeDef ft6x06_ts_drv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __FT6XX6_H */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: 'Bug report'
|
||||
about: 'Create a report to help us improve the quality of our software'
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Caution**
|
||||
|
||||
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
|
||||
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the **ST Community** in the STM32 MCUs dedicated [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
|
||||
**Describe the set-up**
|
||||
|
||||
* The board (either ST RPN reference or your custom board)
|
||||
* IDE or at least the compiler and its version
|
||||
|
||||
**Describe the bug (skip if none)**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce the bug (skip if none)**
|
||||
|
||||
1. Indicate the global behavior of your application project
|
||||
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
|
||||
3. Describe the use case that generates the problem
|
||||
4. How we can reproduce the problem
|
||||
|
||||
|
||||
**Additional context**
|
||||
|
||||
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
@@ -0,0 +1,3 @@
|
||||
## IMPORTANT INFORMATION
|
||||
|
||||
Pull-requests are **not** accepted on this repository. Please use issues to report any bug or request.
|
||||
@@ -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).
|
||||
@@ -0,0 +1,28 @@
|
||||
## Contributing guide
|
||||
|
||||
This document serves as a checklist before contributing to this repository.
|
||||
It includes links to read up on if topics are unclear to you.
|
||||
|
||||
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
|
||||
To report a bug or a request please file an issue in the right repository
|
||||
(example for [i3g4250d](https://github.com/STMicroelectronics/i3g4250d/issues/new/choose)).
|
||||
|
||||
Please check the following boxes 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, it should be submitted to the ST Community under the MCU topic [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
|
||||
### 2. Posting the issue
|
||||
When you have checked the previous boxes. You will find two templates (Bug Report or Other Issue) available in the **Issues** tab of the repository.
|
||||
|
||||
### 3. Pull Requests
|
||||
Pull-requests are **not** accepted on this repository. Please use **issues** to report any bug or request.
|
||||
|
||||
### 4. 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 for one new feature or proposal. This will ease the analysis and the final merge if accepted.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,40 @@
|
||||
# BSP I3G4250D Component
|
||||
|
||||
## Overview
|
||||
|
||||
**STM32Cube** is an STMicroelectronics original initiative to ease the 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 components 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 **i3g4250d** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **I3G4250D** BSP MEMS component part.
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2020 STMicroelectronics
|
||||
|
||||
This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this software except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
|
||||
|
||||
## Release note
|
||||
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/i3g4250d/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.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/i3g4250d/issues/new/choose).
|
||||
|
||||
For any other question related to the product, the tools, the environment, you can submit a topic to the [ST Community](https://community.st.com/s/).
|
||||
@@ -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 ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
@@ -0,0 +1,396 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file i3g4250d.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the I3G4250D,
|
||||
* ST MEMS motion sensor, 3-axis digital output gyroscope.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020 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 "i3g4250d.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup I3G4250D
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup I3G4250D_Private_TypesDefinitions Private Types Definitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I3G4250D_Private_Defines Private Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I3G4250D_Private_Macros Private Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I3G4250D_Private_Variables Private Variables
|
||||
* @{
|
||||
*/
|
||||
GYRO_DrvTypeDef I3g4250Drv =
|
||||
{
|
||||
I3G4250D_Init,
|
||||
I3G4250D_DeInit,
|
||||
I3G4250D_ReadID,
|
||||
I3G4250D_RebootCmd,
|
||||
I3G4250D_LowPower,
|
||||
I3G4250D_INT1InterruptConfig,
|
||||
I3G4250D_EnableIT,
|
||||
I3G4250D_DisableIT,
|
||||
0,
|
||||
0,
|
||||
I3G4250D_FilterConfig,
|
||||
I3G4250D_FilterCmd,
|
||||
I3G4250D_ReadXYZAngRate
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I3G4250D_Private_FunctionPrototypes Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I3G4250D_Private_Functions Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set I3G4250D Initialization.
|
||||
* @param I3G4250D_InitStruct: pointer to a I3G4250D_InitTypeDef structure
|
||||
* that contains the configuration setting for the I3G4250D.
|
||||
* @retval None
|
||||
*/
|
||||
void I3G4250D_Init(uint16_t InitStruct)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
|
||||
/* Configure the low level interface */
|
||||
GYRO_IO_Init();
|
||||
|
||||
/* Write value to MEMS CTRL_REG1 register */
|
||||
ctrl = (uint8_t) InitStruct;
|
||||
GYRO_IO_Write(&ctrl, I3G4250D_CTRL_REG1_ADDR, 1);
|
||||
|
||||
/* Write value to MEMS CTRL_REG4 register */
|
||||
ctrl = (uint8_t)(InitStruct >> 8);
|
||||
GYRO_IO_Write(&ctrl, I3G4250D_CTRL_REG4_ADDR, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief I3G4250D De-initialization
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void I3G4250D_DeInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read ID address of I3G4250D
|
||||
* @param None
|
||||
* @retval ID name
|
||||
*/
|
||||
uint8_t I3G4250D_ReadID(void)
|
||||
{
|
||||
uint8_t tmp;
|
||||
|
||||
/* Configure the low level interface */
|
||||
GYRO_IO_Init();
|
||||
|
||||
/* Read WHO I AM register */
|
||||
GYRO_IO_Read(&tmp, I3G4250D_WHO_AM_I_ADDR, 1);
|
||||
|
||||
/* Return the ID */
|
||||
return (uint8_t)tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reboot memory content of I3G4250D
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void I3G4250D_RebootCmd(void)
|
||||
{
|
||||
uint8_t tmpreg;
|
||||
|
||||
/* Read CTRL_REG5 register */
|
||||
GYRO_IO_Read(&tmpreg, I3G4250D_CTRL_REG5_ADDR, 1);
|
||||
|
||||
/* Enable or Disable the reboot memory */
|
||||
tmpreg |= I3G4250D_BOOT_REBOOTMEMORY;
|
||||
|
||||
/* Write value to MEMS CTRL_REG5 register */
|
||||
GYRO_IO_Write(&tmpreg, I3G4250D_CTRL_REG5_ADDR, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set I3G4250D in low-power mode
|
||||
* @param I3G4250D_InitStruct: pointer to a I3G4250D_InitTypeDef structure
|
||||
* that contains the configuration setting for the I3G4250D.
|
||||
* @retval None
|
||||
*/
|
||||
void I3G4250D_LowPower(uint16_t InitStruct)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
|
||||
/* Write value to MEMS CTRL_REG1 register */
|
||||
ctrl = (uint8_t) InitStruct;
|
||||
GYRO_IO_Write(&ctrl, I3G4250D_CTRL_REG1_ADDR, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set I3G4250D Interrupt INT1 configuration
|
||||
* @param Int1Config: the configuration setting for the I3G4250D Interrupt.
|
||||
* @retval None
|
||||
*/
|
||||
void I3G4250D_INT1InterruptConfig(uint16_t Int1Config)
|
||||
{
|
||||
uint8_t ctrl_cfr = 0x00, ctrl3 = 0x00;
|
||||
|
||||
/* Read INT1_CFG register */
|
||||
GYRO_IO_Read(&ctrl_cfr, I3G4250D_INT1_CFG_ADDR, 1);
|
||||
|
||||
/* Read CTRL_REG3 register */
|
||||
GYRO_IO_Read(&ctrl3, I3G4250D_CTRL_REG3_ADDR, 1);
|
||||
|
||||
ctrl_cfr &= 0x80;
|
||||
ctrl_cfr |= ((uint8_t) Int1Config >> 8);
|
||||
|
||||
ctrl3 &= 0xDF;
|
||||
ctrl3 |= ((uint8_t) Int1Config);
|
||||
|
||||
/* Write value to MEMS INT1_CFG register */
|
||||
GYRO_IO_Write(&ctrl_cfr, I3G4250D_INT1_CFG_ADDR, 1);
|
||||
|
||||
/* Write value to MEMS CTRL_REG3 register */
|
||||
GYRO_IO_Write(&ctrl3, I3G4250D_CTRL_REG3_ADDR, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable INT1 or INT2 interrupt
|
||||
* @param IntSel: choice of INT1 or INT2
|
||||
* This parameter can be:
|
||||
* @arg I3G4250D_INT1
|
||||
* @arg I3G4250D_INT2
|
||||
* @retval None
|
||||
*/
|
||||
void I3G4250D_EnableIT(uint8_t IntSel)
|
||||
{
|
||||
uint8_t tmpreg;
|
||||
|
||||
/* Read CTRL_REG3 register */
|
||||
GYRO_IO_Read(&tmpreg, I3G4250D_CTRL_REG3_ADDR, 1);
|
||||
|
||||
if (IntSel == I3G4250D_INT1)
|
||||
{
|
||||
tmpreg &= 0x7F;
|
||||
tmpreg |= I3G4250D_INT1INTERRUPT_ENABLE;
|
||||
}
|
||||
else if (IntSel == I3G4250D_INT2)
|
||||
{
|
||||
tmpreg &= 0xF7;
|
||||
tmpreg |= I3G4250D_INT2INTERRUPT_ENABLE;
|
||||
}
|
||||
|
||||
/* Write value to MEMS CTRL_REG3 register */
|
||||
GYRO_IO_Write(&tmpreg, I3G4250D_CTRL_REG3_ADDR, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable INT1 or INT2 interrupt
|
||||
* @param IntSel: choice of INT1 or INT2
|
||||
* This parameter can be:
|
||||
* @arg I3G4250D_INT1
|
||||
* @arg I3G4250D_INT2
|
||||
* @retval None
|
||||
*/
|
||||
void I3G4250D_DisableIT(uint8_t IntSel)
|
||||
{
|
||||
uint8_t tmpreg;
|
||||
|
||||
/* Read CTRL_REG3 register */
|
||||
GYRO_IO_Read(&tmpreg, I3G4250D_CTRL_REG3_ADDR, 1);
|
||||
|
||||
if (IntSel == I3G4250D_INT1)
|
||||
{
|
||||
tmpreg &= 0x7F;
|
||||
tmpreg |= I3G4250D_INT1INTERRUPT_DISABLE;
|
||||
}
|
||||
else if (IntSel == I3G4250D_INT2)
|
||||
{
|
||||
tmpreg &= 0xF7;
|
||||
tmpreg |= I3G4250D_INT2INTERRUPT_DISABLE;
|
||||
}
|
||||
|
||||
/* Write value to MEMS CTRL_REG3 register */
|
||||
GYRO_IO_Write(&tmpreg, I3G4250D_CTRL_REG3_ADDR, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set High Pass Filter Modality
|
||||
* @param FilterStruct: contains the configuration setting for the L3GD20.
|
||||
* @retval None
|
||||
*/
|
||||
void I3G4250D_FilterConfig(uint8_t FilterStruct)
|
||||
{
|
||||
uint8_t tmpreg;
|
||||
|
||||
/* Read CTRL_REG2 register */
|
||||
GYRO_IO_Read(&tmpreg, I3G4250D_CTRL_REG2_ADDR, 1);
|
||||
|
||||
tmpreg &= 0xC0;
|
||||
|
||||
/* Configure MEMS: mode and cutoff frequency */
|
||||
tmpreg |= FilterStruct;
|
||||
|
||||
/* Write value to MEMS CTRL_REG2 register */
|
||||
GYRO_IO_Write(&tmpreg, I3G4250D_CTRL_REG2_ADDR, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable or Disable High Pass Filter
|
||||
* @param HighPassFilterState: new state of the High Pass Filter feature.
|
||||
* This parameter can be:
|
||||
* @arg: I3G4250D_HIGHPASSFILTER_DISABLE
|
||||
* @arg: I3G4250D_HIGHPASSFILTER_ENABLE
|
||||
* @retval None
|
||||
*/
|
||||
void I3G4250D_FilterCmd(uint8_t HighPassFilterState)
|
||||
{
|
||||
uint8_t tmpreg;
|
||||
|
||||
/* Read CTRL_REG5 register */
|
||||
GYRO_IO_Read(&tmpreg, I3G4250D_CTRL_REG5_ADDR, 1);
|
||||
|
||||
tmpreg &= 0xEF;
|
||||
|
||||
tmpreg |= HighPassFilterState;
|
||||
|
||||
/* Write value to MEMS CTRL_REG5 register */
|
||||
GYRO_IO_Write(&tmpreg, I3G4250D_CTRL_REG5_ADDR, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get status for I3G4250D data
|
||||
* @param None
|
||||
* @retval Data status in a I3G4250D Data
|
||||
*/
|
||||
uint8_t I3G4250D_GetDataStatus(void)
|
||||
{
|
||||
uint8_t tmpreg;
|
||||
|
||||
/* Read STATUS_REG register */
|
||||
GYRO_IO_Read(&tmpreg, I3G4250D_STATUS_REG_ADDR, 1);
|
||||
|
||||
return tmpreg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Calculate the I3G4250D angular data.
|
||||
* @param pfData: Data out pointer
|
||||
* @retval None
|
||||
*/
|
||||
void I3G4250D_ReadXYZAngRate(float *pfData)
|
||||
{
|
||||
uint8_t tmpbuffer[6] = {0};
|
||||
int16_t RawData[3] = {0};
|
||||
uint8_t tmpreg = 0;
|
||||
float sensitivity = 0;
|
||||
int i = 0;
|
||||
|
||||
GYRO_IO_Read(&tmpreg, I3G4250D_CTRL_REG4_ADDR, 1);
|
||||
|
||||
GYRO_IO_Read(tmpbuffer, I3G4250D_OUT_X_L_ADDR, 6);
|
||||
|
||||
/* check in the control register 4 the data alignment (Big Endian or Little Endian)*/
|
||||
if (!(tmpreg & I3G4250D_BLE_MSB))
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
RawData[i] = (int16_t)(((uint16_t)tmpbuffer[2 * i + 1] << 8) + tmpbuffer[2 * i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
RawData[i] = (int16_t)(((uint16_t)tmpbuffer[2 * i] << 8) + tmpbuffer[2 * i + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Switch the sensitivity value set in the CRTL4 */
|
||||
switch (tmpreg & I3G4250D_FULLSCALE_SELECTION)
|
||||
{
|
||||
case I3G4250D_FULLSCALE_245:
|
||||
sensitivity = I3G4250D_SENSITIVITY_245DPS;
|
||||
break;
|
||||
|
||||
case I3G4250D_FULLSCALE_500:
|
||||
sensitivity = I3G4250D_SENSITIVITY_500DPS;
|
||||
break;
|
||||
|
||||
case I3G4250D_FULLSCALE_2000:
|
||||
sensitivity = I3G4250D_SENSITIVITY_2000DPS;
|
||||
break;
|
||||
}
|
||||
/* Multiplied by sensitivity */
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
pfData[i] = (float)(RawData[i] * sensitivity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,302 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file i3g4250d.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the i3g4250d.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020 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 __I3G4250D_H
|
||||
#define __I3G4250D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/gyro.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup I3G4250D
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup I3G4250D_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/******************************************************************************/
|
||||
/*************************** START REGISTER MAPPING **************************/
|
||||
/******************************************************************************/
|
||||
#define I3G4250D_WHO_AM_I_ADDR 0x0F /* device identification register */
|
||||
#define I3G4250D_CTRL_REG1_ADDR 0x20 /* Control register 1 */
|
||||
#define I3G4250D_CTRL_REG2_ADDR 0x21 /* Control register 2 */
|
||||
#define I3G4250D_CTRL_REG3_ADDR 0x22 /* Control register 3 */
|
||||
#define I3G4250D_CTRL_REG4_ADDR 0x23 /* Control register 4 */
|
||||
#define I3G4250D_CTRL_REG5_ADDR 0x24 /* Control register 5 */
|
||||
#define I3G4250D_REFERENCE_REG_ADDR 0x25 /* Reference register */
|
||||
#define I3G4250D_OUT_TEMP_ADDR 0x26 /* Out temp register */
|
||||
#define I3G4250D_STATUS_REG_ADDR 0x27 /* Status register */
|
||||
#define I3G4250D_OUT_X_L_ADDR 0x28 /* Output Register X */
|
||||
#define I3G4250D_OUT_X_H_ADDR 0x29 /* Output Register X */
|
||||
#define I3G4250D_OUT_Y_L_ADDR 0x2A /* Output Register Y */
|
||||
#define I3G4250D_OUT_Y_H_ADDR 0x2B /* Output Register Y */
|
||||
#define I3G4250D_OUT_Z_L_ADDR 0x2C /* Output Register Z */
|
||||
#define I3G4250D_OUT_Z_H_ADDR 0x2D /* Output Register Z */
|
||||
#define I3G4250D_FIFO_CTRL_REG_ADDR 0x2E /* Fifo control Register */
|
||||
#define I3G4250D_FIFO_SRC_REG_ADDR 0x2F /* Fifo src Register */
|
||||
|
||||
#define I3G4250D_INT1_CFG_ADDR 0x30 /* Interrupt 1 configuration Register */
|
||||
#define I3G4250D_INT1_SRC_ADDR 0x31 /* Interrupt 1 source Register */
|
||||
#define I3G4250D_INT1_TSH_XH_ADDR 0x32 /* Interrupt 1 Threshold X register */
|
||||
#define I3G4250D_INT1_TSH_XL_ADDR 0x33 /* Interrupt 1 Threshold X register */
|
||||
#define I3G4250D_INT1_TSH_YH_ADDR 0x34 /* Interrupt 1 Threshold Y register */
|
||||
#define I3G4250D_INT1_TSH_YL_ADDR 0x35 /* Interrupt 1 Threshold Y register */
|
||||
#define I3G4250D_INT1_TSH_ZH_ADDR 0x36 /* Interrupt 1 Threshold Z register */
|
||||
#define I3G4250D_INT1_TSH_ZL_ADDR 0x37 /* Interrupt 1 Threshold Z register */
|
||||
#define I3G4250D_INT1_DURATION_ADDR 0x38 /* Interrupt 1 DURATION register */
|
||||
|
||||
/******************************************************************************/
|
||||
/**************************** END REGISTER MAPPING ***************************/
|
||||
/******************************************************************************/
|
||||
|
||||
#define I_AM_I3G4250D ((uint8_t)0xD3)
|
||||
|
||||
/** @defgroup Power_Mode_selection Power Mode selection
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_MODE_POWERDOWN ((uint8_t)0x00)
|
||||
#define I3G4250D_MODE_ACTIVE ((uint8_t)0x08)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup OutPut_DataRate_Selection OutPut DataRate Selection
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_OUTPUT_DATARATE_1 ((uint8_t)0x00)
|
||||
#define I3G4250D_OUTPUT_DATARATE_2 ((uint8_t)0x40)
|
||||
#define I3G4250D_OUTPUT_DATARATE_3 ((uint8_t)0x80)
|
||||
#define I3G4250D_OUTPUT_DATARATE_4 ((uint8_t)0xC0)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup Axes_Selection Axes Selection
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_X_ENABLE ((uint8_t)0x02)
|
||||
#define I3G4250D_Y_ENABLE ((uint8_t)0x01)
|
||||
#define I3G4250D_Z_ENABLE ((uint8_t)0x04)
|
||||
#define I3G4250D_AXES_ENABLE ((uint8_t)0x07)
|
||||
#define I3G4250D_AXES_DISABLE ((uint8_t)0x00)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup Bandwidth_Selection Bandwidth Selection
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_BANDWIDTH_1 ((uint8_t)0x00)
|
||||
#define I3G4250D_BANDWIDTH_2 ((uint8_t)0x10)
|
||||
#define I3G4250D_BANDWIDTH_3 ((uint8_t)0x20)
|
||||
#define I3G4250D_BANDWIDTH_4 ((uint8_t)0x30)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup Full_Scale_Selection Full Scale Selection
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_FULLSCALE_245 ((uint8_t)0x00)
|
||||
#define I3G4250D_FULLSCALE_500 ((uint8_t)0x10)
|
||||
#define I3G4250D_FULLSCALE_2000 ((uint8_t)0x20)
|
||||
#define I3G4250D_FULLSCALE_SELECTION ((uint8_t)0x30)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup Full_Scale_Sensitivity Full Scale Sensitivity
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_SENSITIVITY_245DPS ((float)8.75f) /*!< gyroscope sensitivity with 250 dps full scale [DPS/LSB] */
|
||||
#define I3G4250D_SENSITIVITY_500DPS ((float)17.50f) /*!< gyroscope sensitivity with 500 dps full scale [DPS/LSB] */
|
||||
#define I3G4250D_SENSITIVITY_2000DPS ((float)70.00f) /*!< gyroscope sensitivity with 2000 dps full scale [DPS/LSB] */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup Block_Data_Update Block Data Update
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_BlockDataUpdate_Continous ((uint8_t)0x00)
|
||||
#define I3G4250D_BlockDataUpdate_Single ((uint8_t)0x80)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup Endian_Data_selection Endian Data selection
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_BLE_LSB ((uint8_t)0x00)
|
||||
#define I3G4250D_BLE_MSB ((uint8_t)0x40)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup High_Pass_Filter_status High Pass Filter status
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_HIGHPASSFILTER_DISABLE ((uint8_t)0x00)
|
||||
#define I3G4250D_HIGHPASSFILTER_ENABLE ((uint8_t)0x10)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup INT1_INT2_selection Selection
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_INT1 ((uint8_t)0x00)
|
||||
#define I3G4250D_INT2 ((uint8_t)0x01)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup INT1_Interrupt_status Interrupt Status
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_INT1INTERRUPT_DISABLE ((uint8_t)0x00)
|
||||
#define I3G4250D_INT1INTERRUPT_ENABLE ((uint8_t)0x80)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup INT2_Interrupt_status Interrupt Status
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_INT2INTERRUPT_DISABLE ((uint8_t)0x00)
|
||||
#define I3G4250D_INT2INTERRUPT_ENABLE ((uint8_t)0x08)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup INT1_Interrupt_ActiveEdge Interrupt Active Edge
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_INT1INTERRUPT_LOW_EDGE ((uint8_t)0x20)
|
||||
#define I3G4250D_INT1INTERRUPT_HIGH_EDGE ((uint8_t)0x00)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup Boot_Mode_selection Boot Mode Selection
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_BOOT_NORMALMODE ((uint8_t)0x00)
|
||||
#define I3G4250D_BOOT_REBOOTMEMORY ((uint8_t)0x80)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup High_Pass_Filter_Mode High Pass Filter Mode
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_HPM_NORMAL_MODE_RES ((uint8_t)0x00)
|
||||
#define I3G4250D_HPM_REF_SIGNAL ((uint8_t)0x10)
|
||||
#define I3G4250D_HPM_NORMAL_MODE ((uint8_t)0x20)
|
||||
#define I3G4250D_HPM_AUTORESET_INT ((uint8_t)0x30)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup High_Pass_CUT OFF_Frequency High Pass CUT OFF Frequency
|
||||
* @{
|
||||
*/
|
||||
#define I3G4250D_HPFCF_0 0x00
|
||||
#define I3G4250D_HPFCF_1 0x01
|
||||
#define I3G4250D_HPFCF_2 0x02
|
||||
#define I3G4250D_HPFCF_3 0x03
|
||||
#define I3G4250D_HPFCF_4 0x04
|
||||
#define I3G4250D_HPFCF_5 0x05
|
||||
#define I3G4250D_HPFCF_6 0x06
|
||||
#define I3G4250D_HPFCF_7 0x07
|
||||
#define I3G4250D_HPFCF_8 0x08
|
||||
#define I3G4250D_HPFCF_9 0x09
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/** @defgroup I3G4250D_Exported_Functions Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/* Sensor Configuration Functions */
|
||||
void I3G4250D_Init(uint16_t InitStruct);
|
||||
void I3G4250D_DeInit(void);
|
||||
void I3G4250D_LowPower(uint16_t InitStruct);
|
||||
uint8_t I3G4250D_ReadID(void);
|
||||
void I3G4250D_RebootCmd(void);
|
||||
|
||||
/* Interrupt Configuration Functions */
|
||||
void I3G4250D_INT1InterruptConfig(uint16_t Int1Config);
|
||||
void I3G4250D_EnableIT(uint8_t IntSel);
|
||||
void I3G4250D_DisableIT(uint8_t IntSel);
|
||||
|
||||
/* High Pass Filter Configuration Functions */
|
||||
void I3G4250D_FilterConfig(uint8_t FilterStruct);
|
||||
void I3G4250D_FilterCmd(uint8_t HighPassFilterState);
|
||||
void I3G4250D_ReadXYZAngRate(float *pfData);
|
||||
uint8_t I3G4250D_GetDataStatus(void);
|
||||
|
||||
/* Gyroscope IO functions */
|
||||
void GYRO_IO_Init(void);
|
||||
void GYRO_IO_DeInit(void);
|
||||
void GYRO_IO_Write(uint8_t *pBuffer, uint8_t WriteAddr, uint16_t NumByteToWrite);
|
||||
void GYRO_IO_Read(uint8_t *pBuffer, uint8_t ReadAddr, uint16_t NumByteToRead);
|
||||
|
||||
/* Gyroscope driver structure */
|
||||
extern GYRO_DrvTypeDef I3g4250Drv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __I3G4250D_H */
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: 'Bug report'
|
||||
about: 'Create a report to help us improve the quality of our software'
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Caution**
|
||||
|
||||
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
|
||||
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the **ST Community** in the STM32 MCUs dedicated [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
|
||||
**Describe the set-up**
|
||||
|
||||
* The board (either ST RPN reference or your custom board)
|
||||
* IDE or at least the compiler and its version
|
||||
|
||||
**Describe the bug (skip if none)**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce the bug (skip if none)**
|
||||
|
||||
1. Indicate the global behavior of your application project
|
||||
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
|
||||
3. Describe the use case that generates the problem
|
||||
4. How we can reproduce the problem
|
||||
|
||||
|
||||
**Additional context**
|
||||
|
||||
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
@@ -0,0 +1,3 @@
|
||||
## IMPORTANT INFORMATION
|
||||
|
||||
Pull-requests are **not** accepted on this repository. Please use issues to report any bug or request.
|
||||
@@ -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).
|
||||
@@ -0,0 +1,28 @@
|
||||
## Contributing guide
|
||||
|
||||
This document serves as a checklist before contributing to this repository.
|
||||
It includes links to read up on if topics are unclear to you.
|
||||
|
||||
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
|
||||
To report a bug or a request please file an issue in the right repository
|
||||
(example for [ili9325](https://github.com/STMicroelectronics/ili9325/issues/new/choose)).
|
||||
|
||||
Please check the following boxes 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, it should be submitted to the ST Community under the MCU topic [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
|
||||
### 2. Posting the issue
|
||||
When you have checked the previous boxes. You will find two templates (Bug Report or Other Issue) available in the **Issues** tab of the repository.
|
||||
|
||||
### 3. Pull Requests
|
||||
Pull-requests are **not** accepted on this repository. Please use **issues** to report any bug or request.
|
||||
|
||||
### 4. 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 for one new feature or proposal. This will ease the analysis and the final merge if accepted.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,40 @@
|
||||
# BSP ILI9325 Component
|
||||
|
||||
## Overview
|
||||
|
||||
**STM32Cube** is an STMicroelectronics original initiative to ease the 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 components 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 **ili9325** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **ILI9325** BSP LCD component part.
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2016 STMicroelectronics
|
||||
|
||||
This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this software except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
|
||||
|
||||
## Release note
|
||||
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/ili9325/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
|
||||
|
||||
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/ili9325/issues/new/choose).
|
||||
|
||||
For any other question related to the product, the tools, the environment, you can submit a topic to the [ST Community](https://community.st.com/s/).
|
||||
@@ -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 ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
@@ -0,0 +1,499 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ili9325.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.2.3
|
||||
* @date 03-May-2016
|
||||
* @brief This file includes the LCD driver for ILI9325 LCD.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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 "ili9325.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ili9325
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* ILI9325 LCD.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9325_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9325_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9325_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9325_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
LCD_DrvTypeDef ili9325_drv =
|
||||
{
|
||||
ili9325_Init,
|
||||
ili9325_ReadID,
|
||||
ili9325_DisplayOn,
|
||||
ili9325_DisplayOff,
|
||||
ili9325_SetCursor,
|
||||
ili9325_WritePixel,
|
||||
ili9325_ReadPixel,
|
||||
ili9325_SetDisplayWindow,
|
||||
ili9325_DrawHLine,
|
||||
ili9325_DrawVLine,
|
||||
ili9325_GetLcdPixelWidth,
|
||||
ili9325_GetLcdPixelHeight,
|
||||
ili9325_DrawBitmap,
|
||||
ili9325_DrawRGBImage,
|
||||
};
|
||||
|
||||
static uint16_t ArrayRGB[320] = {0};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9325_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9325_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize the ILI9325 LCD Component.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_Init(void)
|
||||
{
|
||||
/* Initialize ILI9325 low level bus layer ----------------------------------*/
|
||||
LCD_IO_Init();
|
||||
|
||||
/* Start Initial Sequence --------------------------------------------------*/
|
||||
ili9325_WriteReg(LCD_REG_0, 0x0001); /* Start internal OSC. */
|
||||
ili9325_WriteReg(LCD_REG_1, 0x0100); /* Set SS and SM bit */
|
||||
ili9325_WriteReg(LCD_REG_2, 0x0700); /* Set 1 line inversion */
|
||||
ili9325_WriteReg(LCD_REG_3, 0x1018); /* Set GRAM write direction and BGR=1. */
|
||||
ili9325_WriteReg(LCD_REG_4, 0x0000); /* Resize register */
|
||||
ili9325_WriteReg(LCD_REG_8, 0x0202); /* Set the back porch and front porch */
|
||||
ili9325_WriteReg(LCD_REG_9, 0x0000); /* Set non-display area refresh cycle ISC[3:0] */
|
||||
ili9325_WriteReg(LCD_REG_10, 0x0000); /* FMARK function */
|
||||
ili9325_WriteReg(LCD_REG_12, 0x0000); /* RGB interface setting */
|
||||
ili9325_WriteReg(LCD_REG_13, 0x0000); /* Frame marker Position */
|
||||
ili9325_WriteReg(LCD_REG_15, 0x0000); /* RGB interface polarity */
|
||||
|
||||
/* Power On sequence -------------------------------------------------------*/
|
||||
ili9325_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
|
||||
ili9325_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
|
||||
ili9325_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
|
||||
ili9325_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */
|
||||
|
||||
ili9325_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
|
||||
ili9325_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */
|
||||
|
||||
ili9325_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */
|
||||
|
||||
ili9325_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */
|
||||
ili9325_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */
|
||||
|
||||
ili9325_WriteReg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */
|
||||
ili9325_WriteReg(LCD_REG_33, 0x0000); /* GRAM Vertical Address */
|
||||
|
||||
/* Adjust the Gamma Curve (ILI9325) ----------------------------------------*/
|
||||
ili9325_WriteReg(LCD_REG_48, 0x0007);
|
||||
ili9325_WriteReg(LCD_REG_49, 0x0302);
|
||||
ili9325_WriteReg(LCD_REG_50, 0x0105);
|
||||
ili9325_WriteReg(LCD_REG_53, 0x0206);
|
||||
ili9325_WriteReg(LCD_REG_54, 0x0808);
|
||||
ili9325_WriteReg(LCD_REG_55, 0x0206);
|
||||
ili9325_WriteReg(LCD_REG_56, 0x0504);
|
||||
ili9325_WriteReg(LCD_REG_57, 0x0007);
|
||||
ili9325_WriteReg(LCD_REG_60, 0x0105);
|
||||
ili9325_WriteReg(LCD_REG_61, 0x0808);
|
||||
|
||||
/* Set GRAM area -----------------------------------------------------------*/
|
||||
ili9325_WriteReg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */
|
||||
ili9325_WriteReg(LCD_REG_81, 0x00EF); /* Horizontal GRAM End Address */
|
||||
ili9325_WriteReg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */
|
||||
ili9325_WriteReg(LCD_REG_83, 0x013F); /* Vertical GRAM End Address */
|
||||
|
||||
ili9325_WriteReg(LCD_REG_96, 0xA700); /* Gate Scan Line(GS=1, scan direction is G320~G1) */
|
||||
ili9325_WriteReg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */
|
||||
ili9325_WriteReg(LCD_REG_106, 0x0000); /* set scrolling line */
|
||||
|
||||
/* Partial Display Control -------------------------------------------------*/
|
||||
ili9325_WriteReg(LCD_REG_128, 0x0000);
|
||||
ili9325_WriteReg(LCD_REG_129, 0x0000);
|
||||
ili9325_WriteReg(LCD_REG_130, 0x0000);
|
||||
ili9325_WriteReg(LCD_REG_131, 0x0000);
|
||||
ili9325_WriteReg(LCD_REG_132, 0x0000);
|
||||
ili9325_WriteReg(LCD_REG_133, 0x0000);
|
||||
|
||||
/* Panel Control -----------------------------------------------------------*/
|
||||
ili9325_WriteReg(LCD_REG_144, 0x0010);
|
||||
ili9325_WriteReg(LCD_REG_146, 0x0000);
|
||||
ili9325_WriteReg(LCD_REG_147, 0x0003);
|
||||
ili9325_WriteReg(LCD_REG_149, 0x0110);
|
||||
ili9325_WriteReg(LCD_REG_151, 0x0000);
|
||||
ili9325_WriteReg(LCD_REG_152, 0x0000);
|
||||
|
||||
/* set GRAM write direction and BGR = 1 */
|
||||
/* I/D=00 (Horizontal : increment, Vertical : decrement) */
|
||||
/* AM=1 (address is updated in vertical writing direction) */
|
||||
ili9325_WriteReg(LCD_REG_3, 0x1018);
|
||||
|
||||
/* 262K color and display ON */
|
||||
ili9325_WriteReg(LCD_REG_7, 0x0173);
|
||||
|
||||
/* Set the Cursor */
|
||||
ili9325_SetCursor(0, 0);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables the Display.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_DisplayOn(void)
|
||||
{
|
||||
/* Power On sequence -------------------------------------------------------*/
|
||||
ili9325_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
|
||||
ili9325_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
|
||||
ili9325_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
|
||||
ili9325_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/
|
||||
|
||||
ili9325_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
|
||||
ili9325_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */
|
||||
|
||||
ili9325_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */
|
||||
|
||||
ili9325_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */
|
||||
ili9325_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */
|
||||
|
||||
/* Display On */
|
||||
ili9325_WriteReg(LCD_REG_7, 0x0173); /* 262K color and display ON */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables the Display.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_DisplayOff(void)
|
||||
{
|
||||
/* Power Off sequence ------------------------------------------------------*/
|
||||
ili9325_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
|
||||
ili9325_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
|
||||
ili9325_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
|
||||
ili9325_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/
|
||||
|
||||
ili9325_WriteReg(LCD_REG_41, 0x0000); /* VCM[4:0] for VCOMH */
|
||||
|
||||
/* Display Off */
|
||||
ili9325_WriteReg(LCD_REG_7, 0x0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the LCD pixel Width.
|
||||
* @param None
|
||||
* @retval The Lcd Pixel Width
|
||||
*/
|
||||
uint16_t ili9325_GetLcdPixelWidth(void)
|
||||
{
|
||||
return (uint16_t)320;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the LCD pixel Height.
|
||||
* @param None
|
||||
* @retval The Lcd Pixel Height
|
||||
*/
|
||||
uint16_t ili9325_GetLcdPixelHeight(void)
|
||||
{
|
||||
return (uint16_t)240;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the ILI9325 ID.
|
||||
* @param None
|
||||
* @retval The ILI9325 ID
|
||||
*/
|
||||
uint16_t ili9325_ReadID(void)
|
||||
{
|
||||
LCD_IO_Init();
|
||||
return (ili9325_ReadReg(0x00));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set Cursor position.
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_SetCursor(uint16_t Xpos, uint16_t Ypos)
|
||||
{
|
||||
ili9325_WriteReg(LCD_REG_32, Ypos);
|
||||
ili9325_WriteReg(LCD_REG_33, (ILI9325_LCD_PIXEL_WIDTH - 1 - Xpos));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write pixel.
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @param RGBCode: the RGB pixel color
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
|
||||
{
|
||||
/* Set Cursor */
|
||||
ili9325_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
|
||||
/* Write 16-bit GRAM Reg */
|
||||
LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read pixel.
|
||||
* @param None
|
||||
* @retval The RGB pixel color
|
||||
*/
|
||||
uint16_t ili9325_ReadPixel(uint16_t Xpos, uint16_t Ypos)
|
||||
{
|
||||
/* Set Cursor */
|
||||
ili9325_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Read 16-bit Reg */
|
||||
return (LCD_IO_ReadData(LCD_REG_34));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes to the selected LCD register.
|
||||
* @param LCDReg: Address of the selected register.
|
||||
* @param LCDRegValue: Value to write to the selected register.
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue)
|
||||
{
|
||||
LCD_IO_WriteReg(LCDReg);
|
||||
|
||||
/* Write 16-bit GRAM Reg */
|
||||
LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads the selected LCD Register.
|
||||
* @param LCDReg: address of the selected register.
|
||||
* @retval LCD Register Value.
|
||||
*/
|
||||
uint16_t ili9325_ReadReg(uint8_t LCDReg)
|
||||
{
|
||||
/* Read 16-bit Reg */
|
||||
return (LCD_IO_ReadData(LCDReg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets a display window
|
||||
* @param Xpos: specifies the X bottom left position.
|
||||
* @param Ypos: specifies the Y bottom left position.
|
||||
* @param Height: display window height.
|
||||
* @param Width: display window width.
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
|
||||
{
|
||||
/* Horizontal GRAM Start Address */
|
||||
ili9325_WriteReg(LCD_REG_80, (Ypos));
|
||||
/* Horizontal GRAM End Address */
|
||||
ili9325_WriteReg(LCD_REG_81, (Ypos + Height - 1));
|
||||
|
||||
/* Vertical GRAM Start Address */
|
||||
ili9325_WriteReg(LCD_REG_82, ILI9325_LCD_PIXEL_WIDTH - Xpos - Width);
|
||||
/* Vertical GRAM End Address */
|
||||
ili9325_WriteReg(LCD_REG_83, ILI9325_LCD_PIXEL_WIDTH - Xpos - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Draw vertical line.
|
||||
* @param RGBCode: Specifies the RGB color
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @param Length: specifies the Line length.
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
|
||||
{
|
||||
uint16_t counter = 0;
|
||||
|
||||
/* Set Cursor */
|
||||
ili9325_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
|
||||
/* Sent a complete line */
|
||||
for(counter = 0; counter < Length; counter++)
|
||||
{
|
||||
ArrayRGB[counter] = RGBCode;
|
||||
}
|
||||
|
||||
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Draw vertical line.
|
||||
* @param RGBCode: Specifies the RGB color
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @param Length: specifies the Line length.
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
|
||||
{
|
||||
uint16_t counter = 0;
|
||||
|
||||
/* set GRAM write direction and BGR = 1 */
|
||||
/* I/D=00 (Horizontal : increment, Vertical : decrement) */
|
||||
/* AM=1 (address is updated in vertical writing direction) */
|
||||
ili9325_WriteReg(LCD_REG_3, 0x1010);
|
||||
|
||||
/* Set Cursor */
|
||||
ili9325_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
|
||||
/* Fill a complete vertical line */
|
||||
for(counter = 0; counter < Length; counter++)
|
||||
{
|
||||
ArrayRGB[counter] = RGBCode;
|
||||
}
|
||||
|
||||
/* Write 16-bit GRAM Reg */
|
||||
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
|
||||
|
||||
/* set GRAM write direction and BGR = 1 */
|
||||
/* I/D=00 (Horizontal : increment, Vertical : decrement) */
|
||||
/* AM=1 (address is updated in vertical writing direction) */
|
||||
ili9325_WriteReg(LCD_REG_3, 0x1018);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Displays a bitmap picture.
|
||||
* @param BmpAddress: Bmp picture address.
|
||||
* @param Xpos: Bmp X position in the LCD
|
||||
* @param Ypos: Bmp Y position in the LCD
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
|
||||
{
|
||||
uint32_t index = 0, size = 0;
|
||||
/* Read bitmap size */
|
||||
size = *(volatile uint16_t *) (pbmp + 2);
|
||||
size |= (*(volatile uint16_t *) (pbmp + 4)) << 16;
|
||||
/* Get bitmap data address offset */
|
||||
index = *(volatile uint16_t *) (pbmp + 10);
|
||||
index |= (*(volatile uint16_t *) (pbmp + 12)) << 16;
|
||||
size = (size - index)/2;
|
||||
pbmp += index;
|
||||
/* Set GRAM write direction and BGR = 1 */
|
||||
/* I/D=00 (Horizontal : decrement, Vertical : decrement) */
|
||||
/* AM=1 (address is updated in vertical writing direction) */
|
||||
ili9325_WriteReg(LCD_REG_3, 0x1008);
|
||||
|
||||
/* Set Cursor */
|
||||
ili9325_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
|
||||
LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2);
|
||||
|
||||
/* Set GRAM write direction and BGR = 1 */
|
||||
/* I/D = 01 (Horizontal : increment, Vertical : decrement) */
|
||||
/* AM = 1 (address is updated in vertical writing direction) */
|
||||
ili9325_WriteReg(LCD_REG_3, 0x1018);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Displays picture.
|
||||
* @param pdata: picture address.
|
||||
* @param Xpos: Image X position in the LCD
|
||||
* @param Ypos: Image Y position in the LCD
|
||||
* @param Xsize: Image X size in the LCD
|
||||
* @param Ysize: Image Y size in the LCD
|
||||
* @retval None
|
||||
*/
|
||||
void ili9325_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata)
|
||||
{
|
||||
uint32_t size = 0;
|
||||
|
||||
size = (Xsize * Ysize);
|
||||
|
||||
/* Set Cursor */
|
||||
ili9325_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
|
||||
LCD_IO_WriteMultipleData((uint8_t*)pdata, size*2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,237 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ili9325.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.2.3
|
||||
* @date 04-May-2016
|
||||
* @brief This file contains all the functions prototypes for the ili9325.c
|
||||
* driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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 __ILI9325_H
|
||||
#define __ILI9325_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/lcd.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ili9325
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9325_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9325_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief ILI9325 ID
|
||||
*/
|
||||
#define ILI9325_ID 0x9325
|
||||
|
||||
/**
|
||||
* @brief ILI9325 Size
|
||||
*/
|
||||
#define ILI9325_LCD_PIXEL_WIDTH ((uint16_t)320)
|
||||
#define ILI9325_LCD_PIXEL_HEIGHT ((uint16_t)240)
|
||||
|
||||
/**
|
||||
* @brief ILI9325 Registers
|
||||
*/
|
||||
#define LCD_REG_0 0x00
|
||||
#define LCD_REG_1 0x01
|
||||
#define LCD_REG_2 0x02
|
||||
#define LCD_REG_3 0x03
|
||||
#define LCD_REG_4 0x04
|
||||
#define LCD_REG_5 0x05
|
||||
#define LCD_REG_6 0x06
|
||||
#define LCD_REG_7 0x07
|
||||
#define LCD_REG_8 0x08
|
||||
#define LCD_REG_9 0x09
|
||||
#define LCD_REG_10 0x0A
|
||||
#define LCD_REG_12 0x0C
|
||||
#define LCD_REG_13 0x0D
|
||||
#define LCD_REG_14 0x0E
|
||||
#define LCD_REG_15 0x0F
|
||||
#define LCD_REG_16 0x10
|
||||
#define LCD_REG_17 0x11
|
||||
#define LCD_REG_18 0x12
|
||||
#define LCD_REG_19 0x13
|
||||
#define LCD_REG_20 0x14
|
||||
#define LCD_REG_21 0x15
|
||||
#define LCD_REG_22 0x16
|
||||
#define LCD_REG_23 0x17
|
||||
#define LCD_REG_24 0x18
|
||||
#define LCD_REG_25 0x19
|
||||
#define LCD_REG_26 0x1A
|
||||
#define LCD_REG_27 0x1B
|
||||
#define LCD_REG_28 0x1C
|
||||
#define LCD_REG_29 0x1D
|
||||
#define LCD_REG_30 0x1E
|
||||
#define LCD_REG_31 0x1F
|
||||
#define LCD_REG_32 0x20
|
||||
#define LCD_REG_33 0x21
|
||||
#define LCD_REG_34 0x22
|
||||
#define LCD_REG_36 0x24
|
||||
#define LCD_REG_37 0x25
|
||||
#define LCD_REG_40 0x28
|
||||
#define LCD_REG_41 0x29
|
||||
#define LCD_REG_43 0x2B
|
||||
#define LCD_REG_45 0x2D
|
||||
#define LCD_REG_48 0x30
|
||||
#define LCD_REG_49 0x31
|
||||
#define LCD_REG_50 0x32
|
||||
#define LCD_REG_51 0x33
|
||||
#define LCD_REG_52 0x34
|
||||
#define LCD_REG_53 0x35
|
||||
#define LCD_REG_54 0x36
|
||||
#define LCD_REG_55 0x37
|
||||
#define LCD_REG_56 0x38
|
||||
#define LCD_REG_57 0x39
|
||||
#define LCD_REG_58 0x3A
|
||||
#define LCD_REG_59 0x3B
|
||||
#define LCD_REG_60 0x3C
|
||||
#define LCD_REG_61 0x3D
|
||||
#define LCD_REG_62 0x3E
|
||||
#define LCD_REG_63 0x3F
|
||||
#define LCD_REG_64 0x40
|
||||
#define LCD_REG_65 0x41
|
||||
#define LCD_REG_66 0x42
|
||||
#define LCD_REG_67 0x43
|
||||
#define LCD_REG_68 0x44
|
||||
#define LCD_REG_69 0x45
|
||||
#define LCD_REG_70 0x46
|
||||
#define LCD_REG_71 0x47
|
||||
#define LCD_REG_72 0x48
|
||||
#define LCD_REG_73 0x49
|
||||
#define LCD_REG_74 0x4A
|
||||
#define LCD_REG_75 0x4B
|
||||
#define LCD_REG_76 0x4C
|
||||
#define LCD_REG_77 0x4D
|
||||
#define LCD_REG_78 0x4E
|
||||
#define LCD_REG_79 0x4F
|
||||
#define LCD_REG_80 0x50
|
||||
#define LCD_REG_81 0x51
|
||||
#define LCD_REG_82 0x52
|
||||
#define LCD_REG_83 0x53
|
||||
#define LCD_REG_96 0x60
|
||||
#define LCD_REG_97 0x61
|
||||
#define LCD_REG_106 0x6A
|
||||
#define LCD_REG_118 0x76
|
||||
#define LCD_REG_128 0x80
|
||||
#define LCD_REG_129 0x81
|
||||
#define LCD_REG_130 0x82
|
||||
#define LCD_REG_131 0x83
|
||||
#define LCD_REG_132 0x84
|
||||
#define LCD_REG_133 0x85
|
||||
#define LCD_REG_134 0x86
|
||||
#define LCD_REG_135 0x87
|
||||
#define LCD_REG_136 0x88
|
||||
#define LCD_REG_137 0x89
|
||||
#define LCD_REG_139 0x8B
|
||||
#define LCD_REG_140 0x8C
|
||||
#define LCD_REG_141 0x8D
|
||||
#define LCD_REG_143 0x8F
|
||||
#define LCD_REG_144 0x90
|
||||
#define LCD_REG_145 0x91
|
||||
#define LCD_REG_146 0x92
|
||||
#define LCD_REG_147 0x93
|
||||
#define LCD_REG_148 0x94
|
||||
#define LCD_REG_149 0x95
|
||||
#define LCD_REG_150 0x96
|
||||
#define LCD_REG_151 0x97
|
||||
#define LCD_REG_152 0x98
|
||||
#define LCD_REG_153 0x99
|
||||
#define LCD_REG_154 0x9A
|
||||
#define LCD_REG_157 0x9D
|
||||
#define LCD_REG_192 0xC0
|
||||
#define LCD_REG_193 0xC1
|
||||
#define LCD_REG_229 0xE5
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9325_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
void ili9325_Init(void);
|
||||
uint16_t ili9325_ReadID(void);
|
||||
void ili9325_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue);
|
||||
uint16_t ili9325_ReadReg(uint8_t LCDReg);
|
||||
|
||||
void ili9325_DisplayOn(void);
|
||||
void ili9325_DisplayOff(void);
|
||||
void ili9325_SetCursor(uint16_t Xpos, uint16_t Ypos);
|
||||
void ili9325_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode);
|
||||
uint16_t ili9325_ReadPixel(uint16_t Xpos, uint16_t Ypos);
|
||||
|
||||
void ili9325_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
|
||||
void ili9325_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
|
||||
void ili9325_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
|
||||
void ili9325_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata);
|
||||
|
||||
void ili9325_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
|
||||
|
||||
|
||||
uint16_t ili9325_GetLcdPixelWidth(void);
|
||||
uint16_t ili9325_GetLcdPixelHeight(void);
|
||||
|
||||
/* LCD driver structure */
|
||||
extern LCD_DrvTypeDef ili9325_drv;
|
||||
|
||||
/* LCD IO functions */
|
||||
void LCD_IO_Init(void);
|
||||
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size);
|
||||
void LCD_IO_WriteReg(uint8_t Reg);
|
||||
uint16_t LCD_IO_ReadData(uint16_t Reg);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ILI9325_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: 'Bug report'
|
||||
about: 'Create a report to help us improve the quality of our software'
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Caution**
|
||||
|
||||
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
|
||||
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the **ST Community** in the STM32 MCUs dedicated [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
|
||||
**Describe the set-up**
|
||||
|
||||
* The board (either ST RPN reference or your custom board)
|
||||
* IDE or at least the compiler and its version
|
||||
|
||||
**Describe the bug (skip if none)**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce the bug (skip if none)**
|
||||
|
||||
1. Indicate the global behavior of your application project
|
||||
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
|
||||
3. Describe the use case that generates the problem
|
||||
4. How we can reproduce the problem
|
||||
|
||||
|
||||
**Additional context**
|
||||
|
||||
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
@@ -0,0 +1,3 @@
|
||||
## IMPORTANT INFORMATION
|
||||
|
||||
Pull-requests are **not** accepted on this repository. Please use issues to report any bug or request.
|
||||
@@ -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).
|
||||
@@ -0,0 +1,28 @@
|
||||
## Contributing guide
|
||||
|
||||
This document serves as a checklist before contributing to this repository.
|
||||
It includes links to read up on if topics are unclear to you.
|
||||
|
||||
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
|
||||
To report a bug or a request please file an issue in the right repository
|
||||
(example for [ili9341](https://github.com/STMicroelectronics/ili9341/issues/new/choose)).
|
||||
|
||||
Please check the following boxes 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, it should be submitted to the ST Community under the MCU topic [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
|
||||
### 2. Posting the issue
|
||||
When you have checked the previous boxes. You will find two templates (Bug Report or Other Issue) available in the **Issues** tab of the repository.
|
||||
|
||||
### 3. Pull Requests
|
||||
Pull-requests are **not** accepted on this repository. Please use **issues** to report any bug or request.
|
||||
|
||||
### 4. 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 for one new feature or proposal. This will ease the analysis and the final merge if accepted.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,40 @@
|
||||
# BSP ILI9341 Component
|
||||
|
||||
## Overview
|
||||
|
||||
**STM32Cube** is an STMicroelectronics original initiative to ease the 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 components 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 **ili9341** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **ILI9341** BSP LCD component part.
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2014 STMicroelectronics
|
||||
|
||||
This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this software except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
|
||||
|
||||
## Release note
|
||||
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/ili9341/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
|
||||
|
||||
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/ili9341/issues/new/choose).
|
||||
|
||||
For any other question related to the product, the tools, the environment, you can submit a topic to the [ST Community](https://community.st.com/s/).
|
||||
@@ -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 ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
@@ -0,0 +1,327 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ili9341.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.2
|
||||
* @date 02-December-2014
|
||||
* @brief This file includes the LCD driver for ILI9341 LCD.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2014 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 "ili9341.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ILI9341
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* ILI9341 LCD.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9341_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9341_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9341_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9341_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
LCD_DrvTypeDef ili9341_drv =
|
||||
{
|
||||
ili9341_Init,
|
||||
ili9341_ReadID,
|
||||
ili9341_DisplayOn,
|
||||
ili9341_DisplayOff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
ili9341_GetLcdPixelWidth,
|
||||
ili9341_GetLcdPixelHeight,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9341_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9341_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Power on the LCD.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ili9341_Init(void)
|
||||
{
|
||||
/* Initialize ILI9341 low level bus layer ----------------------------------*/
|
||||
LCD_IO_Init();
|
||||
|
||||
/* Configure LCD */
|
||||
ili9341_WriteReg(0xCA);
|
||||
ili9341_WriteData(0xC3);
|
||||
ili9341_WriteData(0x08);
|
||||
ili9341_WriteData(0x50);
|
||||
ili9341_WriteReg(LCD_POWERB);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0xC1);
|
||||
ili9341_WriteData(0x30);
|
||||
ili9341_WriteReg(LCD_POWER_SEQ);
|
||||
ili9341_WriteData(0x64);
|
||||
ili9341_WriteData(0x03);
|
||||
ili9341_WriteData(0x12);
|
||||
ili9341_WriteData(0x81);
|
||||
ili9341_WriteReg(LCD_DTCA);
|
||||
ili9341_WriteData(0x85);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0x78);
|
||||
ili9341_WriteReg(LCD_POWERA);
|
||||
ili9341_WriteData(0x39);
|
||||
ili9341_WriteData(0x2C);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0x34);
|
||||
ili9341_WriteData(0x02);
|
||||
ili9341_WriteReg(LCD_PRC);
|
||||
ili9341_WriteData(0x20);
|
||||
ili9341_WriteReg(LCD_DTCB);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteReg(LCD_FRMCTR1);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0x1B);
|
||||
ili9341_WriteReg(LCD_DFC);
|
||||
ili9341_WriteData(0x0A);
|
||||
ili9341_WriteData(0xA2);
|
||||
ili9341_WriteReg(LCD_POWER1);
|
||||
ili9341_WriteData(0x10);
|
||||
ili9341_WriteReg(LCD_POWER2);
|
||||
ili9341_WriteData(0x10);
|
||||
ili9341_WriteReg(LCD_VCOM1);
|
||||
ili9341_WriteData(0x45);
|
||||
ili9341_WriteData(0x15);
|
||||
ili9341_WriteReg(LCD_VCOM2);
|
||||
ili9341_WriteData(0x90);
|
||||
ili9341_WriteReg(LCD_MAC);
|
||||
ili9341_WriteData(0xC8);
|
||||
ili9341_WriteReg(LCD_3GAMMA_EN);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteReg(LCD_RGB_INTERFACE);
|
||||
ili9341_WriteData(0xC2);
|
||||
ili9341_WriteReg(LCD_DFC);
|
||||
ili9341_WriteData(0x0A);
|
||||
ili9341_WriteData(0xA7);
|
||||
ili9341_WriteData(0x27);
|
||||
ili9341_WriteData(0x04);
|
||||
|
||||
/* Colomn address set */
|
||||
ili9341_WriteReg(LCD_COLUMN_ADDR);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0xEF);
|
||||
/* Page address set */
|
||||
ili9341_WriteReg(LCD_PAGE_ADDR);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0x01);
|
||||
ili9341_WriteData(0x3F);
|
||||
ili9341_WriteReg(LCD_INTERFACE);
|
||||
ili9341_WriteData(0x01);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0x06);
|
||||
|
||||
ili9341_WriteReg(LCD_GRAM);
|
||||
LCD_Delay(200);
|
||||
|
||||
ili9341_WriteReg(LCD_GAMMA);
|
||||
ili9341_WriteData(0x01);
|
||||
|
||||
ili9341_WriteReg(LCD_PGAMMA);
|
||||
ili9341_WriteData(0x0F);
|
||||
ili9341_WriteData(0x29);
|
||||
ili9341_WriteData(0x24);
|
||||
ili9341_WriteData(0x0C);
|
||||
ili9341_WriteData(0x0E);
|
||||
ili9341_WriteData(0x09);
|
||||
ili9341_WriteData(0x4E);
|
||||
ili9341_WriteData(0x78);
|
||||
ili9341_WriteData(0x3C);
|
||||
ili9341_WriteData(0x09);
|
||||
ili9341_WriteData(0x13);
|
||||
ili9341_WriteData(0x05);
|
||||
ili9341_WriteData(0x17);
|
||||
ili9341_WriteData(0x11);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteReg(LCD_NGAMMA);
|
||||
ili9341_WriteData(0x00);
|
||||
ili9341_WriteData(0x16);
|
||||
ili9341_WriteData(0x1B);
|
||||
ili9341_WriteData(0x04);
|
||||
ili9341_WriteData(0x11);
|
||||
ili9341_WriteData(0x07);
|
||||
ili9341_WriteData(0x31);
|
||||
ili9341_WriteData(0x33);
|
||||
ili9341_WriteData(0x42);
|
||||
ili9341_WriteData(0x05);
|
||||
ili9341_WriteData(0x0C);
|
||||
ili9341_WriteData(0x0A);
|
||||
ili9341_WriteData(0x28);
|
||||
ili9341_WriteData(0x2F);
|
||||
ili9341_WriteData(0x0F);
|
||||
|
||||
ili9341_WriteReg(LCD_SLEEP_OUT);
|
||||
LCD_Delay(200);
|
||||
ili9341_WriteReg(LCD_DISPLAY_ON);
|
||||
/* GRAM start writing */
|
||||
ili9341_WriteReg(LCD_GRAM);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables the Display.
|
||||
* @param None
|
||||
* @retval LCD Register Value.
|
||||
*/
|
||||
uint16_t ili9341_ReadID(void)
|
||||
{
|
||||
LCD_IO_Init();
|
||||
return ((uint16_t)ili9341_ReadData(LCD_READ_ID4, LCD_READ_ID4_SIZE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables the Display.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ili9341_DisplayOn(void)
|
||||
{
|
||||
/* Display On */
|
||||
ili9341_WriteReg(LCD_DISPLAY_ON);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables the Display.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ili9341_DisplayOff(void)
|
||||
{
|
||||
/* Display Off */
|
||||
ili9341_WriteReg(LCD_DISPLAY_OFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes to the selected LCD register.
|
||||
* @param LCD_Reg: address of the selected register.
|
||||
* @retval None
|
||||
*/
|
||||
void ili9341_WriteReg(uint8_t LCD_Reg)
|
||||
{
|
||||
LCD_IO_WriteReg(LCD_Reg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes data to the selected LCD register.
|
||||
* @param LCD_Reg: address of the selected register.
|
||||
* @retval None
|
||||
*/
|
||||
void ili9341_WriteData(uint16_t RegValue)
|
||||
{
|
||||
LCD_IO_WriteData(RegValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads the selected LCD Register.
|
||||
* @param RegValue: Address of the register to read
|
||||
* @param ReadSize: Number of bytes to read
|
||||
* @retval LCD Register Value.
|
||||
*/
|
||||
uint32_t ili9341_ReadData(uint16_t RegValue, uint8_t ReadSize)
|
||||
{
|
||||
/* Read a max of 4 bytes */
|
||||
return (LCD_IO_ReadData(RegValue, ReadSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get LCD PIXEL WIDTH.
|
||||
* @param None
|
||||
* @retval LCD PIXEL WIDTH.
|
||||
*/
|
||||
uint16_t ili9341_GetLcdPixelWidth(void)
|
||||
{
|
||||
/* Return LCD PIXEL WIDTH */
|
||||
return ILI9341_LCD_PIXEL_WIDTH;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get LCD PIXEL HEIGHT.
|
||||
* @param None
|
||||
* @retval LCD PIXEL HEIGHT.
|
||||
*/
|
||||
uint16_t ili9341_GetLcdPixelHeight(void)
|
||||
{
|
||||
/* Return LCD PIXEL HEIGHT */
|
||||
return ILI9341_LCD_PIXEL_HEIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,230 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file ili9341.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.2
|
||||
* @date 02-December-2014
|
||||
* @brief This file contains all the functions prototypes for the ili9341.c
|
||||
* driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2014 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 __ILI9341_H
|
||||
#define __ILI9341_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/lcd.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ILI9341
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9341_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9341_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief ILI9341 chip IDs
|
||||
*/
|
||||
#define ILI9341_ID 0x9341
|
||||
|
||||
/**
|
||||
* @brief ILI9341 Size
|
||||
*/
|
||||
#define ILI9341_LCD_PIXEL_WIDTH ((uint16_t)240)
|
||||
#define ILI9341_LCD_PIXEL_HEIGHT ((uint16_t)320)
|
||||
|
||||
/**
|
||||
* @brief ILI9341 Timing
|
||||
*/
|
||||
/* Timing configuration (Typical configuration from ILI9341 datasheet)
|
||||
HSYNC=10 (9+1)
|
||||
HBP=20 (29-10+1)
|
||||
ActiveW=240 (269-20-10+1)
|
||||
HFP=10 (279-240-20-10+1)
|
||||
|
||||
VSYNC=2 (1+1)
|
||||
VBP=2 (3-2+1)
|
||||
ActiveH=320 (323-2-2+1)
|
||||
VFP=4 (327-320-2-2+1)
|
||||
*/
|
||||
#define ILI9341_HSYNC ((uint32_t)9) /* Horizontal synchronization */
|
||||
#define ILI9341_HBP ((uint32_t)29) /* Horizontal back porch */
|
||||
#define ILI9341_HFP ((uint32_t)2) /* Horizontal front porch */
|
||||
#define ILI9341_VSYNC ((uint32_t)1) /* Vertical synchronization */
|
||||
#define ILI9341_VBP ((uint32_t)3) /* Vertical back porch */
|
||||
#define ILI9341_VFP ((uint32_t)2) /* Vertical front porch */
|
||||
|
||||
/**
|
||||
* @brief ILI9341 Registers
|
||||
*/
|
||||
|
||||
/* Level 1 Commands */
|
||||
#define LCD_SWRESET 0x01 /* Software Reset */
|
||||
#define LCD_READ_DISPLAY_ID 0x04 /* Read display identification information */
|
||||
#define LCD_RDDST 0x09 /* Read Display Status */
|
||||
#define LCD_RDDPM 0x0A /* Read Display Power Mode */
|
||||
#define LCD_RDDMADCTL 0x0B /* Read Display MADCTL */
|
||||
#define LCD_RDDCOLMOD 0x0C /* Read Display Pixel Format */
|
||||
#define LCD_RDDIM 0x0D /* Read Display Image Format */
|
||||
#define LCD_RDDSM 0x0E /* Read Display Signal Mode */
|
||||
#define LCD_RDDSDR 0x0F /* Read Display Self-Diagnostic Result */
|
||||
#define LCD_SPLIN 0x10 /* Enter Sleep Mode */
|
||||
#define LCD_SLEEP_OUT 0x11 /* Sleep out register */
|
||||
#define LCD_PTLON 0x12 /* Partial Mode ON */
|
||||
#define LCD_NORMAL_MODE_ON 0x13 /* Normal Display Mode ON */
|
||||
#define LCD_DINVOFF 0x20 /* Display Inversion OFF */
|
||||
#define LCD_DINVON 0x21 /* Display Inversion ON */
|
||||
#define LCD_GAMMA 0x26 /* Gamma register */
|
||||
#define LCD_DISPLAY_OFF 0x28 /* Display off register */
|
||||
#define LCD_DISPLAY_ON 0x29 /* Display on register */
|
||||
#define LCD_COLUMN_ADDR 0x2A /* Colomn address register */
|
||||
#define LCD_PAGE_ADDR 0x2B /* Page address register */
|
||||
#define LCD_GRAM 0x2C /* GRAM register */
|
||||
#define LCD_RGBSET 0x2D /* Color SET */
|
||||
#define LCD_RAMRD 0x2E /* Memory Read */
|
||||
#define LCD_PLTAR 0x30 /* Partial Area */
|
||||
#define LCD_VSCRDEF 0x33 /* Vertical Scrolling Definition */
|
||||
#define LCD_TEOFF 0x34 /* Tearing Effect Line OFF */
|
||||
#define LCD_TEON 0x35 /* Tearing Effect Line ON */
|
||||
#define LCD_MAC 0x36 /* Memory Access Control register*/
|
||||
#define LCD_VSCRSADD 0x37 /* Vertical Scrolling Start Address */
|
||||
#define LCD_IDMOFF 0x38 /* Idle Mode OFF */
|
||||
#define LCD_IDMON 0x39 /* Idle Mode ON */
|
||||
#define LCD_PIXEL_FORMAT 0x3A /* Pixel Format register */
|
||||
#define LCD_WRITE_MEM_CONTINUE 0x3C /* Write Memory Continue */
|
||||
#define LCD_READ_MEM_CONTINUE 0x3E /* Read Memory Continue */
|
||||
#define LCD_SET_TEAR_SCANLINE 0x44 /* Set Tear Scanline */
|
||||
#define LCD_GET_SCANLINE 0x45 /* Get Scanline */
|
||||
#define LCD_WDB 0x51 /* Write Brightness Display register */
|
||||
#define LCD_RDDISBV 0x52 /* Read Display Brightness */
|
||||
#define LCD_WCD 0x53 /* Write Control Display register*/
|
||||
#define LCD_RDCTRLD 0x54 /* Read CTRL Display */
|
||||
#define LCD_WRCABC 0x55 /* Write Content Adaptive Brightness Control */
|
||||
#define LCD_RDCABC 0x56 /* Read Content Adaptive Brightness Control */
|
||||
#define LCD_WRITE_CABC 0x5E /* Write CABC Minimum Brightness */
|
||||
#define LCD_READ_CABC 0x5F /* Read CABC Minimum Brightness */
|
||||
#define LCD_READ_ID1 0xDA /* Read ID1 */
|
||||
#define LCD_READ_ID2 0xDB /* Read ID2 */
|
||||
#define LCD_READ_ID3 0xDC /* Read ID3 */
|
||||
|
||||
/* Level 2 Commands */
|
||||
#define LCD_RGB_INTERFACE 0xB0 /* RGB Interface Signal Control */
|
||||
#define LCD_FRMCTR1 0xB1 /* Frame Rate Control (In Normal Mode) */
|
||||
#define LCD_FRMCTR2 0xB2 /* Frame Rate Control (In Idle Mode) */
|
||||
#define LCD_FRMCTR3 0xB3 /* Frame Rate Control (In Partial Mode) */
|
||||
#define LCD_INVTR 0xB4 /* Display Inversion Control */
|
||||
#define LCD_BPC 0xB5 /* Blanking Porch Control register */
|
||||
#define LCD_DFC 0xB6 /* Display Function Control register */
|
||||
#define LCD_ETMOD 0xB7 /* Entry Mode Set */
|
||||
#define LCD_BACKLIGHT1 0xB8 /* Backlight Control 1 */
|
||||
#define LCD_BACKLIGHT2 0xB9 /* Backlight Control 2 */
|
||||
#define LCD_BACKLIGHT3 0xBA /* Backlight Control 3 */
|
||||
#define LCD_BACKLIGHT4 0xBB /* Backlight Control 4 */
|
||||
#define LCD_BACKLIGHT5 0xBC /* Backlight Control 5 */
|
||||
#define LCD_BACKLIGHT7 0xBE /* Backlight Control 7 */
|
||||
#define LCD_BACKLIGHT8 0xBF /* Backlight Control 8 */
|
||||
#define LCD_POWER1 0xC0 /* Power Control 1 register */
|
||||
#define LCD_POWER2 0xC1 /* Power Control 2 register */
|
||||
#define LCD_VCOM1 0xC5 /* VCOM Control 1 register */
|
||||
#define LCD_VCOM2 0xC7 /* VCOM Control 2 register */
|
||||
#define LCD_NVMWR 0xD0 /* NV Memory Write */
|
||||
#define LCD_NVMPKEY 0xD1 /* NV Memory Protection Key */
|
||||
#define LCD_RDNVM 0xD2 /* NV Memory Status Read */
|
||||
#define LCD_READ_ID4 0xD3 /* Read ID4 */
|
||||
#define LCD_PGAMMA 0xE0 /* Positive Gamma Correction register */
|
||||
#define LCD_NGAMMA 0xE1 /* Negative Gamma Correction register */
|
||||
#define LCD_DGAMCTRL1 0xE2 /* Digital Gamma Control 1 */
|
||||
#define LCD_DGAMCTRL2 0xE3 /* Digital Gamma Control 2 */
|
||||
#define LCD_INTERFACE 0xF6 /* Interface control register */
|
||||
|
||||
/* Extend register commands */
|
||||
#define LCD_POWERA 0xCB /* Power control A register */
|
||||
#define LCD_POWERB 0xCF /* Power control B register */
|
||||
#define LCD_DTCA 0xE8 /* Driver timing control A */
|
||||
#define LCD_DTCB 0xEA /* Driver timing control B */
|
||||
#define LCD_POWER_SEQ 0xED /* Power on sequence register */
|
||||
#define LCD_3GAMMA_EN 0xF2 /* 3 Gamma enable register */
|
||||
#define LCD_PRC 0xF7 /* Pump ratio control register */
|
||||
|
||||
/* Size of read registers */
|
||||
#define LCD_READ_ID4_SIZE 3 /* Size of Read ID4 */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ILI9341_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
void ili9341_Init(void);
|
||||
uint16_t ili9341_ReadID(void);
|
||||
void ili9341_WriteReg(uint8_t LCD_Reg);
|
||||
void ili9341_WriteData(uint16_t RegValue);
|
||||
uint32_t ili9341_ReadData(uint16_t RegValue, uint8_t ReadSize);
|
||||
void ili9341_DisplayOn(void);
|
||||
void ili9341_DisplayOff(void);
|
||||
uint16_t ili9341_GetLcdPixelWidth(void);
|
||||
uint16_t ili9341_GetLcdPixelHeight(void);
|
||||
|
||||
/* LCD driver structure */
|
||||
extern LCD_DrvTypeDef ili9341_drv;
|
||||
|
||||
/* LCD IO functions */
|
||||
void LCD_IO_Init(void);
|
||||
void LCD_IO_WriteData(uint16_t RegValue);
|
||||
void LCD_IO_WriteReg(uint8_t Reg);
|
||||
uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize);
|
||||
void LCD_Delay (uint32_t delay);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ILI9341_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: 'Bug report'
|
||||
about: 'Create a report to help us improve the quality of our software'
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Caution**
|
||||
|
||||
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
|
||||
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the **ST Community** in the STM32 MCUs dedicated [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
|
||||
**Describe the set-up**
|
||||
|
||||
* The board (either ST RPN reference or your custom board)
|
||||
* IDE or at least the compiler and its version
|
||||
|
||||
**Describe the bug (skip if none)**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce the bug (skip if none)**
|
||||
|
||||
1. Indicate the global behavior of your application project
|
||||
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
|
||||
3. Describe the use case that generates the problem
|
||||
4. How we can reproduce the problem
|
||||
|
||||
|
||||
**Additional context**
|
||||
|
||||
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
@@ -0,0 +1,3 @@
|
||||
## IMPORTANT INFORMATION
|
||||
|
||||
Pull-requests are **not** accepted on this repository. Please use issues to report any bug or request.
|
||||
@@ -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).
|
||||
@@ -0,0 +1,28 @@
|
||||
## Contributing guide
|
||||
|
||||
This document serves as a checklist before contributing to this repository.
|
||||
It includes links to read up on if topics are unclear to you.
|
||||
|
||||
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
|
||||
To report a bug or a request please file an issue in the right repository
|
||||
(example for [l3gd20](https://github.com/STMicroelectronics/l3gd20/issues/new/choose)).
|
||||
|
||||
Please check the following boxes 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, it should be submitted to the ST Community under the MCU topic [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
|
||||
### 2. Posting the issue
|
||||
When you have checked the previous boxes. You will find two templates (Bug Report or Other Issue) available in the **Issues** tab of the repository.
|
||||
|
||||
### 3. Pull Requests
|
||||
Pull-requests are **not** accepted on this repository. Please use **issues** to report any bug or request.
|
||||
|
||||
### 4. 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 for one new feature or proposal. This will ease the analysis and the final merge if accepted.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,40 @@
|
||||
# BSP L3GD20 Component
|
||||
|
||||
## Overview
|
||||
|
||||
**STM32Cube** is an STMicroelectronics original initiative to ease the 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 components 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 **l3gd20** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **L3GD20** BSP MEMS component part.
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2015 STMicroelectronics
|
||||
|
||||
This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this software except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
|
||||
|
||||
## Release note
|
||||
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/l3gd20/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.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/l3gd20/issues/new/choose).
|
||||
|
||||
For any other question related to the product, the tools, the environment, you can submit a topic to the [ST Community](https://community.st.com/s/).
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user