STM32F469NI Discovery board drivers
Dependents: DISCO-F469NI_LCDTS_GUI_demo Configurable_Robots DISCO-F469NI_LCD_demo DISCO-F469NI_SD_demo ... more
Drivers/BSP/STM32469I-Discovery/stm32469i_discovery_eeprom.h@4:27609b3a44ed, 2021-06-09 (annotated)
- Committer:
- aa6164
- Date:
- Wed Jun 09 12:45:23 2021 +0000
- Revision:
- 4:27609b3a44ed
- Parent:
- 3:3cdfcc4f7c9d
Updated wait_ms() to thread_sleep_for() for Mbed OS 6+
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jerome Coutant
2:123b894b49dd
|
1
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
2
|
******************************************************************************
|
|
Jerome Coutant
2:123b894b49dd
|
3
|
* @file stm32469i_discovery_eeprom.h
|
|
Jerome Coutant
2:123b894b49dd
|
4
|
* @author MCD Application Team
|
|
Jerome Coutant
2:123b894b49dd
|
5
|
* @brief This file contains all the functions prototypes for
|
|
Jerome Coutant
2:123b894b49dd
|
6
|
* the stm32469i_discovery_eeprom.c firmware driver.
|
|
Jerome Coutant
2:123b894b49dd
|
7
|
******************************************************************************
|
|
Jerome Coutant
2:123b894b49dd
|
8
|
* @attention
|
|
Jerome Coutant
2:123b894b49dd
|
9
|
*
|
|
Jerome Coutant
2:123b894b49dd
|
10
|
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
|
Jerome Coutant
2:123b894b49dd
|
11
|
*
|
|
Jerome Coutant
2:123b894b49dd
|
12
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
Jerome Coutant
2:123b894b49dd
|
13
|
* are permitted provided that the following conditions are met:
|
|
Jerome Coutant
2:123b894b49dd
|
14
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
Jerome Coutant
2:123b894b49dd
|
15
|
* this list of conditions and the following disclaimer.
|
|
Jerome Coutant
2:123b894b49dd
|
16
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
Jerome Coutant
2:123b894b49dd
|
17
|
* this list of conditions and the following disclaimer in the documentation
|
|
Jerome Coutant
2:123b894b49dd
|
18
|
* and/or other materials provided with the distribution.
|
|
Jerome Coutant
2:123b894b49dd
|
19
|
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
Jerome Coutant
2:123b894b49dd
|
20
|
* may be used to endorse or promote products derived from this software
|
|
Jerome Coutant
2:123b894b49dd
|
21
|
* without specific prior written permission.
|
|
Jerome Coutant
2:123b894b49dd
|
22
|
*
|
|
Jerome Coutant
2:123b894b49dd
|
23
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Jerome Coutant
2:123b894b49dd
|
24
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Jerome Coutant
2:123b894b49dd
|
25
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Jerome Coutant
2:123b894b49dd
|
26
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
Jerome Coutant
2:123b894b49dd
|
27
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Jerome Coutant
2:123b894b49dd
|
28
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Jerome Coutant
2:123b894b49dd
|
29
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Jerome Coutant
2:123b894b49dd
|
30
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Jerome Coutant
2:123b894b49dd
|
31
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Jerome Coutant
2:123b894b49dd
|
32
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Jerome Coutant
2:123b894b49dd
|
33
|
*
|
|
Jerome Coutant
2:123b894b49dd
|
34
|
******************************************************************************
|
|
Jerome Coutant
2:123b894b49dd
|
35
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
36
|
|
|
Jerome Coutant
2:123b894b49dd
|
37
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
Jerome Coutant
2:123b894b49dd
|
38
|
#ifndef __STM32F469I_DISCOVERY_EEPROM_H
|
|
Jerome Coutant
2:123b894b49dd
|
39
|
#define __STM32F469I_DISCOVERY_EEPROM_H
|
|
Jerome Coutant
2:123b894b49dd
|
40
|
|
|
Jerome Coutant
2:123b894b49dd
|
41
|
#ifdef __cplusplus
|
|
Jerome Coutant
2:123b894b49dd
|
42
|
extern "C" {
|
|
Jerome Coutant
2:123b894b49dd
|
43
|
#endif
|
|
Jerome Coutant
2:123b894b49dd
|
44
|
|
|
Jerome Coutant
2:123b894b49dd
|
45
|
/* Includes ------------------------------------------------------------------*/
|
|
Jerome Coutant
2:123b894b49dd
|
46
|
#include "stm32469i_discovery.h"
|
|
Jerome Coutant
2:123b894b49dd
|
47
|
|
|
Jerome Coutant
2:123b894b49dd
|
48
|
/** @addtogroup BSP
|
|
Jerome Coutant
2:123b894b49dd
|
49
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
50
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
51
|
|
|
Jerome Coutant
2:123b894b49dd
|
52
|
/** @addtogroup STM32469I_Discovery
|
|
Jerome Coutant
2:123b894b49dd
|
53
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
54
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
55
|
|
|
Jerome Coutant
2:123b894b49dd
|
56
|
/** @addtogroup STM32469I-Discovery_EEPROM
|
|
Jerome Coutant
2:123b894b49dd
|
57
|
* @brief This file includes the I2C EEPROM driver of STM32469I-Discovery board.
|
|
Jerome Coutant
2:123b894b49dd
|
58
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
59
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
60
|
|
|
Jerome Coutant
2:123b894b49dd
|
61
|
/** @defgroup STM32469I-Discovery_EEPROM_Exported_Types STM32469I Discovery EEPROM Exported Types
|
|
Jerome Coutant
2:123b894b49dd
|
62
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
63
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
64
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
65
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
66
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
67
|
|
|
Jerome Coutant
2:123b894b49dd
|
68
|
/** @defgroup STM32469I-Discovery_EEPROM_Exported_Constants STM32469I Discovery EEPROM Exported Constants
|
|
Jerome Coutant
2:123b894b49dd
|
69
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
70
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
71
|
/* EEPROM hardware address and page size */
|
|
Jerome Coutant
2:123b894b49dd
|
72
|
#define EEPROM_PAGESIZE ((uint8_t)4)
|
|
Jerome Coutant
2:123b894b49dd
|
73
|
#define EEPROM_MAX_SIZE ((uint16_t)0x2000) /* 64Kbit */
|
|
Jerome Coutant
2:123b894b49dd
|
74
|
|
|
Jerome Coutant
2:123b894b49dd
|
75
|
/* Maximum Timeout values for flags and events waiting loops.
|
|
Jerome Coutant
2:123b894b49dd
|
76
|
This timeout is based on systick set to 1ms*/
|
|
Jerome Coutant
2:123b894b49dd
|
77
|
/* Timeout for read based if read all the EEPROM : EEPROM_MAX_SIZE * I2C_SPEED (640ms) */
|
|
Jerome Coutant
2:123b894b49dd
|
78
|
#define EEPROM_READ_TIMEOUT ((uint32_t)(1000))
|
|
Jerome Coutant
2:123b894b49dd
|
79
|
/* Timeout for write based on max write which is EEPROM_PAGESIZE bytes: EEPROM_PAGESIZE * I2C_SPEED (320us) */
|
|
Jerome Coutant
2:123b894b49dd
|
80
|
#define EEPROM_WRITE_TIMEOUT ((uint32_t)(10))
|
|
Jerome Coutant
2:123b894b49dd
|
81
|
|
|
Jerome Coutant
2:123b894b49dd
|
82
|
/* Maximum number of trials for EEPROM_WaitEepromStandbyState() function */
|
|
Jerome Coutant
2:123b894b49dd
|
83
|
#define EEPROM_MAX_TRIALS 3000
|
|
Jerome Coutant
2:123b894b49dd
|
84
|
|
|
Jerome Coutant
2:123b894b49dd
|
85
|
#define EEPROM_OK 0
|
|
Jerome Coutant
2:123b894b49dd
|
86
|
#define EEPROM_FAIL 1
|
|
Jerome Coutant
2:123b894b49dd
|
87
|
#define EEPROM_TIMEOUT 2
|
|
Jerome Coutant
2:123b894b49dd
|
88
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
89
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
90
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
91
|
|
|
Jerome Coutant
2:123b894b49dd
|
92
|
/** @defgroup STM32469I-Discovery_EEPROM_Exported_Macros STM32469I Discovery EEPROM Exported Macros
|
|
Jerome Coutant
2:123b894b49dd
|
93
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
94
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
95
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
96
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
97
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
98
|
|
|
Jerome Coutant
2:123b894b49dd
|
99
|
/** @defgroup STM32469I-Discovery_EEPROM_Exported_Functions STM32469I Discovery EEPROM Exported Functions
|
|
Jerome Coutant
2:123b894b49dd
|
100
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
101
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
102
|
uint32_t BSP_EEPROM_Init(void);
|
|
Jerome Coutant
2:123b894b49dd
|
103
|
uint8_t BSP_EEPROM_DeInit(void);
|
|
Jerome Coutant
2:123b894b49dd
|
104
|
uint32_t BSP_EEPROM_ReadBuffer(uint8_t* pBuffer, uint16_t ReadAddr, uint16_t* NumByteToRead);
|
|
Jerome Coutant
2:123b894b49dd
|
105
|
uint32_t BSP_EEPROM_WritePage(uint8_t* pBuffer, uint16_t WriteAddr, uint8_t* NumByteToWrite);
|
|
Jerome Coutant
2:123b894b49dd
|
106
|
uint32_t BSP_EEPROM_WriteBuffer(uint8_t* pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite);
|
|
Jerome Coutant
2:123b894b49dd
|
107
|
uint32_t BSP_EEPROM_WaitEepromStandbyState(void);
|
|
Jerome Coutant
2:123b894b49dd
|
108
|
|
|
Jerome Coutant
2:123b894b49dd
|
109
|
/* USER Callbacks: This function is declared as __weak in EEPROM driver and
|
|
Jerome Coutant
2:123b894b49dd
|
110
|
should be implemented into user application.
|
|
Jerome Coutant
2:123b894b49dd
|
111
|
BSP_EEPROM_TIMEOUT_UserCallback() function is called whenever a timeout condition
|
|
Jerome Coutant
2:123b894b49dd
|
112
|
occure during communication (waiting on an event that doesn't occur, bus
|
|
Jerome Coutant
2:123b894b49dd
|
113
|
errors, busy devices ...). */
|
|
Jerome Coutant
2:123b894b49dd
|
114
|
void BSP_EEPROM_TIMEOUT_UserCallback(void);
|
|
Jerome Coutant
2:123b894b49dd
|
115
|
|
|
Jerome Coutant
2:123b894b49dd
|
116
|
/* Link function for I2C EEPROM peripheral */
|
|
Jerome Coutant
2:123b894b49dd
|
117
|
void EEPROM_IO_Init(void);
|
|
Jerome Coutant
2:123b894b49dd
|
118
|
HAL_StatusTypeDef EEPROM_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize);
|
|
Jerome Coutant
2:123b894b49dd
|
119
|
HAL_StatusTypeDef EEPROM_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize);
|
|
Jerome Coutant
2:123b894b49dd
|
120
|
HAL_StatusTypeDef EEPROM_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
|
|
Jerome Coutant
2:123b894b49dd
|
121
|
|
|
Jerome Coutant
2:123b894b49dd
|
122
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
123
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
124
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
125
|
|
|
Jerome Coutant
2:123b894b49dd
|
126
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
127
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
128
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
129
|
|
|
Jerome Coutant
2:123b894b49dd
|
130
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
131
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
132
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
133
|
|
|
Jerome Coutant
2:123b894b49dd
|
134
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
135
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
136
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
137
|
|
|
Jerome Coutant
2:123b894b49dd
|
138
|
#ifdef __cplusplus
|
|
Jerome Coutant
2:123b894b49dd
|
139
|
}
|
|
Jerome Coutant
2:123b894b49dd
|
140
|
#endif
|
|
Jerome Coutant
2:123b894b49dd
|
141
|
|
|
Jerome Coutant
2:123b894b49dd
|
142
|
#endif /* __STM32F469I_DISCOVERY_EEPROM_H */
|
|
Jerome Coutant
2:123b894b49dd
|
143
|
|
|
Jerome Coutant
2:123b894b49dd
|
144
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|