Browse Source

首驱T10C项目(35/40A),以EVT1送样的程序进行初次归档,前期修改点,参考企业版gitee的程序

master
Ruikang 1 month ago
commit
b41306e360
  1. BIN
      AppFunction/EE.c
  2. BIN
      AppFunction/EE.h
  3. BIN
      AppFunction/EmergencyBraking.c
  4. BIN
      AppFunction/EmergencyBraking.h
  5. BIN
      AppFunction/EmergencyRiding.c
  6. BIN
      AppFunction/EmergencyRiding.h
  7. BIN
      AppFunction/FaultDisp.c
  8. BIN
      AppFunction/FaultDisp.h
  9. BIN
      AppFunction/HoldBrake.c
  10. BIN
      AppFunction/HoldBrake.h
  11. BIN
      AppFunction/IqGivenControl.c
  12. BIN
      AppFunction/IqGivenControl.h
  13. BIN
      AppFunction/ProtocolGenfo.c
  14. BIN
      AppFunction/ProtocolGenfo.h
  15. BIN
      AppFunction/ProtocolLowLevel.c
  16. BIN
      AppFunction/ProtocolLowLevel.h
  17. BIN
      AppFunction/ProtocolModbus.c
  18. BIN
      AppFunction/ProtocolModbus.h
  19. BIN
      AppFunction/Tcs.c
  20. BIN
      AppFunction/Tcs.h
  21. 43
      AppFunction/anodebug.c
  22. BIN
      AppFunction/anodebug.h
  23. BIN
      AppFunction/assistMode.c
  24. 57
      AppFunction/assistMode.h
  25. BIN
      AppFunction/batt.c
  26. BIN
      AppFunction/batt.h
  27. BIN
      AppFunction/can.c
  28. BIN
      AppFunction/can.h
  29. BIN
      AppFunction/cruise.c
  30. 78
      AppFunction/cruise.h
  31. BIN
      AppFunction/curr.c
  32. BIN
      AppFunction/curr.h
  33. BIN
      AppFunction/currShow.c
  34. BIN
      AppFunction/currShow.h
  35. BIN
      AppFunction/error_led.c
  36. BIN
      AppFunction/error_led.h
  37. BIN
      AppFunction/flash.c
  38. BIN
      AppFunction/flash.h
  39. BIN
      AppFunction/hallShow.c
  40. BIN
      AppFunction/hallShow.h
  41. BIN
      AppFunction/hand.c
  42. BIN
      AppFunction/hand.h
  43. BIN
      AppFunction/help.c
  44. BIN
      AppFunction/help.h
  45. BIN
      AppFunction/io.c
  46. BIN
      AppFunction/io.h
  47. BIN
      AppFunction/led164.c
  48. BIN
      AppFunction/led164.h
  49. BIN
      AppFunction/low_battery_life.c
  50. 43
      AppFunction/low_battery_life.h
  51. BIN
      AppFunction/modeShow.c
  52. BIN
      AppFunction/modeShow.h
  53. BIN
      AppFunction/oneLine.c
  54. BIN
      AppFunction/oneLine.h
  55. BIN
      AppFunction/speedShow.c
  56. BIN
      AppFunction/speedShow.h
  57. BIN
      AppFunction/temperature.c
  58. BIN
      AppFunction/temperature.h
  59. BIN
      AppFunction/thief.c
  60. BIN
      AppFunction/thief.h
  61. BIN
      CanCommunication/CanApp.c
  62. 1086
      CanCommunication/CanApp.h
  63. 223
      CanCommunication/CanCycleSend_app.c
  64. 784
      CanCommunication/CanCycleSend_app.h
  65. 88
      CanCommunication/common.h
  66. 845
      CanCommunication/dev_can1.c
  67. BIN
      CanCommunication/eeprom_app.c
  68. BIN
      CanCommunication/eeprom_app.h
  69. 117
      CanCommunication/kernel.c
  70. 70
      CanCommunication/kernel.h
  71. BIN
      CanCommunication/mode_key.c
  72. 9
      CanCommunication/mode_key.h
  73. 64
      CanCommunication/time.c
  74. 21
      CanCommunication/time.h
  75. 9
      CanCommunication/user.h
  76. BIN
      Debug/anodebug.c
  77. BIN
      Debug/anodebug.h
  78. BIN
      Hardware/I2c.c
  79. BIN
      Hardware/I2c.h
  80. BIN
      Hardware/adc.c
  81. BIN
      Hardware/adc.h
  82. 0
      Hardware/dam.h
  83. BIN
      Hardware/dma.c
  84. BIN
      Hardware/gpio.c
  85. BIN
      Hardware/gpio.h
  86. BIN
      Hardware/timer1.c
  87. BIN
      Hardware/timer1.h
  88. BIN
      Hardware/timer17.c
  89. 0
      Hardware/timer17.h
  90. BIN
      Hardware/timer2.c
  91. BIN
      Hardware/timer2.h
  92. BIN
      Hardware/timer3.c
  93. BIN
      Hardware/timer3.h
  94. BIN
      Hardware/usart.c
  95. BIN
      Hardware/usart.h
  96. BIN
      Include/Common.h
  97. BIN
      Include/Common_Type.h
  98. BIN
      Include/HardwareInterface.h
  99. BIN
      Include/info.h
  100. BIN
      Include/main.h

BIN
AppFunction/EE.c

Binary file not shown.

BIN
AppFunction/EE.h

Binary file not shown.

BIN
AppFunction/EmergencyBraking.c

Binary file not shown.

BIN
AppFunction/EmergencyBraking.h

Binary file not shown.

BIN
AppFunction/EmergencyRiding.c

Binary file not shown.

BIN
AppFunction/EmergencyRiding.h

Binary file not shown.

BIN
AppFunction/FaultDisp.c

Binary file not shown.

BIN
AppFunction/FaultDisp.h

Binary file not shown.

BIN
AppFunction/HoldBrake.c

Binary file not shown.

BIN
AppFunction/HoldBrake.h

Binary file not shown.

BIN
AppFunction/IqGivenControl.c

Binary file not shown.

BIN
AppFunction/IqGivenControl.h

Binary file not shown.

BIN
AppFunction/ProtocolGenfo.c

Binary file not shown.

BIN
AppFunction/ProtocolGenfo.h

Binary file not shown.

BIN
AppFunction/ProtocolLowLevel.c

Binary file not shown.

BIN
AppFunction/ProtocolLowLevel.h

Binary file not shown.

BIN
AppFunction/ProtocolModbus.c

Binary file not shown.

BIN
AppFunction/ProtocolModbus.h

Binary file not shown.

BIN
AppFunction/Tcs.c

Binary file not shown.

BIN
AppFunction/Tcs.h

Binary file not shown.

43
AppFunction/anodebug.c

@ -0,0 +1,43 @@
/******************************************************************************
* File anodebug.c
* Organization
* Version V1.00
* Date 22-November-2024
* Brief ANO debug function
******************************************************************************/
/******************************************************************************
Version Record
*****************************************************************************
Time 22-November-2024
Version V1.00
Author
Description
*First version created(move from DC_Inverter_Shunt_Sample.c)
******************************************************************************/
#include "parameter.h"
#include "usart.h"
#include "anodebug.h"
/*------Ano数组--------帧头----------------数据长度--数据1-----数据2-----数据3-----数据4-----帧尾校验-*/
uint8_t AnoData[16] = {0xAB,0xFE,0x05,0xF1,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
void ANO_Debug_Run(void)
{
uint16_t flen = AnoData[4] + AnoData[5]*256;
uint8_t sumcheck = 0;
uint8_t addcheck = 0;
for(uint16_t i=0;i<(flen+6);i++)
{
sumcheck+=AnoData[i];
addcheck+=sumcheck;
}
AnoData[flen+6]=(uint8_t)sumcheck;
AnoData[flen+7]=(uint8_t)addcheck;
}
/*********** (C) COPYRIGHT 2024 江苏钮玮动力科技有限公司 ******** END OF FILE ********/

BIN
AppFunction/anodebug.h

Binary file not shown.

BIN
AppFunction/assistMode.c

Binary file not shown.

57
AppFunction/assistMode.h

@ -0,0 +1,57 @@
/**
******************************************************************************
* @file AssistMode.h
* @author
* @version V1.0.0
* @date 2024-9-29
* @brief hand.c模块头文件
******************************************************************************
* @attention
*
* <h2><center>&copy;</center></h2>
*
*
* 使
*
******************************************************************************
*/
/* 定义防止递归包含 ----------------------------------------------------------*/
#ifndef __ASSISTMODE_H
#define __ASSISTMODE_H
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************/
/* 包含 ----------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "stm32f10x_conf.h"
#include "qmathLib.h"
#include "info.h"
/* 公有 types ----------------------------------------------------------------*/
/* 公有 define ---------------------------------------------------------------*/
typedef struct
{
/* 私有 */
uint16_t time; /* 变量: 时间 */
uint8_t AssistFlag; /* Tcs标志*/
}USEASSIST_DataDef;
typedef USEASSIST_DataDef *USEASSISTHandle;
extern USEASSIST_DataDef U_assist;
/* 公有 macro ----------------------------------------------------------------*/
/* 公有 constants ------------------------------------------------------------*/
/* 公有 variables ------------------------------------------------------------*/
/* 公有 functions ----------------------------------------------------------- */
extern u8 AssistModeDisp(u8 DASH_AsscReq,u8 MCU_RunStatus);
/******************************************************************************/
#ifdef __cplusplus
}
#endif /* extern "C" */
#endif /* __HAND_H */
/**************************** (C) 深圳市摩特康 ********************************/
/********************************END OF FILE***********************************/

BIN
AppFunction/batt.c

Binary file not shown.

BIN
AppFunction/batt.h

Binary file not shown.

BIN
AppFunction/can.c

Binary file not shown.

BIN
AppFunction/can.h

Binary file not shown.

BIN
AppFunction/cruise.c

Binary file not shown.

78
AppFunction/cruise.h

@ -0,0 +1,78 @@
/********************************* Copyright ************************************
* (C) Copyright 2024,Zhang Kai,China,Genfo.
* All Rights Reserved
*
* By(Zhang Kai)
*
* : cruise.h
* : V1.0
* : 2024-09-29
* : ()
* : ()
********************************************************************************/
#ifndef __CRUISE_H_
#define __CRUISE_H_
/**********************************参数及宏定义*********************************/
#define SPEED_HOLD_TIME_CNT 3000 //速度保持时间计数值(根据调用周期设置)
#define CRS_MAX_ALLOWABLE_SPEED 55 //巡航最大允许的速度,单位km/h
typedef enum
{
Invalid = 0, //无效
valid , //有效
}CrsBtnSts_e;
typedef enum
{
AutoHold = 0,
Alarmed ,
Park,
Ready,
Run,
Cruise, //定速巡航
LowPowerFront, //推车助力
LowPowerRear, //倒车助力
}RunStatus_e;
typedef struct
{
unsigned char ButtonStatus; //定速巡航按钮状态 @ref CrsBtnSts_e 0x0:Invalid 无效 0x1:valid 有效
unsigned int SpeedHoldTimeCnt; //速度保持时间计数值
unsigned char RunStatus; /*运行状态
0x0autohold
0x1alarmed
0x2Park
0x3ready
0x4run
0x5cruise()
0x6low-power-front
0x7low-power-rear
*/
unsigned char HbarRange; //当前手把开度0-100%
unsigned char CurrentSpeed; //当前车速 单位:千米/时
unsigned char KmhLimit; //巡航最高车速限速千米/时
unsigned char IncSpeed; //增加巡航速度
unsigned char ReduceSpeed; //减少巡航速度
unsigned char BrakeEn; //制动使能标志 1:制动使能 0:未制动
unsigned char PullBackHbar; //回拉转把
unsigned char McuFault; //MCU故障
unsigned char SideBraceFallsDown; //边撑落下
unsigned char MaxAllowableSpeed; //系统被允许的最高测速
unsigned char AutoStatus; //自动巡航状态 0:未进入 1:已进入
unsigned char AutoEnSet; //自动巡航使能开启 0:未开启 1:已开启
} Cruise_t;
/*******************************外部参数及函数声明******************************/
extern Cruise_t Cruise_M1;
void app_cruise (Cruise_t *p);
#endif

BIN
AppFunction/curr.c

Binary file not shown.

BIN
AppFunction/curr.h

Binary file not shown.

BIN
AppFunction/currShow.c

Binary file not shown.

BIN
AppFunction/currShow.h

Binary file not shown.

BIN
AppFunction/error_led.c

Binary file not shown.

BIN
AppFunction/error_led.h

Binary file not shown.

BIN
AppFunction/flash.c

Binary file not shown.

BIN
AppFunction/flash.h

Binary file not shown.

BIN
AppFunction/hallShow.c

Binary file not shown.

BIN
AppFunction/hallShow.h

Binary file not shown.

BIN
AppFunction/hand.c

Binary file not shown.

BIN
AppFunction/hand.h

Binary file not shown.

BIN
AppFunction/help.c

Binary file not shown.

BIN
AppFunction/help.h

Binary file not shown.

BIN
AppFunction/io.c

Binary file not shown.

BIN
AppFunction/io.h

Binary file not shown.

BIN
AppFunction/led164.c

Binary file not shown.

BIN
AppFunction/led164.h

Binary file not shown.

BIN
AppFunction/low_battery_life.c

Binary file not shown.

43
AppFunction/low_battery_life.h

@ -0,0 +1,43 @@
/********************************* Copyright ************************************
* (C) Copyright 2024,Zhang Kai,China,Genfo.
* All Rights Reserved
*
* By(Zhang Kai)
*
* : low_battery_life.h
* : V1.0
* : 2024-09-29
* : ()
* : ()
********************************************************************************/
#ifndef __LOW_BATTERY_LIFE_H_
#define __LOW_BATTERY_LIFE_H_
/**********************************参数及宏定义*********************************/
#define LBF_MAX_ALLOWABLE_SPEED 55 //低电量续航最大允许的速度,单位km/h
typedef enum
{
NoRequest = 0,
Off ,
On,
Reserved,
}LowBatLife_e;
typedef struct
{
unsigned char EnSet; //功能使能标志 0x0:No Request 0x1:OFF 0x2: ON 0x3:reserved
unsigned char Status; //低电量长续航模式状态 0x0:OFF 0x1: ON
unsigned char SocValue; //电池SOC 0--100
unsigned char KmhLimit; //限速千米/时
} LowBatLife_t;
/*******************************外部参数及函数声明******************************/
extern LowBatLife_t LowBatLife_M1;
void app_low_battery_life (LowBatLife_t *p);
#endif

BIN
AppFunction/modeShow.c

Binary file not shown.

BIN
AppFunction/modeShow.h

Binary file not shown.

BIN
AppFunction/oneLine.c

Binary file not shown.

BIN
AppFunction/oneLine.h

Binary file not shown.

BIN
AppFunction/speedShow.c

Binary file not shown.

