PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
C:/pdl_v10/library/utility/at24cxx/i2c_polling_at24cxx.c File Reference
#include "i2c_at24cxx.h"
Include dependency graph for i2c_polling_at24cxx.c:

Go to the source code of this file.

Functions

static boolean_t I2cCheckErrorStatus (void)
 Check the error status of I2C.
static en_result_t I2cStart (uint8_t u8DevAddr)
 Generate I2C start signal and send device address.
static en_result_t I2cRestart (uint8_t u8Addr)
 Generate I2C restart signal and send device address.
static en_result_t I2cSendData (uint8_t *pu8Data, uint8_t u8Size)
 Sene I2C data.
static en_result_t I2cRead (uint8_t *pRxData, uint8_t u8Size)
 Read I2C data.
static en_result_t I2cStop (void)
 Generate I2C stop signal.
en_result_t At24cxx_Init (void)
 Initialize AT24CXX.
en_result_t At24cxx_ByteWrite (uint8_t u8DevAddr, uint16_t u16Addr, uint8_t u8Data)
 Write byte at a certain address of AT24CXX.
en_result_t At24cxx_PageWrite (uint8_t u8DevAddr, uint16_t u16PageAddr, uint8_t *pu8Data, uint8_t u8Size)
 Write a page bytes at a page address of AT24CXX.
en_result_t At24cxx_CurrentAddrRead (uint8_t u8DevAddr, uint8_t *pu8CurData)
 Read the data of current data address of AT24CXX.
en_result_t At24cxx_RandomRead (uint8_t u8DevAddr, uint16_t u16Addr, uint8_t *pu8Data)
 Read a byte data of ramdon data address of AT24CXX.
en_result_t At24cxx_SequentialRead (uint8_t u8DevAddr, uint8_t *pu8Data, uint8_t u8Size)
 Read data bytes following by random read or current address read.
void At24cxx_Delayms (uint32_t u32Cnt)
 ms delay function

Detailed Description

A detailed description is available at Module description

History:

  • 2014-03-17 0.1 Edison Zhang First version.

Definition in file i2c_polling_at24cxx.c.


Function Documentation

static boolean_t I2cCheckErrorStatus ( void  ) [static]

Check the error status of I2C.

Return values:
TRUENo error
FALSEI2C error occurs

Definition at line 80 of file i2c_polling_at24cxx.c.

References EE_I2C_CH, FALSE, I2cBusErr, I2cOverrunError, Mfs_I2c_GetStatus(), and TRUE.

Referenced by I2cRead(), I2cRestart(), I2cSendData(), and I2cStart().

Here is the call graph for this function:

Here is the caller graph for this function:

static en_result_t I2cRead ( uint8_t *  pRxData,
uint8_t  u8Size 
) [static]

Read I2C data.

Parameters:
[out]pRxDataPointer to data address
[in]u8SizeData size
Return values:
OkI2C read normally
ErrorI2C NACK, bus error, overrun error

Definition at line 258 of file i2c_polling_at24cxx.c.

References EE_I2C_CH, Error, I2cAck, I2cCheckErrorStatus(), I2cNAck, I2cRxFull, I2cRxTxInt, Mfs_I2c_ClrStatus(), Mfs_I2c_ConfigAck(), Mfs_I2c_GetStatus(), Mfs_I2c_ReceiveData(), Ok, and TRUE.

Referenced by At24cxx_CurrentAddrRead(), At24cxx_RandomRead(), and At24cxx_SequentialRead().

Here is the call graph for this function:

Here is the caller graph for this function:

static en_result_t I2cRestart ( uint8_t  u8Addr) [static]

Generate I2C restart signal and send device address.

Parameters:
[in]u8AddrDevice address
Return values:
OkI2C restart normally
ErrorTimeoutI2C timeout
ErrorOther errors

Definition at line 155 of file i2c_polling_at24cxx.c.

References EE_I2C_CH, Error, ErrorTimeout, I2cAck, I2cCheckErrorStatus(), I2cNAck, I2cRxTxInt, Mfs_I2c_ConfigAck(), Mfs_I2c_GenerateRestart(), Mfs_I2c_GetAck(), Mfs_I2c_GetStatus(), Mfs_I2c_SendData(), Ok, and TRUE.

Referenced by At24cxx_RandomRead().

Here is the call graph for this function:

Here is the caller graph for this function:

static en_result_t I2cSendData ( uint8_t *  pu8Data,
uint8_t  u8Size 
) [static]

Sene I2C data.

Parameters:
[in]pu8DataPointer to data address
[in]u8SizeData size
Return values:
OkI2C data send normally
ErrorI2C NACK, bus error, overrun error

Definition at line 204 of file i2c_polling_at24cxx.c.

References EE_I2C_CH, Error, I2cCheckErrorStatus(), I2cNAck, I2cRxTxInt, I2cTxEmpty, Mfs_I2c_ClrStatus(), Mfs_I2c_GetAck(), Mfs_I2c_GetStatus(), Mfs_I2c_SendData(), Ok, and TRUE.

Referenced by At24cxx_ByteWrite(), At24cxx_PageWrite(), and At24cxx_RandomRead().

Here is the call graph for this function:

Here is the caller graph for this function:

static en_result_t I2cStart ( uint8_t  u8DevAddr) [static]

Generate I2C start signal and send device address.

Parameters:
[in]u8DevAddrDevice address
Return values:
OkI2C start normally
ErrorTimeoutI2C timeout
ErrorOther errors

Definition at line 106 of file i2c_polling_at24cxx.c.

References EE_I2C_CH, Error, ErrorTimeout, I2cAck, I2cCheckErrorStatus(), I2cNAck, I2cRxTxInt, Mfs_I2c_ConfigAck(), Mfs_I2c_GenerateStart(), Mfs_I2c_GetAck(), Mfs_I2c_GetStatus(), Mfs_I2c_SendData(), Ok, and TRUE.

Referenced by At24cxx_ByteWrite(), At24cxx_CurrentAddrRead(), At24cxx_PageWrite(), At24cxx_RandomRead(), and At24cxx_SequentialRead().

Here is the call graph for this function:

Here is the caller graph for this function:

static en_result_t I2cStop ( void  ) [static]

Generate I2C stop signal.

Return values:
OkI2C stop normally
ErrorTimeoutI2C timeout
ErrorOther errors

Definition at line 319 of file i2c_polling_at24cxx.c.

References EE_I2C_CH, Error, ErrorTimeout, I2cBusErr, I2cRxTxInt, I2cStopDetect, Mfs_I2c_ClrStatus(), Mfs_I2c_GenerateStop(), Mfs_I2c_GetStatus(), Ok, and TRUE.

Referenced by At24cxx_ByteWrite(), At24cxx_CurrentAddrRead(), At24cxx_PageWrite(), At24cxx_RandomRead(), and At24cxx_SequentialRead().

Here is the call graph for this function:

Here is the caller graph for this function: