I'm currently using the USBHID library to turn my mbed into an HID device. I've got code that looks like this:
void transfer_USB(){
if(hid.readNB(&recv_report)){
read the report
do stuff
}
}
Ticker usb_timing;
void main(int){
usb_timing.attach(&transfer_USB, 0.5);
while(1){
do stuff
}
}
I'm using usb_timing to check every 0.5s whether anything has been sent from the host. I've noticed that if I try to check more frequently (say every 0.3s), the computer will no longer recognize the mbed as a USB device. According to the USBHID.cpp file, bInterval = 10ms in the configuration descriptor so I wouldn't think that 300ms would be much of a problem.
My questions are:
1. Using my current method, is there a way to get the transfer rate down to under 100ms?
2. If not, is there any way I can handle the USB receive interrupt on my own in a way that either complements or supercedes the current implementation?
3. In the USBHID.cpp file, I see "callback" methods that are described as being "called in ISR context". What are these for? Can I use them to implement my own interrupt handling?
Thanks
I'm currently using the USBHID library to turn my mbed into an HID device. I've got code that looks like this:
void transfer_USB(){ if(hid.readNB(&recv_report)){ read the report do stuff } }
Ticker usb_timing;
void main(int){ usb_timing.attach(&transfer_USB, 0.5); while(1){ do stuff } }
I'm using usb_timing to check every 0.5s whether anything has been sent from the host. I've noticed that if I try to check more frequently (say every 0.3s), the computer will no longer recognize the mbed as a USB device. According to the USBHID.cpp file, bInterval = 10ms in the configuration descriptor so I wouldn't think that 300ms would be much of a problem.
My questions are: 1. Using my current method, is there a way to get the transfer rate down to under 100ms? 2. If not, is there any way I can handle the USB receive interrupt on my own in a way that either complements or supercedes the current implementation? 3. In the USBHID.cpp file, I see "callback" methods that are described as being "called in ISR context". What are these for? Can I use them to implement my own interrupt handling?
Thanks