![Ratoc Systems REX-USB61 User Manual Download Page 64](http://html.mh-extra.com/html/ratoc-systems/rex-usb61/rex-usb61_user-manual_788102064.webp)
4. API function reference
Page.4-19
I2C bus operation on I2C bus slave mode
VC
RS_STATUS
usb61_i2c_read_slave( HANDLE hUsb61Device,
RS_NOTIFY_TYPE nType,
void (CALLBACK EXPORT* lpfnReadEvent)
(USHORT ReadBytes, UCHAR *pReadBuf),
HWND hWnd );
VB
Function
Usb61I2cReadSlave(ByVal hUsb61Device As Long,
ByVal nType As Integer) As Long
Definition
VB.NET
Function
Usb61I2cReadSlave(ByVal hUsb61Device As Integer,
ByVal nType As Short) As Integer
Description
Read a stream of bytes from the I2C master device.
In background, waiting until it receives the data from master device, after call this
function.
The completion of receiving the data, it is notified to the application via callback
function.
Before calling this function, have to call the “usb61_I2c_set_response_data()”
function to set the data for sending to master device in advance.
On Visual Basic, by using ActiveX control, as user-defined-message
"WM_USB61_MSG" is notified.
Parameters
[IN] hUsb61Device : handle of an REX-USB61 device
[IN] nType : notification method
enumerated type of notification method by using the defined symbol as the following:
RS_NOTIFY_CALLBACK notified by callback function (only VC)
RS_NOTIFY_USER_MSG notified by user message
[IN] lpfnReadEvent : callback function which notify to application
'lpfnReadEvent' callback function supplied by the upper application is set as the
argument.
The name of 'lpfnReadEvent' callback function does not have to be 'ReadIsComplete',
but it must be defined as follows:
void CALLBACK EXPORT ReadIsComplete(USHORT ReadBytes, UCHAR *pReadBuf);
[IN] hWnd : window handle which notify user message
if not notify user message, set NULL
Return
Values
RS_SUCCESS Function call succeeded.
Error code (refer. 4-5) Function call failed.