BIN
AppFunction/speedShow.h

Binary file not shown.

BIN
AppFunction/temperature.c

Binary file not shown.

BIN
AppFunction/temperature.h

Binary file not shown.

BIN
AppFunction/thief.c

Binary file not shown.

BIN
AppFunction/thief.h

Binary file not shown.

BIN
CanCommunication/CanApp.c

Binary file not shown.

1086
CanCommunication/CanApp.h

File diff suppressed because it is too large

223
CanCommunication/CanCycleSend_app.c

@ -0,0 +1,223 @@
#include "CanCycleSend_app.h"
#include "CanApp.h"
#include "user.h"
#include "eeprom_app.h"
#include "mode_key.h"
//INT16U Can1MsgTxCyclicCounter[12];
//qiuadd
INT16U Can1MsgTxCyclicCounter[26];
//INT16U Can1MsgTxTimer[12];
//qiuadd
INT16U Can1MsgTxTimer[26];
void Can1_CommunicationInit(void)
{
for(int i=0;i<26;i++)
{
Can1MsgTxCyclicCounter[i] = 0;
Can1MsgTxTimer[i] = FOREMOST_TIME;
}
for(int i=0;i<26;i++)
{
Can1MsgTxCyclicCounter[i] = CycleTime_22NID[i];
}
CAN_AppUpdata_time = FOREMOST_TIME;
UserCanRxSignal.CycleSendEnable_flg =1;
ModeKey_Init();
}
CanTxMsg TxMsg;
//extern uint8_t one_cycle_pedal_flag;
u8 errorstate;
u8 ID230cnt;
u8 ID231cnt;
u8 ID232cnt;
u8 ID233cnt;
void Can1_CommunicationTask(void)
{
INT32U Can_ID;
ModeKey_Task();
for(int i=0;i<26;i++)
{
if(Can1MsgTxCyclicCounter[i] != CycleTime_22NID[i])
{
Can1MsgTxCyclicCounter[i] = CycleTime_22NID[i];
Can1MsgTxTimer[i] = FOREMOST_TIME;
}
}
if(UserCanRxSignal.CycleSendEnable_flg==1)
{
MC_Broadcast_Update();
if (Get1MsTickInterval(Can1MsgTxTimer[0]) >= Can1MsgTxCyclicCounter[0])
{
Can1MsgTxTimer[0] = Get1MsTickVal();
Can_ID = 0x18ff0200;
write(h_can1, DateTxBroadcast.ID00, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[1]) >= Can1MsgTxCyclicCounter[1])
{
Can1MsgTxTimer[1] = Get1MsTickVal();
Can_ID = 0x18ff0201;
write(h_can1, DateTxBroadcast.ID01, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[2]) >= Can1MsgTxCyclicCounter[2])
{
Can1MsgTxTimer[2] = Get1MsTickVal();
Can_ID = 0x18ff0202;
write(h_can1, DateTxBroadcast.ID02, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[3]) >= Can1MsgTxCyclicCounter[3])
{
Can1MsgTxTimer[3] = Get1MsTickVal();
Can_ID = 0x18ff0203;
write(h_can1, DateTxBroadcast.ID03, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[4]) >= Can1MsgTxCyclicCounter[4])
{
Can1MsgTxTimer[4] = Get1MsTickVal();
Can_ID = 0x18ff0204;
write(h_can1, DateTxBroadcast.ID04, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[5]) >= Can1MsgTxCyclicCounter[5])
{
Can1MsgTxTimer[5] = Get1MsTickVal();
Can_ID = 0x18ff0205;
write(h_can1, DateTxBroadcast.ID05, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[6]) >= Can1MsgTxCyclicCounter[6]&&ID230cnt<5)
{
Can1MsgTxTimer[6] = Get1MsTickVal();
ID230cnt++;
if(ID230cnt>5)
ID230cnt=5;
Can_ID = 0x18ff0230;
write(h_can1, DateTxBroadcast.ID06, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[7]) >= Can1MsgTxCyclicCounter[7]&&ID231cnt<5)
{
Can1MsgTxTimer[7] = Get1MsTickVal();
ID231cnt++;
if(ID231cnt>5)
ID231cnt=5;
Can_ID = 0x18ff0231;
write(h_can1, DateTxBroadcast.ID07, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[8]) >= Can1MsgTxCyclicCounter[8]&&ID232cnt<5)
{
Can1MsgTxTimer[8] = Get1MsTickVal();
ID232cnt++;
if(ID232cnt>5)
ID232cnt=5;
Can_ID = 0x18ff0232;
write(h_can1, DateTxBroadcast.ID08, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[9]) >= Can1MsgTxCyclicCounter[9]&&ID233cnt<5)
{
Can1MsgTxTimer[9] = Get1MsTickVal();
ID233cnt++;
if(ID233cnt>5)
ID233cnt=5;
Can_ID = 0x18ff0233;
write(h_can1, DateTxBroadcast.ID09, 8, &Can_ID);
}
// if (Get1MsTickInterval(Can1MsgTxTimer[10]) >= Can1MsgTxCyclicCounter[10])
// {
// Can1MsgTxTimer[10] = Get1MsTickVal();
// Can_ID = 0x18ff0240;
// write(h_can1, DateTxBroadcast.ID10, 8, &Can_ID);
// }
//
// if (Get1MsTickInterval(Can1MsgTxTimer[11]) >= Can1MsgTxCyclicCounter[11])
// {
// Can1MsgTxTimer[11] = Get1MsTickVal();
// Can_ID = 0x18ff0241;
// write(h_can1, DateTxBroadcast.ID11, 8, &Can_ID);
// }
//
// if (Get1MsTickInterval(Can1MsgTxTimer[12]) >= Can1MsgTxCyclicCounter[12])
// {
// Can1MsgTxTimer[12] = Get1MsTickVal();
// Can_ID = 0x18ff0242;
// write(h_can1, DateTxBroadcast.ID12, 8, &Can_ID);
// }
//
// if (Get1MsTickInterval(Can1MsgTxTimer[13]) >= Can1MsgTxCyclicCounter[13])
// {
// Can1MsgTxTimer[13] = Get1MsTickVal();
// Can_ID = 0x18ff0243;
// write(h_can1, DateTxBroadcast.ID13, 8, &Can_ID);
// }
// 0x18FF0101、0x18FF0108~0x18FF010C 为VCU接收触发帧,不再周期发送。
if (Get1MsTickInterval(Can1MsgTxTimer[20]) >= Can1MsgTxCyclicCounter[20])
{
Can1MsgTxTimer[20] = Get1MsTickVal();
Can_ID = 0x18ff0600;
write(h_can1, DateTxBroadcast.ID20, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[21]) >= Can1MsgTxCyclicCounter[21])
{
Can1MsgTxTimer[21] = Get1MsTickVal();
Can_ID = 0x18ff0601;
write(h_can1, DateTxBroadcast.ID21, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[22]) >= Can1MsgTxCyclicCounter[22])
{
Can1MsgTxTimer[22] = Get1MsTickVal();
Can_ID = 0x18ff0250;
write(h_can1, DateTxBroadcast.ID22, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[23]) >= Can1MsgTxCyclicCounter[23])
{
Can1MsgTxTimer[23] = Get1MsTickVal();
Can_ID = 0x18ff0260;
write(h_can1, DateTxBroadcast.ID23, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[24]) >= Can1MsgTxCyclicCounter[24])
{
Can1MsgTxTimer[24] = Get1MsTickVal();
Can_ID = 0x18ff0261;
write(h_can1, DateTxBroadcast.ID24, 8, &Can_ID);
}
if (Get1MsTickInterval(Can1MsgTxTimer[25]) >= Can1MsgTxCyclicCounter[25])
{
Can1MsgTxTimer[25] = Get1MsTickVal();
Can_ID = 0x18ff0262;
write(h_can1, DateTxBroadcast.ID25, 8, &Can_ID);
}
uint8_t error_code = CAN_GetLastErrorCode(CAN1);
if (error_code != CAN_ErrorCode_NoErr) {
// 有错误,查看错误码
errorstate=error_code;
}
}
else
{
for(int i=0;i<26;i++)
{
Can1MsgTxTimer[i] = FOREMOST_TIME;
}
}
}

784
CanCommunication/CanCycleSend_app.h

@ -0,0 +1,784 @@
#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;//仪表连接成功标志
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个时记录的轮子脉冲个数的差值,并上报此帧)
} 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

88
CanCommunication/common.h

@ -0,0 +1,88 @@
#ifndef __COMMON_H
#define __COMMON_H
#include <string.h>
#include <stdio.h>
#include "stdint.h"
#include <stdlib.h>
#include "stdbool.h"
#include "usart.h"
#include "stm32f10x.h"
#include "Common_Type.h"
#include "kernel.h"
#include "time.h"
#include "misc.h"
#pragma anon_unions
#define GPIO_Type GPIO_TypeDef
#undef NULL
#define NULL ((void *)0)
//#define TRUE 1
//#define FALSE 0
//CAN
#define IOCTL_CMD_CAN_FILTER_ADD 1 //添加过滤器
#define IOCTL_CMD_CAN_FILTER_MASK_ADD 2 //添加过滤器掩码
#define IOCTL_CMD_CAN_FILTER_INIT 3 //初始化过滤器
#define IOCTL_CAN_SET_FILTER_ALL 4 //全接收模式
#define IOCTL_CAN_CLEAR_RXBUFF 5 //清除缓冲区
#define IOCTL_CAN_GET_NEXTMAILID 6 //获取下一封邮箱的CAN ID
#define TASK_LOCK \
{ \
__disable_irq();
#define TASK_UNLOCK \
__enable_irq(); \
}
#define DISABLE_IRQ(IRQChannel) NVIC->ICER[IRQChannel >> 0x05] = (uint32_t)0x01 << (IRQChannel & (uint8_t)0x1F)
#define ENABLE_IRQ(IRQChannel) NVIC->ISER[IRQChannel >> 0x05] = (uint32_t)0x01 << (IRQChannel & (uint8_t)0x1F)
extern unsigned short int Get1MsTickVal(void);
#define clock() Get1MsTickVal()
extern void Delay_ms(uint16_t ms);
#define sleep(ms) Delay_ms(ms)
typedef enum
{
INSTANCE_CAN1 = 0,
INSTANCE_CAN2
} can_instance;
typedef struct
{
INT16U SlowRecoverCounter; /* 慢恢复时间, 单位1ms */
INT16U FastRecoverCounter; /* 快恢复时间, 单位1ms */
INT16U Threshold; /* 快恢复转到慢恢复阈值 */
INT16U DtcOccurCnt; /* 连续多少次产生Busoff DTC */
INT16U BusOffRecoverTime; /* Message received AND message sent on CAN successfully 连续时间 */
} tCanBusOffConfigTyp;
typedef enum
{
st_BusNormal,
st_BusOff
} eBusOffStateType;
typedef struct
{
INT8U Can1_BusOff_Flag;
INT8U Can2_BusOff_Flag;
} BusOff_t;
extern BusOff_t x_BusOff;
extern int h_can1;
#endif

845
CanCommunication/dev_can1.c

