#ifndef SYSTEM_MONITOR_H #define SYSTEM_MONITOR_H #include "main.h" #include "ltc2508_driver.h" #include "data_storage.h" #include // 系统状态定义 typedef enum { SYSTEM_STATE_INIT = 0, SYSTEM_STATE_IDLE, SYSTEM_STATE_SAMPLING, SYSTEM_STATE_RECORDING, SYSTEM_STATE_ERROR, SYSTEM_STATE_MAINTENANCE, SYSTEM_STATE_USB_MODE } SystemState_t; // 系统错误类型 typedef enum { SYSTEM_ERROR_NONE = 0, SYSTEM_ERROR_ADC, SYSTEM_ERROR_STORAGE, SYSTEM_ERROR_USB, SYSTEM_ERROR_COMMUNICATION, SYSTEM_ERROR_MEMORY, SYSTEM_ERROR_CRITICAL } SystemError_t; // 系统监控统计信息 typedef struct { SystemState_t current_state; SystemError_t last_error; uint32_t uptime_seconds; uint32_t total_samples; uint32_t error_count; uint32_t memory_usage; uint8_t cpu_usage_percent; uint8_t temperature_celsius; } SystemMonitorStats_t; // 函数声明 void SystemMonitor_Init(void); void SystemMonitor_Update(void); SystemState_t SystemMonitor_GetState(void); void SystemMonitor_SetState(SystemState_t new_state); void SystemMonitor_ReportError(SystemError_t error); void SystemMonitor_GetStats(SystemMonitorStats_t *stats); uint8_t SystemMonitor_IsHealthy(void); #endif // SYSTEM_MONITOR_H