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