Files
menu/src/param/menu_param.h
2025-12-18 23:56:36 +08:00

39 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file menu_param.h
* @brief 菜单参数管理内部类型定义(用户无需关心)
*/
#ifndef MENU_PARAM_H
#define MENU_PARAM_H
#include "menu_core.h"
#include <stdint.h>
#include <stdbool.h>
/**
* @brief 参数值共用体(支持多种数据类型)
*/
typedef union {
int8_t i8; ///< 8位有符号整数
uint8_t u8; ///< 8位无符号整数
int16_t i16; ///< 16位有符号整数
uint16_t u16; ///< 16位无符号整数
int32_t i32; ///< 32位有符号整数
uint32_t u32; ///< 32位无符号整数
float f; ///< 浮点数
} MenuParamValue;
/**
* @brief 参数结构体(参数管理的核心单元)
*/
typedef struct {
uint16_t id; ///< 参数ID唯一
MenuParamType type; ///< 参数类型
MenuParamValue value; ///< 当前值
MenuParamValue default_val;///< 默认值
float min_val; ///< 最小值(浮点表示)
float max_val; ///< 最大值(浮点表示)
float scale; ///< 缩放因子
bool is_registered : 1; ///< 是否已注册
} MenuParam;
#endif // MENU_PARAM_H