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
51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
#ifndef CORRECTION_H
|
|
#define CORRECTION_H
|
|
|
|
#include "main.h"
|
|
#include <stdint.h>
|
|
|
|
// 使用ARM DSP库进行矩阵运算
|
|
#ifdef ARM_MATH_CM4
|
|
#include "arm_math.h"
|
|
#define USE_ARM_DSP 1
|
|
#else
|
|
#define USE_ARM_DSP 0
|
|
#endif
|
|
|
|
// 校正参数结构体
|
|
typedef struct {
|
|
// 偏移参数
|
|
float offset_x, offset_y, offset_z;
|
|
|
|
// 3x3校正矩阵 (行优先存储)
|
|
float correction_matrix[9];
|
|
|
|
// ARM DSP矩阵实例
|
|
#if USE_ARM_DSP
|
|
arm_matrix_instance_f32 matrix_inst;
|
|
#endif
|
|
|
|
// 校正参数有效标志
|
|
uint8_t params_valid;
|
|
} CorrectionParams_t;
|
|
|
|
// 校正结果结构体
|
|
typedef struct {
|
|
float corrected_x;
|
|
float corrected_y;
|
|
float corrected_z;
|
|
uint32_t timestamp;
|
|
uint8_t correction_applied;
|
|
} CorrectionResult_t;
|
|
|
|
// 函数声明
|
|
void Init_CorrectionParams(CorrectionParams_t *params);
|
|
void Set_CorrectionMatrix(CorrectionParams_t *params, const float *matrix);
|
|
void Set_CorrectionOffsets(CorrectionParams_t *params, float offset_x, float offset_y, float offset_z);
|
|
HAL_StatusTypeDef Apply_Correction(int32_t raw_x, int32_t raw_y, int32_t raw_z,
|
|
CorrectionResult_t *result,
|
|
const CorrectionParams_t *params);
|
|
void Load_CorrectionParams_FromFlash(CorrectionParams_t *params);
|
|
HAL_StatusTypeDef Save_CorrectionParams_ToFlash(const CorrectionParams_t *params);
|
|
|
|
#endif // CORRECTION_H
|