Kamcho Library 02.00.03  lib.kamcho.02.00.03.287
Data Structures | Macros | Functions
i2c_sfrs.h File Reference

Go to the source code of this file.

Data Structures

struct  I2C_SFRS_t
 A structure to represent Special Function Registers for I2C. More...
 

Macros

#define I2C_SFRS   ((__IO I2C_SFRS_t *) (SDIO_BASE + 0x08))
 The starting address of I2C SFRS. More...
 
#define E_I2C_STATUS_BIT_IRBUFOVL   ((uint8_t) (1<<0))
 The enumeration of I2C status. More...
 
#define E_I2C_STATUS_BIT_IWBUFOVL   ((uint8_t) (1<<1))
 
#define E_I2C_STATUS_BIT_IBUFF   ((uint8_t) (1<<2))
 
#define E_I2C_STATUS_BIT_IRWBUSY   ((uint8_t) (1<<3))
 
#define E_I2C_STATUS_BIT_ISTPR   ((uint8_t) (1<<4))
 
#define E_I2C_STATUS_BIT_ISTRR   ((uint8_t) (1<<5))
 
#define E_I2C_STATUS_BIT_IADDRR   ((uint8_t) (1<<6))
 
#define E_I2C_STATUS_BIT_IACKR   ((uint8_t) (1<<7))
 
#define E_I2C_CTRL1_BIT_ISTRSTRETCH   ((uint8_t) (1<<0))
 The enumeration of I2C control 1 register. More...
 
#define E_I2C_CTRL1_BIT_ISTPSIZE   ((uint8_t) (1<<1))
 
#define E_I2C_CTRL1_BIT_ISACK   ((uint8_t) (1<<2))
 
#define E_I2C_CTRL1_BIT_ISNACK   ((uint8_t) (1<<3))
 
#define E_I2C_CTRL1_BIT_IRCSTRT   ((uint8_t) (1<<4))
 
#define E_I2C_CTRL1_BIT_IGC   ((uint8_t) (1<<5))
 
#define E_I2C_CTRL1_BIT_ICLKSTR   ((uint8_t) (1<<6))
 
#define E_I2C_CTRL1_BIT_IRSTR   ((uint8_t) (1<<7))
 

Functions

static __INLINE void f_I2C_Enable (void)
 Enable I2C Module. More...
 
static __INLINE void f_I2C_Disable (void)
 Disable I2C Module. More...
 
static __INLINE void f_I2C_WriteData (uint8_t data)
 Write a byte to I2C module. More...
 
static __INLINE uint8_t f_I2C_ReadData (void)
 Read a byte from I2C module. More...
 
static __INLINE uint8_t f_I2C_GetStatus (void)
 Get the status of I2C module. More...
 
static __INLINE void f_I2C_SlaveClockStretch (void)
 Start clock stretch in I2C slave mode. More...
 
static __INLINE void f_I2C_SlaveReleaseClock (void)
 Release clock stretch in I2C slave mode. More...
 
static __INLINE void f_I2C_SlaveEnableGeneralCall (void)
 Enable general call mode in I2C slave mode. More...
 
static __INLINE void f_I2C_SlaveDisableGeneralCall (void)
 Disable general call mode in I2C slave mode. More...
 
static __INLINE void f_I2C_SlaveAddreeSizeTen (void)
 Set slave address length. More...
 
static __INLINE void f_I2C_MasterRepeatStart (void)
 Send Repeat Start bit in I2C master mode. More...
 
static __INLINE void f_I2C_MasterReceiveStart (void)
 Start to receive data in I2C master mode. More...
 
static __INLINE void f_I2C_MasterIssueNack (void)
 Issue NACK bit in I2C master mode. More...
 
static __INLINE void f_I2C_MasterIssueAck (void)
 Issue Ack bit in I2C master mode. More...
 
static __INLINE void f_I2C_MasterIssueStop (void)
 Issue a Stop bit in I2C master mode. More...
 
static __INLINE void f_I2C_MasterIssueStart (void)
 Issue a Start bit in I2C master mode. More...
 
static __INLINE void f_I2C_InitMasterMode (void)
 Initialize I2C module to master mode. More...
 
static __INLINE void f_I2C_InitSlaveMode (void)
 Initialize I2C module to slave mode. More...
 
static __INLINE uint8_t f_I2C_IsMasterMode (void)
 Check if I2C module a master mode. More...
 
static __INLINE void f_I2C_Set7BitSlaveAddr (void)
 Set I2C slave address in 7-bit mode. More...
 
static __INLINE void f_I2C_Set10BitSlaveAddr (void)
 Set I2C slave address in 10-bit mode. More...
 
static __INLINE void f_I2C_EnableFilter (void)
 Enable I2C filter. More...
 
static __INLINE void f_I2C_DisableFilter (void)
 Disable I2C filter. More...
 
static __INLINE void f_I2C_SetSlaveAddress (uint16_t addr)
 Set I2C address in slave mode. More...
 
static __INLINE void f_I2C_SetSlaveAddressMask (uint16_t mask)
 Set I2C address mask in slave mode. More...
 
static __INLINE void f_I2C_SetClockDivider (uint8_t div)
 Set clock divider for I2C module. More...
 
static __INLINE uint8_t f_I2C_WriteBuffNotEmpty (void)
 Check if I2C write buffer full. More...
 
static __INLINE uint8_t f_I2C_BuffFull (void)
 Check if I2C buffer full. More...
 
static __INLINE uint8_t f_I2C_StartBitReceived (void)
 Check if I2C Start bit is received. More...
 

Detailed Description

This file is proprietary to Indie Semiconductor. All rights reserved. Reproduction or distribution, in whole or in part, is forbidden except by express written permission of Indie Semiconductor.

