ABC’s of USB
C. Managing my App & Transferring Data
Main Loop USB Framework
while(1){
switch( USB_connectionState() )
{
case ST_USB_DISCONNECTED:
break;
case ST_ENUM_ACTIVE:
break;
case ST_ENUM_SUSPENDED:
break;
case ST_ENUM_IN_PROGRESS:
break;
case ST_USB_CONNECTED_NO_ENUM:
break;
case ST_NOENUM_SUSPENDED:
break;
case ST_ERROR:
break;
default:;
}
}
Execution within main loop “forks”
depending on the state of USB,
creating alternate main loops
Thus, USB state becomes a central
part of managing software flow
This framework excels when the
device behaves differently in each
state!
For cases where system only cares
about one state, connectionState()
fxn could be called from IF{} stmt
Most common non-RTOS solution –
it’s used in many of the USB
examples provided with the API
These three states are where
the application spends most
of its time
7 - 24 MSP430 Workshop - USB Devices