菜单支持,所有功能都测试成功

This commit is contained in:
2026-07-15 15:39:49 +08:00
parent d4112399c2
commit 92facadeb0
16 changed files with 908 additions and 447 deletions

55
STM32F103C8T6/User/menu.h Normal file
View File

@@ -0,0 +1,55 @@
#ifndef __MENU_H
#define __MENU_H
#ifdef __cplusplus
extern "C" {
#endif
#include "main.h"
/* 参数数量 */
#define PARAM_COUNT 4
/* 参数ID枚举 */
typedef enum {
PARAM_PWM1 = 0, /* PA6 TIM3_CH1 */
PARAM_PWM2, /* PA7 TIM3_CH2 */
PARAM_PWM3, /* PB0 TIM3_CH3 */
PARAM_PWM4, /* PB1 TIM3_CH4 */
} ParamId_t;
/*
* 函数功能:菜单系统初始化
* 入口参数:无
* 返回值:无
* 函数说明从EEPROM加载参数清屏绘制初始界面
*/
void menu_init(void);
/*
* 函数功能:菜单系统循环处理
* 入口参数:无
* 返回值:无
* 函数说明:轮询按键事件,更新参数/界面。需在主循环中频繁调用
*/
void menu_process(void);
/*
* 函数功能:获取指定参数的当前值
* 入口参数id - 参数ID
* 返回值:参数值
*/
int32_t menu_get_param(ParamId_t id);
/*
* 函数功能强制保存参数到EEPROM
* 入口参数:无
* 返回值0=成功,负值=失败
*/
int menu_save_params(void);
#ifdef __cplusplus
}
#endif
#endif /* __MENU_H */