97 lines
2.7 KiB
C
97 lines
2.7 KiB
C
#ifndef PDS_H__
|
|
#define PDS_H__
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <taskManager.h>
|
|
|
|
/**************************************************************************************************/
|
|
#define DEFAULT_CONSTANTSPEED (700U)
|
|
#define DEFAULT_STARTSPEED (1500U)
|
|
#define DEFAULT_SLOWSPEED (1500U)
|
|
#define DEFAULT_ACOILVOLTAGE (60U)
|
|
#define DEFAULT_BCOILVOLTAGE (60U)
|
|
#define DEFAULT_CLIMBTIME (200U)
|
|
#define DEFAULT_SLOWTIME (200U)
|
|
|
|
#define TransferCNT (6U)
|
|
|
|
typedef union{
|
|
struct{
|
|
uint16_t Constantspeed;
|
|
uint16_t startspeed;
|
|
uint16_t Slowspeed;
|
|
uint16_t MotorlockAcoilvoltage;
|
|
uint16_t MotorlockBcoilvoltage;
|
|
uint8_t ClimbTime;
|
|
uint8_t SlowTime;
|
|
uint16_t reservedata[4];
|
|
};
|
|
uint16_t data16[10];
|
|
uint32_t data32[5];
|
|
}MotorClusterParams_t;
|
|
|
|
typedef struct{
|
|
uint8_t frameId;
|
|
uint8_t frameIsValid;
|
|
}FrameID_t;
|
|
|
|
/**************************************************************************************************/
|
|
/* lin parameters */
|
|
typedef union{
|
|
/* 16 + 32*2 = 80 */
|
|
struct{
|
|
uint16_t fwVersion; /* Reserved should be LINS_FW_VERSION */
|
|
uint16_t hwVersion; /* Reserved should be LINS_HW_VERSION */
|
|
uint32_t serialNo; /* Reserved should be LINS_SERIAL_NO */
|
|
uint16_t supplierID; /* Reserved should be LINS_SUPPLIER_ID */
|
|
uint16_t functionID; /* Reserved should be LINS_FUNCTION_ID */
|
|
uint8_t variant; /* Reserved should be LINS_VARIANT */
|
|
uint8_t nad;
|
|
uint8_t frameIDSize;
|
|
FrameID_t frameInfo[32];
|
|
};
|
|
uint8_t payload[96U];
|
|
}LINClusterParams_t;
|
|
/**************************************************************************************************/
|
|
|
|
typedef enum{
|
|
PDS_STATUS_USING_NORMAL,
|
|
PDS_STATUS_USING_BACKUP,
|
|
PDS_STATUS_USING_DEFAULT,
|
|
}PdsStatus_t;
|
|
|
|
|
|
|
|
typedef struct{
|
|
struct{
|
|
uint32_t crc32;
|
|
uint32_t index;
|
|
}head; /* size = 8 bytes */
|
|
struct{
|
|
LINClusterParams_t linParams; /* size = 96 bytes */
|
|
MotorClusterParams_t motorParams; /* size = 20bytes */
|
|
}info;
|
|
}SystemParams_t;
|
|
|
|
typedef struct{
|
|
struct{
|
|
uint32_t crc32;
|
|
uint32_t index;
|
|
}head;
|
|
struct{
|
|
uint16_t data[2]; /* size = 4 bytes */
|
|
}info;
|
|
}Userdata_t;
|
|
|
|
MotorClusterParams_t *PDS_GetMotorParam(void);
|
|
uint32_t PDS_GetMotorstepnfromflash(void);
|
|
void PDS_PowerONRead_MotorParamfromFlash(uint16_t *buff,uint16_t leng);
|
|
void userdatapds_store(void);
|
|
|
|
LINClusterParams_t *PDS_GetLINParam(void);
|
|
PdsStatus_t PDS_GetPdsStatus(void);
|
|
void PDS_Init(void);
|
|
void PDS_TaskHandler(void);
|
|
|
|
#endif |