修改关机进入休眠并等待关机
This commit is contained in:
parent
dcca71d4d5
commit
6cc55e5964
@ -48,6 +48,7 @@ extern void user_app_main(void);
|
|||||||
extern void rtos_set_user_app_entry(beken_thread_function_t entry);
|
extern void rtos_set_user_app_entry(beken_thread_function_t entry);
|
||||||
extern int bk_cli_init(void);
|
extern int bk_cli_init(void);
|
||||||
extern void bk_set_jtag_mode(uint32_t cpu_id, uint32_t group_id);
|
extern void bk_set_jtag_mode(uint32_t cpu_id, uint32_t group_id);
|
||||||
|
void bk_enter_deepsleep();
|
||||||
|
|
||||||
#define TAG "APP_MAIN"
|
#define TAG "APP_MAIN"
|
||||||
|
|
||||||
@ -103,6 +104,7 @@ const struct factory_config_t s_user_config[] = {
|
|||||||
#if (CONFIG_SYS_CPU0)
|
#if (CONFIG_SYS_CPU0)
|
||||||
#include "iot/thing.h"
|
#include "iot/thing.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void power_on();
|
void power_on();
|
||||||
void power_off();
|
void power_off();
|
||||||
|
|
||||||
@ -254,16 +256,25 @@ static void handle_system_event(key_event_t event)
|
|||||||
rtos_delay_milliseconds(1000);
|
rtos_delay_milliseconds(1000);
|
||||||
bk_gpio_enable_output(51);
|
bk_gpio_enable_output(51);
|
||||||
bk_gpio_set_output_low(51);
|
bk_gpio_set_output_low(51);
|
||||||
|
bk_enter_deepsleep();
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
rtos_delay_milliseconds(1);
|
||||||
|
bk_printf("wait for power off\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (ispoweron == 0)
|
else if (ispoweron == 0)
|
||||||
{
|
{
|
||||||
bk_printf("POWER ON \r\n");
|
bk_printf("POWER ON \r\n");
|
||||||
|
|
||||||
|
bk_gpio_enable_output(51);
|
||||||
|
bk_gpio_set_output_high(51);
|
||||||
power_on();
|
power_on();
|
||||||
#if (CONFIG_SYS_CPU0)
|
#if (CONFIG_SYS_CPU0)
|
||||||
//打开电源供电
|
//打开电源供电
|
||||||
bk_gpio_enable_output(51);
|
|
||||||
bk_gpio_set_output_high(51);
|
|
||||||
ispoweron = 1;
|
ispoweron = 1;
|
||||||
|
|
||||||
ws2812_led_wifi_disconnect();
|
ws2812_led_wifi_disconnect();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user