Availability | All terminals | ||||||||||||||||
Description | The OPN-2500 and OPN-6000 have 4 power states: active, idle, sleep (power down) and power off. This function controls the sleep (power down) and power off time. Every time when the user presses a key, or when the communications port receives data, the count down for automatic power down is reset. | ||||||||||||||||
Syntax | void AutoPowerDown(int command, unsigned long time); | ||||||||||||||||
Arguments |
int commandThe action that AutoPowerDown() must perform. One of the following values:
unsigned long timeThe time before the terminal powers down automatically. |
||||||||||||||||
Returns | None | ||||||||||||||||
Remarks |
time is an unsigned long. The maximum value is 4294967295, approx. 2.5 years. The minimum value is theoretically zero, but the power down time is limited to 1 second. The default power down and off times are different for the various terminals, and are shown below:
Be very sure that when you use the APD_SHUTDOWN_ON, to never leave files open before the system shuts down. To make sure that no files are left open, use the new API-function 'Application_ShutdownCallback' which installs a call back function, which is called before the device powers off (when idle or forced due to a low battery) and when the USB cable is connected in USB-MSD mode. |
||||||||||||||||
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 } } |