CyU3PUsbSendEP0Data() can be called only when the data is requested by the PC. The FX3 cannot send it anytime it wishes,
So the actual sequence should be
(ii) Interrupt Function should set a flag that a button has been pressed.
(iii) PC should request data via Control Request
(iv) FX3 received the control request and checks if the Button has been pressed or not using the flag. If it is pressed, it sends the code to the PC using CyU3PUsbSendEP0Data API
Thank you for your reply.
If I want to send code to PC anytime it wishes, how can I realize it?
This method maybe help you.
1. enable hardware trigger event(general event, not still image trigger event)
2. send this hardware event to HSOT
3. HOST send one vendor cmd to FX3/CX3
4. FX3/CX3 return GPIO information to HOST(PC)