-
Ajouter la gestion des points d’accès dans l’autre source C du projet.
- Définir les points d’accès dans la fonction EVENT_USB_Device_ConfigurationChanged :
Endpoint_ConfigureEndpoint(<EPADDR>, <EP_TYPE>, <EPSIZE>, 1);
- Appeler ces fonctions de gestion dans la boucle infinie USB_USBTask.
- Fonction de gestion d’un point d’accès IN :
/* Select the IN Endpoint */
Endpoint_SelectEndpoint(IN_EPADDR);
/* Check if Endpoint Ready for Read/Write */
if(Endpoint_IsReadWriteAllowed()){
/* Write Keyboard Report Data */
Endpoint_Write_xxx(...);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
}
- Fonction de gestion d’un point d’accès OUT :
/* Select the OUT Endpoint */
Endpoint_SelectEndpoint(OUT_EPADDR);
/* Check if Endpoint contains a packet */
if(Endpoint_IsOUTReceived()){
/* Check to see if the packet contains data */
if(Endpoint_IsReadWriteAllowed()){
/* Read from the host */
... Endpoint_Read_yyy(...);
/* Process the data from the host */
...
}
/* Handshake the OUT Endpoint - clear endpoint and ready for next report */
Endpoint_ClearOUT();
}