User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
601
HID_Enable
Prototype
void HID_Enable(char *readbuff, char *writebuff);
Description Enables USB HID communication.
Parameters - readbuff: Read Buffer.
- writebuff: Write Buffer.
These parameters are used for HID communication.
Returns Nothing.
Requires Nothing
Example
HID_Enable(&readbuff,&writebuff);
Notes This function needs to be called before using other routines of USB HID Library.
HID_Read
Prototype
char HID_Read(void);
Description Receives message from host and stores it in the Read Buffer.
Parameters None.
Returns If the data reading has failed, the function returns 0. Otherwise, it returns number of characters
received from the host.
Requires USB HID needs to be enabled before using this function. See HID_Enable.
Example
// retry until success
while(!HID_Read())
;
Notes None.
HID_Write
Prototype
char HID_Write(char *writebuff, char len);
Description Function sends data from Write Buffer writebuff to host.
Parameters - writebuff: Write Buffer, same parameter as used in initialization; see HID_Enable.
- len: species a length of the data to be transmitted.
Returns If the data transmitting has failed, the function returns 0. Otherwise, it returns number of transmitted
bytes.
Requires USB HID needs to be enabled before using this function. See HID_Enable.
Example
// retry until success
while(!HID_Write(&writebuff,64))
;
Notes Function call needs to be repeated as long as data is not successfuly sent.