MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / Sleep

Class Sleep

modules/base/sleep/sleep.js:21–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 */
20
21export class Sleep {
22 static install(handler) {
23 // this dance allows handlers to be installed both at preload and run time
24 if (Object.isFrozen(Sleep.prototype.handlers))
25 Sleep.prototype.handlers = Array.from(Sleep.prototype.handlers);
26 Sleep.prototype.handlers.push(handler);
27 }
28
29 static getPersistentValue(index) @ "xs_get_persistent_value";
30 static setPersistentValue(index, value) @ "xs_set_persistent_value";
31 static deep(ms) {
32 Sleep.prototype.handlers.forEach(handler => (handler)());
33 this.doSleepEM4(ms);
34 }
35 static doSleepEM4(ms) @ "xs_sleep_enter_em4";
36 static getWakeupCause() @ "xs_sleep_get_reset_cause";
37 static getWakeupPin() @ "xs_sleep_get_wakeup_pin";
38
39 static getIdleSleepLevel() @ "xs_sleep_get_idle_sleep_level";
40 static setIdleSleepLevel(level) @ "xs_sleep_set_idle_sleep_level";
41};
42
43Sleep.PowerOnReset = 0b00000001; // power applied
44Sleep.ExternalReset = 0b00000010; // reset button

Callers 7

_262_agent_sleepFunction · 0.85
fxProgrammingModeSerialFunction · 0.85
fxRestartSerialFunction · 0.85
mainFunction · 0.85
modTimerDelayMSFunction · 0.85
PiuScreenQuitFunction · 0.85
fx_agent_sleepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected