zpBootEvent (Function)

Top  Previous  Next

Architecture:

X32

Device support:

SX1

Firmware version:

2.70


This function will query the event which has caused the device to boot.

 

The boot events have the following precedence when multiple sources have been detected:

 

Power Down has been called (see pmPowerDown).

Hardware reset (reset switch used).

Vibration (see zpPowerDown).

Timeout (see zpPowerDown).

Digital input 1 change.

Digital input 2 change.

External power applied.

Software reset (e.g. boardReset, boardWatchdog, etc.)

 

If no change in system state can be detected, the function will return "-1". An example would be if the external power was removed and applied after entering Zero Power mode by using zpPowerDown.

 

Input:

None.

 

Returns: INT

7


Digital input 2 change.

6


Digital input 1 change.

5


Vibration (see zpPowerDown).

4


Timeout (see zpPowerDown).

3


External power applied.

2


Power Down has been called (see pmPowerDown).

1


Hardware reset (reset switch used).

0


Software reset (e.g. boardReset, boardWatchdog, etc.)

-1


Unknown boot source.

 

Declaration:

FUNCTION zpBootEvent : INT;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
DebugFmt(message := "Reason for boot : \1", v1 := zpBootEvent());
BEGIN
  // boot once a day or on vibration
  zpPowerDown(Time := (60*24), Vibration := TRUE);
END;
 
END_PROGRAM;