70 lines
1.7 KiB
C
70 lines
1.7 KiB
C
/*
|
|
* @Author: CaoWangrenbo cao.wangrenbo@yandex.com
|
|
* @Date: 2023-03-19 18:28:44
|
|
* @LastEditors: CaoWangrenbo cao.wangrenbo@yandex.com
|
|
* @LastEditTime: 2023-03-19 20:43:00
|
|
* @FilePath: \icr18_btl143_ch32v_slave\project\code\page\fd_page.h
|
|
* @Description:
|
|
*
|
|
*
|
|
*/
|
|
#ifndef _FD_PAGE_H__
|
|
#define _FD_PAGE_H__
|
|
|
|
#include "zf_common_headfile.h"
|
|
|
|
#include "by_rt_button.h"
|
|
|
|
enum PageID {
|
|
PAGE_NULL = -1,
|
|
//......
|
|
page_menu,
|
|
//page_rtcam,
|
|
page_param,
|
|
// page_argv,
|
|
// page_sys,
|
|
// page_run,
|
|
//......
|
|
page_max,
|
|
};
|
|
|
|
typedef enum page_event{
|
|
page_event_forward = rotate_button_forward,
|
|
page_event_backward = rotate_button_backward,
|
|
page_event_press_short = rotate_button_press_short,
|
|
page_event_press_long = rotate_button_press_long,
|
|
} page_event;
|
|
|
|
typedef void (*CallbackFunction_t)(void);
|
|
typedef void (*EventFunction_t)(page_event);
|
|
typedef struct {
|
|
char *Text;
|
|
CallbackFunction_t SetupCallback;
|
|
CallbackFunction_t LoopCallback;
|
|
CallbackFunction_t ExitCallback;
|
|
EventFunction_t EventCallback;
|
|
} PAGE_LIST;
|
|
|
|
//页面注册函数
|
|
#define PAGE_REG(name)\
|
|
do{\
|
|
extern void PageRegister_##name(unsigned char pageID);\
|
|
PageRegister_##name(name);\
|
|
}while(0)
|
|
|
|
void Page_Register(uint8_t pageID, char *pageText,
|
|
CallbackFunction_t setupCallback, CallbackFunction_t loopCallback,
|
|
CallbackFunction_t exitCallback, EventFunction_t eventCallback);
|
|
|
|
void Page_EventTransmit(unsigned char event);
|
|
void Page_Shift(unsigned char pageID);
|
|
void Page_CloseCurrentPage(void);
|
|
void Page_OpenCurrentPage(void);
|
|
uint8_t Page_GetStatus(void);
|
|
void Page_Run(void);
|
|
void Page_Init(void);
|
|
|
|
extern PAGE_LIST pagelist[page_max];
|
|
|
|
#endif
|