1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-27 16:39:29 +00:00

Added some sleep mode related functions, fixed the example, fixed some things

This commit is contained in:
Firew0lf 2016-05-09 23:28:41 +02:00
parent b4ceb200ea
commit 5494f3d2e5
5 changed files with 34 additions and 4 deletions

View file

@ -107,6 +107,30 @@ static int apt_getMenuAppID(lua_State *L) {
return 1;
}
/***
Allow or not the system to enter sleep mode.
@function setSleepAllowed
@tparam boolean allowed `true` to allow, `false` to disallow
*/
static int apt_setSleepAllowed(lua_State *L) {
bool allowed = lua_toboolean(L, 1);
aptSetSleepAllowed(allowed);
return 0;
}
/***
Check if sleep mode is allowed.
@function isSleepAllowed
@treturn boolean `true` is allowed, false if not.
*/
static int apt_isSleepAllowed(lua_State *L) {
lua_pushboolean(L, aptIsSleepAllowed());
return 1;
}
static const struct luaL_Reg apt_lib[] = {
{"openSession", apt_openSession },
{"closeSession", apt_closeSession },
@ -117,6 +141,8 @@ static const struct luaL_Reg apt_lib[] = {
{"setStatusPower", apt_setStatusPower },
{"signalReadyForSleep", apt_signalReadyForSleep},
{"getMenuAppID", apt_getMenuAppID },
{"setSleepAllowed", apt_setSleepAllowed },
{"isSleepAllowed", apt_isSleepAllowed },
{NULL, NULL}
};