STM8S/A Standard Peripherals Firmware Library: STM8S_EVAL_I2C_EE_Private_Functions

STM8S/A

STM8S/A Standard Peripherals Firmware Library
STM8S_EVAL_I2C_EE_Private_Functions

Functions

void sEE_DeInit (void)
 DeInitializes peripherals used by the I2C EEPROM driver.
void sEE_EnterCriticalSection_UserCallback (void)
 Start critical section: this callbacks should be typically used to disable interrupts when entering a critical section of I2C communication You may use default callbacks provided into this driver by uncommenting the define USE_DEFAULT_CRITICAL_CALLBACK.
void sEE_ExitCriticalSection_UserCallback (void)
 End of critical section: this callbacks should be typically used to re-enable interrupts when exiting a critical section of I2C communication You may use default callbacks provided into this driver by uncommenting the define USE_DEFAULT_CRITICAL_CALLBACK.
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.

Function Documentation

void sEE_DeInit ( void  )

DeInitializes peripherals used by the I2C EEPROM driver.

Parameters:
None
Return values:
None

Definition at line 114 of file stm8s_eval_i2c_ee.c.

References sEE_LowLevel_DeInit().

Referenced by main().

void sEE_EnterCriticalSection_UserCallback ( void  )

Start critical section: this callbacks should be typically used to disable interrupts when entering a critical section of I2C communication You may use default callbacks provided into this driver by uncommenting the define USE_DEFAULT_CRITICAL_CALLBACK.

Or you can comment that line and implement these callbacks into your application.

Parameters:
None.
Return values:
None.

Definition at line 805 of file stm8s_eval_i2c_ee.c.

References disableInterrupts.

Referenced by sEE_ReadBuffer().

void sEE_ExitCriticalSection_UserCallback ( void  )

End of critical section: this callbacks should be typically used to re-enable interrupts when exiting a critical section of I2C communication You may use default callbacks provided into this driver by uncommenting the define USE_DEFAULT_CRITICAL_CALLBACK.

Or you can comment that line and implement these callbacks into your application.

Parameters:
None.
Return values:
None.

Definition at line 820 of file stm8s_eval_i2c_ee.c.

References enableInterrupts.

Referenced by sEE_ReadBuffer().

void sEE_Init ( void  )

Initializes peripherals used by the I2C EEPROM driver.

Parameters:
None
Return values:
None

Definition at line 124 of file stm8s_eval_i2c_ee.c.

References ENABLE, I2C_ACK_CURR, I2C_ADDMODE_7BIT, I2C_Cmd(), I2C_DUTYCYCLE_2, I2C_Init(), I2C_SLAVE_ADDRESS7, I2C_SPEED, sEE_HW_ADDRESS, sEE_LowLevel_Init(), and sEEAddress.

Referenced by main().

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 to know when the transfer is complete.
This function ensures data reading from EEPROM, it assumes that I2C is used with polling or its interrupt priority is not the highest in the application. Method 2 transfer sequence is implemented in this function(refer to RM0016 for more details). 3 bytes, 2bytes and 1 byte reception cases are handled.
Return values:
sEE_OK(0) if operation is correctly performed, else return value different from sEE_OK (0) or the timeout user callback.

Definition at line 162 of file stm8s_eval_i2c_ee.c.

References ENABLE, I2C, I2C_ACK_CURR, I2C_ACK_NEXT, I2C_ACK_NONE, I2C_AcknowledgeConfig(), I2C_CheckEvent(), I2C_CR2_STOP, I2C_DIRECTION_RX, I2C_DIRECTION_TX, I2C_EVENT_MASTER_BYTE_TRANSMITTED, I2C_EVENT_MASTER_MODE_SELECT, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED, I2C_FLAG_ADDRESSSENTMATCHED, I2C_FLAG_BUSBUSY, I2C_FLAG_RXNOTEMPTY, I2C_FLAG_TRANSFERFINISHED, I2C_GenerateSTART(), I2C_GenerateSTOP(), I2C_GetFlagStatus(), I2C_ReceiveData(), I2C_Send7bitAddress(), I2C_SendData(), RESET, sEE_EnterCriticalSection_UserCallback(), sEE_ExitCriticalSection_UserCallback(), sEE_FLAG_TIMEOUT, sEE_I2C, sEE_LONG_TIMEOUT, sEE_OK, sEE_TIMEOUT_UserCallback(), sEEAddress, 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 a 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.

Definition at line 706 of file stm8s_eval_i2c_ee.c.

References __IO, ENABLE, I2C_CheckEvent(), I2C_ClearFlag(), I2C_DIRECTION_TX, I2C_EVENT_MASTER_MODE_SELECT, I2C_FLAG_ACKNOWLEDGEFAILURE, I2C_FLAG_ADDRESSSENTMATCHED, I2C_FLAG_BUSBUSY, I2C_GenerateSTART(), I2C_GenerateSTOP(), I2C_GetFlagStatus(), I2C_Send7bitAddress(), I2C_SR1_ADDR, RESET, sEE_FLAG_TIMEOUT, sEE_I2C, sEE_LONG_TIMEOUT, sEE_MAX_TRIALS_NUMBER, sEE_OK, sEE_TIMEOUT_UserCallback(), sEEAddress, and sEETimeout.

Referenced by main(), and 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

Definition at line 409 of file stm8s_eval_i2c_ee.c.

References sEE_LONG_TIMEOUT, sEE_PAGESIZE, 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.

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

Definition at line 597 of file stm8s_eval_i2c_ee.c.

References ENABLE, I2C_CheckEvent(), I2C_DIRECTION_TX, I2C_EVENT_MASTER_BYTE_TRANSMITTED, I2C_EVENT_MASTER_MODE_SELECT, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED, I2C_FLAG_BUSBUSY, I2C_FLAG_TRANSFERFINISHED, I2C_GenerateSTART(), I2C_GenerateSTOP(), I2C_GetFlagStatus(), I2C_Send7bitAddress(), I2C_SendData(), sEE_FLAG_TIMEOUT, sEE_I2C, sEE_LONG_TIMEOUT, sEE_OK, sEE_TIMEOUT_UserCallback(), sEEAddress, sEEDataWritePointer, and sEETimeout.

Referenced by sEE_WriteBuffer().

STM8 Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM8 8-bit Microcontrollers platform visit www.st.com