12345678910111213141516171819202122232425262728293031 |
- #ifndef __LOG_SAVE_H
- #define __LOG_SAVE_H
- #include "stm32f1xx_hal.h"
- #include "motor_control.h"
- #include "eeprom_flash.h"
- #define LOG_ADDRESS_BEGIN 0x0801F000
- #define LOG_ADDRESS_END 0x0801F3FF
- //故障日志记录信息 64 bytes,1K空间可以保存最近16条故障记录
- typedef struct
- {
- uint16_t Error_Index; //故障列表索引 2 bytes, 地址偏移 0
- uint16_t NotesInfo1; //备注信息1,地址偏移 2
- uint16_t NotesInfo2; //备注信息2,地址偏移 4
- uint16_t NotesInfo3; //备注信息3,地址偏移 6
- uint32_t ErrorCode; //故障码 4 bytes, 地址偏移 8
- uint32_t RunTime; //运行时间 4bytes, 地址偏移 12
- MC_RunInfo_Struct_t RunInfo; //运行信息 32bytes, 地址偏移 16
- MC_AttitudeAngle_Struct_t AttitudeAngle; //车辆姿态角度 8bytes, 地址偏移 48
- MC_CalParam_Struct_t MC_CalParam; //马达控制参数 8bytes , 地址偏移 56
- }MC_ErrorLogSaveInfo_Struct_t;
- extern MC_ErrorLogSaveInfo_Struct_t MC_ErrorLogSaveInfo; //故障发生时刻日志信息
- extern TrueOrFalse_Flag_Struct_t IsErrorLogSaveInfoUpdateFlag; //故障日志更新标志
- extern void ErrorLogSave_Update(MC_ErrorLogSaveInfo_Struct_t* p_ErrorLogSaveInfo);
- extern void ErrorLogSave_Process(MC_ErrorLogSaveInfo_Struct_t* p_ErrorLogSaveInfo, TrueOrFalse_Flag_Struct_t* IsUpdate);
- #endif
|