@ -0,0 +1,845 @@
#include "stm32f10x_can.h"
#include "common.h"
#include "kernel.h"
#include "CanApp.h"
int h_can1 = -1;
KERNEL_DEVICE_INIT("dev_can1")
extern void user_process_can1_send_interface(INT32U msg_id);
extern void user_process_can1_error_interface(void);
#define USER_CAN_MODE CAN_Mode_Normal;
#define BUSY 0x55
#define IDLE 0x00
#define CAN_MAIL_BUFF_SIZE 64
// 定义为扩展帧类型
#define CAN_FRAME_TYPE CAN_FRAME_EXT
#define CAN_FRAME_STD 0
#define CAN_FRAME_EXT 1
KERNEL_TYPE unsigned char CanEvent = 0;
//每封CAN邮件基本格式
typedef struct
{
unsigned int MailID; // 扩展帧使??9位ID
unsigned short int MailLenth;
unsigned char MailBuffer[8];
} CANMAILMESSAGE;
//定义每个存储的循环缓冲大??
typedef struct
{
unsigned int Head;
unsigned int Tail;
CANMAILMESSAGE MailBuffer[CAN_MAIL_BUFF_SIZE];
} CAN_FIFO;
KERNEL_TYPE CAN_FIFO can_rx;
KERNEL_TYPE CAN_FIFO can_tx;
KERNEL_TYPE void CAN_RCC_Configuration(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN1, ENABLE);
}
KERNEL_TYPE void CAN_GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
// 如需重映射CAN引脚可启??
GPIO_PinRemapConfig(GPIO_Remap1_CAN1, ENABLE);
// CAN_RX - PA11
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_8;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStruct);
// CAN_TX - PA12
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9; //TX
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOB, &GPIO_InitStruct);
}
KERNEL_TYPE void CAN_NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
// 接收中断
NVIC_InitStructure.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// 发送中??
NVIC_InitStructure.NVIC_IRQChannel = USB_HP_CAN1_TX_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// 错误中断 - 最高优先级
NVIC_InitStructure.NVIC_IRQChannel = CAN1_SCE_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
typedef struct
{
unsigned short int BPS;
unsigned char SJW;
unsigned char BS1;
unsigned char BS2;
unsigned short int Prescaler;
} CAN_BAUD_Struct_t;
KERNEL_TYPE CAN_BAUD_Struct_t CAN_BaudTab[] =
{ //采样点:%81.25
/*0*/ {125, CAN_SJW_1tq, CAN_BS1_14tq, CAN_BS2_3tq, 16},
/*1*/ {250, CAN_SJW_1tq, CAN_BS1_14tq, CAN_BS2_3tq, 8},
// /*2*/ {500, CAN_SJW_2tq, CAN_BS1_13tq, CAN_BS2_4tq, 4}, //SysClock 72MHz
/*2*/ {500, CAN_SJW_2tq, CAN_BS1_14tq, CAN_BS2_3tq, 6}, //SysClock 108MHz
/*3*/ {1000, CAN_SJW_1tq, CAN_BS1_14tq, CAN_BS2_3tq, 2}
};
KERNEL_TYPE int CAN_Configuration(void)
{
unsigned char can_baud_index;
CAN_InitTypeDef CAN_InitStructure;
CAN_StructInit(&CAN_InitStructure);
//关闭时间触发模式
CAN_InitStructure.CAN_TTCM = DISABLE;
//关闭自动离线管理
CAN_InitStructure.CAN_ABOM = DISABLE;
//关闭自动唤醒模式
CAN_InitStructure.CAN_AWUM = DISABLE;
//禁止报文自动重传
CAN_InitStructure.CAN_NART = ENABLE; //只发送一??
//FIFO 溢出时报文覆盖源文件
CAN_InitStructure.CAN_RFLM = DISABLE;
//报文发送优先级取决于请求顺??
CAN_InitStructure.CAN_TXFP = ENABLE;
//正常的工作模??
CAN_InitStructure.CAN_Mode = USER_CAN_MODE;
can_baud_index = 2;// 使用500kbps波特??
CAN_InitStructure.CAN_SJW = CAN_BaudTab[can_baud_index].SJW;
CAN_InitStructure.CAN_BS1 = CAN_BaudTab[can_baud_index].BS1;
CAN_InitStructure.CAN_BS2 = CAN_BaudTab[can_baud_index].BS2;
CAN_InitStructure.CAN_Prescaler = CAN_BaudTab[can_baud_index].Prescaler;
//初始化CAN
CAN_Init(CAN1, &CAN_InitStructure);
//使能接收中断
CAN_ITConfig(CAN1, CAN_IT_FMP0, ENABLE);
//发送中??
CAN_ITConfig(CAN1, CAN_IT_TME, ENABLE); //邮箱空中断使??
CAN_ClearFlag(CAN1, CAN_FLAG_EPV);
CAN_ClearFlag(CAN1, CAN_FLAG_BOF);
CAN_ClearFlag(CAN1, CAN_FLAG_LEC);
CAN_ClearFlag(CAN1, CAN_FLAG_EWG);
//CAN_ITConfig(CAN1, CAN_IT_ERR | CAN_IT_LEC | CAN_IT_BOF | CAN_IT_EPV, ENABLE);
CAN_ITConfig(CAN1, CAN_IT_ERR | CAN_IT_BOF , ENABLE);
return 0;
}
#define CAN_LIST_SZIE 32
unsigned int CAN_FilterList[CAN_LIST_SZIE];
unsigned int CAN_FilterList_Mask[CAN_LIST_SZIE];
KERNEL_TYPE int CAN_FilterCount = 0;
KERNEL_TYPE int CAN_FilterMaskCount = 0;
KERNEL_TYPE int CAN_FilterAdd(int filterID) //添加后不生效
{
// 扩展帧ID范围检??
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
if (filterID < 0 || filterID > 0x7FF)
{
return K_FAIL;
}
#else
if (filterID < 0 || filterID > 0x1FFFFFFF)
{
return K_FAIL;
}
#endif
if (CAN_FilterCount >= CAN_LIST_SZIE)
{
return K_FAIL;
}
CAN_FilterList[CAN_FilterCount++] = filterID;
return K_SUCCESS;
}
KERNEL_TYPE int CAN_FilterMaskAdd(int filterMask) //添加后不生效
{
// 扩展帧掩码范围检??
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
if (filterMask < 0 || filterMask > 0x7FF)
{
return K_FAIL;
}
#else
if (filterMask < 0 || filterMask > 0x1FFFFFFF)
{
return K_FAIL;
}
#endif
if (CAN_FilterMaskCount >= CAN_LIST_SZIE)
{
return K_FAIL;
}
CAN_FilterList_Mask[CAN_FilterMaskCount++] = filterMask;
return K_SUCCESS;
}
KERNEL_TYPE int CAN_FilterEnable(void)
{
CAN_FilterInitTypeDef CAN_FilterInitStructure;
int FilterNumber = 0;
int num = 0;
int index = 0;
int mask_index = 0;
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
FilterNumber = CAN_FilterCount / 4;
//屏蔽模式
CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdList;
//16位寄存器
CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_16bit;
//过滤??0 关联??FIFO0
CAN_FilterInitStructure.CAN_FilterFIFOAssignment = CAN_Filter_FIFO0;
//使能过滤??
CAN_FilterInitStructure.CAN_FilterActivation = ENABLE;
for (num = 0; num < FilterNumber; num++)
{
CAN_FilterInitStructure.CAN_FilterNumber = num;
//??6??
CAN_FilterInitStructure.CAN_FilterIdHigh = CAN_FilterList[index++] << 5;
//??6??
CAN_FilterInitStructure.CAN_FilterIdLow = CAN_FilterList[index++] << 5;
//屏蔽位高16??
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = CAN_FilterList[index++] << 5;
//屏蔽位低16??
CAN_FilterInitStructure.CAN_FilterMaskIdLow = CAN_FilterList[index++] << 5;
//初始化过滤器
CAN_FilterInit(&CAN_FilterInitStructure);
}
if (CAN_FilterCount % 4)
{
CAN_FilterInitStructure.CAN_FilterNumber = num;
//??6??
CAN_FilterInitStructure.CAN_FilterIdHigh = CAN_FilterList[index] << 5;
//??6??
if (index < CAN_FilterCount)
{
index++;
CAN_FilterInitStructure.CAN_FilterIdLow = CAN_FilterList[index] << 5;
}
//屏蔽位高16??
if (index < CAN_FilterCount)
{
index++;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = CAN_FilterList[index] << 5;
}
//屏蔽位低16??
if (index < CAN_FilterCount)
{
index++;
CAN_FilterInitStructure.CAN_FilterMaskIdLow = CAN_FilterList[index] << 5;
}
//初始化过滤器
CAN_FilterInit(&CAN_FilterInitStructure);
}
#else
//屏蔽模式
CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask;
//32位寄存器- 扩展帧必须使??2位模??
CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_32bit;
//过滤??0 关联??FIFO0
CAN_FilterInitStructure.CAN_FilterFIFOAssignment = CAN_Filter_FIFO0;
//使能过滤??
CAN_FilterInitStructure.CAN_FilterActivation = ENABLE;
if(CAN_FilterInitStructure.CAN_FilterMode == CAN_FilterMode_IdList)
{
FilterNumber = CAN_FilterCount / 2;
for (num = 0; num < FilterNumber; num++)
{
CAN_FilterInitStructure.CAN_FilterNumber = num;
//??6??
CAN_FilterInitStructure.CAN_FilterIdHigh = CAN_FilterList[index] >> 13;
//??6位,包含IDE??0x0004表示扩展??
CAN_FilterInitStructure.CAN_FilterIdLow = (CAN_FilterList[index++] << 3) | 0x0004;
//屏蔽位高16??
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = CAN_FilterList[index] >> 13;
//屏蔽位低16??
CAN_FilterInitStructure.CAN_FilterMaskIdLow = (CAN_FilterList[index++] << 3) | 0x0004;
//初始化过滤器
CAN_FilterInit(&CAN_FilterInitStructure);
}
if (CAN_FilterCount % 2)
{
CAN_FilterInitStructure.CAN_FilterNumber = num;
//??6??
CAN_FilterInitStructure.CAN_FilterIdHigh = CAN_FilterList[index] >> 13;
//??6??
CAN_FilterInitStructure.CAN_FilterIdLow = (CAN_FilterList[index] << 3) | 0x0004;
//初始化过滤器
CAN_FilterInit(&CAN_FilterInitStructure);
}
}
if(CAN_FilterInitStructure.CAN_FilterMode == CAN_FilterMode_IdMask)
{
FilterNumber = CAN_FilterCount;
for (num = 0; num < FilterNumber; num++)
{
CAN_FilterInitStructure.CAN_FilterNumber = num;
//??6??
CAN_FilterInitStructure.CAN_FilterIdHigh = CAN_FilterList[index] >> 13;
//??6??
CAN_FilterInitStructure.CAN_FilterIdLow = (CAN_FilterList[index++] << 3) | 0x0004;
//屏蔽位高16??
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = CAN_FilterList_Mask[mask_index] >> 13;
//屏蔽位低16??
CAN_FilterInitStructure.CAN_FilterMaskIdLow = (CAN_FilterList_Mask[mask_index++] << 3) | 0x0004;
//初始化过滤器
CAN_FilterInit(&CAN_FilterInitStructure);
}
}
#endif
return K_SUCCESS;
}
KERNEL_TYPE int CAN_FilterMaskEnable(void)
{
CAN_FilterInitTypeDef CAN_FilterInitStructure;
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
//屏蔽模式
CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask;
//32位寄存器
CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_16bit;
//??6??
CAN_FilterInitStructure.CAN_FilterIdHigh = 0;
//??6??
CAN_FilterInitStructure.CAN_FilterIdLow = 0;
//屏蔽位高16??
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = 0;
//屏蔽位低16??
CAN_FilterInitStructure.CAN_FilterMaskIdLow = 0;
#else
//屏蔽模式
CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask;
//32位寄存器
CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_32bit;
//??6??
CAN_FilterInitStructure.CAN_FilterIdHigh = 0;
//??6??
CAN_FilterInitStructure.CAN_FilterIdLow = 0x0004;
//屏蔽位高16??
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = 0;
//屏蔽位低16??
CAN_FilterInitStructure.CAN_FilterMaskIdLow = 0x0004;
#endif
//过滤??0 关联??FIFO0
CAN_FilterInitStructure.CAN_FilterFIFOAssignment = CAN_Filter_FIFO0;
//使能过滤??
CAN_FilterInitStructure.CAN_FilterActivation = ENABLE;
CAN_FilterInitStructure.CAN_FilterNumber = 0;
//初始化过滤器
CAN_FilterInit(&CAN_FilterInitStructure);
return K_SUCCESS;
}
#define CAN_TSR_TMEx_MASK (0x07 << 26)
#define CAN_TSR_TMEx_isEmpty (CAN1->TSR & CAN_TSR_TMEx_MASK) //空闲邮箱状??
#define CAN_FIFO_0_FMP0_MASK 0x03
#define CAN_FIFO_0_NUM (CAN1->RF0R & CAN_FIFO_0_FMP0_MASK) //FIFO 0 接收到的报文数目
CanTxMsg TxMessage;
//启动发??
KERNEL_TYPE void CAN_send_mail(void)
{
if (CAN_TSR_TMEx_isEmpty)
{
if (can_tx.Head != can_tx.Tail)
{
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
TxMessage.StdId = can_tx.MailBuffer[can_tx.Tail].MailID;
#else
TxMessage.ExtId = can_tx.MailBuffer[can_tx.Tail].MailID;
#endif
TxMessage.DLC = can_tx.MailBuffer[can_tx.Tail].MailLenth;
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
TxMessage.IDE = CAN_ID_STD;
#else
TxMessage.IDE = CAN_ID_EXT;
#endif
TxMessage.RTR = CAN_RTR_DATA;
memcpy(TxMessage.Data, can_tx.MailBuffer[can_tx.Tail].MailBuffer, TxMessage.DLC);
TASK_LOCK;
can_tx.Tail++;
if (can_tx.Tail >= CAN_MAIL_BUFF_SIZE) can_tx.Tail = 0;
TASK_UNLOCK;
CAN_Transmit(CAN1, &TxMessage);
}
}
}
/*
KERNEL_TYPE void CAN_read_fifo(void)
{
CanRxMsg rx_message;
unsigned short int lTimer = 0;
lTimer = clock();
while (1) //等待缓冲区空出空??
{
if (((can_rx.Head + 1) == can_rx.Tail) || (can_rx.Tail == 0 && ((can_rx.Head + 1) == CAN_MAIL_BUFF_SIZE)))
{
if ((Get1MsTickInterval(lTimer)) >= 10) //10ms 等待超时
{
return;
}
}
else
{
break;
}
}
CAN_Receive(CAN1, CAN_FIFO0, &rx_message);
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
can_rx.MailBuffer[can_rx.Head].MailID = rx_message.StdId;
#else
can_rx.MailBuffer[can_rx.Head].MailID = rx_message.ExtId;
#endif
can_rx.MailBuffer[can_rx.Head].MailLenth = rx_message.DLC;
memcpy(can_rx.MailBuffer[can_rx.Head].MailBuffer, rx_message.Data, rx_message.DLC);
TASK_LOCK;
can_rx.Head++;
if (can_rx.Head >= CAN_MAIL_BUFF_SIZE) can_rx.Head = 0;
TASK_UNLOCK;
}
*/
////CAN邮箱数据接收中断
//void USB_LP_CAN1_RX0_IRQHandler(void)
//{
// //CAN接收
// CAN_read_fifo();
//}
extern u8 ReceiveOTA_flg;
//CAN邮箱存在空中??
void USB_HP_CAN1_TX_IRQHandler(void)
{
if (CAN1->TSR & (1 << 26))
{
CAN_ClearFlag(CAN1, CAN_FLAG_RQCP0);
}
if (CAN1->TSR & (1 << 27))
{
CAN_ClearFlag(CAN1, CAN_FLAG_RQCP1);
}
if (CAN1->TSR & (1 << 28))
{
CAN_ClearFlag(CAN1, CAN_FLAG_RQCP2);
}
if((UpgradeRequest)||(UserCanRxSignal.JumpToBOOT_flg==1))
{
UserCanRxSignal.JumpToBOOT_flg =1;
UpgradeRequest = 0;
NVIC_SystemReset();
}
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
//user_process_can1_send_interface(TxMessage.StdId);
#else
//user_process_can1_send_interface(TxMessage.ExtId);
#endif
CAN_send_mail();
if (CAN_TSR_TMEx_isEmpty == CAN_TSR_TMEx_MASK) //全为空才是闲
{
CanEvent = IDLE;
}
else if (CAN_TSR_TMEx_isEmpty == 0)
{
CanEvent = BUSY;
}
}
////CAN1 错误终端入口
//void CAN1_SCE_IRQHandler(void)
//{
// CAN_ClearFlag(CAN1, CAN_FLAG_EPV);
// CAN_ClearFlag(CAN1, CAN_FLAG_BOF);
// CAN_ClearFlag(CAN1, CAN_FLAG_LEC);
//
// //user_process_can1_error_interface();
//}
KERNEL_TYPE int WriteOneMessage(CanTxMsg *TxMessage)
{
unsigned short int lTimer = 0;
lTimer = clock();
while (1) //等待缓冲区空出空??
{
if (((can_tx.Head + 1) == can_tx.Tail) || (can_tx.Tail == 0 && ((can_tx.Head + 1) == CAN_MAIL_BUFF_SIZE)))
{
if ((Get1MsTickInterval(lTimer)) >= 10)
{
close(h_can1);
h_can1 = open("dev_can1", 0);
return K_FAIL;
}
}
else
{
break;
}
}
memcpy(can_tx.MailBuffer[can_tx.Head].MailBuffer, TxMessage->Data, TxMessage->DLC);
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
can_tx.MailBuffer[can_tx.Head].MailID = TxMessage->StdId;
#else
can_tx.MailBuffer[can_tx.Head].MailID = TxMessage->ExtId;
#endif
can_tx.MailBuffer[can_tx.Head].MailLenth = TxMessage->DLC;
//关闭中断
TASK_LOCK;
can_tx.Head++;
if (can_tx.Head >= CAN_MAIL_BUFF_SIZE)
{
can_tx.Head = 0;
}
TASK_UNLOCK;
if (CanEvent == IDLE)
{
//启动发??
CanEvent = BUSY;
CAN_send_mail();
}
return K_SUCCESS;
}
KERNEL_TYPE int GetNextMailID(void)
{
if (can_rx.Head == can_rx.Tail)
{
return K_FAIL;
}
return can_rx.MailBuffer[can_rx.Tail].MailID;
}
KERNEL_TYPE int GetOneMessage(CanRxMsg *message)
{
if (can_rx.Head == can_rx.Tail)
{
return K_FAIL;
}
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
message->StdId = can_rx.MailBuffer[can_rx.Tail].MailID;
#else
message->ExtId = can_rx.MailBuffer[can_rx.Tail].MailID;
#endif
message->DLC = can_rx.MailBuffer[can_rx.Tail].MailLenth & 0x0F;
//qiuadd
message->IDE = CAN_ID_EXT;
memcpy(message->Data, can_rx.MailBuffer[can_rx.Tail].MailBuffer, message->DLC);
TASK_LOCK;
can_rx.Tail++;
if (can_rx.Tail >= CAN_MAIL_BUFF_SIZE)
{
can_rx.Tail = 0;
}
TASK_UNLOCK;
if (message->DLC == 0)
{
return K_FAIL;
}
return K_SUCCESS;
}
//
//设备接口实现
//
KERNEL_TYPE int device_ioctl(unsigned int cmd, unsigned long arg);
KERNEL_TYPE int device_open(int flags)
{
if (kernel_device_status == TRUE)
{
return K_FAIL;
}
CAN_DeInit(CAN1);
CAN_RCC_Configuration();
CAN_GPIO_Configuration();
CAN_NVIC_Configuration();
// device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x02);
// device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x03);
// device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x7DF);
// device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x200);
// device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x202);
// device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x20C);
//qiuadd
device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x1840FF20);//变速器当前档位
device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x1843FF20);//变速器总档??
device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x1844FF20);//变速成功与否的报文
device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x1845FF20);//变速器发送的故障报文
device_ioctl(IOCTL_CMD_CAN_FILTER_ADD, 0x1825FF20);//变速器心跳
device_ioctl(IOCTL_CMD_CAN_FILTER_INIT, 0);
// device_ioctl(IOCTL_CAN_SET_FILTER_ALL, 0);
CAN_Configuration();
can_tx.Head = 0;
can_tx.Tail = 0;
can_rx.Head = 0;
can_rx.Tail = 0;
CanEvent = IDLE;
kernel_device_status = TRUE;
return K_SUCCESS;
}
//param 第三个参数作??CAN_ID
KERNEL_TYPE int device_write(unsigned char *buff, unsigned int len, void *param)
{
int i = 0, pack_count = 0, less = 0;
CanTxMsg TxMessage;
KERNEL_CHECK_OPEN;
if (param == NULL)
{
return K_FAIL; //ID参数传入??
}
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
TxMessage.StdId = *((int *)param);
if (TxMessage.StdId > 0x7FF)
{
return K_FAIL; //ID不合??
}
#else
TxMessage.ExtId = *((int *)param);
if (TxMessage.ExtId > 0x1FFFFFFF)
{
return K_FAIL; //ID不合??
}
#endif
pack_count = len / 8;
less = len % 8;
for (i = 0; i < pack_count; i++)
{
TxMessage.DLC = 8;
TxMessage.IDE = CAN_ID_EXT; // 设置为扩展帧
TxMessage.RTR = CAN_RTR_DATA;
memcpy(TxMessage.Data, &(buff[i * 8]), 8);
WriteOneMessage(&TxMessage);
}
if (less)
{
TxMessage.DLC = less;
TxMessage.IDE = CAN_ID_EXT; // 设置为扩展帧
TxMessage.RTR = CAN_RTR_DATA;
memcpy(TxMessage.Data, &(buff[i * 8]), less);
WriteOneMessage(&TxMessage);
}
return K_SUCCESS;
}
KERNEL_TYPE int device_read(unsigned char *buff, unsigned int len, void *param)
{
CanRxMsg message;
int last_id = 0;
int next_id = 0;
int r_len = 0;
KERNEL_CHECK_OPEN;
if (param == NULL)
{
return K_FAIL;
}
if (GetOneMessage(&message) == K_FAIL)
{
return 0;
}
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
last_id = message.StdId;
#else
last_id = message.ExtId;
#endif
memcpy(buff, message.Data, message.DLC);
r_len += message.DLC;
*(int *)param = last_id;
while (r_len < len)
{
next_id = GetNextMailID();
if (next_id == K_FAIL)
{
return r_len;
}
if (next_id != last_id)
{
return r_len;
}
GetOneMessage(&message);
#if (CAN_FRAME_TYPE == CAN_FRAME_STD)
if (last_id != message.StdId)
{
return K_FAIL;
}
#else
if (last_id != message.ExtId)
{
return K_FAIL;
}
#endif
memcpy(&buff[r_len], message.Data, message.DLC);
r_len += message.DLC;
}
return r_len;
}
KERNEL_TYPE int device_ioctl(unsigned int cmd, unsigned long arg)
{
int Status = K_SUCCESS;
switch (cmd)
{
case IOCTL_CMD_CAN_FILTER_ADD:
Status = CAN_FilterAdd(arg);
break;
case IOCTL_CMD_CAN_FILTER_MASK_ADD:
Status = CAN_FilterMaskAdd(arg);
break;
case IOCTL_CMD_CAN_FILTER_INIT:
CAN_FilterEnable();
break;
case IOCTL_CAN_SET_FILTER_ALL:
CAN_FilterMaskEnable();
break;
case IOCTL_CAN_GET_NEXTMAILID:
return GetNextMailID();
break;
default:
return K_FAIL;
}
return Status;
}
KERNEL_TYPE int device_clsoe(void)
{
KERNEL_CHECK_OPEN;
kernel_device_status = FALSE;
CAN_DeInit(CAN1);
can_tx.Head = 0;
can_tx.Tail = 0;
can_rx.Head = 0;
can_rx.Tail = 0;
CanEvent = 0;
return K_SUCCESS;
}
KERNEL_TYPE const file_operations ops = {
/*open*/ device_open,
/*write*/ device_write,
/*read*/ device_read,
/*ioctl*/ device_ioctl,
/*close*/ device_clsoe,
};
register_driver(ops)

BIN
CanCommunication/eeprom_app.c

Binary file not shown.

BIN
CanCommunication/eeprom_app.h

Binary file not shown.

117
CanCommunication/kernel.c

@ -0,0 +1,117 @@
#include "kernel.h"
#undef __FILENAME__
#define __FILENAME__ "kernel.c"
// 设备内核
extern const unsigned char Image$$KERNEL_ROM$$Base;
extern char Image$$KERNEL_ROM$$Length[];
#define KERNEL_DEVICE_COUNT (((int)Image$$KERNEL_ROM$$Length) >> 2)
static int *kernel_map = (int *)(&Image$$KERNEL_ROM$$Base);
#define kernel_list(x) ((KENERAL_NODE *)(kernel_map[x]))
int open(char *filename, int flags)
{
int i = 0;
int status = K_FAIL;
for (i = 0; i < KERNEL_DEVICE_COUNT; i++)
{
if (strcmp(filename, kernel_list(i)->filename) == 0)
{
if (kernel_list(i)->ops->f_open == NULL)
{
return K_OPS_NULL;
}
status = kernel_list(i)->ops->f_open(flags);
if (status == K_SUCCESS)
{
return i;
}
else
{
return k_OPEN_FAIL;
}
}
}
return K_NOFOUND;
}
int write(int handle, unsigned char *buff, unsigned int len, void *param)
{
int status = K_FAIL;
if ((handle < KERNEL_DEVICE_COUNT) && (handle >= 0))
{
if (kernel_list(handle)->ops->f_write == NULL)
{
return K_OPS_NULL;
}
status = kernel_list(handle)->ops->f_write(buff, len, param);
return status;
}
return K_FAIL;
}
int read(int handle, unsigned char *buff, unsigned int len, void *param)
{
int status = K_FAIL;
if ((handle < KERNEL_DEVICE_COUNT) && (handle >= 0))
{
if (kernel_list(handle)->ops->f_read == NULL)
{
return K_OPS_NULL;
}
status = kernel_list(handle)->ops->f_read(buff, len, param);
return status;
}
return K_FAIL;
}
int ioctl(int handle, unsigned int cmd, unsigned long arg)
{
int status = K_FAIL;
if ((handle < KERNEL_DEVICE_COUNT) && (handle >= 0))
{
if (kernel_list(handle)->ops->f_ioctl == NULL)
{
return K_OPS_NULL;
}
status = kernel_list(handle)->ops->f_ioctl(cmd, arg);
return status;
}
return K_FAIL;
}
int close(int handle)
{
int status = K_FAIL;
if ((handle < KERNEL_DEVICE_COUNT) && (handle >= 0))
{
if (kernel_list(handle)->ops->f_close == NULL)
{
return K_OPS_NULL;
}
status = kernel_list(handle)->ops->f_close();
return status;
}
return K_FAIL;
}
int isopen(int handle)
{
int status = K_FAIL;
if ((handle < KERNEL_DEVICE_COUNT) && (handle >= 0))
{
if (kernel_list(handle)->ops->f_isopen == NULL)
{
return K_OPS_NULL;
}
status = kernel_list(handle)->ops->f_isopen();
return status;
}
return K_FAIL;
}

