feat: 完成按键、屏幕和蜂鸣器适配

This commit is contained in:
2024-01-31 17:20:09 +08:00
parent 7181da95de
commit 64e95d278c
31 changed files with 385 additions and 1338 deletions

View File

@@ -1,6 +1,6 @@
#include "page.h"
#include "by_rt_button.h"
#include "by_button.h"
PAGE_LIST pagelist[page_max];
static uint8_t page_busy = 0;
@@ -89,8 +89,8 @@ uint8_t Page_GetStatus(void)
*/
void Page_Run(void)
{
uint8_t temp_status = by_get_rb_status(); // 轮询旋钮状态
if(temp_status){
uint8_t temp_status = by_button_get_status(); // 轮询旋钮状态
if (temp_status) {
pagelist[now_page].EventCallback(temp_status);
}
@@ -118,7 +118,7 @@ void Page_Run(void)
}
/**
* @brief 页面初始化(注册,构建) ATTENTION 在此处添加新加入的页面
* @brief 页面初始化注册构建ATTENTION 在此处添加新加入的页面
*
*/
void Page_Init(void)

View File

@@ -13,7 +13,7 @@
#include "zf_common_headfile.h"
#include "by_rt_button.h"
#include "by_button.h"
enum PageID {
PAGE_NULL = -1,
@@ -28,11 +28,11 @@ enum PageID {
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,
typedef enum page_event {
page_event_forward = button_event_up,
page_event_backward = button_event_down,
page_event_press_short = button_event_center_sp,
page_event_press_long = button_event_center_lp,
} page_event;
typedef void (*CallbackFunction_t)(void);
@@ -45,16 +45,16 @@ typedef struct {
EventFunction_t EventCallback;
} PAGE_LIST;
//页面注册函数
#define PAGE_REG(name)\
do{\
extern void PageRegister_##name(unsigned char pageID);\
PageRegister_##name(name);\
}while(0)
// 页面注册函数
#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);
CallbackFunction_t setupCallback, CallbackFunction_t loopCallback,
CallbackFunction_t exitCallback, EventFunction_t eventCallback);
void Page_EventTransmit(unsigned char event);
void Page_Shift(unsigned char pageID);

View File

@@ -1,11 +1,10 @@
#include "jj_param.h"
#include "page_ui_widget.h"
#include "jj_motion.h"
#include "page.h"
#define LINE_HEAD 0
#define LINE_END DATA_NUM - 2
static char Text[] = "RealTime Param";
static char Text[] = "Param";
int event_flag = 0;
int32_t index_power = 0;
static int8_t Curser = LINE_HEAD; // 定义光标位置
@@ -75,7 +74,6 @@ static void Event(page_event event)
return;
} else if (page_event_press_long == event) {
jj_param_update();
sport_pid_init();
Page_Shift(page_menu);
return;
}