STM32_EVAL_I2C_EE_Private_Functions
[STM32_EVAL_I2C_EE]

Functions

void sEE_DeInit (void)
 DeInitializes peripherals used by the I2C EEPROM driver.
void sEE_Init (void)
 Initializes peripherals used by the I2C EEPROM driver.
uint32_t sEE_ReadBuffer (uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead)
 Reads a block of data from the EEPROM.
uint32_t sEE_WaitEepromStandbyState (void)
 Wait for EEPROM Standby state.
void sEE_WriteBuffer (uint8_t *pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite)
 Writes buffer of data to the I2C EEPROM.
uint32_t sEE_WritePage (uint8_t *pBuffer, uint16_t WriteAddr, uint8_t *NumByteToWrite)
 Writes more than one byte to the EEPROM with a single WRITE cycle.

Function Documentation

void sEE_DeInit ( void   ) 

DeInitializes peripherals used by the I2C EEPROM driver.

Parameters:
None 
Return values:
None 

Definition at line 136 of file stm32_eval_i2c_ee.c.

References sEE_LowLevel_DeInit().

Referenced by main().

void sEE_Init ( void   ) 
uint32_t sEE_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.
When number of data to be read is higher than 1, this function just configures the communication and enable the DMA channel to transfer data. Meanwhile, the user application may perform other tasks. When number of data to be read is 1, then the DMA is not used. The byte is read in polling mode.
Return values:
sEE_OK (0) if operation is correctly performed, else return value different from sEE_OK (0) or the timeout user callback.

< While the bus is busy

< Test on EV5 and clear it (cleared by reading SR1 then writing to DR)

< Test on EV6 and clear it

< Test on EV8 and clear it

< Test on EV5 and clear it (cleared by reading SR1 then writing to DR)

< Send STOP Condition

< Decrement the read bytes counter

< Test on EV6 and clear it

Definition at line 217 of file stm32_eval_i2c_ee.c.

References DISABLE, DMA_Cmd(), ENABLE, I2C_AcknowledgeConfig(), I2C_CheckEvent(), I2C_CR1_STOP, I2C_Direction_Receiver, I2C_Direction_Transmitter, I2C_DMALastTransferCmd(), I2C_EVENT_MASTER_BYTE_TRANSMITTED, I2C_EVENT_MASTER_MODE_SELECT, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED, I2C_FLAG_ADDR, I2C_FLAG_BTF, I2C_FLAG_BUSY, I2C_FLAG_RXNE, I2C_GenerateSTART(), I2C_GenerateSTOP(), I2C_GetFlagStatus(), I2C_ReceiveData(), I2C_Send7bitAddress(), I2C_SendData(), RESET, sEE_DIRECTION_RX, sEE_EnterCriticalSection_UserCallback(), sEE_ExitCriticalSection_UserCallback(), sEE_FLAG_TIMEOUT, sEE_I2C, sEE_I2C_DMA_CHANNEL_RX, sEE_LONG_TIMEOUT, sEE_LowLevel_DMAConfig(), sEE_OK, sEE_TIMEOUT_UserCallback(), sEEAddress, sEEDataReadPointer, and sEETimeout.

Referenced by main().

uint32_t sEE_WaitEepromStandbyState ( void   ) 

Wait for EEPROM Standby state.

Note:
This function allows to wait and check that EEPROM has finished the last Write 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.
It is not necessary to call this function after sEE_WriteBuffer() function (sEE_WriteBuffer() already calls this function after each write page operation).
Parameters:
None 
Return values:
sEE_OK (0) if operation is correctly performed, else return value different from sEE_OK (0) or the timeout user callback.

< While the bus is busy

< Send START condition

< Test on EV5 and clear it

< STOP condition

< Clear AF flag

Definition at line 659 of file stm32_eval_i2c_ee.c.

References ENABLE, I2C_CheckEvent(), I2C_ClearFlag(), I2C_Direction_Transmitter, I2C_EVENT_MASTER_MODE_SELECT, I2C_FLAG_AF, I2C_FLAG_BUSY, I2C_GenerateSTART(), I2C_GenerateSTOP(), I2C_GetFlagStatus(), I2C_Send7bitAddress(), I2C_SR1_ADDR, I2C_SR1_AF, sEE_FLAG_TIMEOUT, sEE_I2C, sEE_LONG_TIMEOUT, sEE_MAX_TRIALS_NUMBER, sEE_OK, sEE_TIMEOUT_UserCallback(), sEEAddress, and sEETimeout.

Referenced by sEE_WriteBuffer().

void sEE_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:
None 

< If WriteAddr is sEE_PAGESIZE aligned

< If NumByteToWrite < sEE_PAGESIZE

< If NumByteToWrite < sEE_PAGESIZE

< If the number of data to be written is more than the remaining space in the current page:

< Write the data conained in same page

< Write the remaining data in the following page

Definition at line 476 of file stm32_eval_i2c_ee.c.

References sEE_LONG_TIMEOUT, sEE_TIMEOUT_UserCallback(), sEE_WaitEepromStandbyState(), sEE_WritePage(), sEEDataNum, and sEETimeout.

Referenced by main().

uint32_t sEE_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 sEE_WriteBuffer() which calls sEE_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:
sEE_OK (0) if operation is correctly performed, else return value different from sEE_OK (0) or the timeout user callback.

< While the bus is busy

< Test on EV5 and clear it

< Test on EV6 and clear it

< Test on EV8 and clear it

Definition at line 393 of file stm32_eval_i2c_ee.c.

References DMA_Cmd(), ENABLE, I2C_CheckEvent(), I2C_Direction_Transmitter, I2C_EVENT_MASTER_BYTE_TRANSMITTED, I2C_EVENT_MASTER_MODE_SELECT, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED, I2C_FLAG_BUSY, I2C_GenerateSTART(), I2C_GetFlagStatus(), I2C_Send7bitAddress(), I2C_SendData(), sEE_DIRECTION_TX, sEE_FLAG_TIMEOUT, sEE_I2C, sEE_I2C_DMA_CHANNEL_TX, sEE_LONG_TIMEOUT, sEE_LowLevel_DMAConfig(), sEE_OK, sEE_TIMEOUT_UserCallback(), sEEAddress, sEEDataWritePointer, and sEETimeout.

Referenced by sEE_WriteBuffer().

STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32