API for the OSIF

terminology:-
int adapter - The number of the connected adapter from 0
int device - The address of the connected I2C device
unsigned char addr - Register Address to write to in the I2C device
unsigned char * data - Pointer to the data array to read from/recieve to
size_t buflen - Number of bytes to read/write


Initialise the OSIF

int OSIF_init(void);


De-initialise the OSIF. Must be called when closing the application.

int OSIF_deinit(void);


Write some data to the OSIF's connected I2C device

int OSIF_write(int adapter, int device, unsigned char addr, unsigned char * data, size_t buflen );


Read some data from the OSIF's connected I2C device

int OSIF_read(int adapter, int device, unsigned char addr, unsigned char * data, size_t buflen );


Perform a read only from the OSIF's I2C device. This does not call a register selection write first.

OSIF_readonly(int adapter, int device, unsigned char * data, size_t buflen );


Scan the I2C bus for devices. Returns an array of device numbers as well as a device count.

OSIF_scan(int adapter, int devices[], int *dev_count )


Probe to see if an address on the I2C bus exists.

bool OSIF_probe(int adapter, int device );


Send a single byte command to an I2C device

int OSIF_command(int adapter, int device, unsigned char command);


Returns the number of OSIF adapters currently connected.

int OSIF_get_adapter_count(void);


Returns the friendly name of the connected OSIF.

int OSIF_get_adapter_name(int adapter, char* name);


Start downloading an Intel hex formatted file to the I2C device. Mainly used for Opendevice reflashing.

int OSIF_reflash(int adapter, int device, int bootloader_addr, char *filename);

Source code examples

Visual Basic .NET example