Atmel AVR262
11
8375A-AVR-03/11
6.3 HID report generation
6.3.1 hid_report_in
Whenever the host requests data, the device responds accordingly. If there is no new
data, the device sends a NAK response. When new data is available, the device
needs to send the information to the host. This function is responsible for generating
the report to be sent via USB.
Whenever a touch or release is sensed, the value of the touch_data variable changes
and the host is updated with the new status.
Usb_select_endpoint(EP_HID_IN);
if(!Is_usb_write_enabled())
return; // Not ready to send
report
if (touch_data == old_touch_data)
return;
old_touch_data = touch_data;
// Send report
Usb_write_byte(touch_data); // Touch Information
Usb_write_byte(GPIOR1); // Dummy (not used)
Usb_write_byte(GPIOR1); // Dummy (not used)
Usb_write_byte(GPIOR1); // Dummy (not used)
Usb_write_byte(GPIOR1); // Dummy (not used)
Usb_write_byte(GPIOR1); // Dummy (not used)
Usb_write_byte(GPIOR1); // Dummy (not used)
Usb_write_byte(GPIOR1); // Dummy (not used)
Usb_ack_in_ready(); // Send data over the
USB