IPC@CHIP® RTOS-LNX – API Documentation

Header image

Main page


Functions
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.

The I2C API expects the I2C slave address in this format:

Note: The I2C-bus API of the SC1x8 and SC1x5 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 bus. More...
 
void i2cSetSpeed (BYTE idx, unsigned int value)
 Set I2C speed, clock frequency and timing. More...
 
unsigned int i2cWrite (BYTE idx, unsigned int addr, const BYTE *bufferPtr, unsigned int nbytes, BOOLEAN ext)
 Write bytes to a I2C slave on a certain address. More...
 
unsigned int i2cRead (BYTE idx, unsigned int addr, BYTE *bufferPtr, unsigned int nbytes, BOOLEAN ext)
 Read bytes from a I2C slave on a certain address. More...
 
void i2cSetTimeout (BYTE idx, unsigned int time)
 Set I2C timeout value. More...
 
void i2cReset (BYTE idx)
 Perform a I2C software reset. More...
 
unsigned int i2cScan (BYTE idx, unsigned int start_addr, unsigned int end_addr, BOOLEAN ext)
 Scan for I2C slave devices. More...
 
unsigned int i2cTransfer (BYTE idx, I2cData *data)
 Transfer data to and from I2C slave devices. More...
 
unsigned int i2cTransmitChar (BYTE idx, unsigned int addr, BYTE data, BOOLEAN ext)
 Send a single character. More...
 
unsigned int i2cTransmitBlock (BYTE idx, unsigned int addr, BYTE *buffer, int length, BOOLEAN ext)
 Send a block of characters. More...
 
unsigned int i2cReceiveBlock (BYTE idx, unsigned int addr, BYTE *buffer, int length, BOOLEAN ext)
 Receive a block of characters. More...
 
unsigned int i2cReceiveChar (BYTE idx, unsigned int addr, BYTE *data, BOOLEAN not_last, BOOLEAN ext)
 Receive a single character. More...
 
void i2cRelease (BYTE idx)
 Return I2C master to the idle state. More...
 





Top of page | Main page

Copyright © 2018 Beck IPC GmbH
Generated on Fri Jun 8 2018 12:48:20 by Doxygen 1.8.13