mirror of
https://github.com/Ai-Thinker-Open/Ai-Thinker-Open_RTL8710BX_ALIOS_SDK.git
synced 2025-07-31 19:31:05 +00:00
rel_1.6.0 init
This commit is contained in:
commit
27b3e2883d
19359 changed files with 8093121 additions and 0 deletions
14
Living_SDK/platform/mcu/stm32l475/B-L475E-IOT01.sct
Normal file
14
Living_SDK/platform/mcu/stm32l475/B-L475E-IOT01.sct
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LR_IROM1 0x08000000 0x00100000 { ; load region size_region
|
||||
ER_IROM1 0x08000000 0x00100000 { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
RW_IRAM1 0x20000000 0x0001F000 { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
|
@ -0,0 +1,178 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for B-L475E-IOT01 Board Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for B-L475E-IOT01 Board Drivers</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2017 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"> <span style="font-family: "Times New Roman";"> </span>
|
||||
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update
|
||||
History</span></h2>
|
||||
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 200px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 17-March-2017</span></h3>
|
||||
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
<ul style="margin-top: 0cm;" type="square">
|
||||
<li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">First official release </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-weight: bold; font-style: italic;"></span></span><span style="font-size: 10pt; font-family: Verdana;">for <span style="font-weight: bold; font-style: italic;">B-L475E-IOT01</span>
|
||||
BSP drivers.</span></li>
|
||||
</ul>
|
||||
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><span style="font-size: 12pt; color: white;">License<o:p></o:p></span></h2>
|
||||
<div style="text-align: justify;">
|
||||
<div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistribution and use in
|
||||
source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol>
|
||||
<li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source
|
||||
code must retain the above copyright notice, this list of conditions
|
||||
and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li>
|
||||
<li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or
|
||||
other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li>
|
||||
<li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of
|
||||
STMicroelectronics nor the names of its contributors may be used to
|
||||
endorse or promote products derived </span><br>
|
||||
</font> </li>
|
||||
</ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS
|
||||
SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE
|
||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY
|
||||
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.</span></font> </div>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span></div>
|
||||
<span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"></span>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,669 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief STM32L475E-IOT01 board support package
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01.h"
|
||||
/** @defgroup BSP BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01 STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_LOW_LEVEL LOW LEVEL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_LOW_LEVEL_Private_Defines LOW LEVEL Private Def
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief STM32L475E IOT01 BSP Driver version number V1.0.0
|
||||
*/
|
||||
#define __STM32L475E_IOT01_BSP_VERSION_MAIN (0x01) /*!< [31:24] main version */
|
||||
#define __STM32L475E_IOT01_BSP_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
|
||||
#define __STM32L475E_IOT01_BSP_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
|
||||
#define __STM32L475E_IOT01_BSP_VERSION_RC (0x00) /*!< [7:0] release candidate */
|
||||
#define __STM32L475E_IOT01_BSP_VERSION ((__STM32L475E_IOT01_BSP_VERSION_MAIN << 24)\
|
||||
|(__STM32L475E_IOT01_BSP_VERSION_SUB1 << 16)\
|
||||
|(__STM32L475E_IOT01_BSP_VERSION_SUB2 << 8 )\
|
||||
|(__STM32L475E_IOT01_BSP_VERSION_RC))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_LOW_LEVEL_Private_Variables LOW LEVEL Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
const uint32_t GPIO_PIN[LEDn] = {LED2_PIN};
|
||||
|
||||
|
||||
GPIO_TypeDef* GPIO_PORT[LEDn] = {LED2_GPIO_PORT};
|
||||
|
||||
|
||||
GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {USER_BUTTON_GPIO_PORT};
|
||||
|
||||
const uint16_t BUTTON_PIN[BUTTONn] = {USER_BUTTON_PIN};
|
||||
|
||||
const uint16_t BUTTON_IRQn[BUTTONn] = {USER_BUTTON_EXTI_IRQn};
|
||||
|
||||
USART_TypeDef* COM_USART[COMn] = {DISCOVERY_COM1,DISCOVERY_COM4};
|
||||
|
||||
GPIO_TypeDef* COM_TX_PORT[COMn] = {DISCOVERY_COM1_TX_GPIO_PORT,DISCOVERY_COM4_TX_GPIO_PORT};
|
||||
|
||||
GPIO_TypeDef* COM_RX_PORT[COMn] = {DISCOVERY_COM1_RX_GPIO_PORT,DISCOVERY_COM4_RX_GPIO_PORT};
|
||||
|
||||
const uint16_t COM_TX_PIN[COMn] = {DISCOVERY_COM1_TX_PIN,DISCOVERY_COM4_TX_PIN};
|
||||
|
||||
const uint16_t COM_RX_PIN[COMn] = {DISCOVERY_COM1_RX_PIN,DISCOVERY_COM4_RX_PIN};
|
||||
|
||||
const uint16_t COM_TX_AF[COMn] = {DISCOVERY_COM1_TX_AF,DISCOVERY_COM4_TX_AF};
|
||||
|
||||
const uint16_t COM_RX_AF[COMn] = {DISCOVERY_COM1_RX_AF,DISCOVERY_COM4_RX_AF};
|
||||
|
||||
I2C_HandleTypeDef hI2cHandler;
|
||||
UART_HandleTypeDef hDiscoUart;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/** @defgroup STM32L475E_IOT01_LOW_LEVEL_Private_FunctionPrototypes LOW LEVEL Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
static void I2Cx_MspInit(I2C_HandleTypeDef *i2c_handler);
|
||||
static void I2Cx_MspDeInit(I2C_HandleTypeDef *i2c_handler);
|
||||
static void I2Cx_Init(I2C_HandleTypeDef *i2c_handler);
|
||||
static void I2Cx_DeInit(I2C_HandleTypeDef *i2c_handler);
|
||||
static HAL_StatusTypeDef I2Cx_ReadMultiple(I2C_HandleTypeDef *i2c_handler, uint8_t Addr, uint16_t Reg, uint16_t MemAddSize, uint8_t *Buffer, uint16_t Length);
|
||||
static HAL_StatusTypeDef I2Cx_WriteMultiple(I2C_HandleTypeDef *i2c_handler, uint8_t Addr, uint16_t Reg, uint16_t MemAddSize, uint8_t *Buffer, uint16_t Length);
|
||||
static HAL_StatusTypeDef I2Cx_IsDeviceReady(I2C_HandleTypeDef *i2c_handler, uint16_t DevAddress, uint32_t Trials);
|
||||
static void I2Cx_Error(I2C_HandleTypeDef *i2c_handler, uint8_t Addr);
|
||||
|
||||
/* Sensors IO functions */
|
||||
void SENSOR_IO_Init(void);
|
||||
void SENSOR_IO_DeInit(void);
|
||||
void SENSOR_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
|
||||
uint8_t SENSOR_IO_Read(uint8_t Addr, uint8_t Reg);
|
||||
uint16_t SENSOR_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
void SENSOR_IO_WriteMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
HAL_StatusTypeDef SENSOR_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
|
||||
void SENSOR_IO_Delay(uint32_t Delay);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_LOW_LEVEL_Private_Functions LOW LEVEL Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This method returns the STM32L475E IOT01 BSP Driver revision
|
||||
* @retval version: 0xXYZR (8bits for each decimal, R for RC)
|
||||
*/
|
||||
uint32_t BSP_GetVersion(void)
|
||||
{
|
||||
return __STM32L475E_IOT01_BSP_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures LEDs.
|
||||
* @param Led: LED to be configured.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED2
|
||||
*/
|
||||
void BSP_LED_Init(Led_TypeDef Led)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
LEDx_GPIO_CLK_ENABLE(Led);
|
||||
/* Configure the GPIO_LED pin */
|
||||
gpio_init_structure.Pin = GPIO_PIN[Led];
|
||||
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_init_structure.Pull = GPIO_NOPULL;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
|
||||
HAL_GPIO_Init(GPIO_PORT[Led], &gpio_init_structure);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInit LEDs.
|
||||
* @param Led: LED to be configured.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED2
|
||||
*/
|
||||
void BSP_LED_DeInit(Led_TypeDef Led)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
/* DeInit the GPIO_LED pin */
|
||||
gpio_init_structure.Pin = GPIO_PIN[Led];
|
||||
|
||||
/* Turn off LED */
|
||||
HAL_GPIO_WritePin(GPIO_PORT[Led], GPIO_PIN[Led], GPIO_PIN_RESET);
|
||||
HAL_GPIO_DeInit(GPIO_PORT[Led], gpio_init_structure.Pin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turns selected LED On.
|
||||
* @param Led: LED to be set on
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED2
|
||||
*/
|
||||
void BSP_LED_On(Led_TypeDef Led)
|
||||
{
|
||||
HAL_GPIO_WritePin(GPIO_PORT[Led], GPIO_PIN[Led], GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turns selected LED Off.
|
||||
* @param Led: LED to be set off
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED2
|
||||
*/
|
||||
void BSP_LED_Off(Led_TypeDef Led)
|
||||
{
|
||||
HAL_GPIO_WritePin(GPIO_PORT[Led], GPIO_PIN[Led], GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggles the selected LED.
|
||||
* @param Led: LED to be toggled
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED2
|
||||
*/
|
||||
void BSP_LED_Toggle(Led_TypeDef Led)
|
||||
{
|
||||
HAL_GPIO_TogglePin(GPIO_PORT[Led], GPIO_PIN[Led]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures button GPIO and EXTI Line.
|
||||
* @param Button: Button to be configured
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_WAKEUP: Wakeup Push Button
|
||||
* @param ButtonMode: Button mode
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_MODE_GPIO: Button will be used as simple IO
|
||||
* @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line
|
||||
* with interrupt generation capability
|
||||
*/
|
||||
void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
/* Enable the BUTTON clock */
|
||||
USER_BUTTON_GPIO_CLK_ENABLE();
|
||||
|
||||
if(ButtonMode == BUTTON_MODE_GPIO)
|
||||
{
|
||||
/* Configure Button pin as input */
|
||||
gpio_init_structure.Pin = BUTTON_PIN[Button];
|
||||
gpio_init_structure.Mode = GPIO_MODE_INPUT;
|
||||
gpio_init_structure.Pull = GPIO_PULLUP;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
|
||||
}
|
||||
|
||||
if(ButtonMode == BUTTON_MODE_EXTI)
|
||||
{
|
||||
/* Configure Button pin as input with External interrupt */
|
||||
gpio_init_structure.Pin = BUTTON_PIN[Button];
|
||||
gpio_init_structure.Pull = GPIO_PULLUP;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
|
||||
gpio_init_structure.Mode = GPIO_MODE_IT_RISING;
|
||||
|
||||
HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
|
||||
|
||||
/* Enable and set Button EXTI Interrupt to the lowest priority */
|
||||
HAL_NVIC_SetPriority((IRQn_Type)(BUTTON_IRQn[Button]), 0x0F, 0x00);
|
||||
HAL_NVIC_EnableIRQ((IRQn_Type)(BUTTON_IRQn[Button]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Push Button DeInit.
|
||||
* @param Button: Button to be configured
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_WAKEUP: Wakeup Push Button
|
||||
* @note PB DeInit does not disable the GPIO clock
|
||||
*/
|
||||
void BSP_PB_DeInit(Button_TypeDef Button)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
gpio_init_structure.Pin = BUTTON_PIN[Button];
|
||||
HAL_NVIC_DisableIRQ((IRQn_Type)(BUTTON_IRQn[Button]));
|
||||
HAL_GPIO_DeInit(BUTTON_PORT[Button], gpio_init_structure.Pin);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns the selected button state.
|
||||
* @param Button: Button to be checked
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_WAKEUP: Wakeup Push Button
|
||||
* @retval The Button GPIO pin value (GPIO_PIN_RESET = button pressed)
|
||||
*/
|
||||
uint32_t BSP_PB_GetState(Button_TypeDef Button)
|
||||
{
|
||||
return HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures COM port.
|
||||
* @param COM: COM port to be configured.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg COM1
|
||||
* @param huart: Pointer to a UART_HandleTypeDef structure that contains the
|
||||
* configuration information for the specified USART peripheral.
|
||||
*/
|
||||
void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *huart)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
/* Enable GPIO clock */
|
||||
DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(COM);
|
||||
DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(COM);
|
||||
|
||||
/* Enable USART clock */
|
||||
DISCOVERY_COMx_CLK_ENABLE(COM);
|
||||
|
||||
/* Configure USART Tx as alternate function */
|
||||
gpio_init_structure.Pin = COM_TX_PIN[COM];
|
||||
gpio_init_structure.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
gpio_init_structure.Pull = GPIO_NOPULL;
|
||||
gpio_init_structure.Alternate = COM_TX_AF[COM];
|
||||
HAL_GPIO_Init(COM_TX_PORT[COM], &gpio_init_structure);
|
||||
|
||||
/* Configure USART Rx as alternate function */
|
||||
gpio_init_structure.Pin = COM_RX_PIN[COM];
|
||||
gpio_init_structure.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_init_structure.Alternate = COM_RX_AF[COM];
|
||||
HAL_GPIO_Init(COM_RX_PORT[COM], &gpio_init_structure);
|
||||
|
||||
/* USART configuration */
|
||||
huart->Instance = COM_USART[COM];
|
||||
HAL_UART_Init(huart);
|
||||
|
||||
/* Configure the NVIC for UART */
|
||||
/* NVIC for USART */
|
||||
if(COM==COM1){
|
||||
HAL_NVIC_SetPriority(USART1_IRQn, 0, 1);
|
||||
HAL_NVIC_EnableIRQ(USART1_IRQn);
|
||||
}else if(COM==COM4){
|
||||
HAL_NVIC_SetPriority(UART4_IRQn, 0, 1);
|
||||
HAL_NVIC_EnableIRQ(UART4_IRQn);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInit COM port.
|
||||
* @param COM: COM port to be configured.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg COM1
|
||||
* @param huart: Pointer to a UART_HandleTypeDef structure that contains the
|
||||
* configuration information for the specified USART peripheral.
|
||||
*/
|
||||
void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart)
|
||||
{
|
||||
/* USART configuration */
|
||||
huart->Instance = COM_USART[COM];
|
||||
HAL_UART_DeInit(huart);
|
||||
|
||||
/* Enable USART clock */
|
||||
DISCOVERY_COMx_CLK_DISABLE(COM);
|
||||
|
||||
/* DeInit GPIO pins can be done in the application
|
||||
(by surcharging this __weak function) */
|
||||
|
||||
/* GPIO pins clock, FMC clock and DMA clock can be shut down in the application
|
||||
by surcharging this __weak function */
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
BUS OPERATIONS
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************* I2C Routines *********************************/
|
||||
/**
|
||||
* @brief Initializes I2C MSP.
|
||||
* @param i2c_handler : I2C handler
|
||||
* @retval None
|
||||
*/
|
||||
static void I2Cx_MspInit(I2C_HandleTypeDef *i2c_handler)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
/*** Configure the GPIOs ***/
|
||||
/* Enable GPIO clock */
|
||||
DISCOVERY_I2Cx_SCL_SDA_GPIO_CLK_ENABLE();
|
||||
|
||||
/* Configure I2C Tx, Rx as alternate function */
|
||||
gpio_init_structure.Pin = DISCOVERY_I2Cx_SCL_PIN | DISCOVERY_I2Cx_SDA_PIN;
|
||||
gpio_init_structure.Mode = GPIO_MODE_AF_OD;
|
||||
gpio_init_structure.Pull = GPIO_PULLUP;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
gpio_init_structure.Alternate = DISCOVERY_I2Cx_SCL_SDA_AF;
|
||||
HAL_GPIO_Init(DISCOVERY_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
|
||||
|
||||
HAL_GPIO_Init(DISCOVERY_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
|
||||
|
||||
/*** Configure the I2C peripheral ***/
|
||||
/* Enable I2C clock */
|
||||
DISCOVERY_I2Cx_CLK_ENABLE();
|
||||
|
||||
/* Force the I2C peripheral clock reset */
|
||||
DISCOVERY_I2Cx_FORCE_RESET();
|
||||
|
||||
/* Release the I2C peripheral clock reset */
|
||||
DISCOVERY_I2Cx_RELEASE_RESET();
|
||||
|
||||
/* Enable and set I2Cx Interrupt to a lower priority */
|
||||
HAL_NVIC_SetPriority(DISCOVERY_I2Cx_EV_IRQn, 0x0F, 0);
|
||||
HAL_NVIC_EnableIRQ(DISCOVERY_I2Cx_EV_IRQn);
|
||||
|
||||
/* Enable and set I2Cx Interrupt to a lower priority */
|
||||
HAL_NVIC_SetPriority(DISCOVERY_I2Cx_ER_IRQn, 0x0F, 0);
|
||||
HAL_NVIC_EnableIRQ(DISCOVERY_I2Cx_ER_IRQn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitializes I2C MSP.
|
||||
* @param i2c_handler : I2C handler
|
||||
* @retval None
|
||||
*/
|
||||
static void I2Cx_MspDeInit(I2C_HandleTypeDef *i2c_handler)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
/* Configure I2C Tx, Rx as alternate function */
|
||||
gpio_init_structure.Pin = DISCOVERY_I2Cx_SCL_PIN | DISCOVERY_I2Cx_SDA_PIN;
|
||||
HAL_GPIO_DeInit(DISCOVERY_I2Cx_SCL_SDA_GPIO_PORT, gpio_init_structure.Pin);
|
||||
/* Disable GPIO clock */
|
||||
DISCOVERY_I2Cx_SCL_SDA_GPIO_CLK_DISABLE();
|
||||
|
||||
/* Disable I2C clock */
|
||||
DISCOVERY_I2Cx_CLK_DISABLE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes I2C HAL.
|
||||
* @param i2c_handler : I2C handler
|
||||
* @retval None
|
||||
*/
|
||||
static void I2Cx_Init(I2C_HandleTypeDef *i2c_handler)
|
||||
{
|
||||
/* I2C configuration */
|
||||
i2c_handler->Instance = DISCOVERY_I2Cx;
|
||||
i2c_handler->Init.Timing = DISCOVERY_I2Cx_TIMING;
|
||||
i2c_handler->Init.OwnAddress1 = 0;
|
||||
i2c_handler->Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||
i2c_handler->Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
||||
i2c_handler->Init.OwnAddress2 = 0;
|
||||
i2c_handler->Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||
i2c_handler->Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||
|
||||
/* Init the I2C */
|
||||
I2Cx_MspInit(i2c_handler);
|
||||
HAL_I2C_Init(i2c_handler);
|
||||
|
||||
/**Configure Analogue filter */
|
||||
HAL_I2CEx_ConfigAnalogFilter(i2c_handler, I2C_ANALOGFILTER_ENABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitializes I2C HAL.
|
||||
* @param i2c_handler : I2C handler
|
||||
* @retval None
|
||||
*/
|
||||
static void I2Cx_DeInit(I2C_HandleTypeDef *i2c_handler)
|
||||
{ /* DeInit the I2C */
|
||||
I2Cx_MspDeInit(i2c_handler);
|
||||
HAL_I2C_DeInit(i2c_handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads multiple data.
|
||||
* @param i2c_handler : I2C handler
|
||||
* @param Addr: I2C address
|
||||
* @param Reg: Reg address
|
||||
* @param MemAddress: memory address
|
||||
* @param Buffer: Pointer to data buffer
|
||||
* @param Length: Length of the data
|
||||
* @retval HAL status
|
||||
*/
|
||||
static HAL_StatusTypeDef I2Cx_ReadMultiple(I2C_HandleTypeDef *i2c_handler, uint8_t Addr, uint16_t Reg, uint16_t MemAddress, uint8_t *Buffer, uint16_t Length)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
|
||||
status = HAL_I2C_Mem_Read(i2c_handler, Addr, (uint16_t)Reg, MemAddress, Buffer, Length, 1000);
|
||||
|
||||
/* Check the communication status */
|
||||
if(status != HAL_OK)
|
||||
{
|
||||
/* I2C error occured */
|
||||
I2Cx_Error(i2c_handler, Addr);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Writes a value in a register of the device through BUS in using DMA mode.
|
||||
* @param i2c_handler : I2C handler
|
||||
* @param Addr: Device address on BUS Bus.
|
||||
* @param Reg: The target register address to write
|
||||
* @param MemAddress: memory address
|
||||
* @param Buffer: The target register value to be written
|
||||
* @param Length: buffer size to be written
|
||||
* @retval HAL status
|
||||
*/
|
||||
static HAL_StatusTypeDef I2Cx_WriteMultiple(I2C_HandleTypeDef *i2c_handler, uint8_t Addr, uint16_t Reg, uint16_t MemAddress, uint8_t *Buffer, uint16_t Length)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
|
||||
status = HAL_I2C_Mem_Write(i2c_handler, Addr, (uint16_t)Reg, MemAddress, Buffer, Length, 1000);
|
||||
|
||||
/* Check the communication status */
|
||||
if(status != HAL_OK)
|
||||
{
|
||||
/* Re-Initiaize the I2C Bus */
|
||||
I2Cx_Error(i2c_handler, Addr);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks if target device is ready for communication.
|
||||
* @note This function is used with Memory devices
|
||||
* @param i2c_handler : I2C handler
|
||||
* @param DevAddress: Target device address
|
||||
* @param Trials: Number of trials
|
||||
* @retval HAL status
|
||||
*/
|
||||
static HAL_StatusTypeDef I2Cx_IsDeviceReady(I2C_HandleTypeDef *i2c_handler, uint16_t DevAddress, uint32_t Trials)
|
||||
{
|
||||
return (HAL_I2C_IsDeviceReady(i2c_handler, DevAddress, Trials, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Manages error callback by re-initializing I2C.
|
||||
* @param i2c_handler : I2C handler
|
||||
* @param Addr: I2C Address
|
||||
* @retval None
|
||||
*/
|
||||
static void I2Cx_Error(I2C_HandleTypeDef *i2c_handler, uint8_t Addr)
|
||||
{
|
||||
/* De-initialize the I2C communication bus */
|
||||
HAL_I2C_DeInit(i2c_handler);
|
||||
|
||||
/* Re-Initialize the I2C communication bus */
|
||||
I2Cx_Init(i2c_handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
LINK OPERATIONS
|
||||
*******************************************************************************/
|
||||
/******************************** LINK Sensors ********************************/
|
||||
|
||||
/**
|
||||
* @brief Initializes Sensors low level.
|
||||
* @retval None
|
||||
*/
|
||||
void SENSOR_IO_Init(void)
|
||||
{
|
||||
I2Cx_Init(&hI2cHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitializes Sensors low level.
|
||||
* @retval None
|
||||
*/
|
||||
void SENSOR_IO_DeInit(void)
|
||||
{
|
||||
I2Cx_DeInit(&hI2cHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes a single data.
|
||||
* @param Addr: I2C address
|
||||
* @param Reg: Reg address
|
||||
* @param Value: Data to be written
|
||||
* @retval None
|
||||
*/
|
||||
void SENSOR_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
|
||||
{
|
||||
I2Cx_WriteMultiple(&hI2cHandler, Addr, (uint16_t)Reg, I2C_MEMADD_SIZE_8BIT,(uint8_t*)&Value, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads a single data.
|
||||
* @param Addr: I2C address
|
||||
* @param Reg: Reg address
|
||||
* @retval Data to be read
|
||||
*/
|
||||
uint8_t SENSOR_IO_Read(uint8_t Addr, uint8_t Reg)
|
||||
{
|
||||
uint8_t read_value = 0;
|
||||
|
||||
I2Cx_ReadMultiple(&hI2cHandler, Addr, Reg, I2C_MEMADD_SIZE_8BIT, (uint8_t*)&read_value, 1);
|
||||
|
||||
return read_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads multiple data with I2C communication
|
||||
* channel from TouchScreen.
|
||||
* @param Addr: I2C address
|
||||
* @param Reg: Register address
|
||||
* @param Buffer: Pointer to data buffer
|
||||
* @param Length: Length of the data
|
||||
* @retval HAL status
|
||||
*/
|
||||
uint16_t SENSOR_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length)
|
||||
{
|
||||
return I2Cx_ReadMultiple(&hI2cHandler, Addr, (uint16_t)Reg, I2C_MEMADD_SIZE_8BIT, Buffer, Length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes multiple data with I2C communication
|
||||
* channel from MCU to TouchScreen.
|
||||
* @param Addr: I2C address
|
||||
* @param Reg: Register address
|
||||
* @param Buffer: Pointer to data buffer
|
||||
* @param Length: Length of the data
|
||||
* @retval None
|
||||
*/
|
||||
void SENSOR_IO_WriteMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length)
|
||||
{
|
||||
I2Cx_WriteMultiple(&hI2cHandler, Addr, (uint16_t)Reg, I2C_MEMADD_SIZE_8BIT, Buffer, Length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks if target device is ready for communication.
|
||||
* @note This function is used with Memory devices
|
||||
* @param DevAddress: Target device address
|
||||
* @param Trials: Number of trials
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef SENSOR_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials)
|
||||
{
|
||||
return (I2Cx_IsDeviceReady(&hI2cHandler, DevAddress, Trials));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delay function used in TouchScreen low level driver.
|
||||
* @param Delay: Delay in ms
|
||||
* @retval None
|
||||
*/
|
||||
void SENSOR_IO_Delay(uint32_t Delay)
|
||||
{
|
||||
HAL_Delay(Delay);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,294 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief STM32L475E IOT01 board support package
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS 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 __STM32L475E_IOT01_H
|
||||
#define __STM32L475E_IOT01_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l4xx_hal.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01_LOW_LEVEL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LED2 = 0,
|
||||
LED_GREEN = LED2,
|
||||
}Led_TypeDef;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_USER = 0
|
||||
}Button_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_MODE_GPIO = 0,
|
||||
BUTTON_MODE_EXTI = 1
|
||||
}ButtonMode_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM1 = 0,
|
||||
COM4 = 1,
|
||||
}COM_TypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_LOW_LEVEL_Exported_Constants LOW LEVEL Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Define for STM32L475E_IOT01 board
|
||||
*/
|
||||
#if !defined (USE_STM32L475E_IOT01)
|
||||
#define USE_STM32L475E_IOT01
|
||||
#endif
|
||||
|
||||
#define LEDn ((uint8_t)1)
|
||||
|
||||
#define LED2_PIN GPIO_PIN_14
|
||||
#define LED2_GPIO_PORT GPIOB
|
||||
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
|
||||
|
||||
|
||||
#define LEDx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) LED2_GPIO_CLK_ENABLE();}while(0)
|
||||
|
||||
#define LEDx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) LED2_GPIO_CLK_DISABLE();}while(0)
|
||||
|
||||
/* Only one User/Wakeup button */
|
||||
#define BUTTONn ((uint8_t)1)
|
||||
|
||||
/**
|
||||
* @brief Wakeup push-button
|
||||
*/
|
||||
#define USER_BUTTON_PIN GPIO_PIN_13
|
||||
#define USER_BUTTON_GPIO_PORT GPIOC
|
||||
#define USER_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define USER_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
#define USER_BUTTON_EXTI_IRQn EXTI15_10_IRQn
|
||||
|
||||
|
||||
|
||||
#define COMn ((uint8_t)2)
|
||||
|
||||
/**
|
||||
* @brief Definition for COM port1, connected to USART1
|
||||
*/
|
||||
#define DISCOVERY_COM1 USART1
|
||||
#define DISCOVERY_COM1_CLK_ENABLE() __HAL_RCC_USART1_CLK_ENABLE()
|
||||
#define DISCOVERY_COM1_CLK_DISABLE() __HAL_RCC_USART1_CLK_DISABLE()
|
||||
|
||||
#define DISCOVERY_COM1_TX_PIN GPIO_PIN_6
|
||||
#define DISCOVERY_COM1_TX_GPIO_PORT GPIOB
|
||||
#define DISCOVERY_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#define DISCOVERY_COM1_TX_AF GPIO_AF7_USART1
|
||||
|
||||
#define DISCOVERY_COM1_RX_PIN GPIO_PIN_7
|
||||
#define DISCOVERY_COM1_RX_GPIO_PORT GPIOB
|
||||
#define DISCOVERY_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#define DISCOVERY_COM1_RX_AF GPIO_AF7_USART1
|
||||
|
||||
#define DISCOVERY_COM1_IRQn USART1_IRQn
|
||||
|
||||
|
||||
/**
|
||||
* @brief Definition for COM port4, connected to USART4
|
||||
*/
|
||||
#define DISCOVERY_COM4 UART4
|
||||
#define DISCOVERY_COM4_CLK_ENABLE() __HAL_RCC_UART4_CLK_ENABLE()
|
||||
#define DISCOVERY_COM4_CLK_DISABLE() __HAL_RCC_UART4_CLK_DISABLE()
|
||||
|
||||
#define DISCOVERY_COM4_TX_PIN GPIO_PIN_1
|
||||
#define DISCOVERY_COM4_TX_GPIO_PORT GPIOA
|
||||
#define DISCOVERY_COM4_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define DISCOVERY_COM4_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define DISCOVERY_COM4_TX_AF GPIO_AF8_UART4
|
||||
|
||||
#define DISCOVERY_COM4_RX_PIN GPIO_PIN_0
|
||||
#define DISCOVERY_COM4_RX_GPIO_PORT GPIOA
|
||||
#define DISCOVERY_COM4_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define DISCOVERY_COM4_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define DISCOVERY_COM4_RX_AF GPIO_AF8_UART4
|
||||
|
||||
#define DISCOVERY_COM4_IRQn UART4_IRQn
|
||||
|
||||
#define DISCOVERY_COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_ENABLE();} \
|
||||
else if((__INDEX__) == COM4) {DISCOVERY_COM4_CLK_ENABLE();}} while(0)
|
||||
#define DISCOVERY_COMx_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_DISABLE();} \
|
||||
else if((__INDEX__) == COM4) {DISCOVERY_COM4_CLK_DISABLE();}} while(0)
|
||||
|
||||
#define DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_ENABLE();} \
|
||||
else if((__INDEX__) == COM4) {DISCOVERY_COM4_TX_GPIO_CLK_ENABLE();}} while(0)
|
||||
#define DISCOVERY_COMx_TX_GPIO_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_DISABLE();} \
|
||||
else if((__INDEX__) == COM4) {DISCOVERY_COM4_TX_GPIO_CLK_DISABLE();}} while(0)
|
||||
|
||||
#define DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_ENABLE();} \
|
||||
else if((__INDEX__) == COM4) {DISCOVERY_COM4_RX_GPIO_CLK_ENABLE();}} while(0)
|
||||
#define DISCOVERY_COMx_RX_GPIO_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_DISABLE();} \
|
||||
else if((__INDEX__) == COM4) {DISCOVERY_COM4_RX_GPIO_CLK_DISABLE();}} while(0)
|
||||
|
||||
|
||||
|
||||
/* User can use this section to tailor I2Cx instance used and associated resources */
|
||||
/* Definition for I2Cx resources */
|
||||
#define DISCOVERY_I2Cx I2C2
|
||||
#define DISCOVERY_I2Cx_CLK_ENABLE() __HAL_RCC_I2C2_CLK_ENABLE()
|
||||
#define DISCOVERY_I2Cx_CLK_DISABLE() __HAL_RCC_I2C2_CLK_DISABLE()
|
||||
#define DISCOVERY_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
|
||||
#define DISCOVERY_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define DISCOVERY_I2Cx_SCL_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
|
||||
#define DISCOVERY_I2Cx_FORCE_RESET() __HAL_RCC_I2C2_FORCE_RESET()
|
||||
#define DISCOVERY_I2Cx_RELEASE_RESET() __HAL_RCC_I2C2_RELEASE_RESET()
|
||||
|
||||
/* Definition for I2Cx Pins */
|
||||
#define DISCOVERY_I2Cx_SCL_PIN GPIO_PIN_10
|
||||
#define DISCOVERY_I2Cx_SDA_PIN GPIO_PIN_11
|
||||
#define DISCOVERY_I2Cx_SCL_SDA_GPIO_PORT GPIOB
|
||||
#define DISCOVERY_I2Cx_SCL_SDA_AF GPIO_AF4_I2C2
|
||||
|
||||
/* I2C interrupt requests */
|
||||
#define DISCOVERY_I2Cx_EV_IRQn I2C2_EV_IRQn
|
||||
#define DISCOVERY_I2Cx_ER_IRQn I2C2_ER_IRQn
|
||||
|
||||
/* I2C clock speed configuration (in Hz)
|
||||
WARNING:
|
||||
Make sure that this define is not already declared in other files.
|
||||
It can be used in parallel by other modules. */
|
||||
#ifndef DISCOVERY_I2C_SPEED
|
||||
#define DISCOVERY_I2C_SPEED 100000
|
||||
#endif /* DISCOVERY_I2C_SPEED */
|
||||
|
||||
#ifndef DISCOVERY_I2Cx_TIMING
|
||||
#define DISCOVERY_I2Cx_TIMING ((uint32_t)0x00702681)
|
||||
#endif /* DISCOVERY_I2Cx_TIMING */
|
||||
|
||||
|
||||
/* I2C Sensors address */
|
||||
/* LPS22HB (Pressure) I2C Address */
|
||||
#define LPS22HB_I2C_ADDRESS (uint8_t)0xBA
|
||||
/* HTS221 (Humidity) I2C Address */
|
||||
#define HTS221_I2C_ADDRESS (uint8_t)0xBE
|
||||
|
||||
#ifdef USE_LPS22HB_TEMP
|
||||
/* LPS22HB Sensor hardware I2C address */
|
||||
#define TSENSOR_I2C_ADDRESS LPS22HB_I2C_ADDRESS
|
||||
#else /* USE_HTS221_TEMP */
|
||||
/* HTS221 Sensor hardware I2C address */
|
||||
#define TSENSOR_I2C_ADDRESS HTS221_I2C_ADDRESS
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_LOW_LEVEL_Exported_Functions LOW LEVEL Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint32_t BSP_GetVersion(void);
|
||||
void BSP_LED_Init(Led_TypeDef Led);
|
||||
void BSP_LED_DeInit(Led_TypeDef Led);
|
||||
void BSP_LED_On(Led_TypeDef Led);
|
||||
void BSP_LED_Off(Led_TypeDef Led);
|
||||
void BSP_LED_Toggle(Led_TypeDef Led);
|
||||
void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
|
||||
void BSP_PB_DeInit(Button_TypeDef Button);
|
||||
uint32_t BSP_PB_GetState(Button_TypeDef Button);
|
||||
void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart);
|
||||
void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L475E_IOT01_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_accelero.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the accelerometer sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01_accelero.h"
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_ACCELERO ACCELERO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_ACCELERO_Private_Variables ACCELERO Private Variables
|
||||
* @{
|
||||
*/
|
||||
static ACCELERO_DrvTypeDef *AccelerometerDrv;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_ACCELERO_Private_Functions ACCELERO Private Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Initialize the ACCELERO.
|
||||
* @retval ACCELERO_OK or ACCELERO_ERROR
|
||||
*/
|
||||
ACCELERO_StatusTypeDef BSP_ACCELERO_Init(void)
|
||||
{
|
||||
ACCELERO_StatusTypeDef ret = ACCELERO_OK;
|
||||
uint16_t ctrl = 0x0000;
|
||||
ACCELERO_InitTypeDef LSM6DSL_InitStructure;
|
||||
|
||||
if(Lsm6dslAccDrv.ReadID() != LSM6DSL_ACC_GYRO_WHO_AM_I)
|
||||
{
|
||||
ret = ACCELERO_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Initialize the ACCELERO accelerometer driver structure */
|
||||
AccelerometerDrv = &Lsm6dslAccDrv;
|
||||
|
||||
/* MEMS configuration ------------------------------------------------------*/
|
||||
/* Fill the ACCELERO accelerometer structure */
|
||||
LSM6DSL_InitStructure.AccOutput_DataRate = LSM6DSL_ODR_52Hz;
|
||||
LSM6DSL_InitStructure.Axes_Enable = 0;
|
||||
LSM6DSL_InitStructure.AccFull_Scale = LSM6DSL_ACC_FULLSCALE_2G;
|
||||
LSM6DSL_InitStructure.BlockData_Update = LSM6DSL_BDU_BLOCK_UPDATE;
|
||||
LSM6DSL_InitStructure.High_Resolution = 0;
|
||||
LSM6DSL_InitStructure.Communication_Mode = 0;
|
||||
|
||||
/* Configure MEMS: data rate, full scale */
|
||||
ctrl = (LSM6DSL_InitStructure.AccOutput_DataRate | LSM6DSL_InitStructure.AccFull_Scale);
|
||||
|
||||
/* Configure MEMS: BDU and Auto-increment for multi read/write */
|
||||
ctrl |= ((LSM6DSL_InitStructure.BlockData_Update | LSM6DSL_ACC_GYRO_IF_INC_ENABLED) << 8);
|
||||
|
||||
/* Configure the ACCELERO accelerometer main parameters */
|
||||
AccelerometerDrv->Init(ctrl);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitialize the ACCELERO.
|
||||
* @retval None.
|
||||
*/
|
||||
void BSP_ACCELERO_DeInit(void)
|
||||
{
|
||||
/* DeInitialize the accelerometer IO interfaces */
|
||||
if(AccelerometerDrv != NULL)
|
||||
{
|
||||
if(AccelerometerDrv->DeInit != NULL)
|
||||
{
|
||||
AccelerometerDrv->DeInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set/Unset the ACCELERO in low power mode.
|
||||
* @param status 0 means disable Low Power Mode, otherwise Low Power Mode is enabled
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_ACCELERO_LowPower(uint16_t status)
|
||||
{
|
||||
/* Set/Unset the ACCELERO in low power mode */
|
||||
if(AccelerometerDrv != NULL)
|
||||
{
|
||||
if(AccelerometerDrv->LowPower != NULL)
|
||||
{
|
||||
AccelerometerDrv->LowPower(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get XYZ acceleration values.
|
||||
* @param pDataXYZ Pointer on 3 angular accelerations table with
|
||||
* pDataXYZ[0] = X axis, pDataXYZ[1] = Y axis, pDataXYZ[2] = Z axis
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_ACCELERO_AccGetXYZ(int16_t *pDataXYZ)
|
||||
{
|
||||
if(AccelerometerDrv != NULL)
|
||||
{
|
||||
if(AccelerometerDrv->GetXYZ != NULL)
|
||||
{
|
||||
AccelerometerDrv->GetXYZ(pDataXYZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_accelero.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the accelerometer sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS 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 __STM32L475E_IOT01_ACCELERO_H
|
||||
#define __STM32L475E_IOT01_ACCELERO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01.h"
|
||||
/* Include Accelero component driver */
|
||||
#include "../Components/lsm6dsl/lsm6dsl.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01_ACCELERO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475_DISCOVERY_ACCELERO_Exported_Types ACCELERO Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ACCELERO_OK = 0,
|
||||
ACCELERO_ERROR = 1,
|
||||
ACCELERO_TIMEOUT = 2
|
||||
}
|
||||
ACCELERO_StatusTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_ACCELERO_Exported_Functions ACCELERO Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/* Sensor Configuration Functions */
|
||||
ACCELERO_StatusTypeDef BSP_ACCELERO_Init(void);
|
||||
void BSP_ACCELERO_DeInit(void);
|
||||
void BSP_ACCELERO_LowPower(uint16_t status); /* 0 Means Disable Low Power Mode, otherwise Low Power Mode is enabled */
|
||||
void BSP_ACCELERO_AccGetXYZ(int16_t *pDataXYZ);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L475E_IOT01_ACCELERO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_gyro.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the gyroscope sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01_gyro.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_GYROSCOPE GYROSCOPE
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_GYROSCOPE_Private_Variables GYROSCOPE Private Variables
|
||||
* @{
|
||||
*/
|
||||
static GYRO_DrvTypeDef *GyroscopeDrv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_GYROSCOPE_Private_Functions GYROSCOPE Private Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Initialize Gyroscope.
|
||||
* @retval GYRO_OK or GYRO_ERROR
|
||||
*/
|
||||
uint8_t BSP_GYRO_Init(void)
|
||||
{
|
||||
uint8_t ret = GYRO_ERROR;
|
||||
uint16_t ctrl = 0x0000;
|
||||
GYRO_InitTypeDef LSM6DSL_InitStructure;
|
||||
|
||||
if(Lsm6dslGyroDrv.ReadID() != LSM6DSL_ACC_GYRO_WHO_AM_I)
|
||||
{
|
||||
ret = GYRO_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Initialize the gyroscope driver structure */
|
||||
GyroscopeDrv = &Lsm6dslGyroDrv;
|
||||
|
||||
/* Configure Mems : data rate, power mode, full scale and axes */
|
||||
LSM6DSL_InitStructure.Power_Mode = 0;
|
||||
LSM6DSL_InitStructure.Output_DataRate = LSM6DSL_ODR_52Hz;
|
||||
LSM6DSL_InitStructure.Axes_Enable = 0;
|
||||
LSM6DSL_InitStructure.Band_Width = 0;
|
||||
LSM6DSL_InitStructure.BlockData_Update = LSM6DSL_BDU_BLOCK_UPDATE;
|
||||
LSM6DSL_InitStructure.Endianness = 0;
|
||||
LSM6DSL_InitStructure.Full_Scale = LSM6DSL_GYRO_FS_2000;
|
||||
|
||||
/* Configure MEMS: data rate, full scale */
|
||||
ctrl = (LSM6DSL_InitStructure.Full_Scale | LSM6DSL_InitStructure.Output_DataRate);
|
||||
|
||||
/* Configure MEMS: BDU and Auto-increment for multi read/write */
|
||||
ctrl |= ((LSM6DSL_InitStructure.BlockData_Update | LSM6DSL_ACC_GYRO_IF_INC_ENABLED) << 8);
|
||||
|
||||
/* Initialize component */
|
||||
GyroscopeDrv->Init(ctrl);
|
||||
|
||||
ret = GYRO_OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief DeInitialize Gyroscope.
|
||||
*/
|
||||
void BSP_GYRO_DeInit(void)
|
||||
{
|
||||
/* DeInitialize the Gyroscope IO interfaces */
|
||||
if(GyroscopeDrv != NULL)
|
||||
{
|
||||
if(GyroscopeDrv->DeInit!= NULL)
|
||||
{
|
||||
GyroscopeDrv->DeInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set/Unset Gyroscope in low power mode.
|
||||
* @param status 0 means disable Low Power Mode, otherwise Low Power Mode is enabled
|
||||
*/
|
||||
void BSP_GYRO_LowPower(uint16_t status)
|
||||
{
|
||||
/* Set/Unset component in low-power mode */
|
||||
if(GyroscopeDrv != NULL)
|
||||
{
|
||||
if(GyroscopeDrv->LowPower!= NULL)
|
||||
{
|
||||
GyroscopeDrv->LowPower(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get XYZ angular acceleration from the Gyroscope.
|
||||
* @param pfData: pointer on floating array
|
||||
*/
|
||||
void BSP_GYRO_GetXYZ(float* pfData)
|
||||
{
|
||||
if(GyroscopeDrv != NULL)
|
||||
{
|
||||
if(GyroscopeDrv->GetXYZ!= NULL)
|
||||
{
|
||||
GyroscopeDrv->GetXYZ(pfData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_gyro.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file contains definitions for the stm32l475e_iot01_gyro.c
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS 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 __STM32L475E_IOT01_GYRO_H
|
||||
#define __STM32L475E_IOT01_GYRO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01.h"
|
||||
/* Include Gyro component driver */
|
||||
#include "../Components/lsm6dsl/lsm6dsl.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01_GYROSCOPE
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475_IOT01_GYROSCOPE_Exported_Constants GYROSCOPE Exported Constants
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GYRO_OK = 0,
|
||||
GYRO_ERROR = 1,
|
||||
GYRO_TIMEOUT = 2
|
||||
}
|
||||
GYRO_StatusTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_GYROSCOPE_Exported_Functions GYROSCOPE Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_GYRO_Init(void);
|
||||
void BSP_GYRO_DeInit(void);
|
||||
void BSP_GYRO_LowPower(uint16_t status); /* 0 Means Disable Low Power Mode, otherwise Low Power Mode is enabled */
|
||||
void BSP_GYRO_GetXYZ(float* pfData);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L475E_IOT01_GYRO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_hsensor.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the humidity sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01_hsensor.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_HUMIDITY HUMIDITY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_HUMIDITY_Private_Variables HUMIDITY Private Variables
|
||||
* @{
|
||||
*/
|
||||
static HSENSOR_DrvTypeDef *Hsensor_drv;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_HUMIDITY_Private_Functions HUMIDITY Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes peripherals used by the I2C Humidity Sensor driver.
|
||||
* @retval HSENSOR status
|
||||
*/
|
||||
uint32_t BSP_HSENSOR_Init(void)
|
||||
{
|
||||
uint32_t ret;
|
||||
|
||||
if(HTS221_H_Drv.ReadID(HTS221_I2C_ADDRESS) != HTS221_WHO_AM_I_VAL)
|
||||
{
|
||||
ret = HSENSOR_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
Hsensor_drv = &HTS221_H_Drv;
|
||||
/* HSENSOR Init */
|
||||
Hsensor_drv->Init(HTS221_I2C_ADDRESS);
|
||||
ret = HSENSOR_OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read ID of HTS221.
|
||||
* @retval HTS221 ID value.
|
||||
*/
|
||||
uint8_t BSP_HSENSOR_ReadID(void)
|
||||
{
|
||||
return Hsensor_drv->ReadID(HTS221_I2C_ADDRESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read Humidity register of HTS221.
|
||||
* @retval HTS221 measured humidity value.
|
||||
*/
|
||||
float BSP_HSENSOR_ReadHumidity(void)
|
||||
{
|
||||
return Hsensor_drv->ReadHumidity(HTS221_I2C_ADDRESS);
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_hsensor.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the humidity sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS 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 __STM32L475E_IOT01_HSENSOR_H
|
||||
#define __STM32L475E_IOT01_HSENSOR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01.h"
|
||||
#include "../Components/hts221/hts221.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01_HUMIDITY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup STM32L475E_IOT01_HUMIDITY_Exported_Types HUMIDITY Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief HSENSOR Status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HSENSOR_OK = 0,
|
||||
HSENSOR_ERROR
|
||||
}HSENSOR_Status_TypDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_HUMIDITY_Exported_Functions HUMIDITY Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/* Sensor Configuration Functions */
|
||||
uint32_t BSP_HSENSOR_Init(void);
|
||||
uint8_t BSP_HSENSOR_ReadID(void);
|
||||
float BSP_HSENSOR_ReadHumidity(void);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* __STM32L475E_IOT01_HSENSOR_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_magneto.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the magnetometer sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01_magneto.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_MAGNETO MAGNETO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_MAGNETO_Private_Variables MAGNETO Private Variables
|
||||
* @{
|
||||
*/
|
||||
static MAGNETO_DrvTypeDef *MagnetoDrv;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_MAGNETO_Private_Functions MAGNETO Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize a magnetometer sensor
|
||||
* @retval COMPONENT_ERROR in case of failure
|
||||
*/
|
||||
MAGNETO_StatusTypeDef BSP_MAGNETO_Init(void)
|
||||
{
|
||||
MAGNETO_StatusTypeDef ret = MAGNETO_OK;
|
||||
MAGNETO_InitTypeDef LIS3MDL_InitStructureMag;
|
||||
|
||||
if(Lis3mdlMagDrv.ReadID() != I_AM_LIS3MDL)
|
||||
{
|
||||
ret = MAGNETO_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Initialize the MAGNETO magnetometer driver structure */
|
||||
MagnetoDrv = &Lis3mdlMagDrv;
|
||||
|
||||
/* MEMS configuration ------------------------------------------------------*/
|
||||
/* Fill the MAGNETO magnetometer structure */
|
||||
LIS3MDL_InitStructureMag.Register1 = LIS3MDL_MAG_TEMPSENSOR_DISABLE | LIS3MDL_MAG_OM_XY_HIGH | LIS3MDL_MAG_ODR_40_HZ;
|
||||
LIS3MDL_InitStructureMag.Register2 = LIS3MDL_MAG_FS_4_GA | LIS3MDL_MAG_REBOOT_DEFAULT | LIS3MDL_MAG_SOFT_RESET_DEFAULT;
|
||||
LIS3MDL_InitStructureMag.Register3 = LIS3MDL_MAG_CONFIG_NORMAL_MODE | LIS3MDL_MAG_CONTINUOUS_MODE;
|
||||
LIS3MDL_InitStructureMag.Register4 = LIS3MDL_MAG_OM_Z_HIGH | LIS3MDL_MAG_BLE_LSB;
|
||||
LIS3MDL_InitStructureMag.Register5 = LIS3MDL_MAG_BDU_MSBLSB;
|
||||
/* Configure the MAGNETO magnetometer main parameters */
|
||||
MagnetoDrv->Init(LIS3MDL_InitStructureMag);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitialize the MAGNETO.
|
||||
*/
|
||||
void BSP_MAGNETO_DeInit(void)
|
||||
{
|
||||
/* DeInitialize the magnetometer IO interfaces */
|
||||
if(MagnetoDrv != NULL)
|
||||
{
|
||||
if(MagnetoDrv->DeInit != NULL)
|
||||
{
|
||||
MagnetoDrv->DeInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set/Unset the MAGNETO in low power mode.
|
||||
*/
|
||||
void BSP_MAGNETO_LowPower(uint16_t status)
|
||||
{
|
||||
/* Put the magnetometer in low power mode */
|
||||
if(MagnetoDrv != NULL)
|
||||
{
|
||||
if(MagnetoDrv->LowPower != NULL)
|
||||
{
|
||||
MagnetoDrv->LowPower(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get XYZ magnetometer values.
|
||||
* @param pDataXYZ Pointer on 3 magnetometer values table with
|
||||
* pDataXYZ[0] = X axis, pDataXYZ[1] = Y axis, pDataXYZ[2] = Z axis
|
||||
*/
|
||||
void BSP_MAGNETO_GetXYZ(int16_t *pDataXYZ)
|
||||
{
|
||||
if(MagnetoDrv != NULL)
|
||||
{
|
||||
if(MagnetoDrv->GetXYZ != NULL)
|
||||
{
|
||||
MagnetoDrv->GetXYZ(pDataXYZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_magneto.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the magnetometer sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS 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 __STM32L475E_IOT01_MAGNETO_H
|
||||
#define __STM32L475E_IOT01_MAGNETO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01.h"
|
||||
/* Include Magnetometer component driver */
|
||||
#include "../Components/lis3mdl/lis3mdl.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01_MAGNETO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475_IOT01_MAGNETO_Exported_Types MAGNETO Exported Types
|
||||
* @{
|
||||
*/
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
MAGNETO_OK = 0,
|
||||
MAGNETO_ERROR = 1,
|
||||
MAGNETO_TIMEOUT = 2
|
||||
}
|
||||
MAGNETO_StatusTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_MAGNETO_Exported_Functions MAGNETO Exported Functions
|
||||
* @{
|
||||
*/
|
||||
MAGNETO_StatusTypeDef BSP_MAGNETO_Init(void);
|
||||
void BSP_MAGNETO_DeInit(void);
|
||||
void BSP_MAGNETO_LowPower(uint16_t status); /* 0 Means Disable Low Power Mode, otherwise Low Power Mode is enabled */
|
||||
void BSP_MAGNETO_GetXYZ(int16_t *pDataXYZ);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L475E_IOT01_MAGNETO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_psensor.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the pressure sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01_psensor.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_PRESSURE PRESSURE
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_PRESSURE_Private_Variables PRESSURE Private Variables
|
||||
* @{
|
||||
*/
|
||||
static PSENSOR_DrvTypeDef *Psensor_drv;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_PRESSURE_Private_Functions PRESSURE Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes peripherals used by the I2C Pressure Sensor driver.
|
||||
* @retval PSENSOR status
|
||||
*/
|
||||
uint32_t BSP_PSENSOR_Init(void)
|
||||
{
|
||||
uint32_t ret;
|
||||
|
||||
if(LPS22HB_P_Drv.ReadID(LPS22HB_I2C_ADDRESS) != LPS22HB_WHO_AM_I_VAL)
|
||||
{
|
||||
ret = PSENSOR_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
Psensor_drv = &LPS22HB_P_Drv;
|
||||
|
||||
/* PSENSOR Init */
|
||||
Psensor_drv->Init(LPS22HB_I2C_ADDRESS);
|
||||
ret = PSENSOR_OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read ID of LPS22HB.
|
||||
* @retval LPS22HB ID value.
|
||||
*/
|
||||
uint8_t BSP_PSENSOR_ReadID(void)
|
||||
{
|
||||
return Psensor_drv->ReadID(LPS22HB_I2C_ADDRESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read Pressure register of LPS22HB.
|
||||
* @retval LPS22HB measured pressure value.
|
||||
*/
|
||||
float BSP_PSENSOR_ReadPressure(void)
|
||||
{
|
||||
return Psensor_drv->ReadPressure(LPS22HB_I2C_ADDRESS);
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_psensor.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the pressure sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS 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 __STM32L475E_IOT01_PSENSOR_H
|
||||
#define __STM32L475E_IOT01_PSENSOR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01.h"
|
||||
#include "../Components/lps22hb/lps22hb.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01_PRESSURE
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup STM32L475E_IOT01_PRESSURE_Exported_Types PRESSURE Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief PSENSOR Status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
PSENSOR_OK = 0,
|
||||
PSENSOR_ERROR
|
||||
}PSENSOR_Status_TypDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_PRESSURE_Exported_Functions PRESSURE Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/* Sensor Configuration Functions */
|
||||
uint32_t BSP_PSENSOR_Init(void);
|
||||
uint8_t BSP_PSENSOR_ReadID(void);
|
||||
float BSP_PSENSOR_ReadPressure(void);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L475E_IOT01_PSENSOR_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,138 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_qspi.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file contains the common defines and functions prototypes for
|
||||
* the stm32l475e_iot01_qspi.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32L475E_IOT01_QSPI_H
|
||||
#define __STM32L475E_IOT01_QSPI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l4xx_hal.h"
|
||||
#include "../Components/mx25r6435f/mx25r6435f.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01_QSPI
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup STM32L475E_IOT01_QSPI_Exported_Constants QSPI Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/* QSPI Error codes */
|
||||
#define QSPI_OK ((uint8_t)0x00)
|
||||
#define QSPI_ERROR ((uint8_t)0x01)
|
||||
#define QSPI_BUSY ((uint8_t)0x02)
|
||||
#define QSPI_NOT_SUPPORTED ((uint8_t)0x04)
|
||||
#define QSPI_SUSPENDED ((uint8_t)0x08)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup STM32L475E_IOT01_QSPI_Exported_Types QSPI Exported Types
|
||||
* @{
|
||||
*/
|
||||
/* QSPI Info */
|
||||
typedef struct {
|
||||
uint32_t FlashSize; /*!< Size of the flash */
|
||||
uint32_t EraseSectorSize; /*!< Size of sectors for the erase operation */
|
||||
uint32_t EraseSectorsNumber; /*!< Number of sectors for the erase operation */
|
||||
uint32_t ProgPageSize; /*!< Size of pages for the program operation */
|
||||
uint32_t ProgPagesNumber; /*!< Number of pages for the program operation */
|
||||
} QSPI_Info;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @defgroup STM32L475E_IOT01_QSPI_Exported_Functions QSPI Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_QSPI_Init (void);
|
||||
uint8_t BSP_QSPI_DeInit (void);
|
||||
uint8_t BSP_QSPI_Read (uint8_t* pData, uint32_t ReadAddr, uint32_t Size);
|
||||
uint8_t BSP_QSPI_Write (uint8_t* pData, uint32_t WriteAddr, uint32_t Size);
|
||||
uint8_t BSP_QSPI_Erase_Block (uint32_t BlockAddress);
|
||||
uint8_t BSP_QSPI_Erase_Sector (uint32_t Sector);
|
||||
uint8_t BSP_QSPI_Erase_Chip (void);
|
||||
uint8_t BSP_QSPI_GetStatus (void);
|
||||
uint8_t BSP_QSPI_GetInfo (QSPI_Info* pInfo);
|
||||
uint8_t BSP_QSPI_EnableMemoryMappedMode(void);
|
||||
uint8_t BSP_QSPI_SuspendErase (void);
|
||||
uint8_t BSP_QSPI_ResumeErase (void);
|
||||
uint8_t BSP_QSPI_EnterDeepPowerDown (void);
|
||||
uint8_t BSP_QSPI_LeaveDeepPowerDown (void);
|
||||
|
||||
void BSP_QSPI_MspInit(void);
|
||||
void BSP_QSPI_MspDeInit(void);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L475E_IOT01_QSPI_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_tsensor.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the temperature sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01_tsensor.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_TEMPERATURE TEMPERATURE
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_TEMPERATURE_Private_Variables TEMPERATURE Private Variables
|
||||
* @{
|
||||
*/
|
||||
static TSENSOR_DrvTypeDef *tsensor_drv;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_TEMPERATURE_Private_Functions TEMPERATURE Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes peripherals used by the I2C Temperature Sensor driver.
|
||||
* @retval TSENSOR status
|
||||
*/
|
||||
uint32_t BSP_TSENSOR_Init(void)
|
||||
{
|
||||
uint8_t ret = TSENSOR_ERROR;
|
||||
|
||||
#ifdef USE_LPS22HB_TEMP
|
||||
tsensor_drv = &LPS22HB_T_Drv;
|
||||
#else /* USE_HTS221_TEMP */
|
||||
tsensor_drv = &HTS221_T_Drv;
|
||||
#endif
|
||||
|
||||
/* Low level init */
|
||||
SENSOR_IO_Init();
|
||||
|
||||
/* TSENSOR Init */
|
||||
tsensor_drv->Init(TSENSOR_I2C_ADDRESS, NULL);
|
||||
|
||||
ret = TSENSOR_OK;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read Temperature register of TS751.
|
||||
* @retval STTS751 measured temperature value.
|
||||
*/
|
||||
float BSP_TSENSOR_ReadTemp(void)
|
||||
{
|
||||
return tsensor_drv->ReadTemp(TSENSOR_I2C_ADDRESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l475e_iot01_tsensor.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-March-2017
|
||||
* @brief This file provides a set of functions needed to manage the temperature sensor
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS 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 __STM32L475E_IOT01_TSENSOR_H
|
||||
#define __STM32L475E_IOT01_TSENSOR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l475e_iot01.h"
|
||||
#ifdef USE_LPS22HB_TEMP
|
||||
#include "../Components/lps22hb/lps22hb.h"
|
||||
#else /* USE_HTS221_TEMP */
|
||||
#include "../Components/hts221/hts221.h"
|
||||
#endif
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L475E_IOT01_TEMPERATURE
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_TEMPERATURE_Exported_Types TEMPERATURE Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief TSENSOR Status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
TSENSOR_OK = 0,
|
||||
TSENSOR_ERROR
|
||||
}TSENSOR_Status_TypDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM32L475E_IOT01_TEMPERATURE_Exported_Functions TEMPERATURE Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/* Sensor Configuration Functions */
|
||||
uint32_t BSP_TSENSOR_Init(void);
|
||||
float BSP_TSENSOR_ReadTemp(void);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* __STM32L475E_IOT01_TSENSOR_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,834 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for BSP Components Common Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for BSP Components Common Drivers</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2017 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<span style="font-family: "Times New Roman";">
|
||||
</span>
|
||||
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
||||
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V5.0.0 / 01-March-2017 <o:p></o:p></span></h3>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Add hsensor.h: support of humidity class</span></li>
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">Add psensor.h: support of pressure class</span></li>
|
||||
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">Update tsensor.h: Temperature can be negative</span></li>
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">Update accelero.h: LowPower API can enable or disable the low power mode</span></li>
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">Update magneto.h: LowPower </span><span style="font-size: 10pt; font-family: Verdana;">API </span><span style="font-size: 10pt; font-family: Verdana;">can enable or disable the low power mode</span></li>
|
||||
</ul>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"> <span style="font-weight: bold; font-style: italic; text-decoration: underline;">Notes:</span><br>
|
||||
</span><span style="font-size: 10pt; font-family: Verdana;"> This version breaks the compatibility with previous versions. </span><br>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.0.1 / 21-July-2015 <o:p></o:p></span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">tsensor.h: Fix compilation issue on TSENSOR_InitTypeDef</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.0.0 / 22-June-2015 <o:p></o:p></span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">accelero.h: add <span style="font-style: italic;">*DeInit</span> field in <span style="font-style: italic;">ACCELERO_DrvTypeDef</span> structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">audio.h: add <span style="font-style: italic;">*DeInit</span> field in <span style="font-style: italic;">AUDIO_DrvTypeDef</span> structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;">idd.h: </span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">add <span style="font-style: italic;">Shunt0StabDelay, Shunt1StabDelay, Shunt2StabDelay, Shunt3StabDelay, Shunt4StabDelay and ShuntNbOnBoard </span></span><span style="font-size: 10pt; font-family: Verdana;">fields in <span style="font-style: italic;">IDD_ConfigTypeDef</span> </span><span style="font-size: 10pt; font-family: Verdana;">structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;">rename <span style="font-style: italic;">ShuntNumber</span> field to <span style="font-style: italic;">ShuntNbUsed</span> in </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">IDD_ConfigTypeDef</span> structure</span></li></ul><li><span style="font-size: 10pt; font-family: Verdana;">magneto.h: add <span style="font-style: italic;">*DeInit</span> field in <span style="font-style: italic;">MAGNETO_DrvTypeDef</span> structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;"><span style="font-weight: bold;">Important Note:</span> this release V4.0.0 is not backward compatible with V3.0.0</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V3.0.0 / 28-April-2015 <o:p></o:p></span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">accelero.h: </span><span style="font-size: 10pt; font-family: Verdana;">add <span style="font-style: italic;">*LowPower</span> field in <span style="font-style: italic;">ACCELERO_DrvTypeDef</span> structure</span><span style="font-size: 10pt; font-family: Verdana;"></span></li><li><span style="font-size: 10pt; font-family: Verdana;">magneto.h: </span><span style="font-size: 10pt; font-family: Verdana;">add <span style="font-style: italic;">*LowPower</span> field in <span style="font-style: italic;">MAGNETO_DrvTypeDef</span> structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;">gyro.h: add <span style="font-style: italic;">*DeInit</span> and <span style="font-style: italic;">*LowPower</span> fields in <span style="font-style: italic;">GYRO_DrvTypeDef</span> structure<br></span></li><li><span style="font-size: 10pt; font-family: Verdana;">camera.h: add <span style="font-style: italic;">CAMERA_COLOR_EFFECT_NONE</span> define</span></li><li><span style="font-size: 10pt; font-family: Verdana;">idd.h: </span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">add <span style="font-style: italic;">MeasureNb</span>, <span style="font-style: italic;">DeltaDelayUnit</span> and <span style="font-style: italic;">DeltaDelayValue</span> fields in <span style="font-style: italic;">IDD_ConfigTypeDef</span> structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;">rename <span style="font-style: italic;">PreDelay</span> field to <span style="font-style: italic;">PreDelayUnit</span> in </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">IDD_ConfigTypeDef</span> structure</span></li></ul>
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;"><span style="font-weight: bold;">Important Note:</span> this release V3.0.0 is not backward compatible with V2.2.0<br>
|
||||
</span></li>
|
||||
</ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.2.0 / 09-February-2015 <o:p></o:p></span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Magnetometer </span><span style="font-size: 10pt; font-family: Verdana;">driver function prototypes added (magneto.h file)</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Update "idd.h" file to provide DeInit() and WakeUp() services in IDD current measurement driver</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.1.0 / 06-February-2015 <o:p></o:p></span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">IDD current measurement </span><span style="font-size: 10pt; font-family: Verdana;">driver function prototypes added (idd.h file)</span></li><li><span style="font-size: 10pt; font-family: Verdana;">io.h: add new typedef enum IO_PinState with IO_PIN_RESET and IO_PIN_SET values<br></span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0 / 15-December-2014 <o:p></o:p></span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">Update "io.h" file to support MFX (Multi Function eXpander) device available on some STM32 boards</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">add new entries for IO_ModeTypedef enumeration structure</span><span style="font-size: 10pt; font-family: Verdana;"></span></li><li><span style="font-size: 10pt; font-family: Verdana;">update the IO_DrvTypeDef structure</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Update all return values and function parameters to uint32_t</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Add a return value for Config field</span></li></ul></ul><li style="font-family: Verdana;"><small><span style="font-weight: bold;">Important Note</span>: this version V2.0.0 is not backward compatible with V1.2.1</small></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.2.1 / 02-December-2014 <o:p></o:p></span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">gyro.h: change “__GIRO_H” by “__GYRO_H” to fix compilation issue under Mac OS</span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.2.0 / 18-June-2014 <o:p></o:p></span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">EPD (</span><span style="font-size: 10pt; font-family: Verdana;">E Paper Display) driver function prototype added (epd.h file)<br>
|
||||
</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.0 / 21-March-2014 <o:p></o:p></span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Temperature Sensor driver function prototype added</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">First official release with </span><span style="font-size: 10pt; font-family: Verdana;">Accelerometer, </span><span style="font-size: 10pt; font-family: Verdana;">Audio, Camera, Gyroscope, IO, LCD and Touch Screen drivers function prototypes </span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
|
||||
<div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><font size="-1"></font><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file accelero.h
|
||||
* @author MCD Application Team
|
||||
* @version V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This header file contains the functions prototypes for the Accelerometer driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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)(uint16_t);
|
||||
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 V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This header file contains the common defines and functions prototypes
|
||||
* for the Audio driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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 V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This header file contains the common defines and functions prototypes
|
||||
* for the camera driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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 V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* EPD (E Paper Display) driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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 V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This header file contains the functions prototypes for the gyroscope driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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,101 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file tsensor.h
|
||||
* @author MCD Application Team
|
||||
* @version V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This header file contains the functions prototypes for the
|
||||
* Temperature Sensor driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __HSENSOR_H
|
||||
#define __HSENSOR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup HSENSOR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup HSENSOR_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup HSENSOR_Driver_structure Temperature Sensor Driver structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (*Init)(uint16_t);
|
||||
uint8_t (*ReadID)(uint16_t);
|
||||
float (*ReadHumidity)(uint16_t);
|
||||
}HSENSOR_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __HSENSOR_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file idd.h
|
||||
* @author MCD Application Team
|
||||
* @version V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This file contains all the functions prototypes for the IDD driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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 V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This file contains all the functions prototypes for the IO driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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 V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This file contains all the functions prototypes for the LCD driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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 V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This header file contains the functions prototypes for the MAGNETO driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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)(uint16_t);
|
||||
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,101 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file tsensor.h
|
||||
* @author MCD Application Team
|
||||
* @version V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This header file contains the functions prototypes for the
|
||||
* Temperature Sensor driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __PSENSOR_H
|
||||
#define __PSENSOR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup PSENSOR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup PSENSOR_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup PSENSOR_Driver_structure Temperature Sensor Driver structure
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (*Init)(uint16_t);
|
||||
uint8_t (*ReadID)(uint16_t);
|
||||
float (*ReadPressure)(uint16_t);
|
||||
}PSENSOR_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PSENSOR_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file ts.h
|
||||
* @author MCD Application Team
|
||||
* @version V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This file contains all the functions prototypes for the Touch Screen driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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 V5.0.0
|
||||
* @date 01-March-2017
|
||||
* @brief This header file contains the functions prototypes for the
|
||||
* Temperature Sensor driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __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 */
|
||||
int8_t TemperatureLimitHigh; /* High Temperature Limit Range */
|
||||
int8_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);
|
||||
float (*ReadTemp)(uint16_t);
|
||||
}TSENSOR_DrvTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TSENSOR_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for ADV7533 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2016 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1
|
||||
/ 05-December-2016 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Add adv7533_SetVolume, adv7533_SetOutputMode and adv7533_Reset to adv7533_drv for compatibility reasons<br>
|
||||
</span></li>
|
||||
</ul>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 26-August-2016 <o:p></o:p></span></h3>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="padding: 0cm;" valign="top"><br>
|
||||
</td></tr></tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,513 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file adv7533.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.1
|
||||
* @date 05-December-2016
|
||||
* @brief This file provides the ADV7533 DSI to HDMI bridge driver
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "adv7533.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ADV7533 ADV7533
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* adv7533 DSI-HDMI bridge.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
/** @defgroup ADV7533_Private_Constants ADV7533 Private Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
/** @defgroup ADV7533_Exported_Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
AUDIO_DrvTypeDef adv7533_drv =
|
||||
{
|
||||
adv7533_AudioInit,
|
||||
adv7533_DeInit,
|
||||
adv7533_ReadID,
|
||||
adv7533_Play,
|
||||
adv7533_Pause,
|
||||
adv7533_Resume,
|
||||
adv7533_Stop,
|
||||
adv7533_SetFrequency,
|
||||
adv7533_SetVolume, /* Not supported, added for compatibility */
|
||||
adv7533_SetMute,
|
||||
adv7533_SetOutputMode, /* Not supported, added for compatibility */
|
||||
adv7533_Reset /* Not supported, added for compatibility */
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @defgroup ADV7533_Exported_Functions ADV7533 Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes the ADV7533 bridge.
|
||||
* @param None
|
||||
* @retval Status
|
||||
*/
|
||||
uint8_t ADV7533_Init(void)
|
||||
{
|
||||
HDMI_IO_Init();
|
||||
|
||||
/* Configure the IC2 address for CEC_DSI interface */
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xE1, ADV7533_CEC_DSI_I2C_ADDR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Power on the ADV7533 bridge.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ADV7533_PowerOn(void)
|
||||
{
|
||||
uint8_t tmp;
|
||||
|
||||
/* Power on */
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x41);
|
||||
tmp &= ~0x40;
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x41, tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Power off the ADV7533 bridge.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ADV7533_PowerDown(void)
|
||||
{
|
||||
uint8_t tmp;
|
||||
|
||||
/* Power down */
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x41);
|
||||
tmp |= 0x40;
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x41, tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the DSI-HDMI ADV7533 bridge for video.
|
||||
* @param config : pointer to adv7533ConfigTypeDef that contains the
|
||||
* video configuration parameters
|
||||
* @retval None
|
||||
*/
|
||||
void ADV7533_Configure(adv7533ConfigTypeDef * config)
|
||||
{
|
||||
uint8_t tmp;
|
||||
|
||||
/* Sequence from Section 3 - Quick Start Guide */
|
||||
|
||||
/* ADV7533 Power Settings */
|
||||
/* Power down */
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x41);
|
||||
tmp &= ~0x40;
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x41, tmp);
|
||||
/* HPD Override */
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xD6);
|
||||
tmp |= 0x40;
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xD6, tmp);
|
||||
/* Gate DSI LP Oscillator and DSI Bias Clock Powerdown */
|
||||
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x03);
|
||||
tmp &= ~0x02;
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x03, tmp);
|
||||
|
||||
/* Fixed registers that must be set on power-up */
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x16);
|
||||
tmp &= ~0x3E;
|
||||
tmp |= 0x20;
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x16, tmp);
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x9A, 0xE0);
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xBA);
|
||||
tmp &= ~0xF8;
|
||||
tmp |= 0x70;
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xBA, tmp);
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xDE, 0x82);
|
||||
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xE4);
|
||||
tmp |= 0x40;
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xE4, tmp);
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xE5, 0x80);
|
||||
|
||||
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x15);
|
||||
tmp &= ~0x30;
|
||||
tmp |= 0x10;
|
||||
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x17);
|
||||
tmp &= ~0xF0;
|
||||
tmp |= 0xD0;
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x17, tmp);
|
||||
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x24);
|
||||
tmp &= ~0x10;
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x24, tmp);
|
||||
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x57);
|
||||
tmp |= 0x01;
|
||||
tmp |= 0x10;
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x57, tmp);
|
||||
|
||||
/* Configure the number of DSI lanes */
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x1C, (config->DSI_LANES << 4));
|
||||
|
||||
/* Setup video output mode */
|
||||
/* Select HDMI mode */
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0xAF);
|
||||
tmp |= 0x02;
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0xAF, tmp);
|
||||
/* HDMI Output Enable */
|
||||
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x03);
|
||||
tmp |= 0x80;
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x03, tmp);
|
||||
|
||||
/* GC packet enable */
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x40);
|
||||
tmp |= 0x80;
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x40, tmp);
|
||||
/* Input color depth 24-bit per pixel */
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x4C);
|
||||
tmp &= ~0x0F;
|
||||
tmp |= 0x03;
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x4C, tmp);
|
||||
/* Down dither output color depth */
|
||||
HDMI_IO_Write(ADV7533_MAIN_I2C_ADDR, 0x49, 0xfc);
|
||||
|
||||
/* Internal timing disabled */
|
||||
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x27);
|
||||
tmp &= ~0x80;
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x27, tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable video pattern generation.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ADV7533_PatternEnable(void)
|
||||
{
|
||||
/* Timing generator enable */
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x55, 0x80); /* Color bar */
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x55, 0xA0); /* Color ramp */
|
||||
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x03, 0x89);
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0xAF, 0x16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable video pattern generation.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
void ADV7533_PatternDisable(void)
|
||||
{
|
||||
/* Timing generator enable */
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x55, 0x00);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the ADV7533 audio interface.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param OutputDevice: Not used (for compatiblity only).
|
||||
* @param Volume: Not used (for compatiblity only).
|
||||
* @param AudioFreq: Audio Frequency
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t adv7533_AudioInit(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume,uint32_t AudioFreq)
|
||||
{
|
||||
uint32_t val = 4096;
|
||||
uint8_t tmp = 0;
|
||||
|
||||
/* Audio data enable*/
|
||||
tmp = HDMI_IO_Read(ADV7533_CEC_DSI_I2C_ADDR, 0x05);
|
||||
tmp &= ~0x20;
|
||||
HDMI_IO_Write(ADV7533_CEC_DSI_I2C_ADDR, 0x05, tmp);
|
||||
|
||||
/* HDMI statup */
|
||||
tmp= (uint8_t)((val & 0xF0000)>>16);
|
||||
HDMI_IO_Write(DeviceAddr, 0x01, tmp);
|
||||
|
||||
tmp= (uint8_t)((val & 0xFF00)>>8);
|
||||
HDMI_IO_Write(DeviceAddr, 0x02, tmp);
|
||||
|
||||
tmp= (uint8_t)((val & 0xFF));
|
||||
HDMI_IO_Write(DeviceAddr, 0x03, tmp);
|
||||
|
||||
/* Enable spdif */
|
||||
tmp = HDMI_IO_Read(DeviceAddr, 0x0B);
|
||||
tmp |= 0x80;
|
||||
HDMI_IO_Write(DeviceAddr, 0x0B, tmp);
|
||||
|
||||
/* Enable I2S */
|
||||
tmp = HDMI_IO_Read(DeviceAddr, 0x0C);
|
||||
tmp |=0x04;
|
||||
HDMI_IO_Write(DeviceAddr, 0x0C, tmp);
|
||||
|
||||
/* Set audio sampling frequency */
|
||||
adv7533_SetFrequency(DeviceAddr, AudioFreq);
|
||||
|
||||
/* Select SPDIF is 0x10 , I2S=0x00 */
|
||||
tmp = HDMI_IO_Read(ADV7533_MAIN_I2C_ADDR, 0x0A);
|
||||
tmp &=~ 0x10;
|
||||
HDMI_IO_Write(DeviceAddr, 0x0A, tmp);
|
||||
|
||||
/* Set v1P2 enable */
|
||||
tmp = HDMI_IO_Read(DeviceAddr, 0xE4);
|
||||
tmp |= 0x80;
|
||||
HDMI_IO_Write(DeviceAddr, 0xE4, tmp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the adv7533
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void adv7533_DeInit(void)
|
||||
{
|
||||
/* Deinitialize Audio adv7533 interface */
|
||||
AUDIO_IO_DeInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the adv7533 ID.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval The adv7533 ID
|
||||
*/
|
||||
uint32_t adv7533_ReadID(uint16_t DeviceAddr)
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
|
||||
tmp = HDMI_IO_Read(DeviceAddr, ADV7533_CHIPID_ADDR0);
|
||||
tmp = (tmp<<8);
|
||||
tmp |= HDMI_IO_Read(DeviceAddr, ADV7533_CHIPID_ADDR1);
|
||||
|
||||
return(tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pauses playing on the audio hdmi
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t adv7533_Pause(uint16_t DeviceAddr)
|
||||
{
|
||||
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_ON));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resumes playing on the audio hdmi.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t adv7533_Resume(uint16_t DeviceAddr)
|
||||
{
|
||||
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_OFF));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start the audio hdmi 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 adv7533_Play(uint16_t DeviceAddr ,uint16_t* pBuffer ,uint16_t Size)
|
||||
{
|
||||
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_OFF));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stop playing on the audio hdmi
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t adv7533_Stop(uint16_t DeviceAddr,uint32_t cmd)
|
||||
{
|
||||
return(adv7533_SetMute(DeviceAddr,AUDIO_MUTE_ON));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the mute feature on the audio hdmi.
|
||||
* @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 adv7533_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
|
||||
tmp = HDMI_IO_Read(DeviceAddr, 0x0D);
|
||||
if (Cmd == AUDIO_MUTE_ON)
|
||||
{
|
||||
/* enable audio mute*/
|
||||
tmp |= 0x40;
|
||||
HDMI_IO_Write(DeviceAddr, 0x0D, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*audio mute off disable the mute */
|
||||
tmp &= ~0x40;
|
||||
HDMI_IO_Write(DeviceAddr, 0x0D, tmp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets output mode.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param Output : hdmi output.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t adv7533_SetOutputMode(uint16_t DeviceAddr, uint8_t Output)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets volumee.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @param Volume : volume value.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t adv7533_SetVolume(uint16_t DeviceAddr, uint8_t Volume)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resets adv7533 registers.
|
||||
* @param DeviceAddr: Device address on communication Bus.
|
||||
* @retval 0 if correct communication, else wrong communication
|
||||
*/
|
||||
uint32_t adv7533_Reset(uint16_t DeviceAddr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 adv7533_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
|
||||
tmp = HDMI_IO_Read(DeviceAddr, 0x15);
|
||||
tmp &= (~0xF0);
|
||||
/* Clock Configurations */
|
||||
switch (AudioFreq)
|
||||
{
|
||||
case AUDIO_FREQUENCY_32K:
|
||||
/* Sampling Frequency =32 KHZ*/
|
||||
tmp |= 0x30;
|
||||
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
||||
break;
|
||||
case AUDIO_FREQUENCY_44K:
|
||||
/* Sampling Frequency =44,1 KHZ*/
|
||||
tmp |= 0x00;
|
||||
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
||||
break;
|
||||
|
||||
case AUDIO_FREQUENCY_48K:
|
||||
/* Sampling Frequency =48KHZ*/
|
||||
tmp |= 0x20;
|
||||
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
||||
break;
|
||||
|
||||
case AUDIO_FREQUENCY_96K:
|
||||
/* Sampling Frequency =96 KHZ*/
|
||||
tmp |= 0xA0;
|
||||
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
||||
break;
|
||||
|
||||
case AUDIO_FREQUENCY_88K:
|
||||
/* Sampling Frequency =88,2 KHZ*/
|
||||
tmp |= 0x80;
|
||||
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
||||
break;
|
||||
|
||||
case AUDIO_FREQUENCY_176K:
|
||||
/* Sampling Frequency =176,4 KHZ*/
|
||||
tmp |= 0xC0;
|
||||
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
||||
break;
|
||||
|
||||
case AUDIO_FREQUENCY_192K:
|
||||
/* Sampling Frequency =192KHZ*/
|
||||
tmp |= 0xE0;
|
||||
HDMI_IO_Write(DeviceAddr, 0x15, tmp);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,232 @@
|
|||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file adv7533.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.1
|
||||
* @date 05-December-2016
|
||||
* @brief This file contains all the constants parameters for the ADV7533
|
||||
* which is the HDMI bridge between DSI and HDMI
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 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 __ADV7533_H
|
||||
#define __ADV7533_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/audio.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup adv7533
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ADV7533_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint8_t DSI_LANES;
|
||||
uint16_t HACT;
|
||||
uint16_t HSYNC;
|
||||
uint16_t HBP;
|
||||
uint16_t HFP;
|
||||
uint16_t VACT;
|
||||
uint16_t VSYNC;
|
||||
uint16_t VBP;
|
||||
uint16_t VFP;
|
||||
uint8_t ASPECT_RATIO;
|
||||
} adv7533ConfigTypeDef;
|
||||
|
||||
/** @defgroup ADV7533_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief HDMI audio output DEVICE
|
||||
*/
|
||||
#define OUTPUT_DEVICE_ADV7533_HDMI ((uint16_t)0x1000)
|
||||
|
||||
/**
|
||||
* @brief ADV7533 I2C Addresses 0x7A / 0x78
|
||||
*/
|
||||
#define ADV7533_MAIN_I2C_ADDR ((uint8_t)0x7A)
|
||||
#define ADV7533_CEC_DSI_I2C_ADDR ((uint8_t)0x78)
|
||||
|
||||
/**
|
||||
* @brief ADV7533 Aspect ratio
|
||||
*/
|
||||
#define ADV7533_ASPECT_RATIO_16_9 ((uint8_t)0x00)
|
||||
#define ADV7533_ASPECT_RATIO_4_3 ((uint8_t)0x01)
|
||||
|
||||
/**
|
||||
* @brief ADV7533 Aspect ratio
|
||||
*/
|
||||
#define ADV7533_MODE_HDMI 0x0
|
||||
#define ADV7533_MODE_DVI 0x1
|
||||
|
||||
/**
|
||||
* @brief ADV7533 Main Registers
|
||||
*/
|
||||
#define ADV7533_MAIN_SYNC_REG ((uint8_t)0x17)
|
||||
#define ADV7533_MAIN_POWER_DOWN_REG ((uint8_t)0x41)
|
||||
#define ADV7533_MAIN_HPG_REG ((uint8_t)0x42)
|
||||
|
||||
/**
|
||||
* @brief ADV7533 Main Features Parameters
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief ADV7533 CEC DSI Registers
|
||||
*/
|
||||
#define ADV7533_CEC_DSI_INTERNAL_TIMING_REG ((uint8_t)0x27)
|
||||
#define ADV7533_CEC_DSI_TOTAL_WIDTH_H_REG ((uint8_t)0x28)
|
||||
#define ADV7533_CEC_DSI_TOTAL_WIDTH_L_REG ((uint8_t)0x29)
|
||||
#define ADV7533_CEC_DSI_HSYNC_H_REG ((uint8_t)0x2A)
|
||||
#define ADV7533_CEC_DSI_HSYNC_L_REG ((uint8_t)0x2B)
|
||||
#define ADV7533_CEC_DSI_HFP_H_REG ((uint8_t)0x2C)
|
||||
#define ADV7533_CEC_DSI_HFP_L_REG ((uint8_t)0x2D)
|
||||
#define ADV7533_CEC_DSI_HBP_H_REG ((uint8_t)0x2E)
|
||||
#define ADV7533_CEC_DSI_HBP_L_REG ((uint8_t)0x2F)
|
||||
|
||||
#define ADV7533_CEC_DSI_TOTAL_HEIGHT_H_REG ((uint8_t)0x30)
|
||||
#define ADV7533_CEC_DSI_TOTAL_HEIGHT_L_REG ((uint8_t)0x31)
|
||||
#define ADV7533_CEC_DSI_VSYNC_H_REG ((uint8_t)0x32)
|
||||
#define ADV7533_CEC_DSI_VSYNC_L_REG ((uint8_t)0x33)
|
||||
#define ADV7533_CEC_DSI_VFP_H_REG ((uint8_t)0x34)
|
||||
#define ADV7533_CEC_DSI_VFP_L_REG ((uint8_t)0x35)
|
||||
#define ADV7533_CEC_DSI_VBP_H_REG ((uint8_t)0x36)
|
||||
#define ADV7533_CEC_DSI_VBP_L_REG ((uint8_t)0x37)
|
||||
|
||||
/** @Brief adv7533 ID
|
||||
*/
|
||||
#define ADV7533_ID 0x7533
|
||||
|
||||
/** @Brief device ID register
|
||||
*/
|
||||
#define ADV7533_CHIPID_ADDR0 0x00
|
||||
#define ADV7533_CHIPID_ADDR1 0x01
|
||||
|
||||
/* MUTE commands */
|
||||
#define AUDIO_MUTE_ON 1
|
||||
#define AUDIO_MUTE_OFF 0
|
||||
|
||||
/* AUDIO FREQUENCY */
|
||||
#define AUDIO_FREQUENCY_192K ((uint32_t)192000)
|
||||
#define AUDIO_FREQUENCY_176K ((uint32_t)176400)
|
||||
#define AUDIO_FREQUENCY_96K ((uint32_t)96000)
|
||||
#define AUDIO_FREQUENCY_88K ((uint32_t)88200)
|
||||
#define AUDIO_FREQUENCY_48K ((uint32_t)48000)
|
||||
#define AUDIO_FREQUENCY_44K ((uint32_t)44100)
|
||||
#define AUDIO_FREQUENCY_32K ((uint32_t)32000)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup ADV7533_Exported_Macros ADV7533 Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup ADV7533_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
HDMI video functions
|
||||
------------------------------------------------------------------------------*/
|
||||
uint8_t ADV7533_Init(void);
|
||||
void ADV7533_PowerOn(void);
|
||||
void ADV7533_PowerDown(void);
|
||||
void ADV7533_Configure(adv7533ConfigTypeDef * config);
|
||||
void ADV7533_PatternEnable(void);
|
||||
void ADV7533_PatternDisable(void);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
HDMI Audio functions
|
||||
------------------------------------------------------------------------------*/
|
||||
uint32_t adv7533_AudioInit(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume,uint32_t AudioFreq);
|
||||
void adv7533_DeInit(void);
|
||||
uint32_t adv7533_ReadID(uint16_t DeviceAddr);
|
||||
uint32_t adv7533_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size);
|
||||
uint32_t adv7533_Stop(uint16_t DeviceAddr,uint32_t Cmd);
|
||||
uint32_t adv7533_Pause(uint16_t DeviceAddr);
|
||||
uint32_t adv7533_Resume(uint16_t DeviceAddr);
|
||||
uint32_t adv7533_SetMute(uint16_t DeviceAddr, uint32_t Cmd);
|
||||
uint32_t adv7533_SetVolume(uint16_t, uint8_t);
|
||||
uint32_t adv7533_Reset(uint16_t DeviceAddr);
|
||||
uint32_t adv7533_SetOutputMode(uint16_t DeviceAddr, uint8_t Output);
|
||||
uint32_t adv7533_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq);
|
||||
|
||||
|
||||
/* HDMI IO functions */
|
||||
void HDMI_IO_Init(void);
|
||||
void HDMI_IO_Write(uint8_t addr, uint8_t reg, uint8_t value);
|
||||
uint8_t HDMI_IO_Read(uint8_t addr, uint8_t reg);
|
||||
void HDMI_IO_Delay(uint32_t delay);
|
||||
void AUDIO_IO_DeInit(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* HDMI Audio driver structure */
|
||||
extern AUDIO_DrvTypeDef adv7533_drv;
|
||||
|
||||
#endif /* __ADV7533_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 ES_WIFI BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for ES_WIFI Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2017 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 23-February-2017 <o:p></o:p></span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">First official release of ES_WIFI wifi component</span></li>
|
||||
|
||||
</ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="padding: 0cm;" valign="top"><br>
|
||||
</td></tr></tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,309 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file es-wifi.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 23-02-2017
|
||||
* @brief header file for the es-wifi module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS 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 __ES_WIFI_H
|
||||
#define __ES_WIFI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stdint.h"
|
||||
#include "string.h"
|
||||
#include "stdio.h"
|
||||
#include "es_wifi_conf.h"
|
||||
|
||||
/* Exported Constants --------------------------------------------------------*/
|
||||
#define ES_WIFI_PAYLOAD_SIZE 1200
|
||||
/* Exported macro-------------------------------------------------------------*/
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
typedef int8_t (*IO_Init_Func)( void);
|
||||
typedef int8_t (*IO_DeInit_Func)( void);
|
||||
typedef void (*IO_Delay_Func)(uint32_t);
|
||||
typedef int16_t (*IO_Send_Func)( uint8_t *, uint16_t len, uint32_t);
|
||||
typedef int16_t (*IO_Receive_Func)(uint8_t *, uint16_t len, uint32_t);
|
||||
|
||||
/* Exported typedef ----------------------------------------------------------*/
|
||||
typedef enum {
|
||||
ES_WIFI_STATUS_OK = 0,
|
||||
ES_WIFI_STATUS_REQ_DATA_STAGE = 1,
|
||||
ES_WIFI_STATUS_ERROR = 2,
|
||||
ES_WIFI_STATUS_TIMEOUT = 3,
|
||||
ES_WIFI_STATUS_IO_ERROR = 4,
|
||||
}ES_WIFI_Status_t;
|
||||
|
||||
typedef enum {
|
||||
ES_WIFI_MODE_SINGLE = 0,
|
||||
ES_WIFI_MODE_MULTI = 1,
|
||||
}ES_WIFI_ConnMode_t;
|
||||
|
||||
typedef enum {
|
||||
ES_WIFI_TCP_CONNECTION = 0,
|
||||
ES_WIFI_UDP_CONNECTION = 1,
|
||||
ES_WIFI_UDP_LITE_CONNECTION = 2,
|
||||
ES_WIFI_TCP_SSL_CONNECTION = 3,
|
||||
ES_WIFI_MQTT_CONNECTION = 4,
|
||||
}ES_WIFI_ConnType_t;
|
||||
|
||||
/* Security settings for wifi network */
|
||||
typedef enum {
|
||||
ES_WIFI_SEC_OPEN = 0x00, /*!< Wifi is open */
|
||||
ES_WIFI_SEC_WEP = 0x01, /*!< Wired Equivalent Privacy option for wifi security. \note This mode can't be used when setting up ES_WIFI wifi */
|
||||
ES_WIFI_SEC_WPA = 0x02, /*!< Wi-Fi Protected Access */
|
||||
ES_WIFI_SEC_WPA2 = 0x03, /*!< Wi-Fi Protected Access 2 */
|
||||
ES_WIFI_SEC_WPA_WPA2= 0x04, /*!< Wi-Fi Protected Access with both modes */
|
||||
ES_WIFI_SEC_WPA2_TKIP= 0x05, /*!< Wi-Fi Protected Access with both modes */
|
||||
ES_WIFI_SEC_UNKNOWN = 0xFF, /*!< Wi-Fi Unknown Security mode */
|
||||
} ES_WIFI_SecurityType_t;
|
||||
|
||||
typedef enum {
|
||||
ES_WIFI_IPV4 = 0x00,
|
||||
ES_WIFI_IPV6 = 0x01,
|
||||
} ES_WIFI_IPVer_t;
|
||||
|
||||
typedef enum {
|
||||
ES_WIFI_AP_NONE = 0x00,
|
||||
ES_WIFI_AP_ASSIGNED = 0x01,
|
||||
ES_WIFI_AP_JOINED = 0x02,
|
||||
ES_WIFI_AP_ERROR = 0xFF,
|
||||
} ES_WIFI_APState_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Port;
|
||||
uint32_t BaudRate;
|
||||
uint32_t DataWidth;
|
||||
uint32_t Parity;
|
||||
uint32_t StopBits;
|
||||
uint32_t Mode;
|
||||
|
||||
}ES_WIFI_UARTConfig_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Configuration;
|
||||
uint32_t WPSPin;
|
||||
uint32_t VID;
|
||||
uint32_t PID;
|
||||
uint8_t MAC[6];
|
||||
uint8_t AP_IPAddress[4];
|
||||
uint32_t PS_Mode;
|
||||
uint32_t RadioMode;
|
||||
uint32_t CurrentBeacon;
|
||||
uint32_t PrevBeacon;
|
||||
uint32_t ProductName;
|
||||
|
||||
}ES_WIFI_SystemConfig_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t* Address; /*!< Pointer to domain or IP to ping */
|
||||
uint32_t Time; /*!< Time in milliseconds needed for pinging */
|
||||
uint8_t Success; /*!< Status indicates if ping was successful */
|
||||
}ES_WIFI_Ping_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t SSID[ES_WIFI_MAX_SSID_NAME_SIZE + 1]; /*!< Service Set Identifier value.Wi-Fi spot name */
|
||||
ES_WIFI_SecurityType_t Security; /*!< Security of Wi-Fi spot. */
|
||||
int16_t RSSI; /*!< Signal strength of Wi-Fi spot */
|
||||
uint8_t MAC[6]; /*!< MAC address of spot */
|
||||
uint8_t Channel; /*!< Wi-Fi channel */
|
||||
} ES_WIFI_AP_t;
|
||||
|
||||
/* Access point configuration */
|
||||
typedef struct {
|
||||
uint8_t SSID[ES_WIFI_MAX_SSID_NAME_SIZE + 1]; /*!< Network public name for ESP AP mode */
|
||||
uint8_t Pass[ES_WIFI_MAX_PSWD_NAME_SIZE + 1]; /*!< Network password for ESP AP mode */
|
||||
ES_WIFI_SecurityType_t Security; /*!< Security of Wi-Fi spot. This parameter can be a value of \ref ESP8266_Ecn_t enumeration */
|
||||
uint8_t Channel; /*!< Channel Wi-Fi is operating at */
|
||||
uint8_t MaxConnections; /*!< Max number of stations that are allowed to connect to ESP AP, between 1 and 4 */
|
||||
uint8_t Hidden; /*!< Set to 1 if network is hidden (not broadcast) or zero if noz */
|
||||
} ES_WIFI_APConfig_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t SSID[ES_WIFI_MAX_SSID_NAME_SIZE + 1]; /*!< Network public name for ESP AP mode */
|
||||
uint8_t IP_Addr[4]; /*!< IP Address */
|
||||
uint8_t MAC_Addr[6]; /*!< MAC address */
|
||||
} ES_WIFI_APSettings_t;
|
||||
|
||||
typedef struct {
|
||||
ES_WIFI_AP_t AP[ES_WIFI_MAX_DETECTED_AP];
|
||||
uint8_t nbr;
|
||||
|
||||
}ES_WIFI_APs_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t SSID[ES_WIFI_MAX_SSID_NAME_SIZE + 1];
|
||||
uint8_t pswd[ES_WIFI_MAX_PSWD_NAME_SIZE + 1];
|
||||
ES_WIFI_SecurityType_t Security;
|
||||
uint8_t DHCP_IsEnabled;
|
||||
uint8_t JoinRetries;
|
||||
uint8_t IsConnected;
|
||||
uint8_t AutoConnect;
|
||||
ES_WIFI_IPVer_t IP_Ver;
|
||||
uint8_t IP_Addr[4];
|
||||
uint8_t IP_Mask[4];
|
||||
uint8_t Gateway_Addr[4];
|
||||
uint8_t DNS1[4];
|
||||
uint8_t DNS2[4];
|
||||
} ES_WIFI_Network_t;
|
||||
|
||||
#if (ES_WIFI_USE_AWS == 1)
|
||||
typedef struct {
|
||||
ES_WIFI_ConnType_t Type;
|
||||
uint8_t Number;
|
||||
uint16_t RemotePort;
|
||||
uint8_t RemoteIP[4];
|
||||
uint8_t *PublishTopic;
|
||||
uint8_t *SubscribeTopic;
|
||||
uint8_t *ClientID;
|
||||
uint8_t MQTTMode;
|
||||
} ES_WIFI_AWS_Conn_t;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
ES_WIFI_ConnType_t Type;
|
||||
uint8_t Number;
|
||||
uint16_t RemotePort;
|
||||
uint16_t LocalPort;
|
||||
uint8_t RemoteIP[4];
|
||||
char* Name;
|
||||
} ES_WIFI_Conn_t;
|
||||
|
||||
typedef struct {
|
||||
IO_Init_Func IO_Init;
|
||||
IO_DeInit_Func IO_DeInit;
|
||||
IO_Delay_Func IO_Delay;
|
||||
IO_Send_Func IO_Send;
|
||||
IO_Receive_Func IO_Receive;
|
||||
} ES_WIFI_IO_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t Product_ID[ES_WIFI_PRODUCT_ID_SIZE];
|
||||
uint8_t FW_Rev[ES_WIFI_FW_REV_SIZE];
|
||||
uint8_t API_Rev[ES_WIFI_API_REV_SIZE];
|
||||
uint8_t Stack_Rev[ES_WIFI_STACK_REV_SIZE];
|
||||
uint8_t RTOS_Rev[ES_WIFI_RTOS_REV_SIZE];
|
||||
uint8_t Product_Name[ES_WIFI_PRODUCT_NAME_SIZE];
|
||||
uint32_t CPU_Clock;
|
||||
ES_WIFI_SecurityType_t Security;
|
||||
ES_WIFI_Network_t NetSettings;
|
||||
ES_WIFI_APSettings_t APSettings;
|
||||
ES_WIFI_IO_t fops;
|
||||
uint8_t CmdData[ES_WIFI_DATA_SIZE];
|
||||
uint32_t Timeout;
|
||||
uint32_t BufferSize;
|
||||
}ES_WIFIObject_t;
|
||||
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
ES_WIFI_Status_t ES_WIFI_Init(ES_WIFIObject_t *Obj);
|
||||
ES_WIFI_Status_t ES_WIFI_SetTimeout(ES_WIFIObject_t *Obj, uint32_t Timeout);
|
||||
ES_WIFI_Status_t ES_WIFI_ListAccessPoints(ES_WIFIObject_t *Obj, ES_WIFI_APs_t *APs);
|
||||
ES_WIFI_Status_t ES_WIFI_Connect(ES_WIFIObject_t *Obj, const char* SSID, const char* Password,
|
||||
ES_WIFI_SecurityType_t SecType);
|
||||
ES_WIFI_Status_t ES_WIFI_Disconnect(ES_WIFIObject_t *Obj);
|
||||
uint8_t ES_WIFI_IsConnected(ES_WIFIObject_t *Obj);
|
||||
ES_WIFI_Status_t ES_WIFI_GetNetworkSettings(ES_WIFIObject_t *Obj);
|
||||
ES_WIFI_Status_t ES_WIFI_GetMACAddress(ES_WIFIObject_t *Obj, uint8_t *mac);
|
||||
ES_WIFI_Status_t ES_WIFI_GetIPAddress(ES_WIFIObject_t *Obj, uint8_t *ipaddr);
|
||||
ES_WIFI_Status_t ES_WIFI_GetProductID(ES_WIFIObject_t *Obj, uint8_t *productID);
|
||||
ES_WIFI_Status_t ES_WIFI_GetFWRevID(ES_WIFIObject_t *Obj, uint8_t *FWRev);
|
||||
ES_WIFI_Status_t ES_WIFI_GetRTOSRev(ES_WIFIObject_t *Obj, uint8_t *RTOSRev);
|
||||
ES_WIFI_Status_t ES_WIFI_GetProductName(ES_WIFIObject_t *Obj, uint8_t *productName);
|
||||
ES_WIFI_Status_t ES_WIFI_GetAPIRev(ES_WIFIObject_t *Obj, uint8_t *APIRev);
|
||||
ES_WIFI_Status_t ES_WIFI_GetStackRev(ES_WIFIObject_t *Obj, uint8_t *StackRev);
|
||||
|
||||
|
||||
ES_WIFI_Status_t ES_WIFI_SetMACAddress(ES_WIFIObject_t *Obj, uint8_t *mac);
|
||||
ES_WIFI_Status_t ES_WIFI_ResetToFactoryDefault(ES_WIFIObject_t *Obj);
|
||||
ES_WIFI_Status_t ES_WIFI_ResetModule(ES_WIFIObject_t *Obj);
|
||||
ES_WIFI_Status_t ES_WIFI_SetProductName(ES_WIFIObject_t *Obj, uint8_t *ProductName);
|
||||
#if (ES_WIFI_USE_PING == 1)
|
||||
ES_WIFI_Status_t ES_WIFI_Ping(ES_WIFIObject_t *Obj, uint8_t *address, uint16_t count, uint16_t interval_ms);
|
||||
#endif
|
||||
ES_WIFI_Status_t ES_WIFI_DNS_LookUp(ES_WIFIObject_t *Obj, const char *url, uint8_t *ipaddress);
|
||||
ES_WIFI_Status_t ES_WIFI_StartClientConnection(ES_WIFIObject_t *Obj, ES_WIFI_Conn_t *conn);
|
||||
ES_WIFI_Status_t ES_WIFI_StopClientConnection(ES_WIFIObject_t *Obj, ES_WIFI_Conn_t *conn);
|
||||
#if (ES_WIFI_USE_AWS == 1)
|
||||
ES_WIFI_Status_t ES_WIFI_StartAWSClientConnection(ES_WIFIObject_t *Obj, ES_WIFI_AWS_Conn_t *conn);
|
||||
#endif
|
||||
ES_WIFI_Status_t ES_WIFI_StartServerSingleConn(ES_WIFIObject_t *Obj, ES_WIFI_Conn_t *conn);
|
||||
ES_WIFI_Status_t ES_WIFI_StopServerSingleConn(ES_WIFIObject_t *Obj);
|
||||
ES_WIFI_Status_t ES_WIFI_StartServerMultiConn(ES_WIFIObject_t *Obj, ES_WIFI_Conn_t *conn);
|
||||
ES_WIFI_Status_t ES_WIFI_StopServerMultiConn(ES_WIFIObject_t *Obj);
|
||||
ES_WIFI_Status_t ES_WIFI_SendData(ES_WIFIObject_t *Obj, uint8_t Socket, uint8_t *pdata, uint16_t Reqlen , uint16_t *SentLen, uint32_t timeout);
|
||||
ES_WIFI_Status_t ES_WIFI_ReceiveData(ES_WIFIObject_t *Obj, uint8_t Socket, uint8_t *pdata, uint16_t Reqlen, uint16_t *Receivedlen, uint32_t timeout);
|
||||
ES_WIFI_Status_t ES_WIFI_ActivateAP(ES_WIFIObject_t *Obj, ES_WIFI_APConfig_t *ApConfig);
|
||||
ES_WIFI_APState_t ES_WIFI_WaitAPStateChange(ES_WIFIObject_t *Obj);
|
||||
|
||||
#if (ES_WIFI_USE_FIRMWAREUPDATE == 1)
|
||||
ES_WIFI_Status_t ES_WIFI_OTA_Upgrade(ES_WIFIObject_t *Obj, uint8_t *link);
|
||||
#endif
|
||||
|
||||
#if (ES_WIFI_USE_UART == 1)
|
||||
ES_WIFI_Status_t ES_WIFI_SetUARTBaudRate(ES_WIFIObject_t *Obj, uint16_t BaudRate);
|
||||
ES_WIFI_Status_t ES_WIFI_GetUARTConfig(ES_WIFIObject_t *Obj, ES_WIFI_UARTConfig_t *pconf);
|
||||
#endif
|
||||
|
||||
ES_WIFI_Status_t ES_WIFI_GetSystemConfig(ES_WIFIObject_t *Obj, ES_WIFI_SystemConfig_t *pconf);
|
||||
|
||||
ES_WIFI_Status_t ES_WIFI_RegisterBusIO(ES_WIFIObject_t *Obj, IO_Init_Func IO_Init,
|
||||
IO_DeInit_Func IO_DeInit,
|
||||
IO_Delay_Func IO_Delay,
|
||||
IO_Send_Func IO_Send,
|
||||
IO_Receive_Func IO_Receive);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*__ES_WIFI_H*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file es_wifi_conf_template.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 23-02-2017
|
||||
* @brief es-wifi configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution 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 other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ES_WIFI_CONF_H
|
||||
#define __ES_WIFI_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
#define ES_WIFI_MAX_SSID_NAME_SIZE 32
|
||||
#define ES_WIFI_MAX_PSWD_NAME_SIZE 32
|
||||
#define ES_WIFI_PRODUCT_ID_SIZE 32
|
||||
#define ES_WIFI_PRODUCT_NAME_SIZE 32
|
||||
#define ES_WIFI_FW_REV_SIZE 16
|
||||
#define ES_WIFI_API_REV_SIZE 16
|
||||
#define ES_WIFI_STACK_REV_SIZE 16
|
||||
#define ES_WIFI_RTOS_REV_SIZE 16
|
||||
|
||||
#define ES_WIFI_DATA_SIZE 1600
|
||||
#define ES_WIFI_MAX_DETECTED_AP 10
|
||||
|
||||
#define ES_WIFI_TIMEOUT 0xFFFF
|
||||
|
||||
#define ES_WIFI_USE_PING 1
|
||||
#define ES_WIFI_USE_AWS 0
|
||||
#define ES_WIFI_USE_FIRMWAREUPDATE 0
|
||||
#define ES_WIFI_USE_WPS 0
|
||||
|
||||
#define ES_WIFI_USE_SPI 0
|
||||
#define ES_WIFI_USE_UART (!ES_WIFI_USE_SPI)
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __ES_WIFI_CONF_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head>
|
||||
<body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for FT6X06 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2016 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1
|
||||
/ 03-May-2016 <o:p></o:p></span></h3>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">Add support of FT6x36 Touch controller<br>
|
||||
</span></li>
|
||||
</ul>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 03-August-2015 <o:p></o:p></span></h3>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="padding: 0cm;" valign="top"><br>
|
||||
</td></tr></tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,514 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file ft6x06.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.1
|
||||
* @date 03-May-2016
|
||||
* @brief This file provides a set of functions needed to manage the FT6X06
|
||||
* IO Expander devices.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "ft6x06.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FT6X06
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT6X06_Private_Defines FT6X06 Private Defines
|
||||
* @{
|
||||
*/
|
||||
#define FT6x06_MAX_INSTANCE 2
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT6X06_Private_Variables FT6X06 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
|
||||
};
|
||||
|
||||
/* ft6x06 instances by address */
|
||||
uint8_t ft6x06[FT6x06_MAX_INSTANCE] = {0};
|
||||
|
||||
/* Global ft6x06 handle */
|
||||
static ft6x06_handle_TypeDef ft6x06_handle = { FT6206_I2C_NOT_INITIALIZED, 0, 0};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ft6x06_Private_Function_Prototypes ft6x06 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: FT6206 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: FT6206 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 ft6x06_Private_Functions ft6x06 Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize the ft6x06 communication bus
|
||||
* from MCU to FT6206 : ie I2C channel initialization (if required).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
|
||||
* @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 ft6x06.
|
||||
* @note : Not applicable to FT6206.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_Reset(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Do nothing */
|
||||
/* No software reset sequence available in FT6206 IC */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the ft6x06 device ID, pre initialize I2C in case of need to be
|
||||
* able to read the FT6206 device ID, and verify this is a FT6206.
|
||||
* @param DeviceAddr: I2C FT6x06 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 FT6206 */
|
||||
ft6x06_TS_Configure(DeviceAddr);
|
||||
|
||||
/* By default set FT6206 IC in Polling mode : no INT generation on FT6206 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 ft6x06 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 FT6206 device to generate IT on given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT6206).
|
||||
* @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 FT6206 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 FT6206).
|
||||
* @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 FT6206 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 FT6206.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
|
||||
* @retval TS interrupts status : always return 0 here
|
||||
*/
|
||||
uint8_t ft6x06_TS_ITStatus(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Always return 0 as feature not applicable to FT6206 */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear IT status in FT6206 interrupt status clear registers
|
||||
* Should be called Following an EXTI coming to the MCU.
|
||||
* @note : This feature is not applicable to FT6206.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_TS_ClearIT(uint16_t DeviceAddr)
|
||||
{
|
||||
/* Nothing to be done here for FT6206 */
|
||||
}
|
||||
|
||||
/**** 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 FT6x06).
|
||||
* @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 FT6x06).
|
||||
* @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: FT6206 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 FT6206 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: FT6206 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 FT6206 */
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,471 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file ft6x06.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.1
|
||||
* @date 03-May-2016
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* ft6x06.c IO expander driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 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 __FT6X06_H
|
||||
#define __FT6X06_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 FT6X06
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT6X06_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup FT6X06_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 FT6x36 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 FT6206 I2C register addresses on 8 bit
|
||||
**/
|
||||
|
||||
/* Current mode register of the FT6206 (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 FT6206 system is in (R) */
|
||||
#define FT6206_PWR_MODE_REG 0xA5
|
||||
|
||||
/* FT6206 firmware version */
|
||||
#define FT6206_FIRMID_REG 0xA6
|
||||
|
||||
/* FT6206 Chip identification register */
|
||||
#define FT6206_CHIP_ID_REG 0xA8
|
||||
|
||||
/* Possible values of FT6206_CHIP_ID_REG */
|
||||
#define FT6206_ID_VALUE 0x11
|
||||
#define FT6x36_ID_VALUE 0xCD
|
||||
|
||||
/* Release code version */
|
||||
#define FT6206_RELEASE_CODE_ID_REG 0xAF
|
||||
|
||||
/* Current operating mode the FT6206 system is in (R) */
|
||||
#define FT6206_STATE_REG 0xBC
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup ft6x06_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup ft6x06_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief ft6x06 Control functions
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize the ft6x06 communication bus
|
||||
* from MCU to FT6206 : ie I2C channel initialization (if required).
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_Init(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Software Reset the ft6x06.
|
||||
* @param DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_Reset(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Read the ft6x06 device ID, pre intitalize I2C in case of need to be
|
||||
* able to read the FT6206 device ID, and verify this is a FT6206.
|
||||
* @param DeviceAddr: I2C FT6x06 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 FT6206 device to generate IT on given INT pin
|
||||
* connected to MCU as EXTI.
|
||||
* @param DeviceAddr: Device address on communication Bus (Slave I2C address of FT6206).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_TS_EnableIT(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Configure the FT6206 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 FT6206).
|
||||
* @retval None
|
||||
*/
|
||||
void ft6x06_TS_DisableIT(uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Get IT status from FT6206 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 FT6206).
|
||||
* @retval TS interrupts status
|
||||
*/
|
||||
uint8_t ft6x06_TS_ITStatus (uint16_t DeviceAddr);
|
||||
|
||||
/**
|
||||
* @brief Clear IT status in FT6206 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 FT6206).
|
||||
* @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 FT6x06).
|
||||
* @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 FT6x06).
|
||||
* @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 ft6x06_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 ft6x06_Imported_Globals
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* Touch screen driver structure */
|
||||
extern TS_DrvTypeDef ft6x06_ts_drv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __FT6X06_H */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 HTS221 BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for HTS221 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2017 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 14-February-2017 <o:p></o:p></span></h3>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release of HTS221 </span><span style="font-size: 10pt; font-family: Verdana;">Temperature/Humidity</span><span style="font-size: 10pt; font-family: Verdana;"> sensor<br>
|
||||
</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="padding: 0cm;" valign="top"><br>
|
||||
</td></tr></tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file hts221.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 14-February-2017
|
||||
* @brief This file provides a set of functions needed to manage the HTS221
|
||||
* humidity and temperature devices
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "hts221.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221 HTS221
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221_Private_Variables HTS221 Private Variables
|
||||
* @{
|
||||
*/
|
||||
/* HTS221 Humidity Private Variables */
|
||||
HSENSOR_DrvTypeDef HTS221_H_Drv =
|
||||
{
|
||||
HTS221_H_Init,
|
||||
HTS221_H_ReadID,
|
||||
HTS221_H_ReadHumidity
|
||||
};
|
||||
|
||||
/* HTS221_Temperature_Private_Variables */
|
||||
TSENSOR_DrvTypeDef HTS221_T_Drv =
|
||||
{
|
||||
HTS221_T_Init,
|
||||
0,
|
||||
0,
|
||||
HTS221_T_ReadTemp
|
||||
};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221_Humidity_Private_Functions HTS221 Humidity Private Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Set HTS221 humidity sensor Initialization.
|
||||
*/
|
||||
void HTS221_H_Init(uint16_t DeviceAddr)
|
||||
{
|
||||
uint8_t tmp;
|
||||
|
||||
/* Read CTRL_REG1 */
|
||||
tmp = SENSOR_IO_Read(DeviceAddr, HTS221_CTRL_REG1);
|
||||
|
||||
/* Enable BDU */
|
||||
tmp &= ~HTS221_BDU_MASK;
|
||||
tmp |= (1 << HTS221_BDU_BIT);
|
||||
|
||||
/* Set default ODR */
|
||||
tmp &= ~HTS221_ODR_MASK;
|
||||
tmp |= (uint8_t)0x01; /* Set ODR to 1Hz */
|
||||
|
||||
/* Activate the device */
|
||||
tmp |= HTS221_PD_MASK;
|
||||
|
||||
/* Apply settings to CTRL_REG1 */
|
||||
SENSOR_IO_Write(DeviceAddr, HTS221_CTRL_REG1, tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read HTS221 ID.
|
||||
* @retval ID
|
||||
*/
|
||||
uint8_t HTS221_H_ReadID(uint16_t DeviceAddr)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
|
||||
/* IO interface initialization */
|
||||
SENSOR_IO_Init();
|
||||
|
||||
/* Read value at Who am I register address */
|
||||
ctrl = SENSOR_IO_Read(DeviceAddr, HTS221_WHO_AM_I_REG);
|
||||
|
||||
return ctrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read humidity value of HTS221
|
||||
* @retval humidity value;
|
||||
*/
|
||||
float HTS221_H_ReadHumidity(uint16_t DeviceAddr)
|
||||
{
|
||||
int16_t H0_T0_out, H1_T0_out, H_T_out;
|
||||
int16_t H0_rh, H1_rh;
|
||||
uint8_t buffer[2];
|
||||
float tmp_f;
|
||||
|
||||
SENSOR_IO_ReadMultiple(DeviceAddr, (HTS221_H0_RH_X2 | 0x80), buffer, 2);
|
||||
|
||||
H0_rh = buffer[0] >> 1;
|
||||
H1_rh = buffer[1] >> 1;
|
||||
|
||||
SENSOR_IO_ReadMultiple(DeviceAddr, (HTS221_H0_T0_OUT_L | 0x80), buffer, 2);
|
||||
|
||||
H0_T0_out = (((uint16_t)buffer[1]) << 8) | (uint16_t)buffer[0];
|
||||
|
||||
SENSOR_IO_ReadMultiple(DeviceAddr, (HTS221_H1_T0_OUT_L | 0x80), buffer, 2);
|
||||
|
||||
H1_T0_out = (((uint16_t)buffer[1]) << 8) | (uint16_t)buffer[0];
|
||||
|
||||
SENSOR_IO_ReadMultiple(DeviceAddr, (HTS221_HR_OUT_L_REG | 0x80), buffer, 2);
|
||||
|
||||
H_T_out = (((uint16_t)buffer[1]) << 8) | (uint16_t)buffer[0];
|
||||
|
||||
tmp_f = (float)(H_T_out - H0_T0_out) * (float)(H1_rh - H0_rh) / (float)(H1_T0_out - H0_T0_out) + H0_rh;
|
||||
tmp_f *= 10.0f;
|
||||
|
||||
tmp_f = ( tmp_f > 1000.0f ) ? 1000.0f
|
||||
: ( tmp_f < 0.0f ) ? 0.0f
|
||||
: tmp_f;
|
||||
|
||||
return (tmp_f / 10.0f);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221_Temperature_Private_Functions HTS221 Temperature Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set HTS221 temperature sensor Initialization.
|
||||
* @param DeviceAddr: I2C device address
|
||||
* @param InitStruct: pointer to a TSENSOR_InitTypeDef structure
|
||||
* that contains the configuration setting for the HTS221.
|
||||
*/
|
||||
void HTS221_T_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct)
|
||||
{
|
||||
uint8_t tmp;
|
||||
|
||||
/* Read CTRL_REG1 */
|
||||
tmp = SENSOR_IO_Read(DeviceAddr, HTS221_CTRL_REG1);
|
||||
|
||||
/* Enable BDU */
|
||||
tmp &= ~HTS221_BDU_MASK;
|
||||
tmp |= (1 << HTS221_BDU_BIT);
|
||||
|
||||
/* Set default ODR */
|
||||
tmp &= ~HTS221_ODR_MASK;
|
||||
tmp |= (uint8_t)0x01; /* Set ODR to 1Hz */
|
||||
|
||||
/* Activate the device */
|
||||
tmp |= HTS221_PD_MASK;
|
||||
|
||||
/* Apply settings to CTRL_REG1 */
|
||||
SENSOR_IO_Write(DeviceAddr, HTS221_CTRL_REG1, tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read temperature value of HTS221
|
||||
* @param DeviceAddr: I2C device address
|
||||
* @retval temperature value
|
||||
*/
|
||||
float HTS221_T_ReadTemp(uint16_t DeviceAddr)
|
||||
{
|
||||
int16_t T0_out, T1_out, T_out, T0_degC_x8_u16, T1_degC_x8_u16;
|
||||
int16_t T0_degC, T1_degC;
|
||||
uint8_t buffer[4], tmp;
|
||||
float tmp_f;
|
||||
|
||||
SENSOR_IO_ReadMultiple(DeviceAddr, (HTS221_T0_DEGC_X8 | 0x80), buffer, 2);
|
||||
tmp = SENSOR_IO_Read(DeviceAddr, HTS221_T0_T1_DEGC_H2);
|
||||
|
||||
T0_degC_x8_u16 = (((uint16_t)(tmp & 0x03)) << 8) | ((uint16_t)buffer[0]);
|
||||
T1_degC_x8_u16 = (((uint16_t)(tmp & 0x0C)) << 6) | ((uint16_t)buffer[1]);
|
||||
T0_degC = T0_degC_x8_u16 >> 3;
|
||||
T1_degC = T1_degC_x8_u16 >> 3;
|
||||
|
||||
SENSOR_IO_ReadMultiple(DeviceAddr, (HTS221_T0_OUT_L | 0x80), buffer, 4);
|
||||
|
||||
T0_out = (((uint16_t)buffer[1]) << 8) | (uint16_t)buffer[0];
|
||||
T1_out = (((uint16_t)buffer[3]) << 8) | (uint16_t)buffer[2];
|
||||
|
||||
SENSOR_IO_ReadMultiple(DeviceAddr, (HTS221_TEMP_OUT_L_REG | 0x80), buffer, 2);
|
||||
|
||||
T_out = (((uint16_t)buffer[1]) << 8) | (uint16_t)buffer[0];
|
||||
|
||||
tmp_f = (float)(T_out - T0_out) * (float)(T1_degC - T0_degC) / (float)(T1_out - T0_out) + T0_degC;
|
||||
|
||||
return tmp_f;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,338 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file hts221.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 14-February-2017
|
||||
* @brief HTS221 header driver file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __HTS221__H
|
||||
#define __HTS221__H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/hsensor.h"
|
||||
#include "../Common/tsensor.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup HTS221
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221_Exported_Constants HTS221 Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Bitfield positioning.
|
||||
*/
|
||||
#define HTS221_BIT(x) ((uint8_t)x)
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device Identification register.
|
||||
* Read
|
||||
* Default value: 0xBC
|
||||
* 7:0 This read-only register contains the device identifier for HTS221.
|
||||
*/
|
||||
#define HTS221_WHO_AM_I_REG (uint8_t)0x0F
|
||||
|
||||
/**
|
||||
* @brief Device Identification value.
|
||||
*/
|
||||
#define HTS221_WHO_AM_I_VAL (uint8_t)0xBC
|
||||
|
||||
|
||||
/**
|
||||
* @brief Humidity and temperature average mode register.
|
||||
* Read/write
|
||||
* Default value: 0x1B
|
||||
* 7:6 Reserved.
|
||||
* 5:3 AVGT2-AVGT1-AVGT0: Select the temperature internal average.
|
||||
*
|
||||
* AVGT2 | AVGT1 | AVGT0 | Nr. Internal Average
|
||||
* ----------------------------------------------------
|
||||
* 0 | 0 | 0 | 2
|
||||
* 0 | 0 | 1 | 4
|
||||
* 0 | 1 | 0 | 8
|
||||
* 0 | 1 | 1 | 16
|
||||
* 1 | 0 | 0 | 32
|
||||
* 1 | 0 | 1 | 64
|
||||
* 1 | 1 | 0 | 128
|
||||
* 1 | 1 | 1 | 256
|
||||
*
|
||||
* 2:0 AVGH2-AVGH1-AVGH0: Select humidity internal average.
|
||||
* AVGH2 | AVGH1 | AVGH0 | Nr. Internal Average
|
||||
* ------------------------------------------------------
|
||||
* 0 | 0 | 0 | 4
|
||||
* 0 | 0 | 1 | 8
|
||||
* 0 | 1 | 0 | 16
|
||||
* 0 | 1 | 1 | 32
|
||||
* 1 | 0 | 0 | 64
|
||||
* 1 | 0 | 1 | 128
|
||||
* 1 | 1 | 0 | 256
|
||||
* 1 | 1 | 1 | 512
|
||||
*
|
||||
*/
|
||||
#define HTS221_AV_CONF_REG (uint8_t)0x10
|
||||
|
||||
#define HTS221_AVGT_BIT HTS221_BIT(3)
|
||||
#define HTS221_AVGH_BIT HTS221_BIT(0)
|
||||
|
||||
#define HTS221_AVGH_MASK (uint8_t)0x07
|
||||
#define HTS221_AVGT_MASK (uint8_t)0x38
|
||||
|
||||
/**
|
||||
* @brief Control register 1.
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7 PD: power down control. 0 - power down mode; 1 - active mode.
|
||||
* 6:3 Reserved.
|
||||
* 2 BDU: block data update. 0 - continuous update
|
||||
* 1 - output registers not updated until MSB and LSB reading.
|
||||
* 1:0 ODR1, ODR0: output data rate selection.
|
||||
*
|
||||
* ODR1 | ODR0 | Humidity output data-rate(Hz) | Pressure output data-rate(Hz)
|
||||
* ----------------------------------------------------------------------------------
|
||||
* 0 | 0 | one shot | one shot
|
||||
* 0 | 1 | 1 | 1
|
||||
* 1 | 0 | 7 | 7
|
||||
* 1 | 1 | 12.5 | 12.5
|
||||
*
|
||||
*/
|
||||
#define HTS221_CTRL_REG1 (uint8_t)0x20
|
||||
|
||||
#define HTS221_PD_BIT HTS221_BIT(7)
|
||||
#define HTS221_BDU_BIT HTS221_BIT(2)
|
||||
#define HTS221_ODR_BIT HTS221_BIT(0)
|
||||
|
||||
#define HTS221_PD_MASK (uint8_t)0x80
|
||||
#define HTS221_BDU_MASK (uint8_t)0x04
|
||||
#define HTS221_ODR_MASK (uint8_t)0x03
|
||||
|
||||
/**
|
||||
* @brief Control register 2.
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7 BOOT: Reboot memory content. 0: normal mode
|
||||
* 1: reboot memory content. Self-cleared upon completation.
|
||||
* 6:2 Reserved.
|
||||
* 1 HEATHER: 0: heater enable; 1: heater disable.
|
||||
* 0 ONE_SHOT: 0: waiting for start of conversion
|
||||
* 1: start for a new dataset. Self-cleared upon completation.
|
||||
*/
|
||||
#define HTS221_CTRL_REG2 (uint8_t)0x21
|
||||
|
||||
#define HTS221_BOOT_BIT HTS221_BIT(7)
|
||||
#define HTS221_HEATHER_BIT HTS221_BIT(1)
|
||||
#define HTS221_ONESHOT_BIT HTS221_BIT(0)
|
||||
|
||||
#define HTS221_BOOT_MASK (uint8_t)0x80
|
||||
#define HTS221_HEATHER_MASK (uint8_t)0x02
|
||||
#define HTS221_ONE_SHOT_MASK (uint8_t)0x01
|
||||
|
||||
/**
|
||||
* @brief Control register 3.
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7 DRDY_H_L: Interrupt edge. 0: active high, 1: active low.
|
||||
* 6 PP_OD: Push-Pull/OpenDrain selection on interrupt pads. 0: push-pull
|
||||
* 1: open drain.
|
||||
* 5:3 Reserved.
|
||||
* 2 DRDY: interrupt config. 0: disable, 1: enable.
|
||||
*/
|
||||
#define HTS221_CTRL_REG3 (uint8_t)0x22
|
||||
|
||||
#define HTS221_DRDY_H_L_BIT HTS221_BIT(7)
|
||||
#define HTS221_PP_OD_BIT HTS221_BIT(6)
|
||||
#define HTS221_DRDY_BIT HTS221_BIT(2)
|
||||
|
||||
#define HTS221_DRDY_H_L_MASK (uint8_t)0x80
|
||||
#define HTS221_PP_OD_MASK (uint8_t)0x40
|
||||
#define HTS221_DRDY_MASK (uint8_t)0x04
|
||||
|
||||
/**
|
||||
* @brief Status register.
|
||||
* Read
|
||||
* Default value: 0x00
|
||||
* 7:2 Reserved.
|
||||
* 1 H_DA: Humidity data available. 0: new data for humidity is not yet available
|
||||
* 1: new data for humidity is available.
|
||||
* 0 T_DA: Temperature data available. 0: new data for temperature is not yet available
|
||||
* 1: new data for temperature is available.
|
||||
*/
|
||||
#define HTS221_STATUS_REG (uint8_t)0x27
|
||||
|
||||
#define HTS221_H_DA_BIT HTS221_BIT(1)
|
||||
#define HTS221_T_DA_BIT HTS221_BIT(0)
|
||||
|
||||
#define HTS221_HDA_MASK (uint8_t)0x02
|
||||
#define HTS221_TDA_MASK (uint8_t)0x01
|
||||
|
||||
/**
|
||||
* @brief Humidity data (LSB).
|
||||
* Read
|
||||
* Default value: 0x00.
|
||||
* HOUT7 - HOUT0: Humidity data LSB (2's complement).
|
||||
*/
|
||||
#define HTS221_HR_OUT_L_REG (uint8_t)0x28
|
||||
|
||||
/**
|
||||
* @brief Humidity data (MSB).
|
||||
* Read
|
||||
* Default value: 0x00.
|
||||
* HOUT15 - HOUT8: Humidity data MSB (2's complement).
|
||||
*/
|
||||
#define HTS221_HR_OUT_H_REG (uint8_t)0x29
|
||||
|
||||
/**
|
||||
* @brief Temperature data (LSB).
|
||||
* Read
|
||||
* Default value: 0x00.
|
||||
* TOUT7 - TOUT0: temperature data LSB.
|
||||
*/
|
||||
#define HTS221_TEMP_OUT_L_REG (uint8_t)0x2A
|
||||
|
||||
/**
|
||||
* @brief Temperature data (MSB).
|
||||
* Read
|
||||
* Default value: 0x00.
|
||||
* TOUT15 - TOUT8: temperature data MSB.
|
||||
*/
|
||||
#define HTS221_TEMP_OUT_H_REG (uint8_t)0x2B
|
||||
|
||||
/**
|
||||
* @brief Calibration registers.
|
||||
* Read
|
||||
*/
|
||||
#define HTS221_H0_RH_X2 (uint8_t)0x30
|
||||
#define HTS221_H1_RH_X2 (uint8_t)0x31
|
||||
#define HTS221_T0_DEGC_X8 (uint8_t)0x32
|
||||
#define HTS221_T1_DEGC_X8 (uint8_t)0x33
|
||||
#define HTS221_T0_T1_DEGC_H2 (uint8_t)0x35
|
||||
#define HTS221_H0_T0_OUT_L (uint8_t)0x36
|
||||
#define HTS221_H0_T0_OUT_H (uint8_t)0x37
|
||||
#define HTS221_H1_T0_OUT_L (uint8_t)0x3A
|
||||
#define HTS221_H1_T0_OUT_H (uint8_t)0x3B
|
||||
#define HTS221_T0_OUT_L (uint8_t)0x3C
|
||||
#define HTS221_T0_OUT_H (uint8_t)0x3D
|
||||
#define HTS221_T1_OUT_L (uint8_t)0x3E
|
||||
#define HTS221_T1_OUT_H (uint8_t)0x3F
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup HTS221_Humidity_Exported_Functions HTS221 Humidity Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/* HUMIDITY functions */
|
||||
void HTS221_H_Init(uint16_t DeviceAddr);
|
||||
uint8_t HTS221_H_ReadID(uint16_t DeviceAddr);
|
||||
float HTS221_H_ReadHumidity(uint16_t DeviceAddr);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221_HumImported_Globals Humidity Imported Globals
|
||||
* @{
|
||||
*/
|
||||
/* Humidity driver structure */
|
||||
extern HSENSOR_DrvTypeDef HTS221_H_Drv;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221_Temperature_Exported_Functions HTS221 Temperature Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/* TEMPERATURE functions */
|
||||
void HTS221_T_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct);
|
||||
float HTS221_T_ReadTemp(uint16_t DeviceAddr);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221_TempImported_Globals Temperature Imported Globals
|
||||
* @{
|
||||
*/
|
||||
/* Temperature driver structure */
|
||||
extern TSENSOR_DrvTypeDef HTS221_T_Drv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221_Imported_Functions HTS221 Imported Functions
|
||||
* @{
|
||||
*/
|
||||
/* IO functions */
|
||||
extern void SENSOR_IO_Init(void);
|
||||
extern void SENSOR_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
|
||||
extern uint8_t SENSOR_IO_Read(uint8_t Addr, uint8_t Reg);
|
||||
extern uint16_t SENSOR_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
extern void SENSOR_IO_WriteMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __HTS221__H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 LIS3MDL BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for LIS3MDL Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2017 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 14-February-2017 <o:p></o:p></span></h3>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release of LIS3MDL Magnetometer sensor<br>
|
||||
</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="padding: 0cm;" valign="top"><br>
|
||||
</td></tr></tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,220 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file lis3mdl.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 14-February-2017
|
||||
* @brief This file provides a set of functions needed to manage the LIS3MDL
|
||||
* magnetometer devices
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "lis3mdl.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LIS3MDL LIS3MDL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LIS3MDL_Mag_Private_Variables LIS3MDL Mag Private Variables
|
||||
* @{
|
||||
*/
|
||||
MAGNETO_DrvTypeDef Lis3mdlMagDrv =
|
||||
{
|
||||
LIS3MDL_MagInit,
|
||||
LIS3MDL_MagDeInit,
|
||||
LIS3MDL_MagReadID,
|
||||
0,
|
||||
LIS3MDL_MagLowPower,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
LIS3MDL_MagReadXYZ
|
||||
};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup LIS3MDL_Mag_Private_Functions LIS3MDL Mag Private Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Set LIS3MDL Magnetometer Initialization.
|
||||
* @param LIS3MDL_InitStruct: pointer to a LIS3MDL_MagInitTypeDef structure
|
||||
* that contains the configuration setting for the LIS3MDL.
|
||||
*/
|
||||
void LIS3MDL_MagInit(MAGNETO_InitTypeDef LIS3MDL_InitStruct)
|
||||
{
|
||||
SENSOR_IO_Write(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_CTRL_REG1, LIS3MDL_InitStruct.Register1);
|
||||
SENSOR_IO_Write(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_CTRL_REG2, LIS3MDL_InitStruct.Register2);
|
||||
SENSOR_IO_Write(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_CTRL_REG3, LIS3MDL_InitStruct.Register3);
|
||||
SENSOR_IO_Write(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_CTRL_REG4, LIS3MDL_InitStruct.Register4);
|
||||
SENSOR_IO_Write(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_CTRL_REG5, LIS3MDL_InitStruct.Register5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LIS3MDL Magnetometer De-initialization.
|
||||
*/
|
||||
void LIS3MDL_MagDeInit(void)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
|
||||
/* Read control register 1 value */
|
||||
ctrl = SENSOR_IO_Read(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_CTRL_REG3);
|
||||
|
||||
/* Clear Selection Mode bits */
|
||||
ctrl &= ~(LIS3MDL_MAG_SELECTION_MODE);
|
||||
|
||||
/* Set Power down */
|
||||
ctrl |= LIS3MDL_MAG_POWERDOWN2_MODE;
|
||||
|
||||
/* write back control register */
|
||||
SENSOR_IO_Write(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_CTRL_REG3, ctrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read LIS3MDL ID.
|
||||
* @retval ID
|
||||
*/
|
||||
uint8_t LIS3MDL_MagReadID(void)
|
||||
{
|
||||
/* IO interface initialization */
|
||||
SENSOR_IO_Init();
|
||||
/* Read value at Who am I register address */
|
||||
return (SENSOR_IO_Read(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_WHO_AM_I_REG));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set/Unset Magnetometer in low power mode.
|
||||
* @param status 0 means disable Low Power Mode, otherwise Low Power Mode is enabled
|
||||
*/
|
||||
void LIS3MDL_MagLowPower(uint16_t status)
|
||||
{
|
||||
uint8_t ctrl = 0;
|
||||
|
||||
/* Read control register 1 value */
|
||||
ctrl = SENSOR_IO_Read(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_CTRL_REG3);
|
||||
|
||||
/* Clear Low Power Mode bit */
|
||||
ctrl &= ~(0x20);
|
||||
|
||||
/* Set Low Power Mode */
|
||||
if(status)
|
||||
{
|
||||
ctrl |= LIS3MDL_MAG_CONFIG_LOWPOWER_MODE;
|
||||
}else
|
||||
{
|
||||
ctrl |= LIS3MDL_MAG_CONFIG_NORMAL_MODE;
|
||||
}
|
||||
|
||||
/* write back control register */
|
||||
SENSOR_IO_Write(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_CTRL_REG3, ctrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read X, Y & Z Magnetometer values
|
||||
* @param pData: Data out pointer
|
||||
*/
|
||||
void LIS3MDL_MagReadXYZ(int16_t* pData)
|
||||
{
|
||||
int16_t pnRawData[3];
|
||||
uint8_t ctrlm= 0;
|
||||
uint8_t buffer[6];
|
||||
uint8_t i = 0;
|
||||
float sensitivity = 0;
|
||||
|
||||
/* Read the magnetometer control register content */
|
||||
ctrlm = SENSOR_IO_Read(LIS3MDL_MAG_I2C_ADDRESS_HIGH, LIS3MDL_MAG_CTRL_REG2);
|
||||
|
||||
/* Read output register X, Y & Z acceleration */
|
||||
SENSOR_IO_ReadMultiple(LIS3MDL_MAG_I2C_ADDRESS_HIGH, (LIS3MDL_MAG_OUTX_L | 0x80), buffer, 6);
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
{
|
||||
pnRawData[i]=((((uint16_t)buffer[2*i+1]) << 8) + (uint16_t)buffer[2*i]);
|
||||
}
|
||||
|
||||
/* Normal mode */
|
||||
/* Switch the sensitivity value set in the CRTL_REG2 */
|
||||
switch(ctrlm & 0x60)
|
||||
{
|
||||
case LIS3MDL_MAG_FS_4_GA:
|
||||
sensitivity = LIS3MDL_MAG_SENSITIVITY_FOR_FS_4GA;
|
||||
break;
|
||||
case LIS3MDL_MAG_FS_8_GA:
|
||||
sensitivity = LIS3MDL_MAG_SENSITIVITY_FOR_FS_8GA;
|
||||
break;
|
||||
case LIS3MDL_MAG_FS_12_GA:
|
||||
sensitivity = LIS3MDL_MAG_SENSITIVITY_FOR_FS_12GA;
|
||||
break;
|
||||
case LIS3MDL_MAG_FS_16_GA:
|
||||
sensitivity = LIS3MDL_MAG_SENSITIVITY_FOR_FS_16GA;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Obtain the mGauss value for the three axis */
|
||||
for(i=0; i<3; i++)
|
||||
{
|
||||
pData[i]=( int16_t )(pnRawData[i] * sensitivity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
||||
|
|
@ -0,0 +1,232 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file lis3mdl.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 14-February-2017
|
||||
* @brief LIS3MDL header driver file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __LIS3MDL__H
|
||||
#define __LIS3MDL__H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/magneto.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup LIS3MDL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LIS3MDL_Exported_Constants LIS3MDL Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/************** I2C Address *****************/
|
||||
|
||||
#define LIS3MDL_MAG_I2C_ADDRESS_LOW ((uint8_t)0x38) // SAD[0] = 0
|
||||
#define LIS3MDL_MAG_I2C_ADDRESS_HIGH ((uint8_t)0x3C) // SAD[0] = 1
|
||||
|
||||
/************** Who am I *******************/
|
||||
|
||||
#define I_AM_LIS3MDL ((uint8_t)0x3D)
|
||||
|
||||
/************** Device Register *******************/
|
||||
|
||||
#define LIS3MDL_MAG_WHO_AM_I_REG 0x0F
|
||||
#define LIS3MDL_MAG_CTRL_REG1 0x20
|
||||
#define LIS3MDL_MAG_CTRL_REG2 0x21
|
||||
#define LIS3MDL_MAG_CTRL_REG3 0x22
|
||||
#define LIS3MDL_MAG_CTRL_REG4 0x23
|
||||
#define LIS3MDL_MAG_CTRL_REG5 0x24
|
||||
#define LIS3MDL_MAG_STATUS_REG 0x27
|
||||
#define LIS3MDL_MAG_OUTX_L 0x28
|
||||
#define LIS3MDL_MAG_OUTX_H 0x29
|
||||
#define LIS3MDL_MAG_OUTY_L 0x2A
|
||||
#define LIS3MDL_MAG_OUTY_H 0x2B
|
||||
#define LIS3MDL_MAG_OUTZ_L 0x2C
|
||||
#define LIS3MDL_MAG_OUTZ_H 0x2D
|
||||
#define LIS3MDL_MAG_TEMP_OUT_L 0x2E
|
||||
#define LIS3MDL_MAG_TEMP_OUT_H 0x2F
|
||||
#define LIS3MDL_MAG_INT_CFG 0x30
|
||||
#define LIS3MDL_MAG_INT_SRC 0x31
|
||||
#define LIS3MDL_MAG_INT_THS_L 0x32
|
||||
#define LIS3MDL_MAG_INT_THS_H 0x33
|
||||
|
||||
/* Mag Temperature Sensor Control*/
|
||||
#define LIS3MDL_MAG_TEMPSENSOR_ENABLE ((uint8_t) 0x80) /*!< Temp sensor Enable */
|
||||
#define LIS3MDL_MAG_TEMPSENSOR_DISABLE ((uint8_t) 0x00) /*!< Temp sensor Disable */
|
||||
|
||||
/* Mag_XY-axis Operating Mode */
|
||||
#define LIS3MDL_MAG_OM_XY_LOWPOWER ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_OM_XY_MEDIUM ((uint8_t) 0x20)
|
||||
#define LIS3MDL_MAG_OM_XY_HIGH ((uint8_t) 0x40)
|
||||
#define LIS3MDL_MAG_OM_XY_ULTRAHIGH ((uint8_t) 0x60)
|
||||
|
||||
/* Mag Data Rate */
|
||||
#define LIS3MDL_MAG_ODR_0_625_HZ ((uint8_t) 0x00) /*!< Output Data Rate = 0.625 Hz */
|
||||
#define LIS3MDL_MAG_ODR_1_25_HZ ((uint8_t) 0x04) /*!< Output Data Rate = 1.25 Hz */
|
||||
#define LIS3MDL_MAG_ODR_2_5_HZ ((uint8_t) 0x08) /*!< Output Data Rate = 2.5 Hz */
|
||||
#define LIS3MDL_MAG_ODR_5_0_HZ ((uint8_t) 0x0C) /*!< Output Data Rate = 5.0 Hz */
|
||||
#define LIS3MDL_MAG_ODR_10_HZ ((uint8_t) 0x10) /*!< Output Data Rate = 10 Hz */
|
||||
#define LIS3MDL_MAG_ODR_20_HZ ((uint8_t) 0x14) /*!< Output Data Rate = 20 Hz */
|
||||
#define LIS3MDL_MAG_ODR_40_HZ ((uint8_t) 0x18) /*!< Output Data Rate = 40 Hz */
|
||||
#define LIS3MDL_MAG_ODR_80_HZ ((uint8_t) 0x1C) /*!< Output Data Rate = 80 Hz */
|
||||
|
||||
/* Mag Data Rate */
|
||||
#define LMS303C_MAG_SELFTEST_DISABLE ((uint8_t 0x00)
|
||||
#define LMS303C_MAG_SELFTEST_ENABLE ((uint8_t 0x01)
|
||||
|
||||
/* Mag Full Scale */
|
||||
#define LIS3MDL_MAG_FS_DEFAULT ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_FS_4_GA ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_FS_8_GA ((uint8_t) 0x20)
|
||||
#define LIS3MDL_MAG_FS_12_GA ((uint8_t) 0x40)
|
||||
#define LIS3MDL_MAG_FS_16_GA ((uint8_t) 0x60) /*!< Full scale = ±16 Gauss */
|
||||
|
||||
/* Mag_Reboot */
|
||||
#define LIS3MDL_MAG_REBOOT_DEFAULT ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_REBOOT_ENABLE ((uint8_t) 0x08)
|
||||
|
||||
/* Mag Soft reset */
|
||||
#define LIS3MDL_MAG_SOFT_RESET_DEFAULT ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_SOFT_RESET_ENABLE ((uint8_t) 0x04)
|
||||
|
||||
/* Mag_Communication_Mode */
|
||||
#define LIS3MDL_MAG_SIM_4_WIRE ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_SIM_3_WIRE ((uint8_t) 0x04)
|
||||
|
||||
/* Mag Lowpower mode config */
|
||||
#define LIS3MDL_MAG_CONFIG_NORMAL_MODE ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_CONFIG_LOWPOWER_MODE ((uint8_t) 0x20)
|
||||
|
||||
/* Mag Operation Mode */
|
||||
#define LIS3MDL_MAG_SELECTION_MODE ((uint8_t) 0x03) /* CTRL_REG3 */
|
||||
#define LIS3MDL_MAG_CONTINUOUS_MODE ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_SINGLE_MODE ((uint8_t) 0x01)
|
||||
#define LIS3MDL_MAG_POWERDOWN1_MODE ((uint8_t) 0x02)
|
||||
#define LIS3MDL_MAG_POWERDOWN2_MODE ((uint8_t) 0x03)
|
||||
|
||||
/* Mag_Z-axis Operation Mode */
|
||||
#define LIS3MDL_MAG_OM_Z_LOWPOWER ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_OM_Z_MEDIUM ((uint8_t) 0x04)
|
||||
#define LIS3MDL_MAG_OM_Z_HIGH ((uint8_t) 0x08)
|
||||
#define LIS3MDL_MAG_OM_Z_ULTRAHIGH ((uint8_t) 0x0C)
|
||||
|
||||
/* Mag Big little-endian selection */
|
||||
#define LIS3MDL_MAG_BLE_LSB ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_BLE_MSB ((uint8_t) 0x02)
|
||||
|
||||
|
||||
/* Mag_Bloc_update_magnetic_data */
|
||||
#define LIS3MDL_MAG_BDU_CONTINUOUS ((uint8_t) 0x00)
|
||||
#define LIS3MDL_MAG_BDU_MSBLSB ((uint8_t) 0x40)
|
||||
|
||||
|
||||
/* Magnetometer_Sensitivity */
|
||||
#define LIS3MDL_MAG_SENSITIVITY_FOR_FS_4GA ((float)0.14f) /**< Sensitivity value for 4 gauss full scale [mgauss/LSB] */
|
||||
#define LIS3MDL_MAG_SENSITIVITY_FOR_FS_8GA ((float)0.29f) /**< Sensitivity value for 8 gauss full scale [mgauss/LSB] */
|
||||
#define LIS3MDL_MAG_SENSITIVITY_FOR_FS_12GA ((float)0.43f) /**< Sensitivity value for 12 gauss full scale [mgauss/LSB] */
|
||||
#define LIS3MDL_MAG_SENSITIVITY_FOR_FS_16GA ((float)0.58f) /**< Sensitivity value for 16 gauss full scale [mgauss/LSB] */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup LIS3MDL_Exported_Functions LIS3MDL Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
void LIS3MDL_MagInit(MAGNETO_InitTypeDef LIS3MDL_InitStruct);
|
||||
void LIS3MDL_MagDeInit(void);
|
||||
uint8_t LIS3MDL_MagReadID(void);
|
||||
void LIS3MDL_MagLowPower(uint16_t status);
|
||||
void LIS3MDL_MagReadXYZ(int16_t* pData);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup LIS3MDL_Imported_Functions LIS3MDL Imported Functions
|
||||
* @{
|
||||
*/
|
||||
/* IO functions */
|
||||
extern void SENSOR_IO_Init(void);
|
||||
extern void SENSOR_IO_DeInit(void);
|
||||
extern void SENSOR_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
|
||||
extern uint8_t SENSOR_IO_Read(uint8_t Addr, uint8_t Reg);
|
||||
extern uint16_t SENSOR_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
extern void SENSOR_IO_WriteMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LIS3MDL_Imported_Globals Imported Globals
|
||||
* @{
|
||||
*/
|
||||
/* MAG driver structure */
|
||||
extern MAGNETO_DrvTypeDef Lis3mdlMagDrv;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __LIS3MDL__H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 LPS22HB BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for LPS22HB Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2017 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 14-February-2017 <o:p></o:p></span></h3>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release of LPS22HB Temperature/Pressure sensor<br>
|
||||
</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="padding: 0cm;" valign="top"><br>
|
||||
</td></tr></tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,246 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file lps22hb.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 14-February-2017
|
||||
* @brief This file provides a set of functions needed to manage the LPS22HB
|
||||
* pressure and temperature devices
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "lps22hb.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LPS22HB LPS22HB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LPS22HB_Private_FunctionsPrototypes LPS22HB Private Functions Prototypes
|
||||
* @{
|
||||
*/
|
||||
static void LPS22HB_Init(uint16_t DeviceAddr);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LPS22HB_Private_Variables LPS22HB Private Variables
|
||||
* @{
|
||||
*/
|
||||
/* Pressure Private Variables */
|
||||
PSENSOR_DrvTypeDef LPS22HB_P_Drv =
|
||||
{
|
||||
LPS22HB_P_Init,
|
||||
LPS22HB_P_ReadID,
|
||||
LPS22HB_P_ReadPressure
|
||||
};
|
||||
|
||||
/* Temperature Private Variables */
|
||||
TSENSOR_DrvTypeDef LPS22HB_T_Drv =
|
||||
{
|
||||
LPS22HB_T_Init,
|
||||
0,
|
||||
0,
|
||||
LPS22HB_T_ReadTemp
|
||||
};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LPS22HB_Pressure_Private_Functions LPS22HB Pressure Private Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Set LPS22HB pressure sensor Initialization.
|
||||
*/
|
||||
void LPS22HB_P_Init(uint16_t DeviceAddr)
|
||||
{
|
||||
LPS22HB_Init(DeviceAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read LPS22HB ID.
|
||||
* @retval ID
|
||||
*/
|
||||
uint8_t LPS22HB_P_ReadID(uint16_t DeviceAddr)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
|
||||
/* IO interface initialization */
|
||||
SENSOR_IO_Init();
|
||||
|
||||
/* Read value at Who am I register address */
|
||||
ctrl = SENSOR_IO_Read(DeviceAddr, LPS22HB_WHO_AM_I_REG);
|
||||
|
||||
return ctrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read pressure value of LPS22HB
|
||||
* @retval pressure value
|
||||
*/
|
||||
float LPS22HB_P_ReadPressure(uint16_t DeviceAddr)
|
||||
{
|
||||
int32_t raw_press;
|
||||
uint8_t buffer[3];
|
||||
uint32_t tmp = 0;
|
||||
uint8_t i;
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
buffer[i] = SENSOR_IO_Read(DeviceAddr, (LPS22HB_PRESS_OUT_XL_REG + i));
|
||||
}
|
||||
|
||||
/* Build the raw data */
|
||||
for(i = 0; i < 3; i++)
|
||||
tmp |= (((uint32_t)buffer[i]) << (8 * i));
|
||||
|
||||
/* convert the 2's complement 24 bit to 2's complement 32 bit */
|
||||
if(tmp & 0x00800000)
|
||||
tmp |= 0xFF000000;
|
||||
|
||||
raw_press = ((int32_t)tmp);
|
||||
|
||||
raw_press = (raw_press * 100) / 4096;
|
||||
|
||||
return (float)((float)raw_press / 100.0f);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LPS22HB_Temperature_Private_Functions LPS22HB Temperature Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set LPS22HB temperature sensor Initialization.
|
||||
* @param DeviceAddr: I2C device address
|
||||
* @param InitStruct: pointer to a TSENSOR_InitTypeDef structure
|
||||
* that contains the configuration setting for the HTS221.
|
||||
* @retval None
|
||||
*/
|
||||
void LPS22HB_T_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct)
|
||||
{
|
||||
LPS22HB_Init(DeviceAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read temperature value of LPS22HB
|
||||
* @param DeviceAddr: I2C device address
|
||||
* @retval temperature value
|
||||
*/
|
||||
float LPS22HB_T_ReadTemp(uint16_t DeviceAddr)
|
||||
{
|
||||
int16_t raw_data;
|
||||
uint8_t buffer[2];
|
||||
uint16_t tmp;
|
||||
uint8_t i;
|
||||
|
||||
for(i = 0; i < 2; i++)
|
||||
{
|
||||
buffer[i] = SENSOR_IO_Read(DeviceAddr, (LPS22HB_TEMP_OUT_L_REG + i));
|
||||
}
|
||||
|
||||
/* Build the raw tmp */
|
||||
tmp = (((uint16_t)buffer[1]) << 8) + (uint16_t)buffer[0];
|
||||
|
||||
raw_data = (tmp * 10) / 100;
|
||||
|
||||
return ((float)(raw_data / 10.0f));
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup LPS22HB_Private_Functions LPS22HB Private functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set LPS22HB Initialization.
|
||||
* @param DeviceAddr: I2C device address
|
||||
* @retval None
|
||||
*/
|
||||
static void LPS22HB_Init(uint16_t DeviceAddr)
|
||||
{
|
||||
uint8_t tmp;
|
||||
|
||||
/* Set Power mode */
|
||||
tmp = SENSOR_IO_Read(DeviceAddr, LPS22HB_RES_CONF_REG);
|
||||
|
||||
tmp &= ~LPS22HB_LCEN_MASK;
|
||||
tmp |= (uint8_t)0x01; /* Set low current mode */
|
||||
|
||||
SENSOR_IO_Write(DeviceAddr, LPS22HB_RES_CONF_REG, tmp);
|
||||
|
||||
/* Read CTRL_REG1 */
|
||||
tmp = SENSOR_IO_Read(DeviceAddr, LPS22HB_CTRL_REG1);
|
||||
|
||||
/* Set default ODR */
|
||||
tmp &= ~LPS22HB_ODR_MASK;
|
||||
tmp |= (uint8_t)0x30; /* Set ODR to 25Hz */
|
||||
|
||||
/* Enable BDU */
|
||||
tmp &= ~LPS22HB_BDU_MASK;
|
||||
tmp |= ((uint8_t)0x02);
|
||||
|
||||
/* Apply settings to CTRL_REG1 */
|
||||
SENSOR_IO_Write(DeviceAddr, LPS22HB_CTRL_REG1, tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,534 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file lps22hb.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 14-February-2017
|
||||
* @brief LPS22HB header driver file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __LPS22HB__H
|
||||
#define __LPS22HB__H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/psensor.h"
|
||||
#include "../Common/tsensor.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup LPS22HB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LPS22HB_Exported_Macros LPS22HB Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Bitfield positioning.
|
||||
*/
|
||||
#define LPS22HB_BIT(x) ((uint8_t)x)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup LPS22HB_Exported_Constants LPS22HB Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Device Identification register.
|
||||
* Read
|
||||
* Default value: 0xB1
|
||||
* 7:0 This read-only register contains the device identifier that, for LPS22HB, is set to B1h.
|
||||
*/
|
||||
|
||||
#define LPS22HB_WHO_AM_I_REG (uint8_t)0x0F
|
||||
|
||||
/**
|
||||
* @brief Device Identification value.
|
||||
*/
|
||||
#define LPS22HB_WHO_AM_I_VAL (uint8_t)0xB1
|
||||
|
||||
/**
|
||||
* @brief Reference Pressure Register(LSB data)
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7:0 REFL7-0: Lower part of the reference pressure value that
|
||||
* is sum to the sensor output pressure.
|
||||
*/
|
||||
#define LPS22HB_REF_P_XL_REG (uint8_t)0x15
|
||||
|
||||
/**
|
||||
* @brief Reference Pressure Register (Middle data)
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7:0 REFL15-8: Middle part of the reference pressure value that
|
||||
* is sum to the sensor output pressure.
|
||||
*/
|
||||
#define LPS22HB_REF_P_L_REG (uint8_t)0x16
|
||||
|
||||
/**
|
||||
* @brief Reference Pressure Register (MSB data)
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7:0 REFL23-16 Higest part of the reference pressure value that
|
||||
* is sum to the sensor output pressure.
|
||||
*/
|
||||
#define LPS22HB_REF_P_H_REG (uint8_t)0x17
|
||||
|
||||
/**
|
||||
* @brief Pressure and temperature resolution mode Register
|
||||
* Read/write
|
||||
* Default value: 0x05
|
||||
* 7:2 These bits must be set to 0 for proper operation of the device
|
||||
* 1: Reserved
|
||||
* 0 LC_EN: Low Current Mode Enable. Default 0
|
||||
*/
|
||||
#define LPS22HB_RES_CONF_REG (uint8_t)0x1A
|
||||
#define LPS22HB_LCEN_MASK (uint8_t)0x01
|
||||
|
||||
/**
|
||||
* @brief Control Register 1
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7: This bit must be set to 0 for proper operation of the device
|
||||
* 6:4 ODR2, ODR1, ODR0: output data rate selection.Default 000
|
||||
* ODR2 | ODR1 | ODR0 | Pressure output data-rate(Hz) | Pressure output data-rate(Hz)
|
||||
* ----------------------------------------------------------------------------------
|
||||
* 0 | 0 | 0 | one shot | one shot
|
||||
* 0 | 0 | 1 | 1 | 1
|
||||
* 0 | 1 | 0 | 10 | 10
|
||||
* 0 | 1 | 1 | 25 | 25
|
||||
* 1 | 0 | 0 | 50 | 50
|
||||
* 1 | 0 | 1 | 75 | 75
|
||||
* 1 | 1 | 0 | Reserved | Reserved
|
||||
* 1 | 1 | 1 | Reserved | Reserved
|
||||
*
|
||||
* 3 EN_LPFP: Enable Low Pass filter on Pressure data. Default value:0
|
||||
* 2:LPF_CFG Low-pass configuration register. (0: Filter cutoff is ODR/9; 1: filter cutoff is ODR/20)
|
||||
* 1 BDU: block data update. 0 - continuous update; 1 - output registers not updated until MSB and LSB reading.
|
||||
* 0 SIM: SPI Serial Interface Mode selection. 0 - SPI 4-wire; 1 - SPI 3-wire
|
||||
*/
|
||||
#define LPS22HB_CTRL_REG1 (uint8_t)0x10
|
||||
|
||||
#define LPS22HB_ODR_MASK (uint8_t)0x70
|
||||
#define LPS22HB_LPFP_MASK (uint8_t)0x08
|
||||
#define LPS22HB_LPFP_CUTOFF_MASK (uint8_t)0x04
|
||||
#define LPS22HB_BDU_MASK (uint8_t)0x02
|
||||
#define LPS22HB_SIM_MASK (uint8_t)0x01
|
||||
|
||||
#define LPS22HB_LPFP_BIT LPS22HB_BIT(3)
|
||||
|
||||
/**
|
||||
* @brief Control Register 2
|
||||
* Read/write
|
||||
* Default value: 0x10
|
||||
* 7 BOOT: Reboot memory content. 0: normal mode; 1: reboot memory content. Self-clearing upon completation
|
||||
* 6 FIFO_EN: FIFO Enable. 0: disable; 1: enable
|
||||
* 5 STOP_ON_FTH: Stop on FIFO Threshold FIFO Watermark level use. 0: disable; 1: enable
|
||||
* 4 IF_ADD_INC: Register address automatically incrementeed during a multiple byte access with a serial interface (I2C or SPI).
|
||||
* Default value 1.( 0: disable; 1: enable)
|
||||
* 3 I2C DIS: Disable I2C interface 0: I2C Enabled; 1: I2C disabled
|
||||
* 2 SWRESET: Software reset. 0: normal mode; 1: SW reset. Self-clearing upon completation
|
||||
* 1 AUTO_ZERO: Autozero enable. 0: normal mode; 1: autozero enable.
|
||||
* 0 ONE_SHOT: One shot enable. 0: waiting for start of conversion; 1: start for a new dataset
|
||||
*/
|
||||
#define LPS22HB_CTRL_REG2 (uint8_t)0x11
|
||||
|
||||
#define LPS22HB_BOOT_BIT LPS22HB_BIT(7)
|
||||
#define LPS22HB_FIFO_EN_BIT LPS22HB_BIT(6)
|
||||
#define LPS22HB_WTM_EN_BIT LPS22HB_BIT(5)
|
||||
#define LPS22HB_ADD_INC_BIT LPS22HB_BIT(4)
|
||||
#define LPS22HB_I2C_BIT LPS22HB_BIT(3)
|
||||
#define LPS22HB_SW_RESET_BIT LPS22HB_BIT(2)
|
||||
|
||||
#define LPS22HB_FIFO_EN_MASK (uint8_t)0x40
|
||||
#define LPS22HB_WTM_EN_MASK (uint8_t)0x20
|
||||
#define LPS22HB_ADD_INC_MASK (uint8_t)0x10
|
||||
#define LPS22HB_I2C_MASK (uint8_t)0x08
|
||||
#define LPS22HB_ONE_SHOT_MASK (uint8_t)0x01
|
||||
|
||||
|
||||
/**
|
||||
* @brief CTRL Reg3 Interrupt Control Register
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7 INT_H_L: Interrupt active high, low. 0:active high; 1: active low.
|
||||
* 6 PP_OD: Push-Pull/OpenDrain selection on interrupt pads. 0: Push-pull; 1: open drain.
|
||||
* 5 F_FSS5: FIFO full flag on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
|
||||
* 4 F_FTH: FIFO threshold (watermark) status on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
|
||||
* 3 F_OVR: FIFO overrun interrupt on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
|
||||
* 2 DRDY: Data-ready signal on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
|
||||
* 1:0 INT_S2, INT_S1: data signal on INT pad control bits.
|
||||
* INT_S2 | INT_S1 | INT pin
|
||||
* ------------------------------------------------------
|
||||
* 0 | 0 | Data signal( in order of priority:PTH_DRDY or F_FTH or F_OVR_or F_FSS5
|
||||
* 0 | 1 | Pressure high (P_high)
|
||||
* 1 | 0 | Pressure low (P_low)
|
||||
* 1 | 1 | P_low OR P_high
|
||||
*/
|
||||
#define LPS22HB_CTRL_REG3 (uint8_t)0x12
|
||||
|
||||
#define LPS22HB_PP_OD_BIT LPS22HB_BIT(6)
|
||||
#define LPS22HB_FIFO_FULL_BIT LPS22HB_BIT(5)
|
||||
#define LPS22HB_FIFO_FTH_BIT LPS22HB_BIT(4)
|
||||
#define LPS22HB_FIFO_OVR_BIT LPS22HB_BIT(3)
|
||||
#define LPS22HB_DRDY_BIT LPS22HB_BIT(2)
|
||||
|
||||
|
||||
#define LPS22HB_INT_H_L_MASK (uint8_t)0x80
|
||||
#define LPS22HB_PP_OD_MASK (uint8_t)0x40
|
||||
#define LPS22HB_FIFO_FULL_MASK (uint8_t)0x20
|
||||
#define LPS22HB_FIFO_FTH_MASK (uint8_t)0x10
|
||||
#define LPS22HB_FIFO_OVR_MASK (uint8_t)0x08
|
||||
#define LPS22HB_DRDY_MASK (uint8_t)0x04
|
||||
#define LPS22HB_INT_S12_MASK (uint8_t)0x03
|
||||
|
||||
|
||||
/**
|
||||
* @brief Interrupt Differential configuration Register
|
||||
* Read/write
|
||||
* Default value: 0x00.
|
||||
* 7 AUTORIFP: AutoRifP Enable
|
||||
* 6 RESET_ARP: Reset AutoRifP function
|
||||
* 4 AUTOZERO: Autozero enabled
|
||||
* 5 RESET_AZ: Reset Autozero Function
|
||||
* 3 DIFF_EN: Interrupt generation enable
|
||||
* 2 LIR: Latch Interrupt request into INT_SOURCE register. 0 - interrupt request not latched
|
||||
* 1 - interrupt request latched
|
||||
* 1 PL_E: Enable interrupt generation on differential pressure low event. 0 - disable; 1 - enable
|
||||
* 0 PH_E: Enable interrupt generation on differential pressure high event. 0 - disable; 1 - enable
|
||||
*/
|
||||
#define LPS22HB_INTERRUPT_CFG_REG (uint8_t)0x0B
|
||||
|
||||
#define LPS22HB_DIFF_EN_BIT LPS22HB_BIT(3)
|
||||
#define LPS22HB_LIR_BIT LPS22HB_BIT(2)
|
||||
#define LPS22HB_PLE_BIT LPS22HB_BIT(1)
|
||||
#define LPS22HB_PHE_BIT LPS22HB_BIT(0)
|
||||
|
||||
#define LPS22HB_AUTORIFP_MASK (uint8_t)0x80
|
||||
#define LPS22HB_RESET_ARP_MASK (uint8_t)0x40
|
||||
#define LPS22HB_AUTOZERO_MASK (uint8_t)0x20
|
||||
#define LPS22HB_RESET_AZ_MASK (uint8_t)0x10
|
||||
#define LPS22HB_DIFF_EN_MASK (uint8_t)0x08
|
||||
#define LPS22HB_LIR_MASK (uint8_t)0x04
|
||||
#define LPS22HB_PLE_MASK (uint8_t)0x02
|
||||
#define LPS22HB_PHE_MASK (uint8_t)0x01
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Interrupt source Register (It is cleared by reading it)
|
||||
* Read
|
||||
* 7 BOOT_STATUS: If 1 indicates that the Boot (Reboot) phase is running.
|
||||
* 6:3 Reserved: Keep these bits at 0
|
||||
* 2 IA: Interrupt Active.0: no interrupt has been generated
|
||||
* 1: one or more interrupt events have been generated.
|
||||
* 1 PL: Differential pressure Low. 0: no interrupt has been generated
|
||||
* 1: Low differential pressure event has occurred.
|
||||
* 0 PH: Differential pressure High. 0: no interrupt has been generated
|
||||
* 1: High differential pressure event has occurred.
|
||||
*/
|
||||
#define LPS22HB_INTERRUPT_SOURCE_REG (uint8_t)0x25
|
||||
|
||||
#define LPS22HB_BOOT_STATUS_BIT LPS22HB_BIT(7)
|
||||
#define LPS22HB_IA_BIT LPS22HB_BIT(2)
|
||||
#define LPS22HB_PL_BIT LPS22HB_BIT(1)
|
||||
#define LPS22HB_PH_BIT LPS22HB_BIT(0)
|
||||
|
||||
#define LPS22HB_BOOT_STATUS_MASK (uint8_t)0x80
|
||||
#define LPS22HB_IA_MASK (uint8_t)0x04
|
||||
#define LPS22HB_PL_MASK (uint8_t)0x02
|
||||
#define LPS22HB_PH_MASK (uint8_t)0x01
|
||||
|
||||
|
||||
/**
|
||||
* @brief Status Register
|
||||
* Read
|
||||
* 7:6 Reserved: 0
|
||||
* 5 T_OR: Temperature data overrun. 0: no overrun has occurred
|
||||
* 1: a new data for temperature has overwritten the previous one.
|
||||
* 4 P_OR: Pressure data overrun. 0: no overrun has occurred
|
||||
* 1: new data for pressure has overwritten the previous one.
|
||||
* 3:2 Reserved: 0
|
||||
* 1 T_DA: Temperature data available. 0: new data for temperature is not yet available
|
||||
* 1: new data for temperature is available.
|
||||
* 0 P_DA: Pressure data available. 0: new data for pressure is not yet available
|
||||
* 1: new data for pressure is available.
|
||||
*/
|
||||
#define LPS22HB_STATUS_REG (uint8_t)0x27
|
||||
|
||||
#define LPS22HB_TOR_BIT LPS22HB_BIT(5)
|
||||
#define LPS22HB_POR_BIT LPS22HB_BIT(4)
|
||||
#define LPS22HB_TDA_BIT LPS22HB_BIT(1)
|
||||
#define LPS22HB_PDA_BIT LPS22HB_BIT(0)
|
||||
|
||||
#define LPS22HB_TOR_MASK (uint8_t)0x20
|
||||
#define LPS22HB_POR_MASK (uint8_t)0x10
|
||||
#define LPS22HB_TDA_MASK (uint8_t)0x02
|
||||
#define LPS22HB_PDA_MASK (uint8_t)0x01
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pressure data (LSB) register.
|
||||
* Read
|
||||
* Default value: 0x00.(To be verified)
|
||||
* POUT7 - POUT0: Pressure data LSB (2's complement).
|
||||
* Pressure output data: Pout(hPA)=(PRESS_OUT_H & PRESS_OUT_L &
|
||||
* PRESS_OUT_XL)[dec]/4096.
|
||||
*/
|
||||
#define LPS22HB_PRESS_OUT_XL_REG (uint8_t)0x28
|
||||
|
||||
/**
|
||||
* @brief Pressure data (Middle part) register.
|
||||
* Read
|
||||
* Default value: 0x80.
|
||||
* POUT15 - POUT8: Pressure data middle part (2's complement).
|
||||
* Pressure output data: Pout(hPA)=(PRESS_OUT_H & PRESS_OUT_L &
|
||||
* PRESS_OUT_XL)[dec]/4096.
|
||||
*/
|
||||
#define LPS22HB_PRESS_OUT_L_REG (uint8_t)0x29
|
||||
|
||||
/**
|
||||
* @brief Pressure data (MSB) register.
|
||||
* Read
|
||||
* Default value: 0x2F.
|
||||
* POUT23 - POUT16: Pressure data MSB (2's complement).
|
||||
* Pressure output data: Pout(hPA)=(PRESS_OUT_H & PRESS_OUT_L &
|
||||
* PRESS_OUT_XL)[dec]/4096.
|
||||
*/
|
||||
#define LPS22HB_PRESS_OUT_H_REG (uint8_t)0x2A
|
||||
|
||||
/**
|
||||
* @brief Temperature data (LSB) register.
|
||||
* Read
|
||||
* Default value: 0x00.
|
||||
* TOUT7 - TOUT0: temperature data LSB.
|
||||
* Tout(degC)=TEMP_OUT/100
|
||||
*/
|
||||
#define LPS22HB_TEMP_OUT_L_REG (uint8_t)0x2B
|
||||
|
||||
/**
|
||||
* @brief Temperature data (MSB) register.
|
||||
* Read
|
||||
* Default value: 0x00.
|
||||
* TOUT15 - TOUT8: temperature data MSB.
|
||||
* Tout(degC)=TEMP_OUT/100
|
||||
*/
|
||||
#define LPS22HBH_TEMP_OUT_H_REG (uint8_t)0x2C
|
||||
|
||||
/**
|
||||
* @brief Threshold pressure (LSB) register.
|
||||
* Read/write
|
||||
* Default value: 0x00.
|
||||
* 7:0 THS7-THS0: LSB Threshold pressure Low part of threshold value for pressure interrupt
|
||||
* generation. The complete threshold value is given by THS_P_H & THS_P_L and is
|
||||
* expressed as unsigned number. P_ths(hPA)=(THS_P_H & THS_P_L)[dec]/16.
|
||||
*/
|
||||
#define LPS22HB_THS_P_LOW_REG (uint8_t)0x0C
|
||||
|
||||
/**
|
||||
* @brief Threshold pressure (MSB)
|
||||
* Read/write
|
||||
* Default value: 0x00.
|
||||
* 7:0 THS15-THS8: MSB Threshold pressure. High part of threshold value for pressure interrupt
|
||||
* generation. The complete threshold value is given by THS_P_H & THS_P_L and is
|
||||
* expressed as unsigned number. P_ths(mbar)=(THS_P_H & THS_P_L)[dec]/16.
|
||||
*/
|
||||
#define LPS22HB_THS_P_HIGH_REG (uint8_t)0x0D
|
||||
|
||||
/**
|
||||
* @brief FIFO control register
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7:5 F_MODE2, F_MODE1, F_MODE0: FIFO mode selection.
|
||||
* FM2 | FM1 | FM0 | FIFO MODE
|
||||
* ---------------------------------------------------
|
||||
* 0 | 0 | 0 | BYPASS MODE
|
||||
* 0 | 0 | 1 | FIFO MODE. Stops collecting data when full
|
||||
* 0 | 1 | 0 | STREAM MODE: Keep the newest measurements in the FIFO
|
||||
* 0 | 1 | 1 | STREAM MODE until trigger deasserted, then change to FIFO MODE
|
||||
* 1 | 0 | 0 | BYPASS MODE until trigger deasserted, then STREAM MODE
|
||||
* 1 | 0 | 1 | Reserved for future use
|
||||
* 1 | 1 | 0 | Reserved
|
||||
* 1 | 1 | 1 | BYPASS mode until trigger deasserted, then FIFO MODE
|
||||
*
|
||||
* 4:0 WTM_POINT4-0 : FIFO Watermark level selection (0-31)
|
||||
*/
|
||||
#define LPS22HB_CTRL_FIFO_REG (uint8_t)0x14
|
||||
|
||||
#define LPS22HB_FIFO_MODE_MASK (uint8_t)0xE0
|
||||
#define LPS22HB_WTM_POINT_MASK (uint8_t)0x1F
|
||||
|
||||
|
||||
/**
|
||||
* @brief FIFO Status register
|
||||
* Read
|
||||
* 7 FTH_FIFO: FIFO threshold status. 0:FIFO filling is lower than FTH level
|
||||
* 1: FIFO is equal or higher than FTH level.
|
||||
* 6 OVR: Overrun bit status. 0 - FIFO not full
|
||||
* 1 - FIFO is full and at least one sample in the FIFO has been overwritten.
|
||||
* 5:0 FSS: FIFO Stored data level. 000000: FIFO empty, 100000: FIFO is full and has 32 unread samples.
|
||||
*/
|
||||
#define LPS22HB_STATUS_FIFO_REG (uint8_t)0x26
|
||||
|
||||
#define LPS22HB_FTH_FIFO_BIT LPS22HB_BIT(7)
|
||||
#define LPS22HB_OVR_FIFO_BIT LPS22HB_BIT(6)
|
||||
|
||||
#define LPS22HB_FTH_FIFO_MASK (uint8_t)0x80
|
||||
#define LPS22HB_OVR_FIFO_MASK (uint8_t)0x40
|
||||
#define LPS22HB_LEVEL_FIFO_MASK (uint8_t)0x3F
|
||||
#define LPS22HB_FIFO_EMPTY (uint8_t)0x00
|
||||
#define LPS22HB_FIFO_FULL (uint8_t)0x20
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pressure offset register (LSB)
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7:0 RPDS7-0:Pressure Offset for 1 point calibration (OPC) after soldering.
|
||||
* This register contains the low part of the pressure offset value after soldering,for
|
||||
* differential pressure computing. The complete value is given by RPDS_L & RPDS_H
|
||||
* and is expressed as signed 2 complement value.
|
||||
*/
|
||||
#define LPS22HB_RPDS_L_REG (uint8_t)0x18
|
||||
|
||||
/**
|
||||
* @brief Pressure offset register (MSB)
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7:0 RPDS15-8:Pressure Offset for 1 point calibration (OPC) after soldering.
|
||||
* This register contains the high part of the pressure offset value after soldering (see description RPDS_L)
|
||||
*/
|
||||
#define LPS22HB_RPDS_H_REG (uint8_t)0x19
|
||||
|
||||
|
||||
/**
|
||||
* @brief Clock Tree Configuration register
|
||||
* Read/write
|
||||
* Default value: 0x00
|
||||
* 7:6 Reserved.
|
||||
* 5: CTE: Clock Tree Enhancement
|
||||
*/
|
||||
#define LPS22HB_CLOCK_TREE_CONFIGURATION (uint8_t)0x43
|
||||
#define LPS22HB_CTE_MASK (uint8_t)0x20
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup LPS22HB_Pressure_Exported_Functions LPS22HB Pressure Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/* PRESSURE functions */
|
||||
void LPS22HB_P_Init(uint16_t DeviceAddr);
|
||||
uint8_t LPS22HB_P_ReadID(uint16_t DeviceAddr);
|
||||
float LPS22HB_P_ReadPressure(uint16_t DeviceAddr);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221_PressImported_Globals PRESSURE Imported Globals
|
||||
* @{
|
||||
*/
|
||||
/* PRESSURE driver structure */
|
||||
extern PSENSOR_DrvTypeDef LPS22HB_P_Drv;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LPS22HB_Temperature_Exported_Functions LPS22HB Temperature Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/* TEMPERATURE functions */
|
||||
void LPS22HB_T_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct);
|
||||
float LPS22HB_T_ReadTemp(uint16_t DeviceAddr);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HTS221_TempImported_Globals Temperature Imported Globals
|
||||
* @{
|
||||
*/
|
||||
/* Temperature driver structure */
|
||||
extern TSENSOR_DrvTypeDef LPS22HB_T_Drv;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LPS22HB_Imported_Functions LPS22HB Imported Functions
|
||||
* @{
|
||||
*/
|
||||
/* IO functions */
|
||||
extern void SENSOR_IO_Init(void);
|
||||
extern void SENSOR_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
|
||||
extern uint8_t SENSOR_IO_Read(uint8_t Addr, uint8_t Reg);
|
||||
extern uint16_t SENSOR_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
extern void SENSOR_IO_WriteMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __LPS22HB__H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 LSM6DSL BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for LSM6DSL Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2017 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 14-February-2017 <o:p></o:p></span></h3>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release of LSM6DSL Accelerometer/Gyroscope sensor<br>
|
||||
</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="padding: 0cm;" valign="top"><br>
|
||||
</td></tr></tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,394 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file lsm6dsl.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 14-February-2017
|
||||
* @brief This file provides a set of functions needed to manage the LSM6DSL
|
||||
* accelero and gyro devices
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "lsm6dsl.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LSM6DSL LSM6DSL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LSM6DSL_Private_Variables LSM6DSL Private Variables
|
||||
* @{
|
||||
*/
|
||||
ACCELERO_DrvTypeDef Lsm6dslAccDrv =
|
||||
{
|
||||
LSM6DSL_AccInit,
|
||||
LSM6DSL_AccDeInit,
|
||||
LSM6DSL_AccReadID,
|
||||
0,
|
||||
LSM6DSL_AccLowPower,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
LSM6DSL_AccReadXYZ
|
||||
};
|
||||
|
||||
GYRO_DrvTypeDef Lsm6dslGyroDrv =
|
||||
{
|
||||
LSM6DSL_GyroInit,
|
||||
LSM6DSL_GyroDeInit,
|
||||
LSM6DSL_GyroReadID,
|
||||
0,
|
||||
LSM6DSL_GyroLowPower,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
LSM6DSL_GyroReadXYZAngRate
|
||||
};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LSM6DSL_ACC_Private_Functions LSM6DSL ACC Private Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Set LSM6DSL Accelerometer Initialization.
|
||||
* @param InitStruct: Init parameters
|
||||
*/
|
||||
void LSM6DSL_AccInit(uint16_t InitStruct)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
uint8_t tmp;
|
||||
|
||||
/* Read CTRL1_XL */
|
||||
tmp = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL1_XL);
|
||||
|
||||
/* Write value to ACC MEMS CTRL1_XL register: FS and Data Rate */
|
||||
ctrl = (uint8_t) InitStruct;
|
||||
tmp &= ~(0xFC);
|
||||
tmp |= ctrl;
|
||||
SENSOR_IO_Write(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL1_XL, tmp);
|
||||
|
||||
/* Read CTRL3_C */
|
||||
tmp = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL3_C);
|
||||
|
||||
/* Write value to ACC MEMS CTRL3_C register: BDU and Auto-increment */
|
||||
ctrl = ((uint8_t) (InitStruct >> 8));
|
||||
tmp &= ~(0x44);
|
||||
tmp |= ctrl;
|
||||
SENSOR_IO_Write(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL3_C, tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LSM6DSL Accelerometer De-initialization.
|
||||
*/
|
||||
void LSM6DSL_AccDeInit(void)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
|
||||
/* Read control register 1 value */
|
||||
ctrl = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL1_XL);
|
||||
|
||||
/* Clear ODR bits */
|
||||
ctrl &= ~(LSM6DSL_ODR_BITPOSITION);
|
||||
|
||||
/* Set Power down */
|
||||
ctrl |= LSM6DSL_ODR_POWER_DOWN;
|
||||
|
||||
/* write back control register */
|
||||
SENSOR_IO_Write(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL1_XL, ctrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read LSM6DSL ID.
|
||||
* @retval ID
|
||||
*/
|
||||
uint8_t LSM6DSL_AccReadID(void)
|
||||
{
|
||||
/* IO interface initialization */
|
||||
SENSOR_IO_Init();
|
||||
/* Read value at Who am I register address */
|
||||
return (SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_WHO_AM_I_REG));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set/Unset Accelerometer in low power mode.
|
||||
* @param status 0 means disable Low Power Mode, otherwise Low Power Mode is enabled
|
||||
*/
|
||||
void LSM6DSL_AccLowPower(uint16_t status)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
|
||||
/* Read CTRL6_C value */
|
||||
ctrl = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL6_C);
|
||||
|
||||
/* Clear Low Power Mode bit */
|
||||
ctrl &= ~(0x10);
|
||||
|
||||
/* Set Low Power Mode */
|
||||
if(status)
|
||||
{
|
||||
ctrl |= LSM6DSL_ACC_GYRO_LP_XL_ENABLED;
|
||||
}else
|
||||
{
|
||||
ctrl |= LSM6DSL_ACC_GYRO_LP_XL_DISABLED;
|
||||
}
|
||||
|
||||
/* write back control register */
|
||||
SENSOR_IO_Write(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL6_C, ctrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read X, Y & Z Acceleration values
|
||||
* @param pData: Data out pointer
|
||||
*/
|
||||
void LSM6DSL_AccReadXYZ(int16_t* pData)
|
||||
{
|
||||
int16_t pnRawData[3];
|
||||
uint8_t ctrlx= 0;
|
||||
uint8_t buffer[6];
|
||||
uint8_t i = 0;
|
||||
float sensitivity = 0;
|
||||
|
||||
/* Read the acceleration control register content */
|
||||
ctrlx = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL1_XL);
|
||||
|
||||
/* Read output register X, Y & Z acceleration */
|
||||
SENSOR_IO_ReadMultiple(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_OUTX_L_XL, buffer, 6);
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
{
|
||||
pnRawData[i]=((((uint16_t)buffer[2*i+1]) << 8) + (uint16_t)buffer[2*i]);
|
||||
}
|
||||
|
||||
/* Normal mode */
|
||||
/* Switch the sensitivity value set in the CRTL1_XL */
|
||||
switch(ctrlx & 0x0C)
|
||||
{
|
||||
case LSM6DSL_ACC_FULLSCALE_2G:
|
||||
sensitivity = LSM6DSL_ACC_SENSITIVITY_2G;
|
||||
break;
|
||||
case LSM6DSL_ACC_FULLSCALE_4G:
|
||||
sensitivity = LSM6DSL_ACC_SENSITIVITY_4G;
|
||||
break;
|
||||
case LSM6DSL_ACC_FULLSCALE_8G:
|
||||
sensitivity = LSM6DSL_ACC_SENSITIVITY_8G;
|
||||
break;
|
||||
case LSM6DSL_ACC_FULLSCALE_16G:
|
||||
sensitivity = LSM6DSL_ACC_SENSITIVITY_16G;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Obtain the mg value for the three axis */
|
||||
for(i=0; i<3; i++)
|
||||
{
|
||||
pData[i]=( int16_t )(pnRawData[i] * sensitivity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LSM6DSL_GYRO_Private_Functions LSM6DSL GYRO Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set LSM6DSL Gyroscope Initialization.
|
||||
* @param InitStruct: pointer to a LSM6DSL_InitTypeDef structure
|
||||
* that contains the configuration setting for the LSM6DSL.
|
||||
*/
|
||||
void LSM6DSL_GyroInit(uint16_t InitStruct)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
uint8_t tmp;
|
||||
|
||||
/* Read CTRL2_G */
|
||||
tmp = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL2_G);
|
||||
|
||||
/* Write value to GYRO MEMS CTRL2_G register: FS and Data Rate */
|
||||
ctrl = (uint8_t) InitStruct;
|
||||
tmp &= ~(0xFC);
|
||||
tmp |= ctrl;
|
||||
SENSOR_IO_Write(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL2_G, tmp);
|
||||
|
||||
/* Read CTRL3_C */
|
||||
tmp = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL3_C);
|
||||
|
||||
/* Write value to GYRO MEMS CTRL3_C register: BDU and Auto-increment */
|
||||
ctrl = ((uint8_t) (InitStruct >> 8));
|
||||
tmp &= ~(0x44);
|
||||
tmp |= ctrl;
|
||||
SENSOR_IO_Write(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL3_C, tmp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief LSM6DSL Gyroscope De-initialization
|
||||
*/
|
||||
void LSM6DSL_GyroDeInit(void)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
|
||||
/* Read control register 1 value */
|
||||
ctrl = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL2_G);
|
||||
|
||||
/* Clear ODR bits */
|
||||
ctrl &= ~(LSM6DSL_ODR_BITPOSITION);
|
||||
|
||||
/* Set Power down */
|
||||
ctrl |= LSM6DSL_ODR_POWER_DOWN;
|
||||
|
||||
/* write back control register */
|
||||
SENSOR_IO_Write(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL2_G, ctrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read ID address of LSM6DSL
|
||||
* @retval ID
|
||||
*/
|
||||
uint8_t LSM6DSL_GyroReadID(void)
|
||||
{
|
||||
/* IO interface initialization */
|
||||
SENSOR_IO_Init();
|
||||
/* Read value at Who am I register address */
|
||||
return SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_WHO_AM_I_REG);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set/Unset LSM6DSL Gyroscope in low power mode
|
||||
* @param status 0 means disable Low Power Mode, otherwise Low Power Mode is enabled
|
||||
*/
|
||||
void LSM6DSL_GyroLowPower(uint16_t status)
|
||||
{
|
||||
uint8_t ctrl = 0x00;
|
||||
|
||||
/* Read CTRL7_G value */
|
||||
ctrl = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL7_G);
|
||||
|
||||
/* Clear Low Power Mode bit */
|
||||
ctrl &= ~(0x80);
|
||||
|
||||
/* Set Low Power Mode */
|
||||
if(status)
|
||||
{
|
||||
ctrl |= LSM6DSL_ACC_GYRO_LP_G_ENABLED;
|
||||
}else
|
||||
{
|
||||
ctrl |= LSM6DSL_ACC_GYRO_LP_G_DISABLED;
|
||||
}
|
||||
|
||||
/* write back control register */
|
||||
SENSOR_IO_Write(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL7_G, ctrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Calculate the LSM6DSL angular data.
|
||||
* @param pfData: Data out pointer
|
||||
*/
|
||||
void LSM6DSL_GyroReadXYZAngRate(float *pfData)
|
||||
{
|
||||
int16_t pnRawData[3];
|
||||
uint8_t ctrlg= 0;
|
||||
uint8_t buffer[6];
|
||||
uint8_t i = 0;
|
||||
float sensitivity = 0;
|
||||
|
||||
/* Read the gyro control register content */
|
||||
ctrlg = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL2_G);
|
||||
|
||||
/* Read output register X, Y & Z acceleration */
|
||||
SENSOR_IO_ReadMultiple(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_OUTX_L_G, buffer, 6);
|
||||
|
||||
for(i=0; i<3; i++)
|
||||
{
|
||||
pnRawData[i]=((((uint16_t)buffer[2*i+1]) << 8) + (uint16_t)buffer[2*i]);
|
||||
}
|
||||
|
||||
/* Normal mode */
|
||||
/* Switch the sensitivity value set in the CRTL2_G */
|
||||
switch(ctrlg & 0x0C)
|
||||
{
|
||||
case LSM6DSL_GYRO_FS_245:
|
||||
sensitivity = LSM6DSL_GYRO_SENSITIVITY_245DPS;
|
||||
break;
|
||||
case LSM6DSL_GYRO_FS_500:
|
||||
sensitivity = LSM6DSL_GYRO_SENSITIVITY_500DPS;
|
||||
break;
|
||||
case LSM6DSL_GYRO_FS_1000:
|
||||
sensitivity = LSM6DSL_GYRO_SENSITIVITY_1000DPS;
|
||||
break;
|
||||
case LSM6DSL_GYRO_FS_2000:
|
||||
sensitivity = LSM6DSL_GYRO_SENSITIVITY_2000DPS;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Obtain the mg value for the three axis */
|
||||
for(i=0; i<3; i++)
|
||||
{
|
||||
pfData[i]=( float )(pnRawData[i] * sensitivity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
||||
|
|
@ -0,0 +1,346 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file lsm6dsl.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 14-February-2017
|
||||
* @brief LSM6DSL header driver file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __LSM6DSL__H
|
||||
#define __LSM6DSL__H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/accelero.h"
|
||||
#include "../Common/gyro.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup LSM6DSL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup LSM6DSL_Exported_Constants LSM6DSL Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/************** I2C Address *****************/
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW 0xD4 // SAD[0] = 0
|
||||
#define LSM6DSL_ACC_GYRO_I2C_ADDRESS_HIGH 0xD6 // SAD[0] = 1
|
||||
|
||||
/************** Who am I *******************/
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_WHO_AM_I 0x6A
|
||||
|
||||
/************** Device Register *******************/
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_FUNC_CFG_ACCESS 0x01
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_SENSOR_SYNC_TIME 0x04
|
||||
#define LSM6DSL_ACC_GYRO_SENSOR_RES_RATIO 0x05
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_CTRL1 0x06
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_CTRL2 0x07
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_CTRL3 0x08
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_CTRL4 0x09
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_CTRL5 0x0A
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_DRDY_PULSE_CFG_G 0x0B
|
||||
#define LSM6DSL_ACC_GYRO_INT1_CTRL 0x0D
|
||||
#define LSM6DSL_ACC_GYRO_INT2_CTRL 0x0E
|
||||
#define LSM6DSL_ACC_GYRO_WHO_AM_I_REG 0x0F
|
||||
#define LSM6DSL_ACC_GYRO_CTRL1_XL 0x10
|
||||
#define LSM6DSL_ACC_GYRO_CTRL2_G 0x11
|
||||
#define LSM6DSL_ACC_GYRO_CTRL3_C 0x12
|
||||
#define LSM6DSL_ACC_GYRO_CTRL4_C 0x13
|
||||
#define LSM6DSL_ACC_GYRO_CTRL5_C 0x14
|
||||
#define LSM6DSL_ACC_GYRO_CTRL6_C 0x15
|
||||
#define LSM6DSL_ACC_GYRO_CTRL7_G 0x16
|
||||
#define LSM6DSL_ACC_GYRO_CTRL8_XL 0x17
|
||||
#define LSM6DSL_ACC_GYRO_CTRL9_XL 0x18
|
||||
#define LSM6DSL_ACC_GYRO_CTRL10_C 0x19
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_MASTER_CONFIG 0x1A
|
||||
#define LSM6DSL_ACC_GYRO_WAKE_UP_SRC 0x1B
|
||||
#define LSM6DSL_ACC_GYRO_TAP_SRC 0x1C
|
||||
#define LSM6DSL_ACC_GYRO_D6D_SRC 0x1D
|
||||
#define LSM6DSL_ACC_GYRO_STATUS_REG 0x1E
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_OUT_TEMP_L 0x20
|
||||
#define LSM6DSL_ACC_GYRO_OUT_TEMP_H 0x21
|
||||
#define LSM6DSL_ACC_GYRO_OUTX_L_G 0x22
|
||||
#define LSM6DSL_ACC_GYRO_OUTX_H_G 0x23
|
||||
#define LSM6DSL_ACC_GYRO_OUTY_L_G 0x24
|
||||
#define LSM6DSL_ACC_GYRO_OUTY_H_G 0x25
|
||||
#define LSM6DSL_ACC_GYRO_OUTZ_L_G 0x26
|
||||
#define LSM6DSL_ACC_GYRO_OUTZ_H_G 0x27
|
||||
#define LSM6DSL_ACC_GYRO_OUTX_L_XL 0x28
|
||||
#define LSM6DSL_ACC_GYRO_OUTX_H_XL 0x29
|
||||
#define LSM6DSL_ACC_GYRO_OUTY_L_XL 0x2A
|
||||
#define LSM6DSL_ACC_GYRO_OUTY_H_XL 0x2B
|
||||
#define LSM6DSL_ACC_GYRO_OUTZ_L_XL 0x2C
|
||||
#define LSM6DSL_ACC_GYRO_OUTZ_H_XL 0x2D
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB1_REG 0x2E
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB2_REG 0x2F
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB3_REG 0x30
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB4_REG 0x31
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB5_REG 0x32
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB6_REG 0x33
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB7_REG 0x34
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB8_REG 0x35
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB9_REG 0x36
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB10_REG 0x37
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB11_REG 0x38
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB12_REG 0x39
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_STATUS1 0x3A
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_STATUS2 0x3B
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_STATUS3 0x3C
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_STATUS4 0x3D
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_DATA_OUT_L 0x3E
|
||||
#define LSM6DSL_ACC_GYRO_FIFO_DATA_OUT_H 0x3F
|
||||
#define LSM6DSL_ACC_GYRO_TIMESTAMP0_REG 0x40
|
||||
#define LSM6DSL_ACC_GYRO_TIMESTAMP1_REG 0x41
|
||||
#define LSM6DSL_ACC_GYRO_TIMESTAMP2_REG 0x42
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_TIMESTAMP_L 0x49
|
||||
#define LSM6DSL_ACC_GYRO_TIMESTAMP_H 0x4A
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_STEP_COUNTER_L 0x4B
|
||||
#define LSM6DSL_ACC_GYRO_STEP_COUNTER_H 0x4C
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB13_REG 0x4D
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB14_REG 0x4E
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB15_REG 0x4F
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB16_REG 0x50
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB17_REG 0x51
|
||||
#define LSM6DSL_ACC_GYRO_SENSORHUB18_REG 0x52
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_FUNC_SRC 0x53
|
||||
#define LSM6DSL_ACC_GYRO_TAP_CFG1 0x58
|
||||
#define LSM6DSL_ACC_GYRO_TAP_THS_6D 0x59
|
||||
#define LSM6DSL_ACC_GYRO_INT_DUR2 0x5A
|
||||
#define LSM6DSL_ACC_GYRO_WAKE_UP_THS 0x5B
|
||||
#define LSM6DSL_ACC_GYRO_WAKE_UP_DUR 0x5C
|
||||
#define LSM6DSL_ACC_GYRO_FREE_FALL 0x5D
|
||||
#define LSM6DSL_ACC_GYRO_MD1_CFG 0x5E
|
||||
#define LSM6DSL_ACC_GYRO_MD2_CFG 0x5F
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_OUT_MAG_RAW_X_L 0x66
|
||||
#define LSM6DSL_ACC_GYRO_OUT_MAG_RAW_X_H 0x67
|
||||
#define LSM6DSL_ACC_GYRO_OUT_MAG_RAW_Y_L 0x68
|
||||
#define LSM6DSL_ACC_GYRO_OUT_MAG_RAW_Y_H 0x69
|
||||
#define LSM6DSL_ACC_GYRO_OUT_MAG_RAW_Z_L 0x6A
|
||||
#define LSM6DSL_ACC_GYRO_OUT_MAG_RAW_Z_H 0x6B
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_X_OFS_USR 0x73
|
||||
#define LSM6DSL_ACC_GYRO_Y_OFS_USR 0x74
|
||||
#define LSM6DSL_ACC_GYRO_Z_OFS_USR 0x75
|
||||
|
||||
/************** Embedded functions register mapping *******************/
|
||||
#define LSM6DSL_ACC_GYRO_SLV0_ADD 0x02
|
||||
#define LSM6DSL_ACC_GYRO_SLV0_SUBADD 0x03
|
||||
#define LSM6DSL_ACC_GYRO_SLAVE0_CONFIG 0x04
|
||||
#define LSM6DSL_ACC_GYRO_SLV1_ADD 0x05
|
||||
#define LSM6DSL_ACC_GYRO_SLV1_SUBADD 0x06
|
||||
#define LSM6DSL_ACC_GYRO_SLAVE1_CONFIG 0x07
|
||||
#define LSM6DSL_ACC_GYRO_SLV2_ADD 0x08
|
||||
#define LSM6DSL_ACC_GYRO_SLV2_SUBADD 0x09
|
||||
#define LSM6DSL_ACC_GYRO_SLAVE2_CONFIG 0x0A
|
||||
#define LSM6DSL_ACC_GYRO_SLV3_ADD 0x0B
|
||||
#define LSM6DSL_ACC_GYRO_SLV3_SUBADD 0x0C
|
||||
#define LSM6DSL_ACC_GYRO_SLAVE3_CONFIG 0x0D
|
||||
#define LSM6DSL_ACC_GYRO_DATAWRITE_SRC_MODE_SUB_SLV0 0x0E
|
||||
#define LSM6DSL_ACC_GYRO_CONFIG_PEDO_THS_MIN 0x0F
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_SM_STEP_THS 0x13
|
||||
#define LSM6DSL_ACC_GYRO_PEDO_DEB_REG 0x14
|
||||
#define LSM6DSL_ACC_GYRO_STEP_COUNT_DELTA 0x15
|
||||
|
||||
#define LSM6DSL_ACC_GYRO_MAG_SI_XX 0x24
|
||||
#define LSM6DSL_ACC_GYRO_MAG_SI_XY 0x25
|
||||
#define LSM6DSL_ACC_GYRO_MAG_SI_XZ 0x26
|
||||
#define LSM6DSL_ACC_GYRO_MAG_SI_YX 0x27
|
||||
#define LSM6DSL_ACC_GYRO_MAG_SI_YY 0x28
|
||||
#define LSM6DSL_ACC_GYRO_MAG_SI_YZ 0x29
|
||||
#define LSM6DSL_ACC_GYRO_MAG_SI_ZX 0x2A
|
||||
#define LSM6DSL_ACC_GYRO_MAG_SI_ZY 0x2B
|
||||
#define LSM6DSL_ACC_GYRO_MAG_SI_ZZ 0x2C
|
||||
#define LSM6DSL_ACC_GYRO_MAG_OFFX_L 0x2D
|
||||
#define LSM6DSL_ACC_GYRO_MAG_OFFX_H 0x2E
|
||||
#define LSM6DSL_ACC_GYRO_MAG_OFFY_L 0x2F
|
||||
#define LSM6DSL_ACC_GYRO_MAG_OFFY_H 0x30
|
||||
#define LSM6DSL_ACC_GYRO_MAG_OFFZ_L 0x31
|
||||
#define LSM6DSL_ACC_GYRO_MAG_OFFZ_H 0x32
|
||||
|
||||
/* Accelero Full_ScaleSelection */
|
||||
#define LSM6DSL_ACC_FULLSCALE_2G ((uint8_t)0x00) /*!< ±2 g */
|
||||
#define LSM6DSL_ACC_FULLSCALE_4G ((uint8_t)0x08) /*!< ±4 g */
|
||||
#define LSM6DSL_ACC_FULLSCALE_8G ((uint8_t)0x0C) /*!< ±8 g */
|
||||
#define LSM6DSL_ACC_FULLSCALE_16G ((uint8_t)0x04) /*!< ±16 g */
|
||||
|
||||
/* Accelero Full Scale Sensitivity */
|
||||
#define LSM6DSL_ACC_SENSITIVITY_2G ((float)0.061f) /*!< accelerometer sensitivity with 2 g full scale [mgauss/LSB] */
|
||||
#define LSM6DSL_ACC_SENSITIVITY_4G ((float)0.122f) /*!< accelerometer sensitivity with 4 g full scale [mgauss/LSB] */
|
||||
#define LSM6DSL_ACC_SENSITIVITY_8G ((float)0.244f) /*!< accelerometer sensitivity with 8 g full scale [mgauss/LSB] */
|
||||
#define LSM6DSL_ACC_SENSITIVITY_16G ((float)0.488f) /*!< accelerometer sensitivity with 12 g full scale [mgauss/LSB] */
|
||||
|
||||
/* Accelero Power Mode selection */
|
||||
#define LSM6DSL_ACC_GYRO_LP_XL_DISABLED ((uint8_t)0x00) /* LP disabled*/
|
||||
#define LSM6DSL_ACC_GYRO_LP_XL_ENABLED ((uint8_t)0x10) /* LP enabled*/
|
||||
|
||||
/* Output Data Rate */
|
||||
#define LSM6DSL_ODR_BITPOSITION ((uint8_t)0xF0) /*!< Output Data Rate bit position */
|
||||
#define LSM6DSL_ODR_POWER_DOWN ((uint8_t)0x00) /* Power Down mode */
|
||||
#define LSM6DSL_ODR_13Hz ((uint8_t)0x10) /* Low Power mode */
|
||||
#define LSM6DSL_ODR_26Hz ((uint8_t)0x20) /* Low Power mode */
|
||||
#define LSM6DSL_ODR_52Hz ((uint8_t)0x30) /* Low Power mode */
|
||||
#define LSM6DSL_ODR_104Hz ((uint8_t)0x40) /* Normal mode */
|
||||
#define LSM6DSL_ODR_208Hz ((uint8_t)0x50) /* Normal mode */
|
||||
#define LSM6DSL_ODR_416Hz ((uint8_t)0x60) /* High Performance mode */
|
||||
#define LSM6DSL_ODR_833Hz ((uint8_t)0x70) /* High Performance mode */
|
||||
#define LSM6DSL_ODR_1660Hz ((uint8_t)0x80) /* High Performance mode */
|
||||
#define LSM6DSL_ODR_3330Hz ((uint8_t)0x90) /* High Performance mode */
|
||||
#define LSM6DSL_ODR_6660Hz ((uint8_t)0xA0) /* High Performance mode */
|
||||
|
||||
/* Gyro Full Scale Selection */
|
||||
#define LSM6DSL_GYRO_FS_245 ((uint8_t)0x00)
|
||||
#define LSM6DSL_GYRO_FS_500 ((uint8_t)0x04)
|
||||
#define LSM6DSL_GYRO_FS_1000 ((uint8_t)0x08)
|
||||
#define LSM6DSL_GYRO_FS_2000 ((uint8_t)0x0C)
|
||||
|
||||
/* Gyro Full Scale Sensitivity */
|
||||
#define LSM6DSL_GYRO_SENSITIVITY_245DPS ((float)8.750f) /**< Sensitivity value for 245 dps full scale [mdps/LSB] */
|
||||
#define LSM6DSL_GYRO_SENSITIVITY_500DPS ((float)17.50f) /**< Sensitivity value for 500 dps full scale [mdps/LSB] */
|
||||
#define LSM6DSL_GYRO_SENSITIVITY_1000DPS ((float)35.00f) /**< Sensitivity value for 1000 dps full scale [mdps/LSB] */
|
||||
#define LSM6DSL_GYRO_SENSITIVITY_2000DPS ((float)70.00f) /**< Sensitivity value for 2000 dps full scale [mdps/LSB] */
|
||||
|
||||
/* Gyro Power Mode selection */
|
||||
#define LSM6DSL_ACC_GYRO_LP_G_DISABLED ((uint8_t)0x00) /* LP disabled*/
|
||||
#define LSM6DSL_ACC_GYRO_LP_G_ENABLED ((uint8_t)0x80) /* LP enabled*/
|
||||
|
||||
/* Block Data Update */
|
||||
#define LSM6DSL_BDU_CONTINUOS ((uint8_t)0x00)
|
||||
#define LSM6DSL_BDU_BLOCK_UPDATE ((uint8_t)0x40)
|
||||
|
||||
/* Auto-increment */
|
||||
#define LSM6DSL_ACC_GYRO_IF_INC_DISABLED ((uint8_t)0x00)
|
||||
#define LSM6DSL_ACC_GYRO_IF_INC_ENABLED ((uint8_t)0x04)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LSM6DSL_AccExported_Functions ACCELEROMETER Exported functions
|
||||
* @{
|
||||
*/
|
||||
void LSM6DSL_AccInit(uint16_t InitStruct);
|
||||
void LSM6DSL_AccDeInit(void);
|
||||
uint8_t LSM6DSL_AccReadID(void);
|
||||
void LSM6DSL_AccLowPower(uint16_t status);
|
||||
void LSM6DSL_AccReadXYZ(int16_t* pData);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LSM6DSL_AccImported_Globals ACCELEROMETER Imported Globals
|
||||
* @{
|
||||
*/
|
||||
extern ACCELERO_DrvTypeDef Lsm6dslAccDrv;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LSM6DSL_GyroExported_Functions GYROSCOPE Exported functions
|
||||
* @{
|
||||
*/
|
||||
/* Sensor Configuration Functions */
|
||||
void LSM6DSL_GyroInit(uint16_t InitStruct);
|
||||
void LSM6DSL_GyroDeInit(void);
|
||||
uint8_t LSM6DSL_GyroReadID(void);
|
||||
void LSM6DSL_GyroLowPower(uint16_t status);
|
||||
void LSM6DSL_GyroReadXYZAngRate(float *pfData);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LSM6DSL_GyroImported_Globals GYROSCOPE Imported Globals
|
||||
* @{
|
||||
*/
|
||||
/* Gyroscope driver structure */
|
||||
extern GYRO_DrvTypeDef Lsm6dslGyroDrv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup LSM6DSL_Imported_Functions LSM6DSL Imported Functions
|
||||
* @{
|
||||
*/
|
||||
/* IO functions */
|
||||
extern void SENSOR_IO_Init(void);
|
||||
extern void SENSOR_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
|
||||
extern uint8_t SENSOR_IO_Read(uint8_t Addr, uint8_t Reg);
|
||||
extern uint16_t SENSOR_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
extern void SENSOR_IO_WriteMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __LSM6DSL__H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,218 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for MX25L512 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2016 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
||||
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.2
|
||||
/ 13-December-2016 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Replace QPI_* with QSPI_*</span></li>
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">Add alias for comaptibility<br>
|
||||
</span></li>
|
||||
</ul>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1
|
||||
/ 03-August-2016 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Remove extra comment<br>
|
||||
</span></li>
|
||||
</ul>
|
||||
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 22-April-2016 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release</span></li>
|
||||
</ul>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="padding: 0cm;" valign="top"><br>
|
||||
</td></tr></tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file mx25l512.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.2
|
||||
* @date 13-December-2016
|
||||
* @brief This file contains all the description of the MX25L51245G QSPI memory.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 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 __MX25L512_H
|
||||
#define __MX25L512_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup MX25L512
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup MX25L512_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MX25L512_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief MX25L512 Configuration
|
||||
*/
|
||||
#define MX25L512_FLASH_SIZE 0x4000000 /* 512 MBits => 64MBytes */
|
||||
#define MX25L512_SECTOR_SIZE 0x10000 /* 1024 sectors of 64KBytes */
|
||||
#define MX25L512_SUBSECTOR_SIZE 0x1000 /* 16384 subsectors of 4kBytes */
|
||||
#define MX25L512_PAGE_SIZE 0x100 /* 262144 pages of 256 bytes */
|
||||
|
||||
#define MX25L512_DUMMY_CYCLES_READ_QUAD 3
|
||||
#define MX25L512_DUMMY_CYCLES_READ 8
|
||||
#define MX25L512_DUMMY_CYCLES_READ_QUAD_IO 10
|
||||
#define MX25L512_DUMMY_CYCLES_READ_DTR 6
|
||||
#define MX25L512_DUMMY_CYCLES_READ_QUAD_DTR 8
|
||||
|
||||
#define MX25L512_BULK_ERASE_MAX_TIME 600000
|
||||
#define MX25L512_SECTOR_ERASE_MAX_TIME 2000
|
||||
#define MX25L512_SUBSECTOR_ERASE_MAX_TIME 800
|
||||
|
||||
/**
|
||||
* @brief MX25L512 Commands
|
||||
*/
|
||||
/* Reset Operations */
|
||||
#define RESET_ENABLE_CMD 0x66
|
||||
#define RESET_MEMORY_CMD 0x99
|
||||
|
||||
/* Identification Operations */
|
||||
#define READ_ID_CMD 0x9F
|
||||
#define MULTIPLE_IO_READ_ID_CMD 0xAF
|
||||
#define READ_SERIAL_FLASH_DISCO_PARAM_CMD 0x5A
|
||||
|
||||
/* Read Operations */
|
||||
#define READ_CMD 0x03
|
||||
#define READ_4_BYTE_ADDR_CMD 0x13
|
||||
|
||||
#define FAST_READ_CMD 0x0B
|
||||
#define FAST_READ_DTR_CMD 0x0D
|
||||
#define FAST_READ_4_BYTE_ADDR_CMD 0x0C
|
||||
|
||||
#define DUAL_OUT_FAST_READ_CMD 0x3B
|
||||
#define DUAL_OUT_FAST_READ_4_BYTE_ADDR_CMD 0x3C
|
||||
|
||||
#define DUAL_INOUT_FAST_READ_CMD 0xBB
|
||||
#define DUAL_INOUT_FAST_READ_DTR_CMD 0xBD
|
||||
#define DUAL_INOUT_FAST_READ_4_BYTE_ADDR_CMD 0xBC
|
||||
|
||||
#define QUAD_OUT_FAST_READ_CMD 0x6B
|
||||
#define QUAD_OUT_FAST_READ_4_BYTE_ADDR_CMD 0x6C
|
||||
|
||||
#define QUAD_INOUT_FAST_READ_CMD 0xEB
|
||||
#define QUAD_INOUT_FAST_READ_DTR_CMD 0xED
|
||||
#define QSPI_READ_4_BYTE_ADDR_CMD 0xEC
|
||||
|
||||
/* Write Operations */
|
||||
#define WRITE_ENABLE_CMD 0x06
|
||||
#define WRITE_DISABLE_CMD 0x04
|
||||
|
||||
/* Register Operations */
|
||||
#define READ_STATUS_REG_CMD 0x05
|
||||
#define READ_CFG_REG_CMD 0x15
|
||||
#define WRITE_STATUS_CFG_REG_CMD 0x01
|
||||
|
||||
#define READ_LOCK_REG_CMD 0x2D
|
||||
#define WRITE_LOCK_REG_CMD 0x2C
|
||||
|
||||
#define READ_EXT_ADDR_REG_CMD 0xC8
|
||||
#define WRITE_EXT_ADDR_REG_CMD 0xC5
|
||||
|
||||
/* Program Operations */
|
||||
#define PAGE_PROG_CMD 0x02
|
||||
#define QSPI_PAGE_PROG_4_BYTE_ADDR_CMD 0x12
|
||||
|
||||
#define QUAD_IN_FAST_PROG_CMD 0x38
|
||||
#define EXT_QUAD_IN_FAST_PROG_CMD 0x38
|
||||
#define QUAD_IN_FAST_PROG_4_BYTE_ADDR_CMD 0x3E
|
||||
|
||||
/* Erase Operations */
|
||||
#define SUBSECTOR_ERASE_CMD 0x20
|
||||
#define SUBSECTOR_ERASE_4_BYTE_ADDR_CMD 0x21
|
||||
|
||||
#define SECTOR_ERASE_CMD 0xD8
|
||||
#define SECTOR_ERASE_4_BYTE_ADDR_CMD 0xDC
|
||||
|
||||
#define BULK_ERASE_CMD 0xC7
|
||||
|
||||
#define PROG_ERASE_RESUME_CMD 0x30
|
||||
#define PROG_ERASE_SUSPEND_CMD 0xB0
|
||||
|
||||
/* 4-byte Address Mode Operations */
|
||||
#define ENTER_4_BYTE_ADDR_MODE_CMD 0xB7
|
||||
#define EXIT_4_BYTE_ADDR_MODE_CMD 0xE9
|
||||
|
||||
/* Quad Operations */
|
||||
#define ENTER_QUAD_CMD 0x35
|
||||
#define EXIT_QUAD_CMD 0xF5
|
||||
|
||||
/* Added for compatibility */
|
||||
#define QPI_READ_4_BYTE_ADDR_CMD QSPI_READ_4_BYTE_ADDR_CMD
|
||||
#define QPI_PAGE_PROG_4_BYTE_ADDR_CMD QSPI_PAGE_PROG_4_BYTE_ADDR_CMD
|
||||
|
||||
/**
|
||||
* @brief MX25L512 Registers
|
||||
*/
|
||||
/* Status Register */
|
||||
#define MX25L512_SR_WIP ((uint8_t)0x01) /*!< Write in progress */
|
||||
#define MX25L512_SR_WREN ((uint8_t)0x02) /*!< Write enable latch */
|
||||
#define MX25L512_SR_BLOCKPR ((uint8_t)0x5C) /*!< Block protected against program and erase operations */
|
||||
#define MX25L512_SR_PRBOTTOM ((uint8_t)0x20) /*!< Protected memory area defined by BLOCKPR starts from top or bottom */
|
||||
#define MX25L512_SR_QUADEN ((uint8_t)0x40) /*!< Quad IO mode enabled if =1 */
|
||||
#define MX25L512_SR_SRWREN ((uint8_t)0x80) /*!< Status register write enable/disable */
|
||||
|
||||
/* Configuration Register */
|
||||
#define MX25L512_CR_ODS ((uint8_t)0x07) /*!< Output driver strength */
|
||||
#define MX25L512_CR_ODS_30 ((uint8_t)0x07) /*!< Output driver strength 30 ohms (default)*/
|
||||
#define MX25L512_CR_ODS_15 ((uint8_t)0x06) /*!< Output driver strength 15 ohms */
|
||||
#define MX25L512_CR_ODS_20 ((uint8_t)0x05) /*!< Output driver strength 20 ohms */
|
||||
#define MX25L512_CR_ODS_45 ((uint8_t)0x03) /*!< Output driver strength 45 ohms */
|
||||
#define MX25L512_CR_ODS_60 ((uint8_t)0x02) /*!< Output driver strength 60 ohms */
|
||||
#define MX25L512_CR_ODS_90 ((uint8_t)0x01) /*!< Output driver strength 90 ohms */
|
||||
#define MX25L512_CR_TB ((uint8_t)0x08) /*!< Top/Bottom bit used to configure the block protect area */
|
||||
#define MX25L512_CR_PBE ((uint8_t)0x10) /*!< Preamble Bit Enable */
|
||||
#define MX25L512_CR_4BYTE ((uint8_t)0x20) /*!< 3-bytes or 4-bytes addressing */
|
||||
#define MX25L512_CR_NB_DUMMY ((uint8_t)0xC0) /*!< Number of dummy clock cycles */
|
||||
|
||||
#define MX25L512_MANUFACTURER_ID ((uint8_t)0xC2)
|
||||
#define MX25L512_DEVICE_ID_MEM_TYPE ((uint8_t)0x20)
|
||||
#define MX25L512_DEVICE_ID_MEM_CAPACITY ((uint8_t)0x1A)
|
||||
#define MX25L512_UNIQUE_ID_DATA_LENGTH ((uint8_t)0x10)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MX25L512_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MX25L512_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]-->
|
||||
|
||||
|
||||
|
||||
<title>Release Notes for STM32 BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head>
|
||||
<body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for MX25R6435F Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2017 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 200px; margin-right: 500pt;"><span style="color: white; font-family: Arial; font-size: 10pt;">V1.0.0 / 17-February-2017</span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b><u><span style="color: black; font-family: Verdana; font-size: 10pt;">Main Change<o:p></o:p></span></u></b></p><ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-family: Verdana; font-size: 10pt;">First official release<span style="font-style: italic; font-weight: bold;"> </span></span><span style="font-family: Verdana; font-size: 10pt;">of </span><span style="font-size: 10pt; font-family: Verdana;">MX256435F QuadSPI Flash memory</span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br>
|
||||
</h2>
|
||||
<div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistribution
|
||||
and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol>
|
||||
<li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li>
|
||||
<li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the
|
||||
documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li>
|
||||
<li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the
|
||||
name of STMicroelectronics nor the names of its contributors may be
|
||||
used to endorse or promote products derived </span><br>
|
||||
</font> </li>
|
||||
</ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS
|
||||
SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.</span></font> </div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file mx25r6435f.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 17-February-2017
|
||||
* @brief This file contains all the description of the MX25R6435F QSPI memory.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MX25R6435F_H
|
||||
#define __MX25R6435F_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup mx25r6435f
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup MX25R6435F_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MX25R6435F_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief MX25R6435F Configuration
|
||||
*/
|
||||
#define MX25R6435F_FLASH_SIZE 0x800000 /* 64 MBits => 8MBytes */
|
||||
#define MX25R6435F_BLOCK_SIZE 0x10000 /* 128 blocks of 64KBytes */
|
||||
#define MX25R6435F_SUBBLOCK_SIZE 0x8000 /* 256 blocks of 32KBytes */
|
||||
#define MX25R6435F_SECTOR_SIZE 0x1000 /* 2048 sectors of 4kBytes */
|
||||
#define MX25R6435F_PAGE_SIZE 0x100 /* 32768 pages of 256 bytes */
|
||||
|
||||
#define MX25R6435F_DUMMY_CYCLES_READ 8
|
||||
#define MX25R6435F_DUMMY_CYCLES_READ_DUAL 4
|
||||
#define MX25R6435F_DUMMY_CYCLES_READ_QUAD 4
|
||||
#define MX25R6435F_DUMMY_CYCLES_2READ 2
|
||||
#define MX25R6435F_DUMMY_CYCLES_4READ 4
|
||||
|
||||
#define MX25R6435F_ALT_BYTES_PE_MODE 0xA5
|
||||
#define MX25R6435F_ALT_BYTES_NO_PE_MODE 0xAA
|
||||
|
||||
#define MX25R6435F_CHIP_ERASE_MAX_TIME 240000
|
||||
#define MX25R6435F_BLOCK_ERASE_MAX_TIME 3500
|
||||
#define MX25R6435F_SUBBLOCK_ERASE_MAX_TIME 3000
|
||||
#define MX25R6435F_SECTOR_ERASE_MAX_TIME 240
|
||||
|
||||
/**
|
||||
* @brief MX25R6435F Commands
|
||||
*/
|
||||
/* Read Operations */
|
||||
#define READ_CMD 0x03
|
||||
#define FAST_READ_CMD 0x0B
|
||||
#define DUAL_OUT_READ_CMD 0x3B
|
||||
#define DUAL_INOUT_READ_CMD 0xBB
|
||||
#define QUAD_OUT_READ_CMD 0x6B
|
||||
#define QUAD_INOUT_READ_CMD 0xEB
|
||||
|
||||
/* Program Operations */
|
||||
#define PAGE_PROG_CMD 0x02
|
||||
#define QUAD_PAGE_PROG_CMD 0x38
|
||||
|
||||
/* Erase Operations */
|
||||
#define SECTOR_ERASE_CMD 0x20
|
||||
#define SUBBLOCK_ERASE_CMD 0x52
|
||||
#define BLOCK_ERASE_CMD 0xD8
|
||||
#define CHIP_ERASE_CMD 0x60
|
||||
#define CHIP_ERASE_CMD_2 0xC7
|
||||
|
||||
#define PROG_ERASE_RESUME_CMD 0x7A
|
||||
#define PROG_ERASE_RESUME_CMD_2 0x30
|
||||
#define PROG_ERASE_SUSPEND_CMD 0x75
|
||||
#define PROG_ERASE_SUSPEND_CMD_2 0xB0
|
||||
|
||||
/* Identification Operations */
|
||||
#define READ_ID_CMD 0x9F
|
||||
#define READ_ELECTRONIC_ID_CMD 0xAB
|
||||
#define READ_ELEC_MANUFACTURER_DEVICE_ID_CMD 0x90
|
||||
#define READ_SERIAL_FLASH_DISCO_PARAM_CMD 0x5A
|
||||
|
||||
/* Write Operations */
|
||||
#define WRITE_ENABLE_CMD 0x06
|
||||
#define WRITE_DISABLE_CMD 0x04
|
||||
|
||||
/* Register Operations */
|
||||
#define READ_STATUS_REG_CMD 0x05
|
||||
#define READ_CFG_REG_CMD 0x15
|
||||
#define WRITE_STATUS_CFG_REG_CMD 0x01
|
||||
|
||||
#define READ_SEC_REG_CMD 0x2B
|
||||
#define WRITE_SEC_REG_CMD 0x2F
|
||||
|
||||
/* Power Down Operations */
|
||||
#define DEEP_POWER_DOWN_CMD 0xB9
|
||||
|
||||
/* Burst Operations */
|
||||
#define SET_BURST_LENGTH_CMD 0xC0
|
||||
|
||||
/* One-Time Programmable Operations */
|
||||
#define ENTER_SECURED_OTP_CMD 0xB1
|
||||
#define EXIT_SECURED_OTP_CMD 0xC1
|
||||
|
||||
/* No Operation */
|
||||
#define NO_OPERATION_CMD 0x00
|
||||
|
||||
/* Reset Operations */
|
||||
#define RESET_ENABLE_CMD 0x66
|
||||
#define RESET_MEMORY_CMD 0x99
|
||||
#define RELEASE_READ_ENHANCED_CMD 0xFF
|
||||
|
||||
/**
|
||||
* @brief MX25R6435F Registers
|
||||
*/
|
||||
/* Status Register */
|
||||
#define MX25R6435F_SR_WIP ((uint8_t)0x01) /*!< Write in progress */
|
||||
#define MX25R6435F_SR_WEL ((uint8_t)0x02) /*!< Write enable latch */
|
||||
#define MX25R6435F_SR_BP ((uint8_t)0x3C) /*!< Block protect */
|
||||
#define MX25R6435F_SR_QE ((uint8_t)0x40) /*!< Quad enable */
|
||||
#define MX25R6435F_SR_SRWD ((uint8_t)0x80) /*!< Status register write disable */
|
||||
|
||||
/* Configuration Register 1 */
|
||||
#define MX25R6435F_CR1_TB ((uint8_t)0x08) /*!< Top / bottom */
|
||||
|
||||
/* Configuration Register 2 */
|
||||
#define MX25R6435F_CR2_LH_SWITCH ((uint8_t)0x02) /*!< Low power / high performance switch */
|
||||
|
||||
/* Security Register */
|
||||
#define MX25R6435F_SECR_SOI ((uint8_t)0x01) /*!< Secured OTP indicator */
|
||||
#define MX25R6435F_SECR_LDSO ((uint8_t)0x02) /*!< Lock-down secured OTP */
|
||||
#define MX25R6435F_SECR_PSB ((uint8_t)0x04) /*!< Program suspend bit */
|
||||
#define MX25R6435F_SECR_ESB ((uint8_t)0x08) /*!< Erase suspend bit */
|
||||
#define MX25R6435F_SECR_P_FAIL ((uint8_t)0x20) /*!< Program fail flag */
|
||||
#define MX25R6435F_SECR_E_FAIL ((uint8_t)0x40) /*!< Erase fail flag */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MX25R6435F_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MX25R6435F_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head>
|
||||
<body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for N25Q128A Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><br><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 29-May-2015 <o:p></o:p></span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-family: Verdana; font-size: 10pt;">First official
|
||||
release</span><span style="font-size: 10pt; font-family: Verdana;"> of </span><span style="font-size: 10pt; font-family: Verdana;">N25Q128A QuadSPI Flash Component</span><span style="font-size: 10pt; font-family: Verdana;"> driver</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="padding: 0cm;" valign="top"></td></tr></tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,219 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file n25q128a.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0
|
||||
* @date 29-May-2015
|
||||
* @brief This file contains all the description of the N25Q128A QSPI memory.
|
||||
******************************************************************************
|
||||
* @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 __N25Q128A_H
|
||||
#define __N25Q128A_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup n25q128a
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup N25Q128A_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup N25Q128A_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief N25Q128A Configuration
|
||||
*/
|
||||
#define N25Q128A_FLASH_SIZE 0x1000000 /* 128 MBits => 16MBytes */
|
||||
#define N25Q128A_SECTOR_SIZE 0x10000 /* 256 sectors of 64KBytes */
|
||||
#define N25Q128A_SUBSECTOR_SIZE 0x1000 /* 4096 subsectors of 4kBytes */
|
||||
#define N25Q128A_PAGE_SIZE 0x100 /* 65536 pages of 256 bytes */
|
||||
|
||||
#define N25Q128A_DUMMY_CYCLES_READ 8
|
||||
#define N25Q128A_DUMMY_CYCLES_READ_QUAD 10
|
||||
|
||||
#define N25Q128A_BULK_ERASE_MAX_TIME 250000
|
||||
#define N25Q128A_SECTOR_ERASE_MAX_TIME 3000
|
||||
#define N25Q128A_SUBSECTOR_ERASE_MAX_TIME 800
|
||||
|
||||
/**
|
||||
* @brief N25Q128A Commands
|
||||
*/
|
||||
/* Reset Operations */
|
||||
#define RESET_ENABLE_CMD 0x66
|
||||
#define RESET_MEMORY_CMD 0x99
|
||||
|
||||
/* Identification Operations */
|
||||
#define READ_ID_CMD 0x9E
|
||||
#define READ_ID_CMD2 0x9F
|
||||
#define MULTIPLE_IO_READ_ID_CMD 0xAF
|
||||
#define READ_SERIAL_FLASH_DISCO_PARAM_CMD 0x5A
|
||||
|
||||
/* Read Operations */
|
||||
#define READ_CMD 0x03
|
||||
#define FAST_READ_CMD 0x0B
|
||||
#define DUAL_OUT_FAST_READ_CMD 0x3B
|
||||
#define DUAL_INOUT_FAST_READ_CMD 0xBB
|
||||
#define QUAD_OUT_FAST_READ_CMD 0x6B
|
||||
#define QUAD_INOUT_FAST_READ_CMD 0xEB
|
||||
|
||||
/* Write Operations */
|
||||
#define WRITE_ENABLE_CMD 0x06
|
||||
#define WRITE_DISABLE_CMD 0x04
|
||||
|
||||
/* Register Operations */
|
||||
#define READ_STATUS_REG_CMD 0x05
|
||||
#define WRITE_STATUS_REG_CMD 0x01
|
||||
|
||||
#define READ_LOCK_REG_CMD 0xE8
|
||||
#define WRITE_LOCK_REG_CMD 0xE5
|
||||
|
||||
#define READ_FLAG_STATUS_REG_CMD 0x70
|
||||
#define CLEAR_FLAG_STATUS_REG_CMD 0x50
|
||||
|
||||
#define READ_NONVOL_CFG_REG_CMD 0xB5
|
||||
#define WRITE_NONVOL_CFG_REG_CMD 0xB1
|
||||
|
||||
#define READ_VOL_CFG_REG_CMD 0x85
|
||||
#define WRITE_VOL_CFG_REG_CMD 0x81
|
||||
|
||||
#define READ_ENHANCED_VOL_CFG_REG_CMD 0x65
|
||||
#define WRITE_ENHANCED_VOL_CFG_REG_CMD 0x61
|
||||
|
||||
/* Program Operations */
|
||||
#define PAGE_PROG_CMD 0x02
|
||||
#define DUAL_IN_FAST_PROG_CMD 0xA2
|
||||
#define EXT_DUAL_IN_FAST_PROG_CMD 0xD2
|
||||
#define QUAD_IN_FAST_PROG_CMD 0x32
|
||||
#define EXT_QUAD_IN_FAST_PROG_CMD 0x12
|
||||
|
||||
/* Erase Operations */
|
||||
#define SUBSECTOR_ERASE_CMD 0x20
|
||||
#define SECTOR_ERASE_CMD 0xD8
|
||||
#define BULK_ERASE_CMD 0xC7
|
||||
|
||||
#define PROG_ERASE_RESUME_CMD 0x7A
|
||||
#define PROG_ERASE_SUSPEND_CMD 0x75
|
||||
|
||||
/* One-Time Programmable Operations */
|
||||
#define READ_OTP_ARRAY_CMD 0x4B
|
||||
#define PROG_OTP_ARRAY_CMD 0x42
|
||||
|
||||
/**
|
||||
* @brief N25Q128A Registers
|
||||
*/
|
||||
/* Status Register */
|
||||
#define N25Q128A_SR_WIP ((uint8_t)0x01) /*!< Write in progress */
|
||||
#define N25Q128A_SR_WREN ((uint8_t)0x02) /*!< Write enable latch */
|
||||
#define N25Q128A_SR_BLOCKPR ((uint8_t)0x5C) /*!< Block protected against program and erase operations */
|
||||
#define N25Q128A_SR_PRBOTTOM ((uint8_t)0x20) /*!< Protected memory area defined by BLOCKPR starts from top or bottom */
|
||||
#define N25Q128A_SR_SRWREN ((uint8_t)0x80) /*!< Status register write enable/disable */
|
||||
|
||||
/* Nonvolatile Configuration Register */
|
||||
#define N25Q128A_NVCR_LOCK ((uint16_t)0x0001) /*!< Lock nonvolatile configuration register */
|
||||
#define N25Q128A_NVCR_DUAL ((uint16_t)0x0004) /*!< Dual I/O protocol */
|
||||
#define N25Q128A_NVCR_QUAB ((uint16_t)0x0008) /*!< Quad I/O protocol */
|
||||
#define N25Q128A_NVCR_RH ((uint16_t)0x0010) /*!< Reset/hold */
|
||||
#define N25Q128A_NVCR_ODS ((uint16_t)0x01C0) /*!< Output driver strength */
|
||||
#define N25Q128A_NVCR_XIP ((uint16_t)0x0E00) /*!< XIP mode at power-on reset */
|
||||
#define N25Q128A_NVCR_NB_DUMMY ((uint16_t)0xF000) /*!< Number of dummy clock cycles */
|
||||
|
||||
/* Volatile Configuration Register */
|
||||
#define N25Q128A_VCR_WRAP ((uint8_t)0x03) /*!< Wrap */
|
||||
#define N25Q128A_VCR_XIP ((uint8_t)0x08) /*!< XIP */
|
||||
#define N25Q128A_VCR_NB_DUMMY ((uint8_t)0xF0) /*!< Number of dummy clock cycles */
|
||||
|
||||
/* Enhanced Volatile Configuration Register */
|
||||
#define N25Q128A_EVCR_ODS ((uint8_t)0x07) /*!< Output driver strength */
|
||||
#define N25Q128A_EVCR_VPPA ((uint8_t)0x08) /*!< Vpp accelerator */
|
||||
#define N25Q128A_EVCR_RH ((uint8_t)0x10) /*!< Reset/hold */
|
||||
#define N25Q128A_EVCR_DUAL ((uint8_t)0x40) /*!< Dual I/O protocol */
|
||||
#define N25Q128A_EVCR_QUAD ((uint8_t)0x80) /*!< Quad I/O protocol */
|
||||
|
||||
/* Flag Status Register */
|
||||
#define N25Q128A_FSR_PRERR ((uint8_t)0x02) /*!< Protection error */
|
||||
#define N25Q128A_FSR_PGSUS ((uint8_t)0x04) /*!< Program operation suspended */
|
||||
#define N25Q128A_FSR_VPPERR ((uint8_t)0x08) /*!< Invalid voltage during program or erase */
|
||||
#define N25Q128A_FSR_PGERR ((uint8_t)0x10) /*!< Program error */
|
||||
#define N25Q128A_FSR_ERERR ((uint8_t)0x20) /*!< Erase error */
|
||||
#define N25Q128A_FSR_ERSUS ((uint8_t)0x40) /*!< Erase operation suspended */
|
||||
#define N25Q128A_FSR_READY ((uint8_t)0x80) /*!< Ready or command in progress */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup N25Q128A_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __N25Q128A_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for OTM8009A BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for OTM8009A Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2017 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.2
|
||||
/ 27-January-2017 <o:p></o:p></span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Update DSI controller timings</span></li>
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">CABC LEDPWM frequency adjusted to 19,5kHz<br>
|
||||
</span></li>
|
||||
</ul>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1
|
||||
/ 04-August-2016 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Update DSI controller timings</span></li>
|
||||
</ul>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 03-August-2015 <o:p></o:p></span></h3>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="padding: 0cm;" valign="top"><br>
|
||||
</td></tr></tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,454 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file otm8009a.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.2
|
||||
* @date 27-January-2017
|
||||
* @brief This file provides the LCD Driver for KoD KM-040TMP-02-0621 (WVGA)
|
||||
* DSI LCD Display OTM8009A.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "otm8009a.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup OTM8009A OTM8009A
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* otm8009a IC display driver.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
/** @defgroup OTM8009A_Private_Constants OTM8009A Private Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
* @brief Constant tables of register settings used to transmit DSI
|
||||
* command packets as power up initialization sequence of the KoD LCD (OTM8009A LCD Driver)
|
||||
*/
|
||||
const uint8_t lcdRegData1[] = {0x80,0x09,0x01,0xFF};
|
||||
const uint8_t lcdRegData2[] = {0x80,0x09,0xFF};
|
||||
const uint8_t lcdRegData3[] = {0x00,0x09,0x0F,0x0E,0x07,0x10,0x0B,0x0A,0x04,0x07,0x0B,0x08,0x0F,0x10,0x0A,0x01,0xE1};
|
||||
const uint8_t lcdRegData4[] = {0x00,0x09,0x0F,0x0E,0x07,0x10,0x0B,0x0A,0x04,0x07,0x0B,0x08,0x0F,0x10,0x0A,0x01,0xE2};
|
||||
const uint8_t lcdRegData5[] = {0x79,0x79,0xD8};
|
||||
const uint8_t lcdRegData6[] = {0x00,0x01,0xB3};
|
||||
const uint8_t lcdRegData7[] = {0x85,0x01,0x00,0x84,0x01,0x00,0xCE};
|
||||
const uint8_t lcdRegData8[] = {0x18,0x04,0x03,0x39,0x00,0x00,0x00,0x18,0x03,0x03,0x3A,0x00,0x00,0x00,0xCE};
|
||||
const uint8_t lcdRegData9[] = {0x18,0x02,0x03,0x3B,0x00,0x00,0x00,0x18,0x01,0x03,0x3C,0x00,0x00,0x00,0xCE};
|
||||
const uint8_t lcdRegData10[] = {0x01,0x01,0x20,0x20,0x00,0x00,0x01,0x02,0x00,0x00,0xCF};
|
||||
const uint8_t lcdRegData11[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
|
||||
const uint8_t lcdRegData12[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
|
||||
const uint8_t lcdRegData13[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
|
||||
const uint8_t lcdRegData14[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
|
||||
const uint8_t lcdRegData15[] = {0x00,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
|
||||
const uint8_t lcdRegData16[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0xCB};
|
||||
const uint8_t lcdRegData17[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
|
||||
const uint8_t lcdRegData18[] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xCB};
|
||||
const uint8_t lcdRegData19[] = {0x00,0x26,0x09,0x0B,0x01,0x25,0x00,0x00,0x00,0x00,0xCC};
|
||||
const uint8_t lcdRegData20[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x0A,0x0C,0x02,0xCC};
|
||||
const uint8_t lcdRegData21[] = {0x25,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC};
|
||||
const uint8_t lcdRegData22[] = {0x00,0x25,0x0C,0x0A,0x02,0x26,0x00,0x00,0x00,0x00,0xCC};
|
||||
const uint8_t lcdRegData23[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x25,0x0B,0x09,0x01,0xCC};
|
||||
const uint8_t lcdRegData24[] = {0x26,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC};
|
||||
const uint8_t lcdRegData25[] = {0xFF,0xFF,0xFF,0xFF};
|
||||
/*
|
||||
* CASET value (Column Address Set) : X direction LCD GRAM boundaries
|
||||
* depending on LCD orientation mode and PASET value (Page Address Set) : Y direction
|
||||
* LCD GRAM boundaries depending on LCD orientation mode
|
||||
* XS[15:0] = 0x000 = 0, XE[15:0] = 0x31F = 799 for landscape mode : apply to CASET
|
||||
* YS[15:0] = 0x000 = 0, YE[15:0] = 0x31F = 799 for portrait mode : : apply to PASET
|
||||
*/
|
||||
const uint8_t lcdRegData27[] = {0x00, 0x00, 0x03, 0x1F, OTM8009A_CMD_CASET};
|
||||
/*
|
||||
* XS[15:0] = 0x000 = 0, XE[15:0] = 0x1DF = 479 for portrait mode : apply to CASET
|
||||
* YS[15:0] = 0x000 = 0, YE[15:0] = 0x1DF = 479 for landscape mode : apply to PASET
|
||||
*/
|
||||
const uint8_t lcdRegData28[] = {0x00, 0x00, 0x01, 0xDF, OTM8009A_CMD_PASET};
|
||||
|
||||
|
||||
const uint8_t ShortRegData1[] = {OTM8009A_CMD_NOP, 0x00};
|
||||
const uint8_t ShortRegData2[] = {OTM8009A_CMD_NOP, 0x80};
|
||||
const uint8_t ShortRegData3[] = {0xC4, 0x30};
|
||||
const uint8_t ShortRegData4[] = {OTM8009A_CMD_NOP, 0x8A};
|
||||
const uint8_t ShortRegData5[] = {0xC4, 0x40};
|
||||
const uint8_t ShortRegData6[] = {OTM8009A_CMD_NOP, 0xB1};
|
||||
const uint8_t ShortRegData7[] = {0xC5, 0xA9};
|
||||
const uint8_t ShortRegData8[] = {OTM8009A_CMD_NOP, 0x91};
|
||||
const uint8_t ShortRegData9[] = {0xC5, 0x34};
|
||||
const uint8_t ShortRegData10[] = {OTM8009A_CMD_NOP, 0xB4};
|
||||
const uint8_t ShortRegData11[] = {0xC0, 0x50};
|
||||
const uint8_t ShortRegData12[] = {0xD9, 0x4E};
|
||||
const uint8_t ShortRegData13[] = {OTM8009A_CMD_NOP, 0x81};
|
||||
const uint8_t ShortRegData14[] = {0xC1, 0x66};
|
||||
const uint8_t ShortRegData15[] = {OTM8009A_CMD_NOP, 0xA1};
|
||||
const uint8_t ShortRegData16[] = {0xC1, 0x08};
|
||||
const uint8_t ShortRegData17[] = {OTM8009A_CMD_NOP, 0x92};
|
||||
const uint8_t ShortRegData18[] = {0xC5, 0x01};
|
||||
const uint8_t ShortRegData19[] = {OTM8009A_CMD_NOP, 0x95};
|
||||
const uint8_t ShortRegData20[] = {OTM8009A_CMD_NOP, 0x94};
|
||||
const uint8_t ShortRegData21[] = {0xC5, 0x33};
|
||||
const uint8_t ShortRegData22[] = {OTM8009A_CMD_NOP, 0xA3};
|
||||
const uint8_t ShortRegData23[] = {0xC0, 0x1B};
|
||||
const uint8_t ShortRegData24[] = {OTM8009A_CMD_NOP, 0x82};
|
||||
const uint8_t ShortRegData25[] = {0xC5, 0x83};
|
||||
const uint8_t ShortRegData26[] = {0xC4, 0x83};
|
||||
const uint8_t ShortRegData27[] = {0xC1, 0x0E};
|
||||
const uint8_t ShortRegData28[] = {OTM8009A_CMD_NOP, 0xA6};
|
||||
const uint8_t ShortRegData29[] = {OTM8009A_CMD_NOP, 0xA0};
|
||||
const uint8_t ShortRegData30[] = {OTM8009A_CMD_NOP, 0xB0};
|
||||
const uint8_t ShortRegData31[] = {OTM8009A_CMD_NOP, 0xC0};
|
||||
const uint8_t ShortRegData32[] = {OTM8009A_CMD_NOP, 0xD0};
|
||||
const uint8_t ShortRegData33[] = {OTM8009A_CMD_NOP, 0x90};
|
||||
const uint8_t ShortRegData34[] = {OTM8009A_CMD_NOP, 0xE0};
|
||||
const uint8_t ShortRegData35[] = {OTM8009A_CMD_NOP, 0xF0};
|
||||
const uint8_t ShortRegData36[] = {OTM8009A_CMD_SLPOUT, 0x00};
|
||||
const uint8_t ShortRegData37[] = {OTM8009A_CMD_COLMOD, OTM8009A_COLMOD_RGB565};
|
||||
const uint8_t ShortRegData38[] = {OTM8009A_CMD_COLMOD, OTM8009A_COLMOD_RGB888};
|
||||
const uint8_t ShortRegData39[] = {OTM8009A_CMD_MADCTR, OTM8009A_MADCTR_MODE_LANDSCAPE};
|
||||
const uint8_t ShortRegData40[] = {OTM8009A_CMD_WRDISBV, 0x7F};
|
||||
const uint8_t ShortRegData41[] = {OTM8009A_CMD_WRCTRLD, 0x2C};
|
||||
const uint8_t ShortRegData42[] = {OTM8009A_CMD_WRCABC, 0x02};
|
||||
const uint8_t ShortRegData43[] = {OTM8009A_CMD_WRCABCMB, 0xFF};
|
||||
const uint8_t ShortRegData44[] = {OTM8009A_CMD_DISPON, 0x00};
|
||||
const uint8_t ShortRegData45[] = {OTM8009A_CMD_RAMWR, 0x00};
|
||||
const uint8_t ShortRegData46[] = {0xCF, 0x00};
|
||||
const uint8_t ShortRegData47[] = {0xC5, 0x66};
|
||||
const uint8_t ShortRegData48[] = {OTM8009A_CMD_NOP, 0xB6};
|
||||
const uint8_t ShortRegData49[] = {0xF5, 0x06};
|
||||
const uint8_t ShortRegData50[] = {OTM8009A_CMD_NOP, 0xB1};
|
||||
const uint8_t ShortRegData51[] = {0xC6, 0x06};
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
/** @defgroup OTM8009A_Exported_Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions ---------------------------------------------------------*/
|
||||
/** @defgroup OTM8009A_Exported_Functions OTM8009A Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief DSI IO write short/long command.
|
||||
* @note : Can be surcharged by application code implementation of the function.
|
||||
*/
|
||||
__weak void DSI_IO_WriteCmd(uint32_t NbrParams, uint8_t *pParams)
|
||||
{
|
||||
/* NOTE : This function Should not be modified, when it is needed,
|
||||
the DSI_IO_WriteCmd could be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the LCD KoD display part by communication in DSI mode in Video Mode
|
||||
* with IC Display Driver OTM8009A (see IC Driver specification for more information).
|
||||
* @param hdsi_eval : pointer on DSI configuration structure
|
||||
* @param hdsivideo_handle : pointer on DSI video mode configuration structure
|
||||
* @retval Status
|
||||
*/
|
||||
uint8_t OTM8009A_Init(uint32_t ColorCoding, uint32_t orientation)
|
||||
{
|
||||
/* Enable CMD2 to access vendor specific commands */
|
||||
/* Enter in command 2 mode and set EXTC to enable address shift function (0x00) */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
|
||||
DSI_IO_WriteCmd( 3, (uint8_t *)lcdRegData1);
|
||||
|
||||
/* Enter ORISE Command 2 */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2); /* Shift address to 0x80 */
|
||||
DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData2);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
/* SD_PCH_CTRL - 0xC480h - 129th parameter - Default 0x00 */
|
||||
/* Set SD_PT */
|
||||
/* -> Source output level during porch and non-display area to GND */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData3);
|
||||
OTM8009A_IO_Delay(10);
|
||||
/* Not documented */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData4);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData5);
|
||||
OTM8009A_IO_Delay(10);
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* PWR_CTRL4 - 0xC4B0h - 178th parameter - Default 0xA8 */
|
||||
/* Set gvdd_en_test */
|
||||
/* -> enable GVDD test mode !!! */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData6);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData7);
|
||||
|
||||
/* PWR_CTRL2 - 0xC590h - 146th parameter - Default 0x79 */
|
||||
/* Set pump 4 vgh voltage */
|
||||
/* -> from 15.0v down to 13.0v */
|
||||
/* Set pump 5 vgh voltage */
|
||||
/* -> from -12.0v downto -9.0v */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData8);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData9);
|
||||
|
||||
/* P_DRV_M - 0xC0B4h - 181th parameter - Default 0x00 */
|
||||
/* -> Column inversion */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData10);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData11);
|
||||
|
||||
/* VCOMDC - 0xD900h - 1st parameter - Default 0x39h */
|
||||
/* VCOM Voltage settings */
|
||||
/* -> from -1.0000v downto -1.2625v */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData12);
|
||||
|
||||
/* Oscillator adjustment for Idle/Normal mode (LPDT only) set to 65Hz (default is 60Hz) */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData14);
|
||||
|
||||
/* Video mode internal */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData15);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData16);
|
||||
|
||||
/* PWR_CTRL2 - 0xC590h - 147h parameter - Default 0x00 */
|
||||
/* Set pump 4&5 x6 */
|
||||
/* -> ONLY VALID when PUMP4_EN_ASDM_HV = "0" */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData17);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData18);
|
||||
|
||||
/* PWR_CTRL2 - 0xC590h - 150th parameter - Default 0x33h */
|
||||
/* Change pump4 clock ratio */
|
||||
/* -> from 1 line to 1/2 line */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData19);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData9);
|
||||
|
||||
/* GVDD/NGVDD settings */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
|
||||
DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData5);
|
||||
|
||||
/* PWR_CTRL2 - 0xC590h - 149th parameter - Default 0x33h */
|
||||
/* Rewrite the default value ! */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData20);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData21);
|
||||
|
||||
/* Panel display timing Setting 3 */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData22);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData23);
|
||||
|
||||
/* Power control 1 */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData24);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData25);
|
||||
|
||||
/* Source driver precharge */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData26);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData15);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData27);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData28);
|
||||
DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData6);
|
||||
|
||||
/* GOAVST */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
|
||||
DSI_IO_WriteCmd( 6, (uint8_t *)lcdRegData7);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
|
||||
DSI_IO_WriteCmd( 14, (uint8_t *)lcdRegData8);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
|
||||
DSI_IO_WriteCmd( 14, (uint8_t *)lcdRegData9);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
|
||||
DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData10);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData46);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
|
||||
DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData11);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData33);
|
||||
DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData12);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
|
||||
DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData13);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
|
||||
DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData14);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
|
||||
DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData15);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
|
||||
DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData16);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData34);
|
||||
DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData17);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData35);
|
||||
DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData18);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
|
||||
DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData19);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData33);
|
||||
DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData20);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
|
||||
DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData21);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
|
||||
DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData22);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
|
||||
DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData23);
|
||||
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
|
||||
DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData24);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/* PWR_CTRL1 - 0xc580h - 130th parameter - default 0x00 */
|
||||
/* Pump 1 min and max DM */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData47);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData48);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData49);
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* CABC LEDPWM frequency adjusted to 19,5kHz */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData50);
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData51);
|
||||
|
||||
/* Exit CMD2 mode */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
|
||||
DSI_IO_WriteCmd( 3, (uint8_t *)lcdRegData25);
|
||||
|
||||
/*************************************************************************** */
|
||||
/* Standard DCS Initialization TO KEEP CAN BE DONE IN HSDT */
|
||||
/*************************************************************************** */
|
||||
|
||||
/* NOP - goes back to DCS std command ? */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
|
||||
|
||||
/* Gamma correction 2.2+ table (HSDT possible) */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
|
||||
DSI_IO_WriteCmd( 16, (uint8_t *)lcdRegData3);
|
||||
|
||||
/* Gamma correction 2.2- table (HSDT possible) */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
|
||||
DSI_IO_WriteCmd( 16, (uint8_t *)lcdRegData4);
|
||||
|
||||
/* Send Sleep Out command to display : no parameter */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData36);
|
||||
|
||||
/* Wait for sleep out exit */
|
||||
OTM8009A_IO_Delay(120);
|
||||
|
||||
switch(ColorCoding)
|
||||
{
|
||||
case OTM8009A_FORMAT_RBG565 :
|
||||
/* Set Pixel color format to RGB565 */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData37);
|
||||
break;
|
||||
case OTM8009A_FORMAT_RGB888 :
|
||||
/* Set Pixel color format to RGB888 */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData38);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
/* Send command to configure display in landscape orientation mode. By default
|
||||
the orientation mode is portrait */
|
||||
if(orientation == OTM8009A_ORIENTATION_LANDSCAPE)
|
||||
{
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData39);
|
||||
DSI_IO_WriteCmd( 4, (uint8_t *)lcdRegData27);
|
||||
DSI_IO_WriteCmd( 4, (uint8_t *)lcdRegData28);
|
||||
}
|
||||
|
||||
/** CABC : Content Adaptive Backlight Control section start >> */
|
||||
/* Note : defaut is 0 (lowest Brightness), 0xFF is highest Brightness, try 0x7F : intermediate value */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData40);
|
||||
|
||||
/* defaut is 0, try 0x2C - Brightness Control Block, Display Dimming & BackLight on */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData41);
|
||||
|
||||
/* defaut is 0, try 0x02 - image Content based Adaptive Brightness [Still Picture] */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData42);
|
||||
|
||||
/* defaut is 0 (lowest Brightness), 0xFF is highest Brightness */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData43);
|
||||
|
||||
/** CABC : Content Adaptive Backlight Control section end << */
|
||||
|
||||
/* Send Command Display On */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData44);
|
||||
|
||||
/* NOP command */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
|
||||
|
||||
/* Send Command GRAM memory write (no parameters) : this initiates frame write via other DSI commands sent by */
|
||||
/* DSI host from LTDC incoming pixels in video mode */
|
||||
DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData45);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,224 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file otm8009a.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.2
|
||||
* @date 27-January-2017
|
||||
* @brief This file contains all the constants parameters for the OTM8009A
|
||||
* which is the LCD Driver for KoD KM-040TMP-02-0621 (WVGA)
|
||||
* DSI LCD Display.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __OTM8009A_H
|
||||
#define __OTM8009A_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup otm8009a
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup OTM8009A_Exported_Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined ( __GNUC__ )
|
||||
#ifndef __weak
|
||||
#define __weak __attribute__((weak))
|
||||
#endif /* __weak */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
/**
|
||||
* @brief LCD_OrientationTypeDef
|
||||
* Possible values of Display Orientation
|
||||
*/
|
||||
#define OTM8009A_ORIENTATION_PORTRAIT ((uint32_t)0x00) /* Portrait orientation choice of LCD screen */
|
||||
#define OTM8009A_ORIENTATION_LANDSCAPE ((uint32_t)0x01) /* Landscape orientation choice of LCD screen */
|
||||
|
||||
/**
|
||||
* @brief Possible values of
|
||||
* pixel data format (ie color coding) transmitted on DSI Data lane in DSI packets
|
||||
*/
|
||||
#define OTM8009A_FORMAT_RGB888 ((uint32_t)0x00) /* Pixel format chosen is RGB888 : 24 bpp */
|
||||
#define OTM8009A_FORMAT_RBG565 ((uint32_t)0x02) /* Pixel format chosen is RGB565 : 16 bpp */
|
||||
|
||||
/**
|
||||
* @brief otm8009a_480x800 Size
|
||||
*/
|
||||
|
||||
/* Width and Height in Portrait mode */
|
||||
#define OTM8009A_480X800_WIDTH ((uint16_t)480) /* LCD PIXEL WIDTH */
|
||||
#define OTM8009A_480X800_HEIGHT ((uint16_t)800) /* LCD PIXEL HEIGHT */
|
||||
|
||||
/* Width and Height in Landscape mode */
|
||||
#define OTM8009A_800X480_WIDTH ((uint16_t)800) /* LCD PIXEL WIDTH */
|
||||
#define OTM8009A_800X480_HEIGHT ((uint16_t)480) /* LCD PIXEL HEIGHT */
|
||||
|
||||
/**
|
||||
* @brief OTM8009A_480X800 Timing parameters for Portrait orientation mode
|
||||
*/
|
||||
#define OTM8009A_480X800_HSYNC ((uint16_t)2) /* Horizontal synchronization */
|
||||
#define OTM8009A_480X800_HBP ((uint16_t)34) /* Horizontal back porch */
|
||||
#define OTM8009A_480X800_HFP ((uint16_t)34) /* Horizontal front porch */
|
||||
#define OTM8009A_480X800_VSYNC ((uint16_t)1) /* Vertical synchronization */
|
||||
#define OTM8009A_480X800_VBP ((uint16_t)15) /* Vertical back porch */
|
||||
#define OTM8009A_480X800_VFP ((uint16_t)16) /* Vertical front porch */
|
||||
|
||||
/**
|
||||
* @brief OTM8009A_800X480 Timing parameters for Landscape orientation mode
|
||||
* Same values as for Portrait mode in fact.
|
||||
*/
|
||||
#define OTM8009A_800X480_HSYNC OTM8009A_480X800_VSYNC /* Horizontal synchronization */
|
||||
#define OTM8009A_800X480_HBP OTM8009A_480X800_VBP /* Horizontal back porch */
|
||||
#define OTM8009A_800X480_HFP OTM8009A_480X800_VFP /* Horizontal front porch */
|
||||
#define OTM8009A_800X480_VSYNC OTM8009A_480X800_HSYNC /* Vertical synchronization */
|
||||
#define OTM8009A_800X480_VBP OTM8009A_480X800_HBP /* Vertical back porch */
|
||||
#define OTM8009A_800X480_VFP OTM8009A_480X800_HFP /* Vertical front porch */
|
||||
|
||||
|
||||
/* List of OTM8009A used commands */
|
||||
/* Detailed in OTM8009A Data Sheet 'DATA_SHEET_OTM8009A_V0 92.pdf' */
|
||||
/* Version of 14 June 2012 */
|
||||
#define OTM8009A_CMD_NOP 0x00 /* NOP command */
|
||||
#define OTM8009A_CMD_SWRESET 0x01 /* Sw reset command */
|
||||
#define OTM8009A_CMD_RDDMADCTL 0x0B /* Read Display MADCTR command : read memory display access ctrl */
|
||||
#define OTM8009A_CMD_RDDCOLMOD 0x0C /* Read Display pixel format */
|
||||
#define OTM8009A_CMD_SLPIN 0x10 /* Sleep In command */
|
||||
#define OTM8009A_CMD_SLPOUT 0x11 /* Sleep Out command */
|
||||
#define OTM8009A_CMD_PTLON 0x12 /* Partial mode On command */
|
||||
|
||||
#define OTM8009A_CMD_DISPOFF 0x28 /* Display Off command */
|
||||
#define OTM8009A_CMD_DISPON 0x29 /* Display On command */
|
||||
|
||||
#define OTM8009A_CMD_CASET 0x2A /* Column address set command */
|
||||
#define OTM8009A_CMD_PASET 0x2B /* Page address set command */
|
||||
|
||||
#define OTM8009A_CMD_RAMWR 0x2C /* Memory (GRAM) write command */
|
||||
#define OTM8009A_CMD_RAMRD 0x2E /* Memory (GRAM) read command */
|
||||
|
||||
#define OTM8009A_CMD_PLTAR 0x30 /* Partial area command (4 parameters) */
|
||||
|
||||
#define OTM8009A_CMD_TEOFF 0x34 /* Tearing Effect Line Off command : command with no parameter */
|
||||
|
||||
#define OTM8009A_CMD_TEEON 0x35 /* Tearing Effect Line On command : command with 1 parameter 'TELOM' */
|
||||
|
||||
/* Parameter TELOM : Tearing Effect Line Output Mode : possible values */
|
||||
#define OTM8009A_TEEON_TELOM_VBLANKING_INFO_ONLY 0x00
|
||||
#define OTM8009A_TEEON_TELOM_VBLANKING_AND_HBLANKING_INFO 0x01
|
||||
|
||||
#define OTM8009A_CMD_MADCTR 0x36 /* Memory Access write control command */
|
||||
|
||||
/* Possible used values of MADCTR */
|
||||
#define OTM8009A_MADCTR_MODE_PORTRAIT 0x00
|
||||
#define OTM8009A_MADCTR_MODE_LANDSCAPE 0x60 /* MY = 0, MX = 1, MV = 1, ML = 0, RGB = 0 */
|
||||
|
||||
#define OTM8009A_CMD_IDMOFF 0x38 /* Idle mode Off command */
|
||||
#define OTM8009A_CMD_IDMON 0x39 /* Idle mode On command */
|
||||
|
||||
#define OTM8009A_CMD_COLMOD 0x3A /* Interface Pixel format command */
|
||||
|
||||
/* Possible values of COLMOD parameter corresponding to used pixel formats */
|
||||
#define OTM8009A_COLMOD_RGB565 0x55
|
||||
#define OTM8009A_COLMOD_RGB888 0x77
|
||||
|
||||
#define OTM8009A_CMD_RAMWRC 0x3C /* Memory write continue command */
|
||||
#define OTM8009A_CMD_RAMRDC 0x3E /* Memory read continue command */
|
||||
|
||||
#define OTM8009A_CMD_WRTESCN 0x44 /* Write Tearing Effect Scan line command */
|
||||
#define OTM8009A_CMD_RDSCNL 0x45 /* Read Tearing Effect Scan line command */
|
||||
|
||||
/* CABC Management : ie : Content Adaptive Back light Control in IC OTM8009a */
|
||||
#define OTM8009A_CMD_WRDISBV 0x51 /* Write Display Brightness command */
|
||||
#define OTM8009A_CMD_WRCTRLD 0x53 /* Write CTRL Display command */
|
||||
#define OTM8009A_CMD_WRCABC 0x55 /* Write Content Adaptive Brightness command */
|
||||
#define OTM8009A_CMD_WRCABCMB 0x5E /* Write CABC Minimum Brightness command */
|
||||
|
||||
/**
|
||||
* @brief OTM8009A_480X800 frequency divider
|
||||
*/
|
||||
#define OTM8009A_480X800_FREQUENCY_DIVIDER 2 /* LCD Frequency divider */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup OTM8009A_Exported_Macros OTM8009A Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup OTM8009A_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
void DSI_IO_WriteCmd(uint32_t NbrParams, uint8_t *pParams);
|
||||
uint8_t OTM8009A_Init(uint32_t ColorCoding, uint32_t orientation);
|
||||
void OTM8009A_IO_Delay(uint32_t Delay);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OTM8009A_480X800_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,315 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head>
|
||||
|
||||
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Release Note for ST7789H2 component Driver</title></head><body>
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for ST7789H2 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
|
||||
2016 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<span style="font-family: "Times New Roman";">
|
||||
</span>
|
||||
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.1 / 29-December-2016</span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">st7789h2.c/.h:</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Change "\" by "/" in the include path to fix compilation issue under linux <br>
|
||||
</span></li></ul>
|
||||
</ul>
|
||||
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.0 / 22-December-2016</span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">st7789h2.c/.h:</span></li>
|
||||
<ul>
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;">Add 180° orientation support <br>
|
||||
|
||||
</span></li>
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 04-July-2016</span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">st7789h2.c:</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Update ST7789H2_DisplayOn()</span></li></ul></ul>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 04-May-2016</span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes</span></u></b></p>
|
||||
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">First official release</span></li></ul>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
|
||||
<div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
|
||||
</body></html>
|
||||
|
|
@ -0,0 +1,725 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file st7789h2.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.1
|
||||
* @date 29-December-2016
|
||||
* @brief This file includes the LCD driver for st7789h2 LCD.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "st7789h2.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ST7789H2
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* FRIDA FRD154BP2901 LCD.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ST7789H2_Private_TypesDefinitions ST7789H2 Private TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t red;
|
||||
uint8_t green;
|
||||
uint8_t blue;
|
||||
} ST7789H2_Rgb888;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ST7789H2_Private_Defines ST7789H2 Private Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ST7789H2_Private_Macros ST7789H2 Private Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ST7789H2_Private_Variables ST7789H2 Private Variables
|
||||
* @{
|
||||
*/
|
||||
LCD_DrvTypeDef ST7789H2_drv =
|
||||
{
|
||||
ST7789H2_Init,
|
||||
ST7789H2_ReadID,
|
||||
ST7789H2_DisplayOn,
|
||||
ST7789H2_DisplayOff,
|
||||
ST7789H2_SetCursor,
|
||||
ST7789H2_WritePixel,
|
||||
ST7789H2_ReadPixel,
|
||||
ST7789H2_SetDisplayWindow,
|
||||
ST7789H2_DrawHLine,
|
||||
ST7789H2_DrawVLine,
|
||||
ST7789H2_GetLcdPixelWidth,
|
||||
ST7789H2_GetLcdPixelHeight,
|
||||
ST7789H2_DrawBitmap,
|
||||
ST7789H2_DrawRGBImage,
|
||||
};
|
||||
|
||||
static uint16_t WindowsXstart = 0;
|
||||
static uint16_t WindowsYstart = 0;
|
||||
static uint16_t WindowsXend = ST7789H2_LCD_PIXEL_WIDTH-1;
|
||||
static uint16_t WindowsYend = ST7789H2_LCD_PIXEL_HEIGHT-1;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ST7789H2_Private_FunctionPrototypes ST7789H2 Private FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
static ST7789H2_Rgb888 ST7789H2_ReadPixel_rgb888(uint16_t Xpos, uint16_t Ypos);
|
||||
static void ST7789H2_DrawRGBHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint8_t *pdata);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ST7789H2_Private_Functions ST7789H2 Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize the st7789h2 LCD Component.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ST7789H2_Init(void)
|
||||
{
|
||||
uint8_t parameter[14];
|
||||
|
||||
/* Initialize st7789h2 low level bus layer ----------------------------------*/
|
||||
LCD_IO_Init();
|
||||
/* Sleep In Command */
|
||||
ST7789H2_WriteReg(ST7789H2_SLEEP_IN, (uint8_t*)NULL, 0);
|
||||
/* Wait for 10ms */
|
||||
LCD_IO_Delay(10);
|
||||
|
||||
/* SW Reset Command */
|
||||
ST7789H2_WriteReg(0x01, (uint8_t*)NULL, 0);
|
||||
/* Wait for 200ms */
|
||||
LCD_IO_Delay(200);
|
||||
|
||||
/* Sleep Out Command */
|
||||
ST7789H2_WriteReg(ST7789H2_SLEEP_OUT, (uint8_t*)NULL, 0);
|
||||
/* Wait for 120ms */
|
||||
LCD_IO_Delay(120);
|
||||
|
||||
/* Normal display for Driver Down side */
|
||||
parameter[0] = 0x00;
|
||||
ST7789H2_WriteReg(ST7789H2_NORMAL_DISPLAY, parameter, 1);
|
||||
|
||||
/* Color mode 16bits/pixel */
|
||||
parameter[0] = 0x05;
|
||||
ST7789H2_WriteReg(ST7789H2_COLOR_MODE, parameter, 1);
|
||||
|
||||
/* Display inversion On */
|
||||
ST7789H2_WriteReg(ST7789H2_DISPLAY_INVERSION, (uint8_t*)NULL, 0);
|
||||
|
||||
/* Set Column address CASET */
|
||||
parameter[0] = 0x00;
|
||||
parameter[1] = 0x00;
|
||||
parameter[2] = 0x00;
|
||||
parameter[3] = 0xEF;
|
||||
ST7789H2_WriteReg(ST7789H2_CASET, parameter, 4);
|
||||
/* Set Row address RASET */
|
||||
parameter[0] = 0x00;
|
||||
parameter[1] = 0x00;
|
||||
parameter[2] = 0x00;
|
||||
parameter[3] = 0xEF;
|
||||
ST7789H2_WriteReg(ST7789H2_RASET, parameter, 4);
|
||||
|
||||
/*--------------- ST7789H2 Frame rate setting -------------------------------*/
|
||||
/* PORCH control setting */
|
||||
parameter[0] = 0x0C;
|
||||
parameter[1] = 0x0C;
|
||||
parameter[2] = 0x00;
|
||||
parameter[3] = 0x33;
|
||||
parameter[4] = 0x33;
|
||||
ST7789H2_WriteReg(ST7789H2_PORCH_CTRL, parameter, 5);
|
||||
|
||||
/* GATE control setting */
|
||||
parameter[0] = 0x35;
|
||||
ST7789H2_WriteReg(ST7789H2_GATE_CTRL, parameter, 1);
|
||||
|
||||
/*--------------- ST7789H2 Power setting ------------------------------------*/
|
||||
/* VCOM setting */
|
||||
parameter[0] = 0x1F;
|
||||
ST7789H2_WriteReg(ST7789H2_VCOM_SET, parameter, 1);
|
||||
|
||||
/* LCM Control setting */
|
||||
parameter[0] = 0x2C;
|
||||
ST7789H2_WriteReg(ST7789H2_LCM_CTRL, parameter, 1);
|
||||
|
||||
/* VDV and VRH Command Enable */
|
||||
parameter[0] = 0x01;
|
||||
parameter[1] = 0xC3;
|
||||
ST7789H2_WriteReg(ST7789H2_VDV_VRH_EN, parameter, 2);
|
||||
|
||||
/* VDV Set */
|
||||
parameter[0] = 0x20;
|
||||
ST7789H2_WriteReg(ST7789H2_VDV_SET, parameter, 1);
|
||||
|
||||
/* Frame Rate Control in normal mode */
|
||||
parameter[0] = 0x0F;
|
||||
ST7789H2_WriteReg(ST7789H2_FR_CTRL, parameter, 1);
|
||||
|
||||
/* Power Control */
|
||||
parameter[0] = 0xA4;
|
||||
parameter[1] = 0xA1;
|
||||
ST7789H2_WriteReg(ST7789H2_POWER_CTRL, parameter, 1);
|
||||
|
||||
/*--------------- ST7789H2 Gamma setting ------------------------------------*/
|
||||
/* Positive Voltage Gamma Control */
|
||||
parameter[0] = 0xD0;
|
||||
parameter[1] = 0x08;
|
||||
parameter[2] = 0x11;
|
||||
parameter[3] = 0x08;
|
||||
parameter[4] = 0x0C;
|
||||
parameter[5] = 0x15;
|
||||
parameter[6] = 0x39;
|
||||
parameter[7] = 0x33;
|
||||
parameter[8] = 0x50;
|
||||
parameter[9] = 0x36;
|
||||
parameter[10] = 0x13;
|
||||
parameter[11] = 0x14;
|
||||
parameter[12] = 0x29;
|
||||
parameter[13] = 0x2D;
|
||||
ST7789H2_WriteReg(ST7789H2_PV_GAMMA_CTRL, parameter, 14);
|
||||
|
||||
/* Negative Voltage Gamma Control */
|
||||
parameter[0] = 0xD0;
|
||||
parameter[1] = 0x08;
|
||||
parameter[2] = 0x10;
|
||||
parameter[3] = 0x08;
|
||||
parameter[4] = 0x06;
|
||||
parameter[5] = 0x06;
|
||||
parameter[6] = 0x39;
|
||||
parameter[7] = 0x44;
|
||||
parameter[8] = 0x51;
|
||||
parameter[9] = 0x0B;
|
||||
parameter[10] = 0x16;
|
||||
parameter[11] = 0x14;
|
||||
parameter[12] = 0x2F;
|
||||
parameter[13] = 0x31;
|
||||
ST7789H2_WriteReg(ST7789H2_NV_GAMMA_CTRL, parameter, 14);
|
||||
|
||||
/* Display ON command */
|
||||
ST7789H2_DisplayOn();
|
||||
|
||||
/* Tearing Effect Line On: Option (00h:VSYNC Interface OFF, 01h:VSYNC Interface ON) */
|
||||
parameter[0] = 0x00;
|
||||
ST7789H2_WriteReg(ST7789H2_TEARING_EFFECT, parameter, 1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the Display Orientation.
|
||||
* @param orientation: ST7789H2_ORIENTATION_PORTRAIT, ST7789H2_ORIENTATION_LANDSCAPE
|
||||
* or ST7789H2_ORIENTATION_LANDSCAPE_ROT180
|
||||
* @retval None
|
||||
*/
|
||||
void ST7789H2_SetOrientation(uint32_t orientation)
|
||||
{
|
||||
uint8_t parameter[6];
|
||||
|
||||
if(orientation == ST7789H2_ORIENTATION_LANDSCAPE)
|
||||
{
|
||||
parameter[0] = 0x00;
|
||||
}
|
||||
else if(orientation == ST7789H2_ORIENTATION_LANDSCAPE_ROT180)
|
||||
{
|
||||
/* Vertical Scrolling Definition */
|
||||
/* TFA describes the Top Fixed Area */
|
||||
parameter[0] = 0x00;
|
||||
parameter[1] = 0x00;
|
||||
/* VSA describes the height of the Vertical Scrolling Area */
|
||||
parameter[2] = 0x01;
|
||||
parameter[3] = 0xF0;
|
||||
/* BFA describes the Bottom Fixed Area */
|
||||
parameter[4] = 0x00;
|
||||
parameter[5] = 0x00;
|
||||
ST7789H2_WriteReg(ST7789H2_VSCRDEF, parameter, 6);
|
||||
|
||||
/* Vertical Scroll Start Address of RAM */
|
||||
/* GRAM row nbr (320) - Display row nbr (240) = 80 = 0x50 */
|
||||
parameter[0] = 0x00;
|
||||
parameter[1] = 0x50;
|
||||
ST7789H2_WriteReg(ST7789H2_VSCSAD, parameter, 2);
|
||||
|
||||
parameter[0] = 0xC0;
|
||||
}
|
||||
else
|
||||
{
|
||||
parameter[0] = 0x60;
|
||||
}
|
||||
ST7789H2_WriteReg(ST7789H2_NORMAL_DISPLAY, parameter, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables the Display.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ST7789H2_DisplayOn(void)
|
||||
{
|
||||
/* Display ON command */
|
||||
ST7789H2_WriteReg(ST7789H2_DISPLAY_ON, (uint8_t*)NULL, 0);
|
||||
|
||||
/* Sleep Out command */
|
||||
ST7789H2_WriteReg(ST7789H2_SLEEP_OUT, (uint8_t*)NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables the Display.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ST7789H2_DisplayOff(void)
|
||||
{
|
||||
uint8_t parameter[1];
|
||||
parameter[0] = 0xFE;
|
||||
/* Display OFF command */
|
||||
ST7789H2_WriteReg(ST7789H2_DISPLAY_OFF, parameter, 1);
|
||||
/* Sleep In Command */
|
||||
ST7789H2_WriteReg(ST7789H2_SLEEP_IN, (uint8_t*)NULL, 0);
|
||||
/* Wait for 10ms */
|
||||
LCD_IO_Delay(10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the LCD pixel Width.
|
||||
* @param None
|
||||
* @retval The Lcd Pixel Width
|
||||
*/
|
||||
uint16_t ST7789H2_GetLcdPixelWidth(void)
|
||||
{
|
||||
return (uint16_t)ST7789H2_LCD_PIXEL_WIDTH;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the LCD pixel Height.
|
||||
* @param None
|
||||
* @retval The Lcd Pixel Height
|
||||
*/
|
||||
uint16_t ST7789H2_GetLcdPixelHeight(void)
|
||||
{
|
||||
return (uint16_t)ST7789H2_LCD_PIXEL_HEIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the st7789h2 ID.
|
||||
* @param None
|
||||
* @retval The st7789h2 ID
|
||||
*/
|
||||
uint16_t ST7789H2_ReadID(void)
|
||||
{
|
||||
LCD_IO_Init();
|
||||
|
||||
return ST7789H2_ReadReg(ST7789H2_LCD_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set Cursor position.
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @retval None
|
||||
*/
|
||||
void ST7789H2_SetCursor(uint16_t Xpos, uint16_t Ypos)
|
||||
{
|
||||
uint8_t parameter[4];
|
||||
/* CASET: Comumn Addrses Set */
|
||||
parameter[0] = 0x00;
|
||||
parameter[1] = 0x00 + Xpos;
|
||||
parameter[2] = 0x00;
|
||||
parameter[3] = 0xEF + Xpos;
|
||||
ST7789H2_WriteReg(ST7789H2_CASET, parameter, 4);
|
||||
/* RASET: Row Addrses Set */
|
||||
parameter[0] = 0x00;
|
||||
parameter[1] = 0x00 + Ypos;
|
||||
parameter[2] = 0x00;
|
||||
parameter[3] = 0xEF + Ypos;
|
||||
ST7789H2_WriteReg(ST7789H2_RASET, parameter, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write pixel.
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @param RGBCode: the RGB pixel color in RGB565 format
|
||||
* @retval None
|
||||
*/
|
||||
void ST7789H2_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
|
||||
{
|
||||
/* Set Cursor */
|
||||
ST7789H2_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write to LCD RAM */
|
||||
ST7789H2_WriteReg(ST7789H2_WRITE_RAM, (uint8_t*)NULL, 0); /* RAM write data command */
|
||||
|
||||
/* Write RAM data */
|
||||
LCD_IO_WriteData(RGBCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read pixel.
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @retval The RGB pixel color in RGB565 format
|
||||
*/
|
||||
uint16_t ST7789H2_ReadPixel(uint16_t Xpos, uint16_t Ypos)
|
||||
{
|
||||
ST7789H2_Rgb888 rgb888;
|
||||
uint8_t r, g, b;
|
||||
uint16_t rgb565;
|
||||
|
||||
/* Set Cursor */
|
||||
ST7789H2_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Read RGB888 data from LCD RAM */
|
||||
rgb888 = ST7789H2_ReadPixel_rgb888(Xpos, Ypos);
|
||||
|
||||
/* Convert RGB888 to RGB565 */
|
||||
r = ((rgb888.red & 0xF8) >> 3); /* Extract the red component 5 most significant bits */
|
||||
g = ((rgb888.green & 0xFC) >> 2); /* Extract the green component 6 most significant bits */
|
||||
b = ((rgb888.blue & 0xF8) >> 3); /* Extract the blue component 5 most significant bits */
|
||||
|
||||
rgb565 = ((uint16_t)(r) << 11) + ((uint16_t)(g) << 5) + ((uint16_t)(b) << 0);
|
||||
|
||||
return (rgb565);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes to the selected LCD register.
|
||||
* @param Command: command value (or register address as named in st7789h2 doc).
|
||||
* @param Parameters: pointer on parameters value (if command uses one or several parameters).
|
||||
* @param NbParameters: number of command parameters (0 if no parameter)
|
||||
* @retval None
|
||||
*/
|
||||
void ST7789H2_WriteReg(uint8_t Command, uint8_t *Parameters, uint8_t NbParameters)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
/* Send command */
|
||||
LCD_IO_WriteReg(Command);
|
||||
|
||||
/* Send command's parameters if any */
|
||||
for (i=0; i<NbParameters; i++)
|
||||
{
|
||||
LCD_IO_WriteData(Parameters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads the selected LCD Register.
|
||||
* @param Command: command value (or register address as named in st7789h2 doc).
|
||||
* @retval Register Value.
|
||||
*/
|
||||
uint8_t ST7789H2_ReadReg(uint8_t Command)
|
||||
{
|
||||
/* Send command */
|
||||
LCD_IO_WriteReg(Command);
|
||||
|
||||
/* Read dummy data */
|
||||
LCD_IO_ReadData();
|
||||
|
||||
/* Read register value */
|
||||
return (LCD_IO_ReadData());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 ST7789H2_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
|
||||
{
|
||||
if (Xpos < ST7789H2_LCD_PIXEL_WIDTH)
|
||||
{
|
||||
WindowsXstart = Xpos;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowsXstart = 0;
|
||||
}
|
||||
|
||||
if (Ypos < ST7789H2_LCD_PIXEL_HEIGHT)
|
||||
{
|
||||
WindowsYstart = Ypos;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowsYstart = 0;
|
||||
}
|
||||
|
||||
if (Width + Xpos <= ST7789H2_LCD_PIXEL_WIDTH)
|
||||
{
|
||||
WindowsXend = Width + Xpos - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowsXend = ST7789H2_LCD_PIXEL_WIDTH - 1;
|
||||
}
|
||||
|
||||
if (Height + Ypos <= ST7789H2_LCD_PIXEL_HEIGHT)
|
||||
{
|
||||
WindowsYend = Height + Ypos - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowsYend = ST7789H2_LCD_PIXEL_HEIGHT-1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Draw vertical line.
|
||||
* @param RGBCode: Specifies the RGB color in RGB565 format
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @param Length: specifies the Line length.
|
||||
* @retval None
|
||||
*/
|
||||
void ST7789H2_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
|
||||
{
|
||||
uint16_t counter = 0;
|
||||
|
||||
/* Set Cursor */
|
||||
ST7789H2_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write to LCD RAM */
|
||||
ST7789H2_WriteReg(ST7789H2_WRITE_RAM, (uint8_t*)NULL, 0); /* RAM write data command */
|
||||
|
||||
/* Sent a complete line */
|
||||
for(counter = 0; counter < Length; counter++)
|
||||
{
|
||||
LCD_IO_WriteData(RGBCode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 ST7789H2_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
|
||||
{
|
||||
uint16_t counter = 0;
|
||||
|
||||
/* Set Cursor */
|
||||
ST7789H2_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write to LCD RAM */
|
||||
ST7789H2_WriteReg(ST7789H2_WRITE_RAM, (uint8_t*)NULL, 0); /* RAM write data command */
|
||||
|
||||
/* Fill a complete vertical line */
|
||||
for(counter = 0; counter < Length; counter++)
|
||||
{
|
||||
ST7789H2_WritePixel(Xpos, Ypos + counter, RGBCode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 ST7789H2_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
|
||||
{
|
||||
uint32_t index = 0, size = 0;
|
||||
uint32_t posY;
|
||||
uint32_t nb_line = 0;
|
||||
uint16_t Xsize = WindowsXend - WindowsXstart + 1;
|
||||
uint16_t Ysize = WindowsYend - WindowsYstart + 1;
|
||||
|
||||
/* 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;
|
||||
|
||||
for (posY = (Ypos + Ysize); posY > Ypos; posY--) /* In BMP files the line order is inverted */
|
||||
{
|
||||
/* Set Cursor */
|
||||
ST7789H2_SetCursor(Xpos, posY - 1);
|
||||
|
||||
/* Draw one line of the picture */
|
||||
ST7789H2_DrawRGBHLine(Xpos, posY - 1, Xsize, (pbmp + (nb_line * Xsize * 2)));
|
||||
nb_line++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 ST7789H2_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata)
|
||||
{
|
||||
uint32_t posY;
|
||||
uint32_t nb_line = 0;
|
||||
|
||||
for (posY = Ypos; posY < (Ypos + Ysize); posY ++)
|
||||
{
|
||||
/* Set Cursor */
|
||||
ST7789H2_SetCursor(Xpos, posY);
|
||||
|
||||
/* Draw one line of the picture */
|
||||
ST7789H2_DrawRGBHLine(Xpos, posY, Xsize, (pdata + (nb_line * Xsize * 2)));
|
||||
nb_line++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Static Functions
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief Read pixel from LCD RAM in RGB888 format
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @retval Each RGB pixel color components in a structure
|
||||
*/
|
||||
static ST7789H2_Rgb888 ST7789H2_ReadPixel_rgb888(uint16_t Xpos, uint16_t Ypos)
|
||||
{
|
||||
ST7789H2_Rgb888 rgb888;
|
||||
uint16_t rgb888_part1, rgb888_part2;
|
||||
|
||||
/* In LCD RAM, pixels are 24 bits packed and read with 16 bits access
|
||||
* Here is the pixels components arrangement in memory :
|
||||
* bits: 15 14 13 12 11 10 09 08 | 07 06 05 04 03 02 01 00
|
||||
* address 0 : red pixel 0 X X | green pixel 0 X X
|
||||
* address 1 : blue pixel 0 X X | red pixel 1 X X
|
||||
* address 2 : green pixel 1 X X | blue pixel 1 X X
|
||||
*/
|
||||
|
||||
/* Set Cursor */
|
||||
ST7789H2_SetCursor(Xpos, Ypos);
|
||||
/* Prepare to read LCD RAM */
|
||||
ST7789H2_WriteReg(ST7789H2_READ_RAM, (uint8_t*)NULL, 0); /* RAM read data command */
|
||||
/* Dummy read */
|
||||
LCD_IO_ReadData();
|
||||
/* Read first part of the RGB888 data */
|
||||
rgb888_part1 = LCD_IO_ReadData();
|
||||
/* Read first part of the RGB888 data */
|
||||
rgb888_part2 = LCD_IO_ReadData();
|
||||
|
||||
/* red component */
|
||||
rgb888.red = (rgb888_part1 & 0xFC00) >> 8;
|
||||
/* green component */
|
||||
rgb888.green = (rgb888_part1 & 0x00FC) >> 0;
|
||||
/* blue component */
|
||||
rgb888.blue = (rgb888_part2 & 0xFC00) >> 8;
|
||||
|
||||
return rgb888;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Displays a single picture line.
|
||||
* @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
|
||||
* @retval None
|
||||
*/
|
||||
static void ST7789H2_DrawRGBHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint8_t *pdata)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
uint32_t posX;
|
||||
uint16_t *rgb565 = (uint16_t*)pdata;
|
||||
|
||||
/* Prepare to write to LCD RAM */
|
||||
ST7789H2_WriteReg(ST7789H2_WRITE_RAM, (uint8_t*)NULL, 0); /* RAM write data command */
|
||||
|
||||
for (posX = Xpos; posX < (Xsize + Xpos); posX++)
|
||||
{
|
||||
if ((posX >= WindowsXstart) && (Ypos >= WindowsYstart) && /* Check we are in the defined window */
|
||||
(posX <= WindowsXend) && (Ypos <= WindowsYend))
|
||||
{
|
||||
if (posX != (Xsize + Xpos)) /* When writing last pixel when size is odd, the third part is not written */
|
||||
{
|
||||
LCD_IO_WriteData(rgb565[i]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file st7789h2.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.1
|
||||
* @date 29-December-2016
|
||||
* @brief This file contains all the functions prototypes for the st7789h2.c
|
||||
* driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 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 __ST7789H2_H
|
||||
#define __ST7789H2_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include "../Common/lcd.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ST7789H2
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ST7789H2_Exported_Types ST7789H2 Exported Types
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ST7789H2_Exported_Constants ST7789H2 Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief ST7789H2 ID
|
||||
*/
|
||||
#define ST7789H2_ID 0x85
|
||||
|
||||
/**
|
||||
* @brief ST7789H2 Size
|
||||
*/
|
||||
#define ST7789H2_LCD_PIXEL_WIDTH ((uint16_t)240)
|
||||
#define ST7789H2_LCD_PIXEL_HEIGHT ((uint16_t)240)
|
||||
|
||||
/**
|
||||
* @brief LCD_OrientationTypeDef
|
||||
* Possible values of Display Orientation
|
||||
*/
|
||||
#define ST7789H2_ORIENTATION_PORTRAIT ((uint32_t)0x00) /* Portrait orientation choice of LCD screen */
|
||||
#define ST7789H2_ORIENTATION_LANDSCAPE ((uint32_t)0x01) /* Landscape orientation choice of LCD screen */
|
||||
#define ST7789H2_ORIENTATION_LANDSCAPE_ROT180 ((uint32_t)0x02) /* Landscape rotated 180° orientation choice of LCD screen */
|
||||
|
||||
/**
|
||||
* @brief ST7789H2 Registers
|
||||
*/
|
||||
#define ST7789H2_LCD_ID 0x04
|
||||
#define ST7789H2_SLEEP_IN 0x10
|
||||
#define ST7789H2_SLEEP_OUT 0x11
|
||||
#define ST7789H2_PARTIAL_DISPLAY 0x12
|
||||
#define ST7789H2_DISPLAY_INVERSION 0x21
|
||||
#define ST7789H2_DISPLAY_ON 0x29
|
||||
#define ST7789H2_WRITE_RAM 0x2C
|
||||
#define ST7789H2_READ_RAM 0x2E
|
||||
#define ST7789H2_CASET 0x2A
|
||||
#define ST7789H2_RASET 0x2B
|
||||
#define ST7789H2_VSCRDEF 0x33 /* Vertical Scroll Definition */
|
||||
#define ST7789H2_VSCSAD 0x37 /* Vertical Scroll Start Address of RAM */
|
||||
#define ST7789H2_TEARING_EFFECT 0x35
|
||||
#define ST7789H2_NORMAL_DISPLAY 0x36
|
||||
#define ST7789H2_IDLE_MODE_OFF 0x38
|
||||
#define ST7789H2_IDLE_MODE_ON 0x39
|
||||
#define ST7789H2_COLOR_MODE 0x3A
|
||||
#define ST7789H2_PORCH_CTRL 0xB2
|
||||
#define ST7789H2_GATE_CTRL 0xB7
|
||||
#define ST7789H2_VCOM_SET 0xBB
|
||||
#define ST7789H2_DISPLAY_OFF 0xBD
|
||||
#define ST7789H2_LCM_CTRL 0xC0
|
||||
#define ST7789H2_VDV_VRH_EN 0xC2
|
||||
#define ST7789H2_VDV_SET 0xC4
|
||||
#define ST7789H2_VCOMH_OFFSET_SET 0xC5
|
||||
#define ST7789H2_FR_CTRL 0xC6
|
||||
#define ST7789H2_POWER_CTRL 0xD0
|
||||
#define ST7789H2_PV_GAMMA_CTRL 0xE0
|
||||
#define ST7789H2_NV_GAMMA_CTRL 0xE1
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ST7789H2_Exported_Functions ST7789H2 Exported Functions
|
||||
* @{
|
||||
*/
|
||||
void ST7789H2_Init(void);
|
||||
void ST7789H2_SetOrientation(uint32_t orientation);
|
||||
uint16_t ST7789H2_ReadID(void);
|
||||
void ST7789H2_WriteReg(uint8_t Command, uint8_t *Parameters, uint8_t NbParameters);
|
||||
uint8_t ST7789H2_ReadReg(uint8_t Command);
|
||||
|
||||
void ST7789H2_DisplayOn(void);
|
||||
void ST7789H2_DisplayOff(void);
|
||||
void ST7789H2_SetCursor(uint16_t Xpos, uint16_t Ypos);
|
||||
void ST7789H2_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode);
|
||||
uint16_t ST7789H2_ReadPixel(uint16_t Xpos, uint16_t Ypos);
|
||||
|
||||
void ST7789H2_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
|
||||
void ST7789H2_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
|
||||
void ST7789H2_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
|
||||
void ST7789H2_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata);
|
||||
|
||||
void ST7789H2_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
|
||||
|
||||
|
||||
uint16_t ST7789H2_GetLcdPixelWidth(void);
|
||||
uint16_t ST7789H2_GetLcdPixelHeight(void);
|
||||
|
||||
/* LCD driver structure */
|
||||
extern LCD_DrvTypeDef ST7789H2_drv;
|
||||
|
||||
/* LCD IO functions */
|
||||
extern void LCD_IO_Init(void);
|
||||
extern void LCD_IO_WriteMultipleData(uint16_t *pData, uint32_t Size);
|
||||
extern void LCD_IO_WriteReg(uint8_t Reg);
|
||||
extern void LCD_IO_WriteData(uint16_t RegValue);
|
||||
extern uint16_t LCD_IO_ReadData(void);
|
||||
extern void LCD_IO_Delay(uint32_t delay);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ST7789H2_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,85 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _VL53L0X_API_CALIBRATION_H_
|
||||
#define _VL53L0X_API_CALIBRATION_H_
|
||||
|
||||
#include "vl53l0x_def.h"
|
||||
#include "vl53l0x_platform.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
VL53L0X_Error VL53L0X_perform_xtalk_calibration(VL53L0X_DEV Dev,
|
||||
FixPoint1616_t XTalkCalDistance,
|
||||
FixPoint1616_t *pXTalkCompensationRateMegaCps);
|
||||
|
||||
VL53L0X_Error VL53L0X_perform_offset_calibration(VL53L0X_DEV Dev,
|
||||
FixPoint1616_t CalDistanceMilliMeter,
|
||||
int32_t *pOffsetMicroMeter);
|
||||
|
||||
VL53L0X_Error VL53L0X_set_offset_calibration_data_micro_meter(VL53L0X_DEV Dev,
|
||||
int32_t OffsetCalibrationDataMicroMeter);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_offset_calibration_data_micro_meter(VL53L0X_DEV Dev,
|
||||
int32_t *pOffsetCalibrationDataMicroMeter);
|
||||
|
||||
VL53L0X_Error VL53L0X_apply_offset_adjustment(VL53L0X_DEV Dev);
|
||||
|
||||
VL53L0X_Error VL53L0X_perform_ref_spad_management(VL53L0X_DEV Dev,
|
||||
uint32_t *refSpadCount, uint8_t *isApertureSpads);
|
||||
|
||||
VL53L0X_Error VL53L0X_set_reference_spads(VL53L0X_DEV Dev,
|
||||
uint32_t count, uint8_t isApertureSpads);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_reference_spads(VL53L0X_DEV Dev,
|
||||
uint32_t *pSpadCount, uint8_t *pIsApertureSpads);
|
||||
|
||||
VL53L0X_Error VL53L0X_perform_phase_calibration(VL53L0X_DEV Dev,
|
||||
uint8_t *pPhaseCal, const uint8_t get_data_enable,
|
||||
const uint8_t restore_config);
|
||||
|
||||
VL53L0X_Error VL53L0X_perform_ref_calibration(VL53L0X_DEV Dev,
|
||||
uint8_t *pVhvSettings, uint8_t *pPhaseCal, uint8_t get_data_enable);
|
||||
|
||||
VL53L0X_Error VL53L0X_set_ref_calibration(VL53L0X_DEV Dev,
|
||||
uint8_t VhvSettings, uint8_t PhaseCal);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_ref_calibration(VL53L0X_DEV Dev,
|
||||
uint8_t *pVhvSettings, uint8_t *pPhaseCal);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _VL53L0X_API_CALIBRATION_H_ */
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,108 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _VL53L0X_API_CORE_H_
|
||||
#define _VL53L0X_API_CORE_H_
|
||||
|
||||
#include "vl53l0x_def.h"
|
||||
#include "vl53l0x_platform.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
VL53L0X_Error VL53L0X_reverse_bytes(uint8_t *data, uint32_t size);
|
||||
|
||||
VL53L0X_Error VL53L0X_measurement_poll_for_completion(VL53L0X_DEV Dev);
|
||||
|
||||
uint8_t VL53L0X_encode_vcsel_period(uint8_t vcsel_period_pclks);
|
||||
|
||||
uint8_t VL53L0X_decode_vcsel_period(uint8_t vcsel_period_reg);
|
||||
|
||||
uint32_t VL53L0X_isqrt(uint32_t num);
|
||||
|
||||
uint32_t VL53L0X_quadrature_sum(uint32_t a, uint32_t b);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_info_from_device(VL53L0X_DEV Dev, uint8_t option);
|
||||
|
||||
VL53L0X_Error VL53L0X_set_vcsel_pulse_period(VL53L0X_DEV Dev,
|
||||
VL53L0X_VcselPeriod VcselPeriodType, uint8_t VCSELPulsePeriodPCLK);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_vcsel_pulse_period(VL53L0X_DEV Dev,
|
||||
VL53L0X_VcselPeriod VcselPeriodType, uint8_t *pVCSELPulsePeriodPCLK);
|
||||
|
||||
uint32_t VL53L0X_decode_timeout(uint16_t encoded_timeout);
|
||||
|
||||
VL53L0X_Error get_sequence_step_timeout(VL53L0X_DEV Dev,
|
||||
VL53L0X_SequenceStepId SequenceStepId,
|
||||
uint32_t *pTimeOutMicroSecs);
|
||||
|
||||
VL53L0X_Error set_sequence_step_timeout(VL53L0X_DEV Dev,
|
||||
VL53L0X_SequenceStepId SequenceStepId,
|
||||
uint32_t TimeOutMicroSecs);
|
||||
|
||||
VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV Dev,
|
||||
uint32_t MeasurementTimingBudgetMicroSeconds);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV Dev,
|
||||
uint32_t *pMeasurementTimingBudgetMicroSeconds);
|
||||
|
||||
VL53L0X_Error VL53L0X_load_tuning_settings(VL53L0X_DEV Dev,
|
||||
uint8_t *pTuningSettingBuffer);
|
||||
|
||||
VL53L0X_Error VL53L0X_calc_sigma_estimate(VL53L0X_DEV Dev,
|
||||
VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
|
||||
FixPoint1616_t *pSigmaEstimate, uint32_t *pDmax_mm);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_total_xtalk_rate(VL53L0X_DEV Dev,
|
||||
VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
|
||||
FixPoint1616_t *ptotal_xtalk_rate_mcps);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_total_signal_rate(VL53L0X_DEV Dev,
|
||||
VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
|
||||
FixPoint1616_t *ptotal_signal_rate_mcps);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_pal_range_status(VL53L0X_DEV Dev,
|
||||
uint8_t DeviceRangeStatus,
|
||||
FixPoint1616_t SignalRate,
|
||||
uint16_t EffectiveSpadRtnCount,
|
||||
VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
|
||||
uint8_t *pPalRangeStatus);
|
||||
|
||||
uint32_t VL53L0X_calc_timeout_mclks(VL53L0X_DEV Dev,
|
||||
uint32_t timeout_period_us, uint8_t vcsel_period_pclks);
|
||||
|
||||
uint16_t VL53L0X_encode_timeout(uint32_t timeout_macro_clks);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _VL53L0X_API_CORE_H_ */
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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.
|
||||
******************************************************************************/
|
||||
|
||||
#include "vl53l0x_api.h"
|
||||
#include "vl53l0x_api_core.h"
|
||||
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#define LOG_FUNCTION_START(fmt, ...) \
|
||||
_LOG_FUNCTION_START(TRACE_MODULE_API, fmt, ##__VA_ARGS__)
|
||||
#define LOG_FUNCTION_END(status, ...) \
|
||||
_LOG_FUNCTION_END(TRACE_MODULE_API, status, ##__VA_ARGS__)
|
||||
#define LOG_FUNCTION_END_FMT(status, fmt, ...) \
|
||||
_LOG_FUNCTION_END_FMT(TRACE_MODULE_API, status, fmt, ##__VA_ARGS__)
|
||||
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _VL53L0X_API_RANGING_H_
|
||||
#define _VL53L0X_API_RANGING_H_
|
||||
|
||||
#include "vl53l0x_def.h"
|
||||
#include "vl53l0x_platform.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _VL53L0X_API_RANGING_H_ */
|
||||
|
|
@ -0,0 +1,462 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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.
|
||||
******************************************************************************/
|
||||
|
||||
#include "vl53l0x_api.h"
|
||||
#include "vl53l0x_api_core.h"
|
||||
#include "vl53l0x_api_strings.h"
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#define LOG_FUNCTION_START(fmt, ...) \
|
||||
_LOG_FUNCTION_START(TRACE_MODULE_API, fmt, ##__VA_ARGS__)
|
||||
#define LOG_FUNCTION_END(status, ...) \
|
||||
_LOG_FUNCTION_END(TRACE_MODULE_API, status, ##__VA_ARGS__)
|
||||
#define LOG_FUNCTION_END_FMT(status, fmt, ...) \
|
||||
_LOG_FUNCTION_END_FMT(TRACE_MODULE_API, status, fmt, ##__VA_ARGS__)
|
||||
|
||||
|
||||
VL53L0X_Error VL53L0X_check_part_used(VL53L0X_DEV Dev,
|
||||
uint8_t *Revision,
|
||||
VL53L0X_DeviceInfo_t *pVL53L0X_DeviceInfo)
|
||||
{
|
||||
VL53L0X_Error Status = VL53L0X_ERROR_NONE;
|
||||
uint8_t ModuleIdInt;
|
||||
char *ProductId_tmp;
|
||||
|
||||
LOG_FUNCTION_START("");
|
||||
|
||||
Status = VL53L0X_get_info_from_device(Dev, 2);
|
||||
|
||||
if (Status == VL53L0X_ERROR_NONE) {
|
||||
ModuleIdInt = VL53L0X_GETDEVICESPECIFICPARAMETER(Dev, ModuleId);
|
||||
|
||||
if (ModuleIdInt == 0) {
|
||||
*Revision = 0;
|
||||
VL53L0X_COPYSTRING(pVL53L0X_DeviceInfo->ProductId, "");
|
||||
} else {
|
||||
*Revision = VL53L0X_GETDEVICESPECIFICPARAMETER(Dev, Revision);
|
||||
ProductId_tmp = VL53L0X_GETDEVICESPECIFICPARAMETER(Dev,
|
||||
ProductId);
|
||||
VL53L0X_COPYSTRING(pVL53L0X_DeviceInfo->ProductId, ProductId_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
LOG_FUNCTION_END(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
VL53L0X_Error VL53L0X_get_device_info(VL53L0X_DEV Dev,
|
||||
VL53L0X_DeviceInfo_t *pVL53L0X_DeviceInfo)
|
||||
{
|
||||
VL53L0X_Error Status = VL53L0X_ERROR_NONE;
|
||||
uint8_t revision_id;
|
||||
uint8_t Revision;
|
||||
|
||||
Status = VL53L0X_check_part_used(Dev, &Revision, pVL53L0X_DeviceInfo);
|
||||
|
||||
if (Status == VL53L0X_ERROR_NONE) {
|
||||
if (Revision == 0) {
|
||||
VL53L0X_COPYSTRING(pVL53L0X_DeviceInfo->Name,
|
||||
VL53L0X_STRING_DEVICE_INFO_NAME_TS0);
|
||||
} else if ((Revision <= 34) && (Revision != 32)) {
|
||||
VL53L0X_COPYSTRING(pVL53L0X_DeviceInfo->Name,
|
||||
VL53L0X_STRING_DEVICE_INFO_NAME_TS1);
|
||||
} else if (Revision < 39) {
|
||||
VL53L0X_COPYSTRING(pVL53L0X_DeviceInfo->Name,
|
||||
VL53L0X_STRING_DEVICE_INFO_NAME_TS2);
|
||||
} else {
|
||||
VL53L0X_COPYSTRING(pVL53L0X_DeviceInfo->Name,
|
||||
VL53L0X_STRING_DEVICE_INFO_NAME_ES1);
|
||||
}
|
||||
|
||||
VL53L0X_COPYSTRING(pVL53L0X_DeviceInfo->Type,
|
||||
VL53L0X_STRING_DEVICE_INFO_TYPE);
|
||||
|
||||
}
|
||||
|
||||
if (Status == VL53L0X_ERROR_NONE) {
|
||||
Status = VL53L0X_RdByte(Dev, VL53L0X_REG_IDENTIFICATION_MODEL_ID,
|
||||
&pVL53L0X_DeviceInfo->ProductType);
|
||||
}
|
||||
|
||||
if (Status == VL53L0X_ERROR_NONE) {
|
||||
Status = VL53L0X_RdByte(Dev,
|
||||
VL53L0X_REG_IDENTIFICATION_REVISION_ID,
|
||||
&revision_id);
|
||||
pVL53L0X_DeviceInfo->ProductRevisionMajor = 1;
|
||||
pVL53L0X_DeviceInfo->ProductRevisionMinor =
|
||||
(revision_id & 0xF0) >> 4;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
VL53L0X_Error VL53L0X_get_device_error_string(VL53L0X_DeviceError ErrorCode,
|
||||
char *pDeviceErrorString)
|
||||
{
|
||||
VL53L0X_Error Status = VL53L0X_ERROR_NONE;
|
||||
|
||||
LOG_FUNCTION_START("");
|
||||
|
||||
switch (ErrorCode) {
|
||||
case VL53L0X_DEVICEERROR_NONE:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_NONE);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_VCSELCONTINUITYTESTFAILURE:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_VCSELCONTINUITYTESTFAILURE);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_VCSELWATCHDOGTESTFAILURE:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_VCSELWATCHDOGTESTFAILURE);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_NOVHVVALUEFOUND:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_NOVHVVALUEFOUND);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_MSRCNOTARGET:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_MSRCNOTARGET);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_SNRCHECK:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_SNRCHECK);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_RANGEPHASECHECK:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_RANGEPHASECHECK);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_SIGMATHRESHOLDCHECK:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_SIGMATHRESHOLDCHECK);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_TCC:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_TCC);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_PHASECONSISTENCY:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_PHASECONSISTENCY);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_MINCLIP:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_MINCLIP);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_RANGECOMPLETE:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_RANGECOMPLETE);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_ALGOUNDERFLOW:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_ALGOUNDERFLOW);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_ALGOOVERFLOW:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_ALGOOVERFLOW);
|
||||
break;
|
||||
case VL53L0X_DEVICEERROR_RANGEIGNORETHRESHOLD:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_DEVICEERROR_RANGEIGNORETHRESHOLD);
|
||||
break;
|
||||
|
||||
default:
|
||||
VL53L0X_COPYSTRING(pDeviceErrorString,
|
||||
VL53L0X_STRING_UNKNOW_ERROR_CODE);
|
||||
|
||||
}
|
||||
|
||||
LOG_FUNCTION_END(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VL53L0X_Error VL53L0X_get_range_status_string(uint8_t RangeStatus,
|
||||
char *pRangeStatusString)
|
||||
{
|
||||
VL53L0X_Error Status = VL53L0X_ERROR_NONE;
|
||||
|
||||
LOG_FUNCTION_START("");
|
||||
|
||||
switch (RangeStatus) {
|
||||
case 0:
|
||||
VL53L0X_COPYSTRING(pRangeStatusString,
|
||||
VL53L0X_STRING_RANGESTATUS_RANGEVALID);
|
||||
break;
|
||||
case 1:
|
||||
VL53L0X_COPYSTRING(pRangeStatusString,
|
||||
VL53L0X_STRING_RANGESTATUS_SIGMA);
|
||||
break;
|
||||
case 2:
|
||||
VL53L0X_COPYSTRING(pRangeStatusString,
|
||||
VL53L0X_STRING_RANGESTATUS_SIGNAL);
|
||||
break;
|
||||
case 3:
|
||||
VL53L0X_COPYSTRING(pRangeStatusString,
|
||||
VL53L0X_STRING_RANGESTATUS_MINRANGE);
|
||||
break;
|
||||
case 4:
|
||||
VL53L0X_COPYSTRING(pRangeStatusString,
|
||||
VL53L0X_STRING_RANGESTATUS_PHASE);
|
||||
break;
|
||||
case 5:
|
||||
VL53L0X_COPYSTRING(pRangeStatusString,
|
||||
VL53L0X_STRING_RANGESTATUS_HW);
|
||||
break;
|
||||
|
||||
default: /**/
|
||||
VL53L0X_COPYSTRING(pRangeStatusString,
|
||||
VL53L0X_STRING_RANGESTATUS_NONE);
|
||||
}
|
||||
|
||||
LOG_FUNCTION_END(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VL53L0X_Error VL53L0X_get_pal_error_string(VL53L0X_Error PalErrorCode,
|
||||
char *pPalErrorString)
|
||||
{
|
||||
VL53L0X_Error Status = VL53L0X_ERROR_NONE;
|
||||
|
||||
LOG_FUNCTION_START("");
|
||||
|
||||
switch (PalErrorCode) {
|
||||
case VL53L0X_ERROR_NONE:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_NONE);
|
||||
break;
|
||||
case VL53L0X_ERROR_CALIBRATION_WARNING:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_CALIBRATION_WARNING);
|
||||
break;
|
||||
case VL53L0X_ERROR_MIN_CLIPPED:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_MIN_CLIPPED);
|
||||
break;
|
||||
case VL53L0X_ERROR_UNDEFINED:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_UNDEFINED);
|
||||
break;
|
||||
case VL53L0X_ERROR_INVALID_PARAMS:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_INVALID_PARAMS);
|
||||
break;
|
||||
case VL53L0X_ERROR_NOT_SUPPORTED:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_NOT_SUPPORTED);
|
||||
break;
|
||||
case VL53L0X_ERROR_INTERRUPT_NOT_CLEARED:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_INTERRUPT_NOT_CLEARED);
|
||||
break;
|
||||
case VL53L0X_ERROR_RANGE_ERROR:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_RANGE_ERROR);
|
||||
break;
|
||||
case VL53L0X_ERROR_TIME_OUT:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_TIME_OUT);
|
||||
break;
|
||||
case VL53L0X_ERROR_MODE_NOT_SUPPORTED:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_MODE_NOT_SUPPORTED);
|
||||
break;
|
||||
case VL53L0X_ERROR_BUFFER_TOO_SMALL:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_BUFFER_TOO_SMALL);
|
||||
break;
|
||||
case VL53L0X_ERROR_GPIO_NOT_EXISTING:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_GPIO_NOT_EXISTING);
|
||||
break;
|
||||
case VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED);
|
||||
break;
|
||||
case VL53L0X_ERROR_CONTROL_INTERFACE:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_CONTROL_INTERFACE);
|
||||
break;
|
||||
case VL53L0X_ERROR_INVALID_COMMAND:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_INVALID_COMMAND);
|
||||
break;
|
||||
case VL53L0X_ERROR_DIVISION_BY_ZERO:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_DIVISION_BY_ZERO);
|
||||
break;
|
||||
case VL53L0X_ERROR_REF_SPAD_INIT:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_REF_SPAD_INIT);
|
||||
break;
|
||||
case VL53L0X_ERROR_NOT_IMPLEMENTED:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_ERROR_NOT_IMPLEMENTED);
|
||||
break;
|
||||
|
||||
default:
|
||||
VL53L0X_COPYSTRING(pPalErrorString,
|
||||
VL53L0X_STRING_UNKNOW_ERROR_CODE);
|
||||
}
|
||||
|
||||
LOG_FUNCTION_END(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VL53L0X_Error VL53L0X_get_pal_state_string(VL53L0X_State PalStateCode,
|
||||
char *pPalStateString)
|
||||
{
|
||||
VL53L0X_Error Status = VL53L0X_ERROR_NONE;
|
||||
|
||||
LOG_FUNCTION_START("");
|
||||
|
||||
switch (PalStateCode) {
|
||||
case VL53L0X_STATE_POWERDOWN:
|
||||
VL53L0X_COPYSTRING(pPalStateString,
|
||||
VL53L0X_STRING_STATE_POWERDOWN);
|
||||
break;
|
||||
case VL53L0X_STATE_WAIT_STATICINIT:
|
||||
VL53L0X_COPYSTRING(pPalStateString,
|
||||
VL53L0X_STRING_STATE_WAIT_STATICINIT);
|
||||
break;
|
||||
case VL53L0X_STATE_STANDBY:
|
||||
VL53L0X_COPYSTRING(pPalStateString,
|
||||
VL53L0X_STRING_STATE_STANDBY);
|
||||
break;
|
||||
case VL53L0X_STATE_IDLE:
|
||||
VL53L0X_COPYSTRING(pPalStateString,
|
||||
VL53L0X_STRING_STATE_IDLE);
|
||||
break;
|
||||
case VL53L0X_STATE_RUNNING:
|
||||
VL53L0X_COPYSTRING(pPalStateString,
|
||||
VL53L0X_STRING_STATE_RUNNING);
|
||||
break;
|
||||
case VL53L0X_STATE_UNKNOWN:
|
||||
VL53L0X_COPYSTRING(pPalStateString,
|
||||
VL53L0X_STRING_STATE_UNKNOWN);
|
||||
break;
|
||||
case VL53L0X_STATE_ERROR:
|
||||
VL53L0X_COPYSTRING(pPalStateString,
|
||||
VL53L0X_STRING_STATE_ERROR);
|
||||
break;
|
||||
|
||||
default:
|
||||
VL53L0X_COPYSTRING(pPalStateString,
|
||||
VL53L0X_STRING_STATE_UNKNOWN);
|
||||
}
|
||||
|
||||
LOG_FUNCTION_END(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VL53L0X_Error VL53L0X_get_sequence_steps_info(
|
||||
VL53L0X_SequenceStepId SequenceStepId,
|
||||
char *pSequenceStepsString)
|
||||
{
|
||||
VL53L0X_Error Status = VL53L0X_ERROR_NONE;
|
||||
LOG_FUNCTION_START("");
|
||||
|
||||
switch (SequenceStepId) {
|
||||
case VL53L0X_SEQUENCESTEP_TCC:
|
||||
VL53L0X_COPYSTRING(pSequenceStepsString,
|
||||
VL53L0X_STRING_SEQUENCESTEP_TCC);
|
||||
break;
|
||||
case VL53L0X_SEQUENCESTEP_DSS:
|
||||
VL53L0X_COPYSTRING(pSequenceStepsString,
|
||||
VL53L0X_STRING_SEQUENCESTEP_DSS);
|
||||
break;
|
||||
case VL53L0X_SEQUENCESTEP_MSRC:
|
||||
VL53L0X_COPYSTRING(pSequenceStepsString,
|
||||
VL53L0X_STRING_SEQUENCESTEP_MSRC);
|
||||
break;
|
||||
case VL53L0X_SEQUENCESTEP_PRE_RANGE:
|
||||
VL53L0X_COPYSTRING(pSequenceStepsString,
|
||||
VL53L0X_STRING_SEQUENCESTEP_PRE_RANGE);
|
||||
break;
|
||||
case VL53L0X_SEQUENCESTEP_FINAL_RANGE:
|
||||
VL53L0X_COPYSTRING(pSequenceStepsString,
|
||||
VL53L0X_STRING_SEQUENCESTEP_FINAL_RANGE);
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = VL53L0X_ERROR_INVALID_PARAMS;
|
||||
}
|
||||
|
||||
LOG_FUNCTION_END(Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
VL53L0X_Error VL53L0X_get_limit_check_info(VL53L0X_DEV Dev, uint16_t LimitCheckId,
|
||||
char *pLimitCheckString)
|
||||
{
|
||||
VL53L0X_Error Status = VL53L0X_ERROR_NONE;
|
||||
|
||||
LOG_FUNCTION_START("");
|
||||
|
||||
switch (LimitCheckId) {
|
||||
case VL53L0X_CHECKENABLE_SIGMA_FINAL_RANGE:
|
||||
VL53L0X_COPYSTRING(pLimitCheckString,
|
||||
VL53L0X_STRING_CHECKENABLE_SIGMA_FINAL_RANGE);
|
||||
break;
|
||||
case VL53L0X_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE:
|
||||
VL53L0X_COPYSTRING(pLimitCheckString,
|
||||
VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE);
|
||||
break;
|
||||
case VL53L0X_CHECKENABLE_SIGNAL_REF_CLIP:
|
||||
VL53L0X_COPYSTRING(pLimitCheckString,
|
||||
VL53L0X_STRING_CHECKENABLE_SIGNAL_REF_CLIP);
|
||||
break;
|
||||
case VL53L0X_CHECKENABLE_RANGE_IGNORE_THRESHOLD:
|
||||
VL53L0X_COPYSTRING(pLimitCheckString,
|
||||
VL53L0X_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD);
|
||||
break;
|
||||
|
||||
case VL53L0X_CHECKENABLE_SIGNAL_RATE_MSRC:
|
||||
VL53L0X_COPYSTRING(pLimitCheckString,
|
||||
VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_MSRC);
|
||||
break;
|
||||
|
||||
case VL53L0X_CHECKENABLE_SIGNAL_RATE_PRE_RANGE:
|
||||
VL53L0X_COPYSTRING(pLimitCheckString,
|
||||
VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_PRE_RANGE);
|
||||
break;
|
||||
|
||||
default:
|
||||
VL53L0X_COPYSTRING(pLimitCheckString,
|
||||
VL53L0X_STRING_UNKNOW_ERROR_CODE);
|
||||
|
||||
}
|
||||
|
||||
LOG_FUNCTION_END(Status);
|
||||
return Status;
|
||||
}
|
||||
|
|
@ -0,0 +1,277 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef VL53L0X_API_STRINGS_H_
|
||||
#define VL53L0X_API_STRINGS_H_
|
||||
|
||||
#include "vl53l0x_def.h"
|
||||
#include "vl53l0x_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
VL53L0X_Error VL53L0X_get_device_info(VL53L0X_DEV Dev,
|
||||
VL53L0X_DeviceInfo_t *pVL53L0X_DeviceInfo);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_device_error_string(VL53L0X_DeviceError ErrorCode,
|
||||
char *pDeviceErrorString);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_range_status_string(uint8_t RangeStatus,
|
||||
char *pRangeStatusString);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_pal_error_string(VL53L0X_Error PalErrorCode,
|
||||
char *pPalErrorString);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_pal_state_string(VL53L0X_State PalStateCode,
|
||||
char *pPalStateString);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_sequence_steps_info(
|
||||
VL53L0X_SequenceStepId SequenceStepId,
|
||||
char *pSequenceStepsString);
|
||||
|
||||
VL53L0X_Error VL53L0X_get_limit_check_info(VL53L0X_DEV Dev, uint16_t LimitCheckId,
|
||||
char *pLimitCheckString);
|
||||
|
||||
|
||||
#ifdef USE_EMPTY_STRING
|
||||
#define VL53L0X_STRING_DEVICE_INFO_NAME ""
|
||||
#define VL53L0X_STRING_DEVICE_INFO_NAME_TS0 ""
|
||||
#define VL53L0X_STRING_DEVICE_INFO_NAME_TS1 ""
|
||||
#define VL53L0X_STRING_DEVICE_INFO_NAME_TS2 ""
|
||||
#define VL53L0X_STRING_DEVICE_INFO_NAME_ES1 ""
|
||||
#define VL53L0X_STRING_DEVICE_INFO_TYPE ""
|
||||
|
||||
/* PAL ERROR strings */
|
||||
#define VL53L0X_STRING_ERROR_NONE ""
|
||||
#define VL53L0X_STRING_ERROR_CALIBRATION_WARNING ""
|
||||
#define VL53L0X_STRING_ERROR_MIN_CLIPPED ""
|
||||
#define VL53L0X_STRING_ERROR_UNDEFINED ""
|
||||
#define VL53L0X_STRING_ERROR_INVALID_PARAMS ""
|
||||
#define VL53L0X_STRING_ERROR_NOT_SUPPORTED ""
|
||||
#define VL53L0X_STRING_ERROR_RANGE_ERROR ""
|
||||
#define VL53L0X_STRING_ERROR_TIME_OUT ""
|
||||
#define VL53L0X_STRING_ERROR_MODE_NOT_SUPPORTED ""
|
||||
#define VL53L0X_STRING_ERROR_BUFFER_TOO_SMALL ""
|
||||
#define VL53L0X_STRING_ERROR_GPIO_NOT_EXISTING ""
|
||||
#define VL53L0X_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED ""
|
||||
#define VL53L0X_STRING_ERROR_CONTROL_INTERFACE ""
|
||||
#define VL53L0X_STRING_ERROR_INVALID_COMMAND ""
|
||||
#define VL53L0X_STRING_ERROR_DIVISION_BY_ZERO ""
|
||||
#define VL53L0X_STRING_ERROR_REF_SPAD_INIT ""
|
||||
#define VL53L0X_STRING_ERROR_NOT_IMPLEMENTED ""
|
||||
|
||||
#define VL53L0X_STRING_UNKNOW_ERROR_CODE ""
|
||||
|
||||
|
||||
|
||||
/* Range Status */
|
||||
#define VL53L0X_STRING_RANGESTATUS_NONE ""
|
||||
#define VL53L0X_STRING_RANGESTATUS_RANGEVALID ""
|
||||
#define VL53L0X_STRING_RANGESTATUS_SIGMA ""
|
||||
#define VL53L0X_STRING_RANGESTATUS_SIGNAL ""
|
||||
#define VL53L0X_STRING_RANGESTATUS_MINRANGE ""
|
||||
#define VL53L0X_STRING_RANGESTATUS_PHASE ""
|
||||
#define VL53L0X_STRING_RANGESTATUS_HW ""
|
||||
|
||||
|
||||
/* Range Status */
|
||||
#define VL53L0X_STRING_STATE_POWERDOWN ""
|
||||
#define VL53L0X_STRING_STATE_WAIT_STATICINIT ""
|
||||
#define VL53L0X_STRING_STATE_STANDBY ""
|
||||
#define VL53L0X_STRING_STATE_IDLE ""
|
||||
#define VL53L0X_STRING_STATE_RUNNING ""
|
||||
#define VL53L0X_STRING_STATE_UNKNOWN ""
|
||||
#define VL53L0X_STRING_STATE_ERROR ""
|
||||
|
||||
|
||||
/* Device Specific */
|
||||
#define VL53L0X_STRING_DEVICEERROR_NONE ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_VCSELCONTINUITYTESTFAILURE ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_VCSELWATCHDOGTESTFAILURE ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_NOVHVVALUEFOUND ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_MSRCNOTARGET ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_SNRCHECK ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_RANGEPHASECHECK ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_SIGMATHRESHOLDCHECK ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_TCC ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_PHASECONSISTENCY ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_MINCLIP ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_RANGECOMPLETE ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_ALGOUNDERFLOW ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_ALGOOVERFLOW ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_RANGEIGNORETHRESHOLD ""
|
||||
#define VL53L0X_STRING_DEVICEERROR_UNKNOWN ""
|
||||
|
||||
/* Check Enable */
|
||||
#define VL53L0X_STRING_CHECKENABLE_SIGMA_FINAL_RANGE ""
|
||||
#define VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE ""
|
||||
#define VL53L0X_STRING_CHECKENABLE_SIGNAL_REF_CLIP ""
|
||||
#define VL53L0X_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD ""
|
||||
|
||||
/* Sequence Step */
|
||||
#define VL53L0X_STRING_SEQUENCESTEP_TCC ""
|
||||
#define VL53L0X_STRING_SEQUENCESTEP_DSS ""
|
||||
#define VL53L0X_STRING_SEQUENCESTEP_MSRC ""
|
||||
#define VL53L0X_STRING_SEQUENCESTEP_PRE_RANGE ""
|
||||
#define VL53L0X_STRING_SEQUENCESTEP_FINAL_RANGE ""
|
||||
#else
|
||||
#define VL53L0X_STRING_DEVICE_INFO_NAME "VL53L0X cut1.0"
|
||||
#define VL53L0X_STRING_DEVICE_INFO_NAME_TS0 "VL53L0X TS0"
|
||||
#define VL53L0X_STRING_DEVICE_INFO_NAME_TS1 "VL53L0X TS1"
|
||||
#define VL53L0X_STRING_DEVICE_INFO_NAME_TS2 "VL53L0X TS2"
|
||||
#define VL53L0X_STRING_DEVICE_INFO_NAME_ES1 "VL53L0X ES1 or later"
|
||||
#define VL53L0X_STRING_DEVICE_INFO_TYPE "VL53L0X"
|
||||
|
||||
/* PAL ERROR strings */
|
||||
#define VL53L0X_STRING_ERROR_NONE \
|
||||
"No Error"
|
||||
#define VL53L0X_STRING_ERROR_CALIBRATION_WARNING \
|
||||
"Calibration Warning Error"
|
||||
#define VL53L0X_STRING_ERROR_MIN_CLIPPED \
|
||||
"Min clipped error"
|
||||
#define VL53L0X_STRING_ERROR_UNDEFINED \
|
||||
"Undefined error"
|
||||
#define VL53L0X_STRING_ERROR_INVALID_PARAMS \
|
||||
"Invalid parameters error"
|
||||
#define VL53L0X_STRING_ERROR_NOT_SUPPORTED \
|
||||
"Not supported error"
|
||||
#define VL53L0X_STRING_ERROR_RANGE_ERROR \
|
||||
"Range error"
|
||||
#define VL53L0X_STRING_ERROR_TIME_OUT \
|
||||
"Time out error"
|
||||
#define VL53L0X_STRING_ERROR_MODE_NOT_SUPPORTED \
|
||||
"Mode not supported error"
|
||||
#define VL53L0X_STRING_ERROR_BUFFER_TOO_SMALL \
|
||||
"Buffer too small"
|
||||
#define VL53L0X_STRING_ERROR_GPIO_NOT_EXISTING \
|
||||
"GPIO not existing"
|
||||
#define VL53L0X_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED \
|
||||
"GPIO funct not supported"
|
||||
#define VL53L0X_STRING_ERROR_INTERRUPT_NOT_CLEARED \
|
||||
"Interrupt not Cleared"
|
||||
#define VL53L0X_STRING_ERROR_CONTROL_INTERFACE \
|
||||
"Control Interface Error"
|
||||
#define VL53L0X_STRING_ERROR_INVALID_COMMAND \
|
||||
"Invalid Command Error"
|
||||
#define VL53L0X_STRING_ERROR_DIVISION_BY_ZERO \
|
||||
"Division by zero Error"
|
||||
#define VL53L0X_STRING_ERROR_REF_SPAD_INIT \
|
||||
"Reference Spad Init Error"
|
||||
#define VL53L0X_STRING_ERROR_NOT_IMPLEMENTED \
|
||||
"Not implemented error"
|
||||
|
||||
#define VL53L0X_STRING_UNKNOW_ERROR_CODE \
|
||||
"Unknown Error Code"
|
||||
|
||||
|
||||
|
||||
/* Range Status */
|
||||
#define VL53L0X_STRING_RANGESTATUS_NONE "No Update"
|
||||
#define VL53L0X_STRING_RANGESTATUS_RANGEVALID "Range Valid"
|
||||
#define VL53L0X_STRING_RANGESTATUS_SIGMA "Sigma Fail"
|
||||
#define VL53L0X_STRING_RANGESTATUS_SIGNAL "Signal Fail"
|
||||
#define VL53L0X_STRING_RANGESTATUS_MINRANGE "Min Range Fail"
|
||||
#define VL53L0X_STRING_RANGESTATUS_PHASE "Phase Fail"
|
||||
#define VL53L0X_STRING_RANGESTATUS_HW "Hardware Fail"
|
||||
|
||||
|
||||
/* Range Status */
|
||||
#define VL53L0X_STRING_STATE_POWERDOWN "POWERDOWN State"
|
||||
#define VL53L0X_STRING_STATE_WAIT_STATICINIT \
|
||||
"Wait for staticinit State"
|
||||
#define VL53L0X_STRING_STATE_STANDBY "STANDBY State"
|
||||
#define VL53L0X_STRING_STATE_IDLE "IDLE State"
|
||||
#define VL53L0X_STRING_STATE_RUNNING "RUNNING State"
|
||||
#define VL53L0X_STRING_STATE_UNKNOWN "UNKNOWN State"
|
||||
#define VL53L0X_STRING_STATE_ERROR "ERROR State"
|
||||
|
||||
|
||||
/* Device Specific */
|
||||
#define VL53L0X_STRING_DEVICEERROR_NONE "No Update"
|
||||
#define VL53L0X_STRING_DEVICEERROR_VCSELCONTINUITYTESTFAILURE \
|
||||
"VCSEL Continuity Test Failure"
|
||||
#define VL53L0X_STRING_DEVICEERROR_VCSELWATCHDOGTESTFAILURE \
|
||||
"VCSEL Watchdog Test Failure"
|
||||
#define VL53L0X_STRING_DEVICEERROR_NOVHVVALUEFOUND \
|
||||
"No VHV Value found"
|
||||
#define VL53L0X_STRING_DEVICEERROR_MSRCNOTARGET \
|
||||
"MSRC No Target Error"
|
||||
#define VL53L0X_STRING_DEVICEERROR_SNRCHECK \
|
||||
"SNR Check Exit"
|
||||
#define VL53L0X_STRING_DEVICEERROR_RANGEPHASECHECK \
|
||||
"Range Phase Check Error"
|
||||
#define VL53L0X_STRING_DEVICEERROR_SIGMATHRESHOLDCHECK \
|
||||
"Sigma Threshold Check Error"
|
||||
#define VL53L0X_STRING_DEVICEERROR_TCC \
|
||||
"TCC Error"
|
||||
#define VL53L0X_STRING_DEVICEERROR_PHASECONSISTENCY \
|
||||
"Phase Consistency Error"
|
||||
#define VL53L0X_STRING_DEVICEERROR_MINCLIP \
|
||||
"Min Clip Error"
|
||||
#define VL53L0X_STRING_DEVICEERROR_RANGECOMPLETE \
|
||||
"Range Complete"
|
||||
#define VL53L0X_STRING_DEVICEERROR_ALGOUNDERFLOW \
|
||||
"Range Algo Underflow Error"
|
||||
#define VL53L0X_STRING_DEVICEERROR_ALGOOVERFLOW \
|
||||
"Range Algo Overlow Error"
|
||||
#define VL53L0X_STRING_DEVICEERROR_RANGEIGNORETHRESHOLD \
|
||||
"Range Ignore Threshold Error"
|
||||
#define VL53L0X_STRING_DEVICEERROR_UNKNOWN \
|
||||
"Unknown error code"
|
||||
|
||||
/* Check Enable */
|
||||
#define VL53L0X_STRING_CHECKENABLE_SIGMA_FINAL_RANGE \
|
||||
"SIGMA FINAL RANGE"
|
||||
#define VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE \
|
||||
"SIGNAL RATE FINAL RANGE"
|
||||
#define VL53L0X_STRING_CHECKENABLE_SIGNAL_REF_CLIP \
|
||||
"SIGNAL REF CLIP"
|
||||
#define VL53L0X_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD \
|
||||
"RANGE IGNORE THRESHOLD"
|
||||
#define VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_MSRC \
|
||||
"SIGNAL RATE MSRC"
|
||||
#define VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_PRE_RANGE \
|
||||
"SIGNAL RATE PRE RANGE"
|
||||
|
||||
/* Sequence Step */
|
||||
#define VL53L0X_STRING_SEQUENCESTEP_TCC "TCC"
|
||||
#define VL53L0X_STRING_SEQUENCESTEP_DSS "DSS"
|
||||
#define VL53L0X_STRING_SEQUENCESTEP_MSRC "MSRC"
|
||||
#define VL53L0X_STRING_SEQUENCESTEP_PRE_RANGE "PRE RANGE"
|
||||
#define VL53L0X_STRING_SEQUENCESTEP_FINAL_RANGE "FINAL RANGE"
|
||||
#endif /* USE_EMPTY_STRING */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,638 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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 VL53L0X_def.h
|
||||
*
|
||||
* @brief Type definitions for VL53L0X API.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _VL53L0X_DEF_H_
|
||||
#define _VL53L0X_DEF_H_
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @defgroup VL53L0X_globaldefine_group VL53L0X Defines
|
||||
* @brief VL53L0X Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** PAL SPECIFICATION major version */
|
||||
#define VL53L0X10_SPECIFICATION_VER_MAJOR 1
|
||||
/** PAL SPECIFICATION minor version */
|
||||
#define VL53L0X10_SPECIFICATION_VER_MINOR 2
|
||||
/** PAL SPECIFICATION sub version */
|
||||
#define VL53L0X10_SPECIFICATION_VER_SUB 7
|
||||
/** PAL SPECIFICATION sub version */
|
||||
#define VL53L0X10_SPECIFICATION_VER_REVISION 1440
|
||||
|
||||
/** VL53L0X PAL IMPLEMENTATION major version */
|
||||
#define VL53L0X10_IMPLEMENTATION_VER_MAJOR 1
|
||||
/** VL53L0X PAL IMPLEMENTATION minor version */
|
||||
#define VL53L0X10_IMPLEMENTATION_VER_MINOR 0
|
||||
/** VL53L0X PAL IMPLEMENTATION sub version */
|
||||
#define VL53L0X10_IMPLEMENTATION_VER_SUB 9
|
||||
/** VL53L0X PAL IMPLEMENTATION sub version */
|
||||
#define VL53L0X10_IMPLEMENTATION_VER_REVISION 3673
|
||||
|
||||
/** PAL SPECIFICATION major version */
|
||||
#define VL53L0X_SPECIFICATION_VER_MAJOR 1
|
||||
/** PAL SPECIFICATION minor version */
|
||||
#define VL53L0X_SPECIFICATION_VER_MINOR 2
|
||||
/** PAL SPECIFICATION sub version */
|
||||
#define VL53L0X_SPECIFICATION_VER_SUB 7
|
||||
/** PAL SPECIFICATION sub version */
|
||||
#define VL53L0X_SPECIFICATION_VER_REVISION 1440
|
||||
|
||||
/** VL53L0X PAL IMPLEMENTATION major version */
|
||||
#define VL53L0X_IMPLEMENTATION_VER_MAJOR 1
|
||||
/** VL53L0X PAL IMPLEMENTATION minor version */
|
||||
#define VL53L0X_IMPLEMENTATION_VER_MINOR 0
|
||||
/** VL53L0X PAL IMPLEMENTATION sub version */
|
||||
#define VL53L0X_IMPLEMENTATION_VER_SUB 0
|
||||
/** VL53L0X PAL IMPLEMENTATION sub version */
|
||||
#define VL53L0X_IMPLEMENTATION_VER_REVISION 4570
|
||||
#define VL53L0X_DEFAULT_MAX_LOOP 200
|
||||
#define VL53L0X_MAX_STRING_LENGTH 32
|
||||
|
||||
|
||||
#include "vl53l0x_device.h"
|
||||
#include "vl53l0x_types.h"
|
||||
|
||||
|
||||
/****************************************
|
||||
* PRIVATE define do not edit
|
||||
****************************************/
|
||||
|
||||
/** @brief Defines the parameters of the Get Version Functions
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t revision; /*!< revision number */
|
||||
uint8_t major; /*!< major number */
|
||||
uint8_t minor; /*!< minor number */
|
||||
uint8_t build; /*!< build number */
|
||||
} VL53L0X_Version_t;
|
||||
|
||||
|
||||
/** @brief Defines the parameters of the Get Device Info Functions
|
||||
*/
|
||||
typedef struct {
|
||||
char Name[VL53L0X_MAX_STRING_LENGTH];
|
||||
/*!< Name of the Device e.g. Left_Distance */
|
||||
char Type[VL53L0X_MAX_STRING_LENGTH];
|
||||
/*!< Type of the Device e.g VL53L0X */
|
||||
char ProductId[VL53L0X_MAX_STRING_LENGTH];
|
||||
/*!< Product Identifier String */
|
||||
uint8_t ProductType;
|
||||
/*!< Product Type, VL53L0X = 1, VL53L1 = 2 */
|
||||
uint8_t ProductRevisionMajor;
|
||||
/*!< Product revision major */
|
||||
uint8_t ProductRevisionMinor;
|
||||
/*!< Product revision minor */
|
||||
} VL53L0X_DeviceInfo_t;
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_define_Error_group Error and Warning code returned by API
|
||||
* The following DEFINE are used to identify the PAL ERROR
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef int8_t VL53L0X_Error;
|
||||
|
||||
#define VL53L0X_ERROR_NONE ((VL53L0X_Error) 0)
|
||||
#define VL53L0X_ERROR_CALIBRATION_WARNING ((VL53L0X_Error) -1)
|
||||
/*!< Warning invalid calibration data may be in used
|
||||
\a VL53L0X_InitData()
|
||||
\a VL53L0X_GetOffsetCalibrationData
|
||||
\a VL53L0X_SetOffsetCalibrationData */
|
||||
#define VL53L0X_ERROR_MIN_CLIPPED ((VL53L0X_Error) -2)
|
||||
/*!< Warning parameter passed was clipped to min before to be applied */
|
||||
|
||||
#define VL53L0X_ERROR_UNDEFINED ((VL53L0X_Error) -3)
|
||||
/*!< Unqualified error */
|
||||
#define VL53L0X_ERROR_INVALID_PARAMS ((VL53L0X_Error) -4)
|
||||
/*!< Parameter passed is invalid or out of range */
|
||||
#define VL53L0X_ERROR_NOT_SUPPORTED ((VL53L0X_Error) -5)
|
||||
/*!< Function is not supported in current mode or configuration */
|
||||
#define VL53L0X_ERROR_RANGE_ERROR ((VL53L0X_Error) -6)
|
||||
/*!< Device report a ranging error interrupt status */
|
||||
#define VL53L0X_ERROR_TIME_OUT ((VL53L0X_Error) -7)
|
||||
/*!< Aborted due to time out */
|
||||
#define VL53L0X_ERROR_MODE_NOT_SUPPORTED ((VL53L0X_Error) -8)
|
||||
/*!< Asked mode is not supported by the device */
|
||||
#define VL53L0X_ERROR_BUFFER_TOO_SMALL ((VL53L0X_Error) -9)
|
||||
/*!< ... */
|
||||
#define VL53L0X_ERROR_GPIO_NOT_EXISTING ((VL53L0X_Error) -10)
|
||||
/*!< User tried to setup a non-existing GPIO pin */
|
||||
#define VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED ((VL53L0X_Error) -11)
|
||||
/*!< unsupported GPIO functionality */
|
||||
#define VL53L0X_ERROR_INTERRUPT_NOT_CLEARED ((VL53L0X_Error) -12)
|
||||
/*!< Error during interrupt clear */
|
||||
#define VL53L0X_ERROR_CONTROL_INTERFACE ((VL53L0X_Error) -20)
|
||||
/*!< error reported from IO functions */
|
||||
#define VL53L0X_ERROR_INVALID_COMMAND ((VL53L0X_Error) -30)
|
||||
/*!< The command is not allowed in the current device state
|
||||
* (power down) */
|
||||
#define VL53L0X_ERROR_DIVISION_BY_ZERO ((VL53L0X_Error) -40)
|
||||
/*!< In the function a division by zero occurs */
|
||||
#define VL53L0X_ERROR_REF_SPAD_INIT ((VL53L0X_Error) -50)
|
||||
/*!< Error during reference SPAD initialization */
|
||||
#define VL53L0X_ERROR_NOT_IMPLEMENTED ((VL53L0X_Error) -99)
|
||||
/*!< Tells requested functionality has not been implemented yet or
|
||||
* not compatible with the device */
|
||||
/** @} VL53L0X_define_Error_group */
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_define_DeviceModes_group Defines Device modes
|
||||
* Defines all possible modes for the device
|
||||
* @{
|
||||
*/
|
||||
typedef uint8_t VL53L0X_DeviceModes;
|
||||
|
||||
#define VL53L0X_DEVICEMODE_SINGLE_RANGING ((VL53L0X_DeviceModes) 0)
|
||||
#define VL53L0X_DEVICEMODE_CONTINUOUS_RANGING ((VL53L0X_DeviceModes) 1)
|
||||
#define VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM ((VL53L0X_DeviceModes) 2)
|
||||
#define VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING ((VL53L0X_DeviceModes) 3)
|
||||
#define VL53L0X_DEVICEMODE_SINGLE_ALS ((VL53L0X_DeviceModes) 10)
|
||||
#define VL53L0X_DEVICEMODE_GPIO_DRIVE ((VL53L0X_DeviceModes) 20)
|
||||
#define VL53L0X_DEVICEMODE_GPIO_OSC ((VL53L0X_DeviceModes) 21)
|
||||
/* ... Modes to be added depending on device */
|
||||
/** @} VL53L0X_define_DeviceModes_group */
|
||||
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_define_HistogramModes_group Defines Histogram modes
|
||||
* Defines all possible Histogram modes for the device
|
||||
* @{
|
||||
*/
|
||||
typedef uint8_t VL53L0X_HistogramModes;
|
||||
|
||||
#define VL53L0X_HISTOGRAMMODE_DISABLED ((VL53L0X_HistogramModes) 0)
|
||||
/*!< Histogram Disabled */
|
||||
#define VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY ((VL53L0X_HistogramModes) 1)
|
||||
/*!< Histogram Reference array only */
|
||||
#define VL53L0X_HISTOGRAMMODE_RETURN_ONLY ((VL53L0X_HistogramModes) 2)
|
||||
/*!< Histogram Return array only */
|
||||
#define VL53L0X_HISTOGRAMMODE_BOTH ((VL53L0X_HistogramModes) 3)
|
||||
/*!< Histogram both Reference and Return Arrays */
|
||||
/* ... Modes to be added depending on device */
|
||||
/** @} VL53L0X_define_HistogramModes_group */
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_define_PowerModes_group List of available Power Modes
|
||||
* List of available Power Modes
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef uint8_t VL53L0X_PowerModes;
|
||||
|
||||
#define VL53L0X_POWERMODE_STANDBY_LEVEL1 ((VL53L0X_PowerModes) 0)
|
||||
/*!< Standby level 1 */
|
||||
#define VL53L0X_POWERMODE_STANDBY_LEVEL2 ((VL53L0X_PowerModes) 1)
|
||||
/*!< Standby level 2 */
|
||||
#define VL53L0X_POWERMODE_IDLE_LEVEL1 ((VL53L0X_PowerModes) 2)
|
||||
/*!< Idle level 1 */
|
||||
#define VL53L0X_POWERMODE_IDLE_LEVEL2 ((VL53L0X_PowerModes) 3)
|
||||
/*!< Idle level 2 */
|
||||
|
||||
/** @} VL53L0X_define_PowerModes_group */
|
||||
|
||||
|
||||
/** @brief Defines all parameters for the device
|
||||
*/
|
||||
typedef struct {
|
||||
VL53L0X_DeviceModes DeviceMode;
|
||||
/*!< Defines type of measurement to be done for the next measure */
|
||||
VL53L0X_HistogramModes HistogramMode;
|
||||
/*!< Defines type of histogram measurement to be done for the next
|
||||
* measure */
|
||||
uint32_t MeasurementTimingBudgetMicroSeconds;
|
||||
/*!< Defines the allowed total time for a single measurement */
|
||||
uint32_t InterMeasurementPeriodMilliSeconds;
|
||||
/*!< Defines time between two consecutive measurements (between two
|
||||
* measurement starts). If set to 0 means back-to-back mode */
|
||||
uint8_t XTalkCompensationEnable;
|
||||
/*!< Tells if Crosstalk compensation shall be enable or not */
|
||||
uint16_t XTalkCompensationRangeMilliMeter;
|
||||
/*!< CrossTalk compensation range in millimeter */
|
||||
FixPoint1616_t XTalkCompensationRateMegaCps;
|
||||
/*!< CrossTalk compensation rate in Mega counts per seconds.
|
||||
* Expressed in 16.16 fixed point format. */
|
||||
int32_t RangeOffsetMicroMeters;
|
||||
/*!< Range offset adjustment (mm). */
|
||||
|
||||
uint8_t LimitChecksEnable[VL53L0X_CHECKENABLE_NUMBER_OF_CHECKS];
|
||||
/*!< This Array store all the Limit Check enable for this device. */
|
||||
uint8_t LimitChecksStatus[VL53L0X_CHECKENABLE_NUMBER_OF_CHECKS];
|
||||
/*!< This Array store all the Status of the check linked to last
|
||||
* measurement. */
|
||||
FixPoint1616_t LimitChecksValue[VL53L0X_CHECKENABLE_NUMBER_OF_CHECKS];
|
||||
/*!< This Array store all the Limit Check value for this device */
|
||||
|
||||
uint8_t WrapAroundCheckEnable;
|
||||
/*!< Tells if Wrap Around Check shall be enable or not */
|
||||
} VL53L0X_DeviceParameters_t;
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_define_State_group Defines the current status of the device
|
||||
* Defines the current status of the device
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef uint8_t VL53L0X_State;
|
||||
|
||||
#define VL53L0X_STATE_POWERDOWN ((VL53L0X_State) 0)
|
||||
/*!< Device is in HW reset */
|
||||
#define VL53L0X_STATE_WAIT_STATICINIT ((VL53L0X_State) 1)
|
||||
/*!< Device is initialized and wait for static initialization */
|
||||
#define VL53L0X_STATE_STANDBY ((VL53L0X_State) 2)
|
||||
/*!< Device is in Low power Standby mode */
|
||||
#define VL53L0X_STATE_IDLE ((VL53L0X_State) 3)
|
||||
/*!< Device has been initialized and ready to do measurements */
|
||||
#define VL53L0X_STATE_RUNNING ((VL53L0X_State) 4)
|
||||
/*!< Device is performing measurement */
|
||||
#define VL53L0X_STATE_UNKNOWN ((VL53L0X_State) 98)
|
||||
/*!< Device is in unknown state and need to be rebooted */
|
||||
#define VL53L0X_STATE_ERROR ((VL53L0X_State) 99)
|
||||
/*!< Device is in error state and need to be rebooted */
|
||||
|
||||
/** @} VL53L0X_define_State_group */
|
||||
|
||||
|
||||
/** @brief Structure containing the Dmax computation parameters and data
|
||||
*/
|
||||
typedef struct {
|
||||
int32_t AmbTuningWindowFactor_K;
|
||||
/*!< internal algo tuning (*1000) */
|
||||
int32_t RetSignalAt0mm;
|
||||
/*!< intermediate dmax computation value caching */
|
||||
} VL53L0X_DMaxData_t;
|
||||
|
||||
/**
|
||||
* @struct VL53L0X_RangeData_t
|
||||
* @brief Range measurement data.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t TimeStamp; /*!< 32-bit time stamp. */
|
||||
uint32_t MeasurementTimeUsec;
|
||||
/*!< Give the Measurement time needed by the device to do the
|
||||
* measurement.*/
|
||||
|
||||
|
||||
uint16_t RangeMilliMeter; /*!< range distance in millimeter. */
|
||||
|
||||
uint16_t RangeDMaxMilliMeter;
|
||||
/*!< Tells what is the maximum detection distance of the device
|
||||
* in current setup and environment conditions (Filled when
|
||||
* applicable) */
|
||||
|
||||
FixPoint1616_t SignalRateRtnMegaCps;
|
||||
/*!< Return signal rate (MCPS)\n these is a 16.16 fix point
|
||||
* value, which is effectively a measure of target
|
||||
* reflectance.*/
|
||||
FixPoint1616_t AmbientRateRtnMegaCps;
|
||||
/*!< Return ambient rate (MCPS)\n these is a 16.16 fix point
|
||||
* value, which is effectively a measure of the ambien
|
||||
* t light.*/
|
||||
|
||||
uint16_t EffectiveSpadRtnCount;
|
||||
/*!< Return the effective SPAD count for the return signal.
|
||||
* To obtain Real value it should be divided by 256 */
|
||||
|
||||
uint8_t ZoneId;
|
||||
/*!< Denotes which zone and range scheduler stage the range
|
||||
* data relates to. */
|
||||
uint8_t RangeFractionalPart;
|
||||
/*!< Fractional part of range distance. Final value is a
|
||||
* FixPoint168 value. */
|
||||
uint8_t RangeStatus;
|
||||
/*!< Range Status for the current measurement. This is device
|
||||
* dependent. Value = 0 means value is valid.
|
||||
* See \ref RangeStatusPage */
|
||||
} VL53L0X_RangingMeasurementData_t;
|
||||
|
||||
|
||||
#define VL53L0X_HISTOGRAM_BUFFER_SIZE 24
|
||||
|
||||
/**
|
||||
* @struct VL53L0X_HistogramData_t
|
||||
* @brief Histogram measurement data.
|
||||
*/
|
||||
typedef struct {
|
||||
/* Histogram Measurement data */
|
||||
uint32_t HistogramData[VL53L0X_HISTOGRAM_BUFFER_SIZE];
|
||||
/*!< Histogram data */
|
||||
uint8_t HistogramType; /*!< Indicate the types of histogram data :
|
||||
Return only, Reference only, both Return and Reference */
|
||||
uint8_t FirstBin; /*!< First Bin value */
|
||||
uint8_t BufferSize; /*!< Buffer Size - Set by the user.*/
|
||||
uint8_t NumberOfBins;
|
||||
/*!< Number of bins filled by the histogram measurement */
|
||||
|
||||
VL53L0X_DeviceError ErrorStatus;
|
||||
/*!< Error status of the current measurement. \n
|
||||
see @a ::VL53L0X_DeviceError @a VL53L0X_GetStatusErrorString() */
|
||||
} VL53L0X_HistogramMeasurementData_t;
|
||||
|
||||
#define VL53L0X_REF_SPAD_BUFFER_SIZE 6
|
||||
|
||||
/**
|
||||
* @struct VL53L0X_SpadData_t
|
||||
* @brief Spad Configuration Data.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t RefSpadEnables[VL53L0X_REF_SPAD_BUFFER_SIZE];
|
||||
/*!< Reference Spad Enables */
|
||||
uint8_t RefGoodSpadMap[VL53L0X_REF_SPAD_BUFFER_SIZE];
|
||||
/*!< Reference Spad Good Spad Map */
|
||||
} VL53L0X_SpadData_t;
|
||||
|
||||
typedef struct {
|
||||
FixPoint1616_t OscFrequencyMHz; /* Frequency used */
|
||||
|
||||
uint16_t LastEncodedTimeout;
|
||||
/* last encoded Time out used for timing budget*/
|
||||
|
||||
VL53L0X_GpioFunctionality Pin0GpioFunctionality;
|
||||
/* store the functionality of the GPIO: pin0 */
|
||||
|
||||
uint32_t FinalRangeTimeoutMicroSecs;
|
||||
/*!< Execution time of the final range*/
|
||||
uint8_t FinalRangeVcselPulsePeriod;
|
||||
/*!< Vcsel pulse period (pll clocks) for the final range measurement*/
|
||||
uint32_t PreRangeTimeoutMicroSecs;
|
||||
/*!< Execution time of the final range*/
|
||||
uint8_t PreRangeVcselPulsePeriod;
|
||||
/*!< Vcsel pulse period (pll clocks) for the pre-range measurement*/
|
||||
|
||||
uint16_t SigmaEstRefArray;
|
||||
/*!< Reference array sigma value in 1/100th of [mm] e.g. 100 = 1mm */
|
||||
uint16_t SigmaEstEffPulseWidth;
|
||||
/*!< Effective Pulse width for sigma estimate in 1/100th
|
||||
* of ns e.g. 900 = 9.0ns */
|
||||
uint16_t SigmaEstEffAmbWidth;
|
||||
/*!< Effective Ambient width for sigma estimate in 1/100th of ns
|
||||
* e.g. 500 = 5.0ns */
|
||||
|
||||
|
||||
uint8_t ReadDataFromDeviceDone; /* Indicate if read from device has
|
||||
been done (==1) or not (==0) */
|
||||
uint8_t ModuleId; /* Module ID */
|
||||
uint8_t Revision; /* test Revision */
|
||||
char ProductId[VL53L0X_MAX_STRING_LENGTH];
|
||||
/* Product Identifier String */
|
||||
uint8_t ReferenceSpadCount; /* used for ref spad management */
|
||||
uint8_t ReferenceSpadType; /* used for ref spad management */
|
||||
uint8_t RefSpadsInitialised; /* reports if ref spads are initialised. */
|
||||
uint32_t PartUIDUpper; /*!< Unique Part ID Upper */
|
||||
uint32_t PartUIDLower; /*!< Unique Part ID Lower */
|
||||
FixPoint1616_t SignalRateMeasFixed400mm; /*!< Peek Signal rate
|
||||
at 400 mm*/
|
||||
|
||||
} VL53L0X_DeviceSpecificParameters_t;
|
||||
|
||||
/**
|
||||
* @struct VL53L0X_DevData_t
|
||||
*
|
||||
* @brief VL53L0X PAL device ST private data structure \n
|
||||
* End user should never access any of these field directly
|
||||
*
|
||||
* These must never access directly but only via macro
|
||||
*/
|
||||
typedef struct {
|
||||
VL53L0X_DMaxData_t DMaxData;
|
||||
/*!< Dmax Data */
|
||||
int32_t Part2PartOffsetNVMMicroMeter;
|
||||
/*!< backed up NVM value */
|
||||
int32_t Part2PartOffsetAdjustmentNVMMicroMeter;
|
||||
/*!< backed up NVM value representing additional offset adjustment */
|
||||
VL53L0X_DeviceParameters_t CurrentParameters;
|
||||
/*!< Current Device Parameter */
|
||||
VL53L0X_RangingMeasurementData_t LastRangeMeasure;
|
||||
/*!< Ranging Data */
|
||||
VL53L0X_HistogramMeasurementData_t LastHistogramMeasure;
|
||||
/*!< Histogram Data */
|
||||
VL53L0X_DeviceSpecificParameters_t DeviceSpecificParameters;
|
||||
/*!< Parameters specific to the device */
|
||||
VL53L0X_SpadData_t SpadData;
|
||||
/*!< Spad Data */
|
||||
uint8_t SequenceConfig;
|
||||
/*!< Internal value for the sequence config */
|
||||
uint8_t RangeFractionalEnable;
|
||||
/*!< Enable/Disable fractional part of ranging data */
|
||||
VL53L0X_State PalState;
|
||||
/*!< Current state of the PAL for this device */
|
||||
VL53L0X_PowerModes PowerMode;
|
||||
/*!< Current Power Mode */
|
||||
uint16_t SigmaEstRefArray;
|
||||
/*!< Reference array sigma value in 1/100th of [mm] e.g. 100 = 1mm */
|
||||
uint16_t SigmaEstEffPulseWidth;
|
||||
/*!< Effective Pulse width for sigma estimate in 1/100th
|
||||
* of ns e.g. 900 = 9.0ns */
|
||||
uint16_t SigmaEstEffAmbWidth;
|
||||
/*!< Effective Ambient width for sigma estimate in 1/100th of ns
|
||||
* e.g. 500 = 5.0ns */
|
||||
uint16_t targetRefRate;
|
||||
/*!< Target Ambient Rate for Ref spad management */
|
||||
FixPoint1616_t SigmaEstimate;
|
||||
/*!< Sigma Estimate - based on ambient & VCSEL rates and
|
||||
* signal_total_events */
|
||||
FixPoint1616_t SignalEstimate;
|
||||
/*!< Signal Estimate - based on ambient & VCSEL rates and cross talk */
|
||||
FixPoint1616_t LastSignalRefMcps;
|
||||
/*!< Latest Signal ref in Mcps */
|
||||
uint8_t *pTuningSettingsPointer;
|
||||
/*!< Pointer for Tuning Settings table */
|
||||
uint8_t UseInternalTuningSettings;
|
||||
/*!< Indicate if we use Tuning Settings table */
|
||||
uint16_t LinearityCorrectiveGain;
|
||||
/*!< Linearity Corrective Gain value in x1000 */
|
||||
uint16_t DmaxCalRangeMilliMeter;
|
||||
/*!< Dmax Calibration Range millimeter */
|
||||
FixPoint1616_t DmaxCalSignalRateRtnMegaCps;
|
||||
/*!< Dmax Calibration Signal Rate Return MegaCps */
|
||||
|
||||
} VL53L0X_DevData_t;
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_define_InterruptPolarity_group Defines the Polarity
|
||||
* of the Interrupt
|
||||
* Defines the Polarity of the Interrupt
|
||||
* @{
|
||||
*/
|
||||
typedef uint8_t VL53L0X_InterruptPolarity;
|
||||
|
||||
#define VL53L0X_INTERRUPTPOLARITY_LOW ((VL53L0X_InterruptPolarity) 0)
|
||||
/*!< Set active low polarity best setup for falling edge. */
|
||||
#define VL53L0X_INTERRUPTPOLARITY_HIGH ((VL53L0X_InterruptPolarity) 1)
|
||||
/*!< Set active high polarity best setup for rising edge. */
|
||||
|
||||
/** @} VL53L0X_define_InterruptPolarity_group */
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_define_VcselPeriod_group Vcsel Period Defines
|
||||
* Defines the range measurement for which to access the vcsel period.
|
||||
* @{
|
||||
*/
|
||||
typedef uint8_t VL53L0X_VcselPeriod;
|
||||
|
||||
#define VL53L0X_VCSEL_PERIOD_PRE_RANGE ((VL53L0X_VcselPeriod) 0)
|
||||
/*!<Identifies the pre-range vcsel period. */
|
||||
#define VL53L0X_VCSEL_PERIOD_FINAL_RANGE ((VL53L0X_VcselPeriod) 1)
|
||||
/*!<Identifies the final range vcsel period. */
|
||||
|
||||
/** @} VL53L0X_define_VcselPeriod_group */
|
||||
|
||||
/** @defgroup VL53L0X_define_SchedulerSequence_group Defines the steps
|
||||
* carried out by the scheduler during a range measurement.
|
||||
* @{
|
||||
* Defines the states of all the steps in the scheduler
|
||||
* i.e. enabled/disabled.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t TccOn; /*!<Reports if Target Centre Check On */
|
||||
uint8_t MsrcOn; /*!<Reports if MSRC On */
|
||||
uint8_t DssOn; /*!<Reports if DSS On */
|
||||
uint8_t PreRangeOn; /*!<Reports if Pre-Range On */
|
||||
uint8_t FinalRangeOn; /*!<Reports if Final-Range On */
|
||||
} VL53L0X_SchedulerSequenceSteps_t;
|
||||
|
||||
/** @} VL53L0X_define_SchedulerSequence_group */
|
||||
|
||||
/** @defgroup VL53L0X_define_SequenceStepId_group Defines the Polarity
|
||||
* of the Interrupt
|
||||
* Defines the the sequence steps performed during ranging..
|
||||
* @{
|
||||
*/
|
||||
typedef uint8_t VL53L0X_SequenceStepId;
|
||||
|
||||
#define VL53L0X_SEQUENCESTEP_TCC ((VL53L0X_VcselPeriod) 0)
|
||||
/*!<Target CentreCheck identifier. */
|
||||
#define VL53L0X_SEQUENCESTEP_DSS ((VL53L0X_VcselPeriod) 1)
|
||||
/*!<Dynamic Spad Selection function Identifier. */
|
||||
#define VL53L0X_SEQUENCESTEP_MSRC ((VL53L0X_VcselPeriod) 2)
|
||||
/*!<Minimum Signal Rate Check function Identifier. */
|
||||
#define VL53L0X_SEQUENCESTEP_PRE_RANGE ((VL53L0X_VcselPeriod) 3)
|
||||
/*!<Pre-Range check Identifier. */
|
||||
#define VL53L0X_SEQUENCESTEP_FINAL_RANGE ((VL53L0X_VcselPeriod) 4)
|
||||
/*!<Final Range Check Identifier. */
|
||||
|
||||
#define VL53L0X_SEQUENCESTEP_NUMBER_OF_CHECKS 5
|
||||
/*!<Number of Sequence Step Managed by the API. */
|
||||
|
||||
/** @} VL53L0X_define_SequenceStepId_group */
|
||||
|
||||
|
||||
/* MACRO Definitions */
|
||||
/** @defgroup VL53L0X_define_GeneralMacro_group General Macro Defines
|
||||
* General Macro Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Defines */
|
||||
#define VL53L0X_SETPARAMETERFIELD(Dev, field, value) \
|
||||
PALDevDataSet(Dev, CurrentParameters.field, value)
|
||||
|
||||
#define VL53L0X_GETPARAMETERFIELD(Dev, field, variable) \
|
||||
variable = PALDevDataGet(Dev, CurrentParameters).field
|
||||
|
||||
|
||||
#define VL53L0X_SETARRAYPARAMETERFIELD(Dev, field, index, value) \
|
||||
PALDevDataSet(Dev, CurrentParameters.field[index], value)
|
||||
|
||||
#define VL53L0X_GETARRAYPARAMETERFIELD(Dev, field, index, variable) \
|
||||
variable = PALDevDataGet(Dev, CurrentParameters).field[index]
|
||||
|
||||
|
||||
#define VL53L0X_SETDEVICESPECIFICPARAMETER(Dev, field, value) \
|
||||
PALDevDataSet(Dev, DeviceSpecificParameters.field, value)
|
||||
|
||||
#define VL53L0X_GETDEVICESPECIFICPARAMETER(Dev, field) \
|
||||
PALDevDataGet(Dev, DeviceSpecificParameters).field
|
||||
|
||||
|
||||
#define VL53L0X_FIXPOINT1616TOFIXPOINT97(Value) \
|
||||
(uint16_t)((Value>>9)&0xFFFF)
|
||||
#define VL53L0X_FIXPOINT97TOFIXPOINT1616(Value) \
|
||||
(FixPoint1616_t)(Value<<9)
|
||||
|
||||
#define VL53L0X_FIXPOINT1616TOFIXPOINT88(Value) \
|
||||
(uint16_t)((Value>>8)&0xFFFF)
|
||||
#define VL53L0X_FIXPOINT88TOFIXPOINT1616(Value) \
|
||||
(FixPoint1616_t)(Value<<8)
|
||||
|
||||
#define VL53L0X_FIXPOINT1616TOFIXPOINT412(Value) \
|
||||
(uint16_t)((Value>>4)&0xFFFF)
|
||||
#define VL53L0X_FIXPOINT412TOFIXPOINT1616(Value) \
|
||||
(FixPoint1616_t)(Value<<4)
|
||||
|
||||
#define VL53L0X_FIXPOINT1616TOFIXPOINT313(Value) \
|
||||
(uint16_t)((Value>>3)&0xFFFF)
|
||||
#define VL53L0X_FIXPOINT313TOFIXPOINT1616(Value) \
|
||||
(FixPoint1616_t)(Value<<3)
|
||||
|
||||
#define VL53L0X_FIXPOINT1616TOFIXPOINT08(Value) \
|
||||
(uint8_t)((Value>>8)&0x00FF)
|
||||
#define VL53L0X_FIXPOINT08TOFIXPOINT1616(Value) \
|
||||
(FixPoint1616_t)(Value<<8)
|
||||
|
||||
#define VL53L0X_FIXPOINT1616TOFIXPOINT53(Value) \
|
||||
(uint8_t)((Value>>13)&0x00FF)
|
||||
#define VL53L0X_FIXPOINT53TOFIXPOINT1616(Value) \
|
||||
(FixPoint1616_t)(Value<<13)
|
||||
|
||||
#define VL53L0X_FIXPOINT1616TOFIXPOINT102(Value) \
|
||||
(uint16_t)((Value>>14)&0x0FFF)
|
||||
#define VL53L0X_FIXPOINT102TOFIXPOINT1616(Value) \
|
||||
(FixPoint1616_t)(Value<<12)
|
||||
|
||||
#define VL53L0X_MAKEUINT16(lsb, msb) (uint16_t)((((uint16_t)msb)<<8) + \
|
||||
(uint16_t)lsb)
|
||||
|
||||
/** @} VL53L0X_define_GeneralMacro_group */
|
||||
|
||||
/** @} VL53L0X_globaldefine_group */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _VL53L0X_DEF_H_ */
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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.
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* Device specific defines. To be adapted by implementer for the targeted
|
||||
* device.
|
||||
*/
|
||||
|
||||
#ifndef _VL53L0X_DEVICE_H_
|
||||
#define _VL53L0X_DEVICE_H_
|
||||
|
||||
#include "vl53l0x_types.h"
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_DevSpecDefines_group VL53L0X cut1.1 Device Specific Defines
|
||||
* @brief VL53L0X cut1.1 Device Specific Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_DeviceError_group Device Error
|
||||
* @brief Device Error code
|
||||
*
|
||||
* This enum is Device specific it should be updated in the implementation
|
||||
* Use @a VL53L0X_GetStatusErrorString() to get the string.
|
||||
* It is related to Status Register of the Device.
|
||||
* @{
|
||||
*/
|
||||
typedef uint8_t VL53L0X_DeviceError;
|
||||
|
||||
#define VL53L0X_DEVICEERROR_NONE ((VL53L0X_DeviceError) 0)
|
||||
/*!< 0 NoError */
|
||||
#define VL53L0X_DEVICEERROR_VCSELCONTINUITYTESTFAILURE ((VL53L0X_DeviceError) 1)
|
||||
#define VL53L0X_DEVICEERROR_VCSELWATCHDOGTESTFAILURE ((VL53L0X_DeviceError) 2)
|
||||
#define VL53L0X_DEVICEERROR_NOVHVVALUEFOUND ((VL53L0X_DeviceError) 3)
|
||||
#define VL53L0X_DEVICEERROR_MSRCNOTARGET ((VL53L0X_DeviceError) 4)
|
||||
#define VL53L0X_DEVICEERROR_SNRCHECK ((VL53L0X_DeviceError) 5)
|
||||
#define VL53L0X_DEVICEERROR_RANGEPHASECHECK ((VL53L0X_DeviceError) 6)
|
||||
#define VL53L0X_DEVICEERROR_SIGMATHRESHOLDCHECK ((VL53L0X_DeviceError) 7)
|
||||
#define VL53L0X_DEVICEERROR_TCC ((VL53L0X_DeviceError) 8)
|
||||
#define VL53L0X_DEVICEERROR_PHASECONSISTENCY ((VL53L0X_DeviceError) 9)
|
||||
#define VL53L0X_DEVICEERROR_MINCLIP ((VL53L0X_DeviceError) 10)
|
||||
#define VL53L0X_DEVICEERROR_RANGECOMPLETE ((VL53L0X_DeviceError) 11)
|
||||
#define VL53L0X_DEVICEERROR_ALGOUNDERFLOW ((VL53L0X_DeviceError) 12)
|
||||
#define VL53L0X_DEVICEERROR_ALGOOVERFLOW ((VL53L0X_DeviceError) 13)
|
||||
#define VL53L0X_DEVICEERROR_RANGEIGNORETHRESHOLD ((VL53L0X_DeviceError) 14)
|
||||
|
||||
/** @} end of VL53L0X_DeviceError_group */
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_CheckEnable_group Check Enable list
|
||||
* @brief Check Enable code
|
||||
*
|
||||
* Define used to specify the LimitCheckId.
|
||||
* Use @a VL53L0X_GetLimitCheckInfo() to get the string.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define VL53L0X_CHECKENABLE_SIGMA_FINAL_RANGE 0
|
||||
#define VL53L0X_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE 1
|
||||
#define VL53L0X_CHECKENABLE_SIGNAL_REF_CLIP 2
|
||||
#define VL53L0X_CHECKENABLE_RANGE_IGNORE_THRESHOLD 3
|
||||
#define VL53L0X_CHECKENABLE_SIGNAL_RATE_MSRC 4
|
||||
#define VL53L0X_CHECKENABLE_SIGNAL_RATE_PRE_RANGE 5
|
||||
|
||||
#define VL53L0X_CHECKENABLE_NUMBER_OF_CHECKS 6
|
||||
|
||||
/** @} end of VL53L0X_CheckEnable_group */
|
||||
|
||||
|
||||
/** @defgroup VL53L0X_GpioFunctionality_group Gpio Functionality
|
||||
* @brief Defines the different functionalities for the device GPIO(s)
|
||||
* @{
|
||||
*/
|
||||
typedef uint8_t VL53L0X_GpioFunctionality;
|
||||
|
||||
#define VL53L0X_GPIOFUNCTIONALITY_OFF \
|
||||
((VL53L0X_GpioFunctionality) 0) /*!< NO Interrupt */
|
||||
#define VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW \
|
||||
((VL53L0X_GpioFunctionality) 1) /*!< Level Low (value < thresh_low) */
|
||||
#define VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH \
|
||||
((VL53L0X_GpioFunctionality) 2) /*!< Level High (value > thresh_high) */
|
||||
#define VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT \
|
||||
((VL53L0X_GpioFunctionality) 3)
|
||||
/*!< Out Of Window (value < thresh_low OR value > thresh_high) */
|
||||
#define VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY \
|
||||
((VL53L0X_GpioFunctionality) 4) /*!< New Sample Ready */
|
||||
|
||||
/** @} end of VL53L0X_GpioFunctionality_group */
|
||||
|
||||
|
||||
/* Device register map */
|
||||
|
||||
/** @defgroup VL53L0X_DefineRegisters_group Define Registers
|
||||
* @brief List of all the defined registers
|
||||
* @{
|
||||
*/
|
||||
#define VL53L0X_REG_SYSRANGE_START 0x000
|
||||
/** mask existing bit in #VL53L0X_REG_SYSRANGE_START*/
|
||||
#define VL53L0X_REG_SYSRANGE_MODE_MASK 0x0F
|
||||
/** bit 0 in #VL53L0X_REG_SYSRANGE_START write 1 toggle state in
|
||||
* continuous mode and arm next shot in single shot mode */
|
||||
#define VL53L0X_REG_SYSRANGE_MODE_START_STOP 0x01
|
||||
/** bit 1 write 0 in #VL53L0X_REG_SYSRANGE_START set single shot mode */
|
||||
#define VL53L0X_REG_SYSRANGE_MODE_SINGLESHOT 0x00
|
||||
/** bit 1 write 1 in #VL53L0X_REG_SYSRANGE_START set back-to-back
|
||||
* operation mode */
|
||||
#define VL53L0X_REG_SYSRANGE_MODE_BACKTOBACK 0x02
|
||||
/** bit 2 write 1 in #VL53L0X_REG_SYSRANGE_START set timed operation
|
||||
* mode */
|
||||
#define VL53L0X_REG_SYSRANGE_MODE_TIMED 0x04
|
||||
/** bit 3 write 1 in #VL53L0X_REG_SYSRANGE_START set histogram operation
|
||||
* mode */
|
||||
#define VL53L0X_REG_SYSRANGE_MODE_HISTOGRAM 0x08
|
||||
|
||||
|
||||
#define VL53L0X_REG_SYSTEM_THRESH_HIGH 0x000C
|
||||
#define VL53L0X_REG_SYSTEM_THRESH_LOW 0x000E
|
||||
|
||||
|
||||
#define VL53L0X_REG_SYSTEM_SEQUENCE_CONFIG 0x0001
|
||||
#define VL53L0X_REG_SYSTEM_RANGE_CONFIG 0x0009
|
||||
#define VL53L0X_REG_SYSTEM_INTERMEASUREMENT_PERIOD 0x0004
|
||||
|
||||
|
||||
#define VL53L0X_REG_SYSTEM_INTERRUPT_CONFIG_GPIO 0x000A
|
||||
#define VL53L0X_REG_SYSTEM_INTERRUPT_GPIO_DISABLED 0x00
|
||||
#define VL53L0X_REG_SYSTEM_INTERRUPT_GPIO_LEVEL_LOW 0x01
|
||||
#define VL53L0X_REG_SYSTEM_INTERRUPT_GPIO_LEVEL_HIGH 0x02
|
||||
#define VL53L0X_REG_SYSTEM_INTERRUPT_GPIO_OUT_OF_WINDOW 0x03
|
||||
#define VL53L0X_REG_SYSTEM_INTERRUPT_GPIO_NEW_SAMPLE_READY 0x04
|
||||
|
||||
#define VL53L0X_REG_GPIO_HV_MUX_ACTIVE_HIGH 0x0084
|
||||
|
||||
|
||||
#define VL53L0X_REG_SYSTEM_INTERRUPT_CLEAR 0x000B
|
||||
|
||||
/* Result registers */
|
||||
#define VL53L0X_REG_RESULT_INTERRUPT_STATUS 0x0013
|
||||
#define VL53L0X_REG_RESULT_RANGE_STATUS 0x0014
|
||||
|
||||
#define VL53L0X_REG_RESULT_CORE_PAGE 1
|
||||
#define VL53L0X_REG_RESULT_CORE_AMBIENT_WINDOW_EVENTS_RTN 0x00BC
|
||||
#define VL53L0X_REG_RESULT_CORE_RANGING_TOTAL_EVENTS_RTN 0x00C0
|
||||
#define VL53L0X_REG_RESULT_CORE_AMBIENT_WINDOW_EVENTS_REF 0x00D0
|
||||
#define VL53L0X_REG_RESULT_CORE_RANGING_TOTAL_EVENTS_REF 0x00D4
|
||||
#define VL53L0X_REG_RESULT_PEAK_SIGNAL_RATE_REF 0x00B6
|
||||
|
||||
/* Algo register */
|
||||
|
||||
#define VL53L0X_REG_ALGO_PART_TO_PART_RANGE_OFFSET_MM 0x0028
|
||||
|
||||
#define VL53L0X_REG_I2C_SLAVE_DEVICE_ADDRESS 0x008a
|
||||
|
||||
/* Check Limit registers */
|
||||
#define VL53L0X_REG_MSRC_CONFIG_CONTROL 0x0060
|
||||
|
||||
#define VL53L0X_REG_PRE_RANGE_CONFIG_MIN_SNR 0X0027
|
||||
#define VL53L0X_REG_PRE_RANGE_CONFIG_VALID_PHASE_LOW 0x0056
|
||||
#define VL53L0X_REG_PRE_RANGE_CONFIG_VALID_PHASE_HIGH 0x0057
|
||||
#define VL53L0X_REG_PRE_RANGE_MIN_COUNT_RATE_RTN_LIMIT 0x0064
|
||||
|
||||
#define VL53L0X_REG_FINAL_RANGE_CONFIG_MIN_SNR 0X0067
|
||||
#define VL53L0X_REG_FINAL_RANGE_CONFIG_VALID_PHASE_LOW 0x0047
|
||||
#define VL53L0X_REG_FINAL_RANGE_CONFIG_VALID_PHASE_HIGH 0x0048
|
||||
#define VL53L0X_REG_FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT 0x0044
|
||||
|
||||
|
||||
#define VL53L0X_REG_PRE_RANGE_CONFIG_SIGMA_THRESH_HI 0X0061
|
||||
#define VL53L0X_REG_PRE_RANGE_CONFIG_SIGMA_THRESH_LO 0X0062
|
||||
|
||||
/* PRE RANGE registers */
|
||||
#define VL53L0X_REG_PRE_RANGE_CONFIG_VCSEL_PERIOD 0x0050
|
||||
#define VL53L0X_REG_PRE_RANGE_CONFIG_TIMEOUT_MACROP_HI 0x0051
|
||||
#define VL53L0X_REG_PRE_RANGE_CONFIG_TIMEOUT_MACROP_LO 0x0052
|
||||
|
||||
#define VL53L0X_REG_SYSTEM_HISTOGRAM_BIN 0x0081
|
||||
#define VL53L0X_REG_HISTOGRAM_CONFIG_INITIAL_PHASE_SELECT 0x0033
|
||||
#define VL53L0X_REG_HISTOGRAM_CONFIG_READOUT_CTRL 0x0055
|
||||
|
||||
#define VL53L0X_REG_FINAL_RANGE_CONFIG_VCSEL_PERIOD 0x0070
|
||||
#define VL53L0X_REG_FINAL_RANGE_CONFIG_TIMEOUT_MACROP_HI 0x0071
|
||||
#define VL53L0X_REG_FINAL_RANGE_CONFIG_TIMEOUT_MACROP_LO 0x0072
|
||||
#define VL53L0X_REG_CROSSTALK_COMPENSATION_PEAK_RATE_MCPS 0x0020
|
||||
|
||||
#define VL53L0X_REG_MSRC_CONFIG_TIMEOUT_MACROP 0x0046
|
||||
|
||||
|
||||
#define VL53L0X_REG_SOFT_RESET_GO2_SOFT_RESET_N 0x00bf
|
||||
#define VL53L0X_REG_IDENTIFICATION_MODEL_ID 0x00c0
|
||||
#define VL53L0X_REG_IDENTIFICATION_REVISION_ID 0x00c2
|
||||
|
||||
#define VL53L0X_REG_OSC_CALIBRATE_VAL 0x00f8
|
||||
|
||||
|
||||
#define VL53L0X_SIGMA_ESTIMATE_MAX_VALUE 65535
|
||||
/* equivalent to a range sigma of 655.35mm */
|
||||
|
||||
#define VL53L0X_REG_GLOBAL_CONFIG_VCSEL_WIDTH 0x032
|
||||
#define VL53L0X_REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_0 0x0B0
|
||||
#define VL53L0X_REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_1 0x0B1
|
||||
#define VL53L0X_REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_2 0x0B2
|
||||
#define VL53L0X_REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_3 0x0B3
|
||||
#define VL53L0X_REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_4 0x0B4
|
||||
#define VL53L0X_REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_5 0x0B5
|
||||
|
||||
#define VL53L0X_REG_GLOBAL_CONFIG_REF_EN_START_SELECT 0xB6
|
||||
#define VL53L0X_REG_DYNAMIC_SPAD_NUM_REQUESTED_REF_SPAD 0x4E /* 0x14E */
|
||||
#define VL53L0X_REG_DYNAMIC_SPAD_REF_EN_START_OFFSET 0x4F /* 0x14F */
|
||||
#define VL53L0X_REG_POWER_MANAGEMENT_GO1_POWER_FORCE 0x80
|
||||
|
||||
/*
|
||||
* Speed of light in um per 1E-10 Seconds
|
||||
*/
|
||||
|
||||
#define VL53L0X_SPEED_OF_LIGHT_IN_AIR 2997
|
||||
|
||||
#define VL53L0X_REG_VHV_CONFIG_PAD_SCL_SDA__EXTSUP_HV 0x0089
|
||||
|
||||
#define VL53L0X_REG_ALGO_PHASECAL_LIM 0x0030 /* 0x130 */
|
||||
#define VL53L0X_REG_ALGO_PHASECAL_CONFIG_TIMEOUT 0x0030
|
||||
|
||||
/** @} VL53L0X_DefineRegisters_group */
|
||||
|
||||
/** @} VL53L0X_DevSpecDefines_group */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* _VL53L0X_DEVICE_H_ */
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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.
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _VL53L0X_INTERRUPT_THRESHOLD_SETTINGS_H_
|
||||
#define _VL53L0X_INTERRUPT_THRESHOLD_SETTINGS_H_
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
uint8_t InterruptThresholdSettings[] = {
|
||||
|
||||
/* Start of Interrupt Threshold Settings */
|
||||
0x1, 0xff, 0x00,
|
||||
0x1, 0x80, 0x01,
|
||||
0x1, 0xff, 0x01,
|
||||
0x1, 0x00, 0x00,
|
||||
0x1, 0xff, 0x01,
|
||||
0x1, 0x4f, 0x02,
|
||||
0x1, 0xFF, 0x0E,
|
||||
0x1, 0x00, 0x03,
|
||||
0x1, 0x01, 0x84,
|
||||
0x1, 0x02, 0x0A,
|
||||
0x1, 0x03, 0x03,
|
||||
0x1, 0x04, 0x08,
|
||||
0x1, 0x05, 0xC8,
|
||||
0x1, 0x06, 0x03,
|
||||
0x1, 0x07, 0x8D,
|
||||
0x1, 0x08, 0x08,
|
||||
0x1, 0x09, 0xC6,
|
||||
0x1, 0x0A, 0x01,
|
||||
0x1, 0x0B, 0x02,
|
||||
0x1, 0x0C, 0x00,
|
||||
0x1, 0x0D, 0xD5,
|
||||
0x1, 0x0E, 0x18,
|
||||
0x1, 0x0F, 0x12,
|
||||
0x1, 0x10, 0x01,
|
||||
0x1, 0x11, 0x82,
|
||||
0x1, 0x12, 0x00,
|
||||
0x1, 0x13, 0xD5,
|
||||
0x1, 0x14, 0x18,
|
||||
0x1, 0x15, 0x13,
|
||||
0x1, 0x16, 0x03,
|
||||
0x1, 0x17, 0x86,
|
||||
0x1, 0x18, 0x0A,
|
||||
0x1, 0x19, 0x09,
|
||||
0x1, 0x1A, 0x08,
|
||||
0x1, 0x1B, 0xC2,
|
||||
0x1, 0x1C, 0x03,
|
||||
0x1, 0x1D, 0x8F,
|
||||
0x1, 0x1E, 0x0A,
|
||||
0x1, 0x1F, 0x06,
|
||||
0x1, 0x20, 0x01,
|
||||
0x1, 0x21, 0x02,
|
||||
0x1, 0x22, 0x00,
|
||||
0x1, 0x23, 0xD5,
|
||||
0x1, 0x24, 0x18,
|
||||
0x1, 0x25, 0x22,
|
||||
0x1, 0x26, 0x01,
|
||||
0x1, 0x27, 0x82,
|
||||
0x1, 0x28, 0x00,
|
||||
0x1, 0x29, 0xD5,
|
||||
0x1, 0x2A, 0x18,
|
||||
0x1, 0x2B, 0x0B,
|
||||
0x1, 0x2C, 0x28,
|
||||
0x1, 0x2D, 0x78,
|
||||
0x1, 0x2E, 0x28,
|
||||
0x1, 0x2F, 0x91,
|
||||
0x1, 0x30, 0x00,
|
||||
0x1, 0x31, 0x0B,
|
||||
0x1, 0x32, 0x00,
|
||||
0x1, 0x33, 0x0B,
|
||||
0x1, 0x34, 0x00,
|
||||
0x1, 0x35, 0xA1,
|
||||
0x1, 0x36, 0x00,
|
||||
0x1, 0x37, 0xA0,
|
||||
0x1, 0x38, 0x00,
|
||||
0x1, 0x39, 0x04,
|
||||
0x1, 0x3A, 0x28,
|
||||
0x1, 0x3B, 0x30,
|
||||
0x1, 0x3C, 0x0C,
|
||||
0x1, 0x3D, 0x04,
|
||||
0x1, 0x3E, 0x0F,
|
||||
0x1, 0x3F, 0x79,
|
||||
0x1, 0x40, 0x28,
|
||||
0x1, 0x41, 0x1E,
|
||||
0x1, 0x42, 0x2F,
|
||||
0x1, 0x43, 0x87,
|
||||
0x1, 0x44, 0x00,
|
||||
0x1, 0x45, 0x0B,
|
||||
0x1, 0x46, 0x00,
|
||||
0x1, 0x47, 0x0B,
|
||||
0x1, 0x48, 0x00,
|
||||
0x1, 0x49, 0xA7,
|
||||
0x1, 0x4A, 0x00,
|
||||
0x1, 0x4B, 0xA6,
|
||||
0x1, 0x4C, 0x00,
|
||||
0x1, 0x4D, 0x04,
|
||||
0x1, 0x4E, 0x01,
|
||||
0x1, 0x4F, 0x00,
|
||||
0x1, 0x50, 0x00,
|
||||
0x1, 0x51, 0x80,
|
||||
0x1, 0x52, 0x09,
|
||||
0x1, 0x53, 0x08,
|
||||
0x1, 0x54, 0x01,
|
||||
0x1, 0x55, 0x00,
|
||||
0x1, 0x56, 0x0F,
|
||||
0x1, 0x57, 0x79,
|
||||
0x1, 0x58, 0x09,
|
||||
0x1, 0x59, 0x05,
|
||||
0x1, 0x5A, 0x00,
|
||||
0x1, 0x5B, 0x60,
|
||||
0x1, 0x5C, 0x05,
|
||||
0x1, 0x5D, 0xD1,
|
||||
0x1, 0x5E, 0x0C,
|
||||
0x1, 0x5F, 0x3C,
|
||||
0x1, 0x60, 0x00,
|
||||
0x1, 0x61, 0xD0,
|
||||
0x1, 0x62, 0x0B,
|
||||
0x1, 0x63, 0x03,
|
||||
0x1, 0x64, 0x28,
|
||||
0x1, 0x65, 0x10,
|
||||
0x1, 0x66, 0x2A,
|
||||
0x1, 0x67, 0x39,
|
||||
0x1, 0x68, 0x0B,
|
||||
0x1, 0x69, 0x02,
|
||||
0x1, 0x6A, 0x28,
|
||||
0x1, 0x6B, 0x10,
|
||||
0x1, 0x6C, 0x2A,
|
||||
0x1, 0x6D, 0x61,
|
||||
0x1, 0x6E, 0x0C,
|
||||
0x1, 0x6F, 0x00,
|
||||
0x1, 0x70, 0x0F,
|
||||
0x1, 0x71, 0x79,
|
||||
0x1, 0x72, 0x00,
|
||||
0x1, 0x73, 0x0B,
|
||||
0x1, 0x74, 0x00,
|
||||
0x1, 0x75, 0x0B,
|
||||
0x1, 0x76, 0x00,
|
||||
0x1, 0x77, 0xA1,
|
||||
0x1, 0x78, 0x00,
|
||||
0x1, 0x79, 0xA0,
|
||||
0x1, 0x7A, 0x00,
|
||||
0x1, 0x7B, 0x04,
|
||||
0x1, 0xFF, 0x04,
|
||||
0x1, 0x79, 0x1D,
|
||||
0x1, 0x7B, 0x27,
|
||||
0x1, 0x96, 0x0E,
|
||||
0x1, 0x97, 0xFE,
|
||||
0x1, 0x98, 0x03,
|
||||
0x1, 0x99, 0xEF,
|
||||
0x1, 0x9A, 0x02,
|
||||
0x1, 0x9B, 0x44,
|
||||
0x1, 0x73, 0x07,
|
||||
0x1, 0x70, 0x01,
|
||||
0x1, 0xff, 0x01,
|
||||
0x1, 0x00, 0x01,
|
||||
0x1, 0xff, 0x00,
|
||||
0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _VL53L0X_INTERRUPT_THRESHOLD_SETTINGS_H_ */
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* COPYRIGHT (C) STMicroelectronics 2015. All rights reserved.
|
||||
*
|
||||
* This software is the confidential and proprietary information of
|
||||
* STMicroelectronics ("Confidential Information"). You shall not
|
||||
* disclose such Confidential Information and shall use it only in
|
||||
* accordance with the terms of the license agreement you entered into
|
||||
* with STMicroelectronics
|
||||
*
|
||||
* Programming Golden Rule: Keep it Simple!
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file VL53L0X_platform_log.c
|
||||
* \brief Code function defintions for Ewok Platform Layer
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h> // sprintf(), vsnprintf(), printf()
|
||||
#include <stdarg.h> // sprintf(), vsnprintf(), printf()
|
||||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#include "vl53l0x_def.h"
|
||||
#include "vl53l0x_platform_log.h"
|
||||
|
||||
|
||||
uint32_t _trace_level = TRACE_LEVEL_WARNING;
|
||||
uint32_t _trace_modules = TRACE_MODULE_NONE;
|
||||
uint32_t _trace_functions = TRACE_FUNCTION_NONE;
|
||||
|
||||
#if defined(VL53L0X_LOG_ENABLE) && (TRACE_UART==1)
|
||||
int32_t VL53L0X_trace_config(char *filename, uint32_t modules, uint32_t level, uint32_t functions)
|
||||
{
|
||||
int STATUS = 0;
|
||||
|
||||
_trace_functions = functions;
|
||||
_trace_level = level;
|
||||
_trace_modules = modules;
|
||||
|
||||
return STATUS;
|
||||
}
|
||||
|
||||
|
||||
void trace_print_module_function(uint32_t module, uint32_t level, uint32_t function, const char *format, ...)
|
||||
{
|
||||
if ( ((level <=_trace_level) && ((module & _trace_modules) > 0))
|
||||
|| ((function & _trace_functions) > 0) )
|
||||
{
|
||||
va_list arg_list;
|
||||
va_start(arg_list, format);
|
||||
trace_vprintf( format, arg_list);
|
||||
va_end(arg_list);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2015, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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.
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _VL53L0X_PLATFORM_LOG_H_
|
||||
#define _VL53L0X_PLATFORM_LOG_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
/* LOG Functions */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @file vl53l0x_platform_log.h
|
||||
*
|
||||
* @brief platform log function definition
|
||||
*/
|
||||
|
||||
//#define VL53L0X_LOG_ENABLE 0
|
||||
|
||||
enum {
|
||||
TRACE_LEVEL_NONE,
|
||||
TRACE_LEVEL_ERRORS,
|
||||
TRACE_LEVEL_WARNING,
|
||||
TRACE_LEVEL_INFO,
|
||||
TRACE_LEVEL_DEBUG,
|
||||
TRACE_LEVEL_ALL,
|
||||
TRACE_LEVEL_IGNORE
|
||||
};
|
||||
|
||||
enum {
|
||||
TRACE_FUNCTION_NONE = 0,
|
||||
TRACE_FUNCTION_I2C = 1,
|
||||
TRACE_FUNCTION_ALL = 0x7fffffff //all bits except sign
|
||||
};
|
||||
|
||||
enum {
|
||||
TRACE_MODULE_NONE = 0x0,
|
||||
TRACE_MODULE_API = 0x1,
|
||||
TRACE_MODULE_PLATFORM = 0x2,
|
||||
TRACE_MODULE_ALL = 0x7fffffff //all bits except sign
|
||||
};
|
||||
|
||||
|
||||
#if defined(VL53L0X_LOG_ENABLE) && (TRACE_UART==1)
|
||||
|
||||
#include <stdarg.h>
|
||||
extern int uart_printf(const char *msg, ...);
|
||||
extern int uart_vprintf(const char *msg, va_list ap);
|
||||
|
||||
#define trace_printf uart_printf
|
||||
#define trace_vprintf uart_vprintf
|
||||
|
||||
|
||||
extern uint32_t _trace_level;
|
||||
|
||||
|
||||
|
||||
int32_t VL53L0X_trace_config(char *filename, uint32_t modules, uint32_t level, uint32_t functions);
|
||||
void trace_print_module_function(uint32_t module, uint32_t level, uint32_t function, const char *format, ...);
|
||||
|
||||
|
||||
//extern FILE * log_file;
|
||||
|
||||
#define LOG_GET_TIME() (int)HAL_GetTick()
|
||||
|
||||
#define _LOG_FUNCTION_START(module, fmt, ... ) \
|
||||
trace_print_module_function(module, _trace_level, TRACE_FUNCTION_ALL, "%ld <START> %s "fmt"\n", LOG_GET_TIME(), __FUNCTION__, ##__VA_ARGS__);
|
||||
|
||||
#define _LOG_FUNCTION_END(module, status, ... )\
|
||||
trace_print_module_function(module, _trace_level, TRACE_FUNCTION_ALL, "%d <END> %s %d\n", LOG_GET_TIME(), __FUNCTION__, (int)status, ##__VA_ARGS__)
|
||||
|
||||
#define _LOG_FUNCTION_END_FMT(module, status, fmt, ... )\
|
||||
trace_print_module_function(module, _trace_level, TRACE_FUNCTION_ALL, "%d <END> %s %d "fmt"\n", LOG_GET_TIME(), __FUNCTION__, (int)status,##__VA_ARGS__)
|
||||
|
||||
|
||||
#else /* VL53L0X_LOG_ENABLE no logging or no TRACE_UART */
|
||||
#define VL53L0X_ErrLog(...) (void)0
|
||||
#define _LOG_FUNCTION_START(module, fmt, ... ) (void)0
|
||||
#define _LOG_FUNCTION_END(module, status, ... ) (void)0
|
||||
#define _LOG_FUNCTION_END_FMT(module, status, fmt, ... ) (void)0
|
||||
#define trace_vprintf(...) (void)0
|
||||
#define VL53L0X_trace_config(...) (void)0
|
||||
|
||||
#endif /* else */
|
||||
|
||||
#define VL53L0_COPYSTRING(str, ...) strcpy(str, ##__VA_ARGS__)
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _VL53L0X_PLATFORM_LOG_H_ */
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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.
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _VL53L0X_TUNING_H_
|
||||
#define _VL53L0X_TUNING_H_
|
||||
|
||||
#include "vl53l0x_def.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
uint8_t DefaultTuningSettings[] = {
|
||||
|
||||
/* update 02/11/2015_v36 */
|
||||
0x01, 0xFF, 0x01,
|
||||
0x01, 0x00, 0x00,
|
||||
|
||||
0x01, 0xFF, 0x00,
|
||||
0x01, 0x09, 0x00,
|
||||
0x01, 0x10, 0x00,
|
||||
0x01, 0x11, 0x00,
|
||||
|
||||
0x01, 0x24, 0x01,
|
||||
0x01, 0x25, 0xff,
|
||||
0x01, 0x75, 0x00,
|
||||
|
||||
0x01, 0xFF, 0x01,
|
||||
0x01, 0x4e, 0x2c,
|
||||
0x01, 0x48, 0x00,
|
||||
0x01, 0x30, 0x20,
|
||||
|
||||
0x01, 0xFF, 0x00,
|
||||
0x01, 0x30, 0x09, /* mja changed from 0x64. */
|
||||
0x01, 0x54, 0x00,
|
||||
0x01, 0x31, 0x04,
|
||||
0x01, 0x32, 0x03,
|
||||
0x01, 0x40, 0x83,
|
||||
0x01, 0x46, 0x25,
|
||||
0x01, 0x60, 0x00,
|
||||
0x01, 0x27, 0x00,
|
||||
0x01, 0x50, 0x06,
|
||||
0x01, 0x51, 0x00,
|
||||
0x01, 0x52, 0x96,
|
||||
0x01, 0x56, 0x08,
|
||||
0x01, 0x57, 0x30,
|
||||
0x01, 0x61, 0x00,
|
||||
0x01, 0x62, 0x00,
|
||||
0x01, 0x64, 0x00,
|
||||
0x01, 0x65, 0x00,
|
||||
0x01, 0x66, 0xa0,
|
||||
|
||||
0x01, 0xFF, 0x01,
|
||||
0x01, 0x22, 0x32,
|
||||
0x01, 0x47, 0x14,
|
||||
0x01, 0x49, 0xff,
|
||||
0x01, 0x4a, 0x00,
|
||||
|
||||
0x01, 0xFF, 0x00,
|
||||
0x01, 0x7a, 0x0a,
|
||||
0x01, 0x7b, 0x00,
|
||||
0x01, 0x78, 0x21,
|
||||
|
||||
0x01, 0xFF, 0x01,
|
||||
0x01, 0x23, 0x34,
|
||||
0x01, 0x42, 0x00,
|
||||
0x01, 0x44, 0xff,
|
||||
0x01, 0x45, 0x26,
|
||||
0x01, 0x46, 0x05,
|
||||
0x01, 0x40, 0x40,
|
||||
0x01, 0x0E, 0x06,
|
||||
0x01, 0x20, 0x1a,
|
||||
0x01, 0x43, 0x40,
|
||||
|
||||
0x01, 0xFF, 0x00,
|
||||
0x01, 0x34, 0x03,
|
||||
0x01, 0x35, 0x44,
|
||||
|
||||
0x01, 0xFF, 0x01,
|
||||
0x01, 0x31, 0x04,
|
||||
0x01, 0x4b, 0x09,
|
||||
0x01, 0x4c, 0x05,
|
||||
0x01, 0x4d, 0x04,
|
||||
|
||||
|
||||
0x01, 0xFF, 0x00,
|
||||
0x01, 0x44, 0x00,
|
||||
0x01, 0x45, 0x20,
|
||||
0x01, 0x47, 0x08,
|
||||
0x01, 0x48, 0x28,
|
||||
0x01, 0x67, 0x00,
|
||||
0x01, 0x70, 0x04,
|
||||
0x01, 0x71, 0x01,
|
||||
0x01, 0x72, 0xfe,
|
||||
0x01, 0x76, 0x00,
|
||||
0x01, 0x77, 0x00,
|
||||
|
||||
0x01, 0xFF, 0x01,
|
||||
0x01, 0x0d, 0x01,
|
||||
|
||||
0x01, 0xFF, 0x00,
|
||||
0x01, 0x80, 0x01,
|
||||
0x01, 0x01, 0xF8,
|
||||
|
||||
0x01, 0xFF, 0x01,
|
||||
0x01, 0x8e, 0x01,
|
||||
0x01, 0x00, 0x01,
|
||||
0x01, 0xFF, 0x00,
|
||||
0x01, 0x80, 0x00,
|
||||
|
||||
0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _VL53L0X_TUNING_H_ */
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
/*******************************************************************************
|
||||
Copyright © 2015, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* 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, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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 vl53l0x_types.h
|
||||
* @brief VL53L0X types definition
|
||||
*/
|
||||
|
||||
#ifndef VL53L0X_TYPES_H_
|
||||
#define VL53L0X_TYPES_H_
|
||||
|
||||
/** @defgroup porting_type Basic type definition
|
||||
* @ingroup VL53L0X_platform_group
|
||||
*
|
||||
* @brief file vl53l0x_types.h files hold basic type definition that may requires porting
|
||||
*
|
||||
* contains type that must be defined for the platform\n
|
||||
* when target platform and compiler provide stdint.h and stddef.h it is enough to include it.\n
|
||||
* If stdint.h is not available review and adapt all signed and unsigned 8/16/32 bits basic types. \n
|
||||
* If stddef.h is not available review and adapt NULL definition .
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef NULL
|
||||
#error "Error NULL definition should be done. Please add required include "
|
||||
#endif
|
||||
|
||||
|
||||
#if ! defined(STDINT_H) && !defined(_GCC_STDINT_H) &&!defined(__STDINT_DECLS) && !defined(_GCC_WRAP_STDINT_H) && !defined(_STDINT) && !defined(_STDINT_H)
|
||||
|
||||
#pragma message("Please review type definition of STDINT define for your platform and add to list above ")
|
||||
|
||||
/*
|
||||
* target platform do not provide stdint or use a different #define than above
|
||||
* to avoid seeing the message below addapt the #define list above or implement
|
||||
* all type and delete these pragma
|
||||
*/
|
||||
|
||||
/** \ingroup VL53L0X_portingType_group
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
|
||||
/** @brief Typedef defining 32 bit unsigned int type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef unsigned int uint32_t;
|
||||
|
||||
/** @brief Typedef defining 32 bit int type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef int int32_t;
|
||||
|
||||
/** @brief Typedef defining 16 bit unsigned short type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef unsigned short uint16_t;
|
||||
|
||||
/** @brief Typedef defining 16 bit short type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef short int16_t;
|
||||
|
||||
/** @brief Typedef defining 8 bit unsigned char type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef unsigned char uint8_t;
|
||||
|
||||
/** @brief Typedef defining 8 bit char type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef signed char int8_t;
|
||||
|
||||
/** @} */
|
||||
#endif /* _STDINT_H */
|
||||
|
||||
|
||||
/** use where fractional values are expected
|
||||
*
|
||||
* Given a floating point value f it's .16 bit point is (int)(f*(1<<16))*/
|
||||
typedef uint32_t FixPoint1616_t;
|
||||
|
||||
#endif /* VL53L0X_TYPES_H_ */
|
||||
|
|
@ -0,0 +1,274 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
|
||||
<link rel="File-List" href="Library_files/filelist.xml">
|
||||
|
||||
|
||||
<link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for WM8994 Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
h2
|
||||
{mso-style-next:Normal;
|
||||
margin-top:12.0pt;
|
||||
margin-right:0in;
|
||||
margin-bottom:3.0pt;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
page-break-after:avoid;
|
||||
mso-outline-level:2;
|
||||
font-size:14.0pt;
|
||||
font-family:Arial;
|
||||
font-weight:bold;
|
||||
font-style:italic;}
|
||||
a:link, span.MsoHyperlink
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{color:blue;
|
||||
text-decoration:underline;
|
||||
text-underline:single;}
|
||||
p
|
||||
{mso-margin-top-alt:auto;
|
||||
margin-right:0in;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
<meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
|
||||
<div class="Section1">
|
||||
<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
|
||||
</o:p></span></p>
|
||||
<div align="center">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top;">
|
||||
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td style="padding: 1.5pt;">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
|
||||
Notes for WM8994 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright 2016 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
|
||||
<p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p> </o:p></span></p>
|
||||
<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td style="padding: 0cm;" valign="top">
|
||||
<span style="font-family: "Times New Roman";">
|
||||
</span>
|
||||
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.1.0 / 22-February-2016 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-family: Verdana; font-size: 10pt;">wm8994.c</span></li>
|
||||
<ul>
|
||||
<li><span style="font-family: Verdana; font-size: 10pt;">Update wm8994_Init() by adding the support of </span><span style="font-family: Verdana; font-size: 10pt;">analog microphone connected to INPUT LINE 1, </span><span style="font-family: Verdana; font-size: 10pt;">INPUT_DEVICE_DIGITAL_MICROPHONE_1 and INPUT_DEVICE_DIGITAL_MIC1_MIC2</span></li>
|
||||
<li><span style="font-family: Verdana; font-size: 10pt;">Add AUDIO_FREQUENCY_32K as possible AudioFreq value</span></li>
|
||||
</ul>
|
||||
<li><span style="font-family: Verdana; font-size: 10pt;">wm8994.h</span></li>
|
||||
<ul>
|
||||
<li><span style="font-family: Verdana; font-size: 10pt;">Add </span><span style="font-family: Verdana; font-size: 10pt;">INPUT_DEVICE_DIGITAL_MIC1_MIC2 define</span></li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0 / 24-June-2015 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;">wm8994.h </span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Add codec de-initialization function: wm8994_DeInit()</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Add Audio IO </span><span style="font-size: 10pt; font-family: Verdana;">de-initialization function prototype: AUDIO_IO_DeInit()</span></li><li><span style="font-family: Verdana; font-size: 10pt;">Add INPUT_DEVICE_INPUT_LINE_1 and </span><span style="font-family: Verdana; font-size: 10pt;">INPUT_DEVICE_INPUT_LINE_1</span><span style="font-family: Verdana; font-size: 10pt;"> support for AUDIO IN</span><span style="font-family: Verdana; font-size: 10pt;"></span></li><li><span style="font-family: Verdana; font-size: 10pt;">Add Input audio volume control support</span></li></ul><li><span style="font-family: Verdana; font-size: 10pt;">wm8994.c </span></li><ul><li><span style="font-family: Verdana; font-size: 10pt;">Update wm8994_Init() function to support the Audio IN</span></li><li><span style="font-family: Verdana; font-size: 10pt;">Update wm8994_Stop() function to only stop the codec if it was configured</span></li><li><span style="font-family: Verdana; font-size: 10pt;">Enable VMID_BUF_ENA bit in R57 ANTIPOP register (address 0x39) for all configurations</span></li></ul><li><span style="font-family: Verdana; font-size: 10pt;"><span style="font-weight: bold;">NOTE:</span> This release must be used with BSP Common
|
||||
driver V4.0.0 or later</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.2 / 12-February-2015 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;">wm8994.c: Update the wm8994_Init() function to set the volume after enabling the dynamic charge pump power control mode </span><span style="font-family: Verdana; font-size: 10pt;"></span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 28-November-2014 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;">wm8994.h: change </span><span style="font-family: Verdana; font-size: 10pt;">"\" by</span><span style="font-family: Verdana; font-size: 10pt;"> "/" </span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;">in the</span><span style="font-family: Verdana; font-size: 10pt;"> include path to fix compilation issue with Linux</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
|
||||
|
||||
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">First official release</span></li>
|
||||
</ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
|
||||
<div style="text-align: justify;"><font size="-1"><span style="font-family: "Verdana","sans-serif";">
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:</span><br>
|
||||
</font>
|
||||
<ol><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Redistributions
|
||||
in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in </span><span style="font-family: "Verdana","sans-serif";">the documentation and/or other materials provided with the distribution.</span><span style="font-family: "Verdana","sans-serif";"></span></font></li><li><font size="-1"><span style="font-family: "Verdana","sans-serif";">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
|
||||
</font>
|
||||
</li></ol>
|
||||
<font size="-1"><span style="font-family: "Verdana","sans-serif";"> from this software without specific prior written permission.</span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";"></span><br>
|
||||
<span style="font-family: "Verdana","sans-serif";">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: "Verdana","sans-serif";"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: "Verdana","sans-serif";">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: "Verdana","sans-serif";">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: "Verdana","sans-serif";">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: "Verdana","sans-serif";"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: "Verdana","sans-serif";">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
|
||||
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><font size="-1"></font><o:p></o:p></span></p>
|
||||
<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
|
||||
|
||||
<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
|
||||
<hr align="center" size="2" width="100%"></span></div>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
|
||||
complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;"> Microcontrollers
|
||||
visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="MsoNormal"><o:p> </o:p></p>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,188 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file wm8994.h
|
||||
* @author MCD Application Team
|
||||
* @version V2.1.0
|
||||
* @date 22-February-2016
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* wm8994.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 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 __WM8994_H
|
||||
#define __WM8994_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/audio.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup WM8994
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup WM8994_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup WM8994_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/******************************************************************************/
|
||||
/*************************** Codec User defines ******************************/
|
||||
/******************************************************************************/
|
||||
/* Codec output DEVICE */
|
||||
#define OUTPUT_DEVICE_SPEAKER ((uint16_t)0x0001)
|
||||
#define OUTPUT_DEVICE_HEADPHONE ((uint16_t)0x0002)
|
||||
#define OUTPUT_DEVICE_BOTH ((uint16_t)0x0003)
|
||||
#define OUTPUT_DEVICE_AUTO ((uint16_t)0x0004)
|
||||
#define INPUT_DEVICE_DIGITAL_MICROPHONE_1 ((uint16_t)0x0100)
|
||||
#define INPUT_DEVICE_DIGITAL_MICROPHONE_2 ((uint16_t)0x0200)
|
||||
#define INPUT_DEVICE_INPUT_LINE_1 ((uint16_t)0x0300)
|
||||
#define INPUT_DEVICE_INPUT_LINE_2 ((uint16_t)0x0400)
|
||||
#define INPUT_DEVICE_DIGITAL_MIC1_MIC2 ((uint16_t)0x0800)
|
||||
|
||||
/* 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)
|
||||
|
||||
#define VOLUME_CONVERT(Volume) (((Volume) > 100)? 100:((uint8_t)(((Volume) * 63) / 100)))
|
||||
#define VOLUME_IN_CONVERT(Volume) (((Volume) >= 100)? 239:((uint8_t)(((Volume) * 240) / 100)))
|
||||
|
||||
/******************************************************************************/
|
||||
/****************************** REGISTER MAPPING ******************************/
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @brief WM8994 ID
|
||||
*/
|
||||
#define WM8994_ID 0x8994
|
||||
|
||||
/**
|
||||
* @brief Device ID Register: Reading from this register will indicate device
|
||||
* family ID 8994h
|
||||
*/
|
||||
#define WM8994_CHIPID_ADDR 0x00
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup WM8994_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup WM8994_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Audio Codec functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/* High Layer codec functions */
|
||||
uint32_t wm8994_Init(uint16_t DeviceAddr, uint16_t OutputInputDevice, uint8_t Volume, uint32_t AudioFreq);
|
||||
void wm8994_DeInit(void);
|
||||
uint32_t wm8994_ReadID(uint16_t DeviceAddr);
|
||||
uint32_t wm8994_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size);
|
||||
uint32_t wm8994_Pause(uint16_t DeviceAddr);
|
||||
uint32_t wm8994_Resume(uint16_t DeviceAddr);
|
||||
uint32_t wm8994_Stop(uint16_t DeviceAddr, uint32_t Cmd);
|
||||
uint32_t wm8994_SetVolume(uint16_t DeviceAddr, uint8_t Volume);
|
||||
uint32_t wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd);
|
||||
uint32_t wm8994_SetOutputMode(uint16_t DeviceAddr, uint8_t Output);
|
||||
uint32_t wm8994_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq);
|
||||
uint32_t wm8994_Reset(uint16_t DeviceAddr);
|
||||
|
||||
/* AUDIO IO functions */
|
||||
void AUDIO_IO_Init(void);
|
||||
void AUDIO_IO_DeInit(void);
|
||||
void AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value);
|
||||
uint8_t AUDIO_IO_Read(uint8_t Addr, uint16_t Reg);
|
||||
void AUDIO_IO_Delay(uint32_t Delay);
|
||||
|
||||
/* Audio driver structure */
|
||||
extern AUDIO_DrvTypeDef wm8994_drv;
|
||||
|
||||
#endif /* __WM8994_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,606 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l496g_discovery.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains definitions for STM32L496G_DISCOVERY's LEDs,
|
||||
* push-buttons hardware resources (MB1261).
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32L496G_DISCOVERY_H
|
||||
#define __STM32L496G_DISCOVERY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Define for STM32L496G_DISCOVERY board
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l4xx_hal.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY_Common
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_Exported_Types Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief LED Types Definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LED1 = 0,
|
||||
LED2 = 1,
|
||||
LED_ORANGE = LED1,
|
||||
LED_GREEN = LED2
|
||||
}
|
||||
Led_TypeDef;
|
||||
|
||||
|
||||
/**
|
||||
* @brief JOYSTICK Types Definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
JOY_SEL = 0,
|
||||
JOY_LEFT = 1,
|
||||
JOY_RIGHT = 2,
|
||||
JOY_DOWN = 3,
|
||||
JOY_UP = 4,
|
||||
JOY_NONE = 5
|
||||
} JOYState_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
JOY_MODE_GPIO = 0,
|
||||
JOY_MODE_EXTI = 1
|
||||
} JOYMode_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM1 = 0
|
||||
} COM_TypeDef;
|
||||
|
||||
/**
|
||||
* @brief LCD constroller Types Definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
__IO uint16_t REG;
|
||||
__IO uint16_t RAM;
|
||||
} LCD_CONTROLLER_TypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_Exported_Constants Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_FMC FMC LCD Constants
|
||||
* @{
|
||||
*/
|
||||
/* We use BANK1 as we use FMC_NE1 signal */
|
||||
#define FMC_BANK1_BASE ((uint32_t)(0x60000000 | 0x00000000))
|
||||
#define FMC_LCD_BASE ((uint32_t)(0x60000000 | 0x00080000)) /*using A18*/
|
||||
#define FMC_BANK1_ADDR ((LCD_CONTROLLER_TypeDef *) FMC_BANK1_BASE)
|
||||
#define LCD_ADDR ((LCD_CONTROLLER_TypeDef *) FMC_LCD_BASE)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_LED LED Constants
|
||||
* @{
|
||||
*/
|
||||
/* To do: invert LED1 and LED2 */
|
||||
#define LEDn 2
|
||||
|
||||
/* LED1 is accessed thru the MFX */
|
||||
#define LED1_PIN IO1_PIN_4
|
||||
|
||||
#define LED2_PIN GPIO_PIN_13
|
||||
#define LED2_GPIO_PORT GPIOB
|
||||
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_BUTTON BUTTON Constants
|
||||
* @{
|
||||
*/
|
||||
#define JOYn 5
|
||||
|
||||
/**
|
||||
* @brief Joystick Right push-button
|
||||
*/
|
||||
#define RIGHT_JOY_PIN GPIO_PIN_11 /* PF.11 */
|
||||
#define RIGHT_JOY_GPIO_PORT GPIOF
|
||||
#define RIGHT_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
|
||||
#define RIGHT_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
|
||||
#define RIGHT_JOY_EXTI_IRQn EXTI15_10_IRQn
|
||||
|
||||
/**
|
||||
* @brief Joystick Left push-button
|
||||
*/
|
||||
#define LEFT_JOY_PIN GPIO_PIN_9 /* PI.09 */
|
||||
#define LEFT_JOY_GPIO_PORT GPIOI
|
||||
#define LEFT_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE()
|
||||
#define LEFT_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE()
|
||||
#define LEFT_JOY_EXTI_IRQn EXTI9_5_IRQn
|
||||
|
||||
/**
|
||||
* @brief Joystick Up push-button
|
||||
*/
|
||||
#define UP_JOY_PIN GPIO_PIN_8 /* PI.08 */
|
||||
#define UP_JOY_GPIO_PORT GPIOI
|
||||
#define UP_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE()
|
||||
#define UP_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE()
|
||||
#define UP_JOY_EXTI_IRQn EXTI9_5_IRQn
|
||||
|
||||
/**
|
||||
* @brief Joystick Down push-button
|
||||
*/
|
||||
#define DOWN_JOY_PIN GPIO_PIN_10 /* PI.10 */
|
||||
#define DOWN_JOY_GPIO_PORT GPIOI
|
||||
#define DOWN_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE()
|
||||
#define DOWN_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE()
|
||||
#define DOWN_JOY_EXTI_IRQn EXTI15_10_IRQn
|
||||
|
||||
/**
|
||||
* @brief Joystick Sel push-button
|
||||
*/
|
||||
#define SEL_JOY_PIN GPIO_PIN_13 /* PC.13 */
|
||||
#define SEL_JOY_GPIO_PORT GPIOC
|
||||
#define SEL_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define SEL_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
#define SEL_JOY_EXTI_IRQn EXTI15_10_IRQn
|
||||
|
||||
#define JOYx_GPIO_CLK_ENABLE(__JOY__) do { if((__JOY__) == JOY_SEL) { SEL_JOY_GPIO_CLK_ENABLE(); } else \
|
||||
if((__JOY__) == JOY_DOWN) { DOWN_JOY_GPIO_CLK_ENABLE(); } else \
|
||||
if((__JOY__) == JOY_LEFT) { LEFT_JOY_GPIO_CLK_ENABLE(); } else \
|
||||
if((__JOY__) == JOY_RIGHT) { RIGHT_JOY_GPIO_CLK_ENABLE(); } else \
|
||||
if((__JOY__) == JOY_UP) { UP_JOY_GPIO_CLK_ENABLE(); } } while(0)
|
||||
|
||||
#define JOYx_GPIO_CLK_DISABLE(__JOY__) do { if((__JOY__) == JOY_SEL) { SEL_JOY_GPIO_CLK_DISABLE(); } else \
|
||||
if((__JOY__) == JOY_DOWN) { DOWN_JOY_GPIO_CLK_DISABLE(); } else \
|
||||
if((__JOY__) == JOY_LEFT) { LEFT_JOY_GPIO_CLK_DISABLE(); } else \
|
||||
if((__JOY__) == JOY_RIGHT) { RIGHT_JOY_GPIO_CLK_DISABLE(); } else \
|
||||
if((__JOY__) == JOY_UP) { UP_JOY_GPIO_CLK_DISABLE(); } } while(0)
|
||||
|
||||
#define JOY_ALL_PINS (RIGHT_JOY_PIN | LEFT_JOY_PIN | UP_JOY_PIN | DOWN_JOY_PIN | SEL_JOY_PIN)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L4R9I_DISCOVERY_COM COM Constants
|
||||
* @{
|
||||
*/
|
||||
#define COMn 1
|
||||
|
||||
/**
|
||||
* @brief Definition for COM port1, connected to USART2 (ST-Link USB Virtual Com Port)
|
||||
*/
|
||||
#define DISCOVERY_COM1 USART2
|
||||
#define DISCOVERY_COM1_CLK_ENABLE() __HAL_RCC_USART2_CLK_ENABLE()
|
||||
#define DISCOVERY_COM1_CLK_DISABLE() __HAL_RCC_USART2_CLK_DISABLE()
|
||||
|
||||
#define DISCOVERY_COM1_TX_PIN GPIO_PIN_2
|
||||
#define DISCOVERY_COM1_TX_GPIO_PORT GPIOA
|
||||
#define DISCOVERY_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define DISCOVERY_COM1_TX_AF GPIO_AF7_USART2
|
||||
|
||||
#define DISCOVERY_COM1_RX_PIN GPIO_PIN_6
|
||||
#define DISCOVERY_COM1_RX_GPIO_PORT GPIOD
|
||||
#define DISCOVERY_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
|
||||
#define DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
|
||||
#define DISCOVERY_COM1_RX_AF GPIO_AF7_USART2
|
||||
|
||||
#define DISCOVERY_COM1_IRQn USART2_IRQn
|
||||
|
||||
|
||||
#define DISCOVERY_COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_ENABLE();}} while(0)
|
||||
#define DISCOVERY_COMx_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_DISABLE();}} while(0)
|
||||
|
||||
#define DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_ENABLE();}} while(0)
|
||||
#define DISCOVERY_COMx_TX_GPIO_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_DISABLE();}} while(0)
|
||||
|
||||
#define DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_ENABLE();}} while(0)
|
||||
#define DISCOVERY_COMx_RX_GPIO_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_DISABLE();}} while(0)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_BUS BUS Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined(HAL_I2C_MODULE_ENABLED)
|
||||
/*##################### I2C1 ###################################*/
|
||||
/* User can use this section to tailor I2C1 instance used and associated
|
||||
resources */
|
||||
/* Definition for I2C1 Pins */
|
||||
#define DISCOVERY_I2C1_SCL_GPIO_PORT GPIOG
|
||||
#define DISCOVERY_I2C1_SDA_GPIO_PORT GPIOG
|
||||
#define DISCOVERY_I2C1_SCL_PIN GPIO_PIN_14
|
||||
#define DISCOVERY_I2C1_SDA_PIN GPIO_PIN_13
|
||||
|
||||
#define DISCOVERY_I2C1_SCL_SDA_AF GPIO_AF4_I2C1
|
||||
|
||||
/* Definition for I2C1 clock resources */
|
||||
#define DISCOVERY_I2C1 I2C1
|
||||
#define DISCOVERY_I2C1_CLK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE()
|
||||
#define DISCOVERY_I2C1_CLK_DISABLE() __HAL_RCC_I2C1_CLK_DISABLE()
|
||||
#define DISCOVERY_I2C1_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
|
||||
#define DISCOVERY_I2C1_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
|
||||
#define DISCOVERY_I2C1_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
|
||||
#define DISCOVERY_I2C1_SCL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
|
||||
#define DISCOVERY_I2C1_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET()
|
||||
#define DISCOVERY_I2C1_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET()
|
||||
|
||||
/* Definition for I2C1's NVIC */
|
||||
#define DISCOVERY_I2C1_EV_IRQn I2C1_EV_IRQn
|
||||
#define DISCOVERY_I2C1_EV_IRQHandler I2C1_EV_IRQHandler
|
||||
#define DISCOVERY_I2C1_ER_IRQn I2C1_ER_IRQn
|
||||
#define DISCOVERY_I2C1_ER_IRQHandler I2C1_ER_IRQHandler
|
||||
|
||||
/* I2C TIMING Register define when I2C clock source is SYSCLK */
|
||||
/* I2C TIMING is calculated in case of the I2C Clock source is the SYSCLK = 80 MHz */
|
||||
/* Set 0x90112626 value to reach 100 KHz speed (Rise time = 640ns, Fall time = 20ns) */
|
||||
#ifndef DISCOVERY_I2C1_TIMING
|
||||
#define DISCOVERY_I2C1_TIMING 0x90D00e28/* 0x90112626*/
|
||||
#endif /* DISCOVERY_I2C1_TIMING */
|
||||
|
||||
/* I2C clock speed configuration (in Hz)
|
||||
WARNING:
|
||||
Make sure that this define is not already declared in other files (ie.
|
||||
stm324xg_discovery.h file). It can be used in parallel by other modules. */
|
||||
#ifndef BSP_I2C_SPEED
|
||||
#define BSP_I2C_SPEED 100000
|
||||
#endif /* BSP_I2C_SPEED */
|
||||
|
||||
/* Maximum Timeout values for flags waiting loops. These timeouts are not based
|
||||
on accurate values, they just guarantee that the application will not remain
|
||||
stuck if the I2C communication is corrupted.
|
||||
You may modify these timeout values depending on CPU frequency and application
|
||||
conditions (interrupts routines ...). */
|
||||
#define DISCOVERY_I2C1_TIMEOUT_MAX 3000
|
||||
|
||||
|
||||
/*##################### I2C2 ###################################*/
|
||||
/* User can use this section to tailor I2C2 instance used and associated
|
||||
resources */
|
||||
/* Definition for I2C2 Pins */
|
||||
#define DISCOVERY_I2C2_SCL_PIN GPIO_PIN_4
|
||||
#define DISCOVERY_I2C2_SCL_GPIO_PORT GPIOH
|
||||
#define DISCOVERY_I2C2_SDA_PIN GPIO_PIN_14
|
||||
#define DISCOVERY_I2C2_SDA_GPIO_PORT GPIOB
|
||||
#define DISCOVERY_I2C2_SCL_SDA_AF GPIO_AF4_I2C2
|
||||
/* Definition for I2C2 clock resources */
|
||||
#define DISCOVERY_I2C2 I2C2
|
||||
#define DISCOVERY_I2C2_CLK_ENABLE() __HAL_RCC_I2C2_CLK_ENABLE()
|
||||
#define DISCOVERY_I2C2_CLK_DISABLE() __HAL_RCC_I2C2_CLK_DISABLE()
|
||||
#define DISCOVERY_I2C2_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define DISCOVERY_I2C2_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOH_CLK_ENABLE()
|
||||
#define DISCOVERY_I2C2_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#define DISCOVERY_I2C2_SCL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOH_CLK_DISABLE()
|
||||
#define DISCOVERY_I2C2_FORCE_RESET() __HAL_RCC_I2C2_FORCE_RESET()
|
||||
#define DISCOVERY_I2C2_RELEASE_RESET() __HAL_RCC_I2C2_RELEASE_RESET()
|
||||
|
||||
/* Definition for I2C2's NVIC */
|
||||
#define DISCOVERY_I2C2_EV_IRQn I2C2_EV_IRQn
|
||||
#define DISCOVERY_I2C2_ER_IRQn I2C2_ER_IRQn
|
||||
|
||||
/* I2C TIMING Register define when I2C clock source is SYSCLK */
|
||||
/* I2C TIMING is calculated in case of the I2C Clock source is the SYSCLK = 80 MHz */
|
||||
/* Set 0x90112626 value to reach 100 KHz speed (Rise time = 25ns, Fall time = 10ns) */
|
||||
#ifndef DISCOVERY_I2C2_TIMING
|
||||
#define DISCOVERY_I2C2_TIMING 0x40403E5D
|
||||
#endif /* DISCOVERY_I2C2_TIMING */
|
||||
|
||||
#define IDD_I2C_ADDRESS ((uint16_t) 0x84)
|
||||
#define IO1_I2C_ADDRESS ((uint16_t) 0x84)
|
||||
#define AUDIO_I2C_ADDRESS ((uint16_t) 0x94)
|
||||
#define TS_I2C_ADDRESS ((uint16_t) 0x70)
|
||||
#define CAMERA_I2C_ADDRESS ((uint16_t) 0x60)
|
||||
|
||||
/* Maximum Timeout values for flags waiting loops. These timeouts are not based
|
||||
on accurate values, they just guarantee that the application will not remain
|
||||
stuck if the I2C communication is corrupted.
|
||||
You may modify these timeout values depending on CPU frequency and application
|
||||
conditions (interrupts routines ...). */
|
||||
#define DISCOVERY_I2C2_TIMEOUT_MAX 3000
|
||||
|
||||
|
||||
#ifndef DISCOVERY_I2C_TIMING
|
||||
#define DISCOVERY_I2C_TIMING /*0x90D00e28*/ 0x90112626
|
||||
#endif /* DISCOVERY_I2C2_TIMING */
|
||||
|
||||
/* Written here after to enable compilation only, to be thoroughly reviewed */
|
||||
|
||||
/* Definition for AUDIO I2Cx resources */
|
||||
#define DISCOVERY_AUDIO_I2Cx I2C1
|
||||
#define DISCOVERY_AUDIO_I2Cx_CLK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE()
|
||||
#define DISCOVERY_AUDIO_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
|
||||
#define DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
|
||||
#define DISCOVERY_AUDIO_I2Cx_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET()
|
||||
#define DISCOVERY_AUDIO_I2Cx_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET()
|
||||
|
||||
/* Definition for I2Cx Pins */
|
||||
#define DISCOVERY_AUDIO_I2Cx_SCL_PIN GPIO_PIN_6
|
||||
#define DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_PORT GPIOB
|
||||
#define DISCOVERY_AUDIO_I2Cx_SCL_SDA_AF GPIO_AF4_I2C1
|
||||
#define DISCOVERY_AUDIO_I2Cx_SDA_PIN GPIO_PIN_7
|
||||
|
||||
/* I2C interrupt requests */
|
||||
#define DISCOVERY_AUDIO_I2Cx_EV_IRQn I2C1_EV_IRQn
|
||||
#define DISCOVERY_AUDIO_I2Cx_ER_IRQn I2C1_ER_IRQn
|
||||
|
||||
|
||||
/* Definition for TS (Capacitive Touch Panel) I2Cx resources */
|
||||
#define DISCOVERY_TS_I2Cx I2C2
|
||||
#define DISCOVERY_TS_I2Cx_CLK_ENABLE() __HAL_RCC_I2C2_CLK_ENABLE()
|
||||
#define DISCOVERY_TS_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
|
||||
#define DISCOVERY_TS_I2Cx_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define DISCOVERY_TS_I2Cx_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#define DISCOVERY_TS_I2Cx_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOH_CLK_ENABLE()
|
||||
#define DISCOVERY_TS_I2Cx_SCL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOH_CLK_DISABLE()
|
||||
|
||||
#define DISCOVERY_TS_I2Cx_FORCE_RESET() __HAL_RCC_I2C2_FORCE_RESET()
|
||||
#define DISCOVERY_TS_I2Cx_RELEASE_RESET() __HAL_RCC_I2C2_RELEASE_RESET()
|
||||
|
||||
/* Definition for I2Cx Pins */
|
||||
#define DISCOVERY_TS_I2Cx_SCL_PIN GPIO_PIN_4
|
||||
#define DISCOVERY_TS_I2Cx_SCL_GPIO_PORT GPIOH
|
||||
#define DISCOVERY_TS_I2Cx_SDA_PIN GPIO_PIN_14
|
||||
#define DISCOVERY_TS_I2Cx_SDA_GPIO_PORT GPIOB
|
||||
#define DISCOVERY_TS_I2Cx_SCL_SDA_AF GPIO_AF4_I2C2
|
||||
|
||||
/* I2C interrupt requests */
|
||||
#define DISCOVERY_TS_I2Cx_EV_IRQn I2C2_EV_IRQn
|
||||
#define DISCOVERY_TS_I2Cx_ER_IRQn I2C2_ER_IRQn
|
||||
|
||||
/* I2C clock setting */
|
||||
#define DISCOVERY_TS_RCC_PERIPHCLK_I2C RCC_PERIPHCLK_I2C2
|
||||
#define DISCOVERY_TS_RCC_CLKSOURCE_I2C RCC_I2C2CLKSOURCE_SYSCLK
|
||||
|
||||
|
||||
|
||||
/* Definition for Camera I2Cx resources */
|
||||
#define DISCOVERY_CAMERA_I2Cx I2C2
|
||||
#define DISCOVERY_CAMERA_I2Cx_CLK_ENABLE() __HAL_RCC_I2C2_CLK_ENABLE()
|
||||
#define DISCOVERY_CAMERA_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
|
||||
#define DISCOVERY_CAMERA_I2Cx_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define DISCOVERY_CAMERA_I2Cx_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#define DISCOVERY_CAMERA_I2Cx_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOH_CLK_ENABLE()
|
||||
#define DISCOVERY_CAMERA_I2Cx_SCL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOH_CLK_DISABLE()
|
||||
|
||||
#define DISCOVERY_CAMERA_I2Cx_FORCE_RESET() __HAL_RCC_I2C2_FORCE_RESET()
|
||||
#define DISCOVERY_CAMERA_I2Cx_RELEASE_RESET() __HAL_RCC_I2C2_RELEASE_RESET()
|
||||
|
||||
/* Definition for I2Cx Pins */
|
||||
#define DISCOVERY_CAMERA_I2Cx_SCL_PIN GPIO_PIN_4
|
||||
#define DISCOVERY_CAMERA_I2Cx_SCL_GPIO_PORT GPIOH
|
||||
#define DISCOVERY_CAMERA_I2Cx_SDA_PIN GPIO_PIN_14
|
||||
#define DISCOVERY_CAMERA_I2Cx_SDA_GPIO_PORT GPIOB
|
||||
#define DISCOVERY_CAMERA_I2Cx_SCL_SDA_AF GPIO_AF4_I2C2
|
||||
|
||||
/* I2C interrupt requests */
|
||||
#define DISCOVERY_CAMERA_I2Cx_EV_IRQn I2C2_EV_IRQn
|
||||
#define DISCOVERY_CAMERA_I2Cx_ER_IRQn I2C2_ER_IRQn
|
||||
|
||||
/* I2C clock setting */
|
||||
#define DISCOVERY_CAMERA_RCC_PERIPHCLK_I2C RCC_PERIPHCLK_I2C2
|
||||
#define DISCOVERY_CAMERA_RCC_CLKSOURCE_I2C RCC_I2C2CLKSOURCE_SYSCLK
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Definition for external, camera and Arduino connector I2Cx resources */ /* to be reviewed */
|
||||
#define DISCOVERY_EXT_I2Cx I2C2
|
||||
#define DISCOVERY_EXT_I2Cx_CLK_ENABLE() __HAL_RCC_I2C2_CLK_ENABLE()
|
||||
#define DISCOVERY_EXT_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
|
||||
#define DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
|
||||
#define DISCOVERY_EXT_I2Cx_FORCE_RESET() __HAL_RCC_I2C2_FORCE_RESET()
|
||||
#define DISCOVERY_EXT_I2Cx_RELEASE_RESET() __HAL_RCC_I2C2_RELEASE_RESET()
|
||||
|
||||
/* Definition for I2Cx Pins */
|
||||
#define DISCOVERY_EXT_I2Cx_SCL_PIN GPIO_PIN_10
|
||||
#define DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_PORT GPIOB
|
||||
#define DISCOVERY_EXT_I2Cx_SCL_AF GPIO_AF4_I2C2
|
||||
#define DISCOVERY_EXT_I2Cx_SDA_AF GPIO_AF4_I2C2
|
||||
#define DISCOVERY_EXT_I2Cx_SDA_PIN GPIO_PIN_9
|
||||
|
||||
/* I2C interrupt requests */
|
||||
#define DISCOVERY_EXT_I2Cx_EV_IRQn I2C2_EV_IRQn
|
||||
#define DISCOVERY_EXT_I2Cx_ER_IRQn I2C2_ER_IRQn
|
||||
|
||||
#ifndef DISCOVERY_I2C_SPEED
|
||||
#define DISCOVERY_I2C_SPEED 100000
|
||||
#endif /* DISCOVERY_I2C_SPEED */
|
||||
|
||||
|
||||
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||
|
||||
|
||||
|
||||
/*##################### Audio Codec ##########################*/
|
||||
/**
|
||||
* @brief Audio codec chip reset definition
|
||||
*/
|
||||
/* Audio codec power on/off macro definition */
|
||||
#define CODEC_AUDIO_POWER_OFF() HAL_GPIO_WritePin(AUDIO_RESET_GPIO, AUDIO_RESET_PIN, GPIO_PIN_RESET)
|
||||
#define CODEC_AUDIO_POWER_ON() HAL_GPIO_WritePin(AUDIO_RESET_GPIO, AUDIO_RESET_PIN, GPIO_PIN_SET)
|
||||
|
||||
/* Audio Reset Pin definition */
|
||||
#define AUDIO_RESET_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define AUDIO_RESET_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
#define AUDIO_RESET_PIN GPIO_PIN_6
|
||||
#define AUDIO_RESET_GPIO GPIOC
|
||||
|
||||
|
||||
|
||||
|
||||
/*##################### MFX ##########################*/
|
||||
/**
|
||||
* @brief MFX interface pins
|
||||
*/
|
||||
|
||||
#define MFX_INT_GPIO_PORT GPIOC /* GPIOC */
|
||||
#define MFX_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define MFX_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
#define MFX_INT_PIN GPIO_PIN_5 /* PC.05 */
|
||||
#define MFX_INT_EXTI_IRQn EXTI9_5_IRQn
|
||||
|
||||
#define MFX_WAKEUP_GPIO_PORT GPIOH /* GPIOH */
|
||||
#define MFX_WAKEUP_GPIO_CLK_ENABLE() __HAL_RCC_GPIOH_CLK_ENABLE()
|
||||
#define MFX_WAKEUP_GPIO_CLK_DISABLE() __HAL_RCC_GPIOH_CLK_DISABLE()
|
||||
#define MFX_WAKEUP_PIN GPIO_PIN_6 /* PH.06 */
|
||||
|
||||
|
||||
|
||||
/* Legacy */
|
||||
#define IDD_INT_GPIO_PORT MFX_INT_GPIO_PORT
|
||||
#define IDD_INT_GPIO_CLK_ENABLE() MFX_INT_GPIO_CLK_ENABLE()
|
||||
#define IDD_INT_GPIO_CLK_DISABLE() MFX_INT_GPIO_CLK_DISABLE()
|
||||
#define IDD_INT_PIN MFX_INT_PIN
|
||||
#define IDD_INT_EXTI_IRQn MFX_INT_EXTI_IRQn
|
||||
#define IDD_WAKEUP_GPIO_PORT MFX_WAKEUP_GPIO_PORT
|
||||
#define IDD_WAKEUP_GPIO_CLK_ENABLE() MFX_WAKEUP_GPIO_CLK_ENABLE()
|
||||
#define IDD_WAKEUP_GPIO_CLK_DISABLE() MFX_WAKEUP_GPIO_CLK_DISABLE()
|
||||
#define IDD_WAKEUP_PIN MFX_WAKEUP_PIN
|
||||
|
||||
|
||||
/**
|
||||
* @brief Idd current measurement interface pins on MFX
|
||||
*/
|
||||
#define IDD_AMP_CONTROL_PIN AGPIO_PIN_1
|
||||
|
||||
/**
|
||||
* @brief TS INT pin
|
||||
*/
|
||||
#define TS_INT_PIN GPIO_PIN_14
|
||||
#define TS_INT_GPIO_PORT GPIOG
|
||||
#define TS_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
|
||||
#define TS_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
|
||||
#define TS_INT_EXTI_IRQn EXTI15_10_IRQn
|
||||
|
||||
/**
|
||||
* @brief TS RST pin
|
||||
*/
|
||||
/* TS RST is accessed thru the MFX */
|
||||
#define TS_RST_PIN IO1_PIN_1
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_Exported_Functions Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint32_t BSP_GetVersion(void);
|
||||
void BSP_LED_Init(Led_TypeDef Led);
|
||||
void BSP_LED_DeInit(Led_TypeDef Led);
|
||||
void BSP_LED_On(Led_TypeDef Led);
|
||||
void BSP_LED_Off(Led_TypeDef Led);
|
||||
void BSP_LED_Toggle(Led_TypeDef Led);
|
||||
uint8_t BSP_JOY_Init(JOYMode_TypeDef Joy_Mode);
|
||||
void BSP_JOY_DeInit(void);
|
||||
JOYState_TypeDef BSP_JOY_GetState(void);
|
||||
#if defined(HAL_UART_MODULE_ENABLED)
|
||||
void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart);
|
||||
void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart);
|
||||
#endif /* HAL_UART_MODULE_ENABLED */
|
||||
|
||||
/* These __weak functions can be surcharged by application code for specific application needs */
|
||||
void BSP_ErrorHandler(void);
|
||||
|
||||
|
||||
void FMC_BANK1_MspInit(void);
|
||||
void FMC_BANK1_MspDeInit(void);
|
||||
#if defined(HAL_I2C_MODULE_ENABLED)
|
||||
void I2C2_Init(void);
|
||||
void I2C2_DeInit(void);
|
||||
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L496G_DISCOVERY_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,286 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l496g_discovery_audio.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the common defines and functions prototypes for
|
||||
* the stm32l496g_discovery_audio.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32L496G_DISCOVERY_AUDIO_H
|
||||
#define __STM32L496G_DISCOVERY_AUDIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#if defined(BSP_AUDIO_USE_RTOS)
|
||||
#include "k_mem.h"
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
/* Include audio component Driver */
|
||||
#include "../Components/cs42l51/cs42l51.h"
|
||||
#include "stm32l496g_discovery.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY_AUDIO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_AUDIO_Exported_Types Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef void (*Audio_CallbackTypeDef)(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_AUDIO_Exported_Constants Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/** @defgroup BSP_Audio_Out_Option BSP Audio Out Option
|
||||
* @{
|
||||
*/
|
||||
#define BSP_AUDIO_OUT_CIRCULARMODE ((uint32_t)0x00000001) /* BUFFER CIRCULAR MODE */
|
||||
#define BSP_AUDIO_OUT_NORMALMODE ((uint32_t)0x00000002) /* BUFFER NORMAL MODE */
|
||||
#define BSP_AUDIO_OUT_STEREOMODE ((uint32_t)0x00000004) /* STEREO MODE */
|
||||
#define BSP_AUDIO_OUT_MONOMODE ((uint32_t)0x00000008) /* MONO MODE */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup BSP_Audio_Sample_Rate BSP Audio Sample Rate
|
||||
* @{
|
||||
*/
|
||||
#define BSP_AUDIO_FREQUENCY_96K SAI_AUDIO_FREQUENCY_96K
|
||||
#define BSP_AUDIO_FREQUENCY_48K SAI_AUDIO_FREQUENCY_48K
|
||||
#define BSP_AUDIO_FREQUENCY_44K SAI_AUDIO_FREQUENCY_44K
|
||||
#define BSP_AUDIO_FREQUENCY_32K SAI_AUDIO_FREQUENCY_32K
|
||||
#define BSP_AUDIO_FREQUENCY_22K SAI_AUDIO_FREQUENCY_22K
|
||||
#define BSP_AUDIO_FREQUENCY_16K SAI_AUDIO_FREQUENCY_16K
|
||||
#define BSP_AUDIO_FREQUENCY_11K SAI_AUDIO_FREQUENCY_11K
|
||||
#define BSP_AUDIO_FREQUENCY_8K SAI_AUDIO_FREQUENCY_8K
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/*------------------------------------------------------------------------------
|
||||
USER SAI defines parameters
|
||||
-----------------------------------------------------------------------------*/
|
||||
/* SAI peripheral configuration defines */
|
||||
#define AUDIO_SAIx_TX_CLK_ENABLE() __HAL_RCC_SAI1_CLK_ENABLE()
|
||||
#define AUDIO_SAIx_TX_CLK_DISABLE() __HAL_RCC_SAI1_CLK_DISABLE()
|
||||
#define AUDIO_SAIx_TX_MCK_SCK_SD_FS_AF GPIO_AF13_SAI1
|
||||
|
||||
#define AUDIO_SAIx_TX_MCK_SCK_SD_FS_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
|
||||
#define AUDIO_SAIx_TX_MCK_SCK_SD_FS_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
|
||||
#define AUDIO_SAIx_TX_FS_PIN GPIO_PIN_4
|
||||
#define AUDIO_SAIx_TX_SCK_PIN GPIO_PIN_5
|
||||
#define AUDIO_SAIx_TX_SD_PIN GPIO_PIN_6
|
||||
#define AUDIO_SAIx_TX_MCK_PIN GPIO_PIN_2
|
||||
#define AUDIO_SAIx_TX_MCK_SCK_SD_FS_GPIO_PORT GPIOE
|
||||
|
||||
/* SAI DMA Channel definitions */
|
||||
#define AUDIO_SAIx_DMAx_CLK_ENABLE() __HAL_RCC_DMA2_CLK_ENABLE()
|
||||
#define AUDIO_SAIx_DMAx_CLK_DISABLE() __HAL_RCC_DMA2_CLK_DISABLE()
|
||||
#define AUDIO_SAIx_DMAx_CHANNEL DMA2_Channel1
|
||||
#define AUDIO_SAIx_DMAx_IRQ DMA2_Channel1_IRQn
|
||||
#define AUDIO_SAIx_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_HALFWORD
|
||||
#define AUDIO_SAIx_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_HALFWORD
|
||||
#define DMA_MAX_SZE (uint32_t)0xFFFF
|
||||
|
||||
#define AUDIO_SAIx_DMAx_IRQHandler DMA2_Channel1_IRQHandler
|
||||
|
||||
/* Select the interrupt preemption priority for the DMA interrupt */
|
||||
#define AUDIO_OUT_IRQ_PREPRIO 5 /* Select the preemption priority level(0 is the highest) */
|
||||
|
||||
/* Disable SAIx PLL */
|
||||
#define AUDIO_SAIx_PLL_DISABLE() HAL_RCCEx_DisablePLLSAI2()
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
AUDIO IN CONFIGURATION
|
||||
------------------------------------------------------------------------------*/
|
||||
/* DFSDM Configuration defines */
|
||||
#define AUDIO_DFSDMx_LEFT_CHANNEL DFSDM1_Channel2
|
||||
#define AUDIO_DFSDMx_LEFT_FILTER DFSDM1_Filter0
|
||||
#define AUDIO_DFSDMx_CLK_ENABLE() __HAL_RCC_DFSDM1_CLK_ENABLE()
|
||||
#define AUDIO_DFSDMx_CLK_DISABLE() __HAL_RCC_DFSDM1_CLK_DISABLE()
|
||||
#define AUDIO_DFSDMx_CKOUT_PIN GPIO_PIN_9
|
||||
#define AUDIO_DFSDMx_DMIC_DATIN_PIN GPIO_PIN_7
|
||||
#define AUDIO_DFSDMx_CKOUT_DMIC_DATIN_GPIO_PORT GPIOE
|
||||
#define AUDIO_DFSDMx_CKOUT_DMIC_DATIN_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
|
||||
#define AUDIO_DFSDMx_CKOUT_DMIC_DATIN_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
|
||||
#define AUDIO_DFSDMx_CKOUT_DMIC_DATIN_AF GPIO_AF6_DFSDM1
|
||||
|
||||
/* DFSDM DMA Right and Left channels definitions */
|
||||
#define AUDIO_DFSDMx_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
|
||||
#define AUDIO_DFSDMx_DMAx_CLK_DISABLE() __HAL_RCC_DMA1_CLK_DISABLE()
|
||||
#define AUDIO_DFSDMx_DMAx_LEFT_CHANNEL DMA1_Channel4
|
||||
#define AUDIO_DFSDMx_DMAx_LEFT_IRQ DMA1_Channel4_IRQn
|
||||
#define AUDIO_DFSDM_DMAx_LEFT_IRQHandler DMA1_Channel4_IRQHandler
|
||||
#define AUDIO_DFSDMx_DMAx_RIGHT_CHANNEL DMA1_Channel5
|
||||
#define AUDIO_DFSDMx_DMAx_RIGHT_IRQ DMA1_Channel5_IRQn
|
||||
#define AUDIO_DFSDM_DMAx_RIGHT_IRQHandler DMA1_Channel5_IRQHandler
|
||||
#define AUDIO_DFSDMx_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_WORD
|
||||
#define AUDIO_DFSDMx_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_WORD
|
||||
|
||||
|
||||
/* Select the interrupt preemption priority and subpriority for the IT/DMA interrupt */
|
||||
#define AUDIO_IN_IRQ_PREPRIO 6 /* Select the preemption priority level(0 is the highest) */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
CONFIGURATION: Audio Driver Configuration parameters
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#define AUDIODATA_SIZE 2 /* 16-bits audio data size */
|
||||
|
||||
/* Audio status definition */
|
||||
#define AUDIO_OK 0
|
||||
#define AUDIO_ERROR 1
|
||||
#define AUDIO_TIMEOUT 2
|
||||
|
||||
/* Audio out parameters */
|
||||
#define DEFAULT_AUDIO_OUT_FREQ BSP_AUDIO_FREQUENCY_48K
|
||||
#define DEFAULT_AUDIO_OUT_BIT_RESOLUTION ((uint8_t)16)
|
||||
#define DEFAULT_AUDIO_OUT_CHANNEL_NBR ((uint8_t)2) /* Mono = 1, Stereo = 2 */
|
||||
#define DEFAULT_AUDIO_OUT_VOLUME ((uint16_t)80)
|
||||
|
||||
/* AudioFreq * DataSize (2 bytes) * NumChannels (Stereo: 2) */
|
||||
#define DEFAULT_AUDIO_IN_FREQ BSP_AUDIO_FREQUENCY_16K
|
||||
#define DEFAULT_AUDIO_IN_BIT_RESOLUTION 16
|
||||
#define DEFAULT_AUDIO_IN_CHANNEL_NBR 1 /* Mono = 1, Stereo = 2 */
|
||||
#define DEFAULT_AUDIO_IN_VOLUME 80
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
OPTIONAL Configuration defines parameters
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* Delay for the Codec to be correctly reset */
|
||||
#define CODEC_RESET_DELAY 5
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
INPUT DEVICES definition
|
||||
------------------------------------------------------------------------------*/
|
||||
/* MP34DT01TR digital microphone on PCB top side */
|
||||
#define INPUT_DEVICE_DIGITAL_MIC1 0x20 /* Left microphone */
|
||||
#define INPUT_DEVICE_DIGITAL_MIC2 0x40 /* Right microphone */
|
||||
#define INPUT_DEVICE_DIGITAL_MIC (INPUT_DEVICE_DIGITAL_MIC1 | INPUT_DEVICE_DIGITAL_MIC2)
|
||||
/* Analog microphone input from 3.5 audio jack connector */
|
||||
#define INPUT_DEVICE_ANALOG_MIC INPUT_DEVICE_MIC1
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_AUDIO_Exported_Variables Exported Variables
|
||||
* @{
|
||||
*/
|
||||
extern SAI_HandleTypeDef BSP_AUDIO_hSai_Tx;
|
||||
extern SAI_HandleTypeDef BSP_AUDIO_hSai_Rx;
|
||||
extern DFSDM_Filter_HandleTypeDef BSP_AUDIO_hDfsdmLeftFilter;
|
||||
extern DFSDM_Filter_HandleTypeDef BSP_AUDIO_hDfsdmRightFilter;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_AUDIO_Exported_Macros Exported Macros
|
||||
* @{
|
||||
*/
|
||||
#define DMA_MAX(_X_) (((_X_) <= DMA_MAX_SZE)? (_X_):DMA_MAX_SZE)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @defgroup STM32L496G_DISCOVERY_AUDIO_Exported_Functions Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq);
|
||||
uint8_t BSP_AUDIO_OUT_DeInit(void);
|
||||
uint8_t BSP_AUDIO_OUT_Play(uint16_t *pData, uint32_t Size);
|
||||
uint8_t BSP_AUDIO_OUT_ChangeBuffer(uint16_t *pData, uint16_t Size);
|
||||
uint8_t BSP_AUDIO_OUT_Pause(void);
|
||||
uint8_t BSP_AUDIO_OUT_Resume(void);
|
||||
uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option);
|
||||
uint8_t BSP_AUDIO_OUT_SetVolume(uint8_t Volume);
|
||||
uint8_t BSP_AUDIO_OUT_SetFrequency(uint32_t AudioFreq);
|
||||
void BSP_AUDIO_OUT_ChangeAudioConfig(uint32_t AudioOutOption);
|
||||
uint8_t BSP_AUDIO_OUT_SetMute(uint32_t Cmd);
|
||||
uint8_t BSP_AUDIO_OUT_SetOutputMode(uint8_t Output);
|
||||
void BSP_AUDIO_OUT_RegisterCallbacks(Audio_CallbackTypeDef ErrorCallback,
|
||||
Audio_CallbackTypeDef HalfTransferCallback,
|
||||
Audio_CallbackTypeDef TransferCompleteCallback);
|
||||
|
||||
uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr);
|
||||
uint8_t BSP_AUDIO_IN_InitEx(uint16_t InputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr);
|
||||
uint8_t BSP_AUDIO_IN_DeInit(void);
|
||||
uint8_t BSP_AUDIO_IN_Record(uint16_t *pData, uint32_t Size);
|
||||
uint8_t BSP_AUDIO_IN_SetFrequency(uint32_t AudioFreq);
|
||||
uint8_t BSP_AUDIO_IN_Stop(void);
|
||||
uint8_t BSP_AUDIO_IN_Pause(void);
|
||||
uint8_t BSP_AUDIO_IN_Resume(void);
|
||||
void BSP_AUDIO_IN_RegisterCallbacks(Audio_CallbackTypeDef ErrorCallback,
|
||||
Audio_CallbackTypeDef HalfTransferCallback,
|
||||
Audio_CallbackTypeDef TransferCompleteCallback);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L496G_DISCOVERY_AUDIO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,630 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l496g_discovery_camera.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file includes the driver for Camera modules mounted on
|
||||
* STM32L496G-Discovery board.
|
||||
@verbatim
|
||||
How to use this driver:
|
||||
------------------------
|
||||
- This driver is used to drive the camera.
|
||||
- The OV9655 component driver MUST be included with this driver.
|
||||
|
||||
Driver description:
|
||||
-------------------
|
||||
+ Initialization steps:
|
||||
o Initialize the camera using the BSP_CAMERA_Init() function.
|
||||
o Start the camera capture/snapshot using the CAMERA_Start() function.
|
||||
o Suspend, resume or stop the camera capture using the following functions:
|
||||
- BSP_CAMERA_Suspend()
|
||||
- BSP_CAMERA_Resume()
|
||||
- BSP_CAMERA_Stop()
|
||||
|
||||
+ Options
|
||||
o Increase or decrease on the fly the brightness and/or contrast
|
||||
using the following function:
|
||||
- BSP_CAMERA_ContrastBrightnessConfig
|
||||
o Add a special effect on the fly using the following functions:
|
||||
- BSP_CAMERA_BlackWhiteConfig()
|
||||
- BSP_CAMERA_ColorEffectConfig()
|
||||
@endverbatim
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l496g_discovery_camera.h"
|
||||
#include "stm32l496g_discovery.h"
|
||||
#include "stm32l496g_discovery_io.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY_CAMERA
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_CAMERA_Private_TypesDefinitions STM32L496G_DISCOVERY_CAMERA Private Types Definitions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_CAMERA_Private_Defines STM32L496G_DISCOVERY_CAMERA Private Defines
|
||||
* @{
|
||||
*/
|
||||
#define CAMERA_VGA_RES_X 640
|
||||
#define CAMERA_VGA_RES_Y 480
|
||||
#define CAMERA_480x272_RES_X 480
|
||||
#define CAMERA_480x272_RES_Y 272
|
||||
#define CAMERA_QVGA_RES_X 320
|
||||
#define CAMERA_QVGA_RES_Y 240
|
||||
#define CAMERA_QQVGA_RES_X 160
|
||||
#define CAMERA_QQVGA_RES_Y 120
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_CAMERA_Private_Macros STM32L496G_DISCOVERY_CAMERA Private Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_CAMERA_Private_Variables STM32L496G_DISCOVERY_CAMERA Private Variables
|
||||
* @{
|
||||
*/
|
||||
DCMI_HandleTypeDef hDcmiHandler;
|
||||
CAMERA_DrvTypeDef *camera_drv;
|
||||
/* Camera current resolution naming (QQVGA, VGA, ...) */
|
||||
static uint32_t CameraCurrentResolution;
|
||||
|
||||
/* Camera module I2C HW address */
|
||||
static uint32_t CameraHwAddress;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_CAMERA_Private_FunctionPrototypes STM32L496G_DISCOVERY_CAMERA Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
static uint32_t GetSize(uint32_t resolution);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_CAMERA_Exported_Functions STM32L496G_DISCOVERY_CAMERA Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes the camera.
|
||||
* @param Resolution : camera sensor requested resolution (x, y) : standard resolution
|
||||
* naming QQVGA, QVGA, VGA ...
|
||||
* @retval Camera status
|
||||
*/
|
||||
uint8_t BSP_CAMERA_Init(uint32_t Resolution)
|
||||
{
|
||||
DCMI_HandleTypeDef *phdcmi;
|
||||
uint8_t status = CAMERA_ERROR;
|
||||
|
||||
/* Get the DCMI handle structure */
|
||||
phdcmi = &hDcmiHandler;
|
||||
|
||||
|
||||
/* Initialize the IO functionalities */
|
||||
BSP_IO_Init();
|
||||
|
||||
|
||||
/*** Configures the DCMI to interface with the camera module ***/
|
||||
/* DCMI configuration */
|
||||
phdcmi->Init.CaptureRate = DCMI_CR_ALL_FRAME;
|
||||
phdcmi->Init.HSPolarity = DCMI_HSPOLARITY_HIGH;
|
||||
phdcmi->Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
|
||||
phdcmi->Init.VSPolarity = DCMI_VSPOLARITY_HIGH;
|
||||
phdcmi->Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
|
||||
phdcmi->Init.PCKPolarity = DCMI_PCKPOLARITY_RISING;
|
||||
phdcmi->Init.ByteSelectMode = DCMI_BSM_ALL;
|
||||
phdcmi->Init.LineSelectMode = DCMI_LSM_ALL;
|
||||
phdcmi->Instance = DCMI;
|
||||
|
||||
/* Camera initialization */
|
||||
BSP_CAMERA_MspInit(&hDcmiHandler, NULL);
|
||||
|
||||
/* Read ID of Camera module via I2C */
|
||||
if (ov9655_ReadID(CAMERA_I2C_ADDRESS) == OV9655_ID)
|
||||
{
|
||||
/* Initialize the camera driver structure */
|
||||
camera_drv = &ov9655_drv;
|
||||
CameraHwAddress = CAMERA_I2C_ADDRESS;
|
||||
|
||||
/* DCMI Initialization */
|
||||
HAL_DCMI_Init(phdcmi);
|
||||
|
||||
/* Camera Module Initialization via I2C to the wanted 'Resolution' */
|
||||
if (Resolution == CAMERA_R320x240)
|
||||
{
|
||||
/* For 240x240 resolution, the OV9655 sensor is set to QVGA resolution
|
||||
* as OV9655 doesn't supports 240x240 resolution,
|
||||
* then DCMI is configured to output a 240x240 cropped window */
|
||||
camera_drv->Init(CameraHwAddress, CAMERA_R320x240);
|
||||
|
||||
|
||||
HAL_DCMI_ConfigCROP(phdcmi,
|
||||
40, /* Crop in the middle of the VGA picture */
|
||||
0, /* Same height (same number of lines: no need to crop vertically) */
|
||||
(240 * 2) - 1, /* 2 pixels clock needed to capture one pixel */
|
||||
(240 * 1) - 1); /* All 240 lines are captured */
|
||||
HAL_DCMI_EnableCROP(phdcmi);
|
||||
|
||||
|
||||
/* Set the RGB565 mode */
|
||||
MFX_IO_Write(CameraHwAddress, 0x12 /*OV9655_COM7*/, 0x63);
|
||||
MFX_IO_Write(CameraHwAddress, 0x40 /*OV9655_COM15*/, 0x10);
|
||||
/* Invert the HRef signal */
|
||||
MFX_IO_Write(CameraHwAddress, 0x15 /*OV9655_COM10*/, 0x08);
|
||||
HAL_Delay(500);
|
||||
}
|
||||
else
|
||||
{
|
||||
camera_drv->Init(CameraHwAddress, Resolution);
|
||||
HAL_DCMI_DisableCROP(phdcmi);
|
||||
}
|
||||
|
||||
CameraCurrentResolution = Resolution;
|
||||
|
||||
/* Return CAMERA_OK status */
|
||||
status = CAMERA_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Return CAMERA_NOT_SUPPORTED status */
|
||||
status = CAMERA_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitializes the camera.
|
||||
* @retval Camera status
|
||||
*/
|
||||
uint8_t BSP_CAMERA_DeInit(void)
|
||||
{
|
||||
hDcmiHandler.Instance = DCMI;
|
||||
|
||||
HAL_DCMI_DeInit(&hDcmiHandler);
|
||||
BSP_CAMERA_MspDeInit(&hDcmiHandler, NULL);
|
||||
return CAMERA_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Starts the camera capture in continuous mode.
|
||||
* @param buff: pointer to the camera output buffer
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_CAMERA_ContinuousStart(uint8_t *buff)
|
||||
{
|
||||
/* Start the camera capture */
|
||||
HAL_DCMI_Start_DMA(&hDcmiHandler, DCMI_MODE_CONTINUOUS, (uint32_t)buff, GetSize(CameraCurrentResolution));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Starts the camera capture in snapshot mode.
|
||||
* @param buff: pointer to the camera output buffer
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_CAMERA_SnapshotStart(uint8_t *buff)
|
||||
{
|
||||
/* Start the camera capture */
|
||||
HAL_DCMI_Start_DMA(&hDcmiHandler, DCMI_MODE_SNAPSHOT, (uint32_t)buff, GetSize(CameraCurrentResolution));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Suspend the CAMERA capture
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_CAMERA_Suspend(void)
|
||||
{
|
||||
/* Suspend the Camera Capture */
|
||||
HAL_DCMI_Suspend(&hDcmiHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resume the CAMERA capture
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_CAMERA_Resume(void)
|
||||
{
|
||||
/* Start the Camera Capture */
|
||||
HAL_DCMI_Resume(&hDcmiHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stop the CAMERA capture
|
||||
* @retval Camera status
|
||||
*/
|
||||
uint8_t BSP_CAMERA_Stop(void)
|
||||
{
|
||||
uint8_t status = CAMERA_ERROR;
|
||||
|
||||
if (HAL_DCMI_Stop(&hDcmiHandler) == HAL_OK)
|
||||
{
|
||||
status = CAMERA_OK;
|
||||
}
|
||||
|
||||
/* Set Camera in Power Down */
|
||||
BSP_CAMERA_PwrDown();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CANERA power up
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_CAMERA_PwrUp(void)
|
||||
{
|
||||
/* De-assert the camera POWER_DOWN pin (active high) */
|
||||
BSP_IO_WritePin(CAMERA_PWR_EN_PIN, GPIO_PIN_RESET);
|
||||
|
||||
HAL_Delay(3); /* POWER_DOWN de-asserted during 3ms */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CAMERA power down
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_CAMERA_PwrDown(void)
|
||||
{
|
||||
/* Assert the camera POWER_DOWN pin (active high) */
|
||||
BSP_IO_WritePin(CAMERA_PWR_EN_PIN, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the camera contrast and brightness.
|
||||
* @param contrast_level: Contrast level
|
||||
* This parameter can be one of the following values:
|
||||
* @arg CAMERA_CONTRAST_LEVEL4: for contrast +2
|
||||
* @arg CAMERA_CONTRAST_LEVEL3: for contrast +1
|
||||
* @arg CAMERA_CONTRAST_LEVEL2: for contrast 0
|
||||
* @arg CAMERA_CONTRAST_LEVEL1: for contrast -1
|
||||
* @arg CAMERA_CONTRAST_LEVEL0: for contrast -2
|
||||
* @param brightness_level: Contrast level
|
||||
* This parameter can be one of the following values:
|
||||
* @arg CAMERA_BRIGHTNESS_LEVEL4: for brightness +2
|
||||
* @arg CAMERA_BRIGHTNESS_LEVEL3: for brightness +1
|
||||
* @arg CAMERA_BRIGHTNESS_LEVEL2: for brightness 0
|
||||
* @arg CAMERA_BRIGHTNESS_LEVEL1: for brightness -1
|
||||
* @arg CAMERA_BRIGHTNESS_LEVEL0: for brightness -2
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_CAMERA_ContrastBrightnessConfig(uint32_t contrast_level, uint32_t brightness_level)
|
||||
{
|
||||
if (camera_drv->Config != NULL)
|
||||
{
|
||||
camera_drv->Config(CameraHwAddress, CAMERA_CONTRAST_BRIGHTNESS, contrast_level, brightness_level);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the camera white balance.
|
||||
* @param Mode: black_white mode
|
||||
* This parameter can be one of the following values:
|
||||
* @arg CAMERA_BLACK_WHITE_BW
|
||||
* @arg CAMERA_BLACK_WHITE_NEGATIVE
|
||||
* @arg CAMERA_BLACK_WHITE_BW_NEGATIVE
|
||||
* @arg CAMERA_BLACK_WHITE_NORMAL
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_CAMERA_BlackWhiteConfig(uint32_t Mode)
|
||||
{
|
||||
if (camera_drv->Config != NULL)
|
||||
{
|
||||
camera_drv->Config(CameraHwAddress, CAMERA_BLACK_WHITE, Mode, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the camera color effect.
|
||||
* @param Effect: Color effect
|
||||
* This parameter can be one of the following values:
|
||||
* @arg CAMERA_COLOR_EFFECT_ANTIQUE
|
||||
* @arg CAMERA_COLOR_EFFECT_BLUE
|
||||
* @arg CAMERA_COLOR_EFFECT_GREEN
|
||||
* @arg CAMERA_COLOR_EFFECT_RED
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_CAMERA_ColorEffectConfig(uint32_t Effect)
|
||||
{
|
||||
if (camera_drv->Config != NULL)
|
||||
{
|
||||
camera_drv->Config(CameraHwAddress, CAMERA_COLOR_EFFECT, Effect, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the capture size in pixels unit.
|
||||
* @param resolution: the current resolution.
|
||||
* @retval capture size in pixels unit.
|
||||
*/
|
||||
static uint32_t GetSize(uint32_t resolution)
|
||||
{
|
||||
uint32_t size = 0;
|
||||
|
||||
/* Get capture size */
|
||||
switch (resolution)
|
||||
{
|
||||
case CAMERA_R160x120:
|
||||
{
|
||||
size = 0x2580;
|
||||
}
|
||||
break;
|
||||
case CAMERA_R320x240:
|
||||
{
|
||||
size = 0x9600;
|
||||
}
|
||||
break;
|
||||
case CAMERA_R480x272:
|
||||
{
|
||||
size = 0xFF00;
|
||||
}
|
||||
break;
|
||||
case CAMERA_R640x480:
|
||||
{
|
||||
size = 0x25800;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the DCMI MSP.
|
||||
* @param hdcmi: HDMI handle
|
||||
* @param Params
|
||||
* @retval None
|
||||
*/
|
||||
__weak void BSP_CAMERA_MspInit(DCMI_HandleTypeDef *hdcmi, void *Params)
|
||||
{
|
||||
static DMA_HandleTypeDef hdma_handler;
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
/*** Enable peripherals and GPIO clocks ***/
|
||||
/* Enable DCMI clock */
|
||||
__HAL_RCC_DCMI_CLK_ENABLE();
|
||||
|
||||
/* Enable DMA2 clock */
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
|
||||
/* Enable GPIO clocks */
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOI_CLK_ENABLE();
|
||||
|
||||
HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_SYSCLK, RCC_MCODIV_4);
|
||||
__HAL_RCC_HSI48_ENABLE();
|
||||
HAL_Delay(10); // HSI48 should start in 10ms
|
||||
|
||||
|
||||
/*** Configure the GPIO ***/
|
||||
/* Configure DCMI GPIO as alternate function */
|
||||
gpio_init_structure.Pin = GPIO_PIN_5;
|
||||
gpio_init_structure.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_init_structure.Pull = GPIO_NOPULL;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_HIGH;
|
||||
gpio_init_structure.Alternate = GPIO_AF10_DCMI;
|
||||
HAL_GPIO_Init(GPIOE, &gpio_init_structure);
|
||||
|
||||
|
||||
gpio_init_structure.Pin = GPIO_PIN_5 | GPIO_PIN_8 | GPIO_PIN_9 | \
|
||||
GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_14;
|
||||
gpio_init_structure.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_init_structure.Pull = GPIO_NOPULL;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_HIGH;
|
||||
gpio_init_structure.Alternate = GPIO_AF10_DCMI;
|
||||
HAL_GPIO_Init(GPIOH, &gpio_init_structure);
|
||||
|
||||
gpio_init_structure.Pin = GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_7;
|
||||
gpio_init_structure.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_init_structure.Pull = GPIO_NOPULL;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_HIGH;
|
||||
gpio_init_structure.Alternate = GPIO_AF10_DCMI;
|
||||
HAL_GPIO_Init(GPIOI, &gpio_init_structure);
|
||||
|
||||
/*** Configure the DMA ***/
|
||||
/* Set the parameters to be configured */
|
||||
hdma_handler.Instance = BSP_CAMERA_DMA_INSTANCE;
|
||||
|
||||
hdma_handler.Init.Request = DMA_REQUEST_0;
|
||||
hdma_handler.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_handler.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_handler.Init.MemInc = DMA_MINC_ENABLE; /* Image captured by the DCMI is stored in memory */
|
||||
hdma_handler.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
|
||||
hdma_handler.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
|
||||
hdma_handler.Init.Mode = DMA_CIRCULAR;
|
||||
hdma_handler.Init.Priority = DMA_PRIORITY_HIGH;
|
||||
|
||||
/* Associate the initialized DMA handle to the DCMI handle */
|
||||
__HAL_LINKDMA(hdcmi, DMA_Handle, hdma_handler);
|
||||
|
||||
/*** Configure the NVIC for DCMI and DMA ***/
|
||||
/* NVIC configuration for DCMI transfer complete interrupt */
|
||||
HAL_NVIC_SetPriority(DCMI_IRQn, 0x0F, 0);
|
||||
HAL_NVIC_EnableIRQ(DCMI_IRQn);
|
||||
|
||||
/* NVIC configuration for DMA2D transfer complete interrupt */
|
||||
HAL_NVIC_SetPriority(DMA2_Channel6_IRQn, 0x0F, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA2_Channel6_IRQn);
|
||||
|
||||
/* Configure the DMA stream */
|
||||
HAL_DMA_Init(hdcmi->DMA_Handle);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief DeInitializes the DCMI MSP.
|
||||
* @param hdcmi: HDMI handle
|
||||
* @param Params
|
||||
* @retval None
|
||||
*/
|
||||
__weak void BSP_CAMERA_MspDeInit(DCMI_HandleTypeDef *hdcmi, void *Params)
|
||||
{
|
||||
/* Disable NVIC for DCMI transfer complete interrupt */
|
||||
HAL_NVIC_DisableIRQ(DCMI_IRQn);
|
||||
|
||||
/* Disable NVIC for DMA2 transfer complete interrupt */
|
||||
HAL_NVIC_DisableIRQ(DMA2_Channel6_IRQn);
|
||||
|
||||
/* Configure the DMA stream */
|
||||
HAL_DMA_DeInit(hdcmi->DMA_Handle);
|
||||
|
||||
/* Disable DCMI clock */
|
||||
__HAL_RCC_DCMI_CLK_DISABLE();
|
||||
|
||||
/* GPIO pins clock and DMA clock can be shut down in the application
|
||||
by surcharging this __weak function */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Line event callback
|
||||
* @param hdcmi: pointer to the DCMI handle
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi)
|
||||
{
|
||||
BSP_CAMERA_LineEventCallback();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Line Event callback.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void BSP_CAMERA_LineEventCallback(void)
|
||||
{
|
||||
/* NOTE : This function should not be modified; when the callback is needed,
|
||||
the BSP_CAMERA_LineEventCallback can be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief VSYNC event callback
|
||||
* @param hdcmi: pointer to the DCMI handle
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi)
|
||||
{
|
||||
BSP_CAMERA_VsyncEventCallback();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief VSYNC Event callback.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void BSP_CAMERA_VsyncEventCallback(void)
|
||||
{
|
||||
/* NOTE : This function should not be modified; when the callback is needed,
|
||||
the BSP_CAMERA_VsyncEventCallback can be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Frame event callback
|
||||
* @param hdcmi: pointer to the DCMI handle
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi)
|
||||
{
|
||||
BSP_CAMERA_FrameEventCallback();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Frame Event callback.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void BSP_CAMERA_FrameEventCallback(void)
|
||||
{
|
||||
/* NOTE : This function should not be modified; when the callback is needed,
|
||||
the BSP_CAMERA_FrameEventCallback can be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Error callback
|
||||
* @param hdcmi: pointer to the DCMI handle
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi)
|
||||
{
|
||||
BSP_CAMERA_ErrorCallback();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Error callback.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void BSP_CAMERA_ErrorCallback(void)
|
||||
{
|
||||
/* NOTE : This function should not be modified; when the callback is needed,
|
||||
the BSP_CAMERA_ErrorCallback can be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l496g_discovery_camera.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the common defines and functions prototypes for
|
||||
* the stm32l496g_discovery_camera.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32L496G_DISCOVERY_CAMERA_H
|
||||
#define __STM32L496G_DISCOVERY_CAMERA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Include Camera component Driver */
|
||||
#include "../Components/ov9655/ov9655.h"
|
||||
#include "stm32l496g_discovery.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY_CAMERA
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_CAMERA_Exported_Types STM32L496G_DISCOVERY_CAMERA Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Camera State structures definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CAMERA_OK = 0x00,
|
||||
CAMERA_ERROR = 0x01,
|
||||
CAMERA_TIMEOUT = 0x02,
|
||||
CAMERA_NOT_DETECTED = 0x03,
|
||||
CAMERA_NOT_SUPPORTED = 0x04
|
||||
|
||||
}
|
||||
Camera_StatusTypeDef;
|
||||
|
||||
#define RESOLUTION_R160x120 CAMERA_R160x120 /* QQVGA Resolution */
|
||||
#define RESOLUTION_R320x240 CAMERA_R320x240 /* QVGA Resolution */
|
||||
#define RESOLUTION_R480x272 CAMERA_R480x272 /* 480x272 Resolution */
|
||||
#define RESOLUTION_R640x480 CAMERA_R640x480 /* VGA Resolution */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_CAMERA_Exported_Constants STM32L496G_DISCOVERY_CAMERA Exported Constants
|
||||
* @{
|
||||
*/
|
||||
#define BSP_CAMERA_IRQHandler DCMI_IRQHandler
|
||||
#define BSP_CAMERA_DMA_IRQHandler DMA2_Channel6_IRQHandler
|
||||
#define BSP_CAMERA_DMA_IRQn DMA2_Channel6_IRQn
|
||||
#define BSP_CAMERA_DMA_INSTANCE DMA2_Channel6
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Camera special pins
|
||||
*/
|
||||
/* Camera power up pin */
|
||||
#define CAMERA_PWR_EN_PIN IO1_PIN_6
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY_CAMERA_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_CAMERA_Init(uint32_t Resolution);
|
||||
uint8_t BSP_CAMERA_DeInit(void);
|
||||
void BSP_CAMERA_ContinuousStart(uint8_t *buff);
|
||||
void BSP_CAMERA_SnapshotStart(uint8_t *buff);
|
||||
void BSP_CAMERA_Suspend(void);
|
||||
void BSP_CAMERA_Resume(void);
|
||||
uint8_t BSP_CAMERA_Stop(void);
|
||||
void BSP_CAMERA_PwrUp(void);
|
||||
void BSP_CAMERA_PwrDown(void);
|
||||
void BSP_CAMERA_LineEventCallback(void);
|
||||
void BSP_CAMERA_VsyncEventCallback(void);
|
||||
void BSP_CAMERA_FrameEventCallback(void);
|
||||
void BSP_CAMERA_ErrorCallback(void);
|
||||
|
||||
/* Camera features functions prototype */
|
||||
void BSP_CAMERA_ContrastBrightnessConfig(uint32_t contrast_level, uint32_t brightness_level);
|
||||
void BSP_CAMERA_BlackWhiteConfig(uint32_t Mode);
|
||||
void BSP_CAMERA_ColorEffectConfig(uint32_t Effect);
|
||||
|
||||
/* These functions can be modified in case the current settings (e.g. DMA stream)
|
||||
need to be changed for specific application needs */
|
||||
void BSP_CAMERA_MspInit(DCMI_HandleTypeDef *hdcmi, void *Params);
|
||||
void BSP_CAMERA_MspDeInit(DCMI_HandleTypeDef *hdcmi, void *Params);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L496G_DISCOVERY_CAMERA_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,395 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l496g_discovery_idd.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of firmware functions to manage the
|
||||
* Idd measurement driver for STM32L496G-Discovery board.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l496g_discovery_idd.h"
|
||||
#include "stm32l496g_discovery_io.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_IDD STM32L496G-DISCOVERY IDD
|
||||
* @brief This file includes the Idd driver for STM32L496G-DISCOVERY board.
|
||||
* It allows user to measure MCU Idd current on board, especially in
|
||||
* different low power modes.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_IDD_Private_Defines Private Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_IDD_Private_Variables Private Variables
|
||||
* @{
|
||||
*/
|
||||
static IDD_DrvTypeDef *IddDrv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_IDD_Private_Functions Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_IDD_Exported_Functions Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Configures IDD measurement component.
|
||||
* @retval IDD_OK if no problem during initialization
|
||||
*/
|
||||
uint8_t BSP_IDD_Init(void)
|
||||
{
|
||||
IDD_ConfigTypeDef iddconfig = {0};
|
||||
uint8_t mfxstm32l152_id = 0;
|
||||
uint8_t ret = 0;
|
||||
|
||||
/* wake up mfx component in case it went to standby mode */
|
||||
mfxstm32l152_idd_drv.WakeUp(IDD_I2C_ADDRESS);
|
||||
HAL_Delay(5);
|
||||
|
||||
/* Read ID and verify if the MFX is ready */
|
||||
mfxstm32l152_id = mfxstm32l152_idd_drv.ReadID(IDD_I2C_ADDRESS);
|
||||
|
||||
if ((mfxstm32l152_id == MFXSTM32L152_ID_1) || (mfxstm32l152_id == MFXSTM32L152_ID_2))
|
||||
{
|
||||
/* Initialize the Idd driver structure */
|
||||
IddDrv = &mfxstm32l152_idd_drv;
|
||||
|
||||
/* Initialize the Idd driver */
|
||||
if (IddDrv->Init != NULL)
|
||||
{
|
||||
IddDrv->Init(IDD_I2C_ADDRESS);
|
||||
}
|
||||
|
||||
/* Configure Idd component with default values */
|
||||
iddconfig.AmpliGain = DISCOVERY_IDD_AMPLI_GAIN;
|
||||
iddconfig.VddMin = DISCOVERY_IDD_VDD_MIN;
|
||||
iddconfig.Shunt0Value = DISCOVERY_IDD_SHUNT0_VALUE;
|
||||
iddconfig.Shunt1Value = DISCOVERY_IDD_SHUNT1_VALUE;
|
||||
iddconfig.Shunt2Value = DISCOVERY_IDD_SHUNT2_VALUE;
|
||||
iddconfig.Shunt3Value = 0;
|
||||
iddconfig.Shunt4Value = DISCOVERY_IDD_SHUNT4_VALUE;
|
||||
iddconfig.Shunt0StabDelay = DISCOVERY_IDD_SHUNT0_STABDELAY;
|
||||
iddconfig.Shunt1StabDelay = DISCOVERY_IDD_SHUNT1_STABDELAY;
|
||||
iddconfig.Shunt2StabDelay = DISCOVERY_IDD_SHUNT2_STABDELAY;
|
||||
iddconfig.Shunt3StabDelay = 0;
|
||||
iddconfig.Shunt4StabDelay = DISCOVERY_IDD_SHUNT4_STABDELAY;
|
||||
iddconfig.ShuntNbOnBoard = MFXSTM32L152_IDD_SHUNT_NB_4;
|
||||
iddconfig.ShuntNbUsed = MFXSTM32L152_IDD_SHUNT_NB_4;
|
||||
iddconfig.VrefMeasurement = MFXSTM32L152_IDD_VREF_AUTO_MEASUREMENT_ENABLE;
|
||||
iddconfig.Calibration = MFXSTM32L152_IDD_AUTO_CALIBRATION_ENABLE;
|
||||
iddconfig.PreDelayUnit = MFXSTM32L152_IDD_PREDELAY_20_MS;
|
||||
iddconfig.PreDelayValue = 0x7F;
|
||||
iddconfig.MeasureNb = 100;
|
||||
iddconfig.DeltaDelayUnit = MFXSTM32L152_IDD_DELTADELAY_0_5_MS;
|
||||
iddconfig.DeltaDelayValue = 10;
|
||||
BSP_IDD_Config(iddconfig);
|
||||
|
||||
ret = IDD_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = IDD_ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Unconfigures IDD measurement component.
|
||||
* @retval IDD_OK if no problem during deinitialization
|
||||
*/
|
||||
void BSP_IDD_DeInit(void)
|
||||
{
|
||||
if (IddDrv->DeInit != NULL)
|
||||
{
|
||||
IddDrv->DeInit(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset Idd measurement component.
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_Reset(void)
|
||||
{
|
||||
if (IddDrv->Reset != NULL)
|
||||
{
|
||||
IddDrv->Reset(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turn Idd measurement component in low power (standby/sleep) mode
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_LowPower(void)
|
||||
{
|
||||
if (IddDrv->LowPower != NULL)
|
||||
{
|
||||
IddDrv->LowPower(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start Measurement campaign
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_StartMeasure(void)
|
||||
{
|
||||
|
||||
/* Activate the OPAMP used ny the MFX to measure the current consumption */
|
||||
BSP_IO_ConfigPin(IDD_AMP_CONTROL_PIN, IO_MODE_OUTPUT);
|
||||
BSP_IO_WritePin(IDD_AMP_CONTROL_PIN, GPIO_PIN_RESET);
|
||||
|
||||
if (IddDrv->Start != NULL)
|
||||
{
|
||||
IddDrv->Start(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure Idd component
|
||||
* @param IddConfig: structure of idd parameters
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_Config(IDD_ConfigTypeDef IddConfig)
|
||||
{
|
||||
if (IddDrv->Config != NULL)
|
||||
{
|
||||
IddDrv->Config(IDD_I2C_ADDRESS, IddConfig);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get Idd current value.
|
||||
* @param IddValue: Pointer on u32 to store Idd. Value unit is 10 nA.
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_GetValue(uint32_t *IddValue)
|
||||
{
|
||||
/* De-activate the OPAMP used ny the MFX to measure the current consumption */
|
||||
BSP_IO_ConfigPin(IDD_AMP_CONTROL_PIN, IO_MODE_OUTPUT);
|
||||
BSP_IO_WritePin(IDD_AMP_CONTROL_PIN, GPIO_PIN_RESET);
|
||||
|
||||
if (IddDrv->GetValue != NULL)
|
||||
{
|
||||
IddDrv->GetValue(IDD_I2C_ADDRESS, IddValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable Idd interrupt that warn end of measurement
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_EnableIT(void)
|
||||
{
|
||||
if (IddDrv->EnableIT != NULL)
|
||||
{
|
||||
IddDrv->EnableIT(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear Idd interrupt that warn end of measurement
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_ClearIT(void)
|
||||
{
|
||||
if (IddDrv->ClearIT != NULL)
|
||||
{
|
||||
IddDrv->ClearIT(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get Idd interrupt status
|
||||
* @retval status
|
||||
*/
|
||||
uint8_t BSP_IDD_GetITStatus(void)
|
||||
{
|
||||
if (IddDrv->GetITStatus != NULL)
|
||||
{
|
||||
return (IddDrv->GetITStatus(IDD_I2C_ADDRESS));
|
||||
}
|
||||
else
|
||||
{
|
||||
return IDD_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable Idd interrupt that warn end of measurement
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_DisableIT(void)
|
||||
{
|
||||
if (IddDrv->DisableIT != NULL)
|
||||
{
|
||||
IddDrv->DisableIT(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get Error Code .
|
||||
* @retval Error code or error status
|
||||
*/
|
||||
uint8_t BSP_IDD_ErrorGetCode(void)
|
||||
{
|
||||
if (IddDrv->ErrorGetSrc != NULL)
|
||||
{
|
||||
if ((IddDrv->ErrorGetSrc(IDD_I2C_ADDRESS) & MFXSTM32L152_IDD_ERROR_SRC) != RESET)
|
||||
{
|
||||
if (IddDrv->ErrorGetCode != NULL)
|
||||
{
|
||||
return IddDrv->ErrorGetCode(IDD_I2C_ADDRESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
return IDD_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return IDD_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return IDD_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enable error interrupt that warn end of measurement
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_ErrorEnableIT(void)
|
||||
{
|
||||
if (IddDrv->ErrorEnableIT != NULL)
|
||||
{
|
||||
IddDrv->ErrorEnableIT(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear Error interrupt that warn end of measurement
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_ErrorClearIT(void)
|
||||
{
|
||||
if (IddDrv->ErrorClearIT != NULL)
|
||||
{
|
||||
IddDrv->ErrorClearIT(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get Error interrupt status
|
||||
* @retval Status
|
||||
*/
|
||||
uint8_t BSP_IDD_ErrorGetITStatus(void)
|
||||
{
|
||||
if (IddDrv->ErrorGetITStatus != NULL)
|
||||
{
|
||||
return (IddDrv->ErrorGetITStatus(IDD_I2C_ADDRESS));
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable Error interrupt
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_ErrorDisableIT(void)
|
||||
{
|
||||
if (IddDrv->ErrorDisableIT != NULL)
|
||||
{
|
||||
IddDrv->ErrorDisableIT(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wake up Idd measurement component.
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IDD_WakeUp(void)
|
||||
{
|
||||
if (IddDrv->WakeUp != NULL)
|
||||
{
|
||||
IddDrv->WakeUp(IDD_I2C_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l496g_discovery_idd.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file for stm32l496g_discovery_idd.c module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32L496G_DISCOVERY_IDD_H
|
||||
#define __STM32L496G_DISCOVERY_IDD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l496g_discovery.h"
|
||||
/* Include Idd measurement component driver */
|
||||
#include "../Components/mfxstm32l152/mfxstm32l152.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY_IDD
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_IDD_Exported_Types Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup IDD_Config IDD Config
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
IDD_OK = 0,
|
||||
IDD_TIMEOUT = 1,
|
||||
IDD_ZERO_VALUE = 2,
|
||||
IDD_ERROR = 0xFF
|
||||
}
|
||||
IDD_StatusTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_IDD_Exported_Defines Exported Defines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Shunt values on discovery in milli ohms
|
||||
*/
|
||||
#define DISCOVERY_IDD_SHUNT0_VALUE ((uint16_t) 1000) /*!< value in milliohm */
|
||||
#define DISCOVERY_IDD_SHUNT1_VALUE ((uint16_t) 24) /*!< value in ohm */
|
||||
#define DISCOVERY_IDD_SHUNT2_VALUE ((uint16_t) 620) /*!< value in ohm */
|
||||
#define DISCOVERY_IDD_SHUNT4_VALUE ((uint16_t) 10000) /*!< value in ohm */
|
||||
|
||||
/**
|
||||
* @brief Shunt stabilization delay on discovery in milli ohms
|
||||
*/
|
||||
#define DISCOVERY_IDD_SHUNT0_STABDELAY ((uint8_t) 149) /*!< value in millisec */
|
||||
#define DISCOVERY_IDD_SHUNT1_STABDELAY ((uint8_t) 149) /*!< value in millisec */
|
||||
#define DISCOVERY_IDD_SHUNT2_STABDELAY ((uint8_t) 149) /*!< value in millisec */
|
||||
#define DISCOVERY_IDD_SHUNT4_STABDELAY ((uint8_t) 255) /*!< value in millisec */
|
||||
|
||||
/**
|
||||
* @brief IDD Ampli Gain on discovery
|
||||
*/
|
||||
#define DISCOVERY_IDD_AMPLI_GAIN ((uint16_t) 4967) /*!< value is gain * 100 */
|
||||
|
||||
/**
|
||||
* @brief IDD Vdd Min on discovery
|
||||
*/
|
||||
#define DISCOVERY_IDD_VDD_MIN ((uint16_t) 2000) /*!< value in millivolt */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @defgroup STM32L496G_DISCOVERY_IDD_Exported_Functions Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_IDD_Init(void);
|
||||
void BSP_IDD_DeInit(void);
|
||||
void BSP_IDD_Reset(void);
|
||||
void BSP_IDD_LowPower(void);
|
||||
void BSP_IDD_WakeUp(void);
|
||||
void BSP_IDD_StartMeasure(void);
|
||||
void BSP_IDD_Config(IDD_ConfigTypeDef IddConfig);
|
||||
void BSP_IDD_GetValue(uint32_t *IddValue);
|
||||
void BSP_IDD_EnableIT(void);
|
||||
void BSP_IDD_ClearIT(void);
|
||||
uint8_t BSP_IDD_GetITStatus(void);
|
||||
void BSP_IDD_DisableIT(void);
|
||||
uint8_t BSP_IDD_ErrorGetCode(void);
|
||||
void BSP_IDD_ErrorEnableIT(void);
|
||||
void BSP_IDD_ErrorClearIT(void);
|
||||
uint8_t BSP_IDD_ErrorGetITStatus(void);
|
||||
void BSP_IDD_ErrorDisableIT(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L496G_DISCOVERY_IDD_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,321 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l496g_discovery_io.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the IO pins
|
||||
* on STM32L496G-DISCO evaluation board.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* File Info : -----------------------------------------------------------------
|
||||
User NOTES
|
||||
1. How To use this driver:
|
||||
--------------------------
|
||||
- This driver is used to drive the IO module of the STM32L496G-DISCO evaluation
|
||||
board.
|
||||
- The STMPE811 and STMPE1600 IO expander device component driver must be included with this
|
||||
driver in order to run the IO functionalities commanded by the IO expander
|
||||
device mounted on the evaluation board.
|
||||
|
||||
2. Driver description:
|
||||
---------------------
|
||||
+ Initialization steps:
|
||||
o Initialize the IO module using the BSP_IO_Init() function. This
|
||||
function includes the MSP layer hardware resources initialization and the
|
||||
communication layer configuration to start the IO functionalities use.
|
||||
|
||||
+ IO functionalities use
|
||||
o The IO pin mode is configured when calling the function BSP_IO_ConfigPin(), you
|
||||
must specify the desired IO mode by choosing the "IO_ModeTypedef" parameter
|
||||
predefined value.
|
||||
o If an IO pin is used in interrupt mode, the function BSP_IO_ITGetStatus() is
|
||||
needed to get the interrupt status. To clear the IT pending bits, you should
|
||||
call the function BSP_IO_ITClear() with specifying the IO pending bit to clear.
|
||||
o The IT is handled using the corresponding external interrupt IRQ handler,
|
||||
the user IT callback treatment is implemented on the same external interrupt
|
||||
callback.
|
||||
o To get/set an IO pin combination state you can use the functions
|
||||
BSP_IO_ReadPin()/BSP_IO_WritePin() or the function BSP_IO_TogglePin() to toggle the pin
|
||||
state.
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l496g_discovery_io.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G-DISCO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G-DISCO_IO STM32L496G-DISCO IO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
/** @defgroup STM32L496G-DISCO_IO_Private_Constants Private Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private macros -------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup STM32L496G-DISCO_IO_Private_Macros Private Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
/** @defgroup STM32L496G-DISCO_IO_Private_Variables Private Variables
|
||||
* @{
|
||||
*/
|
||||
static IO_DrvTypeDef *io1_driver;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
|
||||
/** @defgroup STM32L496G-DISCO_IO_Private_Functions Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup STM32L496G-DISCO_IO_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes and configures the IO functionalities and configures all
|
||||
* necessary hardware resources (GPIOs, clocks..).
|
||||
* @note BSP_IO_Init() is using HAL_Delay() function to ensure that stmpe811
|
||||
* IO Expander is correctly reset. HAL_Delay() function provides accurate
|
||||
* delay (in milliseconds) based on variable incremented in SysTick ISR.
|
||||
* This implies that if BSP_IO_Init() is called from a peripheral ISR process,
|
||||
* then the SysTick interrupt must have higher priority (numerically lower)
|
||||
* than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
|
||||
* @retval IO_OK: if all initializations are OK. Other value if error.
|
||||
*/
|
||||
uint8_t BSP_IO_Init(void)
|
||||
{
|
||||
uint8_t ret = IO_ERROR;
|
||||
uint8_t mfxstm32l152_id = 0;
|
||||
|
||||
if (io1_driver == NULL) /* Checks if MFX initialization has been already done */
|
||||
{
|
||||
mfxstm32l152_idd_drv.WakeUp(IO1_I2C_ADDRESS);
|
||||
|
||||
HAL_Delay(10);
|
||||
|
||||
/* Read ID and verify the IO expander is ready */
|
||||
mfxstm32l152_id = mfxstm32l152_io_drv.ReadID(IO1_I2C_ADDRESS);
|
||||
|
||||
if ((mfxstm32l152_id == MFXSTM32L152_ID_1) || (mfxstm32l152_id == MFXSTM32L152_ID_2))
|
||||
{
|
||||
/* Initialize the MFX */
|
||||
io1_driver = &mfxstm32l152_io_drv;
|
||||
|
||||
/* Initialize the MFX IO driver structure */
|
||||
if (io1_driver->Init != NULL)
|
||||
{
|
||||
io1_driver->Init(IO1_I2C_ADDRESS);
|
||||
io1_driver->Start(IO1_I2C_ADDRESS, IO1_PIN_ALL >> IO1_PIN_OFFSET);
|
||||
|
||||
ret = IO_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = IO_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the selected pins IT status.
|
||||
* @param IO_Pin: Selected pins to check the status.
|
||||
* This parameter can be any combination of the IO pins.
|
||||
* @retval Status of the checked IO pin(s).
|
||||
*/
|
||||
uint32_t BSP_IO_ITGetStatus(uint32_t IO_Pin)
|
||||
{
|
||||
uint32_t status = 0;
|
||||
uint32_t io1_pin = 0;
|
||||
|
||||
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
|
||||
|
||||
/* Return the MFX Pin IT status */
|
||||
status |= (io1_driver->ITStatus(IO1_I2C_ADDRESS, io1_pin)) << IO1_PIN_OFFSET;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clears the selected IO IT pending bit.
|
||||
* @param IO_Pin: Selected pins to check the status.
|
||||
* This parameter can be any combination of the IO pins.
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IO_ITClear(uint32_t IO_Pin)
|
||||
{
|
||||
uint32_t io1_pin = 0;
|
||||
|
||||
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
|
||||
|
||||
/* Clears the selected IO Expander 1 pin(s) mode */
|
||||
io1_driver->ClearIT(IO1_I2C_ADDRESS, io1_pin);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the IO pin(s) according to IO mode structure value.
|
||||
* @param IO_Pin: Output pin to be set or reset.
|
||||
* This parameter can be any combination of the IO pins.
|
||||
* @param IO_Mode: IO pin mode to configure
|
||||
* This parameter can be one of the following values:
|
||||
* @arg IO_MODE_INPUT
|
||||
* @arg IO_MODE_OUTPUT
|
||||
* @arg IO_MODE_IT_RISING_EDGE
|
||||
* @arg IO_MODE_IT_FALLING_EDGE
|
||||
* @arg IO_MODE_IT_LOW_LEVEL
|
||||
* @arg IO_MODE_IT_HIGH_LEVEL
|
||||
* @retval IO_OK: if all initializations are OK. Other value if error.
|
||||
*/
|
||||
uint8_t BSP_IO_ConfigPin(uint32_t IO_Pin, IO_ModeTypedef IO_Mode)
|
||||
{
|
||||
uint32_t io1_pin = 0;
|
||||
|
||||
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
|
||||
|
||||
|
||||
/* Configure the selected IO Expander 1 pin(s) mode */
|
||||
io1_driver->Config(IO1_I2C_ADDRESS, io1_pin, IO_Mode);
|
||||
|
||||
return IO_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the selected pins state.
|
||||
* @param IO_Pin: Selected pins to write.
|
||||
* This parameter can be any combination of the IO pins.
|
||||
* @param PinState: New pins state to write
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IO_WritePin(uint32_t IO_Pin, uint8_t PinState)
|
||||
{
|
||||
uint32_t io1_pin = 0;
|
||||
|
||||
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
|
||||
|
||||
/* Sets the IO Expander 1 selected pins state */
|
||||
io1_driver->WritePin(IO1_I2C_ADDRESS, io1_pin, PinState);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the selected pins current state.
|
||||
* @param IO_Pin: Selected pins to read.
|
||||
* This parameter can be any combination of the IO pins.
|
||||
* @retval The current pins state
|
||||
*/
|
||||
uint32_t BSP_IO_ReadPin(uint32_t IO_Pin)
|
||||
{
|
||||
uint32_t pin_state = 0;
|
||||
uint32_t io1_pin = 0;
|
||||
|
||||
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
|
||||
|
||||
/* Gets the IO Expander 1 selected pins current state */
|
||||
pin_state |= (io1_driver->ReadPin(IO1_I2C_ADDRESS, io1_pin)) << IO1_PIN_OFFSET;
|
||||
|
||||
|
||||
return pin_state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggles the selected pins state
|
||||
* @param IO_Pin: Selected pins to toggle.
|
||||
* This parameter can be any combination of the IO pins.
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_IO_TogglePin(uint32_t IO_Pin)
|
||||
{
|
||||
uint32_t io1_pin = 0;
|
||||
|
||||
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
|
||||
|
||||
/* Toggles the IO Expander 1 selected pins state */
|
||||
if (io1_driver->ReadPin(IO1_I2C_ADDRESS, io1_pin) == RESET) /* Set */
|
||||
{
|
||||
BSP_IO_WritePin(io1_pin, GPIO_PIN_SET); /* Reset */
|
||||
}
|
||||
else
|
||||
{
|
||||
BSP_IO_WritePin(io1_pin, GPIO_PIN_RESET); /* Set */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l496g_discovery_io.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the common defines and functions prototypes for
|
||||
* the stm32l496g_eval_io.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32L496G_DISCO_IO_H
|
||||
#define __STM32L496G_DISCO_IO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l496g_discovery.h"
|
||||
#include "../Components/mfxstm32l152/mfxstm32l152.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCO_IO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCO_IO_Exported_Types Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
IO_OK = 0x00,
|
||||
IO_ERROR = 0x01,
|
||||
IO_TIMEOUT = 0x02,
|
||||
IO_ALREADY_INITIALIZED = 0x03
|
||||
}
|
||||
IO_StatusTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCO_IO_Exported_Constants Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/* Virtual pin offset IOExpander1 */
|
||||
#define IO1_PIN_OFFSET 0
|
||||
|
||||
|
||||
/* Pins definition IOExpander */
|
||||
#define IO1_PIN_0 (uint32_t)(0x00000001 << IO1_PIN_OFFSET)
|
||||
#define IO1_PIN_1 (uint32_t)(0x00000002 << IO1_PIN_OFFSET)
|
||||
#define IO1_PIN_2 (uint32_t)(0x00000004 << IO1_PIN_OFFSET)
|
||||
#define IO1_PIN_3 (uint32_t)(0x00000008 << IO1_PIN_OFFSET)
|
||||
#define IO1_PIN_4 (uint32_t)(0x00000010 << IO1_PIN_OFFSET)
|
||||
#define IO1_PIN_5 (uint32_t)(0x00000020 << IO1_PIN_OFFSET)
|
||||
#define IO1_PIN_6 (uint32_t)(0x00000040 << IO1_PIN_OFFSET)
|
||||
#define IO1_PIN_7 (uint32_t)(0x00000080 << IO1_PIN_OFFSET)
|
||||
#define IO1_PIN_8 (uint32_t)(0x00000100 << IO1_PIN_OFFSET)
|
||||
#define AGPIO_PIN_0 (uint32_t)(0x00010000 << IO1_PIN_OFFSET)
|
||||
#define AGPIO_PIN_1 (uint32_t)(0x00020000 << IO1_PIN_OFFSET)
|
||||
|
||||
#define IO1_PIN_ALL (uint32_t)(0x000301FF << IO1_PIN_OFFSET)
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCO_IO_Exported_Functions Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
uint8_t BSP_IO_Init(void);
|
||||
void BSP_IO_ITClear(uint32_t IO_Pin);
|
||||
uint32_t BSP_IO_ITGetStatus(uint32_t IO_Pin);
|
||||
uint8_t BSP_IO_ConfigPin(uint32_t IO_Pin, IO_ModeTypedef IO_Mode);
|
||||
void BSP_IO_WritePin(uint32_t IO_Pin, uint8_t PinState);
|
||||
uint32_t BSP_IO_ReadPin(uint32_t IO_Pin);
|
||||
void BSP_IO_TogglePin(uint32_t IO_Pin);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L496G_DISCO_IO_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,278 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l496g_discovery_lcd.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the common defines and functions prototypes for
|
||||
* the stm32l496g_discovery_lcd.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32L496G_DISCOVERY_LCD_H
|
||||
#define __STM32L496G_DISCOVERY_LCD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l496g_discovery.h"
|
||||
#include "stm32l496g_discovery_io.h"
|
||||
/*#include "../Components/ls016b8uy/ls016b8uy.h"*/
|
||||
#include "../Components/st7789h2/st7789h2.h"
|
||||
#include "../../../Utilities/Fonts/fonts.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L496G_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_LCD STM32L496G-DISCOVERY LCD
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_LCD_Exported_Types STM32L496G DISCOVERY LCD Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t TextColor;
|
||||
uint32_t BackColor;
|
||||
sFONT *pFont;
|
||||
} LCD_DrawPropTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_LCD_Exported_Constants STM32L496G DISCOVERY LCD Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief LCD status structure definition
|
||||
*/
|
||||
#define LCD_OK ((uint8_t)0x00)
|
||||
#define LCD_ERROR ((uint8_t)0x01)
|
||||
#define LCD_TIMEOUT ((uint8_t)0x02)
|
||||
|
||||
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;
|
||||
|
||||
|
||||
#define LCD_ORIENTATION_PORTRAIT ((uint8_t)0x00) /*!< Portrait orientation choice of LCD screen */
|
||||
#define LCD_ORIENTATION_LANDSCAPE ((uint8_t)0x01) /*!< Landscape orientation choice of LCD screen */
|
||||
#define LCD_ORIENTATION_UNDEFINED ((uint8_t)0x02) /*!< Undefined LCD screen orientation */
|
||||
|
||||
|
||||
/**
|
||||
* @brief LCD color
|
||||
*/
|
||||
#define LCD_COLOR_BLUE ((uint16_t)0x001F)
|
||||
#define LCD_COLOR_GREEN ((uint16_t)0x07E0)
|
||||
#define LCD_COLOR_RED ((uint16_t)0xF800)
|
||||
#define LCD_COLOR_CYAN ((uint16_t)0x07FF)
|
||||
#define LCD_COLOR_MAGENTA ((uint16_t)0xF81F)
|
||||
#define LCD_COLOR_YELLOW ((uint16_t)0xFFE0)
|
||||
#define LCD_COLOR_LIGHTBLUE ((uint16_t)0x841F)
|
||||
#define LCD_COLOR_LIGHTGREEN ((uint16_t)0x87F0)
|
||||
#define LCD_COLOR_LIGHTRED ((uint16_t)0xFC10)
|
||||
#define LCD_COLOR_LIGHTMAGENTA ((uint16_t)0xFC1F)
|
||||
#define LCD_COLOR_LIGHTYELLOW ((uint16_t)0xFFF0)
|
||||
#define LCD_COLOR_DARKBLUE ((uint16_t)0x0010)
|
||||
#define LCD_COLOR_DARKGREEN ((uint16_t)0x0400)
|
||||
#define LCD_COLOR_DARKRED ((uint16_t)0x8000)
|
||||
#define LCD_COLOR_DARKCYAN ((uint16_t)0x0410)
|
||||
#define LCD_COLOR_DARKMAGENTA ((uint16_t)0x8010)
|
||||
#define LCD_COLOR_DARKYELLOW ((uint16_t)0x8400)
|
||||
#define LCD_COLOR_WHITE ((uint16_t)0xFFFF)
|
||||
#define LCD_COLOR_LIGHTGRAY ((uint16_t)0xD69A)
|
||||
#define LCD_COLOR_GRAY ((uint16_t)0x8410)
|
||||
#define LCD_COLOR_DARKGRAY ((uint16_t)0x4208)
|
||||
#define LCD_COLOR_BLACK ((uint16_t)0x0000)
|
||||
#define LCD_COLOR_BROWN ((uint16_t)0xA145)
|
||||
#define LCD_COLOR_ORANGE ((uint16_t)0xFD20)
|
||||
|
||||
/**
|
||||
* @brief LCD default font
|
||||
*/
|
||||
#define LCD_DEFAULT_FONT Font12
|
||||
|
||||
/**
|
||||
* @brief LCD special pins
|
||||
*/
|
||||
/* LCD reset pin */
|
||||
/* LCD reset is accessed thru the MFX */
|
||||
#define LCD_RST_PIN IO1_PIN_2
|
||||
|
||||
/* LCD tearing effect pin */
|
||||
#define LCD_TE_PIN GPIO_PIN_7
|
||||
#define LCD_TE_GPIO_PORT GPIOH
|
||||
#define LCD_TE_GPIO_CLK_ENABLE() __HAL_RCC_GPIOH_CLK_ENABLE()
|
||||
#define LCD_TE_GPIO_CLK_DISABLE() __HAL_RCC_GPIOH_CLK_DISABLE()
|
||||
|
||||
/* Backlight control pin */
|
||||
#if defined(LPTIMER_DIMMING)
|
||||
#define LCD_BL_CTRL_PIN GPIO_PIN_15
|
||||
#define LCD_BL_CTRL_GPIO_PORT GPIOG
|
||||
#define LCD_BL_CTRL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
|
||||
#define LCD_BL_CTRL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
|
||||
#else
|
||||
#define LCD_BL_CTRL_PIN GPIO_PIN_0
|
||||
#define LCD_BL_CTRL_GPIO_PORT GPIOI
|
||||
#define LCD_BL_CTRL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE()
|
||||
#define LCD_BL_CTRL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE()
|
||||
#endif
|
||||
|
||||
|
||||
/* Power on control pin */
|
||||
#define LCD_PWR_CTRL_PIN GPIO_PIN_0
|
||||
#define LCD_PWR_CTRL_GPIO_PORT GPIOH
|
||||
#define LCD_PWR_CTRL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOH_CLK_ENABLE()
|
||||
#define LCD_PWR_CTRL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOH_CLK_DISABLE()
|
||||
|
||||
/* Use by application to not use backlight */
|
||||
extern FlagStatus WakeUpFromStandby;
|
||||
extern FlagStatus WakeUpFromShutdown;
|
||||
|
||||
|
||||
/* Screen dimming parameters */
|
||||
/* Definition for TIMx clock resources */
|
||||
#define TIMx TIM5
|
||||
#define TIMx_CLK_ENABLE() __HAL_RCC_TIM5_CLK_ENABLE()
|
||||
#define TIMx_CLK_DISABLE() __HAL_RCC_TIM5_CLK_DISABLE()
|
||||
#define TIMx_CHANNEL TIM_CHANNEL_4
|
||||
#define TIMx_CHANNEl_AF GPIO_AF2_TIM5
|
||||
#if defined(LPTIMER_DIMMING)
|
||||
#define PERIOD_VALUE (uint32_t)(99) /* Period Value */
|
||||
#define PULSE_VALUE (uint32_t)(95) /* 5% cycle */
|
||||
#define PULSE_DECREASE_START (uint32_t)(45) /* cycle start level when starting to dim the screen */
|
||||
#define PULSE_DECREASE_DELAY (uint32_t)(40) /* gradually decrease cycle level every 40 milliseconds */
|
||||
#else
|
||||
#define PERIOD_VALUE (uint32_t)(666 - 1) /* Period Value */
|
||||
#define PULSE_VALUE (uint32_t)((PERIOD_VALUE*5)/100) /* 5% cycle */
|
||||
#define PULSE_DECREASE_START (uint32_t)(PULSE_VALUE + 120) /* cycle start level when starting to dim the screen */
|
||||
#define PULSE_DECREASE_DELAY (uint32_t)(20) /* gradually decrease cycle level every 20 milliseconds */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L496G_DISCOVERY_LCD_Exported_Functions STM32L496G DISCOVERY LCD Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_LCD_Init(void);
|
||||
uint8_t BSP_LCD_InitEx(uint32_t orientation);
|
||||
void BSP_LCD_Reset(void);
|
||||
uint8_t BSP_LCD_DeInit(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);
|
||||
|
||||
uint16_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos);
|
||||
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_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, 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);
|
||||
|
||||
void BSP_LCD_ScreenDimmingOn(void);
|
||||
void BSP_LCD_ScreenDimmingOff(void);
|
||||
void BSP_LCD_ScreenDimmingConfig(const uint8_t start, const uint8_t stop, const uint8_t step, const uint8_t delay);
|
||||
|
||||
uint8_t BSP_LCD_GetOrientation(void);
|
||||
|
||||
/* These functions can be modified in case the current settings
|
||||
need to be changed for specific application needs */
|
||||
__weak void BSP_LCD_MspInit(void);
|
||||
__weak void BSP_LCD_MspDeInit(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L496G_DISCOVERY_LCD_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue