libi2c

Section: Linux Simple I/O Library (2)
Updated: 21 December 2018
Index Return to Main Contents
 

NAME

libi2c -- Linux Simple I/O Library: I2C Module  

SYNOPSIS

#include <libsimpleio/libi2c.h>

void I2C_open(const char *name, int32_t *fd, int32_t * error);

void I2C_close(int32_t fd, int32_t *error);

void I2C_transaction(int32_t fd, int32_t slaveaddr, void *cmd, int32_t cmdlen,
  void *resp, int32_t resplen, int32_t *error);

Link with -lsimpleio.  

DESCRIPTION

All functions return either 0 (upon success) or an errno value (upon failure) in *error.

I2C_open() opens an I2C bus controller device. The device name, /dev/i2c-x, must be passed in the name parameter. Upon success, a file descriptor for the I2C bus controller device is returned in *fd.

I2C_close() closes a previously opened I2C bus controller device.

I2C_transaction() performs a single I2C bus transaction, with optional transmit and receive phases. The I2C slave device address must be passed in the slaveaddr parameter. Either the address of a command message and its length must be passed in the cmd and cmdlen parameters, or NULL and 0 for a receive only transaction. Either the address of a receive buffer and its size must be passed in the resp and resplen parameters, or NULL and 0 for a transmit only transaction.  

SEE ALSO

libsimpleio(2), libadc(2), libdac(2), libevent(2), libgpio(2),
libhidraw(2), libipv4(2), liblinux(2), liblinx(2), libpwm(2),
libserial(2), libspi(2), libstream(2), libwatchdog(2)  

AUTHOR

Philip Munts, President, Munts AM Corp dba Munts Technologies


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 09:41:20 GMT, December 21, 2018