Detection Suspend Mode - example.
Posted: Thu Dec 25, 2014 4:40 pm
I have no opportunity to use the usbSofCount variable therefore I realized another method of detection of a suspend mode:
I don't use the mode of the low-energy consumption but only I disconnect a LED.
It is an example, possibly, it is written not absolutely correctly You don't judge strictly
Code: Select all
for(;;){ /* main event loop */
usbPoll();
if(IsBusy){
StartProcess();
IsBusy = 0;
}else Sleep();
}
Code: Select all
void Sleep()
{
unsigned int a = 1024, taqt = 0;;
unsigned char val = 0, val_2 = 0;
val = PINB&0x01;
while(--a){
val_2 = PINB&0x01;
if(val!=val_2)
taqt++;
val = val_2;
}
if(taqt){
OnLed();
}else OffLed();
}
I don't use the mode of the low-energy consumption but only I disconnect a LED.
It is an example, possibly, it is written not absolutely correctly You don't judge strictly