C Language Development Kit/Functions/PoweredDown

From OptiWiki

Jump to: navigation, search
Description This function is used to find out if the handheld terminal has been powered down. This can be useful if the application must

start in a certain state after switching on the handheld terminal. The operating system keeps track if the handheld terminal was switched on by maintaining a flag. A call to powereddown() returns the state of the flag, and it will clear the flag.

Syntax
int powereddown(void);
Arguments None
Returns
0 The handheld terminal has not been powered down since the last call to powereddown().
1 The handheld terminal has been powered down since the last call to powereddown().
Remarks A call to powereddown() will clear the powereddown flag in the operating system.
Example
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
    autopowerdown( ON, 50*10);    // switch off after 10 sec
    printf("\fTesting\npowereddown..");
    for(;;)
    {
        if( powereddown())
        {
            printf("\fTerminal was\nswitched off!");
            delay( 50*2 );
            printf("\fRunning again");
        }
    }
}


Views
Personal tools