70
CanCommunication/kernel.h

@ -0,0 +1,70 @@
#ifndef __KERNEL_h
#define __KERNEL_h
#include "common.h"
#define kernel_section_name "kernel_xjm"
#define KERNEL_TYPE static
#define K_SUCCESS 0
#define K_FAIL -1 //执行错误
#define K_NOFOUND -2 //未找到
#define k_OPEN_FAIL -3 //设备存在,但打开失败
#define K_PARAM_ERR -4 //输入参数错误
#define K_UNOPEN -5 //设备未打开
#define K_OPS_NULL -6 //设备接口未实现
#define K_TIMEOUT -7 //执行超时
#define KERNEL_DEVICE_INIT(device_name) \
KERNEL_TYPE const char kernel_device_name[] = device_name; \
KERNEL_TYPE int kernel_device_status = FALSE;
#define KERNEL_CHECK_OPEN \
if (kernel_device_status == FALSE) return K_UNOPEN; \
//内核框架
typedef struct
{
int (*f_open)(int flags);
int (*f_write)(unsigned char *buff, unsigned int len, void *param);
int (*f_read)(unsigned char *buff, unsigned int len, void *param);
int (*f_ioctl)(unsigned int cmd, unsigned long arg);
int (*f_close)(void);
int (*f_isopen)(void);
} file_operations;
typedef struct
{
char *filename;
file_operations *ops;
} KENERAL_NODE;
#define register_driver(ops) \
static const KENERAL_NODE kernel_node = {(char *)kernel_device_name, (file_operations *)&ops}; \
static const int kernel_mem_node __attribute__((used, section(kernel_section_name))) = (int)&kernel_node;
int open(char *filename, int flags);
int write(int handle, unsigned char *buff, unsigned int len, void *param);
int read(int handle, unsigned char *buff, unsigned int len, void *param);
int ioctl(int handle, unsigned int cmd, unsigned long arg);
int close(int handle);
int isopen(int handle);
#endif

