clockSetWakeup (Function) |
Top Previous Next |
This function is used to configure the system to wake from suspend at a specific time. It can e.g. be used to wake at midnight so the device can send a report. The time can both be supplied as a linsec with an absolute time to wake at and the individual time components such as hour and minute. If the time components are provided, the wake time will be set to an absolute time when the function is called, so it should be called just before calling pmSuspend. When using time components, at least one part must be specified. All the parts that are larger than the specified parts will be ignored while all the parts that are smaller will be set to the current time. The time will always be adjusted to be in the future, if e.g. a day is chosen that is smaller that the current day, it will trigger in the next month instead. Examples: Current time: 2019-04-02 15:44 Setting month = 5: 2019-05-02 15:44 Setting hour = 0: 2019-04-03 00:44 Setting minute = 30: 2019-04-02 16:30
Note that this can not be used while also using the time parameter on pmSuspend.
pmSuspend return codes for this wake-up source:
Input:
Enable : BOOL (default: TRUE) Set to true to enable the wake-up, set to false to disable it.
linsec : DINT (default: -1) The linsec to wake at. If set to -1 it will not be used.
month : SINT (default: -1) The month part of the wake-up time. If set to -1, the month will be ignored.
day : SINT (default: -1) The day part of the wake-up time. If set to -1, the day will be ignored.
hour : SINT (default: -1) The hour part of the wake-up time. If set to -1, the hour will be ignored.
minute : SINT (default: -1) The minute part of the wake-up time. If set to -1, the minute will be ignored.
second: SINT (default: -1) The second part of the wake-up time. If set to -1, the second will be ignored.
Returns:
Declaration: FUNCTION ALIGN clockSetWakeup:INT;
Example: INCLUDE rtcu.inc |