12.07.2015 Views

SUB-20 User Manual - Dimax

SUB-20 User Manual - Dimax

SUB-20 User Manual - Dimax

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

54<strong>SUB</strong>-<strong>20</strong><strong>SUB</strong>-<strong>20</strong> API3.11.3 I2C SlaveConfigurationTo use <strong>SUB</strong>-<strong>20</strong> in I2C slave mode following should be done:· Configure I2C Slave module with sub_i2c_config. Set desired I2C slave address and optional flag(s).· Connect I2C Slave module to FIFO with sub_fifo_config. Set FIFO_SELECT_I2C flag.· If required write data to FIFO with sub_fifo_write. This data will be read by external I2C master.· If required read data from FIFO with sub_fifo_read. This will be data written by external I2C master.Transactions<strong>SUB</strong>-<strong>20</strong> I2C slave module acts as zero address I2C slave device. Below are diagrams of receive and transmittransactions.3.12 Error CodesAPI functions may return error code and/or set global variable sub_errno to provide information aboutcompletion of requested operation. The string describing error code can be received with sub_strerror functioncall.3.12.1 sub_errnoGlobal variable sub_errno contains status of last <strong>SUB</strong>-<strong>20</strong> API call. Variable sub_errno defined in libsub.h.Following error codes are available:0 OK1 <strong>SUB</strong> Device not found2 Can't open <strong>SUB</strong> device3 Can't set configuration© <strong>20</strong>13 xdimax.com rev 2.17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!