EEPROM component demo

Dependents:   DISCO-F429ZI_EEPROM_demo WIRE-BANDING_FT810 WIRE-BANDING_copy

Committer:
jeromecoutant
Date:
Tue Jul 04 16:10:30 2017 +0000
Revision:
1:0980ff473345
Parent:
0:caf01d53736a
Update with MBED rev145

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:caf01d53736a 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
bcostm 0:caf01d53736a 2 *
bcostm 0:caf01d53736a 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
bcostm 0:caf01d53736a 4 * and associated documentation files (the "Software"), to deal in the Software without
bcostm 0:caf01d53736a 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
bcostm 0:caf01d53736a 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
bcostm 0:caf01d53736a 7 * Software is furnished to do so, subject to the following conditions:
bcostm 0:caf01d53736a 8 *
bcostm 0:caf01d53736a 9 * The above copyright notice and this permission notice shall be included in all copies or
bcostm 0:caf01d53736a 10 * substantial portions of the Software.
bcostm 0:caf01d53736a 11 *
bcostm 0:caf01d53736a 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
bcostm 0:caf01d53736a 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
bcostm 0:caf01d53736a 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
bcostm 0:caf01d53736a 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
bcostm 0:caf01d53736a 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
bcostm 0:caf01d53736a 17 */
bcostm 0:caf01d53736a 18
bcostm 0:caf01d53736a 19 #include "EEPROM_DISCO_F429ZI.h"
bcostm 0:caf01d53736a 20
bcostm 0:caf01d53736a 21 // Constructor
bcostm 0:caf01d53736a 22 EEPROM_DISCO_F429ZI::EEPROM_DISCO_F429ZI()
bcostm 0:caf01d53736a 23 {
bcostm 0:caf01d53736a 24 BSP_EEPROM_Init();
bcostm 0:caf01d53736a 25 BSP_EEPROM_WaitEepromStandbyState();
bcostm 0:caf01d53736a 26 }
bcostm 0:caf01d53736a 27
bcostm 0:caf01d53736a 28 // Destructor
bcostm 0:caf01d53736a 29 EEPROM_DISCO_F429ZI::~EEPROM_DISCO_F429ZI()
bcostm 0:caf01d53736a 30 {
bcostm 0:caf01d53736a 31 }
bcostm 0:caf01d53736a 32
bcostm 0:caf01d53736a 33 //=================================================================================================================
bcostm 0:caf01d53736a 34 // Public methods
bcostm 0:caf01d53736a 35 //=================================================================================================================
bcostm 0:caf01d53736a 36
bcostm 0:caf01d53736a 37 uint32_t EEPROM_DISCO_F429ZI::Init(void)
bcostm 0:caf01d53736a 38 {
bcostm 0:caf01d53736a 39 uint32_t status = BSP_EEPROM_Init();
bcostm 0:caf01d53736a 40 if (status == EEPROM_OK) {
bcostm 0:caf01d53736a 41 return BSP_EEPROM_WaitEepromStandbyState();
bcostm 0:caf01d53736a 42 }
bcostm 0:caf01d53736a 43 else {
bcostm 0:caf01d53736a 44 return status;
bcostm 0:caf01d53736a 45 }
bcostm 0:caf01d53736a 46 }
bcostm 0:caf01d53736a 47
bcostm 0:caf01d53736a 48 uint32_t EEPROM_DISCO_F429ZI::ReadBuffer(uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead)
bcostm 0:caf01d53736a 49 {
bcostm 0:caf01d53736a 50 return BSP_EEPROM_ReadBuffer(pBuffer, ReadAddr, NumByteToRead);
bcostm 0:caf01d53736a 51 }
bcostm 0:caf01d53736a 52
bcostm 0:caf01d53736a 53 uint32_t EEPROM_DISCO_F429ZI::WritePage(uint8_t *pBuffer, uint16_t WriteAddr, uint8_t *NumByteToWrite)
bcostm 0:caf01d53736a 54 {
bcostm 0:caf01d53736a 55 return BSP_EEPROM_WritePage(pBuffer, WriteAddr, NumByteToWrite);
bcostm 0:caf01d53736a 56 }
bcostm 0:caf01d53736a 57
bcostm 0:caf01d53736a 58 uint32_t EEPROM_DISCO_F429ZI::WriteBuffer(uint8_t *pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite)
bcostm 0:caf01d53736a 59 {
bcostm 0:caf01d53736a 60 return BSP_EEPROM_WriteBuffer(pBuffer, WriteAddr, NumByteToWrite);
bcostm 0:caf01d53736a 61 }
bcostm 0:caf01d53736a 62
bcostm 0:caf01d53736a 63 uint32_t EEPROM_DISCO_F429ZI::WaitEepromStandbyState(void)
bcostm 0:caf01d53736a 64 {
bcostm 0:caf01d53736a 65 return BSP_EEPROM_WaitEepromStandbyState();
bcostm 0:caf01d53736a 66 }
bcostm 0:caf01d53736a 67
jeromecoutant 1:0980ff473345 68 extern I2C_HandleTypeDef EEP_I2cHandle;
bcostm 0:caf01d53736a 69
bcostm 0:caf01d53736a 70 /**
bcostm 0:caf01d53736a 71 * @brief This function handles sEE DMA TX interrupt request.
bcostm 0:caf01d53736a 72 * @param None
bcostm 0:caf01d53736a 73 * @retval None
bcostm 0:caf01d53736a 74 */
bcostm 0:caf01d53736a 75 void EEPROM_I2C_DMA_TX_IRQHandler(void)
bcostm 0:caf01d53736a 76 {
jeromecoutant 1:0980ff473345 77 HAL_DMA_IRQHandler(EEP_I2cHandle.hdmatx);
bcostm 0:caf01d53736a 78 }
bcostm 0:caf01d53736a 79
bcostm 0:caf01d53736a 80 /**
bcostm 0:caf01d53736a 81 * @brief This function handles sEE DMA RX interrupt request.
bcostm 0:caf01d53736a 82 * @param None
bcostm 0:caf01d53736a 83 * @retval None
bcostm 0:caf01d53736a 84 */
bcostm 0:caf01d53736a 85 void EEPROM_I2C_DMA_RX_IRQHandler(void)
bcostm 0:caf01d53736a 86 {
jeromecoutant 1:0980ff473345 87 HAL_DMA_IRQHandler(EEP_I2cHandle.hdmarx);
bcostm 0:caf01d53736a 88 }