Defines | |
#define | STREAM_CALLBACK(name) uint8_t name (void) |
#define | NO_STREAM_CALLBACK NULL |
Enumerations | |
enum | StreamCallback_Return_ErrorCodes_t { STREAMCALLBACK_Continue = 0, STREAMCALLBACK_Abort = 1 } |
#define NO_STREAM_CALLBACK NULL |
Used with the Endpoint and Pipe stream functions as the callback function parameter, indicating that the stream call has no callback function to be called between USB packets.
#define STREAM_CALLBACK | ( | name | ) | uint8_t name (void) |
Creates a prototype for or begins a stream callback routine. Stream callback routines are small routines which are executed during stream read or writes (if the callback-enabled versions of these functions are used) which allow the user application to abort the transfer when certain arbitrary conditions are met.
Stream callback functions should return a value from the StreamCallback_Return_ErrorCodes_t enum.
Usage Example (Device Endpoint, but applicable for Host pipes also):
STREAM_CALLBACK(GlobalNotSet); // Callback Prototype STREAM_CALLBACK(GlobalNotSet) { if (MyGlobal == false) return ENDPOINT_STREAMCALLBACK_Continue; else return ENDPOINT_STREAMCALLBACK_Abort; } //... // Inside some routine: if (Endpoint_Write_CStream_LE(DataBuffer, sizeof(DataBuffer), GlobalNotSet) == ENDPOINT_RWSTREAM_ERROR_CallbackAborted) { // Do something when the callback aborted the transfer early }