Commit f9f41321 authored by 张金硕's avatar 张金硕

Merge branch 'jinshuo' into 'dev'

Jinshuo

See merge request !111
parents aa057fca 27c6e2fa
......@@ -9,9 +9,10 @@ Light_uint16_t LightR = 0u;
Light_uint16_t LightR_Status = 0;
Light_uint16_t LightR_Status_NCount = 0u;
Light_uint16_t LightR_Status_DCount = 0u;
Light_uint16_t NtcDataCount;
Light_uint8_t NtcDataCount;
__align(4) /* 四字节对齐 */
Light_uint16_t NtcData[LIGHT_DATA_NUM] = {0};
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t u8Lvl;
uint8_t Pos_Lamp_Sts;
......@@ -81,6 +82,7 @@ void BackLight_Back_PWM_Init(void)
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
}
__align(4) /* 四字节对齐 */
uint16_t NTCDegreesBoard[] =
{
550,
......@@ -95,6 +97,7 @@ uint16_t NTCDegreesBoard[] =
1000,
};
__align(4) /* 四字节对齐 */
uint16_t NTCResBoard[] =
{
27091,
......@@ -217,7 +220,7 @@ void BackLight_Get_curDuty(void)
wtemp *= 1;
wtemp += 700;
wtemp /= 10;
g_stBL.destFactor = wtemp;
g_stBL.destFactor = (uint8_t)wtemp;
/* 85°为70%占空比,60°为95%占空比, 1°大概为1% */
}
else if(NTCDegrees <= 880 )
......@@ -226,7 +229,7 @@ void BackLight_Get_curDuty(void)
wtemp *= 16;
wtemp += 200;
wtemp /= 10;
g_stBL.destFactor = wtemp;
g_stBL.destFactor = (uint8_t)wtemp;
/* 88°为20%占空比,85°为70%占空比, 1°大概为16.6% */
}
else if(NTCDegrees <= 900 )
......@@ -235,7 +238,7 @@ void BackLight_Get_curDuty(void)
wtemp *= 5;
wtemp += 100;
wtemp /= 10;
g_stBL.destFactor = wtemp;
g_stBL.destFactor = (uint8_t)wtemp;
/* 90°为10%占空比,88°为20%占空比, 1°大概为5% */
}
else
......@@ -320,7 +323,7 @@ void BackLight_Get_curDuty(void)
#endif
/* 计算具体应该多少占空比 */
g_stBL.u16TftdestDuty = ( uint32_t )(( uint32_t )tftBL * ( uint32_t )g_stBL.curFactor / ( uint32_t )100);
g_stBL.u16TftdestDuty = ( uint16_t )(( uint32_t )tftBL * ( uint32_t )g_stBL.curFactor / ( uint32_t )100);
/* 确保目标占空比不小于100 */
if(g_stBL.u16TftdestDuty < 100)
......@@ -450,7 +453,7 @@ void Data_Light_Res_service(Light_uint8_t deltaTime)//获取光感阻值,并
/* 背光等级回调函数 */
Light_uint8_t Backlight_GetPwmLevel(void)
{
Light_uint8_t Backlight_PwmLevel;
Light_uint8_t Backlight_PwmLevel = 0;
if(LightR > 0 && LightR <= 400)
{
......@@ -472,6 +475,10 @@ Light_uint8_t Backlight_GetPwmLevel(void)
{
Backlight_PwmLevel = 5U;
}
else
{
Backlight_PwmLevel = 5U;
}
return Backlight_PwmLevel;
}
......
......@@ -12,6 +12,8 @@ uint8_t LastCurIgnSt = POWER_STATE_IGN_OFF;
uint8_t IOState = 0;
_PICID_Struct PicObj;
_QRCODE_RECT QRCode_Rect;
__align(4) /* 四字节对齐 */
const uint8_t HJBlueToothName[9]= {"HJ750"};
uint8_t UUIDConfigBuf[21] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
//007502024092400000002
......@@ -71,7 +73,6 @@ void BlueToothService(void)
}
else
{
SetBluetoothCloseCount++;
if(GetBlueToothVaild == 1)
{
// if(SetBluetoothCloseCount < 30)
......@@ -86,7 +87,9 @@ void BlueToothService(void)
// SetBluetoothCloseCount++;
SetBluetoothTurnXX(0);
GetBlueToothVaild = 0;
SetBluetoothCloseCount = 0;
}
SetBluetoothCloseCount++;
if(SetBluetoothCloseCount >= 5)
{
SetBluetoothTurnXX(0);
......@@ -203,12 +206,13 @@ TEXT_STRUCT TextPara[TEXT_NUM_TOTAL] =
};
__align(4) /* 四字节对齐 */
uint8_t PhoneNumber[40];
uint8_t LastPhoneNumber[20];
uint8_t LastBlueToothPhoneName[100];
uint8_t CurBlueToothPhoneName[100];
uint8_t BlueToothName[40];
uint8_t LastBlueToothName[20];
uint8_t BlueToothName[60];
uint8_t LastBlueToothName[30];
uint8_t PhoneNumberTotal[20];
uint8_t InformationOSVersion[20];
uint8_t InformationMCUVersion[26];
......@@ -290,7 +294,7 @@ void TextService(void)
{
for (uint8_t i = 0; i < sizeof(BlueToothPhoneData.PhoneNumber); i++)
{
PhoneNumber[i * 2] = (uint8_t)(BlueToothPhoneData.PhoneNumber[i]);
PhoneNumber[i * 2] = BlueToothPhoneData.PhoneNumber[i];
PhoneNumber[(i * 2) + 1] = 0X00;
}
memcpy(LastPhoneNumber, BlueToothPhoneData.PhoneNumber, (sizeof(BlueToothPhoneData.PhoneNumber) / sizeof(BlueToothPhoneData.PhoneNumber[0])));
......
......@@ -17,13 +17,14 @@ typedef enum {
TEXT_NUM_TOTAL,
} TEXT_NUM_ENUM;
typedef struct {
typedef struct __attribute__((aligned(4)))
{
TEXT_NUM_ENUM TextNum;
uint16_t LableNum;
uint16_t Vaild;
}TEXT_STRUCT;
#define INFORMATION_VERSION_DATE "20241111"
#define INFORMATION_VERSION_DATE "20241129"
#define SW_EXTERNAL_VERSION "100"
#define POWER_STATE_IGN_OFF 0u
#define POWER_STATE_IGN_ON 1u
......@@ -48,7 +49,7 @@ extern _PICID_Struct PicObj;
extern _QRCODE_RECT QRCode_Rect;
extern uint8_t PhoneNumber[40];
extern uint8_t CurBlueToothPhoneName[100];
extern uint8_t BlueToothName[40];
extern uint8_t BlueToothName[60];
extern uint8_t PhoneNumberTotal[20];
extern uint8_t InformationOSVersion[20];
extern uint8_t InformationMCUVersion[26];
......
......@@ -36,6 +36,17 @@ void Can_Init(void)
*/
void Can_RX_Apply_Buff(void)
{
CAN_RecvMsg.DLC = 8;
CAN_RecvMsg.Data[0] = 0;
CAN_RecvMsg.Data[1] = 0;
CAN_RecvMsg.Data[2] = 0;
CAN_RecvMsg.Data[3] = 0;
CAN_RecvMsg.Data[4] = 0;
CAN_RecvMsg.Data[5] = 0;
CAN_RecvMsg.Data[6] = 0;
CAN_RecvMsg.Data[7] = 0;
CAN_RecvMsg.OverWriteConfig = 0;
CAN_RecvMsg.Id = 0x101;
CAN_RecvMsg.IDE = CAN_Id_Standard;
CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
......@@ -141,6 +152,16 @@ void Can_Tx_Apply_Buff(void)
// CAN_MessageCache_DeInit(CAN0MSG08);
// CAN_MessageCache_Init(CAN0MSG08, &CAN_SendMsg);
CAN_SendMsg_Diag_Tx.Data[0] = 0;
CAN_SendMsg_Diag_Tx.Data[1] = 0;
CAN_SendMsg_Diag_Tx.Data[2] = 0;
CAN_SendMsg_Diag_Tx.Data[3] = 0;
CAN_SendMsg_Diag_Tx.Data[4] = 0;
CAN_SendMsg_Diag_Tx.Data[5] = 0;
CAN_SendMsg_Diag_Tx.Data[6] = 0;
CAN_SendMsg_Diag_Tx.Data[7] = 0;
CAN_SendMsg_Diag_Tx.OverWriteConfig = 0;
CAN_SendMsg_Diag_Tx.Id = DIAG_ID_Tx;
CAN_SendMsg_Diag_Tx.IDE = CAN_Id_Standard;
CAN_SendMsg_Diag_Tx.CacheType = CAN_CacheType_Tx;
......
......@@ -21,7 +21,7 @@ Bus-off
#define RSCAN0_BUS_OFF_LV1_RECOVERY_TIME 90U
#define RSCAN0_BUS_OFF_LV2_RECOVERY_TIME 1000U
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t Status;
uint8_t Timer;
......
......@@ -41,8 +41,7 @@ uint8_t Common_Get_IG_Sts(void)
uint16_t Common_Get_Act_V_Speed(void)
{
uint32_t Act_V_Speed_ODO = Act_V_Speed;
return Act_V_Speed_ODO * 1005 / 1000;//需要跑大计测试
return Act_V_Speed;//需要跑大计测试
}
uint16_t Common_Get_Disp_V_Speed(void)
{
......@@ -51,7 +50,7 @@ uint16_t Common_Get_Disp_V_Speed(void)
uint16_t Common_Get_TireSize(void)
{
return 1u;
return 10020ul;
}
void Common_Set_IG_Sts(COMMON_PowerStatus_t Val)
......
......@@ -358,6 +358,7 @@ void Data_Coolant_Temp_Processing_Service ( void )
if(DataCoolantTemp.u8_ResStatus != DataCoolantTemp.u8_Last_ResStatus)
{
Lost_Time++;
time_temp = 0;
if(Lost_Time > 150)
{
DataCoolantTemp.u8_ResStatus = DataCoolantTemp.u8_Last_ResStatus;
......
......@@ -14,7 +14,7 @@
#define DATA_ESPEED_DAMPING_FACTOR 3 //阻尼系数
#define DATA_ESPEED_INC_STEP 30 //速度增加时慢加速速度变化步长
#define DATA_ESPEED_DEC_STEP 20 //方向改变时急减速速度变化步长
#define DATA_ESPEED_APPR_SPEED_MIN 20 //最小逼近速度
#define DATA_ESPEED_APPR_SPEED_MIN 180 //最小逼近速度
#define DATA_ESPEED_HYSTERESIS 80 //回差
/*** 控制结构 ***/
......
......@@ -12,6 +12,7 @@
#define FUEL_SEG_UP 0u
#define FUEL_SEG_DOWN 1u
__align(4) /* 四字节对齐 */
uint16_t g_u16FuelData[FUEL_DATA_NUM];
uint8_t g_u8FuelDataCount = 0u;
......
......@@ -11,7 +11,7 @@ uint16_t g_u16OilData[OIL_DATA_NUM];
uint8_t g_u8OilDataCount = 0u;
// uint8_t g_u8OILStateInitFlag = 0u;
uint16_t OilPressureR = 0u; /*滤波后的机油压力电阻,精度0.1*/
uint32_t OilPressureR = 0u; /*滤波后的机油压力电阻,精度0.1*/
uint8_t g_u8OilADCompleteFlg = 0u;
void Oil_Pressure_KL30_Init(void)
......
......@@ -313,14 +313,14 @@ uint32_t Get_Current_FaultCode(void)
uint8_t Get_Current_Hight_FaultCode(void)
{
uint8_t u8FaultHight = 0;
u8FaultHight = ((List_Display(&FaultCode_t))&(0xFF00))>>8;
u8FaultHight = (uint8_t)(((List_Display(&FaultCode_t))&(0x0000FF00))>>8);
return u8FaultHight;
}
uint8_t Get_Current_Mid_FaultCode(void)
{
uint8_t u8FaultMid = 0;
u8FaultMid = ((List_Display(&FaultCode_t))&(0x00FF));
u8FaultMid = (uint8_t)(((List_Display(&FaultCode_t))&(0x000000FF)));
return u8FaultMid;
}
......
......@@ -20,7 +20,7 @@ typedef struct __attribute__((aligned(4)))
uint32_t *code_list; //故障码列表
uint8_t hade; //列表头
uint8_t tail; //列表尾
uint8_t code_num; //获取的故障码数量
uint16_t code_num; //获取的故障码数量
uint8_t len; //故障码列表最大长度
uint8_t disp; //故障码显示下标
uint16_t TimeCount; //故障码循环显示用的定时器
......
......@@ -20,7 +20,7 @@ void Gpio_Init(_GpioUser_Enum InitMode)
RTE_GPIO_Config(RTE_GPIO_PORT00_PIN05, GpioOut_Low); //L_BiasBitSW 里程百位---
RTE_GPIO_Config(RTE_GPIO_PORT00_PIN06, GpioOut_Low); //L_BiasBitSW 里程千位---
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN00, GpioOut_Low); //表盘背光-PWM
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN00, RTE_GPIO_DIR_IN); //表盘背光-PWM
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN01, GpioOut_Low); //RXD-ESP-IN-MCU
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN02, GpioOut_Low); //TXD-ESP-IN-MCU
RTE_GPIO_Config(RTE_GPIO_PORT01_PIN03, RTE_GPIO_DIR_IN);
......
......@@ -32,14 +32,14 @@ typedef enum
HYS_OPERATE_SUCCESS = 0UL, /*函数操作成功*/
HYS_OPERATE_FAIL, /*函数操作失败*/
} HYS_Operate_Type_en_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
/*该段的下限值*/
Hys_uint16_t u16HYSSegLow;
/*该段的上限值*/
Hys_uint16_t u16HYSSegHigh;
} HYS_Seg_Table_st_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
/*参数分段属性表*/
const HYS_Seg_Table_st_t *pstHYSSegTable;
......@@ -50,7 +50,7 @@ typedef struct
/*1U:正序 0U:降序*/
Hys_uint8_t u8HYSSortBy;
} HYS_Attribute_st_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
/*物理量数量,也就是 HYS_NUM_MAX */
Hys_uint8_t u8HYSNum;
......
#include "MCU_Core_Protocol.h"
#include "Components.h"
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t SOC_St; /*系统启动状态 0启动中 1启动成功 2启动超时*/
uint8_t AnimStatus;
......@@ -9,7 +9,7 @@ typedef struct
uint8_t Restart;
} Core_Monitor_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t u8POPEn;
uint8_t u8BlueToothEn;
......
......@@ -9,8 +9,10 @@
*/
#include "Protocol_CRC16.h"
__align(4) /* 四字节对齐 */
static const Protocol_uint8_t CRC16_TAB_H [ 256 ] = {0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x01u, 0xC0u, 0x80u, 0x41u, 0x00u, 0xC1u, 0x81u, 0x40u};
__align(4) /* 四字节对齐 */
static const Protocol_uint8_t CRC16_TAB_L [ 256 ] = {0x00u, 0xC0u, 0xC1u, 0x01u, 0xC3u, 0x03u, 0x02u, 0xC2u, 0xC6u, 0x06u, 0x07u, 0xC7u, 0x05u, 0xC5u, 0xC4u, 0x04u, 0xCCu, 0x0Cu, 0x0Du, 0xCDu, 0x0Fu, 0xCFu, 0xCEu, 0x0Eu, 0x0Au, 0xCAu, 0xCBu, 0x0Bu, 0xC9u, 0x09u, 0x08u, 0xC8u, 0xD8u, 0x18u, 0x19u, 0xD9u, 0x1Bu, 0xDBu, 0xDAu, 0x1Au, 0x1Eu, 0xDEu, 0xDFu, 0x1Fu, 0xDDu, 0x1Du, 0x1Cu, 0xDCu, 0x14u, 0xD4u, 0xD5u, 0x15u, 0xD7u, 0x17u, 0x16u, 0xD6u, 0xD2u, 0x12u, 0x13u, 0xD3u, 0x11u, 0xD1u, 0xD0u, 0x10u, 0xF0u, 0x30u, 0x31u, 0xF1u, 0x33u, 0xF3u, 0xF2u, 0x32u, 0x36u, 0xF6u, 0xF7u, 0x37u, 0xF5u, 0x35u, 0x34u, 0xF4u, 0x3Cu, 0xFCu, 0xFDu, 0x3Du, 0xFFu, 0x3Fu, 0x3Eu, 0xFEu, 0xFAu, 0x3Au, 0x3Bu, 0xFBu, 0x39u, 0xF9u, 0xF8u, 0x38u, 0x28u, 0xE8u, 0xE9u, 0x29u, 0xEBu, 0x2Bu, 0x2Au, 0xEAu, 0xEEu, 0x2Eu, 0x2Fu, 0xEFu, 0x2Du, 0xEDu, 0xECu, 0x2Cu, 0xE4u, 0x24u, 0x25u, 0xE5u, 0x27u, 0xE7u, 0xE6u, 0x26u, 0x22u, 0xE2u, 0xE3u, 0x23u, 0xE1u, 0x21u, 0x20u, 0xE0u, 0xA0u, 0x60u, 0x61u, 0xA1u, 0x63u, 0xA3u, 0xA2u, 0x62u, 0x66u, 0xA6u, 0xA7u, 0x67u, 0xA5u, 0x65u, 0x64u, 0xA4u, 0x6Cu, 0xACu, 0xADu, 0x6Du, 0xAFu, 0x6Fu, 0x6Eu, 0xAEu, 0xAAu, 0x6Au, 0x6Bu, 0xABu, 0x69u, 0xA9u, 0xA8u, 0x68u, 0x78u, 0xB8u, 0xB9u, 0x79u, 0xBBu, 0x7Bu, 0x7Au, 0xBAu, 0xBEu, 0x7Eu, 0x7Fu, 0xBFu, 0x7Du, 0xBDu, 0xBCu, 0x7Cu, 0xB4u, 0x74u, 0x75u, 0xB5u, 0x77u, 0xB7u, 0xB6u, 0x76u, 0x72u, 0xB2u, 0xB3u, 0x73u, 0xB1u, 0x71u, 0x70u, 0xB0u, 0x50u, 0x90u, 0x91u, 0x51u, 0x93u, 0x53u, 0x52u, 0x92u, 0x96u, 0x56u, 0x57u, 0x97u, 0x55u, 0x95u, 0x94u, 0x54u, 0x9Cu, 0x5Cu, 0x5Du, 0x9Du, 0x5Fu, 0x9Fu, 0x9Eu, 0x5Eu, 0x5Au, 0x9Au, 0x9Bu, 0x5Bu, 0x99u, 0x59u, 0x58u, 0x98u, 0x88u, 0x48u, 0x49u, 0x89u, 0x4Bu, 0x8Bu, 0x8Au, 0x4Au, 0x4Eu, 0x8Eu, 0x8Fu, 0x4Fu, 0x8Du, 0x4Du, 0x4Cu, 0x8Cu, 0x44u, 0x84u, 0x85u, 0x45u, 0x87u, 0x47u, 0x46u, 0x86u, 0x82u, 0x42u, 0x43u, 0x83u, 0x41u, 0x81u, 0x80u, 0x40u};
/**
......
......@@ -30,7 +30,7 @@ Platform_16Bit
/**@struct Protocol_Data_t
* @brief 解析后的协议数据
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
Protocol_uint8_t FrameNo; /**< 帧序号 */
Protocol_uint8_t PowerSts; /**< 电源状态 */
......@@ -49,7 +49,7 @@ typedef void (*UARTClose)(void);
/**@struct Protocol_Func_t
* @brief 协议解析回调函数
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
UARTOpen UARTOpen_Cbk; /**< 串口打开回调 */
UARTSend UARTSend_Cbk; /**< 串口发送回调 */
......
......@@ -6,14 +6,14 @@
#define UART_RX_MAX_DEPTH (2 * 1024UL) // 4K
#define UART_DATA_BUF_LEN (2 * 1024UL) // 4K
typedef struct
typedef struct __attribute__((aligned(4)))
{
Protocol_uint32_t read_pos;
Protocol_uint32_t write_pos;
Protocol_uint8_t Rx_Buffer [ UART_RX_MAX_DEPTH ];
} UARTRxBuf_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
Protocol_uint32_t read_pos;
Protocol_uint32_t write_pos;
......@@ -22,6 +22,8 @@ typedef struct
static UARTRxBuf_t UARTRxBuf;
static UARTTxBuf_t UARTTxBuf;
__align(4) /* 四字节对齐 */
static Protocol_uint8_t mDataBufPtr [ UART_DATA_BUF_LEN ];
static Protocol_uint8_t Protocol_OpenUart(void);
......
......@@ -4,6 +4,7 @@
#include "Components.h"
#include "PicBin.h"
#include "GpioUser.h"
__align(4) /* 四字节对齐 */
//#include "AMT630H_Datas.h"
#define AMT630H_ERR_TIME 10000U
#define AMT630H_RELEASE_MODE 1U
......
......@@ -10,7 +10,7 @@ typedef enum
EM_FLASH_CHECK_RESULT_FAIL,
}EM_FLASH_CHECK_RESULT_T;
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t Flag;
uint32_t InquireTime;
......
#include "Components.h"
__align(4) /* 四字节对齐 */
uint8_t Pic_mode = PIC_DAYTIME_CH;
uint8_t g_u8Display_Mode = ModeDAY;
......@@ -33,7 +34,7 @@ void AMT630H_GUI_SETTING(void);
void AMT630H_GUI_Quit(void);
void AMT630H_GUI_Phone_Connect(void);
void AMT630H_GUI_Fault_Information(void);
void AMT630H_GUI_FaultCode(uint8_t FaultCodeLost);
static void AMT630H_GUI_FaultCode(uint8_t FaultCodeLost);
void AMT630H_GUI_Language_Information(void);
void AMT630H_GUI_Unit_Information(void);
void AMT630H_GUI_Display_Mode_Information(void);
......@@ -626,7 +627,7 @@ void AMT630H_GUI_Bluetooth_Information( uint8_t Connect_ON)
/*蓝牙名称改为字库显示*/
/* RGB 0 0 0 --- 黑*/
/* RGB 0XFF 0XFF 0XFF --- 白*/
PackedTransfer_LabelsList( 0x5022,(uint8_t *)BlueToothName, 40);
PackedTransfer_LabelsList( 0x5022,(uint8_t *)BlueToothName, 60);
SetPageText(GRAPHICS_PAGE_0, 0x5022, 570 , 165 , 200, ALIGN_LEFT, 0, TEXT_COLOR(0,0,0,0XFF),TEXT_LINE_OFFSET(1,1));
}
else if(g_u8Display_Mode == ModeNIGHT)
......@@ -671,7 +672,7 @@ void AMT630H_GUI_Bluetooth_Information( uint8_t Connect_ON)
/*蓝牙名称改为字库显示*/
/* RGB 0 0 0 --- 白*/
/* RGB 0XFF 0XFF 0XFF --- 黑*/
PackedTransfer_LabelsList( 0x5022,(uint8_t *)BlueToothName, 40);
PackedTransfer_LabelsList( 0x5022,(uint8_t *)BlueToothName, 60);
SetPageText(GRAPHICS_PAGE_0, 0x5022, 570 , 165 , 200, ALIGN_LEFT, 0, TEXT_COLOR(0XFF,0XFF,0XFF,0XFF),TEXT_LINE_OFFSET(1,1));
}
if(BlueToothPhoneData.BlueToothSignalSate == BlueTooth_Connection)
......@@ -2142,7 +2143,7 @@ void AMT630H_GUI_Bluetooth_Connect_Setting(Menu_Item_en_t select, uint8_t Connec
/*蓝牙名称改为字库显示*/
/* RGB 0 0 0 --- 黑*/
/* RGB 0XFF 0XFF 0XFF --- 白*/
PackedTransfer_LabelsList( 0x5022,(uint8_t *)BlueToothName, 40);
PackedTransfer_LabelsList( 0x5022,(uint8_t *)BlueToothName, 60);
SetPageText(GRAPHICS_PAGE_0, 0x5022, 570 , 165 , 200, ALIGN_LEFT, 0, TEXT_COLOR(0,0,0,0XFF),TEXT_LINE_OFFSET(1,1));
}
else if(g_u8Display_Mode == ModeNIGHT)
......@@ -2215,7 +2216,7 @@ void AMT630H_GUI_Bluetooth_Connect_Setting(Menu_Item_en_t select, uint8_t Connec
/*蓝牙名称改为字库显示*/
/* RGB 0 0 0 --- 黑*/
/* RGB 0XFF 0XFF 0XFF --- 白*/
PackedTransfer_LabelsList( 0x5022,(uint8_t *)BlueToothName, 40);
PackedTransfer_LabelsList( 0x5022,(uint8_t *)BlueToothName, 60);
SetPageText(GRAPHICS_PAGE_0, 0x5022, 570 , 165 , 200, ALIGN_LEFT, 0, TEXT_COLOR(0XFF,0XFF,0XFF,0XFF),TEXT_LINE_OFFSET(1,1));
}
......@@ -4266,7 +4267,21 @@ static void AMT630H_GUI_ODO(uint32_t ODO, uint8_t Uint)
DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT | 24;
DisplayNumPara.y = GROUP_PIC_USE_PSD_Y_POS;
DisplayNumPara.DecimalNum = 0;
if((ODONumber<1000000)&&(ODONumber>=100000))
if(ODONumber>=1000000)
{
ODONumber = 999999;
DisplayNumPara.x = 173;
DisplayNumPara.MinDigits = 6;
if(Uint == 0)
{
SetPagePic(GRAPHICS_PAGE_0, Pic_0580_211_324);/*KM*/
}
else
{
SetPagePic(GRAPHICS_PAGE_0, Pic_0861_211_324);/*mile*/
}
}
else if((ODONumber<1000000)&&(ODONumber>=100000))
{
DisplayNumPara.x = 173;
DisplayNumPara.MinDigits = 6;
......@@ -4356,13 +4371,27 @@ static void AMT630H_GUI_ODO(uint32_t ODO, uint8_t Uint)
SetPagePic(GRAPHICS_PAGE_0, Pic_0686_55_296);/*ODO图标不动*/
DISPLAY_NUM_ST DisplayNumPara;
uint16_t ODONumber;
uint32_t ODONumber;
ODONumber = ODO;
DisplayNumPara.NumList = NumbeList_ODO_NIGHT;
DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT | 24;
DisplayNumPara.y = GROUP_PIC_USE_PSD_Y_POS;
DisplayNumPara.DecimalNum = 0;
if((ODONumber<1000000)&&(ODONumber>=100000))
if(ODONumber>=1000000)
{
ODONumber = 999999;
DisplayNumPara.x = 173;
DisplayNumPara.MinDigits = 6;
if(Uint == 0)
{
SetPagePic(GRAPHICS_PAGE_0, Pic_0688_211_324);/*KM*/
}
else
{
SetPagePic(GRAPHICS_PAGE_0, Pic_0863_211_324);/*mile*/
}
}
else if((ODONumber<1000000)&&(ODONumber>=100000))
{
DisplayNumPara.x = 173;
DisplayNumPara.MinDigits = 6;
......
......@@ -456,9 +456,9 @@ typedef struct
uint8_t BlueToothSignalSate;
uint8_t BlueToothPhoneSate;//incall、outcall
uint8_t BlueToothPhoneName[100];
char PhoneNumber[20];
uint8_t PhoneNumber[20];
uint16_t PhoneBookTotalCount;
char BlueToothName[30];
uint8_t BlueToothName[30];
}_BlueToothPhoneData;
typedef struct
......
......@@ -22,7 +22,7 @@ extern {
#endif
/* Exported types ------------------------------------------------------------*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint32_t u32Res1;
uint32_t u32Res2;
......
......@@ -58,7 +58,7 @@ typedef enum
* @brief 报文接收属性结构体 \n
* 定义报接收文属性
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
canlib_uint8_t Init_Aarry [ 8u ]; /**< 报文初始化值.默认加载,未收到报文时,buffer内为该值 */
canlib_uint8_t TimeOut_Array [ 8u ]; /**< 报文掉线值.掉线后加载 */
......@@ -74,7 +74,7 @@ typedef struct
* @brief 报文发送属性结构体 \n
* 定义发送报文属性
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
canlib_uint32_t u32MsgID; /**< 报文发送ID */
canlib_uint32_t u32MsgCycle; /**< 报文发送周期,单位是us */
......@@ -91,7 +91,7 @@ typedef struct
* @brief 报文发送结构体 \n
* 定义报文发送结构的信息
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
canlib_uint32_t MsgID; /**< 报文发送ID */
canlib_uint8_t MsgStd; /**< 报文发送标准帧/扩展帧 */
......@@ -106,7 +106,7 @@ typedef canlib_uint8_t (*HAL_CAN_Send)(st_CAN_Msg *Msg);
* @brief 内部使用 \n
* 内容不明
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
canlib_uint8_t AnalyzeMsg [ 8u ];
canlib_uint8_t ReceiveBuf [ 8u ];
......@@ -120,7 +120,7 @@ typedef struct
* @brief 内部使用,不做讲解 \n
* 内部使用,不做讲解
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
st_CANMsgStruct *CAN_MSG_Analysis;
const st_CANMsgAttribute *pAttrubute;
......@@ -131,7 +131,7 @@ typedef struct
* @brief 内部使用,不做讲解 \n
* 内部使用,不做讲解
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
canlib_uint32_t u32MsgID;
canlib_uint32_t u32Timer;
......@@ -149,7 +149,7 @@ typedef struct
* @brief 内部使用,不做讲解 \n
* 内部使用,不做讲解
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
const st_CAN_SendAttribute *pCAN_SendAttribute;
st_CAN_SendOperation *CanMsg;
......
......@@ -36,7 +36,7 @@ typedef enum
AT24C16 = 16,
}DeviceNo_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
ee_uint32_t Odo;
ee_uint32_t Trip;
......
......@@ -17,14 +17,16 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//选择
{
case KEY_EVENT_SHORT_PRESS_1:
Key_Event_Short_Press_Left();
Key_Clear_Time();
break;
case KEY_EVENT_SHORT_PRESS_2:
break;
case KEY_EVENT_LONG_PRESS_1: //2
if((Get_Dis_OdoAndTrip() == 1) && (Get_ActualVechileSpeed() == 0))
{
Data_Clear_Trip(1);
Data_Clear_Trip(0);
}
Key_Clear_Time();
break;
case KEY_EVENT_LONG_PRESS_2: //3
break;
......@@ -63,11 +65,13 @@ void Key_Operation_Right(Key_Event_en_t enKeyEvent)//确认
RTC_SetTime(&counter_val.time);
}
Key_Event_Short_Press_Right();
Key_Clear_Time();
break;
case KEY_EVENT_SHORT_PRESS_2:
break;
case KEY_EVENT_LONG_PRESS_1: //2s
Key_Event_SHORT_PRESS_2_Right();
Key_Event_LONG_PRESS_1_Right();
Key_Clear_Time();
break;
case KEY_EVENT_LONG_PRESS_2: //3s
break;
......@@ -76,6 +80,7 @@ void Key_Operation_Right(Key_Event_en_t enKeyEvent)//确认
case KEY_EVENT_LONG_PRESS_4: //10s
TYW_RESET_ODO();
Get_Into_OTA_Update_Mode();
Key_Clear_Time();
break;
case KEY_EVENT_OFF_TO_ON:
break;
......@@ -341,7 +346,7 @@ void Key_Event_Short_Press_Right(void)//确认
}
}
void Key_Event_SHORT_PRESS_2_Right(void)
void Key_Event_LONG_PRESS_1_Right(void)
{
if((Get_DispVechileSpeed() >= 1990)&&(Get_DispEngineSpeed() >= 12000))
{
......@@ -449,18 +454,18 @@ void KEY_RIGHT_EVENT_NONE_Service(void)
void Key_Clear_Time(void)
{
if(Key_Status_Read_Left() == KEY_REALTIME_PRESS)
{
// if(Key_Status_Read_Left() == KEY_REALTIME_PRESS)
// {
MenuData.Back_Time_Left = 0;
MenuData.Back_Time_Left_Flag = 0;
MenuData.Back_Time_Right_Flag = 0;
}
if(Key_Status_Read_Right() == KEY_REALTIME_PRESS)
{
// MenuData.Back_Time_Left_Flag = 0;
// MenuData.Back_Time_Right_Flag = 0;
// }
// if(Key_Status_Read_Right() == KEY_REALTIME_PRESS)
// {
MenuData.Back_Time_Right = 0;
MenuData.Back_Time_Left_Flag = 0;
MenuData.Back_Time_Right_Flag = 0;
}
// }
}
uint8_t ClearODO_Flag = 0;
......
......@@ -5,7 +5,7 @@
#include "common.h"
#include "rtc.h"
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint16_t Back_Time_Left;
uint16_t Back_Time_Right;
......@@ -30,7 +30,7 @@ typedef enum
BackLight_Val_A,
}_BackLight_Val_Type;
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint16_t Back_Time_Left;
uint16_t Back_Time_Right;
......@@ -62,7 +62,7 @@ Key_Status_en_t Key_Status_Read_Left(void);
Key_Status_en_t Key_Status_Read_Right(void);
void Key_Event_Short_Press_Left(void);
void Key_Event_Short_Press_Right(void);
void Key_Event_SHORT_PRESS_2_Right(void);
void Key_Event_LONG_PRESS_1_Right(void);
void Key_Event_BackLight_Press_Left(void);
void Get_Into_OTA_Update_Mode(void);
void KEY_RIGHT_EVENT_NONE_Service(void);
......
......@@ -33,7 +33,7 @@ typedef Linelib_uint16_t (*LineIn_GetPowerMode)(void);
* @brief 硬线去抖属性结构体 \n
* 定义报接收文属性
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
Linelib_uint8_t DefaultLevel; /**< 初始电平 LEVEL_LOW /LEVEL_HIGH */
Linelib_uint8_t TriggerLevel; /**< 触发电平 LEVEL_LOW /LEVEL_HIGH */
......
......@@ -133,5 +133,6 @@ static Linelib_uint16_t LINE_GET_PWR(void)
void LINE_IN_Init(void)
{
memset(LINE_IN_Men,0,sizeof(LINE_IN_Men));
Line_In_KL30_WakeUp_Init(LINE_IN_Men, g_stLineInAttribute, LINE_IN_MAX, LINE_GET_PWR);
}
......@@ -37,9 +37,9 @@ Platform_16Bit
typedef enum
{
EM_TRIP_A,
EM_TRIP_B,
EM_TRIP_C,
EM_TRIP_D,
// EM_TRIP_B,
// EM_TRIP_C,
// EM_TRIP_D,
EM_TRIP_MAX,
} DataTripEnum_t;
......
......@@ -25,7 +25,7 @@ static void Data_User_EEPROM_Write(Data_EEPROM_Enum_t BlockID, uint32_t u32Data[
#define EEPROM_BLOCK_05 0xC0
#define EEPROM_BLOCK_06 0xE0
uint32_t Milleage_InitFlag = 0U;
/******************************************************************************
......@@ -41,6 +41,7 @@ void Data_User_Mileage_KL30Init(void)
Mileage_Func_t Func = {0};
ODO_Init_t ODOInit = {0};
Trip_Init_t TripInit[4] = {0};
Milleage_InitFlag = 0U;
(void)Data_User_EEPROM_Read(EM_MILEAGE_BLOCK, TempBuf, 1);
if (TempBuf[0] == 0xFFFFFFFF)
......@@ -54,7 +55,7 @@ void Data_User_Mileage_KL30Init(void)
Func.Get_Sys_IG_Sts = Common_Get_IG_Sts;
Func.Get_Act_V_Speed_Valid = Common_Get_Act_V_Speed_Valid;
Func.Get_Act_V_Speed = Common_Get_Act_V_Speed;
Func.Get_TireSize = (void *)0;
Func.Get_TireSize = Common_Get_TireSize;
Func.EEPromWrite_Cbk = Data_User_EEPROM_Write;
Data_Mileage_KL30_Init(DataMilleageBuf, &MileInit, &Func);
......@@ -67,7 +68,7 @@ void Data_User_Mileage_KL30Init(void)
{
ODOInit.Stamp = TempBuf[1];
}
if (TempBuf[1] == 0xFFFFFFFF)
if (TempBuf[2] == 0xFFFFFFFF)
{
ODOInit.Offset = 0;
}
......@@ -75,10 +76,10 @@ void Data_User_Mileage_KL30Init(void)
{
ODOInit.Offset = TempBuf[2];
}
ODOInit.MaxValue = 9999999;
ODOInit.MaxValue = 16099999;
Data_ODO_KL30_Init(DataODOBuf, &ODOInit, Func.EEPromWrite_Cbk);
(void)Data_User_EEPROM_Read(EM_TRIP_BLOCK, TempBuf + 3, 8);
(void)Data_User_EEPROM_Read(EM_TRIP_BLOCK, TempBuf + 3, 2);
if (TempBuf[3] == 0XFFFFFFFF)
{
TripInit[EM_TRIP_A].Stamp = 0;
......@@ -87,42 +88,58 @@ void Data_User_Mileage_KL30Init(void)
{
TripInit[EM_TRIP_A].Stamp = TempBuf[3];
}
TripInit[EM_TRIP_A].Offset = TempBuf[4];
TripInit[EM_TRIP_A].MaxValue = 99999; /* 最大999.9Mile 进行复位 */
if (TempBuf[4] == 0XFFFFFFFF)
{
TripInit[EM_TRIP_A].Offset = 0;
}
else
{
TripInit[EM_TRIP_A].Offset = TempBuf[4];
}
// TripInit[EM_TRIP_A].Offset = TempBuf[4];
TripInit[EM_TRIP_A].MaxValue = 16100; /* 最大999.9Mile 进行复位 */
TripInit[EM_TRIP_A].IsRestart = 1u;
TripInit[EM_TRIP_B].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_B].MaxValue = 99999;
TripInit[EM_TRIP_B].IsRestart = 1u;
// TripInit[EM_TRIP_B].Stamp = 0xFFFFFFFFu;
// TripInit[EM_TRIP_B].MaxValue = 99999;
// TripInit[EM_TRIP_B].IsRestart = 1u;
TripInit[EM_TRIP_C].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_C].MaxValue = 99999;
TripInit[EM_TRIP_C].IsRestart = 1u;
// TripInit[EM_TRIP_C].Stamp = 0xFFFFFFFFu;
// TripInit[EM_TRIP_C].MaxValue = 99999;
// TripInit[EM_TRIP_C].IsRestart = 1u;
TripInit[EM_TRIP_D].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_D].MaxValue = 99999;
TripInit[EM_TRIP_D].IsRestart = 1u;
// TripInit[EM_TRIP_D].Stamp = 0xFFFFFFFFu;
// TripInit[EM_TRIP_D].MaxValue = 99999;
// TripInit[EM_TRIP_D].IsRestart = 1u;
Data_Trip_KL30_Init(DataTripBuf, TripInit, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
Milleage_InitFlag = 0X5AA53AA3UL;
}
void Data_User_Mileage_WakeupInit(void)
{
Mileage_Func_t Func = {0};
Milleage_InitFlag = 0;
Func.Get_Sys_IG_Sts = Common_Get_IG_Sts;
Func.Get_Act_V_Speed_Valid = Common_Get_Act_V_Speed_Valid;
Func.Get_Act_V_Speed = Common_Get_Act_V_Speed;
Func.Get_TireSize = (void *)0;
Func.Get_TireSize = Common_Get_TireSize;
Func.EEPromWrite_Cbk = Data_User_EEPROM_Write; // ��ʱδ����
Data_Mileage_Wakeup_Init(DataMilleageBuf, &Func);
Data_ODO_Wakeup_Init(DataODOBuf, Func.EEPromWrite_Cbk);
Data_Trip_Wakeup_Init(DataTripBuf, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
Milleage_InitFlag = 0X5AA53AA3UL;
}
uint32_t Get_MileageInit_Status(void)
{
return Milleage_InitFlag;
}
static uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len)
{
......@@ -181,7 +198,7 @@ static void Data_User_EEPROM_Write(Data_EEPROM_Enum_t BlockID, uint32_t u32Data[
void Services_Mileage_Callback(void)
{
Data_Mileage_ISR();
// Data_Mileage_ISR();
Data_ODO_Processing();
Data_Trip_Processing();
Trip_Clear_Km_Service();
......@@ -218,15 +235,15 @@ uint32_t Get_Trip_Value(void)
uint32_t Trip = 0;
if (Get_Dis_Unit() == 0) /* 公制 */
{
Trip = Data_Read_Trip(EM_TRIP_B);
Trip = Data_Read_Trip(EM_TRIP_A);
}
else if (Get_Dis_Unit() == 1) /* 英制 */
{
Trip = Data_Km_To_Mile(Data_Read_Trip(EM_TRIP_B));
Trip = Data_Km_To_Mile(Data_Read_Trip(EM_TRIP_A));
}
else /* 无效值,按照公里处理,理论上不会执行到这 */
{
Trip = Data_Read_Trip(EM_TRIP_B);
Trip = Data_Read_Trip(EM_TRIP_A);
}
return Trip;
}
......@@ -239,7 +256,7 @@ void Trip_Clear_Km_Service(void)
{
if (Get_Dis_Unit() == 0) /* 公制 */
{
if (Data_Read_Trip(EM_TRIP_B) > 9999) /* 当前单位在KM时,里程大于999.9KM进行清零 */
if (Data_Read_Trip(EM_TRIP_A) > 9999) /* 当前单位在KM时,里程大于999.9KM进行清零 */
{
Data_Clear_Trip_All();
}
......
......@@ -35,45 +35,56 @@ void PwrMemInit(void)
PowerMemInit(&g_stPwrTasks);
}
static void Power_KL30_Init(void)
static void Power_KL30_Init(void) //588.6ms
{
// ClearODO_Flag = 0;
RTE_GPIO_Init(); //50us
Gpio_Init(Gpio_KL30_Init); //650us
UART_Channel_Config_st_t loc_config;
eeprom_StoreInfo_Init();
eeprom_StoreInfo_Init(); //50us
loc_config.u32UARTChEn = 1U;
loc_config.u32UARTbps = 115200U;
loc_config.pfnUARTConfirmCallBack = NULL;
loc_config.pfnUARTReadMsgCallBack = Amt630hUartRecvData;
UART_DeInit(UART2);
RTE_UART_Init(UART_CH2, &loc_config);
Common_DataInit();
Analog_Signal_Conv_Init();
Sys_KL30_Init();
Data_Vehicle_Speed_KL30_Wakeup_Init();
Data_Engine_Speed_KL30_Wakeup_Init();
LINE_IN_Init();
Key_KL30_Init_EXample();
Data_User_Mileage_KL30Init();
Fuel_KL30_Init();
Oil_Pressure_KL30_Init();
BackLight_30_Init();
Amt630hInit();
Telltales_Init();
UART_DeInit(UART2); //50us
RTE_UART_Init(UART_CH2, &loc_config); //68.35ms
Common_DataInit(); //50us
Analog_Signal_Conv_Init(); //150us
Sys_KL30_Init(); //275.55ms
Data_Vehicle_Speed_KL30_Wakeup_Init(); //50us
Data_Engine_Speed_KL30_Wakeup_Init(); //50us
LINE_IN_Init(); //50us+
Key_KL30_Init_EXample(); //50us
Data_User_Mileage_KL30Init(); //145.7ms
Fuel_KL30_Init(); //50us
Oil_Pressure_KL30_Init(); //50us
BackLight_30_Init(); //50us+
Amt630hInit(); //97.9ms
Telltales_Init(); //50us+
g_stRTCInformation.u8RTCSecond = 0;
g_stRTCInformation.u8RTCMinute = 0;
g_stRTCInformation.u8RTCHour = 0;
g_stRTCInformation.u8RTCDayOfMonth = 1;
g_stRTCInformation.u8RTCMonth = 1;
g_stRTCInformation.u8RTCYear = 20;
RTE_RTC_Init(g_stRTCInformation);
Menu_User_Init();
UDS_Startup_Init();
Can_Init();
Protocol_KL30_Wakeup_Init();
RTE_RTC_Init(g_stRTCInformation); //100us
Menu_User_Init(); //100us
UDS_Startup_Init(); //50us
Can_Init(); //300us
Protocol_KL30_Wakeup_Init(); //50us
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising);
FaultCode_Init();
TEMP_KL30_Init();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising); //50us+
FaultCode_Init(); //50us
TEMP_KL30_Init(); //50us
// g_u32ISRtime.g_u32Starttime = g_u32ISRtime.g_u32Ntime;
// g_u32ISRtime.g_u8IAsrtimesta = SysTick->VAL;
// g_u32ISRtime.g_u32Endtime = g_u32ISRtime.g_u32Ntime;
// g_u32ISRtime.g_u8IAsrtimeend = SysTick->VAL;
}
static void Power_Wakeup_Init(void)
......
......@@ -43,7 +43,7 @@ typedef Power_Status_em (*pfunc_Power_ON)(void);
typedef Power_Status_em (*pfunc_Power_SLEEP)(void);
typedef Power_Status_em (*pfunc_Power_LIM)(void);
typedef struct
typedef struct __attribute__((aligned(4)))
{
pfunPower_KL30_Init Pwr_KL30_Init;
pfunPower_IG_OFF_Init Pwr_IG_OFF_Init;
......
......@@ -11,7 +11,7 @@ typedef struct stRTESIICMasterHandler
uint8_t u8Busy;
uint8_t u8ReceivedACK;
uint16_t u16Rsvd;
}SIIC_M_Handler_st_t;
} __attribute__((aligned(4))) SIIC_M_Handler_st_t;
typedef enum
{
......
......@@ -47,7 +47,7 @@ typedef monitorlib_uint8_t (*Get_LineInStatus)(void);
typedef void (*COMMON_Delay)(monitorlib_uint32_t mMs);
typedef void (*pfunLogic)(void);
typedef struct
typedef struct __attribute__((aligned(4)))
{
Get_Voltage_Vaild SysGet_KL30_Valid;
Get_Voltage_Vaild SysGet_KL15_Valid;
......
......@@ -67,7 +67,7 @@ typedef Tellib_uint32_t (*LED_PowerOFFTimer)(void); /**< 指示灯IG OFF时间
* @brief 指示灯初始化结构体 \n
* 定义指示灯初始化结构体属性
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
Tellib_uint32_t TotalLength; /**< 指示灯总数量 */
LED_PowerOFFTimer LED_PowerOFF_TimerCbk; /**< IG OFF下计时时间戳回调函数 */
......@@ -78,7 +78,7 @@ typedef struct
* @brief 指示灯属性结构体 \n
* 定义指示灯结构体属性
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
Tellib_uint16_t LED_Index; /**< 指示灯序号 */
Tellib_uint16_t isSelfCheck; /**< 指示灯是否执行自检 */
......
......@@ -42,6 +42,7 @@ static void LED_E_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_S_Judgement(void);
static void LED_S_Execution(Tellib_uint16_t led_status);
uint8_t u8CanId401Flag = 0;
__align(4)
const LED_Attribute_st LED_Attribute [ LED_Max ] = {
/* 指示灯索引 是否自检 外部信号自检 工作电源状态 自检开始时间 自检持续时间 指示灯点亮条件 指示灯执行函数 */
......@@ -61,6 +62,7 @@ const LED_Attribute_st LED_Attribute [ LED_Max ] = {
{em_LED_Bluetooth, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Bluetooth_Judgement, LED_Bluetooth_Execution },
{em_LED_E, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_E_Judgement, LED_E_Execution },
};
__align(4)
Tellib_uint8_t Tel_Mem [ Tel_MEM_Block_Size * LED_Max + Tel_MEM_Block_Addition ];
void Telltales_Init(void)
{
......
......@@ -139,7 +139,7 @@ typedef enum
/**@struct RTE_GPIO_Config_st_t
* @brief GPIO端口的配置结构 \n
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint16_t u16PinNum; /**< GPIO端口编号(RTE_GPIO_PORTxx_PINyy) */
uint16_t u16PinMode; /**< GPIO工作模式 */
......
......@@ -160,7 +160,7 @@ void RTE_RTC_Init(RTC_Information_st_t g_stRTCInformation)
RTC_InitStructure.RTC_1HZ_Output = DISABLE; //RTC1HZ diable output
RTC_Init(&RTC_InitStructure);
ISR_Register(RTC_IRQn, rtc_interrupt); //RTC????��????��??��??��
// ISR_Register(RTC_IRQn, rtc_interrupt); //RTC????��????��??��??��
RTE_RTC_Start();
......
......@@ -37,7 +37,7 @@ typedef enum
} RTC_Alarm_Days_en_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t u8RTCYear; /*00~~99 in Dec*/
uint8_t u8RTCMonth; /*01~~12 in Dec*/
......
......@@ -3,10 +3,23 @@
#ifndef RTE_TICK_TIMER_H__
#define RTE_TICK_TIMER_H__
typedef struct __attribute__((aligned(4)))
{
uint32_t g_u32Starttime;
uint32_t g_u32Endtime;
uint32_t g_u32Ntime;
uint8_t g_u8IAsrtimesta;
uint8_t g_u8IAsrtimeend;
}g_TestISRtime;
/* Tick timer interrupt call back function */
typedef void (*RTE_Tick_Timer_Call_Back_ptr_t)(void);
extern void RTE_Tick_Timer_Start(uint32_t u32Interval, RTE_Tick_Timer_Call_Back_ptr_t pfnCallBack);
extern void RTE_Tick_Timer_Stop(void);
extern void RTE_SysTick_Handler(void);
extern g_TestISRtime g_u32ISRtime;
#endif /* RTE_TICK_TIMER_H__ */
......@@ -6,6 +6,8 @@
#define RTE_TICK_TIMER_CLK_SRC_FREQ (64000000UL)
#define RTE_SysTick_LOAD_RELOAD_Msk 0xFFFFFFUL
g_TestISRtime g_u32ISRtime;
RTE_Tick_Timer_Call_Back_ptr_t g_pfnRTETickTimerCallBackFunc = NULL;
uint32_t u8Value_us =0;
......
......@@ -19,7 +19,7 @@
#include "isr.h"
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint32_t u32Period[RTE_TIM40_PERIOD_FILTER_SUM];
uint32_t u32Freq;
......@@ -73,6 +73,7 @@ uint32_t RTE_ENGINE_Freq_Get(void)
return RTE_Frequency_Get(RTE_ENGINE_CAP_CH);
}
__align(4)
const uint32_t TIM4_Clock[16U] = {
64000000UL,
......
......@@ -10,7 +10,7 @@
#include "TrmerM.h"
typedef struct
typedef struct __attribute__((aligned(4)))
{
TIMERM_PWM_Counter_en_t counter; // 定时器选择
} Display_mode_Struct;
......
......@@ -10,7 +10,7 @@ void RTE_UART_Sleep_Init(UART_Channel_en_t enUARTCh);
/*******************************************************************/
/*******************************************************/
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint32_t u32UARTCount; /*发送计数*/
uint32_t u32UARTLEN; /*发送数据总长*/
......@@ -287,10 +287,11 @@ uint8_t UART_Ch3_Get_TX_Busy_Flag(void)
}
/* 一部代买码,暂时未使用,纯借鉴 */
#define MAX_SERIAL_BUFF_SIZE 4096
__align(4) /* 四字节对齐 */
uint8_t mwAmt630hSerialSendBuffer[MAX_SERIAL_BUFF_SIZE] = {0};
uint16_t mwAmt630hSerialDataIndex = 0;
uint16_t mwAmt630hSerialSendCnts = 0;
uint16_t mwAmt630hSerialSendFillCnts = 0;
uint32_t mwAmt630hSerialSendFillCnts = 0;
uint8_t mwAmt630hSerialSendValid = 0;
void mwAmt630hUartSendData(uint8_t *data, uint32_t length)
{
......@@ -324,7 +325,7 @@ void mwAmt630hUartSendIsr(void)
void mwAmt630hUartSendDatainit(void)
{
memset(mwAmt630hSerialSendBuffer,00,sizeof(mwAmt630hSerialSendBuffer));
memset(mwAmt630hSerialSendBuffer,0,sizeof(mwAmt630hSerialSendBuffer));
mwAmt630hSerialDataIndex = 0;
mwAmt630hSerialSendCnts = 0;
mwAmt630hSerialSendFillCnts = 0;
......
......@@ -17,7 +17,7 @@ typedef enum
typedef void (*UART_Confirm)(void);
typedef void (*UART_Read_Msg)(uint16_t u16UARTData);
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint32_t u32UARTChEn; /*通道是否使能*/
uint32_t u32UARTbps; /*通道实际波特率*/
......
#include <stddef.h>
#include "Sys_Scheduler_Lib.h"
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint32_t u32msRocBak;
uint32_t u32Task2msCnt;
......@@ -12,7 +12,7 @@ typedef struct
uint32_t u32Task100msCnt;
} Sys_Scheduler_st_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint32_t u32Pending;
uint32_t u32usCounter;
......
......@@ -23,12 +23,12 @@ void Sys_2ms_Tasks(void)
Check_MCU_Info_in_630H();
DoCAN_Timer_Update(2000u);
//Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 2000u);无外发
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp, 2u);
}
void Sys_5ms_Tasks(void)
{
Flash_Sync_Signal_Generation_Service();
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp, 5u);
}
void Sys_10ms_Tasks(void)
......@@ -38,7 +38,7 @@ void Sys_10ms_Tasks(void)
Line_In_Debounce_Service(10u);
My_Key_Service();
Data_Mileage_Write_EEPROM();
Key_Clear_Time();
// Key_Clear_Time();
Key_TimeOut_Service();
Fuel_R_Cal(10u);
Oil_R_Cal(10u);
......@@ -89,8 +89,11 @@ void Sys_100ms_Tasks(void)
// aaa = Menu_Item_Select_Get(MENU_ITEM_SELECT_AUTO);
}
static uint16_t task_2ms = 0u;
static uint16_t task_100ms = 0u;
// uint8_t g_u8GPIOTurnOver = 0U;
void Sys_Exact_50us_Tasks(void)
{
// g_u32ISRtime.g_u32Ntime ++;
static uint32_t task_1ms = 0u;
GenDelay_Tick();
////DoCAN_Timer_Update(50u);
......@@ -102,9 +105,31 @@ void Sys_Exact_50us_Tasks(void)
}
task_2ms++;
if (task_2ms >= 40)
if (task_2ms >= 40U)
{
task_2ms = 0;
task_2ms = 0U;
AMT630H_Timer(2);
}
task_100ms++;
if(task_100ms >= 2000U)
{
task_100ms = 0U;
if(Get_MileageInit_Status() == 0X5AA53AA3UL)
{
Data_Mileage_ISR();
}
}
// if(g_u8GPIOTurnOver)
// {
// PORT->PM0 &= ~(1<<3);
// PORT->PSET0 = (1<<3);
// g_u8GPIOTurnOver = 0U;
// Gen_TimeDelay(10000u, 50u);
// }
// else
// {
// PORT->PM0 &= ~(1<<3);
// PORT->PCLR0 = (1<<3);
// g_u8GPIOTurnOver = 1U;
// }
}
\ No newline at end of file
......@@ -65,10 +65,6 @@ void Sys_Startup_Pre_Init(void)
void Sys_Startup_Init(void)
{
uint8_t u8StartupMode = 0U;
RTE_WDT_Enable();
GenDelay_Init(RTE_WDT_Clear);
RTE_GPIO_Init();
Gpio_Init(Gpio_KL30_Init);
Gen_TimeDelay(10000u, 50u);
PwrMemInit( );
Power_Management_Init(u8StartupMode);
......@@ -80,6 +76,8 @@ void Sys_Startup_Init(void)
int main(void)
{
Sys_Startup_Pre_Init();
RTE_WDT_Enable();
GenDelay_Init(RTE_WDT_Clear);
Sys_Scheduler_Init();
Sys_Startup_Init();
......
......@@ -78,7 +78,7 @@ uint8_t MCU_HWversion[6] = {'H', 'V', (uint8_t)((HWV >> 8u) & 0x0Fu) + 0x30u, '.
uint8_t MCU_FBLversion[6] = {'B', 'V', (uint8_t)((BTV >> 8u) & 0x0Fu) + 0x30u, '.', (uint8_t)((BTV >> 4u) & 0x0Fu) + 0x30u, (uint8_t)(BTV & 0x0Fu) + 0x30u};
//零件号信息 F187
uint8_t MCU_PartNumber[12] = {'H', 'J', 'Y', 'B', '-', '7', '5', '0', '0', 'T', 'F', 'T'};
uint8_t MCU_PartNumber[20] = {'3', '7', '1', '0', '0', '0', '-', '7', '5', '0', '0', '-', '0', '2', 'T', 'Y', '0', '0', '0', '0'};
/* internal program info */
const uint8_t DID_1024[13] =
......@@ -671,11 +671,11 @@ void UDS_Service_22_Indication(uint16_t A_TA_type, uint16_t A_Length, uint8_t *A
break;
case 0xF187: // 读零件号
for (i = 0; i < 12; i++)
for (i = 0; i < 20; i++)
{
UDS_ISO14229_Transfer[i + 2] = MCU_PartNumber[i];
}
UDS_Service_Response(si, POSITIVE_RSP, DIAG_ID_Tx, 2 + 12, UDS_ISO14229_Transfer);
UDS_Service_Response(si, POSITIVE_RSP, DIAG_ID_Tx, 2 + 20, UDS_ISO14229_Transfer);
break;
case 0x5000U: // 读UUID
......
......@@ -29,12 +29,12 @@
/******************************************************************************
program version
*******************************************************************************/
#define SWV 0x109 // 0x100 = 1.00 software version 软件版本号
#define SWV 0x110 // 0x100 = 1.00 software version 软件版本号
#define HWV 0x120 // 0x100 = 1.00 hardware version 硬件版本号
#define BTV 0x105 // 0x100 = 1.00 bootloader version boot程序版本号
#define internal_version (109UL) /* 内部版本号 105 -> 1.05 */
#define internal_date (20241111UL) /* 内部版本日期 20240805 -> 2024.08.05 */
#define internal_version (110UL) /* 内部版本号 105 -> 1.05 */
#define internal_date (20241129UL) /* 内部版本日期 20240805 -> 2024.08.05 */
/**
*DFlash
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment