pin deep sleep rename

This commit is contained in:
openshwprojects
2023-02-09 22:10:21 +01:00
parent 7d9fa05eb7
commit bc2c8bcb85
5 changed files with 15 additions and 15 deletions

View File

@@ -370,9 +370,9 @@ static commandResult_t CMD_SetFlag(const void *context, const char *cmd, const c
return CMD_RES_OK;
}
extern int g_bWantDeepSleep;
static commandResult_t CMD_StartDeepSleep(const void *context, const char *cmd, const char *args, int cmdFlags){
g_bWantDeepSleep = 1;
extern int g_bWantPinDeepSleep;
static commandResult_t CMD_PinDeepSleep(const void *context, const char *cmd, const char *args, int cmdFlags){
g_bWantPinDeepSleep = 1;
return CMD_RES_OK;
}
void CMD_InitChannelCommands(){
@@ -426,11 +426,11 @@ void CMD_InitChannelCommands(){
//cmddetail:"fn":"CMD_FriendlyName","file":"cmnds/cmd_channels.c","requires":"",
//cmddetail:"examples":""}
CMD_RegisterCommand("FriendlyName", "", CMD_FriendlyName, NULL, NULL);
//cmddetail:{"name":"startDeepSleep","args":"",
//cmddetail:"descr":"NULL",
//cmddetail:"fn":"CMD_StartDeepSleep","file":"cmnds/cmd_channels.c","requires":"",
//cmddetail:{"name":"PinDeepSleep","args":"",
//cmddetail:"descr":"Starts a pin deep sleep (deep sleep that can be interrupted by external IO events like a button press)",
//cmddetail:"fn":"CMD_PinDeepSleep","file":"cmnds/cmd_channels.c","requires":"",
//cmddetail:"examples":""}
CMD_RegisterCommand("startDeepSleep", "", CMD_StartDeepSleep, NULL, NULL);
CMD_RegisterCommand("PinDeepSleep", "", CMD_PinDeepSleep, NULL, NULL);
//cmddetail:{"name":"SetFlag","args":"[FlagIndex][1or0]",
//cmddetail:"descr":"Enables/disables given flag.",
//cmddetail:"fn":"CMD_SetFlag","file":"cmnds/cmd_channels.c","requires":"",

View File

@@ -319,8 +319,8 @@ void CMD_Init_Early() {
//cmddetail:"fn":"CMD_ClearAll","file":"cmnds/cmd_main.c","requires":"",
//cmddetail:"examples":""}
CMD_RegisterCommand("clearAll", "", CMD_ClearAll, NULL, NULL);
//cmddetail:{"name":"DeepSleep","args":"[Miliseconds]",
//cmddetail:"descr":"Enable power save on N & T",
//cmddetail:{"name":"DeepSleep","args":"[Seconds]",
//cmddetail:"descr":"Starts deep sleep for given amount of seconds.",
//cmddetail:"fn":"CMD_DeepSleep","file":"cmnds/cmd_main.c","requires":"",
//cmddetail:"examples":""}
CMD_RegisterCommand("DeepSleep", "", CMD_DeepSleep, NULL, NULL);

View File

@@ -92,7 +92,7 @@ uint32_t g_gpio_index_map = 0;
uint32_t g_gpio_edge_map = 0; // note: 0->rising, 1->falling
void PINS_BeginDeepSleep() {
void PINS_BeginDeepSleepWithPinWakeUp() {
#ifdef PLATFORM_BK7231T
bk_enter_deep_sleep(g_gpio_index_map, g_gpio_edge_map);
#else

View File

@@ -335,7 +335,7 @@ void PIN_ticks(void *param);
void PIN_set_wifi_led(int value);
void PIN_AddCommands(void);
void PINS_BeginDeepSleep();
void PINS_BeginDeepSleepWithPinWakeUp();
void PIN_SetupPins();
void PIN_OnReboot();
void CFG_ClearPins();

View File

@@ -624,15 +624,15 @@ static int g_wifiLedToggleTime = 0;
static int g_wifi_ledState = 0;
static uint32_t g_time = 0;
static uint32_t g_last_time = 0;
int g_bWantDeepSleep;
int g_bWantPinDeepSleep;
/////////////////////////////////////////////////////
// this is what we do in a qucik tick
void QuickTick(void *param)
{
if (g_bWantDeepSleep) {
PINS_BeginDeepSleep();
g_bWantDeepSleep = 0;
if (g_bWantPinDeepSleep) {
PINS_BeginDeepSleepWithPinWakeUp();
g_bWantPinDeepSleep = 0;
return;
}