code clean up and added comments
This commit is contained in:
@@ -44,7 +44,6 @@ int run_hid_device(void) {
|
||||
|
||||
while (true) {
|
||||
tud_task(); // tinyusb device task
|
||||
//tud_cdc_write_flush();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -59,10 +58,11 @@ void tud_hid_set_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_
|
||||
|
||||
|
||||
if (instance == 0 && report_type==HID_REPORT_TYPE_OUTPUT && report_id==REPORT_ID_KEYBOARD && bufsize==1) {
|
||||
//received keyboard LED status, so update
|
||||
//received keyboard indicator LED status, so update
|
||||
set_indicator(buffer);
|
||||
}
|
||||
|
||||
// forward USB report to CDC for debugging
|
||||
char tempbuf[128];
|
||||
size_t count;
|
||||
if(bufsize>0) {
|
||||
@@ -84,13 +84,7 @@ void tud_hid_set_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_
|
||||
|
||||
uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen)
|
||||
{
|
||||
// TODO not Implemented
|
||||
(void) instance;
|
||||
(void) report_id;
|
||||
(void) report_type;
|
||||
(void) buffer;
|
||||
(void) reqlen;
|
||||
|
||||
// echo USB communication to CDC for debugging
|
||||
char tempbuf[128];
|
||||
size_t count;
|
||||
if(reqlen>0) {
|
||||
@@ -108,29 +102,3 @@ uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_t
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Invoked when sent REPORT successfully to host
|
||||
// Application can use this to send the next report
|
||||
// Note: For composite reports, report[0] is report ID
|
||||
/*
|
||||
void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_t len)
|
||||
{
|
||||
(void) instance;
|
||||
(void) len;
|
||||
|
||||
char tempbuf[128];
|
||||
size_t count;
|
||||
if(len>0) {
|
||||
count = sprintf(tempbuf, "\nDevice sent report on interface %u (%u)\n", instance, len);
|
||||
tud_cdc_write(tempbuf, count);
|
||||
for(int i=0;i<len;i++){
|
||||
count=sprintf(tempbuf,"%02X ",report[i]);
|
||||
tud_cdc_write(tempbuf,count);
|
||||
}
|
||||
count = sprintf(tempbuf, "\n");
|
||||
tud_cdc_write(tempbuf,count);
|
||||
tud_cdc_write_flush();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user