IPC@CHIP® RTOS-PPC – API Documentation

Header image

Main page


I2C API


Detailed Description

Philips was the inventor of the Inter-IC or I2C-bus, and it is now firmly established as the worldwide de-facto solution for embedded applications. It is used extensively in a variety of microcontroller-based professional, consumer and telecommunications applications as a control, diagnostic and power management bus. As a two-wire serial bus, its inherently simple operation was crucial to its emergence as the worldwide de-facto standard.

Note: The I2C-bus API of the SC2x3 uses a resource semaphore to synchronize the bus access of different tasks. With the exception of the transmit/receive and release functions, all Master mode functions wait for the semaphore to get access to the bus, perform their operation and afterwards release the ownership of the resource semaphore. The transmit/receive functions only wait for access to the resource semaphore and perform the operation. They will not release the semaphore. The I2C release function must be called to give up the ownership of the resource semaphore, other tasks are now allowed to access the bus.

Functions

void i2cInit (BYTE idx)
 Initialize the I2C interface (Master mode).
void i2cReset (BYTE idx)
 Perform a I2C software reset (Master/Slave mode).
int i2cRelease (BYTE idx)
 Return I2C master to idle (slave) state (Master mode).
void i2cSetTimeout (BYTE idx, unsigned int time)
 Set I2C timeout value (Master mode).
void i2cSetSpeed (BYTE idx, unsigned int value)
 Set I2C speed, clock frequency and timing (Master/Slave mode).
void i2cSetFilter (BYTE value)
 Setup I2C glitch filter option (Master/Slave mode).
unsigned int i2cScan (BYTE idx, unsigned int start_addr, unsigned int end_addr, BOOLEAN ext)
 Scan for I2C slave devices (Master mode).
int i2cTransmitChar (BYTE idx, unsigned int addr, BYTE data, BOOLEAN ext)
 Send a single character (Master mode).
int i2cReceiveChar (BYTE idx, unsigned int addr, BYTE *data, BOOLEAN not_last, BOOLEAN ext)
 Receive a single character (Master mode).
int i2cTransmitBlock (BYTE idx, unsigned int addr, BYTE *buffer, int length, BOOLEAN ext)
 Send a block of characters (Master mode).
int i2cReceiveBlock (BYTE idx, unsigned int addr, BYTE *buffer, int length, BOOLEAN ext)
 Receive a block of characters (Master mode).
void i2cSlaveAddress (BYTE idx, unsigned int addr, BOOLEAN genCallAddr)
 Set the I2C bus slave address (Slave mode).
unsigned int i2cSlaveGetState (BYTE idx)
 Get the I2C bus state (Slave mode).
void i2cSlaveSendByte (BYTE idx, BYTE data)
 Send a byte to I2C bus (Slave mode).
BYTE i2cSlaveReadByte (BYTE idx, BOOLEAN ack)
 Read a byte from I2C bus (Slave mode).
void i2cSlaveSendAck (BYTE idx, BOOLEAN ack)
 Send a I2C bus acknowledge (Slave mode).
void i2cSlaveIdle (BYTE idx)
 Set the I2C internal state back to idle (Slave mode).





Top of page | Main page

Copyright © 2017 Beck IPC GmbH
Generated on Thu Jan 26 16:21:36 2017 by Doxygen 1.6.1