feat: 增加软件复位菜单和主程序侧键复位功能
虽然侧键和硬件复位按键一样难按2333
This commit is contained in:
100
app/page/page_reset.c
Normal file
100
app/page/page_reset.c
Normal file
@@ -0,0 +1,100 @@
|
||||
#include "zf_common_headfile.h"
|
||||
#include "page_ui_widget.h"
|
||||
#include "page.h"
|
||||
|
||||
#define LINE_HEAD 1
|
||||
#define LINE_END 7
|
||||
|
||||
static char Text[] = "Reset";
|
||||
|
||||
static int8_t Curser = LINE_HEAD; // 定义光标位置
|
||||
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
||||
static void Print_Menu_p(void);
|
||||
/***************************************************************************************
|
||||
*
|
||||
* 以下为页面模板函数
|
||||
*
|
||||
***************************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief 页面初始化事件
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Setup()
|
||||
{
|
||||
ips200_clear();
|
||||
Print_Menu_p();
|
||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面退出事件
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Exit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面循环执行的内容
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Loop()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面事件
|
||||
* @param btn:发出事件的按键
|
||||
* @param event:事件编号
|
||||
* @retval 无
|
||||
*/
|
||||
static void Event(page_event event)
|
||||
{
|
||||
Curser_Last = Curser;
|
||||
|
||||
if (page_event_forward == event) {
|
||||
// Curser++; // 光标上移
|
||||
} else if (page_event_backward == event) {
|
||||
// Curser--; // 光标下移
|
||||
} else if (page_event_press_long == event) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
if (Curser < LINE_HEAD) {
|
||||
Curser = LINE_END;
|
||||
} else if (Curser > LINE_END) {
|
||||
Curser = LINE_HEAD;
|
||||
}
|
||||
|
||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面注册函数
|
||||
*
|
||||
* @param pageID
|
||||
*/
|
||||
void PageRegister_page_reset(unsigned char pageID)
|
||||
{
|
||||
Page_Register(pageID, Setup, Loop, Exit, Event);
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
*
|
||||
* 以下为页面自定义功能函数
|
||||
*
|
||||
***************************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief 打印菜单项
|
||||
*
|
||||
*/
|
||||
static void Print_Menu_p(void)
|
||||
{
|
||||
ips200_show_string(0, 0, Text);
|
||||
ips200_show_string(20, 20, "Long Press to Reset");
|
||||
}
|
||||
Reference in New Issue
Block a user