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

Added documentation for the ctr.hid, ctr.ptm, ctr.news and ctr.gfx.texture

This commit is contained in:
Firew0lf 2015-09-13 14:39:12 +02:00
parent ab06123f7a
commit 070a0d698e
4 changed files with 263 additions and 3 deletions

View file

@ -1,3 +1,8 @@
/***
The `ptm` module.
@module ctr.ptm
@usage local ptm = require("ctr.ptm")
*/
#include <3ds/types.h>
#include <3ds/services/ptm.h>
@ -6,18 +11,31 @@
static Handle *ptmHandle;
/***
Initialize the PTM module.
@function init
*/
static int ptm_init(lua_State *L) {
ptmInit();
return 0;
}
/***
Disable the PTM module.
@function shutdown
*/
static int ptm_shutdown(lua_State *L) {
ptmExit();
return 0;
}
/***
Return the shell state. Don't care about this.
@function getShellState
@treturn number shell state
*/
static int ptm_getShellState(lua_State *L) {
u8 out = 0;
PTMU_GetShellState(ptmHandle, &out);
@ -27,6 +45,11 @@ static int ptm_getShellState(lua_State *L) {
return 1;
}
/***
Return the battery level.
@function getBatteryLevel
@treturn number battery level (`5`: fully charged; `0`: empty)
*/
static int ptm_getBatteryLevel(lua_State *L) {
u8 out = 0;
PTMU_GetBatteryLevel(ptmHandle, &out);
@ -36,24 +59,39 @@ static int ptm_getBatteryLevel(lua_State *L) {
return 1;
}
/***
Return whether or not the battery is charging.
@function getBatteryChargeState
@treturn boolean `true` if the battery is charging
*/
static int ptm_getBatteryChargeState(lua_State *L) {
u8 out = 0;
PTMU_GetBatteryChargeState(ptmHandle, &out);
lua_pushinteger(L, out);
lua_pushboolean(L, out);
return 1;
}
/***
Return whether or not the pedometer is counting.
@function getPedometerState
@treturn boolean `true` if the pedometer is counting
*/
static int ptm_getPedometerState(lua_State *L) {
u8 out = 0;
PTMU_GetPedometerState(ptmHandle, &out);
lua_pushinteger(L, out);
lua_pushboolean(L, out);
return 1;
}
/***
Return the total steps taken with the system.
@function getTotalStepCount
@treturn number step count
*/
static int ptm_getTotalStepCount(lua_State *L) {
u32 steps = 0;
PTMU_GetTotalStepCount(ptmHandle, &steps);