Availability | All terminals | ||||
Description |
This function is used to find out if the device has been in powered down state. A call to PoweredDown() returns the state of the flag, and it will clear the flag. |
||||
Syntax | int PoweredDown( void ); | ||||
Arguments | None | ||||
Returns |
|
||||
Remarks |
A call to PoweredDown() will clear the PoweredDown flag in the operating system. A call to IsColdBoot() makes it possible to distinguish between a restart after an automatic powering off and a cold boot. |
||||
Example |
#include <stdio.h> #include "lib.h" void main(void) { AutoPowerDown(ON, 1*50); // 1 second AutoPowerDown(APD_SHUTDOWN_ON, 20*50); // 20 seconds if (IsColdBoot()) Sound(TSTANDARD, VHIGH, SLOW, SMEDIUM, SHIGH, SLOW, SMEDIUM, SHIGH, 0); // 6 tones: Start-up beep else Sound(TSTANDARD, VHIGH, SHIGH, SMEDIUM, SHIGH, 0); // 3 tones: was powered off beep PoweredDown(); // Reset the sleep flag on start-up for(;;) { if(getchar() == TRIGGER_KEY) { if(PoweredDown()) Sound(TSTANDARD, VHIGH, SMEDIUM, SHIGH, 0); // 2 tones: Device has slept } Idle(); // Important to lower power consumption while awake } } |