STM32F072B-Discovery BSP User Manual
|
Functions | |
uint32_t | BSP_EEPROM_Init (void) |
Initializes peripherals used by the I2C EEPROM driver. | |
uint32_t | BSP_EEPROM_ReadBuffer (uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead) |
Reads a block of data from the EEPROM. | |
uint32_t | BSP_EEPROM_WritePage (uint8_t *pBuffer, uint16_t WriteAddr, uint8_t *NumByteToWrite) |
Writes more than one byte to the EEPROM with a single WRITE cycle. | |
uint32_t | BSP_EEPROM_WriteBuffer (uint8_t *pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite) |
Writes buffer of data to the I2C EEPROM. | |
uint32_t | BSP_EEPROM_WaitEepromStandbyState (void) |
Wait for EEPROM Standby state. | |
void | HAL_I2C_MemTxCpltCallback (I2C_HandleTypeDef *hi2c) |
Memory Tx Transfer completed callbacks. | |
void | HAL_I2C_MemRxCpltCallback (I2C_HandleTypeDef *hi2c) |
Memory Rx Transfer completed callbacks. | |
__weak uint32_t | BSP_EEPROM_TIMEOUT_UserCallback (void) |
Basic management of the timeout situation. | |
void | EEPROM_IO_Init (void) |
Initializes peripherals used by the I2C EEPROM driver. | |
uint32_t | EEPROM_IO_WriteData (uint16_t DevAddress, uint16_t MemAddress, uint32_t pBuffer, uint32_t BufferSize) |
Write data to I2C EEPROM driver in using DMA channel. | |
uint32_t | EEPROM_IO_ReadData (uint16_t DevAddress, uint16_t MemAddress, uint32_t pBuffer, uint32_t BufferSize) |
Read data from I2C EEPROM driver in using DMA channel. | |
HAL_StatusTypeDef | EEPROM_IO_IsDeviceReady (uint16_t DevAddress, uint32_t Trials) |
Checks if target device is ready for communication. |
Function Documentation
uint32_t BSP_EEPROM_Init | ( | void | ) |
Initializes peripherals used by the I2C EEPROM driver.
- Note:
- There are 2 different versions of M24LR64 (A01 & A02). Then try to connect on 1st one (EEPROM_I2C_ADDRESS_A01) and if problem, check the 2nd one (EEPROM_I2C_ADDRESS_A02)
- Return values:
-
EEPROM_OK (0) if operation is correctly performed, else return value different from EEPROM_OK (0)
Definition at line 114 of file stm32f072b_discovery_eeprom.c.
References DISCOVERY_EEPROM_I2C_ADDRESS_A01, EEPROM_FAIL, EEPROM_IO_Init(), EEPROM_IO_IsDeviceReady(), EEPROM_MAX_TRIALS_NUMBER, EEPROM_OK, and EEPROMAddress.
uint32_t BSP_EEPROM_ReadBuffer | ( | uint8_t * | pBuffer, |
uint16_t | ReadAddr, | ||
uint16_t * | NumByteToRead | ||
) |
Reads a block of data from the EEPROM.
- Parameters:
-
pBuffer pointer to the buffer that receives the data read from the EEPROM. ReadAddr EEPROM's internal address to start reading from. NumByteToRead pointer to the variable holding number of bytes to be read from the EEPROM.
- Note:
- The variable pointed by NumByteToRead is reset to 0 when all the data are read from the EEPROM. Application should monitor this variable in order know when the transfer is complete.
- Return values:
-
EEPROM_OK (0) if operation is correctly performed, else return value different from EEPROM_OK (0) or the timeout user callback.
Definition at line 143 of file stm32f072b_discovery_eeprom.c.
References BSP_EEPROM_TIMEOUT_UserCallback(), EEPROM_FAIL, EEPROM_IO_ReadData(), EEPROM_LONG_TIMEOUT, EEPROM_OK, EEPROM_TIMEOUT, EEPROMAddress, EEPROMDataRead, and EEPROMTimeout.
__weak uint32_t BSP_EEPROM_TIMEOUT_UserCallback | ( | void | ) |
Basic management of the timeout situation.
- Return values:
-
None
Definition at line 511 of file stm32f072b_discovery_eeprom.c.
Referenced by BSP_EEPROM_ReadBuffer(), BSP_EEPROM_WaitEepromStandbyState(), and BSP_EEPROM_WriteBuffer().
uint32_t BSP_EEPROM_WaitEepromStandbyState | ( | void | ) |
Wait for EEPROM Standby state.
- Note:
- This function allows to wait and check that EEPROM has finished the last operation. It is mostly used after Write operation: after receiving the buffer to be written, the EEPROM may need additional time to actually perform the write operation. During this time, it doesn't answer to I2C packets addressed to it. Once the write operation is complete the EEPROM responds to its address.
- Return values:
-
EEPROM_OK (0) if operation is correctly performed, else return value different from EEPROM_OK (0) or the timeout user callback.
Definition at line 460 of file stm32f072b_discovery_eeprom.c.
References BSP_EEPROM_TIMEOUT_UserCallback(), EEPROM_FAIL, EEPROM_IO_IsDeviceReady(), EEPROM_LONG_TIMEOUT, EEPROM_MAX_TRIALS_NUMBER, EEPROM_OK, EEPROM_TIMEOUT, EEPROMAddress, and EEPROMTimeout.
Referenced by BSP_EEPROM_WriteBuffer().
uint32_t BSP_EEPROM_WriteBuffer | ( | uint8_t * | pBuffer, |
uint16_t | WriteAddr, | ||
uint16_t | NumByteToWrite | ||
) |
Writes buffer of data to the I2C EEPROM.
- Parameters:
-
pBuffer pointer to the buffer containing the data to be written to the EEPROM. WriteAddr EEPROM's internal address to write to. NumByteToWrite number of bytes to write to the EEPROM.
- Return values:
-
EEPROM_OK (0) if operation is correctly performed, else return value different from EEPROM_OK (0) or the timeout user callback.
< If WriteAddr is EEPROM_PAGESIZE aligned
< If NumByteToWrite < EEPROM_PAGESIZE
< If NumByteToWrite < EEPROM_PAGESIZE
< If the number of data to be written is more than the remaining space in the current page:
< Write the data contained in same page
< Write the remaining data in the following page
Definition at line 225 of file stm32f072b_discovery_eeprom.c.
References BSP_EEPROM_TIMEOUT_UserCallback(), BSP_EEPROM_WaitEepromStandbyState(), BSP_EEPROM_WritePage(), EEPROM_FAIL, EEPROM_LONG_TIMEOUT, EEPROM_OK, EEPROM_PAGESIZE, EEPROM_TIMEOUT, EEPROMDataNum, and EEPROMTimeout.
uint32_t BSP_EEPROM_WritePage | ( | uint8_t * | pBuffer, |
uint16_t | WriteAddr, | ||
uint8_t * | NumByteToWrite | ||
) |
Writes more than one byte to the EEPROM with a single WRITE cycle.
- Note:
- The number of bytes (combined to write start address) must not cross the EEPROM page boundary. This function can only write into the boundaries of an EEPROM page. This function doesn't check on boundaries condition (in this driver the function BSP_EEPROM_WriteBuffer() which calls BSP_EEPROM_WritePage() is responsible of checking on Page boundaries).
- Parameters:
-
pBuffer pointer to the buffer containing the data to be written to the EEPROM. WriteAddr EEPROM's internal address to write to. NumByteToWrite pointer to the variable holding number of bytes to be written into the EEPROM.
- Note:
- The variable pointed by NumByteToWrite is reset to 0 when all the data are written to the EEPROM. Application should monitor this variable in order know when the transfer is complete.
- This function just configure the communication and enable the DMA channel to transfer data. Meanwhile, the user application may perform other tasks in parallel.
- Return values:
-
EEPROM_OK (0) if operation is correctly performed, else return value different from EEPROM_OK (0) or the timeout user callback.
Definition at line 200 of file stm32f072b_discovery_eeprom.c.
References EEPROM_IO_WriteData(), EEPROM_OK, EEPROMAddress, and EEPROMDataWritePointer.
Referenced by BSP_EEPROM_WriteBuffer().
void EEPROM_IO_Init | ( | void | ) |
Initializes peripherals used by the I2C EEPROM driver.
- Return values:
-
None
Definition at line 729 of file stm32f072b_discovery.c.
References I2Cx_Init().
Referenced by BSP_EEPROM_Init().
HAL_StatusTypeDef EEPROM_IO_IsDeviceReady | ( | uint16_t | DevAddress, |
uint32_t | Trials | ||
) |
Checks if target device is ready for communication.
- Note:
- This function is used with Memory devices
- Parameters:
-
DevAddress Target device address Trials Number of trials
- Return values:
-
HAL status
Definition at line 781 of file stm32f072b_discovery.c.
References I2cHandle, and I2Cx_TIMEOUT_MAX.
Referenced by BSP_EEPROM_Init(), and BSP_EEPROM_WaitEepromStandbyState().
uint32_t EEPROM_IO_ReadData | ( | uint16_t | DevAddress, |
uint16_t | MemAddress, | ||
uint32_t | pBuffer, | ||
uint32_t | BufferSize | ||
) |
Read data from I2C EEPROM driver in using DMA channel.
- Parameters:
-
DevAddress Target device address MemAddress Internal memory address pBuffer Pointer to data buffer BufferSize Amount of data to be read
- Return values:
-
HAL status
Definition at line 762 of file stm32f072b_discovery.c.
References I2Cx_ReadBuffer(), and I2Cx_ReadData().
Referenced by BSP_EEPROM_ReadBuffer().
uint32_t EEPROM_IO_WriteData | ( | uint16_t | DevAddress, |
uint16_t | MemAddress, | ||
uint32_t | pBuffer, | ||
uint32_t | BufferSize | ||
) |
Write data to I2C EEPROM driver in using DMA channel.
- Parameters:
-
DevAddress Target device address MemAddress Internal memory address pBuffer Pointer to data buffer BufferSize Amount of data to be sent
- Return values:
-
HAL status
Definition at line 742 of file stm32f072b_discovery.c.
References I2Cx_WriteBuffer(), and I2Cx_WriteData().
Referenced by BSP_EEPROM_WritePage().
void HAL_I2C_MemRxCpltCallback | ( | I2C_HandleTypeDef * | hi2c | ) |
Memory Rx Transfer completed callbacks.
- Parameters:
-
hi2c I2C handle
- Return values:
-
None
Definition at line 502 of file stm32f072b_discovery_eeprom.c.
References EEPROMDataRead.
void HAL_I2C_MemTxCpltCallback | ( | I2C_HandleTypeDef * | hi2c | ) |
Memory Tx Transfer completed callbacks.
- Parameters:
-
hi2c I2C handle
- Return values:
-
None
Definition at line 492 of file stm32f072b_discovery_eeprom.c.
References EEPROMDataWritePointer.
Generated on Wed Jul 5 2017 09:43:20 for STM32F072B-Discovery BSP User Manual by 1.7.6.1