Macro Definition Documentation

#define E_I2C_CTRL1_BIT_ICLKSTR   ((uint8_t) (1<<6))

Release clock stretch

#define E_I2C_CTRL1_BIT_IGC   ((uint8_t) (1<<5))

Enable general call

#define E_I2C_CTRL1_BIT_IRCSTRT   ((uint8_t) (1<<4))

Start receiving

#define E_I2C_CTRL1_BIT_IRSTR   ((uint8_t) (1<<7))

Send Repeat Start bit

#define E_I2C_CTRL1_BIT_ISACK   ((uint8_t) (1<<2))

Issue Ack

#define E_I2C_CTRL1_BIT_ISNACK   ((uint8_t) (1<<3))

Set Ack bit value

#define E_I2C_CTRL1_BIT_ISTPSIZE   ((uint8_t) (1<<1))

Issue a Stop bit

#define E_I2C_CTRL1_BIT_ISTRSTRETCH   ((uint8_t) (1<<0))

The enumeration of I2C control 1 register.

Start clock stretch

#define E_I2C_STATUS_BIT_IACKR   ((uint8_t) (1<<7))

Ack Received

#define E_I2C_STATUS_BIT_IADDRR   ((uint8_t) (1<<6))

Data or address received in slave mode

#define E_I2C_STATUS_BIT_IBUFF   ((uint8_t) (1<<2))

Buffer full

#define E_I2C_STATUS_BIT_IRBUFOVL   ((uint8_t) (1<<0))

The enumeration of I2C status.

Read buffer overflow

#define E_I2C_STATUS_BIT_IRWBUSY   ((uint8_t) (1<<3))

Read or write busy

#define E_I2C_STATUS_BIT_ISTPR   ((uint8_t) (1<<4))

Stop bit received in slave mode

#define E_I2C_STATUS_BIT_ISTRR   ((uint8_t) (1<<5))

Start bit received

#define E_I2C_STATUS_BIT_IWBUFOVL   ((uint8_t) (1<<1))

Write buffer overflow

#define I2C_SFRS   ((__IO I2C_SFRS_t *) (SDIO_BASE + 0x08))

The starting address of I2C SFRS.

Function Documentation

static __INLINE uint8_t f_I2C_BuffFull ( void  )
static

Check if I2C buffer full.

Returns
The buffer full bit of the I2C status register.
static __INLINE void f_I2C_Disable ( void  )
static

Disable I2C Module.

static __INLINE void f_I2C_DisableFilter ( void  )
static

Disable I2C filter.

static __INLINE void f_I2C_Enable ( void  )
static

Enable I2C Module.

static __INLINE void f_I2C_EnableFilter ( void  )
static

Enable I2C filter.

static __INLINE uint8_t f_I2C_GetStatus ( void  )
static

Get the status of I2C module.

Returns
The value of status register of I2C module.
static __INLINE void f_I2C_InitMasterMode ( void  )
static

Initialize I2C module to master mode.

static __INLINE void f_I2C_InitSlaveMode ( void  )
static

Initialize I2C module to slave mode.

static __INLINE uint8_t f_I2C_IsMasterMode ( void  )
static

Check if I2C module a master mode.

static __INLINE void f_I2C_MasterIssueAck ( void  )
static

Issue Ack bit in I2C master mode.

static __INLINE void f_I2C_MasterIssueNack ( void  )
static

Issue NACK bit in I2C master mode.

static __INLINE void f_I2C_MasterIssueStart ( void  )
static

Issue a Start bit in I2C master mode.

static __INLINE void f_I2C_MasterIssueStop ( void  )
static

Issue a Stop bit in I2C master mode.

static __INLINE void f_I2C_MasterReceiveStart ( void  )
static

Start to receive data in I2C master mode.

static __INLINE void f_I2C_MasterRepeatStart ( void  )
static

Send Repeat Start bit in I2C master mode.

static __INLINE uint8_t f_I2C_ReadData ( void  )
static

Read a byte from I2C module.

static __INLINE void f_I2C_Set10BitSlaveAddr ( void  )
static

Set I2C slave address in 10-bit mode.

static __INLINE void f_I2C_Set7BitSlaveAddr ( void  )
static

Set I2C slave address in 7-bit mode.

static __INLINE void f_I2C_SetClockDivider ( uint8_t  div)
static

Set clock divider for I2C module.

Parameters
divThe divider for I2C clock.
static __INLINE void f_I2C_SetSlaveAddress ( uint16_t  addr)
static

Set I2C address in slave mode.

Parameters
addrThe slave address.
static __INLINE void f_I2C_SetSlaveAddressMask ( uint16_t  mask)
static

Set I2C address mask in slave mode.

Parameters
maskThe slave address mask.
static __INLINE void f_I2C_SlaveAddreeSizeTen ( void  )
static

Set slave address length.

static __INLINE void f_I2C_SlaveClockStretch ( void  )
static

Start clock stretch in I2C slave mode.

static __INLINE void f_I2C_SlaveDisableGeneralCall ( void  )
static

Disable general call mode in I2C slave mode.

static __INLINE void f_I2C_SlaveEnableGeneralCall ( void  )
static

Enable general call mode in I2C slave mode.

static __INLINE void f_I2C_SlaveReleaseClock ( void  )
static

Release clock stretch in I2C slave mode.

static __INLINE uint8_t f_I2C_StartBitReceived ( void  )
static

Check if I2C Start bit is received.

Returns
The state of Start Bit Received in I2C status register.
static __INLINE uint8_t f_I2C_WriteBuffNotEmpty ( void  )
static

Check if I2C write buffer full.

Returns
The write buffer full bit of the I2C status register.
static __INLINE void f_I2C_WriteData ( uint8_t  data)
static

Write a byte to I2C module.