58 lines
1.1 KiB
C
58 lines
1.1 KiB
C
#ifndef APP_TEMP_H
|
|
#define APP_TEMP_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#define MOTOR_WARNING_TEMP 40
|
|
#define MOTOR_CRITICAL_TEMP 60
|
|
#define MOTOR_THRESHOLD_TEMP 5//回滞值
|
|
|
|
|
|
|
|
|
|
|
|
// 定义温度状态枚举
|
|
typedef enum
|
|
{
|
|
TEMP_NORMAL,
|
|
TEMP_WARNING,
|
|
TEMP_CRITICAL
|
|
} TempState;
|
|
|
|
// 定义温度控制模式枚举
|
|
typedef enum
|
|
{
|
|
TEMP_MODE_AUTO,
|
|
TEMP_MODE_MANUAL
|
|
} TempMode;
|
|
|
|
typedef struct
|
|
{
|
|
TempState state[8];
|
|
TempMode mode;
|
|
int16_t current_temp[8]; // 当前温度,8个不同的温度
|
|
int16_t target_temp; // 目标温度
|
|
uint8_t fan_speed[8]; // 风扇速度 8个通道
|
|
Timer timer; // 定时器
|
|
} TempSystem;
|
|
|
|
// 在头文件中声明外部变量
|
|
extern TempSystem temp_data;
|
|
|
|
// 使用内联函数
|
|
static inline uint8_t setFanOn(void) { return 1; }
|
|
static inline uint8_t setFanOff(void) { return 0; }
|
|
|
|
void tempAppInit(void);
|
|
void setTempMode(TempMode mode);
|
|
void setTargetTemp(int16_t temp);
|
|
void setFanSpeed(uint8_t speed);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // APP_TEMP_H
|