Hello!
I'd like to implement such a example with AFS: Arduino Due (SAM3x8e) as USB HID device with 1 USB interface and 4 endpoints (1 control + 2 interrupt in + 1 interrupt out). Each interrupt_in endpoint has its own callback. If data is received at interrupt_in_1, toggle led 1, else toggle led 2. I cannot get how to do it using ASF.
Could you please help me with the questions I cannot answer myself using manuals from Atmel?
-
Should we modify USB interrupt handler directly?
-
How can we get what did trigger USB interrupt? According to SAM3x datasheet there are many interrupt sources, but only one general flag is set. After getting a USB interrupt we should check different registers to get the exact source. Is there a way to do that using ASF, without register magic?
-
What are predefined callbacks? In manuals there are UDI callbacks for connect/disconnect and for power management. I cannot find data sent/data received callbacks and cannot get how to write and register them.
-
Is it adequate to use different endpoints for different effectors? I.e. I have 2 step motors and want interrupt callback to be as fast as possible. Is it better to give the motors a "personal" endpoint each, or have a single endpoint at price of a bit harder report_out parsing?
-
May be it is better to switch from ASF to something different? Are there something LUFA port for SAM?
-
What is the best way to communicate with the device? LibUSB or something different?
Best,
Gryph