STM_ATEM/User/system_monitor.h
zhoujie 6297f3044d feat(adc): implement comprehensive ADC data acquisition and processing system
Add complete data acquisition pipeline with LTC2508 ADC drivers, correction algorithms,
data storage, and system monitoring. Includes ARM DSP optimized matrix operations for
sensor calibration, SD card data logging with USB mass storage, and robust error handling
with validation throughout the processing chain.

- Add LTC2508 multi-channel SPI driver with DMA support and error recovery
- Implement correction module with ARM DSP matrix operations for sensor calibration
- Add data storage system with SD card logging and configurable file management
- Integrate system monitor for health tracking and error reporting
- Enhance data packet structure with CRC validation and timestamps
- Add USB mass storage interface for SD card access
- Implement comprehensive error handling and statistics collection
2026-01-25 18:15:13 +08:00

51 lines
1.2 KiB
C

#ifndef SYSTEM_MONITOR_H
#define SYSTEM_MONITOR_H
#include "main.h"
#include "ltc2508_driver.h"
#include "data_storage.h"
#include <stdint.h>
// 系统状态定义
typedef enum {
SYSTEM_STATE_INIT = 0,
SYSTEM_STATE_IDLE,
SYSTEM_STATE_SAMPLING,
SYSTEM_STATE_RECORDING,
SYSTEM_STATE_ERROR,
SYSTEM_STATE_MAINTENANCE
} 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