BIN
CanCommunication/mode_key.c

Binary file not shown.

9
CanCommunication/mode_key.h

@ -0,0 +1,9 @@
#ifndef __MODE_KEY_H
#define __MODE_KEY_H
#include "common.h"
void ModeKey_Init(void);
void ModeKey_Task(void);
#endif

64
CanCommunication/time.c

@ -0,0 +1,64 @@
#include "time.h"
#include "stm32f10x_tim.h"
#include "Parameter.h"
#define SysTickReLoadValue (SYSTEM_FREQUENCY / 1000)
uint16_t w1MsTickCnt = 0;
void SYSTICK_INIT(void)
{
SysTick->LOAD = SysTickReLoadValue - 1;
SysTick->VAL = SysTickReLoadValue - 1;
SysTick->CTRL = 0x00;
SysTick->CTRL |= 0x07;
}
void SysTick_Handler(void)
{
w1MsTickCnt++;
if (w1MsTickCnt >= MAX_TICK_VALUE)
{
w1MsTickCnt = 0;
}
}
uint16_t Get1MsTickVal(void)
{
return w1MsTickCnt;
}
uint16_t Get1MsTickInterval(uint16_t wLastTickVal)
{
uint16_t wCurTickVal;
uint16_t wTickInterval;
if (FOREMOST_TIME == wLastTickVal)
{
return MAX_INTERVAL;
}
if (LATTERMOST_TIME == wLastTickVal)
{
return MIN_INTERVAL;
}
wCurTickVal = w1MsTickCnt;
if (wCurTickVal >= wLastTickVal)
{
wTickInterval = wCurTickVal - wLastTickVal;
}
else
{
wTickInterval = (MAX_TICK_VALUE - wLastTickVal) + wCurTickVal;
}
return wTickInterval;
}
void Delay_ms(uint16_t ms)
{
uint16_t time = Get1MsTickVal();
while (Get1MsTickInterval(time) < ms);
}

21
CanCommunication/time.h

@ -0,0 +1,21 @@
#ifndef __TIME_H
#define __TIME_H
#include "common.h"
#define MAX_TICK_VALUE 0xfeff
#define FOREMOST_TIME 0xff00
#define LATTERMOST_TIME 0xff01
#define MIN_INTERVAL 0
#define MAX_INTERVAL MAX_TICK_VALUE
void SYSTICK_INIT(void);
uint16_t Get1MsTickVal(void);
uint16_t Get1MsTickInterval(uint16_t wLastTickVal);
void Delay_ms(uint16_t ms);
#endif

9
CanCommunication/user.h

@ -0,0 +1,9 @@
#ifndef __USER_H
#define __USER_H
#include "common.h"
#include "CanCycleSend_app.h"
#endif

BIN
Debug/anodebug.c

Binary file not shown.

BIN
Debug/anodebug.h

Binary file not shown.

BIN
Hardware/I2c.c

Binary file not shown.

BIN
Hardware/I2c.h

Binary file not shown.

BIN
Hardware/adc.c

Binary file not shown.

BIN
Hardware/adc.h

Binary file not shown.

0
Hardware/dam.h

BIN
Hardware/dma.c

Binary file not shown.

BIN
Hardware/gpio.c

Binary file not shown.

BIN
Hardware/gpio.h

Binary file not shown.

BIN
Hardware/timer1.c

Binary file not shown.

BIN
Hardware/timer1.h

Binary file not shown.

BIN
Hardware/timer17.c

Binary file not shown.

0
Hardware/timer17.h

BIN
Hardware/timer2.c

Binary file not shown.

BIN
Hardware/timer2.h

Binary file not shown.

BIN
Hardware/timer3.c

Binary file not shown.

BIN
Hardware/timer3.h

Binary file not shown.

BIN
Hardware/usart.c

Binary file not shown.

BIN
Hardware/usart.h

Binary file not shown.

BIN
Include/Common.h

Binary file not shown.

BIN
Include/Common_Type.h

Binary file not shown.

BIN
Include/HardwareInterface.h

Binary file not shown.

BIN
Include/info.h

Binary file not shown.

BIN
Include/main.h

Binary file not shown.

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save