You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

785 lines
29 KiB

#ifndef __CAN_APP_H
#define __CAN_APP_H
#include "common.h"
extern u16 CAN_AppUpdata_time;
void Can1_CommunicationInit(void);
void Can1_CommunicationTask(void);
//qiuadd
typedef struct {
uint8_t motorMcu1ProgState : 1; // Startbit=0, Length=1: ����MCU1����״̬
uint8_t motorMcu2ProgState : 1; // Startbit=1, Length=1: ����MCU2����״̬
uint8_t motorAssistMode : 2; // Startbit=2, Length=2: ����������ģʽ��0�������� 1����̤���� 2��ת������ ��
uint8_t motorState : 4; // Startbit=4, Length=4: ����״̬��Min=0, Max=15��
uint8_t motorMaxFaultLevel : 2; // Startbit=8, Length=2: �������߹��ϵȼ���Min=0, Max=3��
uint8_t pedalAssistRatio : 8; // Startbit=10, Length=8: ��̤����������Unit=%��Min=0, Max=255 �� 0~255%��
uint8_t motorAssistRatio : 8; // Startbit=18, Length=8: ��̤����������ͬ�������������ظ�����ʵ�ʵ����� // �������ǡ���̤�����������ظ���������ȷ�ϣ����������ֶΣ�
uint16_t systemAssistTorque : 14; // Startbit=26, Length=14: ϵͳ����Ť�أ�Unit=NM��Min=0, Max=1638.3 �� 0~16383/10��
int16_t motorBusVoltage : 12; // Startbit=40, Length=12: ����ĸ�ߵ�ѹ��Unit=V��Factor=0.1 �� ʵ��ֵ=raw*0.1��Min=-200, Max=200��// �з��ţ��� Min=-200
int16_t motorBusCurrent : 12; // Startbit=52, Length=12: ����ĸ�ߵ�����Unit=A��Factor=0.1 �� ʵ��ֵ=raw*0.1��
}MCUCanSend01;
typedef union
{
MCUCanSend01 Part01;
} MCUCanUnion01;
typedef struct {
uint8_t mosUpperShortFault : 1; // 0��MOS �Ϲܻ�������
uint8_t mosLowerShortFault : 1; // 1��MOS �¹ܻ�������
uint8_t hardwareOverCurrent : 1; // 2��Ӳ����������
uint8_t opAmpFault : 1; // 3���˷Ź���
uint8_t hallFault : 1; // 4����������
uint8_t motorPhaseLoss : 1; // 5������ȱ������
uint8_t opAmpSeriousFault : 1; // 6���˷����ع���
uint8_t brakeFault : 1; // 7��ɲ������
uint8_t motorEncoderCommFault : 1; // 8������������ͨ�Ź���
uint8_t motorEncoderLearnFault : 1; // 9������������ǿ��ѧϰ����
uint8_t throttleFault : 1; // 10��ת�ѹ���
uint8_t hallAngleBigFault : 1; // 11�������Ƕ�ƫ������
uint8_t powerDownFault : 1; // 12����������
uint8_t seriousUnderVoltage : 1; // 13������Ƿѹ����
uint8_t headLightFault : 1; // 14�����ƹ���
uint8_t turnSignalLightFault : 1; // 15��ת���ƹ���
uint8_t chipLowVoltage : 1; // 16��оƬ��ѹ����
uint8_t clockSlowFault : 1; // 17��ʱ��Ƶ��������
uint8_t clockFastFault : 1; // 18��ʱ��Ƶ�ʿ�����
uint8_t clockAbnormalFault : 1; // 19��ʱ���쳣����
uint8_t stackAbnormalFault : 1; // 20����ջ�쳣����
uint8_t ramAbnormalFault : 1; // 21��RAM �쳣����
uint8_t flashAbnormal : 1; // 22: Flash �쳣����
uint8_t watchdogReset : 1; // 23: ���Ź���λ����
uint8_t cpuAbnormal : 1; // 24: CPU �쳣����
uint8_t driverSelfCheck : 1; // 25: ���� IC ʹ�ܿڻؼ�����
uint8_t tailLampFault : 1; // 26: β�ƹ���
uint8_t ntcShort : 1; // 27: NTC ��·����
uint8_t ntcOpen : 1; // 28: NTC ��·����
uint8_t crankAngleComTimeOut : 1; // 29: �����Ƕȱ���ͨ�ų�ʱ�쳣����
uint8_t crankAngleFieldErr : 1; // 30: �����Ƕȱ����ų�ǿ���쳣����
uint8_t motorAngleComOverTimeOut : 1; // 31: �����Ƕȱ���ͨ�ų�ʱ�쳣����
uint8_t motorAngleFieldErr : 1; // 32: �����Ƕȱ����ų�ǿ���쳣����
uint8_t torqueComTimeOut : 1; // 33: Ť�ش�����ͨ�ų�ʱ����
uint8_t torqueRangeErr : 1; // 34: Ť�ش���������Χ����
uint8_t torqueDataErr : 1; // 35: Ť�ش�����������Ч�Թ���
uint8_t torqueDataNoChange : 1; // 36: Ť�ش��������ݲ�������
uint8_t torqueInitErr : 1; // 37: Ť�ش�������ʼ������
uint8_t wheelSpeedFault : 1; // 38: ���ٴ���������
uint8_t CenElecCrolSpiHardErr : 1; // 39: �п������� SPI Ӳ������
uint8_t CenElecCtrlSpiOverTimeOut : 1; // 40: �п������� SPI ͨ�ų�ʱ����
uint8_t CenElecCtrlSpiCrcErr : 1; // 41: ������� SPI CRC ����
uint8_t threePhaseZeroErr : 1; // 42: ������������
uint8_t busCurrentZeroErr : 1; // 43: ĸ�ߵ�����������
uint8_t driverFault : 1; // 44: ���� IC ����
uint8_t softwareOverCurrent : 1; // 45: ������������
uint8_t busUnderVolt : 1; // 46: ĸ��Ƿѹ����
uint8_t busOverVolt : 1; // 47: ĸ�߹�ѹ����
uint8_t ElecCtrlLightOverTemp : 1; // 48: ����һ�����¹���
uint8_t ElecCtrlSeriousOverTemp : 1; // 49: �������ع��¹���
uint8_t motorStallFault : 1; // 50: ������ת����
uint8_t eepromFault : 1; // 51: EEPROM ����
uint8_t dialKeyShort : 1; // 52: ָ��������·����
uint8_t threePhaseUnbalance : 1; // 53: ���಻ƽ������
uint8_t batteryComTimeOut : 1; // 54: ����ͨ�ų�ʱ����
uint8_t batteryCrcErr : 1; // 55: ����ͨ�� CRC ����
uint8_t reserved : 2; // 56: Ԥ��
uint8_t dialComTimeOut : 1; // 58: ָ��ͨ�ų�ʱ����
} MCUCanSend02;
typedef union
{
MCUCanSend02 Part02;
} MCUCanUnion02;
typedef struct {
uint8_t motorGeneralOverload : 1; // 0: ����һ�����ع���
uint8_t motorSeriousOverload : 1; // 1: �������ع��ع���
uint8_t batteryPlugGeneral : 1; // 2: ���ؽӲ�������һ�����ع���
uint8_t batteryPlugSerious : 1; // 3: ���ؽӲ����������ع��ع���
uint8_t crankAngleValidErr : 1; // 4: �����Ƕȱ���������Ч�Թ���
uint8_t crankSpeedOverRange : 1; // 5: �����ٶȳ���Χ����
uint8_t motorAngleValidErr : 1; // 6: �����Ƕȱ���������Ч�Թ���
uint8_t currentSensorErr : 1; // 7: ��������������
uint8_t power5VGood : 1; // 8: 5VPowerGood
uint8_t power12VGood : 1; // 9: 12VPowerGood
uint32_t warnCode : 16; // 32~47: �����루ʾ���� 10 ��Ӧֵ 4194303��
uint32_t faultCode : 16; // 48~63: �����루ʾ���� 32��48 ��Ӧֵ 65535��
} MCUCanSend03;
typedef union
{
MCUCanSend03 Part03;
} MCUCanUnion03;
typedef struct {
uint16_t pedalSpeed;//̤Ƶת��
uint16_t motorSpeed;//����ת��
uint16_t wheelSpeed;//����
uint16_t vehicleSpeed;//˲ʱ����
} MCUCanSend04;
typedef union
{
MCUCanSend04 Part04;
} MCUCanUnion04;
typedef struct {
uint16_t averageSpeed;//ƽ������
uint16_t maxSpeed;//��������
uint16_t wheelDiameter;//�ܳ�
} MCUCanSend05;
typedef union
{
MCUCanSend05 Part05;
} MCUCanUnion05;
typedef struct {
uint8_t gear1Ratio;//1������
uint8_t gear2Ratio;//2������
uint8_t gear3Ratio;//3������
uint8_t gear4Ratio;//4������
uint8_t gear5Ratio;//5������
uint8_t gear6Ratio;//6������
uint16_t reserved;//Ԥ��
} MCUCanSend06;
typedef union
{
MCUCanSend06 Part06;
} MCUCanUnion06;
typedef struct {
uint16_t gear1RemainMile;//1������ʣ������
uint16_t gear2RemainMile;//2������ʣ������
uint16_t gear3RemainMile;//3������ʣ������
uint16_t gear4RemainMile;//4������ʣ������
uint16_t gear5RemainMile;//5������ʣ������
uint16_t gear6RemainMile;//6������ʣ������
uint16_t reserved;//Ԥ��
} MCUCanSend07;
typedef union
{
MCUCanSend07 Part07;
} MCUCanUnion07;
typedef struct {
uint32_t pedalTurnAll;//��̤��Ȧ��
uint32_t wheelTurnAll;//��Ȧ��Ⱥ��
} MCUCanSend08;
typedef union
{
MCUCanSend08 Part08;
} MCUCanUnion08;
typedef struct {
uint32_t ridingSingleTime;//���е���ʱ��
uint32_t ridingAllTime;//������ʱ��
} MCUCanSend09;
typedef union
{
MCUCanSend09 Part09;
} MCUCanUnion09;
typedef struct {
uint32_t ridingSingleMile;//���������
uint32_t ridingAllMile;//����������
} MCUCanSend0A;
typedef union
{
MCUCanSend0A Part0A;
} MCUCanUnion0A;
typedef struct {
uint16_t pedalTorqueFilter;//̤���˲�Ť��
uint16_t motorTorque;//��������Ť��
uint16_t torqueZeroFst;//Ť������1
uint16_t torqueZeroSed;//Ť������2
} MCUCanSend0B;
typedef union
{
MCUCanSend0B Part0B;
} MCUCanUnion0B;
typedef struct {
uint8_t blindingFlag;//�DZ����ӳɹ���־
uint8_t authenticationFlag;//��Ȩ�ɹ���־
uint32_t bootTime;//��������
uint16_t duNTC;//����һNTC
} MCUCanSend0C;
typedef union
{
MCUCanSend0C Part0C;
} MCUCanUnion0C;
typedef struct {
uint8_t gearMaxLevel;//��λ��������Ť��
uint8_t gearAuxiliaryLevel;//��λ���ø����ȼ�
uint8_t gearRoadCondition;//��λ·��ʶ��������
uint8_t gearStartupSensitivity;//��λ����������Ӧ
} MCUCanSend0D;
typedef union
{
MCUCanSend0D Part0D;
} MCUCanUnion0D;
typedef struct {
uint16_t motorTemperature;//�����¶�
uint16_t mcuTemperature;//�������¶�
uint16_t rotorAngleZero;//ת����λ�Ƕ�
uint16_t rotorAngle;//ת��ʵʱ�Ƕ�
} MCUCanSend0E;
typedef union
{
MCUCanSend0E Part0E;
} MCUCanUnion0E;
typedef struct {
uint16_t leftPedalAD;//��̤��ԭʼADֵ
uint16_t rightPedalAD;//��̤��ԭʼADֵ
uint16_t torqueSeorTemperature1;//Ť�ش������¶�����1
uint16_t torqueSeorTemperature2;//Ť�ش������¶�����2
} MCUCanSend0F;
typedef union
{
MCUCanSend0F Part0F;
} MCUCanUnion0F;
typedef struct {
uint16_t pedalAngle;//�����Ƕ�
uint16_t motorMaxTorque;//������������Ť��
uint16_t faultLimit;//������������
uint16_t gearRatio;//���ֱ��ٱ�
} MCUCanSend10;
typedef union
{
MCUCanSend10 Part10;
} MCUCanUnion10;
typedef struct {
uint32_t sysClock;//ϵͳ����ʱ��
} MCUCanSend11;
typedef union
{
MCUCanSend11 Part11;
} MCUCanUnion11;
typedef struct {
uint16_t gear1Range :12;//��λ1��ѧϰʣ����������
uint16_t gear2Range :12;//��λ2��ѧϰʣ����������
uint16_t gear3Range :12;//��λ3��ѧϰʣ����������
uint16_t gear4Range :12;//��λ4��ѧϰʣ����������
uint16_t gear5Range :12;//Autio��ѧϰʣ����������
} MCUCanSend13;
typedef union
{
MCUCanSend13 Part13;
} MCUCanUnion13;
typedef struct {
uint8_t funcCode;//������
uint16_t regsAddr;//�Ĵ�����ַ
uint8_t regsNum;//�������ݸ���
uint16_t regs1Data;//����1
uint16_t regs2Data;//����2
} MCUCanSend4F;
typedef union
{
MCUCanSend4F Part4F;
} MCUCanUnion4F;
typedef struct {
uint8_t idle :2; //�Ƿ����� 0������ 1������
uint32_t heartbeatCnt :32;//����
uint32_t reserved :28;//����
} MCUCanSend25;
typedef union
{
MCUCanSend25 Part25;
} MCUCanUnion25;
typedef struct {
uint8_t resetAck :8; //�ָ���������Ӧ��
} MCUCanSend2A;
typedef union
{
MCUCanSend2A Part2A;
} MCUCanUnion2A;
typedef struct {
uint32_t singleCalorie :32; //������
uint32_t totalCalorie :32; //�ܿ�·��
} MCUCanSend15;
typedef union
{
MCUCanSend15 Part15;
} MCUCanUnion15;
typedef struct {
uint8_t bikeCode[4]; //���ͱ���
uint16_t perimeter; //��̥�ܳ�
uint16_t diskTorque; //����Ť��
} MCUCanSend16;
typedef union
{
MCUCanSend16 Part16;
} MCUCanUnion16;
typedef struct {
uint16_t crankRealTimeTorque; //����ʵʱ����
uint16_t loopAverTorque; //Ȧƽ������
uint16_t realTimeSpeed; //ʵʱ�ٶ�
uint8_t crankRealTimeAngle; //����ʵʱ�Ƕ�
uint8_t pedalSpeed; //̤Ƶ
} MCUCanSend17;
typedef union
{
MCUCanSend17 Part17;
} MCUCanUnion17;
typedef struct {
uint16_t pulseRechgCurr :16; //��������
uint8_t shifterGear :8; //����������λ
uint8_t throttle :2; //�Ƿ�����ת��
uint16_t throttleVolt :14; //�Ƿ�����ת��
uint8_t halfSlopeStartSens :4; //��������������
uint8_t sensorMode :2; //����ģʽ״̬
} MCUCanSend18;
typedef union
{
MCUCanSend18 Part18;
} MCUCanUnion18;
typedef struct {
uint8_t autoYorN :1; //�Ƿ�֧��autoģʽ
uint8_t holdYorN :1; //�Ƿ�֧��holdģʽ
uint8_t rearGearShiftYorN :1; //�Ƿ�֧�ֺ����ٵ�λ
uint8_t sellAreaYorN :1; //�Ƿ�֧��������������
uint8_t halfSlopeStart :1; //�Ƿ�֧�ְ����𲽹���
uint8_t boostYorN :1; //�Ƿ�֧��Boostģʽ
uint8_t sensorMode :1; //�Ƿ�֧������������ģʽ�л�
uint8_t cruiseControl :1; //�Ƿ�֧�ֶ���Ѳ������
} MCUCanSend19;
typedef union
{
MCUCanSend19 Part19;
} MCUCanUnion19;
typedef struct {
uint16_t areaSitua :16; //���۵���״̬
} MCUCanSend1A;
typedef union
{
MCUCanSend1A Part1A;
} MCUCanUnion1A;
typedef struct {
uint8_t boostAllow :1; //��ǰ�Ƿ���������Boostģʽ���ᶯ̬�仯
uint16_t boostLeftTime :11; //��ǰboostģʽ��ʣ��ʱ�䣬��λ���룬���Ժ���̬��ʾ����ʱ�á�
uint16_t boostNextAllowTime :12; //�����´�����Boost��ʱ��
uint8_t cruiseControlFlag :1; //�Ƿ����ڶ���Ѳ��״̬
uint8_t cruiseControlOutCase :4; //����Ѳ���˳�ԭ��
uint16_t cruiseControlSpeed :16; //����Ѳ���ٶ�
} MCUCanSend1B;
typedef union
{
MCUCanSend1B Part1B;
} MCUCanUnion1B;
typedef struct {
uint16_t handLearnRemainMile :12; //ת����ѧϰʣ����������
} MCUCanSend1C;
typedef union
{
MCUCanSend1C Part1C;
} MCUCanUnion1C;
typedef struct {
uint16_t motor_torque_red :16; //��������������������Ť��
uint16_t motor_speed_red :16; //��������������������ת��
uint32_t reserved :32; //̤ƵAB����
} MCUCanSend1D;
typedef union
{
MCUCanSend1D Part1D;
} MCUCanUnion1D;
typedef struct {
uint8_t number :8;
uint8_t gear :8;
uint8_t total_gears :8;
} MCUCanSendS40; //s2a_shifter_status
typedef union
{
MCUCanSendS40 PartS40;
} MCUCanUnionS40;
typedef struct {
uint8_t pedal_pulse_param :8; //̤��תһȦʱ����������(�����������Ӳ���仯��A+B�൥���ش�����ʽ)
uint8_t wheel_pulse_param :8; //����תһȦʱ����������(�����������Ӳ���仯��A+B�൥���ش�����ʽ)
uint8_t wheel_pulse_delta :8; //̤���������ﵽһȦʱ����������������������̤�嵥Ȧ36�����壬��̤���������ﵽ36��ʱ��¼��ǰ��������������Ȼ��������һ��̤�������ﵽ36��ʱ��¼���������������IJ�ֵ�����ϱ���֡��
} MCUCanSend6B; //����ʱ��֡��̤Ƶ��һȦ�󴥷�
typedef union
{
MCUCanSend6B Part6B;
} MCUCanUnion6B;
typedef struct {
MCUCanUnion01 CanUnion01;
MCUCanUnion02 CanUnion02;
MCUCanUnion03 CanUnion03;
MCUCanUnion04 CanUnion04;
MCUCanUnion05 CanUnion05;
MCUCanUnion06 CanUnion06;
MCUCanUnion07 CanUnion07;
MCUCanUnion08 CanUnion08;
MCUCanUnion09 CanUnion09;
MCUCanUnion0A CanUnion0A;
MCUCanUnion0B CanUnion0B;
MCUCanUnion0C CanUnion0C;
MCUCanUnion0D CanUnion0D;
MCUCanUnion0E CanUnion0E;
MCUCanUnion0F CanUnion0F;
MCUCanUnion10 CanUnion10;
MCUCanUnion11 CanUnion11;
MCUCanUnion13 CanUnion13;
MCUCanUnion4F CanUnion4F;
MCUCanUnion25 CanUnion25;
MCUCanUnion2A CanUnion2A;
MCUCanUnion15 CanUnion15;
MCUCanUnion16 CanUnion16;
MCUCanUnion17 CanUnion17;
MCUCanUnion18 CanUnion18;
MCUCanUnion19 CanUnion19;
MCUCanUnion1A CanUnion1A;
MCUCanUnion1B CanUnion1B;
MCUCanUnion1C CanUnion1C;
MCUCanUnion1D CanUnion1D;
MCUCanUnionS40 CanUnionS40;
MCUCanUnion6B CanUnion6B;
} MCUCanSend_DataDef;
/*********����ΪMCU��������********/
typedef struct
{
u32 vehicle_name[128];
u32 tire_specification[128];
u32 battery_voltage;
u32 motor_power;
u32 battery_capacity;
u32 vehiclemodel_code;
u16 tire_circumference;
u8 support_password;
u16 sales_territory;
} MULECUtoMCU_ConfigInfo_DataDef;
typedef struct {
uint16_t part_code_char1 : 16; // Startbit=0, Length=16: ����������1���ַ�
uint16_t part_code_char2 : 16; // Startbit=16, Length=16: ����������2���ַ�
uint16_t part_code_char3 : 16; // Startbit=32, Length=16: ����������3���ַ�
uint16_t software_version : 16; // Startbit=48, Length=16: �����汾
uint16_t protocol_version : 16; // Startbit=64, Length=16: Э���汾
uint16_t timestampL : 16;
uint16_t timestampH : 16;
// uint32_t timestamp : 32; // Startbit=80, Length=32: ʱ����
uint8_t assembly_code[14]; // Startbit=112, Length=112: ����һ�ܳɱ��� 112/8=14
}MULMCUCanSend01;
typedef union
{
MULMCUCanSend01 Part01;
} MULMCUCanUnion01;
// ���� mcu_fault_snapshot �ṹ��
typedef struct {
uint16_t software_version; // �����汾�� (16λ)
uint16_t device_address; // �豸��ַ (16λ)
uint8_t packets_per_block; // ÿ�����ݰ��� (8λ)
uint8_t block_position; // ��λ�� (8λ)
uint8_t packet_count; // ���ݰ��� (8λ)
uint8_t packet_size; // ���ݰ���С (8λ)
uint16_t total_fault_count; // �����Ĺ����ܴ��� (16λ)
uint8_t reserved[6]; // Ԥ�� (48λ = 6�ֽ�)
uint16_t bus_voltage; // ĸ�ߵ�ѹ (16λ)
uint16_t bus_current; // ĸ�ߵ��� (16λ)
uint16_t bus_current_zero; // ĸ�ߵ������� (16λ)
uint16_t phase_a_current; // A������ (16λ)
uint16_t phase_b_current; // B������ (16λ)
uint16_t phase_c_current; // C������ (16λ)
uint16_t phase_a_current_zero;// A���������� (16λ)
uint16_t phase_b_current_zero;// B���������� (16λ)
uint16_t phase_c_current_zero;// C���������� (16λ)
uint16_t ntc_temperature; // ���ذ�NTC�¶� (16λ)
uint16_t ad_reserved; // AD��Ԥ�� (16λ)
uint16_t vq_command; // Vq����ֵ (16λ)
uint16_t vq_feedback; // Vq����ֵ (16λ)
uint16_t iq_command; // Iq����ֵ (16λ)
uint16_t iq_feedback; // Iq����ֵ (16λ)
uint16_t id_command; // Id����ֵ (16λ)
uint16_t id_feedback; // Id����ֵ (16λ)
uint16_t vd_feedback; // Vd����ֵ (16λ)
uint16_t motor_speed; // ����ת�� (16λ)
uint16_t max_phase_current; // �ϵ����ֹ������������� (16λ)
uint16_t fault_code1; // ���ع�����1 (16λ)
uint16_t fault_code2; // ���ع�����2 (16λ)
uint16_t fault_code3; // ���ع�����3 (16λ)
uint16_t fault_code4; // ���ع�����4 (16λ)
uint16_t fault_code5; // ���ع�����5 (16λ)
uint16_t system_time; // ϵͳʱ�� (16λ)
uint16_t torque_data1; // Ť������1 (16λ)
uint16_t torque_data2; // Ť������2 (16λ)
uint16_t crankshaft_speed; // ����ת�� (16λ)
uint16_t vehicle_speed; // ���� (16λ) - ע�⣺��λ��0.1 km/h
} MULMCUCanSend02;;
typedef union
{
MULMCUCanSend02 Part02;
} MULMCUCanUnion02;
// ���� Riding_gear1_cfg �ṹ��
typedef struct {
// ����������
uint8_t full_range_assist_level_min; // ������Χ-�����ȼ���Сֵ (8λ)
uint8_t full_range_assist_level_max; // ������Χ-�����ȼ�����ֵ (8λ)
uint8_t full_range_max_torque_min; // ������Χ-����Ť����Сֵ (8λ)
uint8_t full_range_max_torque_max; // ������Χ-����Ť������ֵ (8λ)
uint8_t full_range_start_response_min; // ������Χ-������Ӧ��Сֵ (8λ)
uint8_t full_range_start_response_max; // ������Χ-������Ӧ����ֵ (8λ)
// �����
uint8_t gear_count; // ��λ���� (8λ)
uint8_t current_gear_setting; // ����/��ȡ��λ (8λ)
// ��λ1 ��ϸ����
uint8_t gear1_assist_level_min; // ��λ1-�����ȼ������÷�Χ��Сֵ (8λ)
uint8_t gear1_assist_level_max; // ��λ1-�����ȼ������÷�Χ����ֵ (8λ)
uint8_t gear1_assist_level_step; // ��λ1-�����ȼ����ò��� (8λ)
uint8_t gear1_assist_level_default; // ��λ1-�����ȼ�Ĭ��ֵ (8λ)
uint8_t gear1_assist_level_current; // ��λ1-�����ȼ���ǰֵ (8λ)
uint8_t gear1_max_torque_min; // ��λ1-����Ť�ؿ����÷�Χ��Сֵ (8λ)
uint8_t gear1_max_torque_max; // ��λ1-����Ť�ؿ����÷�Χ����ֵ (8λ)
uint8_t gear1_max_torque_step; // ��λ1-����Ť�����ò��� (8λ)
uint8_t gear1_max_torque_default; // ��λ1-����Ť��Ĭ��ֵ (8λ)
uint8_t gear1_max_torque_current; // ��λ1-����Ť�ص�ǰֵ (8λ)
uint8_t gear1_start_response_min; // ��λ1-������Ӧ�����÷�Χ��Сֵ (8λ)
uint8_t gear1_start_response_max; // ��λ1-������Ӧ�����÷�Χ����ֵ (8λ)
uint8_t gear1_start_response_step; // ��λ1-������Ӧ���ò��� (8λ)
uint8_t gear1_start_response_default; // ��λ1-������ӦĬ��ֵ (8λ)
uint8_t gear1_start_response_current; // ��λ1-������Ӧ��ǰֵ (8λ)
} MULMCUCanSend03;
typedef union
{
MULMCUCanSend03 Part03;
} MULMCUCanUnion03;
// ���� Riding_gear2_cfg �ṹ��
typedef struct {
// ����������
uint8_t full_range_assist_level_min; // ������Χ-�����ȼ���Сֵ (8λ)
uint8_t full_range_assist_level_max; // ������Χ-�����ȼ�����ֵ (8λ)
uint8_t full_range_max_torque_min; // ������Χ-����Ť����Сֵ (8λ)
uint8_t full_range_max_torque_max; // ������Χ-����Ť������ֵ (8λ)
uint8_t full_range_start_response_min; // ������Χ-������Ӧ��Сֵ (8λ)
uint8_t full_range_start_response_max; // ������Χ-������Ӧ����ֵ (8λ)
// �����
uint8_t gear_count; // ��λ���� (8λ)
uint8_t current_gear_setting; // ����/��ȡ��λ (8λ)
// ��λ2 ��ϸ����
uint8_t gear2_assist_level_min; // ��λ2-�����ȼ������÷�Χ��Сֵ (8λ)
uint8_t gear2_assist_level_max; // ��λ2-�����ȼ������÷�Χ����ֵ (8λ)
uint8_t gear2_assist_level_step; // ��λ2-�����ȼ����ò��� (8λ)
uint8_t gear2_assist_level_default; // ��λ2-�����ȼ�Ĭ��ֵ (8λ)
uint8_t gear2_assist_level_current; // ��λ2-�����ȼ���ǰֵ (8λ)
uint8_t gear2_max_torque_min; // ��λ2-����Ť�ؿ����÷�Χ��Сֵ (8λ)
uint8_t gear2_max_torque_max; // ��λ2-����Ť�ؿ����÷�Χ����ֵ (8λ)
uint8_t gear2_max_torque_step; // ��λ2-����Ť�����ò��� (8λ)
uint8_t gear2_max_torque_default; // ��λ2-����Ť��Ĭ��ֵ (8λ)
uint8_t gear2_max_torque_current; // ��λ2-����Ť�ص�ǰֵ (8λ)
uint8_t gear2_start_response_min; // ��λ2-������Ӧ�����÷�Χ��Сֵ (8λ)
uint8_t gear2_start_response_max; // ��λ2-������Ӧ�����÷�Χ����ֵ (8λ)
uint8_t gear2_start_response_step; // ��λ2-������Ӧ���ò��� (8λ)
uint8_t gear2_start_response_default; // ��λ2-������ӦĬ��ֵ (8λ)
uint8_t gear2_start_response_current; // ��λ2-������Ӧ��ǰֵ (8λ)
} MULMCUCanSend04;
typedef union
{
MULMCUCanSend04 Part04;
} MULMCUCanUnion04;
// ���� Riding_gear3_cfg �ṹ��
typedef struct {
// ����������
uint8_t full_range_assist_level_min; // ������Χ-�����ȼ���Сֵ (8λ)
uint8_t full_range_assist_level_max; // ������Χ-�����ȼ�����ֵ (8λ)
uint8_t full_range_max_torque_min; // ������Χ-����Ť����Сֵ (8λ)
uint8_t full_range_max_torque_max; // ������Χ-����Ť������ֵ (8λ)
uint8_t full_range_start_response_min; // ������Χ-������Ӧ��Сֵ (8λ)
uint8_t full_range_start_response_max; // ������Χ-������Ӧ����ֵ (8λ)
// �����
uint8_t gear_count; // ��λ���� (8λ)
uint8_t current_gear_setting; // ����/��ȡ��λ (8λ)
// ��λ3 ��ϸ����
uint8_t gear3_assist_level_min; // ��λ3-�����ȼ������÷�Χ��Сֵ (8λ)
uint8_t gear3_assist_level_max; // ��λ3-�����ȼ������÷�Χ����ֵ (8λ)
uint8_t gear3_assist_level_step; // ��λ3-�����ȼ����ò��� (8λ)
uint8_t gear3_assist_level_default; // ��λ3-�����ȼ�Ĭ��ֵ (8λ)
uint8_t gear3_assist_level_current; // ��λ3-�����ȼ���ǰֵ (8λ)
uint8_t gear3_max_torque_min; // ��λ3-����Ť�ؿ����÷�Χ��Сֵ (8λ)
uint8_t gear3_max_torque_max; // ��λ3-����Ť�ؿ����÷�Χ����ֵ (8λ)
uint8_t gear3_max_torque_step; // ��λ3-����Ť�����ò��� (8λ)
uint8_t gear3_max_torque_default; // ��λ3-����Ť��Ĭ��ֵ (8λ)
uint8_t gear3_max_torque_current; // ��λ3-����Ť�ص�ǰֵ (8λ)
uint8_t gear3_start_response_min; // ��λ3-������Ӧ�����÷�Χ��Сֵ (8λ)
uint8_t gear3_start_response_max; // ��λ3-������Ӧ�����÷�Χ����ֵ (8λ)
uint8_t gear3_start_response_step; // ��λ3-������Ӧ���ò��� (8λ)
uint8_t gear3_start_response_default; // ��λ3-������ӦĬ��ֵ (8λ)
uint8_t gear3_start_response_current; // ��λ3-������Ӧ��ǰֵ (8λ)
} MULMCUCanSend05;
typedef union
{
MULMCUCanSend05 Part05;
} MULMCUCanUnion05;
// ���� Riding_gear4_cfg �ṹ��
typedef struct {
// ����������
uint8_t full_range_assist_level_min; // ������Χ-�����ȼ���Сֵ (8λ)
uint8_t full_range_assist_level_max; // ������Χ-�����ȼ�����ֵ (8λ)
uint8_t full_range_max_torque_min; // ������Χ-����Ť����Сֵ (8λ)
uint8_t full_range_max_torque_max; // ������Χ-����Ť������ֵ (8λ)
uint8_t full_range_start_response_min; // ������Χ-������Ӧ��Сֵ (8λ)
uint8_t full_range_start_response_max; // ������Χ-������Ӧ����ֵ (8λ)
// �����
uint8_t gear_count; // ��λ���� (8λ)
uint8_t current_gear_setting; // ����/��ȡ��λ (8λ)
// ��λ4 ��ϸ����
uint8_t gear4_assist_level_min; // ��λ4-�����ȼ������÷�Χ��Сֵ (8λ)
uint8_t gear4_assist_level_max; // ��λ4-�����ȼ������÷�Χ����ֵ (8λ)
uint8_t gear4_assist_level_step; // ��λ4-�����ȼ����ò��� (8λ)
uint8_t gear4_assist_level_default; // ��λ4-�����ȼ�Ĭ��ֵ (8λ)
uint8_t gear4_assist_level_current; // ��λ4-�����ȼ���ǰֵ (8λ)
uint8_t gear4_max_torque_min; // ��λ4-����Ť�ؿ����÷�Χ��Сֵ (8λ)
uint8_t gear4_max_torque_max; // ��λ4-����Ť�ؿ����÷�Χ����ֵ (8λ)
uint8_t gear4_max_torque_step; // ��λ4-����Ť�����ò��� (8λ)
uint8_t gear4_max_torque_default; // ��λ4-����Ť��Ĭ��ֵ (8λ)
uint8_t gear4_max_torque_current; // ��λ4-����Ť�ص�ǰֵ (8λ)
uint8_t gear4_start_response_min; // ��λ4-������Ӧ�����÷�Χ��Сֵ (8λ)
uint8_t gear4_start_response_max; // ��λ4-������Ӧ�����÷�Χ����ֵ (8λ)
uint8_t gear4_start_response_step; // ��λ4-������Ӧ���ò��� (8λ)
uint8_t gear4_start_response_default; // ��λ4-������ӦĬ��ֵ (8λ)
uint8_t gear4_start_response_current; // ��λ4-������Ӧ��ǰֵ (8λ)
} MULMCUCanSend06;
typedef union
{
MULMCUCanSend06 Part06;
} MULMCUCanUnion06;
// ���� apack_sn �ṹ��
typedef struct {
uint8_t sn_length; // �κ�SN�볤�ȣ������������� (8λ)
char JHEK0005_SN[33];
// char sn_part_material[13]; //���ϱ���
// char sn_separator_1[1]; //�ָ���1
// char sn_part_reserve[2]; //Ԥ��
// char sn_part_prod_date[8]; //����������
// char sn_separator_2[1]; //�ָ���2
// char sn_part_batch[2]; //��������
// char sn_part_seq[6]; //�����
char padding[30]; // ��0�ֶΣ�30�ֽڣ�ʹ�ܳ���=64��
} MULMCUCanSend07;
typedef union
{
MULMCUCanSend07 Part07;
} MULMCUCanUnion07;
// ���� frame_info �ṹ��
typedef struct {
uint8_t frame_code[16]; // �����룬�ַ�����ʽ (128λ = 16�ֽ�)
} MULMCUCanSend08;
typedef union
{
MULMCUCanSend08 Part08;
} MULMCUCanUnion08;
typedef struct {
MULMCUCanUnion01 CanUnion01;
MULMCUCanUnion02 CanUnion02;
MULMCUCanUnion03 CanUnion03;
MULMCUCanUnion04 CanUnion04;
MULMCUCanUnion05 CanUnion05;
MULMCUCanUnion06 CanUnion06;
MULMCUCanUnion07 CanUnion07;
MULMCUCanUnion08 CanUnion08;
} MulPcksMCUCanSend_DataDef;
extern MCUCanSend_DataDef MCUCanSend;
extern MulPcksMCUCanSend_DataDef MULMCUCanSend;
extern MULECUtoMCU_ConfigInfo_DataDef mulecutomcu;
extern MULMCUCanSend01 mcu_prj_info;
extern MULMCUCanSend02 mcu_fault_snapshot;
extern MULMCUCanSend03 riding_gear1_cfg;
extern MULMCUCanSend04 riding_gear2_cfg;
extern MULMCUCanSend05 riding_gear3_cfg;
extern MULMCUCanSend06 riding_gear4_cfg;
extern MULMCUCanSend07 apack_sn;
extern MULMCUCanSend08 frame_info;
typedef struct {
uint8_t vehicle_name[16]; // �������ƣ�16�ֽ��ַ�����
uint8_t tire_spec[16]; // ��̥������16�ֽ��ַ�����
uint8_t battery_voltage[8]; // ���ص�ѹ��8�ֽ��޷���64λ������
uint8_t motor_power[8]; // �������ʣ�8�ֽ��޷���64λ������
uint8_t battery_capacity[10]; // ����������10�ֽ����飩
uint8_t model_code[10]; // ���ͱ��루10�ֽ����飩
uint16_t tire_circumference; // ��̥�ܳ���2�ֽ��޷���16λ������
uint8_t support_password; // �Ƿ�֧�����루1�ֽ��޷���8λ������
uint16_t sales_area; // ����������2�ֽ��޷���16λ������
} MULMCUCanReceive61;
extern MULMCUCanReceive61 config_info;
typedef struct {
uint8_t vin[16]; // �������ƣ�16�ֽ��ַ�����
} MULMCUCanReceive62;
extern MULMCUCanReceive62 frame_info_rx;
#endif