Files
base/app/app_power.h
2025-08-26 10:53:01 +08:00

54 lines
1.4 KiB
C

#ifndef APP_POWER_H
#define APP_POWER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "app_config.h"
#include "app_frm_monitor.h"
#include "app_frm_signal.h"
#include "app_frm_timer.h"
// 定义电源状态枚举
typedef enum {
POWER_STANDBY,
POWER_WORKING,
POWER_EMERGENCY,
POWER_PRE_CHARGE,
POWER_SLEEP
} PowerState;
// 使用内联函数
static inline uint8_t setPowerOn(void) { return 1; }
static inline uint8_t setPowerOff(void) { return 0; }
// 声明 power_data 变量结构体
typedef struct {
PowerState current_state; // 当前电源状态
uint32_t start_time; // 定时器起始时间
Timer timer; // 定时器
Timer timer1;
Timer timer_pre_charge; // 预充定时器
PowerState last_state; // 上一次状态
uint8_t emergency_stop_switch; // 急停开关
uint8_t high_voltage_switch; // 高压开关
uint8_t remote_power_switch; // 遥控器电源开关
uint8_t remote_emergency_stop; // 遥控器急停开关
uint8_t emergency_stop; // 急停状态
uint8_t pre_charge_finish; // 预充完成标志位
uint8_t old_state; // 上一次状态
} PowerSystem;
// 声明外部变量
extern PowerSystem power_data;
void powerAppInit(void);
#ifdef __cplusplus
}
#endif
#endif // APP_POWER_H